/* Steven AI OS — Google Reviews Manager : design system + app shell (Group 7 / T18).
 *
 * Light, modern SaaS admin theme. Plain CSS, no framework, no build step.
 * NO external fonts / CDN — system font stack only. Icons are inline SVG.
 * CSP is style-src 'self' — everything lives here, no inline styles.
 *
 * Layout: fixed left sidebar on desktop (>=1280px); below that the sidebar
 * becomes an off-canvas drawer toggled by the hamburger (#nav-toggle), closed
 * by the overlay (#nav-overlay) or the Escape key.
 */

/* ------------------------------------------------------------------ */
/* design tokens                                                       */
/* ------------------------------------------------------------------ */
:root {
  /* colour — AA contrast on white / on tint */
  --bg: #f5f6f8;
  --bg-sunken: #eef0f4;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --ink: #17202c;          /* body text */
  --ink-soft: #414c5c;
  --muted: #5c6675;        /* 4.6:1 on white */
  --faint: #808b9a;
  --line: #dfe3e9;
  --line-strong: #c6ccd6;

  --brand: #1f5fbf;
  --brand-ink: #17498f;
  --brand-tint: #eaf1fc;
  --ok: #14713d;
  --ok-tint: #e6f4ec;
  --warn: #96570a;
  --warn-tint: #fdf1de;
  --danger: #ab2318;
  --danger-tint: #fdeceb;
  --focus: #1f5fbf;

  /* spacing scale (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;

  /* radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* shadows — subtle */
  --sh-1: 0 1px 2px rgba(23, 32, 44, 0.06);
  --sh-2: 0 4px 14px rgba(23, 32, 44, 0.08);
  --sh-3: 0 12px 32px rgba(23, 32, 44, 0.16);

  /* type scale */
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-15: 15px;
  --fs-17: 17px;
  --fs-20: 20px;
  --fs-26: 26px;

  --sidebar-w: 256px;
  --topbar-h: 66px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: var(--fs-15);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ */
/* focus + accessibility                                               */
/* ------------------------------------------------------------------ */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ */
/* draft-mode banner (text pinned by tests — do not change)            */
/* ------------------------------------------------------------------ */
.banner {
  background: #3c2506;
  color: #ffe7bd;
  text-align: center;
  font-weight: 700;
  font-size: var(--fs-13);
  letter-spacing: 0.02em;
  padding: var(--sp-3) var(--sp-4);
  position: sticky;
  top: 0;
  z-index: 40;
}

/* ------------------------------------------------------------------ */
/* app grid                                                            */
/* ------------------------------------------------------------------ */
.app { min-height: calc(100vh - 40px); }

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-5) var(--sp-3) var(--sp-4);
  overflow-y: auto;
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-1) var(--sp-2) var(--sp-5);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--sp-2);
}
.brand-mark { color: var(--brand); display: inline-flex; }
.brand-text { display: flex; flex-direction: column; }
.brand-title { font-weight: 700; font-size: var(--fs-17); letter-spacing: -0.01em; }
.brand-sub {
  font-size: var(--fs-12);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav { display: flex; flex-direction: column; gap: var(--sp-1); }

/* Primary nav item — the 8 areas. NB: the class name ".tab" is kept for
 * backwards compatibility with the existing UI contract/tests. */
.tab {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 42px;                 /* touch target >= 40px */
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  border-radius: var(--r-md);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-14);
  text-align: left;
}
.tab svg { flex: 0 0 auto; color: var(--muted); }
.tab:hover { background: var(--bg-sunken); color: var(--ink); }
.tab.active {
  background: var(--brand-tint);
  border-color: #cfe0f8;
  color: var(--brand-ink);
  font-weight: 600;
}
.tab.active svg { color: var(--brand); }

.nav-bottom {
  margin-top: auto;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.nav-sub {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 42px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  border-radius: var(--r-md);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-14);
  text-align: left;
}
.nav-sub:hover { background: var(--bg-sunken); }
.nav-sub.active {
  background: var(--brand-tint);
  border-color: #cfe0f8;
  color: var(--brand-ink);
  font-weight: 600;
}
.app-version {
  margin: var(--sp-3) var(--sp-3) 0;
  font-size: var(--fs-11);
  color: var(--faint);
  font-family: var(--mono);
}

.content {
  margin-left: var(--sidebar-w);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------------ */
/* topbar                                                              */
/* ------------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 40px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-height: var(--topbar-h);
  padding: var(--sp-3) var(--sp-6);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar-titles { display: flex; flex-direction: column; }
.topbar-brand { font-size: var(--fs-20); margin: 0; letter-spacing: -0.02em; }
.topbar-sub {
  margin: 0;
  font-size: var(--fs-12);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--r-md);
  color: var(--ink);
  cursor: pointer;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--panel-2);
  font-size: var(--fs-13);
  color: var(--ink-soft);
  white-space: nowrap;
}
.status-pill .dot, .nav-sub .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--faint);
  flex: 0 0 auto;
}
.status-pill.ok .dot, .nav-sub .dot.ok { background: var(--ok); }
.status-pill.warn .dot, .nav-sub .dot.warn { background: var(--warn); }
.status-pill.danger .dot, .nav-sub .dot.danger { background: var(--danger); }
.status-pill.ok { background: var(--ok-tint); border-color: #bfe3cd; color: var(--ok); }
.status-pill.warn { background: var(--warn-tint); border-color: #f0d6a8; color: var(--warn); }
.status-pill.danger { background: var(--danger-tint); border-color: #f3c4c0; color: var(--danger); }

.actor { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-13); color: var(--muted); }
.actor input {
  min-height: 40px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: var(--fs-14);
  background: var(--panel);
}

/* ------------------------------------------------------------------ */
/* main + panels                                                       */
/* ------------------------------------------------------------------ */
main { padding: var(--sp-7) var(--sp-6) var(--sp-8); max-width: 1200px; width: 100%; }
h2 { font-size: var(--fs-20); margin: 0 0 var(--sp-5); letter-spacing: -0.01em; }
h3 { font-size: var(--fs-15); }
.muted { color: var(--muted); font-size: var(--fs-13); }
code { font-family: var(--mono); font-size: 0.92em; background: var(--bg-sunken); padding: 1px 5px; border-radius: 4px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--sp-5);
}
.panel-title {
  font-size: var(--fs-12);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: var(--sp-7) 0 var(--sp-3);
}
.status-panel { margin-bottom: var(--sp-4); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-4); }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--sp-5);
}
.card .n { font-size: var(--fs-26); font-weight: 700; letter-spacing: -0.02em; }
.card .k { color: var(--muted); font-size: var(--fs-12); text-transform: uppercase; letter-spacing: 0.04em; }
.card.danger { border-color: #f0c3bf; background: var(--danger-tint); }
.card.danger .n { color: var(--danger); }

/* settings list (honest, read-only descriptions) */
.settings-list { list-style: none; margin: var(--sp-4) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.settings-list li { display: grid; grid-template-columns: 140px 1fr; gap: var(--sp-4); padding-bottom: var(--sp-3); border-bottom: 1px solid var(--line); }
.settings-list li:last-child { border-bottom: none; padding-bottom: 0; }
.settings-list .k { font-weight: 600; font-size: var(--fs-13); }
.settings-list .v { color: var(--ink-soft); font-size: var(--fs-14); }

/* ------------------------------------------------------------------ */
/* states: loading / empty / error                                     */
/* ------------------------------------------------------------------ */
.state { display: flex; align-items: center; gap: var(--sp-3); color: var(--muted); font-size: var(--fs-14); padding: var(--sp-4) 0; }
.state-error { color: var(--danger); align-items: flex-start; flex-direction: column; gap: var(--sp-1); }
.state-error .state-detail { color: var(--ink-soft); font-size: var(--fs-13); font-family: var(--mono); }
.state-empty { color: var(--muted); font-style: normal; }

.spinner {
  width: 18px; height: 18px; flex: 0 0 auto;
  border: 2px solid var(--line-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4) 0; }
.skeleton-row {
  height: 14px; border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--bg-sunken) 25%, #e4e8ee 37%, var(--bg-sunken) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.skeleton-row.w-60 { width: 60%; }
.skeleton-row.w-80 { width: 80%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .spinner, .skeleton-row { animation: none; }
}

/* ------------------------------------------------------------------ */
/* pager / filters / bulk / notice                                     */
/* ------------------------------------------------------------------ */
.pager { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-4); flex-wrap: wrap; }
.pager button {
  min-height: 40px;
  min-width: 40px;
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  border-radius: var(--r-sm);
  cursor: pointer;
  font: inherit;
}
.pager button:disabled { opacity: 0.5; cursor: not-allowed; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  align-items: flex-end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-5);
}
.filters label { display: flex; flex-direction: column; font-size: var(--fs-12); color: var(--muted); gap: var(--sp-1); font-weight: 600; letter-spacing: 0.02em; }
.filters select, .filters input {
  min-height: 40px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: var(--fs-14);
  background: var(--panel);
  color: var(--ink);
}
.filters button {
  min-height: 40px;
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  border-radius: var(--r-sm);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
.filters button#f-reset { background: var(--panel); color: var(--ink); border-color: var(--line-strong); font-weight: 500; }

.bulkbar { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); flex-wrap: wrap; }
button.primary {
  min-height: 42px;
  padding: var(--sp-3) var(--sp-5);
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  border-radius: var(--r-sm);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
button.primary:disabled { background: #a9bfdd; border-color: #a9bfdd; cursor: not-allowed; }

.notice {
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  background: var(--brand-tint);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  margin: var(--sp-3) 0;
  white-space: pre-wrap;
  font-size: var(--fs-14);
}
#global-notice { position: fixed; right: var(--sp-5); bottom: var(--sp-5); max-width: 420px; box-shadow: var(--sh-3); z-index: 50; margin: 0; }
.notice.error { border-left-color: var(--danger); background: var(--danger-tint); }
.notice.warn { border-left-color: var(--warn); background: var(--warn-tint); }

/* ------------------------------------------------------------------ */
/* queue review cards                                                  */
/* ------------------------------------------------------------------ */
.queue { display: flex; flex-direction: column; gap: var(--sp-4); }

.review {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--sp-5);
}
.review .head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: var(--sp-3);
}
.review .shop { font-weight: 600; }
.review .stars { color: var(--warn); letter-spacing: 1px; white-space: nowrap; }
.review .status {
  font-size: var(--fs-12);
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.review .status.needs_review { background: var(--warn-tint); }
.review .status.approved, .review .status.ready_to_publish { background: var(--ok-tint); }
.review .status.rejected { background: var(--danger-tint); }

.review .orig { margin: var(--sp-3) 0 var(--sp-2); }
.review .draft-box {
  background: var(--panel-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  margin-top: var(--sp-2);
}
.review .label { font-size: var(--fs-11); text-transform: uppercase; color: var(--muted); letter-spacing: 0.06em; font-weight: 600; }
.review .draft-text { white-space: pre-wrap; margin-top: var(--sp-1); }
.review .reasons { color: var(--danger); font-size: var(--fs-12); margin-top: var(--sp-2); }
.review .blocked { color: var(--warn); font-size: var(--fs-12); }
.review textarea {
  width: 100%;
  min-height: 84px;
  margin-top: var(--sp-2);
  font: inherit;
  padding: var(--sp-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  resize: vertical;
}
.review .actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); flex-wrap: wrap; }
.review .actions button {
  min-height: 40px;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  cursor: pointer;
  font: inherit;
}
.review .actions .approve { border-color: var(--ok); color: var(--ok); }
.review .actions .reject { border-color: var(--danger); color: var(--danger); }
.review input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--brand); }
.rowselect { display: flex; align-items: center; min-height: 40px; min-width: 24px; }

/* ------------------------------------------------------------------ */
/* data tables (never overflow: wrapped in a scroll container)         */
/* ------------------------------------------------------------------ */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-lg); }
table.grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
table.grid th, table.grid td { text-align: left; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); font-size: var(--fs-14); vertical-align: top; }
table.grid th { background: var(--bg-sunken); font-size: var(--fs-12); text-transform: uppercase; color: var(--muted); letter-spacing: 0.05em; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tr:hover td { background: var(--panel-2); }
.alert-row td { background: var(--warn-tint); }

/* ------------------------------------------------------------------ */
/* off-canvas drawer below the desktop breakpoint (tablet + mobile)    */
/* ------------------------------------------------------------------ */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 32, 44, 0.42);
  z-index: 25;
}

@media (max-width: 1279px) {
  .nav-toggle { display: inline-flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--sh-3);
    width: min(86vw, 300px);
  }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; }
  .topbar { top: 0; padding: var(--sp-3) var(--sp-4); }
  main { padding: var(--sp-5) var(--sp-4) var(--sp-8); }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* ------------------------------------------------------------------ */
/* small mobile (>=360px): stack tables into cards                     */
/* ------------------------------------------------------------------ */
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; gap: var(--sp-3); }
  .topbar-right { gap: var(--sp-3); width: 100%; flex-wrap: wrap; }
  .actor { flex: 1 1 auto; }
  .actor input { flex: 1 1 auto; }
  main { padding: var(--sp-4) var(--sp-3) var(--sp-8); }

  table.grid, table.grid thead, table.grid tbody,
  table.grid th, table.grid td, table.grid tr { display: block; width: 100%; }
  table.grid thead { display: none; }
  table.grid tr {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    margin-bottom: var(--sp-3);
    overflow: hidden;
  }
  table.grid td { border-bottom: 1px solid var(--line); }
  table.grid td::before {
    content: attr(data-label);
    display: block;
    font-size: var(--fs-11);
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.04em;
    margin-bottom: 2px;
  }

  .filters { flex-direction: column; align-items: stretch; }
  .filters label { width: 100%; }
  .filters select, .filters input { width: 100%; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .review .head { grid-template-columns: auto 1fr auto; }
  .review .status { grid-column: 1 / -1; justify-self: start; }
  .settings-list li { grid-template-columns: 1fr; gap: var(--sp-1); }
}

/* ------------------------------------------------------------------ */
/* Group 7 / T19 -- Overview KPI grid, charts and Location details     */
/* ------------------------------------------------------------------ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: var(--sp-3);
  margin: var(--sp-3) 0 var(--sp-5);
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--sp-4);
}
.kpi.danger { border-color: var(--danger); }
.kpi .kpi-n { font-size: var(--fs-24); font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; }
.kpi .kpi-k { font-size: var(--fs-12); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: var(--sp-1); }
.kpi.danger .kpi-n { color: var(--danger); }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.grid-2 .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: var(--sp-4); }

/* rating distribution rows (bars are inline SVG, no style attributes) */
.dist-row { display: grid; grid-template-columns: 7.5em 1fr 5.5em; align-items: center; gap: var(--sp-3); margin: var(--sp-2) 0; }
.dist-stars { color: var(--warn); letter-spacing: 0.08em; white-space: nowrap; }
.dist-count { font-size: var(--fs-13); color: var(--muted); text-align: right; }
svg.bar { width: 100%; height: 12px; display: block; }
svg.bar rect { fill: var(--brand); }
svg.trend-svg { width: 100%; height: 120px; display: block; margin-top: var(--sp-2); }
svg.trend-svg rect { fill: var(--brand); opacity: 0.85; }

/* sortable column headers */
.th-sort {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: var(--fs-12);
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
  cursor: pointer;
  min-height: 28px;
}
.th-sort:hover { color: var(--fg); }
.th-sort:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* location detail panel */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-2); }
.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-item .k { font-size: var(--fs-11); text-transform: uppercase; color: var(--muted); letter-spacing: 0.05em; }
.detail-item .v { font-size: var(--fs-14); }

@media (max-width: 700px) {
  .dist-row { grid-template-columns: 6.5em 1fr 5em; gap: var(--sp-2); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ------------------------------------------------------------------ */
/* Group 7 / T20 -- Review Inbox split view + approval UX              */
/* ------------------------------------------------------------------ */
/* Desktop: list (left) + detail (right) side by side. Mobile (<700px):
 * the two panes are separate full-screen views toggled by .detail-open
 * and the Back button. */
.split {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(0, 1.35fr);
  gap: var(--sp-4);
  align-items: start;
}
.split-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--sp-4);
}
.split-detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--sp-4);
  position: sticky;
  top: calc(40px + var(--topbar-h) + var(--sp-3));
}
.list-head { margin-bottom: var(--sp-2); }

.inbox-row {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  margin-bottom: var(--sp-2);
  cursor: pointer;
  background: var(--panel);
}
.inbox-row:hover { background: var(--panel-2); }
.inbox-row.selected { border-color: var(--brand); background: var(--brand-tint); }
.inbox-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: var(--sp-2);
}
.inbox-row .shop { font-weight: 600; }
.inbox-row .stars { color: var(--warn); letter-spacing: 1px; white-space: nowrap; }
.inbox-row .status {
  font-size: var(--fs-12);
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.inbox-row .status.needs_review { background: var(--warn-tint); }
.inbox-row .status.approved, .inbox-row .status.ready_to_publish { background: var(--ok-tint); }
.inbox-row .status.rejected { background: var(--danger-tint); }
.inbox-row .status.no_draft { color: var(--muted); }
.inbox-row .excerpt {
  margin: var(--sp-2) 0;
  color: var(--ink-soft);
  font-size: var(--fs-14);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.inbox-row .inbox-meta { display: flex; gap: var(--sp-4); flex-wrap: wrap; color: var(--muted); font-size: var(--fs-12); }
.inbox-row .blocked { color: var(--warn); font-size: var(--fs-12); margin-top: var(--sp-1); }

.detail-head { display: flex; align-items: center; gap: var(--sp-3); }
.detail-head .panel-title { margin: 0; }
.link-btn {
  background: none;
  border: none;
  color: var(--brand);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  min-height: 40px;
  padding: 0 var(--sp-2);
}
.detail-comment {
  white-space: pre-wrap;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.split-detail .label { display: block; margin-top: var(--sp-3); }
.split-detail .draft-text {
  white-space: pre-wrap;
  background: var(--panel-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: var(--sp-3);
}
.split-detail .actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); flex-wrap: wrap; }
.split-detail .actions button {
  min-height: 40px;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  cursor: pointer;
  font: inherit;
}
.split-detail .actions .approve { border-color: var(--ok); color: var(--ok); }
.split-detail .actions .reject { border-color: var(--danger); color: var(--danger); }
.split-detail .actions button:disabled { opacity: 0.5; cursor: not-allowed; }
.split-detail .editor { margin-top: var(--sp-3); }
.split-detail .editor textarea {
  width: 100%;
  min-height: 84px;
  font: inherit;
  padding: var(--sp-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  resize: vertical;
  margin-bottom: var(--sp-2);
}

@media (max-width: 700px) {
  /* Mobile: list and detail are separate full-screen views. */
  .split { display: block; }
  .split-detail { position: static; }
  .split .split-detail { display: none; }
  .split.detail-open .split-list { display: none; }
  .split.detail-open .split-detail { display: block; }
}

/* ------------------------------------------------------------------ */
/* Group 7 / T21 -- KPI unit captions + small-mobile (360/390px) tidy  */
/* ------------------------------------------------------------------ */
/* Sub-caption under a KPI's label: states the UNIT the counter counts. */
.kpi .kpi-c {
  font-size: var(--fs-11);
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}
/* The caption line itself gets a slightly stronger muted tone so it reads as
 * an explanation, not another KPI. */
#kpi-units-caption { margin: calc(-1 * var(--sp-2)) 0 var(--sp-3); }

/* Touch targets: pager buttons and audit controls must be tappable (>=40px). */
.pager button {
  min-height: 40px;
  min-width: 44px;
  padding: var(--sp-2) var(--sp-3);
}

/* Small phones (360px / 390px): stop any horizontal scroll. Nothing may be
 * wider than the viewport; the inbox header stacks instead of overflowing. */
html, body { max-width: 100%; }
@media (max-width: 400px) {
  .banner, .topbar-brand, .topbar-sub, .muted { overflow-wrap: anywhere; }
  .inbox-head {
    grid-template-columns: 1fr auto;
    row-gap: var(--sp-1);
  }
  .inbox-head .shop { grid-column: 1 / -1; }
  .inbox-row .inbox-meta { gap: var(--sp-2); }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
  .split-detail .actions { flex-direction: column; }
  .split-detail .actions button { width: 100%; }
  .filters label, .filters input, .filters select { min-width: 0; }
  .card, .panel, .kpi { padding: var(--sp-3); }
}

/* Login view (Group 8A / T22) -- shown only when the server enforces auth.
   In mock mode the element stays [hidden] and nothing here renders. */
.actor-name { font-weight: 600; color: var(--text, #e8e8e8); }
.login-view {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.65); padding: var(--sp-4, 16px);
}
.login-view[hidden] { display: none; }
.login-card {
  display: flex; flex-direction: column; gap: var(--sp-2, 8px);
  width: min(360px, 100%); padding: var(--sp-5, 24px);
  background: var(--surface, #1c1c22); border: 1px solid var(--border, #33333a);
  border-radius: var(--radius, 10px);
}
.login-card h2 { margin: 0; }
.login-card label { font-size: var(--fs-13, 13px); color: var(--muted); }
.login-card input {
  padding: var(--sp-2, 8px); border-radius: var(--radius, 10px);
  border: 1px solid var(--border, #33333a); background: var(--bg, #121216);
  color: inherit;
}
.login-card .btn { margin-top: var(--sp-2, 8px); }
.login-error { color: var(--danger, #ff6b6b); margin: 0; }
.login-error[hidden] { display: none; }

/* --- Locations / sync display (Dashboard V2 UX pass) --------------------- */
/* Desktop: keep the six priority columns on one line; the .table-scroll
   wrapper pans if the viewport is narrower. Mobile keeps the stacked cards. */
table.grid.locations-table th,
table.grid.locations-table td { white-space: nowrap; }
table.grid.locations-table td:first-child { font-weight: 600; }

button.link {
  background: none; border: 0; padding: 0; margin: 0; font: inherit;
  color: var(--accent, #1d4ed8); cursor: pointer; text-align: left;
}
button.link:hover, button.link:focus-visible { text-decoration: underline; }

.sync-history table.grid th,
.sync-history table.grid td { padding: var(--sp-2) var(--sp-3); white-space: nowrap; }

@media (max-width: 700px) {
  table.grid.locations-table th,
  table.grid.locations-table td { white-space: normal; }
}

/* Business Dashboard (offline FIXTURE preview) — issue #30 */
.fixture-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #6b5200;
  color: #fff;
  font-size: var(--fs-12);
  letter-spacing: 0.06em;
  vertical-align: middle;
}
.readiness {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: var(--fs-12);
}
.readiness-ready { border-color: #2e7d32; color: #2e7d32; }
.readiness-needs_connection { border-color: #b26a00; color: #b26a00; }
.readiness-not_connected { border-color: var(--muted); color: var(--muted); }
tr.biz-row.selected td { background: var(--panel-2); }

/* ------------------------------------------------------------------ */
/* SEO Audit (READ-ONLY offline audit preview) — issue #42            */
/* ------------------------------------------------------------------ */
.offline-banner {
  display: block;
  margin: var(--sp-3) 0 var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-left: 4px solid #b26a00;
  background: var(--warn-tint, #fff4e0);
  color: var(--ink);
  font-size: var(--fs-13);
  font-weight: 600;
  border-radius: var(--r-md, 8px);
}
.seo-table td.seo-score,
.seo-score { font-weight: 700; white-space: nowrap; }
tr.seo-row.selected td { background: var(--panel-2); }

.seo-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.seo-score-big { font-size: var(--fs-26); font-weight: 700; letter-spacing: -0.02em; }
.seo-score-label {
  color: var(--muted);
  font-size: var(--fs-12);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.seo-sub {
  margin: var(--sp-4) 0 var(--sp-2);
  font-size: var(--fs-12);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.missing-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: var(--fs-12);
  font-family: var(--mono);
}
.chip-missing { border-color: #b3261e; color: #b3261e; }
.finding-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.finding {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--r-md, 8px);
  padding: var(--sp-3) var(--sp-4);
  background: var(--panel);
}
.finding-high { border-left-color: #b3261e; }
.finding-medium { border-left-color: #b26a00; }
.finding-low { border-left-color: var(--muted); }
.finding-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-1); }
.sev {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.sev-high { background: var(--danger-tint, #f8e6e4); color: #b3261e; }
.sev-medium { background: var(--warn-tint, #fff4e0); color: #b26a00; }
.sev-low { background: var(--bg-sunken); color: var(--muted); }
.finding-code { font-family: var(--mono); font-size: var(--fs-12); color: var(--ink-soft); }
.finding-field { font-size: var(--fs-12); color: var(--muted); }
.finding-message { margin: var(--sp-1) 0; font-size: var(--fs-14); }
.finding-evidence,
.finding-action {
  margin: var(--sp-1) 0 0;
  font-size: var(--fs-13);
  color: var(--ink-soft);
}
.finding-action { color: var(--accent, #1d4ed8); }

@media (max-width: 700px) {
  .seo-head { flex-direction: column; align-items: flex-start; gap: var(--sp-1); }
}
