/* TableTap staff dashboard: sidebar layout with one panel per section. */
:root {
  color-scheme: light;
  --ink: #1f2420;
  --muted: #6c7068;
  --paper: #faf7f1;
  --panel: #fffdf9;
  --white: #fff;
  --line: #ebe5d9;
  --green: #1f4d33;
  --green-hover: #163a26;
  --green-soft: #e6eedf;
  --leaf: #3d7a4f;
  --tomato: #c4361f;
  --tomato-soft: #fbe4df;
  --amber: #a75a12;
  --amber-soft: #fcebd6;
  --gold: #e0a526;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "DM Sans", sans-serif;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31,36,32,.04), 0 6px 18px rgba(31,36,32,.04);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f5f3f0;
  --muted: #a8a099;
  --paper: #1a1815;
  --panel: #252220;
  --white: #2a2520;
  --line: #3a3530;
  --green: #5fb87f;
  --green-hover: #70d494;
  --green-soft: #1f4d33;
  --leaf: #6dcc95;
  --tomato: #ff6b54;
  --tomato-soft: #7c1e12;
  --amber: #d9a554;
  --amber-soft: #3d2b1a;
  --gold: #f0c041;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin-top: 0; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.stack-gap { margin-bottom: 18px; }
.card-intro { margin: -8px 0 14px; }
.align-with-inputs { margin-top: 30px; }
.plain-fieldset { margin: 0; padding: 0; border: 0; }
.plain-fieldset legend, .field-label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 600; }
.icon { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }

/* Toast messages */
.status-message { position: fixed; z-index: 50; top: 16px; left: 50%; max-width: min(560px, calc(100% - 32px)); transform: translateX(-50%); padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--white); box-shadow: 0 12px 32px rgba(31,36,32,.14); font-size: 13px; line-height: 1.5; cursor: pointer; }
.status-message.error { border-color: #efc4b9; color: #8f2b1a; background: #fff6f3; }
.status-message.success { border-color: #c7d8c4; color: var(--green); background: #f4f8f2; }

/* Buttons and form controls */
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border: 0; border-radius: 9px; color: white; background: var(--green); font-size: 13px; font-weight: 700; }
.primary-button:hover { background: var(--green-hover); }
.primary-button:disabled { background: #a9b3a7; cursor: default; }
.secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--white); font-size: 13px; font-weight: 600; }
.secondary-button:hover { border-color: var(--green); color: var(--green); }
.link-button { padding: 0; border: 0; color: var(--green); background: none; font-weight: 700; }
label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--white); font-size: 14px; }
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31,77,51,.18); border-color: var(--green); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--tomato); outline-offset: 2px; }
.field-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.5; }

/* Sign-in screen */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-panel { width: min(420px, 100%); padding: 32px 30px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: var(--shadow); }
/* TableTap logo: dark lines in light mode, light lines in dark mode (the files are transparent). */
.tt-logo { display: inline-block; flex: none; aspect-ratio: 488 / 482; background: url("brand/tabletap-logo-light.png") center / contain no-repeat; }
html[data-theme="dark"] .tt-logo { background-image: url("brand/tabletap-logo-dark.png"); }
.login-logo { display: block; width: 104px; margin: 0 0 18px; }
.brand span { color: var(--leaf); }
.login-panel h1 { margin: 0 0 6px; font: 600 26px/1.2 var(--serif); }
.login-panel p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.form-stack { display: grid; gap: 14px; }
#mfa-code { font-family: "Courier New", monospace; font-size: 24px; letter-spacing: 8px; text-align: center; font-weight: 600; }
#mfa-form .form-stack { gap: 12px; }
#mfa-form .secondary-button { width: 100%; }
.totp-steps { margin: 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.totp-qr { display: grid; place-items: center; min-height: 120px; color: var(--muted); font-size: 13px; text-align: center; }
.totp-qr svg { width: min(220px, 100%); height: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.totp-key { display: grid; gap: 4px; margin: 0; text-align: center; }
.totp-key span { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.totp-key code { padding: 8px 10px; border-radius: 8px; background: #efebe3; color: var(--ink); font: 600 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .04em; word-break: break-all; user-select: all; }
#mfa-totp-code { font-family: "Courier New", monospace; font-size: 24px; letter-spacing: 8px; text-align: center; font-weight: 600; }
.setup-sign-out { width: 100%; margin-top: 12px; }
#mfa-blocked-text { color: var(--ink); }

/* App shell: the sidebar spans the full height beside the header and the section area. */
.app { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "side top" "side main"; }
.sidebar { grid-area: side; align-self: start; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 24px 16px; border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto; }
.brand { display: block; padding: 0 10px; color: var(--green); font: 700 32px/1.1 var(--serif); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.restaurant-chip { display: flex; align-items: center; gap: 9px; padding: 0 10px; color: var(--muted); font-size: 12px; }
.restaurant-chip .icon { font-size: 18px; color: var(--green); }
.restaurant-chip select { min-height: 32px; padding: 4px 8px; border-radius: 7px; font-size: 12px; font-weight: 600; }
.side-nav { display: grid; gap: 4px; }
.side-nav button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 0 12px; border: 0; border-radius: 10px; color: var(--ink); background: transparent; text-align: left; font-size: 14px; font-weight: 500; }
.side-nav button .icon { font-size: 19px; color: var(--muted); }
.side-nav button:hover { background: var(--green-soft); }
.side-nav button[aria-current="page"] { color: white; background: var(--green); font-weight: 700; }
.side-nav button[aria-current="page"] .icon { color: white; }
.nav-count { margin-left: auto; min-width: 22px; padding: 2px 7px; border-radius: 999px; color: white; background: var(--tomato); text-align: center; font-size: 11px; font-weight: 700; }
.side-links { display: grid; gap: 4px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.side-links a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 13px; text-decoration: none; }
.side-links a:hover { color: var(--green); background: var(--green-soft); }
.sidebar-powered { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; padding: 0 12px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.sidebar-powered .tt-logo { width: 40px; }
.mobile-logo { display: none; width: 34px; margin-right: 8px; }
.workspace { grid-area: main; min-width: 0; padding: 0 32px 64px; }
.app-topbar { grid-area: top; display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-height: 72px; padding: 0 32px; }
.account-wrap { position: relative; }
.mobile-brand { display: none; margin-right: auto; color: var(--green); font: 700 26px/1 var(--serif); text-decoration: none; }
.icon-button { position: relative; width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%; color: var(--ink); background: transparent; font-size: 21px; }
.icon-button:hover { background: var(--green-soft); }
.bell-dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border: 2px solid var(--paper); border-radius: 50%; background: var(--tomato); }
.avatar-button { width: 40px; height: 40px; border: 0; border-radius: 50%; color: white; background: var(--green); font-weight: 700; }
.account-menu { position: absolute; z-index: 20; top: 64px; right: 0; width: 260px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); box-shadow: 0 16px 36px rgba(31,36,32,.14); }
.account-menu p { margin: 0 0 4px; overflow-wrap: anywhere; font-size: 13px; }
.account-menu .account-role { margin-bottom: 12px; color: var(--muted); font-size: 12px; text-transform: capitalize; }
.account-menu .secondary-button { width: 100%; }

/* Section headings */
.section-panel { animation: fade-in .2s ease both; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 22px; }
.section-head h1 { margin: 0; font: 600 34px/1.1 var(--serif); }
.section-head p { margin: 6px 0 0; color: var(--muted); }
.head-select { width: auto; min-width: 170px; font-weight: 600; }
.card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.card-title { margin: 0 0 16px; font: 600 19px/1.3 var(--serif); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head .card-title { margin: 0; }
.empty-state { margin: 0; padding: 26px 16px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.6; }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.kpi-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 12px; color: var(--green); background: var(--green-soft); font-size: 24px; }
.kpi-value { margin: 0; font: 700 26px/1.1 var(--sans); overflow-wrap: anywhere; }
.kpi-label { margin: 2px 0 4px; color: var(--muted); font-size: 13px; }
.delta { font-size: 12px; font-weight: 700; }
.delta.up { color: var(--leaf); }
.delta.down { color: var(--tomato); }
.delta.flat { color: var(--muted); font-weight: 500; }
.stars { color: var(--gold); letter-spacing: 1px; }

/* Charts */
.split-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.bar-chart { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; height: 220px; }
.bar-axis { display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 22px; color: var(--muted); font-size: 11px; text-align: right; }
.bar-plot { display: flex; align-items: flex-end; gap: 6px; padding-bottom: 22px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0, transparent calc(25% - 1px), #f1ece2 calc(25% - 1px), #f1ece2 25%); background-size: 100% calc(100% - 22px); background-repeat: no-repeat; position: relative; }
.bar-col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar { width: min(70%, 26px); min-height: 2px; border-radius: 5px 5px 0 0; background: var(--green); }
.bar.empty { background: #ece6da; }
.bar-col span { position: absolute; bottom: -20px; color: var(--muted); font-size: 11px; }
/* Revenue trend: the SVG stretches to the card while labels and dots stay at a fixed size. */
.trend { display: grid; grid-template-columns: 60px minmax(0, 1fr); grid-template-rows: 240px 26px; column-gap: 12px; }
.trend-axis { display: flex; flex-direction: column; justify-content: space-between; margin: -8px 0; color: var(--muted); font-size: 12px; text-align: right; }
.trend-plot { position: relative; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to bottom, #f1ece2 0, #f1ece2 1px, transparent 1px, transparent 25%); }
.trend-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.trend-dot { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border: 2px solid var(--white); border-radius: 50%; background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.trend-labels { position: relative; color: var(--muted); font-size: 12px; }
.trend-labels span { position: absolute; top: 8px; transform: translateX(-50%); white-space: nowrap; }

/* Lists of ranked items */
.rank-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.rank-list li { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid #f3eee5; }
.rank-list li:last-child { border-bottom: 0; }
.rank-list img, .thumb-placeholder { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: #ece6da; }
.rank-list strong { font-weight: 600; }
.rank-list .rank-value { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* Tabs, filters and search */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.pill-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-tab { min-height: 38px; padding: 0 16px; border: 1px solid transparent; border-radius: 999px; color: var(--ink); background: transparent; font-size: 13px; font-weight: 600; }
.pill-tab:hover { background: var(--green-soft); }
.pill-tab[aria-selected="true"] { color: white; background: var(--green); }
.search-field { position: relative; width: min(280px, 100%); }
.search-field .icon { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); color: var(--muted); font-size: 16px; }
.search-field input { padding-left: 36px; }

/* Data tables; below 820px each row becomes a card. */
.table-card { padding: 0; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); background: #fbf8f2; text-align: left; font-size: 12px; font-weight: 600; white-space: nowrap; }
.data-table td { padding: 14px 16px; border-bottom: 1px solid #f3eee5; vertical-align: middle; font-size: 13px; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; white-space: nowrap; }
.data-table .muted { color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.row-actions button { min-height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--white); font-size: 12px; font-weight: 600; white-space: nowrap; }
.row-actions button:hover { border-color: var(--green); color: var(--green); }
.row-actions .danger:hover { border-color: var(--tomato); color: var(--tomato); }
.row-actions .accept { border-color: var(--green); color: white; background: var(--green); }
.row-actions .accept:hover { color: white; background: var(--green-hover); }
.dish-cell { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.dish-cell img, .dish-cell .thumb-placeholder { width: 44px; height: 44px; flex: none; border-radius: 9px; object-fit: cover; background: #ece6da; }
.order-type { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.order-type .icon { font-size: 18px; color: var(--muted); }
.order-items { line-height: 1.6; }
.waiter-select { width: auto; min-width: 140px; min-height: 34px; padding: 4px 8px; font-size: 12px; }
.price-flag { margin-left: 6px; color: var(--tomato); font-weight: 700; cursor: help; }
.warning-row td { padding-top: 0; }
.order-price-warning { padding: 10px 12px; border-left: 3px solid var(--tomato); border-radius: 0 8px 8px 0; background: #fbefeb; color: #7f2a1c; font-size: 12px; line-height: 1.6; }

/* Status pills */
.pill { display: inline-flex; align-items: center; min-height: 26px; padding: 0 11px; border-radius: 7px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill-new { color: var(--tomato); background: var(--tomato-soft); }
.pill-accepted, .pill-scheduled { color: var(--amber); background: var(--amber-soft); }
.pill-done, .pill-live { color: var(--green); background: var(--green-soft); }
.pill-muted { color: var(--muted); background: #efebe3; }

/* Reviews */
.review-summary { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 32px; align-items: center; margin-bottom: 18px; }
.review-score { min-width: 170px; text-align: center; }
.review-score strong { font: 700 52px/1 var(--sans); }
.review-score strong small { color: var(--muted); font-size: 18px; font-weight: 500; }
.review-score .stars { display: block; margin: 8px 0 6px; font-size: 22px; }
.review-score span:last-child { color: var(--muted); font-size: 13px; }
.rating-bars { display: grid; gap: 8px; }
.rating-bar { display: grid; grid-template-columns: 36px minmax(0, 1fr) 44px; gap: 12px; align-items: center; color: var(--muted); font-size: 13px; }
.rating-track { height: 8px; overflow: hidden; border-radius: 999px; background: #efeae1; }
.rating-fill { height: 100%; border-radius: 999px; background: var(--green); }
.rating-bar span:last-child { text-align: right; }
.review-list { display: grid; gap: 12px; }
.review-item { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; }
.review-avatar { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: white; font-weight: 700; }
.review-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.review-top strong { font-weight: 700; }
.review-top .muted { color: var(--muted); font-size: 12px; }
.review-item p { margin: 6px 0 0; line-height: 1.6; overflow-wrap: anywhere; }
.review-dish { margin-top: 4px; color: var(--muted); font-size: 12px; }

/* Promotions */
.promo-list { display: grid; gap: 14px; }
.promo-card { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.promo-card img, .promo-card .thumb-placeholder { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; }
.promo-card h3 { margin: 0 0 4px; font: 600 18px/1.3 var(--serif); }
.promo-meta { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.promo-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.promo-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; font-weight: 600; cursor: pointer; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch .track { width: 46px; height: 26px; padding: 3px; border-radius: 999px; background: #d9d3c6; transition: background .15s; }
.switch .track::after { content: ""; display: block; width: 20px; height: 20px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--tomato); outline-offset: 2px; }

/* Staff */
.staff-add { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.staff-add input { flex: 1; min-width: 200px; }
.team-add { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 10px; align-items: end; margin-top: 16px; }
.team-note { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.staff-add .tablet-kind { flex: none; width: auto; min-width: 150px; }
/* Audit trail */
.audit-tools { display: flex; gap: 10px; align-items: center; }
.audit-table td { vertical-align: top; }
.audit-when { white-space: nowrap; }
.audit-details { margin-top: 6px; font-size: 12px; }
.audit-details summary { color: var(--green); font-weight: 700; cursor: pointer; }
.audit-details ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.audit-details li { overflow-wrap: anywhere; }
.audit-details p { margin: 8px 0 0; overflow-wrap: anywhere; }
.audit-from { color: var(--tomato); }
.audit-to { color: var(--green); }
.audit-more { margin: 16px 0 0; text-align: center; }
.role-select { width: auto; min-width: 130px; min-height: 34px; padding: 4px 8px; font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }

/* AI assistant */
.ai-quick-prompts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ai-quick-prompts button { min-height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--white); font-size: 12px; font-weight: 600; }
.ai-quick-prompts button:hover { border-color: var(--green); color: var(--green); }
.ai-chat-log { display: flex; flex-direction: column; gap: 10px; min-height: 140px; max-height: 380px; overflow-y: auto; margin-bottom: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.ai-message { max-width: 82%; padding: 10px 13px; border-radius: 10px; font-size: 13px; line-height: 1.6; white-space: pre-line; }
.ai-message-user { align-self: flex-end; color: white; background: var(--green); }
.ai-message-assistant { align-self: flex-start; background: var(--green-soft); }
.ai-message-pending { color: var(--muted); font-style: italic; }
.ai-chat-form { display: flex; gap: 8px; }
.ai-chat-form input { flex: 1; }

/* Settings */
.settings-list { display: grid; gap: 12px; }
.settings-item { padding: 0; overflow: hidden; }
.settings-item summary { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 18px 20px; list-style: none; cursor: pointer; }
.settings-item summary::-webkit-details-marker { display: none; }
.settings-item summary .icon { font-size: 24px; color: var(--green); }
.settings-item summary strong { display: block; font-size: 15px; }
.settings-item summary span { color: var(--muted); font-size: 13px; }
.settings-item summary .chevron { font-size: 18px; color: var(--muted); transition: transform .15s; }
.settings-item[open] summary .chevron { transform: rotate(90deg); }
.settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 0 20px 20px 78px; }
.settings-form .full { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: 9px; margin: 0; font-weight: 500; }
.check-row input { width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: var(--green); }
.settings-links { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 20px 20px 78px; }

/* Theme colors */
.theme-colors-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.color-input-wrapper { display: flex; flex-direction: column; gap: 6px; }
.color-input-wrapper label { display: block; margin-bottom: 0; font-size: 12px; font-weight: 600; }
.color-input-group { display: flex; gap: 8px; align-items: center; }
.color-input-group input[type="color"] { width: 50px; height: 42px; min-height: 42px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; flex: none; }
.color-input-group input[type="text"] { flex: 1; font-family: ui-monospace, monospace; }

/* Dialogs */
dialog { width: min(720px, calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 0; border: 0; border-radius: 18px; color: var(--ink); background: var(--white); box-shadow: 0 24px 80px rgba(23,27,24,.3); }
dialog::backdrop { background: rgba(23,27,24,.55); }
.dialog-head { position: sticky; z-index: 1; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line); background: var(--white); }
.dialog-head h2 { margin: 0; font: 600 22px/1.2 var(--serif); }
.close-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: var(--white); font-size: 18px; }
.dialog-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 20px 24px; }
.dialog-form .full { grid-column: 1 / -1; }
.dialog-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--white); }
.check-grid { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.check-grid .check-row { font-size: 13px; }
.dish-checks { max-height: 180px; overflow-y: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; }
.photo-preview { width: min(100%, 320px); max-height: 180px; display: block; margin-top: 9px; object-fit: cover; border-radius: 10px; }
.starter-menu { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.starter-menu p { margin: 0; }

@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "top" "side" "main"; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar .brand, .side-links, .sidebar-powered { display: none; }
  .restaurant-chip { flex: none; padding: 0; }
  .side-nav { display: flex; gap: 4px; }
  .side-nav button { flex: none; width: auto; min-height: 38px; gap: 8px; padding: 0 12px; font-size: 13px; }
  .side-nav button .icon { font-size: 17px; }
  .app-topbar { min-height: 64px; padding: 0 16px; }
  .mobile-brand { display: block; }
  .mobile-logo { display: inline-block; }
  .workspace { padding: 0 16px 48px; }
  .account-menu { top: 58px; }
}
@media (max-width: 820px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .data-table td { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: center; padding: 5px 0; border: 0; text-align: left; }
  .data-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; }
  .data-table td.num { text-align: left; }
  .data-table td > * { justify-self: start; }
  .data-table td.no-label { display: block; }
  .data-table td.no-label::before { content: none; }
  .row-actions { justify-content: flex-start; }
  .warning-row { padding-top: 0 !important; }
  .review-summary { grid-template-columns: 1fr; gap: 18px; }
  .promo-card { grid-template-columns: 72px minmax(0, 1fr); }
  .promo-card img, .promo-card .thumb-placeholder { width: 72px; height: 72px; }
  .promo-controls { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
}
@media (max-width: 600px) {
  .section-head { flex-direction: column; align-items: stretch; }
  .section-head h1 { font-size: 28px; }
  .kpi-grid, .kpi-grid.three { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { grid-template-columns: 1fr; gap: 8px; padding: 14px; }
  .kpi-icon { width: 40px; height: 40px; font-size: 20px; }
  .kpi-value { font-size: 21px; }
  .card { padding: 16px; }
  .settings-form, .settings-links { grid-template-columns: 1fr; padding: 0 16px 16px; }
  .settings-item summary { padding: 16px; grid-template-columns: 32px minmax(0, 1fr) auto; }
  .theme-colors-grid { grid-template-columns: 1fr; }
  .dialog-form { grid-template-columns: 1fr; padding: 16px; }
  .dialog-head, .dialog-actions { padding: 14px 16px; }
  .team-add { grid-template-columns: 1fr; }
  .search-field { width: 100%; }
  .trend { grid-template-columns: 46px minmax(0, 1fr); grid-template-rows: 190px 26px; column-gap: 8px; }
  .trend-axis, .trend-labels { font-size: 11px; }
}

/* Menu CSV import */
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.dialog-body { display: grid; gap: 16px; padding: 20px 24px; }
.import-steps { display: grid; gap: 14px; margin: 0; padding-left: 20px; line-height: 1.55; }
.import-steps li::marker { color: var(--green); font-weight: 700; }
.link-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.link-row input[type="file"] { width: auto; max-width: 100%; padding: 8px; }
.column-guide { border: 1px solid var(--line); border-radius: 12px; }
.column-guide summary { padding: 12px 16px; font-weight: 600; cursor: pointer; }
.table-scroll { max-height: 260px; overflow: auto; border-top: 1px solid var(--line); }
.column-guide .data-table td, .column-guide .data-table th { padding: 8px 14px; font-size: 12px; }
.import-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.import-table { max-height: 320px; overflow: auto; }
.import-problem { display: block; margin-top: 3px; color: var(--tomato); font-size: 12px; font-weight: 500; }
.import-note { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.import-suggestion { display: block; margin-top: 3px; color: var(--amber); font-size: 12px; font-weight: 500; }
@media (max-width: 600px) { .dialog-body { padding: 16px; } .head-actions { width: 100%; } .head-actions button { flex: 1; } }

/* Waiter tablets: PIN dialog and the one-time setup code */
#pin-dialog { width: min(520px, calc(100% - 32px)); }
.form-problem { min-height: 18px; margin: 0; color: var(--tomato); font-size: 13px; font-weight: 600; }
.form-problem:empty { display: none; }
.setup-code-card { margin-bottom: 16px; padding: 20px 22px; border-color: var(--green); }
.setup-code-card p { margin: 0; }
.setup-code { margin: 8px 0 4px !important; font: 700 34px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .12em; color: var(--green); }
.data-table .check-row { font-size: 12px; white-space: nowrap; }
.setup-code-card a { color: var(--green); font-weight: 700; }
/* Items a diner asked to add to an order */
.addition-waiting { margin-top: 6px; padding: 6px 8px; border-radius: 8px; color: var(--amber); background: var(--amber-soft); font-size: 12px; line-height: 1.5; }
.row-actions button:disabled { opacity: .5; cursor: default; }

/* Plans: the owner's summary in Settings and the platform admin's Plan & features page */
.plan-feature-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 18px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.plan-feature-list li { display: flex; align-items: baseline; gap: 8px; }
.plan-feature-list li.on span:first-child { color: var(--green); font-weight: 700; }
.plan-feature-list li.off { color: var(--muted); }
.plan-feature-list .muted { font-size: 12px; }
.plan-form { display: grid; gap: 20px; padding: 22px; }
.plan-form fieldset { margin: 0; padding: 0; border: 0; }
.plan-form legend { margin-bottom: 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.plan-tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plan-tier { position: relative; display: grid; gap: 4px; margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); cursor: pointer; }
.plan-tier input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
.plan-tier strong { font-size: 15px; }
.plan-tier span { color: var(--muted); font-size: 12px; font-weight: 500; }
.plan-tier.selected { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-soft); }
.plan-tier:has(input:focus-visible) { outline: 2px solid var(--tomato); outline-offset: 2px; }
.plan-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; }
.plan-feature { align-items: flex-start; }
.plan-feature input { margin-top: 2px; }
.plan-feature span { display: grid; gap: 2px; }
.plan-feature strong { font-size: 13px; }
.plan-feature small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.4; }
@media (max-width: 760px) { .plan-tiers, .plan-features { grid-template-columns: 1fr; } }
