/* Storage Solutions: GBP & Analytics Dashboard Report
   Brand: Plus Jakarta Sans · maroon #943E4D · green #0D6358 · sage #C2D7D4 (storage-solutions.org)
   Spacing: 4px grid (4 / 8 / 12 / 16 / 24 / 32). Sharp corners, like the brand's buttons. */
:root {
  --maroon: #943e4d;
  --maroon-700: #7a3140;
  --green: #0d6358;
  --green-700: #0a4f46;
  --green-50: #e7f1ef;
  --sage: #c2d7d4;
  --sage-50: #eef4f3;
  --bg: #f3f4f4;
  --card: #fff;
  --ink: #141414;
  --ink-2: #4a5056;
  --ink-3: #6f767c;
  --line: #e2e5e5;
  --up: #0d6358;
  --down: #b4233c;
  --nav-h: 64px;
  --side-w: 264px;
  --gap: 16px;
  --pad: 20px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-weight: 500; color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--green); }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--ink-3); font-size: 12px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--green); }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--nav-h); display: flex; align-items: center; gap: 24px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; text-decoration: none; }
.brand img { height: 36px; width: auto; display: block; }
.brand .title { border-left: 1px solid var(--line); padding-left: 14px; min-width: 0; }
.brand .title b { display: block; font-size: 14px; font-weight: 700; color: var(--maroon); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .title span { display: block; font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.topbar nav { display: flex; gap: 4px; margin-left: auto; height: 100%; }
.topbar nav a { display: flex; align-items: center; white-space: nowrap; padding: 0 14px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--ink-2); border-bottom: 3px solid transparent; border-top: 3px solid transparent; }
.topbar nav a:hover { color: var(--green); }
.topbar nav a.active { color: var(--green); border-bottom-color: var(--green); }
.user { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.user .avatar { width: 32px; height: 32px; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.user a { color: var(--ink-2); font-weight: 600; }
.menu-btn { display: none; border: 1px solid var(--line); background: #fff; width: 40px; height: 40px; font-size: 18px; flex: none; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: calc(100vh - var(--nav-h)); }
.sidebar { width: var(--side-w); flex: none; background: #fff; border-right: 1px solid var(--line); position: sticky; top: var(--nav-h); height: calc(100vh - var(--nav-h)); display: flex; flex-direction: column; }
.side-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.side-head .eyebrow { display: flex; justify-content: space-between; margin-bottom: 8px; }
.side-head input { width: 100%; height: 36px; border: 1px solid var(--line); padding: 0 10px; font: inherit; font-size: 13px; background: var(--bg); }
.side-head input:focus { outline: 2px solid var(--green); outline-offset: -1px; background: #fff; }
.loc-list { overflow: auto; flex: 1; padding: 4px 0 16px; }
.loc-list a { display: block; padding: 9px 16px 9px 13px; border-left: 3px solid transparent; text-decoration: none; color: var(--ink); }
.loc-list a b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-list a span { display: block; font-size: 11.5px; color: var(--ink-3); }
.loc-list a:hover { background: var(--sage-50); }
.loc-list a.active { background: var(--sage-50); border-left-color: var(--green); }
.loc-list a.active b { color: var(--green); }
.main { flex: 1; min-width: 0; padding: 24px; }
.page { max-width: 1240px; margin: 0 auto; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: var(--gap); }
.toolbar .period { font-size: 12.5px; color: var(--ink-2); margin-right: auto; }
.toolbar .period b { color: var(--ink); font-weight: 700; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border: 1px solid var(--green); background: #fff; color: var(--green); font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; text-decoration: none; border-radius: 0; white-space: nowrap; }
.btn:hover { background: var(--green-50); }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-700); }
.btn.danger { border-color: var(--down); color: var(--down); }
.btn.icon { width: 40px; padding: 0; font-size: 16px; letter-spacing: 0; }
.btn:disabled { opacity: .5; cursor: default; }
.picker { position: relative; z-index: 40; }
.picker > button { min-width: 240px; justify-content: space-between; }
.picker ul { position: absolute; right: 0; top: calc(100% + 4px); width: 320px; margin: 0; padding: 4px 0; list-style: none; background: #fff; border: 1px solid var(--line); box-shadow: 0 12px 28px rgba(0,0,0,.14); max-height: 360px; overflow: auto; }
.picker li button { width: 100%; text-align: left; background: none; border: 0; padding: 9px 14px; font-size: 13px; font-weight: 500; display: grid; gap: 2px; color: var(--ink-2); }
.picker li button .pm b { color: var(--ink); font-weight: 700; }
.picker li button span + span { color: var(--ink-3); font-size: 11.5px; }
.picker li + li { border-top: 1px solid var(--line); }
.picker li button:hover, .picker li button[aria-current="true"] { background: var(--sage-50); color: var(--green); }

/* ---------- Banners ---------- */
.banner { margin-bottom: var(--gap); padding: 10px 14px; font-size: 13px; background: #fff8e6; border: 1px solid #f1d48a; border-left: 4px solid #d9a21b; color: #5c4400; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.banner.error { background: #fdecef; border-color: #f2b8c2; border-left-color: var(--down); color: #6e1323; }
.banner .btn { height: 32px; padding: 0 12px; }

/* ---------- Report ---------- */
.report { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
.report > * { min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px var(--pad) 0; }
.card-head h2 { font-size: 17px; font-weight: 700; color: var(--maroon); margin-top: 4px; }
.card-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px var(--pad); border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); margin-top: 16px; }

.hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px; padding: 24px; border-top: 4px solid var(--maroon); }
.hero h1 { font-size: 30px; font-weight: 700; color: var(--maroon); margin: 6px 0 10px; letter-spacing: -.01em; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; font-size: 12px; font-weight: 600; background: var(--sage-50); color: var(--green-700); border: 1px solid var(--sage); white-space: nowrap; }
.chip.plain { background: #fff; color: var(--ink-2); border-color: var(--line); }
.hero .logos { display: flex; align-items: center; gap: 20px; min-width: 0; }
.hero .logos img { max-width: 100%; }
.hero .logos img.ss { height: 56px; width: auto; }
.hero .logos img.bg { height: 64px; width: auto; }
.hero .logos .sep { width: 1px; height: 48px; background: var(--line); }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.kpi { background: #fff; border: 1px solid var(--line); padding: 16px var(--pad) 14px; display: flex; flex-direction: column; min-height: 168px; min-width: 0; }
.kpi .lbl { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.kpi .lbl svg { color: var(--green); flex: none; }
.kpi .val { font-size: 34px; font-weight: 700; letter-spacing: -.02em; margin-top: 8px; line-height: 1.1; }
.kpi .val small { font-size: 14px; font-weight: 600; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.kpi .sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.kpi .cmp { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.kpi .spark { height: 36px; margin-top: auto; padding-top: 10px; }
.kpi .note { margin-top: auto; padding-top: 10px; font-size: 11.5px; color: var(--ink-3); }
.delta { display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.delta.up { background: var(--green-50); color: var(--up); }
.delta.down { background: #fdecef; color: var(--down); }
.delta.flat { background: var(--bg); color: var(--ink-3); }

.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--gap); }
.heatmap { height: 400px; background: var(--bg); position: relative; isolation: isolate; z-index: 0; margin: 0 var(--pad); border: 1px solid var(--line); }
.heatmap .empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--ink-3); font-size: 13px; }
.pin { width: 24px; height: 24px; border-radius: 50%; color: #fff; font: 700 10px/24px var(--font); text-align: center; box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0,0,0,.35); }
.scan-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 16px var(--pad) 0; border: 1px solid var(--line); border-bottom: 0; }
.scan-stats div { padding: 10px 12px; }
.scan-stats div + div { border-left: 1px solid var(--line); }
.scan-stats b { display: block; font-size: 17px; font-weight: 700; white-space: nowrap; }
.scan-stats div.hl { background: var(--sage-50); }
.scan-stats span { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 12px var(--pad) 0; font-size: 11.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.chart-box { position: relative; height: 360px; margin: 12px var(--pad) 0; }
.series-toggles { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px var(--pad) 0; }
.series-toggles button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--line); background: #fff; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.series-toggles button i { width: 10px; height: 10px; display: inline-block; }
.series-toggles button i.dot { border-radius: 50%; }
.series-toggles button[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }

.ga { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); }
.ga-kpis { background: var(--green); color: #fff; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr 1fr; }
.ga-kpis .head { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 20px var(--pad) 16px; }
.ga-kpis .head img { width: 40px; height: 40px; background: #fff; padding: 6px; }
.ga-kpis .head b { display: block; font-size: 17px; }
.ga-kpis .head span { font-size: 12px; opacity: .85; }
.ga-kpis .k { padding: 16px var(--pad); border-top: 1px solid rgba(255,255,255,.18); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.ga-kpis .k:nth-child(odd) { border-left: 1px solid rgba(255,255,255,.18); }
.ga-kpis .k .l { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.ga-kpis .k .v { font-size: 28px; font-weight: 700; margin: 4px 0 6px; letter-spacing: -.01em; }
.ga-kpis .delta.up { background: rgba(255,255,255,.16); color: #c9f2e5; }
.ga-kpis .delta.down { background: rgba(255,255,255,.16); color: #ffc9d2; }
.ga-kpis .delta.flat { background: rgba(255,255,255,.12); color: #fff; }
.ga-chart { min-width: 0; display: flex; flex-direction: column; }
.ga-chart .chart-box { height: 260px; }
.ga-ref { margin: 16px var(--pad) var(--pad); padding: 12px 14px; background: var(--sage-50); border: 1px solid var(--sage); font-size: 12.5px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ga-ref b { display: block; font-size: 12px; margin-bottom: 4px; }
.ga-ref a { display: block; font-weight: 600; }
.ga-ref .muted { font-size: 11px; }
.report-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-3); }

/* ---------- Tables (month vs month) ---------- */
.page-head { margin-bottom: var(--gap); }
.page-head h1 { font-size: 26px; font-weight: 700; color: var(--maroon); margin-top: 4px; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); font-size: 13px; }
select, input[type=text], input[type=search], input[type=email], input[type=date] { font: inherit; font-size: 13px; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); }
table.cmp { border-collapse: collapse; width: 100%; font-size: 13px; }
table.cmp th, table.cmp td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.cmp th:first-child, table.cmp td:first-child { text-align: left; position: sticky; left: 0; background: inherit; }
table.cmp thead tr { background: var(--sage-50); }
table.cmp thead th { font-weight: 700; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--green-700); }
table.cmp thead tr:first-child th { text-align: center; border-left: 1px solid var(--line); color: var(--maroon); }
table.cmp tbody tr { background: #fff; }
table.cmp tbody tr:hover { background: var(--sage-50); }
table.cmp td.grp { border-left: 1px solid var(--line); font-weight: 700; }
table.cmp td a { font-weight: 600; text-decoration: none; }
table.cmp tfoot tr { background: var(--bg); }
table.cmp tfoot td { font-weight: 700; }
table.cmp .prev { color: var(--ink-3); }
.chg { font-weight: 700; }
.chg.up { color: var(--up); } .chg.down { color: var(--down); } .chg.flat { color: var(--ink-3); }
.section-title { font-size: 17px; font-weight: 700; color: var(--maroon); margin: 24px 0 12px; }

/* ---------- Settings ---------- */
.set-card { margin-bottom: var(--gap); padding: var(--pad); }
.set-card h2 { font-size: 17px; font-weight: 700; color: var(--maroon); display: flex; align-items: center; gap: 10px; }
.set-card p { font-size: 13px; color: var(--ink-2); margin: 6px 0 14px; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--green-50); color: var(--green); }
.pill.bad { background: #fdecef; color: var(--down); }
.pill.wait { background: #fff8e6; color: #8a6100; }
.form-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.form-row label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.loc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.loc-table th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--green-700); background: var(--sage-50); padding: 8px; }
.loc-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.loc-table input, .loc-table select { width: 100%; min-width: 120px; height: 34px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; font-size: 13px; font-weight: 600; z-index: 100; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login .box { background: #fff; padding: 40px 36px; max-width: 440px; width: 100%; text-align: center; border: 1px solid var(--line); border-top: 4px solid var(--maroon); }
.login .logos { display: flex; justify-content: center; align-items: center; gap: 18px; }
.login .logos img { height: 52px; width: auto; }
.login h1 { font-size: 21px; color: var(--maroon); margin: 24px 0 8px; }
.login p { color: var(--ink-2); font-size: 13.5px; margin: 0 0 24px; }
.gbtn { display: inline-flex; align-items: center; gap: 12px; height: 46px; padding: 0 22px; text-decoration: none; font-weight: 700; color: #fff; background: var(--green); font-size: 13px; letter-spacing: .05em; text-transform: uppercase; }
.gbtn svg { background: #fff; padding: 3px; width: 24px; height: 24px; }
.gbtn:hover { background: var(--green-700); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .split, .ga { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand .title span { display: none; }
}
@media (max-width: 860px) {
  .menu-btn { display: inline-grid; place-items: center; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: var(--nav-h); transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 18px rgba(0,0,0,.12); }
  body.nav-open .sidebar { transform: none; }
  .brand .title, .user span { display: none; }
  .topbar { gap: 12px; padding: 0 16px; }
  .topbar nav a { padding: 0 8px; font-size: 13px; }
  .main { padding: 16px; }
  .hero { grid-template-columns: 1fr; padding: 20px 16px; }
  .hero h1 { font-size: 24px; }
  .hero .logos img.ss { height: 40px; } .hero .logos img.bg { height: 46px; }
  .toolbar .period { width: 100%; }
  .picker > button { min-width: 0; }
  .picker ul { left: 0; right: auto; width: min(300px, calc(100vw - 32px)); }
  :root { --pad: 16px; }
}
@media (max-width: 520px) {
  .brand img { height: 24px; }
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar nav { overflow-x: auto; }
  .topbar nav a { padding: 0 6px; font-size: 12.5px; }
  .toolbar .picker { flex: 1; min-width: 0; }
  .toolbar .picker > button { width: 100%; padding: 0 10px; font-size: 11.5px; }
  .toolbar #pdf { width: 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px; min-height: 0; }
  .kpi .val { font-size: 24px; }
  .kpi .lbl { font-size: 10px; letter-spacing: .04em; }
  .user { display: none; }
  .ga-ref { grid-template-columns: 1fr; }
  .scan-stats b { font-size: 15px; }
  .heatmap { height: 340px; }
}

/* ---------- PDF export: compact one-page layout ---------- */
.pdf-menu ul { width: 280px; }
body.export-mode { background: #f3f4f4; }
body.export-mode .topbar, body.export-mode .sidebar, body.export-mode .toolbar, body.export-mode #banners { display: none !important; }
body.export-mode .main { padding: 24px; }
body.exporting .leaflet-control-zoom, body.exporting .series-toggles, body.exporting .card-foot .ref .muted { display: none !important; }
body.exporting .report { gap: 12px; }
body.exporting .hero { padding: 18px 24px; }
body.exporting .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
body.exporting .kpi { min-height: 0; padding: 14px 14px 12px; }
body.exporting .kpi .val { font-size: 28px; }
body.exporting .kpi .lbl { font-size: 10px; letter-spacing: .05em; }
body.exporting .kpi .spark { height: 30px; }
body.exporting .heatmap { height: 380px; }
body.exporting .chart-box { height: 330px; }
body.exporting .ga-chart .chart-box { height: 220px; }
body.exporting .split, body.exporting .ga { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.set-card p:last-child { margin-bottom: 0; }
.prov { display: inline-block; margin-left: 6px; padding: 1px 5px; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: #fff8e6; color: #8a6100; border: 1px solid #f1d48a; vertical-align: 1px; cursor: help; }
.card-foot .ref { display: grid; justify-items: end; gap: 2px; text-align: right; margin-left: auto; }
.card-foot .ref .muted { font-size: 11px; }
.card-foot .ref .muted b { color: var(--ink-2); }
.trend-box { height: 400px; }
body.exporting .trend-box { height: 360px; }

/* Reference links are for signed-in viewers only, never in the PDF */
body.exporting .card-foot a, body.exporting .card-foot .ref, body.exporting #ga-link { display: none !important; }

/* ---------- Phones: no sideways scrolling ---------- */
#picker { z-index: 45; }
.pdf-menu { z-index: 41; }
.picker .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.picker .lbl .short { display: none; }
select, input[type=text], input[type=search], input[type=email], input[type=date] { max-width: 100%; }
.page, .main { min-width: 0; }
@media (max-width: 600px) {
  /* Top bar: logo + sign-out on row 1, the three pages as full-width tabs on row 2 */
  :root { --nav-h: 100px; }
  .topbar { flex-wrap: wrap; height: auto; min-height: var(--nav-h); padding: 0 12px; gap: 0 10px; }
  .topbar .menu-btn, .topbar .brand { height: 56px; }
  .topbar .menu-btn { height: 40px; align-self: center; }
  .topbar .user { display: flex; margin-left: auto; height: 56px; }
  .topbar .user .avatar { display: none; }
  .topbar nav { order: 3; flex: 0 0 calc(100% + 24px); margin: 0 -12px; height: 44px; gap: 0; border-top: 1px solid var(--line); overflow: visible; }
  .topbar nav a { flex: 1; justify-content: center; padding: 0 4px; font-size: 13px; }
  /* Toolbar: dates on top, then ‹ month › on one row, then Download PDF full width */
  .toolbar { gap: 8px; }
  .toolbar .period { width: 100%; font-size: 12px; line-height: 1.5; }
  .toolbar #picker { flex: 1 1 0; min-width: 0; }
  .toolbar #picker > button { width: 100%; padding: 0 10px; font-size: 12px; letter-spacing: .02em; }
  .picker .lbl .long { display: none; }
  .picker .lbl .short { display: inline; }
  .toolbar .pdf-menu { flex: 0 0 100%; }
  .toolbar .pdf-menu #pdf { width: 100%; }
  .toolbar .pdf-menu ul { left: 0; right: 0; width: auto; }
  .picker ul { width: calc(100vw - 32px); max-width: 360px; }
  /* Other pages */
  .toolbar select { width: 100%; }
  .toolbar .btn { white-space: normal; }
  label input[type=text] { width: 100%; }
  .btn { white-space: normal; text-align: center; line-height: 1.25; height: auto; min-height: 40px; padding-top: 8px; padding-bottom: 8px; }
  .btn.icon, #picker > button, #pdf { white-space: nowrap; height: 40px; padding-top: 0; padding-bottom: 0; }
}

.signout { display: inline-flex; align-items: center; gap: 6px; }
.signout svg { display: none; }
.nm-short { display: none; }
@media (max-width: 600px) {
  /* Sign out: clear button on phones */
  .topbar .signout { border: 1px solid var(--line); padding: 7px 10px; text-decoration: none; font-size: 12.5px; }
  .topbar .signout svg { display: block; }
    .scan-stats div { padding: 8px 10px; }
  /* Month vs month: short location names */
  .nm-long { display: none; } .nm-short { display: inline; }
  table.cmp th, table.cmp td { padding: 9px 10px; }
  /* Settings: each location becomes a card with labelled fields */
  #locs, #locs tbody, #locs tr, #locs td { display: block; width: 100%; }
  #locs thead { display: none; }
  #locs tr { border: 1px solid var(--line); padding: 12px; margin-bottom: 10px; background: #fff; }
  #locs td { border: 0; padding: 4px 0; }
  #locs td.loc-name { font-weight: 700; color: var(--maroon); font-size: 14px; padding-bottom: 6px; }
  #locs td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--green-700); margin-bottom: 3px; }
  #locs input, #locs select { min-width: 0; height: 38px; }
  #save { width: 100%; }
  /* Login / 404 */
  .login .box { padding: 28px 18px; }
  .login .logos { gap: 12px; }
  .login .logos img { height: 38px; min-width: 0; max-width: 60%; object-fit: contain; }
  .page-head h1 { font-size: 23px; }
  .trend-box { height: 360px; }
  .ga-chart .chart-box { height: 280px; margin: 12px 8px 0; }
}

/* ---------- Date range picker (like the Google Analytics one) ---------- */
.rp { position: relative; z-index: 45; }
.rp .rp-btn { min-width: 260px; justify-content: space-between; gap: 10px; height: auto; min-height: 40px; padding: 5px 14px; text-transform: none; letter-spacing: 0; font-size: 13px; }
.rp .rp-lbl { display: grid; text-align: left; line-height: 1.25; min-width: 0; }
.rp .rp-lbl b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp .rp-lbl span { font-size: 11.5px; font-weight: 500; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-panel { position: absolute; right: 0; top: calc(100% + 4px); display: grid; grid-template-columns: 210px 330px; background: #fff; border: 1px solid var(--line); box-shadow: 0 14px 32px rgba(0,0,0,.16); }
.rp-panel[hidden] { display: none; }
.rp-presets { list-style: none; margin: 0; padding: 6px 0; border-right: 1px solid var(--line); max-height: 470px; overflow: auto; }
.rp-presets button { width: 100%; text-align: left; background: none; border: 0; padding: 9px 16px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.rp-presets button:hover { background: var(--sage-50); color: var(--green); }
.rp-presets button[aria-pressed="true"] { background: var(--sage-50); color: var(--green); font-weight: 700; box-shadow: inset 3px 0 0 var(--green); }
.rp-main { padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rp-dates { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 8px; }
.rp-dates[hidden] { display: none; }
.rp-dates label { display: grid; gap: 4px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--green-700); }
.rp-dates input { width: 100%; min-width: 0; height: 38px; font-size: 13px; padding: 0 8px; }
.rp-dates > span { padding-bottom: 10px; color: var(--ink-3); }
.rp-switch { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; color: var(--ink); cursor: pointer; border-top: 1px solid var(--line); padding-top: 12px; }
.rp-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rp-switch .sw { width: 34px; height: 18px; background: #cfd5d5; position: relative; flex: none; transition: background .15s; }
.rp-switch .sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: #fff; transition: transform .15s; }
.rp-switch input:checked + .sw { background: var(--green); }
.rp-switch input:checked + .sw::after { transform: translateX(16px); }
.rp-switch input:focus-visible + .sw { outline: 2px solid var(--green); outline-offset: 2px; }
.rp-cmp { display: grid; gap: 10px; }
.rp-cmp[hidden] { display: none; }
.rp-cmp select { width: 100%; height: 38px; }
.rp-hint { margin: 0; font-size: 12.5px; color: var(--ink-2); }
.rp-note { margin: 0; font-size: 11.5px; color: var(--ink-3); }
.rp-foot { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: auto; }
@media (max-width: 860px) {
  .rp-panel { right: auto; left: 0; }
}
@media (max-width: 600px) {
  .toolbar #picker { flex: 1 1 0; min-width: 0; }
  .rp .rp-btn { min-width: 0; width: 100%; padding: 5px 10px; }
  .rp-panel { position: fixed; left: 0; right: 0; top: auto; bottom: 0; max-height: 88vh; overflow: auto; grid-template-columns: 1fr; box-shadow: 0 -10px 30px rgba(0,0,0,.25); z-index: 80; }
  .rp-presets { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); max-height: none; }
  .rp-presets li { flex: none; }
  .rp-presets button { width: auto; border: 1px solid var(--line); padding: 7px 10px; font-size: 12.5px; }
  .rp-presets button[aria-pressed="true"] { box-shadow: none; border-color: var(--green); }
  .rp-foot .btn { flex: 1; }
}

/* ---------- Sign-in: Storage Solutions (email code) + Blue Guru (Google) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.login .box h1 { margin-bottom: 20px; }
.login-opt { text-align: left; border: 1px solid var(--line); padding: 18px; background: var(--sage-50); }
.login-opt h2 { font-size: 15px; color: var(--green-700); margin: 0 0 4px; }
.login-opt p { font-size: 13px; margin: 0 0 12px; text-align: left; }
.login-opt form { display: grid; gap: 8px; }
.login-opt form[hidden] { display: none; }
.login-opt input { height: 44px; font: inherit; font-size: 15px; width: 100%; max-width: none; padding: 0 12px; border: 1px solid var(--line); background: #fff; }
.login-opt #code { letter-spacing: .35em; font-weight: 700; text-align: center; }
.login-opt .btn { height: 44px; width: 100%; }
.login-opt .sent { margin: 0 0 4px; }
.linkbtn { background: none; border: 0; color: var(--green); font-weight: 600; font-size: 12.5px; text-decoration: underline; padding: 4px 0; justify-self: start; }
.login .msg { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-2); min-height: 1em; }
.login .msg.bad { color: var(--down); font-weight: 600; }
.login .or { display: flex; align-items: center; gap: 10px; margin: 22px 0 14px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.login .or::before, .login .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.login .fine { margin: 10px 0 0; font-size: 12px; }
/* Viewer accounts: Report + Review Rankings tabs (same equal-width tabs as admins) */
.viewer-list { list-style: none; margin: 12px 0 0; padding: 0; border: 1px solid var(--line); }
.viewer-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; font-size: 13.5px; }
.viewer-list li + li { border-top: 1px solid var(--line); }
.viewer-list li span { min-width: 0; overflow-wrap: anywhere; }
.btn.small { height: 32px; padding: 0 12px; font-size: 11.5px; }
#viewer-add { flex-wrap: wrap; }
#viewer-add input { flex: 1 1 240px; min-width: 0; max-width: 360px; }
@media (max-width: 600px) { #viewer-add input { max-width: none; flex-basis: 100%; } #viewer-add .btn { width: 100%; } }
.form-row label { min-width: 0; max-width: 100%; }
.form-row select { max-width: 100%; }
@media (max-width: 600px) { .form-row label { width: 100%; } .form-row select, .form-row input { width: 100%; } }


/* Hide app pages until the sign-in check passes (no flash of the dashboard before the login page) */
html.booting body { visibility: hidden; }
html.booting::before { content: ''; position: fixed; top: 50%; left: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; border: 3px solid #cfe0dc; border-top-color: #0D6358; border-radius: 50%; animation: boot-spin .8s linear infinite; }
@keyframes boot-spin { to { transform: rotate(360deg); } }

/* ---------- Reviews list ---------- */
.reviews-card[hidden] { display: none; }
.reviews-card .card-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.rev-tabs { display: flex; border: 1px solid var(--line); }
.rev-tabs button { background: #fff; border: 0; padding: 8px 14px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.rev-tabs button + button { border-left: 1px solid var(--line); }
.rev-tabs button b { font-weight: 700; color: var(--ink); margin-left: 4px; }
.rev-tabs button[aria-selected="true"] { background: var(--green); color: #fff; }
.rev-tabs button[aria-selected="true"] b { color: #fff; }
.rev-list { list-style: none; margin: 12px var(--pad) 0; padding: 0; border: 1px solid var(--line); }
.rev { padding: 14px 16px; }
.rev + .rev { border-top: 1px solid var(--line); }
.rev-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stars { color: #f2b23e; letter-spacing: 1px; font-size: 14px; }
.stars .off { color: #d9dddd; }
.rev .who { font-size: 13.5px; }
.tag { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border: 1px solid; }
.tag.new { color: var(--green); border-color: var(--green); background: var(--sage-50); }
.tag.edited { color: #8a5a00; border-color: #e3bd16; background: #fff8e1; }
.tag.replied { color: var(--ink-3); border-color: var(--line); }
.rev-dates { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.rev-text { margin: 8px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; }
.rev-empty { padding: 16px; font-size: 13px; color: var(--ink-3); }
#rev-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
body.exporting #reviews-card { display: none !important; }
@media (max-width: 600px) { .rev-tabs { width: 100%; } .rev-tabs button { flex: 1; padding: 8px 6px; } .rev { padding: 12px; } }

table.cmp td .split { display: block; font-size: 10.5px; font-weight: 500; color: var(--ink-3); white-space: nowrap; }

/* Confirmation popup (Settings safety checks) */
.confirm-backdrop { position: fixed; inset: 0; z-index: 2000; background: rgba(20, 20, 20, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.confirm-box { background: #fff; width: 100%; max-width: 440px; padding: 24px; border-top: 4px solid var(--maroon); box-shadow: 0 16px 48px rgba(0, 0, 0, .25); }
.confirm-box h3 { margin: 0 0 8px; font-size: 18px; color: var(--maroon); }
.confirm-box p { margin: 0 0 20px; color: var(--ink-2); overflow-wrap: anywhere; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.btn.danger-fill { background: var(--down); border-color: var(--down); color: #fff; }
.btn.danger-fill:hover { background: #8f1c30; }
@media (max-width: 600px) { .confirm-actions .btn { flex: 1 1 140px; } }

/* Review Rankings */
.rank-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--green-700); }
.rank-pick select { height: 40px; padding: 0 10px; border: 1px solid var(--green); border-radius: 0; background: #fff; font: inherit; font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); }
table.cmp.rank thead tr:first-child th { text-align: right; color: var(--green-700); }
table.cmp.rank thead tr:first-child th:nth-child(2) { text-align: left; }
table.cmp.rank th .sub { display: block; font-size: 10px; font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--ink-3); margin-top: 2px; }
table.cmp.rank th.rk, table.cmp.rank td.rk { text-align: center; width: 48px; color: var(--ink-3); font-weight: 700; }
table.cmp.rank th:first-child, table.cmp.rank td:first-child { position: static; }
table.cmp.rank th:nth-child(2), table.cmp.rank td:nth-child(2) { text-align: left; position: sticky; left: 0; background: inherit; }
table.cmp.rank td .city { display: block; font-size: 11.5px; color: var(--ink-3); }
table.cmp.rank td.big { font-size: 15px; }
table.cmp.rank tr.top td.rk { color: #fff; }
table.cmp.rank tr.top1 td.rk { background: var(--maroon); }
table.cmp.rank tr.top2 td.rk { background: var(--green); }
table.cmp.rank tr.top3 td.rk { background: var(--green-700); opacity: .85; }
table.cmp.rank .star { color: #e7a92c; }
.rank-foot { margin-top: 10px; }
@media (max-width: 600px) {
  .rank-pick { width: 100%; }
  .rank-pick select { flex: 1; }
  table.cmp.rank th.rk, table.cmp.rank td.rk { width: 34px; padding-left: 4px; padding-right: 4px; }
}

/* Report dropdown in the top menu: Dashboard View / Table View (admins) */
.topbar nav { overflow: visible !important; }
.nav-dd { position: relative; display: flex; }
.nav-dd-btn { display: flex; align-items: center; gap: 6px; height: 100%; padding: 0 14px; background: none; border: 0; border-top: 3px solid transparent; border-bottom: 3px solid transparent; font: inherit; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.nav-dd-btn:hover, .nav-dd.open .nav-dd-btn { color: var(--green); }
.nav-dd.active .nav-dd-btn { color: var(--green); border-bottom-color: var(--green); }
.nav-dd-btn svg { transition: transform .15s; }
.nav-dd.open .nav-dd-btn svg { transform: rotate(180deg); }
.nav-dd-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 190px; padding: 4px 0; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--green); box-shadow: 0 10px 28px rgba(0, 0, 0, .12); z-index: 60; }
.nav-dd.open .nav-dd-menu { display: block; }
.topbar nav .nav-dd-menu a { display: block; height: auto; padding: 11px 16px; border: 0; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.topbar nav .nav-dd-menu a:hover, .topbar nav .nav-dd-menu a:focus-visible { background: var(--sage-50); color: var(--green); outline: none; }
.topbar nav .nav-dd-menu a.current { color: var(--green); font-weight: 700; box-shadow: inset 3px 0 0 var(--green); }
@media (max-width: 860px) { .nav-dd-btn { padding: 0 8px; font-size: 13px; } }
@media (max-width: 600px) {
  .nav-dd { flex: 1; }
  .nav-dd-btn { width: 100%; justify-content: center; padding: 0 4px; font-size: 13px; }
  .nav-dd-menu { min-width: 100%; width: max-content; }
  .topbar nav .nav-dd-menu a { padding: 14px 16px; font-size: 14px; }
}

/* Admin previewing the viewer experience */
.preview-bar { position: relative; z-index: 70; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; background: var(--maroon); color: #fff; font-size: 13px; text-align: center; }
.preview-bar .btn { height: 32px; padding: 0 12px; background: #fff; border-color: #fff; color: var(--maroon); }
.preview-bar .btn:hover { background: #f6e9ec; }
.preview-row { margin-top: 14px; }
