:root {
  color-scheme: light;
  --font-display: 'Bricolage Grotesque', 'Trebuchet MS', sans-serif;
  --font-body: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ink: #1A2628;
  --soft: #4F5A5C;
  --muted: #78807F;
  --line: rgba(26, 38, 40, 0.10);
  --line-strong: rgba(26, 38, 40, 0.16);
  --surface: #FFFCF6;
  --page: #FAF6EE;
  --page-strong: #F4ECDA;
  --teal: #075859;
  --teal-deep: #054243;
  --teal-soft: rgba(7, 88, 89, 0.10);
  --teal-ink: #FAF6EE;
  --green: #3F6E55;
  --amber: #8a5b00;
  --red: #9f2d28;
  --radius-lg: 1.4rem;
  --radius-md: 1rem;
  --radius-sm: 0.7rem;
  --radius-pill: 999px;
  --shadow-soft: 0 18px 50px rgba(20, 32, 30, 0.08);
  --shadow-card: 0 14px 32px rgba(20, 32, 30, 0.06);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(7, 88, 89, 0.05), transparent 32%),
    linear-gradient(180deg, #FFFDF8 0%, var(--page) 52%, var(--page-strong) 100%);
  background-attachment: fixed;
  min-height: 100dvh;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; }

button {
  cursor: pointer;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  transition: background 140ms ease, border-color 140ms ease, transform 80ms ease, box-shadow 140ms ease;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn { min-height: 44px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-block { width: 100%; }
.btn-primary { border-color: var(--teal); background: var(--teal); color: var(--teal-ink); }
.btn-primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); }
.btn-muted { color: var(--soft); background: var(--surface); }
.btn-muted:hover { border-color: var(--teal); }
.danger-text { color: var(--red); }
.danger-text:hover { border-color: var(--red); }

input, select, textarea {
  min-height: 44px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 13px;
  background: #fff;
  color: var(--ink);
}
textarea { padding: 10px 13px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(7, 88, 89, 0.12);
}
/* Replace the OS-default dropdown arrow with a teal chevron so selects match the
   themed inputs (the native control looked out of place on the cream/teal UI). */
select {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23075859' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
}
select:disabled { cursor: not-allowed; opacity: 0.6; }
/* Tint native checkboxes/radios with the brand teal instead of the OS blue. */
input[type="checkbox"], input[type="radio"] { accent-color: var(--teal); }

.field { display: grid; gap: 6px; }
.field-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.hidden { display: none !important; }
.stack { display: grid; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

/* ── Brand mark ── */
.brand-badge { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; border-radius: 16px; }
.brand-badge--teal { width: 58px; height: 58px; background: var(--teal); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12); }
.brand-badge--ghost { width: 46px; height: 46px; background: rgba(255,255,255,0.12); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22); }
.brand-mark { width: 100%; height: 100%; object-fit: contain; transform: scale(1.22); }

/* ── Login view ── */
.login-view { min-height: 100dvh; display: grid; place-items: center; grid-template-rows: 1fr auto; padding: 28px 16px; }
.login-card {
  width: min(420px, 100%); align-self: center;
  display: grid; gap: 14px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); padding: 32px 28px; box-shadow: var(--shadow-soft);
}
.login-brand { display: grid; justify-items: center; gap: 8px; margin-bottom: 6px; }
.login-wordmark { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; color: var(--teal-deep); }
.login-wordmark span { font-weight: 800; }
.login-eyebrow { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.login-error { margin: 0; border-radius: var(--radius-sm); border: 1px solid #efc2bf; background: #fdebea; color: var(--red); padding: 9px 12px; font-size: 0.85rem; font-weight: 600; text-align: center; }
.login-onboarding { margin: 0; border-radius: var(--radius-sm); border: 1px solid #ead39b; background: #fff7e3; color: var(--amber); padding: 10px 12px; font-size: 0.84rem; }
.token-fallback summary { cursor: pointer; color: var(--muted); font-size: 0.8rem; font-weight: 600; text-align: center; }
.token-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }
.login-footer { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.08em; }

/* ── App shell ── */
.app-shell { min-height: 100dvh; }
.op-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); height: 100dvh;
  display: flex; flex-direction: column; padding: 22px 16px;
  background: linear-gradient(160deg, var(--teal) 0%, var(--teal-deep) 100%);
  color: var(--teal-ink); z-index: 30;
}
.op-brand { display: flex; align-items: center; gap: 12px; background: transparent; border: 0; padding: 4px; margin-bottom: 22px; color: inherit; text-align: start; }
.op-brand-text { display: grid; }
.op-wordmark { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.op-wordmark span { font-weight: 800; }
.op-tagline { font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(250,246,238,0.7); margin-top: 2px; }
.op-nav { display: grid; gap: 4px; }
.op-nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px;
  background: transparent; border: 0; border-radius: 12px; color: rgba(250,246,238,0.82);
  font-weight: 600; text-align: start; position: relative;
}
.op-nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.op-nav-item:hover { background: rgba(255,255,255,0.08); border-color: transparent; }
.op-nav-item.active { background: rgba(255,255,255,0.15); color: #fff; }
.op-nav-item.active::before { content: ''; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: #fff; }
.op-nav-badge { margin-inline-start: auto; min-width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; border-radius: var(--radius-pill); background: #d8584a; color: #fff; font-size: 0.7rem; font-weight: 800; }
.op-sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.14); display: grid; gap: 8px; }
.op-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.op-user-avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.16); font-weight: 800; font-size: 0.85rem; text-transform: uppercase; flex-shrink: 0; }
.op-user-name { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-signout { background: transparent; border: 1px solid rgba(255,255,255,0.22); color: rgba(250,246,238,0.92); min-height: 38px; border-radius: 10px; font-size: 0.82rem; }
.op-signout:hover { border-color: #fff; }

.nav-toggle { display: none; position: fixed; top: 14px; left: 14px; z-index: 40; width: 42px; height: 42px; border-radius: 12px; background: var(--teal); color: #fff; border: 0; font-size: 1.1rem; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(13,32,30,0.45); z-index: 25; }

.op-main { margin-inline-start: var(--sidebar-w); padding: 28px clamp(18px, 3vw, 40px) 64px; max-width: calc(var(--sidebar-w) + 1280px); }
.op-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.op-pagehead h1 { font-size: clamp(1.6rem, 2.4vw, 2.1rem); }
.op-subtitle { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.op-pagehead-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.op-page { display: grid; gap: 20px; }
.op-cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: 20px; align-items: start; }

/* ── Panels ── */
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 22px; box-shadow: var(--shadow-card); }
.panel-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-head h2 { font-size: 1.15rem; }
.panel-head p { margin-top: 3px; color: var(--muted); font-size: 0.85rem; }
.panel-note { margin-top: 10px; color: var(--muted); font-size: 0.8rem; }

/* ── KPI cards ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); padding: 18px 20px; box-shadow: var(--shadow-card); }
.kpi-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-family: var(--font-display); font-weight: 700; font-size: 2rem; line-height: 1.1; margin-top: 8px; color: var(--ink); }
.kpi-sub { margin-top: 6px; font-size: 0.82rem; color: var(--soft); }
.kpi.accent { background: linear-gradient(150deg, rgba(7,88,89,0.96), rgba(5,66,67,0.94)); color: var(--teal-ink); border-color: transparent; }
.kpi.accent .kpi-label, .kpi.accent .kpi-sub { color: rgba(250,246,238,0.78); }
.kpi.accent .kpi-value { color: #fff; }
.kpi.warn .kpi-value { color: var(--red); }

/* ── At-risk + funnel ── */
.atrisk-list { display: grid; gap: 8px; }
.atrisk-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 13px; }
.atrisk-row strong { display: block; }
.atrisk-row span { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.funnel { display: grid; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 92px 1fr auto; align-items: center; gap: 10px; }
.funnel-label { font-size: 0.82rem; font-weight: 600; color: var(--soft); text-transform: capitalize; }
.funnel-svg { display: block; width: 100%; height: 12px; }
.funnel-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.empty-pad { padding: 18px 0; }
.mrr-chart { display: block; width: 100%; height: 120px; }
.trend-axis, .trend-dates { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); }
.trend-dates { margin-top: 6px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table-wrap.narrow table { min-width: 0; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }
.th-sub { display: block; margin-top: 2px; font-size: 0.64rem; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--muted); }
tbody tr:hover { background: rgba(7, 88, 89, 0.04); }
tr:last-child td { border-bottom: 0; }
td span { display: block; margin-top: 3px; color: var(--muted); font-size: 0.82rem; }
td .badge { display: inline-flex; margin: 0; }
.empty { color: var(--muted); text-align: center; }

.row-action { display: inline-block; min-height: 32px; margin-top: 6px; padding: 0 12px; font-size: 0.8rem; }
.row-action.accent { border-color: var(--teal); color: var(--teal); font-weight: 700; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline-reset { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline-reset input { min-height: 32px; padding: 0 8px; font-size: 0.8rem; min-width: 160px; }
.lead-status, .ticket-status { width: auto; min-width: 130px; min-height: 36px; }

/* list toolbar — search + status chips. Keeps the data-heavy tabs (leads,
   restaurants, billing, support) navigable as the fleet/funnel grows. */
.list-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--page-strong); border: 1px solid var(--line); border-radius: var(--radius-pill); }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 13px; border: 0; background: transparent; border-radius: var(--radius-pill); color: var(--soft); font: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active { background: var(--surface); color: var(--teal); box-shadow: var(--shadow-card); }
.seg-count { font-size: 0.74rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg-btn.is-active .seg-count { color: var(--teal); }
.list-search { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 220px; max-width: 340px; min-width: 190px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); }
.list-search:focus-within { border-color: var(--teal); }
.list-search svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.list-search input { flex: 1; min-width: 0; min-height: 38px; padding: 0; border: 0; background: transparent; font: inherit; font-size: 0.88rem; color: var(--ink); -webkit-appearance: none; appearance: none; }
.list-search input:focus { outline: none; }
/* Strip the native WebKit search chrome (the grey "cancel" circle/× and results
   magnifier) — the pill already has its own magnifier icon, and the native
   decoration rendered as an odd inner circle on focus/typing. */
.list-search input::-webkit-search-cancel-button,
.list-search input::-webkit-search-decoration,
.list-search input::-webkit-search-results-button,
.list-search input::-webkit-search-results-decoration { -webkit-appearance: none; appearance: none; display: none; }
.list-count { margin: 0 0 12px; color: var(--muted); font-size: 0.8rem; }
.head-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.head-tools .list-search { flex: 0 1 240px; }

/* leads — sectioned pipeline cards */
.leads-list { display: flex; flex-direction: column; gap: 22px; }
.lead-group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lead-group-head h3 { margin: 0; font-size: 0.95rem; color: var(--ink); }
.lead-group-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--radius-pill); background: var(--page-strong); color: var(--soft); font-size: 0.76rem; font-weight: 700; }
.lead-group-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 12px; }
.lead-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.lead-card--new { border-color: rgba(7, 88, 89, 0.30); background: rgba(7, 88, 89, 0.05); }
.lead-card--converted { border-color: rgba(63, 110, 85, 0.34); }
.lead-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.lead-card-id strong { font-size: 0.95rem; color: var(--ink); }
.lead-card-contact { display: block; margin-top: 3px; color: var(--muted); font-size: 0.82rem; }
.lead-card-time { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.lead-card-restaurant { color: var(--soft); font-size: 0.85rem; font-weight: 600; }
.lead-card-msg { margin: 0; color: var(--soft); font-size: 0.85rem; white-space: normal; }
.lead-card-won { margin: 0; color: var(--green); font-size: 0.8rem; font-weight: 700; }
.lead-card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.lead-card-actions .row-action { margin-top: 0; }
/* per-lead work notes (what we did while working the lead) */
.lead-card-note { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; background: var(--page); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.lead-card-note p { margin: 0; color: var(--soft); font-size: 0.82rem; white-space: pre-wrap; word-break: break-word; }
.lead-note-btn { align-self: flex-start; padding: 0; border: 0; background: transparent; color: var(--teal); font: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer; }
.lead-note-btn:hover { text-decoration: underline; }
.lead-note-edit { display: flex; flex-direction: column; gap: 6px; }
.lead-note-input { width: 100%; min-height: 64px; resize: vertical; font: inherit; font-size: 0.85rem; }
.lead-note-actions { display: flex; gap: 6px; }
.lead-note-actions .row-action { margin-top: 0; }
tr.ticket-open { background: rgba(7, 88, 89, 0.05); }
.ticket-msg { display: block; max-width: 380px; white-space: normal; color: var(--soft); font-size: 0.85rem; }
.ticket-resolution { display: block; margin-top: 6px; max-width: 380px; white-space: normal; color: var(--green); font-size: 0.82rem; font-weight: 600; }
.resolve-notify { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--soft); }
.resolve-notify input { width: auto; min-height: 0; }
#tickets-filter { width: auto; min-width: 175px; }

/* badges + chips */
.badge, .state-chip, .chip { display: inline-flex; align-items: center; gap: 7px; min-height: 26px; border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 3px 11px; background: var(--surface); color: var(--soft); font-size: 0.76rem; font-weight: 700; }
.success { color: var(--green) !important; background: rgba(85,139,110,0.14) !important; border-color: rgba(85,139,110,0.34) !important; }
.warning { color: var(--amber) !important; background: #fff4d8 !important; border-color: #ead39b !important; }
.danger { color: var(--red) !important; background: #fdebea !important; border-color: #efc2bf !important; }
.neutral { color: var(--soft) !important; background: var(--page-strong) !important; border-color: var(--line) !important; }

/* sparkline */
.spark { display: block; margin-top: 6px; overflow: visible; }
.spark-up { stroke: var(--green); }
.spark-down { stroke: var(--red); }

.reconcile-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 16px; }
.reconcile-form .field-date, .reconcile-form .field-status { display: grid; gap: 6px; flex: 1 1 140px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.reconcile-actions { display: flex; gap: 10px; margin-inline-start: auto; }
.action-row { display: flex; justify-content: flex-end; gap: 10px; }
.op-help { color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.twofa-steps { margin: 0 0 12px; padding-inline-start: 20px; color: var(--soft); font-size: 0.86rem; line-height: 1.6; }
.twofa-secret { margin-bottom: 12px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--page-strong); text-align: center; }
.twofa-secret code { font-size: 1.05rem; letter-spacing: 0.12em; font-weight: 700; word-break: break-all; }
.twofa-confirm { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.twofa-confirm input { flex: 1 1 160px; }
.op-hint { display: block; margin-top: 4px; font-size: 0.72rem; color: var(--muted); }
.inline-suffix { display: flex; align-items: center; gap: 8px; }
.inline-suffix input { max-width: 130px; }
.inline-suffix span { color: var(--muted); font-size: 0.85rem; }
.plan-create { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.plan-create .field { flex: 1 1 130px; }
.plan-create .btn { flex: 0 0 auto; }
.details-panel { padding: 0; }
.details-panel > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px; padding: 20px 22px; }
.details-panel > summary::-webkit-details-marker { display: none; }
.details-panel > summary::after { content: '⌄'; position: absolute; inset-inline-end: 22px; color: var(--muted); font-size: 1.1rem; }
.details-panel > summary { position: relative; }
.details-panel[open] > summary { border-bottom: 1px solid var(--line); }
.details-panel[open] > summary::after { content: '⌃'; }
.details-summary-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.details-body { padding: 18px 22px 22px; }

/* clickable restaurant name in tables */
.link-name { background: transparent; border: 0; padding: 0; color: var(--teal-deep); font: inherit; font-weight: 700; text-align: start; cursor: pointer; }
.link-name:hover { text-decoration: underline; }

/* per-restaurant detail dialog */
.detail-dialog { width: min(640px, 100%); max-height: 88vh; overflow-y: auto; display: block; }
.detail-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.detail-head h3 { font-size: 1.3rem; }
.detail-h { font-family: var(--font-display); font-size: 0.95rem; margin: 18px 0 8px; }
.detail-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.detail-stat { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; gap: 5px; }
.detail-stat span { color: var(--muted); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.detail-stat strong { font-size: 0.92rem; }
.detail-stat small { color: var(--muted); font-size: 0.75rem; }
.detail-chart { display: block; width: 100%; height: 90px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fffdf9; }
.detail-contact { color: var(--soft); font-size: 0.9rem; }
#detail-notes { width: 100%; }
.detail-dun { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px 14px; border: 1px solid #efc2bf; background: #fdebea; border-radius: var(--radius-sm); }
.detail-dun strong { display: block; color: var(--red); }
.detail-dun span { color: var(--soft); font-size: 0.8rem; }
/* Closed-restaurant banner + danger zone (close action). */
.detail-closed { margin: 4px 0 14px; padding: 12px 14px; border: 1px solid #efc2bf; background: #fdebea; border-radius: var(--radius-sm); }
.detail-closed strong { color: var(--red); }
.detail-closed span { color: var(--soft); font-size: 0.85rem; }
.detail-closed p { margin: 6px 0 0; font-size: 0.9rem; }
.detail-h-danger { color: var(--red); }
.detail-danger { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid #efc2bf; background: #fdebea; border-radius: var(--radius-sm); }
.detail-danger strong { display: block; }
.detail-danger span { color: var(--soft); font-size: 0.8rem; }
.archive-reason { color: var(--soft); font-size: 0.85rem; max-width: 360px; }

.events-list { display: grid; gap: 10px; }
.event { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: #fffdf9; }
.event p { margin-top: 6px; color: var(--muted); font-size: 0.84rem; }
.event pre { margin: 10px 0 0; white-space: pre-wrap; word-break: break-word; font-size: 0.8rem; color: var(--soft); }

/* ── Dialogs ── */
.dialog-backdrop { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(13,32,30,0.45); z-index: 50; }
.dialog { width: min(460px, 100%); display: grid; gap: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); padding: 24px; box-shadow: 0 24px 60px rgba(13,32,30,0.24); }
.dialog h3 { font-size: 1.2rem; }
.dialog-help { color: var(--muted); font-size: 0.84rem; }
.dialog-help code { background: var(--page-strong); border-radius: 5px; padding: 1px 5px; font-size: 0.82rem; }
.dialog-actions { display: flex; align-items: center; gap: 10px; }
.dialog-spacer { flex: 1; }

/* ── Toast ── */
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(420px, calc(100vw - 40px)); transform: translateY(16px); opacity: 0; pointer-events: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 13px 16px; background: var(--surface); font-weight: 600; box-shadow: 0 16px 36px rgba(13,32,30,0.16); transition: opacity 160ms ease, transform 160ms ease; z-index: 60; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { color: var(--green); }
.toast.danger { color: var(--red); }
.toast.warning { color: var(--amber); }

/* ── Responsive ── */
@media (max-width: 1100px) { .op-cols { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .op-sidebar { transform: translateX(-100%); transition: transform 200ms ease; box-shadow: 0 0 60px rgba(0,0,0,0.3); }
  .app-shell.nav-open .op-sidebar { transform: translateX(0); }
  .op-main { margin-inline-start: 0; padding-top: 68px; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .token-row { grid-template-columns: 1fr; }
  .reconcile-actions { margin-inline-start: 0; width: 100%; }
  .reconcile-actions .btn { flex: 1; }
  .action-row { flex-direction: column; }
  .action-row .btn { width: 100%; }
  .toast { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}
