:root {
  color-scheme: light;
  --ink: #17172a;
  --muted: #66667f;
  --surface: #ffffff;
  --canvas: #f5f4fb;
  --line: #deddea;
  --violet: #5b49d6;
  --violet-dark: #4535b4;
  --violet-soft: #ece9ff;
  --mint: #e3f7ee;
  --green: #17795b;
  --amber: #fff2d8;
  --red: #ba3943;
  --shadow: 0 20px 48px rgba(45, 38, 92, 0.11);
  --radius: 20px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  background: radial-gradient(circle at 10% 10%, #efeaff 0, transparent 38%), #f8f7fd;
}
.login-story { padding: clamp(40px, 7vw, 110px); display: flex; flex-direction: column; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 800; font-size: 21px; letter-spacing: -0.02em; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; background: var(--violet); position: relative; box-shadow: 0 9px 24px #5b49d64a; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: white; top: 10px; }
.brand-mark::before { left: 9px; } .brand-mark::after { right: 8px; opacity: .58; }
.eyebrow { color: var(--violet); text-transform: uppercase; font-weight: 800; letter-spacing: .14em; font-size: 12px; }
.login-story h1 { font-size: clamp(44px, 6.4vw, 82px); letter-spacing: -.06em; line-height: .98; margin: 22px 0; max-width: 720px; }
.login-story p { color: var(--muted); font-size: 19px; line-height: 1.55; max-width: 630px; }
.speed-row { display: flex; gap: 12px; flex-wrap: wrap; }
.speed-pill { padding: 10px 14px; border: 1px solid var(--line); background: #ffffffa8; border-radius: 999px; color: var(--muted); font-size: 14px; }
.login-panel { display: grid; place-items: center; padding: 32px; background: linear-gradient(160deg, #5b49d6, #36258e); }
.login-card { width: min(480px, 100%); background: var(--surface); border-radius: 28px; box-shadow: 0 32px 90px #1b125c55; padding: clamp(30px, 5vw, 54px); }
.login-card h2 { margin: 0 0 8px; font-size: 31px; letter-spacing: -.035em; }
.login-card > p { color: var(--muted); margin: 0 0 30px; line-height: 1.5; }
.field { display: grid; gap: 8px; margin: 18px 0; }
.field label { font-size: 13px; font-weight: 760; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #cbc9dd; border-radius: 13px; padding: 13px 14px; background: white; color: var(--ink); }
.field input:focus, .field textarea:focus, .field select:focus { outline: 3px solid #5b49d629; border-color: var(--violet); }
.primary, .secondary, .ghost, .danger { border: 0; border-radius: 12px; padding: 11px 15px; font-weight: 760; }
.primary { background: var(--violet); color: white; box-shadow: 0 8px 20px #5b49d62d; }
.primary:hover { background: var(--violet-dark); }
.primary:disabled { opacity: .5; cursor: wait; }
.secondary { color: var(--violet); background: var(--violet-soft); }
.ghost { color: var(--muted); background: transparent; }
.danger { color: var(--red); background: #fdecee; }
.wide { width: 100%; padding: 14px 16px; }
.small { font-size: 13px; padding: 8px 11px; }
.login-note { font-size: 12px; color: var(--muted); margin-top: 20px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 236px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 18px; background: #fbfaff; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 30px; z-index: 4; }
.nav { display: grid; gap: 6px; }
.nav button { border: 0; border-radius: 13px; padding: 12px 14px; text-align: left; background: transparent; color: var(--muted); font-weight: 680; }
.nav button:hover, .nav button.active { color: var(--violet); background: var(--violet-soft); }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; }
.account-mini { padding: 12px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.account-mini strong, .account-mini span { display: block; }
.account-mini span { color: var(--muted); font-size: 12px; margin-top: 3px; }
.workspace { min-width: 0; }
.topbar { min-height: 76px; padding: 15px clamp(22px, 4vw, 54px); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #ffffffd9; backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; }
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar h1 { font-size: 18px; margin: 0; }
.office-select { border: 1px solid var(--line); background: white; border-radius: 11px; padding: 9px 34px 9px 11px; max-width: 260px; }
.concept-switcher { display: flex; align-items: center; gap: 6px; overflow-x: auto; }
.history-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 16px; padding-bottom: 2px; }
.history-tabs button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 9px 14px; font-weight: 750; white-space: nowrap; }
.history-tabs button.active { background: var(--violet); border-color: var(--violet); color: white; }
.concept-switcher a { padding: 8px 10px; border-radius: 10px; color: var(--muted); font-size: 12px; font-weight: 760; text-decoration: none; white-space: nowrap; }
.concept-switcher a.active { color: var(--violet); background: var(--violet-soft); }
.content { padding: clamp(24px, 4vw, 54px); max-width: 1540px; margin: 0 auto; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-intro h2 { font-size: clamp(32px, 4vw, 54px); letter-spacing: -.05em; margin: 4px 0 6px; }
.page-intro p { color: var(--muted); margin: 0; max-width: 660px; line-height: 1.55; }
.cache-badge { background: var(--mint); color: var(--green); border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.day-rail { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 10px; margin-bottom: 20px; }
.day-card { border: 1px solid var(--line); border-radius: 15px; background: white; padding: 13px 14px; text-align: left; min-height: 76px; }
.day-card strong, .day-card span { display: block; }
.day-card span { color: var(--muted); font-size: 12px; margin-top: 4px; }
.day-card.active { color: white; background: var(--violet); border-color: var(--violet); box-shadow: 0 12px 30px #5b49d636; }
.day-card.active span { color: #e7e3ff; }
.main-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .7fr); gap: 20px; align-items: start; }
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(46, 40, 84, .05); }
.surface-head { padding: 19px 21px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.surface-head h3 { margin: 0; font-size: 17px; }
.surface-body { padding: 18px 20px; }
.restaurant-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px; }
.restaurant-card { border: 1px solid var(--line); background: white; border-radius: 16px; padding: 16px; text-align: left; transition: transform .16s, border-color .16s, box-shadow .16s; }
.restaurant-card:hover { transform: translateY(-2px); border-color: #b9b2ef; box-shadow: 0 12px 24px #463bb514; }
.restaurant-card strong { display: block; line-height: 1.25; }
.restaurant-card span { color: var(--muted); display: block; margin-top: 7px; font-size: 12px; }
.restaurant-card .ordered { color: var(--green); font-weight: 800; }
.order-panel { position: sticky; top: 96px; overflow: hidden; }
.empty { padding: 34px 20px; color: var(--muted); text-align: center; line-height: 1.55; }
.order-item { padding: 15px 0; border-bottom: 1px solid var(--line); }
.order-item:last-child { border-bottom: 0; }
.order-item strong { display: block; }
.order-item p { color: var(--muted); font-size: 13px; margin: 5px 0 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.menu-list { display: grid; gap: 18px; }
.menu-section h3 { margin: 0 0 10px; }
.menu-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.menu-item { border: 1px solid var(--line); border-radius: 15px; background: white; padding: 14px; text-align: left; display: grid; gap: 8px; }
.menu-item:hover { border-color: var(--violet); }
.menu-item strong { line-height: 1.3; }
.price { color: var(--violet); font-weight: 820; }
.meta { color: var(--muted); font-size: 12px; }
.back-link { border: 0; background: transparent; color: var(--violet); font-weight: 760; padding: 0; }
.history-list, .record-list { display: grid; gap: 10px; }
.record { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: white; display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.record strong { display: block; }
.record p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.metric { border-radius: 16px; padding: 18px; background: var(--violet-soft); }
.metric strong { font-size: 26px; display: block; }
.metric span { color: var(--muted); font-size: 12px; }
.diagnostic { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); overflow: auto; }
.recommendation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.recommendation { border: 1px solid var(--line); border-radius: 16px; padding: 17px; display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; background: var(--surface); }
.recommendation h3 { margin: 9px 0 4px; font-size: 17px; }
.recommendation p { margin: 0 0 7px; color: var(--muted); font-size: 13px; }
.recommendation .primary { flex: 0 0 auto; }
.match-pill { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: var(--violet-soft); color: var(--violet); font-size: 10px; font-weight: 820; text-transform: uppercase; letter-spacing: .06em; }
.match-pill.exact-history { background: var(--mint); color: var(--green); }
.match-pill.semantic-history { background: var(--amber); color: #875210; }

.modal-wrap { position: fixed; inset: 0; background: #17132991; display: grid; place-items: center; padding: 18px; z-index: 20; }
.modal { width: min(680px, 100%); max-height: 88vh; overflow: auto; background: white; border-radius: 24px; box-shadow: 0 30px 90px #17132955; }
.modal-head { padding: 21px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; }
.modal-head h2 { margin: 0; font-size: 23px; }
.modal-body { padding: 20px 24px; }
.modal-foot { position: sticky; bottom: 0; padding: 16px 24px; background: #fffffff2; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.option { padding: 14px 0; border-bottom: 1px solid var(--line); }
.option:last-child { border-bottom: 0; }
.option-title { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); padding: 10px 11px; border-radius: 11px; font-size: 13px; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: grid; gap: 8px; }
.toast { max-width: 370px; background: var(--ink); color: white; border-radius: 13px; padding: 12px 15px; box-shadow: var(--shadow); }
.toast.error { background: var(--red); }
.skeleton { border-radius: 12px; min-height: 80px; background: linear-gradient(90deg, #efedf5 25%, #faf9fd 50%, #efedf5 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Concept 2: fast stacked mobile-first chooser */
.concept-quick-stack .shell { grid-template-columns: 86px 1fr; }
.concept-quick-stack .sidebar .brand span:last-child, .concept-quick-stack .nav button span, .concept-quick-stack .account-mini { display: none; }
.concept-quick-stack .nav button { text-align: center; font-size: 20px; padding: 13px 8px; }
.concept-quick-stack .main-grid { grid-template-columns: 1fr; max-width: 900px; }
.concept-quick-stack .order-panel { position: static; order: -1; }
.concept-quick-stack .restaurant-grid { grid-template-columns: 1fr; }

/* Concept 3: dense planner split view */
.concept-split-planner .content { max-width: none; padding: 28px; }
.concept-split-planner .main-grid { grid-template-columns: minmax(480px, 1fr) 390px; }
.concept-split-planner .restaurant-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.concept-split-planner .restaurant-card { min-height: 110px; }
.concept-split-planner .day-card { border-radius: 8px; }

/* Concept 4: command-center preview */
.concept-command-deck { --canvas: #10101b; --surface: #1a1a29; --ink: #f6f4ff; --muted: #aaa8bd; --line: #313145; --violet-soft: #30295b; }
.concept-command-deck .topbar, .concept-command-deck .sidebar { background: #151522e8; }
.concept-command-deck .surface, .concept-command-deck .restaurant-card, .concept-command-deck .day-card, .concept-command-deck .menu-item, .concept-command-deck .record, .concept-command-deck .recommendation, .concept-command-deck .account-mini { background: #1a1a29; }
.concept-command-deck .office-select { background: #202033; color: white; }
.concept-command-deck .modal { background: #1a1a29; color: #f6f4ff; }
.concept-command-deck .choice, .concept-command-deck .field input, .concept-command-deck .field textarea, .concept-command-deck .field select { background: #202033; color: #f6f4ff; }
.concept-command-deck .modal-foot { background: #1a1a29f2; }

/* Concept 5: calm editorial list */
.concept-calm-list { --canvas: #f6f1e8; --surface: #fffdf8; --line: #ddd4c6; --violet: #7f452f; --violet-dark: #613321; --violet-soft: #f2e1d5; }
.concept-calm-list .sidebar { background: #fffaf2; }
.concept-calm-list .restaurant-grid, .concept-calm-list .menu-items { grid-template-columns: 1fr; }
.concept-calm-list .restaurant-card, .concept-calm-list .menu-item { border-width: 0 0 1px; border-radius: 0; padding: 18px 4px; }
.concept-calm-list .surface { box-shadow: none; }

@media (max-width: 920px) {
  .login-page { grid-template-columns: 1fr; }
  .login-story { min-height: 390px; }
  .shell, .concept-quick-stack .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: auto 10px 10px; height: auto; padding: 8px; border: 1px solid var(--line); border-radius: 16px; flex-direction: row; box-shadow: var(--shadow); }
  .sidebar .brand, .sidebar-foot { display: none; }
  .nav { width: 100%; grid-template-columns: repeat(5, 1fr); }
  .nav button, .concept-quick-stack .nav button { text-align: center; padding: 10px 4px; font-size: 12px; }
  .nav button span { display: inline !important; }
  .content { padding-bottom: 110px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .concept-switcher { width: 100%; }
  .main-grid, .concept-split-planner .main-grid { grid-template-columns: 1fr; }
  .order-panel { position: static; order: -1; }
  .day-rail { overflow-x: auto; grid-template-columns: repeat(5, 145px); padding-bottom: 5px; }
}

@media (max-width: 620px) {
  .login-panel { padding: 18px; }
  .login-story { padding: 32px 24px; }
  .login-story h1 { font-size: 48px; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .page-intro { align-items: flex-start; flex-direction: column; }
  .restaurant-grid, .menu-items, .choice-grid, .metric-grid, .recommendation-grid, .concept-split-planner .restaurant-grid { grid-template-columns: 1fr; }
  .recommendation { align-items: flex-start; flex-direction: column; }
  .surface-head, .record { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
