/* Chicago Dining — warm OpenTable-like PWA */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --bg: #f7f1ea;
  --bg-card: #fffdf9;
  --ink: #1c1410;
  --ink-2: #5c4f45;
  --ink-3: #8a7b6e;
  --line: rgba(28, 20, 16, 0.08);
  --accent: #c45c36;
  --accent-soft: rgba(196, 92, 54, 0.12);
  --accent-ink: #8f3a1f;
  --good: #2f6b4f;
  --good-soft: rgba(47, 107, 79, 0.12);
  --warn: #9a6b1f;
  --warn-soft: rgba(154, 107, 31, 0.14);
  --bad: #9b3b32;
  --bad-soft: rgba(155, 59, 50, 0.14);
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  --shadow: 0 1px 2px rgba(28, 20, 16, 0.04), 0 8px 24px rgba(28, 20, 16, 0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body { min-height: 100dvh; overflow-x: hidden; }
.hidden, [hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
ul { list-style: none; }
a { color: var(--accent-ink); }

.app { min-height: 100dvh; }

.top {
  position: sticky; top: 0; z-index: 30;
  padding: calc(12px + var(--safe-top)) calc(16px + var(--safe-right)) 12px calc(16px + var(--safe-left));
  background: rgba(247, 241, 234, 0.92);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.top-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.brand {
  font-size: 22px; font-weight: 700; letter-spacing: -0.4px;
}
.top--detail {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 10px;
}
.detail-title {
  flex: 1; font-size: 17px; font-weight: 600; letter-spacing: -0.2px;
  text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.spacer { width: 40px; }
.back-btn, .pill-btn, .icon-btn {
  border: none; background: transparent; cursor: pointer;
}
.back-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: var(--bg-card);
  border: 1px solid var(--line);
}
.back-btn:active { transform: scale(0.94); }
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px;
  background: var(--bg-card); border: 1px solid var(--line);
  font-size: 14px; font-weight: 600;
}
.pill-btn:active { opacity: 0.8; }
.pill-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 11px;
  display: inline-grid; place-items: center;
}

.search-wrap {
  position: relative; display: flex; align-items: center;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 14px; padding: 0 12px; margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.search-ico { color: var(--ink-3); flex-shrink: 0; }
.search-wrap input {
  flex: 1; border: none; background: transparent; outline: none;
  padding: 12px 10px; font-size: 16px; -webkit-appearance: none;
}
.clear-btn {
  border: none; background: transparent; color: var(--ink-3);
  font-size: 22px; line-height: 1; padding: 4px 2px; cursor: pointer;
}

.filters {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  margin-bottom: 8px;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; border: 1px solid var(--line); background: var(--bg-card);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600;
  color: var(--ink-2); cursor: pointer;
}
.chip--active {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.filter-row { display: flex; gap: 8px; }
.select {
  flex: 1; border: 1px solid var(--line); background: var(--bg-card);
  border-radius: 12px; padding: 9px 10px; font-size: 13px; font-weight: 500;
  color: var(--ink-2); -webkit-appearance: none; appearance: none;
}

.meta {
  padding: 10px 16px 4px; font-size: 13px; color: var(--ink-3); font-weight: 500;
}
.list { padding: 4px 12px calc(28px + var(--safe-bottom)); }
.card {
  display: block; width: 100%; text-align: left;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 14px 12px;
  margin-bottom: 10px; box-shadow: var(--shadow); cursor: pointer;
}
.card:active { transform: scale(0.99); }
.card-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.card-name { font-size: 17px; font-weight: 650; letter-spacing: -0.2px; }
.card-sub { margin-top: 3px; font-size: 13px; color: var(--ink-2); }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  font-size: 11px; font-weight: 650; letter-spacing: 0.02em;
  padding: 4px 8px; border-radius: 999px; background: rgba(28,20,16,0.06);
  color: var(--ink-2); text-transform: uppercase;
}
.tag--grab { background: var(--good-soft); color: var(--good); }
.tag--hogsalt { background: var(--accent-soft); color: var(--accent-ink); }
.tag--michelin { background: rgba(28,20,16,0.08); color: var(--ink); }
.tag--conf-high { background: var(--good-soft); color: var(--good); }
.tag--conf-medium { background: var(--warn-soft); color: var(--warn); }
.tag--conf-low { background: rgba(28,20,16,0.05); color: var(--ink-3); }
.tag--live-ready { background: var(--good-soft); color: var(--good); }
.tag--test-passed { background: rgba(31, 95, 122, 0.14); color: #1b5670; }
.tag--needs-test { background: var(--warn-soft); color: var(--warn); }
.tag--status { font-size: 11px; letter-spacing: 0.03em; }

.status-banner {
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
  box-shadow: var(--shadow); border: 1px solid transparent;
}
.status-banner-label {
  font-size: 15px; font-weight: 750; letter-spacing: -0.2px;
}
.status-banner-meta {
  margin-top: 3px; font-size: 13px; font-weight: 600;
}
.status-banner-result {
  margin-top: 8px; font-size: 13px; line-height: 1.45; font-weight: 500;
}
.status-banner--live-ready { background: var(--good-soft); color: var(--good); }
.status-banner--test-passed {
  background: rgba(31, 95, 122, 0.12); color: #163f52;
  box-shadow: inset 0 0 0 1px rgba(31, 95, 122, 0.25), var(--shadow);
}
.status-banner--test-passed .status-banner-result { color: #1b5670; }
.status-banner--needs-test { background: var(--warn-soft); color: var(--warn); }
.status-banner--needs-test .status-banner-result { color: #7a5619; }

.detail { padding: 8px 16px calc(100px + var(--safe-bottom)); }
.hero-block { margin-bottom: 18px; }
.hero-name { font-size: 28px; font-weight: 700; letter-spacing: -0.6px; line-height: 1.15; }
.hero-meta { margin-top: 6px; color: var(--ink-2); font-size: 15px; }
.section {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.section h3 {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px;
}
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { font-weight: 550; }
.notes { font-size: 14px; color: var(--ink-2); line-height: 1.45; margin-top: 8px; }
.platform-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; font-weight: 600;
  text-decoration: none; color: var(--ink);
}
.platform-link:first-of-type { border-top: none; padding-top: 0; }
.platform-link span { color: var(--ink-3); font-weight: 500; font-size: 13px; }

.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(247,241,234,0), rgba(247,241,234,0.95) 28%, var(--bg));
}
.primary-btn {
  display: block; width: 100%; border: none; border-radius: 14px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 650;
  padding: 15px; cursor: pointer; box-shadow: 0 8px 20px rgba(196, 92, 54, 0.28);
}
.primary-btn:active { opacity: 0.9; transform: scale(0.99); }
.primary-btn:disabled { opacity: 0.45; box-shadow: none; cursor: not-allowed; }
.secondary-btn {
  display: block; width: 100%; border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg-card); color: var(--ink); font-size: 15px; font-weight: 600;
  padding: 13px; cursor: pointer; margin-top: 8px;
}

/* Sheet */
.sheet {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(28, 20, 16, 0.4);
}
.sheet-panel {
  position: relative; width: 100%; max-width: 560px; max-height: 92dvh;
  overflow: auto; background: var(--bg-card);
  border-radius: 22px 22px 0 0; padding: 8px 18px calc(20px + var(--safe-bottom));
  box-shadow: 0 -12px 40px rgba(28,20,16,0.18);
}
.sheet-handle {
  width: 36px; height: 4px; border-radius: 999px; background: rgba(28,20,16,0.18);
  margin: 6px auto 14px;
}
.sheet-title { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.sheet-sub { color: var(--ink-2); font-size: 14px; margin: 4px 0 16px; }

.plan-form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.field input, .field select {
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  padding: 12px; font-size: 16px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.stepper {
  display: grid; grid-template-columns: 44px 1fr 44px; gap: 8px; align-items: center;
}
.stepper button {
  height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; font-size: 20px; font-weight: 600; cursor: pointer;
}
.stepper input { text-align: center; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.fire-preview {
  background: var(--accent-soft); border-radius: 14px; padding: 12px 14px;
  font-size: 14px; line-height: 1.45; color: var(--accent-ink);
}
.fire-preview strong { display: block; font-size: 15px; margin-bottom: 2px; color: var(--ink); }
.check {
  display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2);
}
.check input { margin-top: 2px; width: 18px; height: 18px; accent-color: var(--accent); }
.check em { font-style: normal; color: var(--ink-3); }

.arm-result {
  margin-top: 14px; padding: 12px; border-radius: 14px;
  background: #f3efe9; border: 1px solid var(--line); font-size: 13px;
}
.arm-result pre {
  margin-top: 8px; padding: 10px; border-radius: 10px; background: #1c1410; color: #f7f1ea;
  overflow-x: auto; white-space: pre-wrap; word-break: break-word; font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.copy-row { display: flex; gap: 8px; margin-top: 10px; }
.copy-row button {
  flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 10px; font-size: 13px; font-weight: 600; cursor: pointer;
}

.jobs-banner {
  margin: 12px 16px; padding: 12px 14px; border-radius: 14px;
  background: var(--warn-soft); color: var(--warn); font-size: 13px; line-height: 1.4;
}
.jobs-banner code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.jobs-list { padding: 0 12px calc(28px + var(--safe-bottom)); }
.job-card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.job-card h3 { font-size: 16px; font-weight: 650; }
.job-id { font-size: 12px; color: var(--ink-3); margin-top: 2px; font-family: ui-monospace, Menlo, monospace; }
.job-meta { margin-top: 8px; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.job-actions { display: flex; gap: 8px; margin-top: 12px; }
.job-actions button {
  flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 10px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.job-actions .danger { color: var(--bad); }
.empty { text-align: center; color: var(--ink-3); padding: 48px 24px; font-size: 15px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%); z-index: 80;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 550; box-shadow: var(--shadow);
  max-width: calc(100vw - 32px);
}

/* Key facts on venue detail */
.key-card { padding: 16px; }
.key-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.key-fact .key-label,
.key-rule-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px;
}
.key-fact .key-value {
  font-size: 17px; font-weight: 700; letter-spacing: -0.2px; line-height: 1.25;
}
.key-fact .key-sub {
  margin-top: 2px; font-size: 13px; font-weight: 550; color: var(--ink-2);
}
.key-rule {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2); font-weight: 550;
}
.key-empty { font-size: 14px; color: var(--ink-3); }

.details-fold { padding: 0; }
.details-fold > summary {
  list-style: none; cursor: pointer; padding: 14px;
  font-size: 14px; font-weight: 650;
  display: flex; align-items: center; justify-content: space-between;
  user-select: none;
}
.details-fold > summary::-webkit-details-marker { display: none; }
.details-fold > summary::after {
  content: ""; width: 8px; height: 8px;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: rotate(-45deg); margin-left: 8px; flex-shrink: 0;
  transition: transform 0.15s ease;
}
.details-fold[open] > summary::after { transform: rotate(45deg); }
.details-fold .fold-body { padding: 0 14px 14px; }
.details-fold .fold-body .kv { margin-bottom: 10px; }
.details-fold .fold-h {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3); margin: 14px 0 8px;
}
.details-fold .fold-h:first-child { margin-top: 0; }

/* Test vs Live toggle */
.mode-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
  background: rgba(28, 20, 16, 0.07); border-radius: 12px; padding: 3px;
}
.mode-toggle button {
  border: none; background: transparent; border-radius: 10px;
  padding: 11px 8px; font-size: 14px; font-weight: 650;
  color: var(--ink-2); cursor: pointer;
}
.mode-toggle button[aria-pressed="true"] {
  background: #fff; color: var(--good); box-shadow: 0 1px 3px rgba(28,20,16,0.14);
}
.mode-toggle button.mode-live[aria-pressed="true"] {
  background: var(--bad); color: #fff; box-shadow: 0 1px 3px rgba(155,59,50,0.35);
}
.mode-banner {
  border-radius: 12px; padding: 10px 12px;
  font-size: 13px; font-weight: 700; text-align: center; letter-spacing: 0.01em;
}
.mode-banner--test { background: var(--good-soft); color: var(--good); }
.mode-banner--live {
  background: var(--bad-soft); color: var(--bad);
  box-shadow: inset 0 0 0 1.5px var(--bad);
}
.primary-btn.primary-btn--live {
  background: var(--bad);
  box-shadow: 0 8px 20px rgba(155, 59, 50, 0.3);
}
.sheet--live .sheet-handle { background: var(--bad); }

.job-badge {
  display: inline-block; font-size: 11px; font-weight: 800;
  letter-spacing: 0.06em; padding: 3px 8px; border-radius: 999px;
  text-transform: uppercase; vertical-align: middle;
}
.job-badge--test { background: var(--good-soft); color: var(--good); }
.job-badge--live { background: var(--bad-soft); color: var(--bad); }
.job-card-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
.arm-result .job-badge { margin-bottom: 6px; }

/* Time wheels */
.wheels-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.time-wheel {
  position: relative; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden;
}
.time-wheel::before {
  content: ""; position: absolute; left: 6px; right: 6px; top: 50%;
  height: 36px; transform: translateY(-50%);
  background: var(--accent-soft); border-radius: 10px; pointer-events: none; z-index: 0;
}
.wheel-viewport {
  position: relative; z-index: 1;
  height: 108px; overflow-y: auto;
  scroll-snap-type: y mandatory; scroll-snap-stop: always;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 78%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 78%, transparent 100%);
  scrollbar-width: none;
}
.wheel-viewport::-webkit-scrollbar { display: none; }
.wheel-option, .wheel-pad {
  height: 36px; scroll-snap-align: center; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; color: var(--ink-3);
}
.wheel-option.is-active { color: var(--ink); font-size: 17px; font-weight: 700; }

@media (min-width: 720px) {
  .app { max-width: 560px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 100dvh; background: var(--bg); }
  body { background: #efe6dc; }
}
