:root {
  --paper: #F5F5F1;
  --panel: #FFFFFF;
  --ink: #202923;
  --ink-2: #58625C;
  --ink-3: #707A73;
  --rule: #E1E5DE;
  --rule-2: #EDF0EA;
  --red: #BE2026;
  --red-soft: #FCEEEF;
  --basil: #26724B;
  --basil-soft: #EAF4ED;
  --mustard: #A77615;
  --mustard-soft: #FBF5E7;
  --slate: #5B6B7F;
  --sky: #356C95;
  --radius: 12px;
  --rail-w: 244px;
  --shadow: 0 2px 5px rgba(32, 41, 35, .025);
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 1, "kern" 1;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary, a, input, select { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.025em; }
h1 { font-size: clamp(26px, 2.2vw, 34px); line-height: 1.18; }
h2 { font-size: 18px; }
h3 { font-size: 15px; color: var(--ink-2); }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 30; padding: 10px 18px; border-radius: 8px; background: var(--ink); color: #fff; }
.skip-link:focus { top: 12px; }
.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }

/* Brand and navigation */
.rail { background: var(--panel); border-right: 1px solid var(--rule); padding: 22px 14px 18px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; height: 100dvh; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 7px; padding-bottom: 16px; border-bottom: 1px solid var(--rule-2); flex: none; }
.brand-home { display: inline-flex; border-radius: 8px; }
.brand-logo { display: block; width: 93px; height: auto; }
.brand-sub { color: var(--ink-3); font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.nav { list-style: none; margin: 0; padding: 0 1px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.nav-label { padding: 16px 12px 5px; color: var(--ink-3); font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.nav-label:first-child { padding-top: 0; }
.nav a { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-size: 13px; font-weight: 500; line-height: 1.4; transition: background .15s, color .15s; }
.nav a svg { width: 18px; height: 18px; opacity: .8; }
.nav a:hover { background: #F5F7F2; color: var(--ink); }
.nav a.on { background: var(--red-soft); color: var(--red); font-weight: 600; }
.nav a.on::before { content: ""; position: absolute; left: -1px; height: 17px; width: 3px; border-radius: 3px; background: var(--red); }
.nav a.on svg { opacity: 1; }
.nav-toggle { display: none; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 7px; padding: 13px 10px 0; border-top: 1px solid var(--rule-2); flex: none; }
.rail-note { color: var(--ink-3); font-size: 11px; padding-left: 28px; }
.mode-badge { align-self: flex-start; background: var(--mustard-soft); color: #654805; border: 1px solid #E9D7A7; border-radius: 6px; padding: 5px 8px; font-size: 11px; font-weight: 600; }
.link { background: none; border: 0; padding: 0; color: var(--basil); cursor: pointer; text-align: left; font-weight: 600; }
.link:hover { text-decoration: underline; }
.refresh-button { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; }
.refresh-button svg { width: 18px; height: 18px; }
.refresh-button[aria-busy="true"] svg { animation: spin 1s linear infinite; }

/* Compact report filters */
.main { min-width: 0; display: flex; flex-direction: column; }
.controls { background: rgba(255, 255, 255, .97); border-bottom: 1px solid var(--rule); padding: 17px 30px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; position: sticky; top: 0; z-index: 10; }
.control-group { display: flex; flex-direction: column; gap: 6px; max-width: 100%; min-width: 0; }
.control-label { color: var(--ink-3); font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
.boundary-control { margin-left: auto; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { border: 1px solid var(--rule); background-color: var(--panel); border-radius: 7px; padding: 9px 11px; min-height: 40px; min-width: 0; max-width: 100%; font-size: 13px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--basil); }
select { cursor: pointer; }
#day-boundary { font-size: 12px; max-width: 248px; }
.filter-menu { position: relative; }
.filter-menu > summary { display: flex; align-items: center; gap: 10px; min-height: 40px; min-width: 184px; max-width: 300px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 7px; background: var(--panel); list-style: none; cursor: pointer; font-size: 13px; font-weight: 500; }
.filter-menu > summary::-webkit-details-marker { display: none; }
.filter-menu > summary svg { width: 17px; height: 17px; color: var(--ink-3); }
.filter-menu > summary:hover, .filter-menu[open] > summary { border-color: #9AA99F; background: #FCFDFB; }
#store-selection-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chevron { margin-left: auto; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); flex: none; position: relative; top: -2px; }
.filter-menu[open] .chevron { transform: rotate(225deg); top: 2px; }
.filter-popover { position: absolute; left: 0; top: calc(100% + 10px); z-index: 12; width: 380px; max-width: calc(100vw - 32px); max-height: min(560px, 70dvh); overflow-y: auto; padding: 20px; background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 14px 40px rgba(27, 42, 32, .14), 0 2px 8px rgba(27, 42, 32, .04); }
.popover-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 14px; }
.popover-heading .link { font-size: 12px; padding: 5px 0 5px 10px; }
.filter-hint { color: var(--ink-3); font-size: 12px; margin-bottom: 15px; }
.chips { display: grid; gap: 6px; }
.chip { width: 100%; border: 1px solid transparent; border-radius: 7px; padding: 9px 11px; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--ink-2); background: #F6F7F4; font-size: 13px; text-align: left; }
.chip::after { content: ""; margin-left: auto; width: 14px; height: 14px; border: 1px solid #ADB8AF; border-radius: 4px; flex: none; }
.chip.on { color: #205D3E; background: var(--basil-soft); border-color: #D9E9DD; }
.chip.on::after { content: "✓"; border-color: var(--basil); background: var(--basil); color: #fff; font-size: 11px; line-height: 12px; text-align: center; }
.chip:hover { border-color: #99B4A3; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); flex: none; }
.chip .dot.online { background: var(--basil); }
.chip .dot.offline { background: var(--red); }
.chip.all { font-weight: 600; margin-bottom: 4px; }
.segmented { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid var(--rule); border-radius: 9px; background: #EFF2EC; }
.segmented button { border: 0; border-radius: 6px; background: transparent; padding: 8px 13px; cursor: pointer; color: var(--ink-2); font-size: 13px; line-height: 1.4; font-weight: 500; }
.segmented button:hover:not(:disabled) { background: rgba(255, 255, 255, .7); color: var(--ink); }
.segmented button.on { background: var(--panel); color: var(--basil); box-shadow: 0 1px 4px rgba(25, 43, 32, .1); font-weight: 600; }
#range-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: transparent; border: 0; padding: 4px 0 0; gap: 7px; }
#range-presets button { text-align: left; background: #F5F7F2; min-height: 39px; border: 1px solid transparent; }
#range-presets button.on { color: var(--basil); background: var(--basil-soft); border-color: #CBDFD1; box-shadow: none; }
.custom-range { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--rule); }
.custom-range label { display: flex; flex: 1 1 130px; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink-2); }
.custom-range input { width: 100%; }
.custom-range .btn { width: 100%; }
.btn { border: 1px solid var(--red); background: var(--red); color: #fff; border-radius: 7px; padding: 9px 16px; min-height: 40px; cursor: pointer; font-size: 13px; font-weight: 600; box-shadow: 0 1px 2px rgba(98, 11, 16, .08); transition: background .15s, border-color .15s; }
.btn:hover { background: #A71C22; border-color: #A71C22; }
.btn.secondary { background: var(--panel); border-color: var(--rule); color: var(--ink); box-shadow: none; }
.btn.secondary:hover { background: var(--rule-2); }
.btn:disabled, .link:disabled { cursor: wait; opacity: .55; }
.status { margin: 16px 30px 0; padding: 12px 16px; border-radius: 8px; background: var(--mustard-soft); color: #76551B; font-size: 13px; border: 1px solid #EEDFB9; }
.status.error { background: var(--red-soft); color: #921B21; border-color: #F0D0D2; }
.status.info { background: var(--rule-2); color: var(--ink-2); border-color: var(--rule); }

/* Report hierarchy */
.view { padding: 24px 30px 56px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.view-head > div:first-child { flex: 1 1 440px; }
.view-head p { color: var(--ink-2); max-width: 84ch; font-size: 13px; line-height: 1.65; margin-top: 9px; }
.view-head > .muted { font-size: 12px; margin-top: 6px; }
.view > p:not(.scope-callout) { font-size: 12px; line-height: 1.65; color: var(--ink-2); }
.loading { color: var(--ink-3); padding: 35px 0; display: flex; align-items: center; gap: 12px; font-size: 13px; }
.loading::before { content: ""; display: block; flex: none; width: 18px; height: 18px; border: 2px solid #D5DDD3; border-top-color: var(--basil); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.reporting-banner { order: -1; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 18px; padding: 0 0 14px; margin: 0; border-bottom: 1px solid var(--rule); color: var(--ink-3); font-size: 11px; }
.reporting-banner > span:first-child { display: flex; align-items: center; gap: 7px; }
.reporting-banner > span:first-child::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--basil); flex: none; }
.reporting-banner.partial > span:first-child::before { background: var(--mustard); }
.reporting-banner.demo > span:first-child::before { background: var(--slate); }
.reporting-banner a { color: var(--ink-2); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { position: relative; min-width: 0; padding: 19px 20px 18px; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.kpi:first-child { border-top: 3px solid var(--red); padding-top: 17px; }
.kpi .label { color: var(--ink-2); font-size: 12px; font-weight: 500; }
.kpi .value { font-size: clamp(24px, 2vw, 32px); font-weight: 600; letter-spacing: -.035em; line-height: 1.2; margin-top: 8px; overflow-wrap: anywhere; }
.kpi .delta { font-size: 11px; line-height: 1.5; margin-top: 9px; color: var(--ink-3); }
.kpi .delta.up { color: var(--basil); }
.kpi .delta.down { color: var(--red); }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; min-width: 0; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.panel h2 { font-size: 17px; }
.panel .sub { color: var(--ink-3); font-size: 12px; line-height: 1.65; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
.chart-wrap { position: relative; height: 275px; min-width: 0; margin-top: 5px; }
.chart-wrap.tall { height: 350px; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.tile { border-radius: 9px; padding: 15px; border: 1px solid var(--rule); background: var(--panel); min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
.tile .name { font-weight: 500; font-size: 12px; line-height: 1.4; display: flex; justify-content: space-between; gap: 6px; }
.tile .name .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; margin-top: 5px; }
.tile .num { font-size: 25px; font-weight: 600; letter-spacing: -.025em; }
.tile .foot { font-size: 11px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; }
.tile.h1 { background: #FFF6F4; border-color: #F1E5DF; } .tile.h2 { background: #FCEBE7; border-color: #F0DBD5; } .tile.h3 { background: #F8DFDC; border-color: #EBCDC8; }
.tile.g1 { background: #F4F8F1; border-color: #E1EBDD; } .tile.g2 { background: #EAF3E7; border-color: #D8E6D4; } .tile.g3 { background: #DDEDD9; border-color: #CBDFC5; }
.tile.err { background: var(--rule-2); color: var(--ink-3); }
.heat { display: grid; grid-template-columns: 52px repeat(7, 1fr); gap: 4px; font-size: 12px; }
.heat .hd { color: var(--ink-3); text-align: center; padding-bottom: 5px; }
.heat .rl { color: var(--ink-3); text-align: right; padding-right: 8px; line-height: 25px; }
.heat .c { height: 25px; border-radius: 4px; background: var(--rule-2); position: relative; }
.heat .c span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--ink-2); }
.heat .c.l1 { background: #F7E0E1; } .heat .c.l2 { background: #F0C1C3; } .heat .c.l3 { background: #E79A9D; } .heat .c.l4 { background: #CE5D64; } .heat .c.l5 { background: var(--red); }
.heat .c.l4 span, .heat .c.l5 span { color: #fff; }

/* Tables and supporting detail */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; line-height: 1.5; }
th, td { text-align: left; padding: 12px 13px; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
th { color: var(--ink-2); font-weight: 600; font-size: 11px; border-bottom-color: var(--rule); position: sticky; top: 0; z-index: 2; background: #F6F8F3; white-space: nowrap; }
th:first-child { border-top-left-radius: 7px; }
th:last-child { border-top-right-radius: 7px; }
td.num, th.num { text-align: right; }
td.num { white-space: nowrap; font-weight: 500; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #FCFDFB; }
tbody tr:hover { background: #F3F7EF; }
td:first-child { font-weight: 500; min-width: 120px; }
.table-scroll { overflow: auto; max-height: 420px; max-width: 100%; min-width: 0; border: 1px solid var(--rule-2); border-radius: 8px; scrollbar-width: thin; scrollbar-color: #BBC5B9 #F4F6F0; }
.table-scroll:focus-visible { outline-offset: 2px; }
.bar { height: 5px; background: var(--rule-2); border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--red); border-radius: 4px; }
.muted { color: var(--ink-3); }
.pos { color: var(--basil); } .neg { color: var(--red); }
.search { width: 260px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11px; color: var(--ink-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.empty { color: var(--ink-3); padding: 26px 14px; font-size: 13px; }
.count-notes { display: grid; gap: 14px; color: var(--ink-2); font-size: 13px; }
.count-notes b { color: var(--ink); }
.scope-callout { padding: 12px 16px; border: 1px solid #EADFBC; border-left: 3px solid #B39242; border-radius: 8px; background: var(--mustard-soft); color: #75613A; font-size: 12px; line-height: 1.7; }
.scope-callout b { color: #655022; }
.mini-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.mini-totals div { display: flex; flex-direction: column; gap: 4px; padding: 13px 15px; border-radius: 8px; background: #F3F6EF; }
.mini-totals span { color: var(--ink-2); font-size: 11px; }
.mini-totals b { font-size: 22px; font-weight: 600; }
details.panel { display: block; }
details.panel > summary { cursor: pointer; font-weight: 600; font-size: 14px; }
details.panel[open] > summary { margin-bottom: 18px; }
details.panel[open] > p { margin-bottom: 16px; font-size: 13px; color: var(--ink-2); }
.details-panel { padding: 0; }
.details-panel > summary { padding: 18px 22px; list-style-position: inside; }
.details-panel[open] > summary { border-bottom: 1px solid var(--rule); margin-bottom: 0; }
.details-panel > .count-notes, .details-body { padding: 20px 22px; }
.panel-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-toolbar label { color: var(--ink-2); font-size: 12px; }
.panel-toolbar .sub { margin: 0; }
.menu-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pizza-tabs { align-self: flex-start; flex-wrap: wrap; }
.pizza-tabs button:disabled { opacity: .45; cursor: not-allowed; }
#pizza-flavour { align-self: flex-start; }
.menu-category-nav { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border: 1px solid var(--rule); border-radius: 10px; background: var(--panel); }
.menu-category-nav label { font-weight: 600; font-size: 13px; }
.menu-category-nav select { min-width: 220px; }

/* Forecasts and local planning */
.forecast-view #period-controls { display: none; }
.forecast-controls { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; align-items: flex-end; gap: 14px; padding: 17px 20px; }
.forecast-controls > div { display: flex; flex-direction: column; gap: 6px; }
.forecast-controls label { font-size: 11px; color: var(--ink-2); font-weight: 500; }
.forecast-controls input { min-width: 156px; }
.forecast-controls select { min-width: 130px; }
.forecast-store-panel td:first-child { min-width: 180px; }
.forecast-store-panel td:nth-child(6) { min-width: 185px; }
.forecast-store-panel td:nth-child(9) { min-width: 170px; }
.forecast-store-panel td:nth-child(10) { min-width: 190px; }
.forecast-store-panel th:first-child, .forecast-store-panel td:first-child { position: sticky; left: 0; background: var(--panel); box-shadow: 1px 0 0 var(--rule); z-index: 1; }
.forecast-store-panel th:first-child { z-index: 3; background: #F6F8F3; }
.forecast-store-panel tr:hover td:first-child { background: #F3F7EF; }
#forecast-detail { min-width: 0; }
#forecast-detail > h2 { margin: 7px 0 8px; }
#forecast-detail > .table-scroll td:last-child { min-width: 240px; }
#forecast-detail > .table-scroll td:first-child { white-space: nowrap; }
.entry-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin: 20px 0; padding: 18px; background: #F6F8F3; border-radius: 9px; }
.entry-form label { display: flex; flex-direction: column; gap: 6px; flex: 1 1 160px; min-width: 0; font-size: 12px; color: var(--ink-2); }
.entry-form input, .entry-form select { width: 100%; }
.forecast-calendar { display: grid; grid-template-columns: repeat(7, minmax(112px, 1fr)); gap: 8px; margin: 18px 0 24px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; scrollbar-color: #BBC5B9 #F4F6F0; }
.calendar-heading { color: var(--ink-3); font-size: 10px; text-transform: uppercase; letter-spacing: .09em; padding: 6px 10px; }
.calendar-day { display: flex; flex-direction: column; gap: 7px; padding: 13px 11px; border: 1px solid #DEE8D9; border-radius: 8px; min-height: 144px; background: #F3F8EF; }
.calendar-day strong { font-size: 10px; font-weight: 600; color: var(--ink-2); }
.calendar-day b { font-size: 23px; letter-spacing: -.035em; color: #255637; font-weight: 600; }
.calendar-day > span { font-size: 11px; color: var(--ink-2); }
.calendar-day small { font-size: 10px; color: var(--ink-3); overflow-wrap: anywhere; }
.calendar-day .calendar-event { color: #82611D; background: #F8EDCE; padding: 3px 6px; border-radius: 4px; align-self: flex-start; }
.calendar-closed { background: var(--red-soft); border-color: #EED5D5; }
.calendar-closed b { color: var(--red); }
.forecast-subpanel { border-top: 1px solid var(--rule); padding: 17px 0; margin-top: 6px; }
.forecast-subpanel summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.forecast-subpanel[open] summary { margin-bottom: 14px; }
.forecast-subpanel .table-scroll { margin: 16px 0; }
.forecast-subpanel > label { font-size: 12px; margin-left: 12px; }

@media (min-width: 1500px) { .menu-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 1200px) {
  .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; }
  .controls { gap: 12px; }
  .boundary-control { margin-left: 0; }
  .filter-menu > summary { min-width: 168px; }
}
@media (max-width: 1000px) {
  :root { --rail-w: 222px; }
  .rail { padding-left: 10px; padding-right: 10px; }
  .nav a { font-size: 12px; gap: 9px; }
  .controls { padding: 14px 22px; }
  .view { padding: 20px 22px 40px; gap: 20px; }
  .status { margin-left: 22px; margin-right: 22px; }
  .panel { padding: 18px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .value { font-size: 28px; }
  .period-popover { left: auto; right: 0; }
}
@media (min-width: 761px) and (max-height: 850px) {
  .rail { padding-top: 14px; padding-bottom: 14px; gap: 10px; }
  .brand { padding-bottom: 12px; gap: 5px; }
  .brand-logo { width: 78px; }
  .nav { gap: 2px; }
  .nav a { padding-top: 7px; padding-bottom: 7px; }
  .nav-label { padding-top: 11px; padding-bottom: 4px; }
  .rail-foot { padding-top: 10px; gap: 4px; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: relative; height: auto; padding: 10px 20px; gap: 0; border-right: 0; border-bottom: 1px solid var(--rule); }
  .brand { flex-direction: row; padding: 0; border: 0; gap: 14px; }
  .brand-logo { width: 48px; }
  .brand-sub { font-size: 10px; letter-spacing: .06em; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; margin-left: auto; padding: 9px 11px; border: 1px solid var(--rule); background: var(--panel); border-radius: 7px; font-size: 12px; cursor: pointer; }
  .nav-toggle svg { width: 16px; height: 16px; }
  .rail .nav, .rail-foot { display: none; }
  .nav-open .rail .nav { display: flex; margin-top: 18px; max-height: 62dvh; }
  .nav-open .rail-foot { display: flex; margin-top: 12px; padding-bottom: 7px; }
  .nav a { font-size: 14px; padding: 11px 12px; }
  .nav-label { padding-top: 18px; }
  .controls { position: relative; padding: 14px 20px; gap: 12px; }
  .control-group { flex: 1 1 140px; }
  .boundary-control { flex: 0 1 auto; }
  .filter-menu > summary { min-width: 0; max-width: none; font-size: 12px; }
  .filter-popover { max-width: calc(100vw - 40px); }
  .filter-menu { position: static; }
  .filter-popover { left: 20px; right: auto; top: 80px; width: calc(100vw - 40px); }
  .view { padding: 20px; }
  .view-head > div:first-child { flex-basis: 100%; }
  .view-head > .muted { margin-top: 0; }
  .reporting-banner { align-items: flex-start; font-size: 10px; }
  .panel { padding: 17px; }
  .status { margin-left: 20px; margin-right: 20px; }
  .menu-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 440px) {
  .rail { padding-left: 16px; padding-right: 16px; }
  .brand-sub { max-width: 105px; }
  .controls, .view { padding-left: 16px; padding-right: 16px; }
  .filter-popover { left: 16px; max-width: calc(100vw - 32px); width: calc(100vw - 32px); }
  .boundary-control { flex-basis: 100%; flex-direction: row; align-items: center; gap: 12px; }
  #day-boundary { flex: 1; width: 100%; max-width: none; min-height: 35px; font-size: 11px; }
  .boundary-control .control-label { flex: none; }
  .forecast-view .stores-control { flex-basis: 100%; }
  .kpis { gap: 9px; }
  .kpi { padding: 15px; }
  .kpi:first-child { padding-top: 13px; }
  .kpi .value { font-size: 25px; }
  .kpi .label { font-size: 11px; }
  .kpi .delta { font-size: 10px; }
  .scope-callout { font-size: 11px; padding: 10px 12px; }
  .menu-category-nav { flex-direction: column; align-items: stretch; gap: 7px; padding: 14px; }
  .menu-category-nav select { min-width: 0; width: 100%; }
  .forecast-controls { gap: 12px; }
  .forecast-controls > div { flex: 1 1 120px; }
  .forecast-controls input, .forecast-controls select { width: 100%; min-width: 0; }
  .forecast-controls .btn { width: 100%; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .forecast-subpanel > label { display: block; margin: 12px 0 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print {
  .rail, .controls, .btn, .skip-link { display: none; }
  .app { display: block; }
  .view { padding: 0; }
  .table-scroll { max-height: none !important; overflow: visible; }
  .panel, .kpi { box-shadow: none; break-inside: avoid; }
}

/* Account menu, shared by the dashboard and account pages */
.account-menu { position: relative; flex: none; }
.account-menu > summary { display: flex; align-items: center; gap: 10px; list-style: none; cursor: pointer; padding: 5px 8px; border: 1px solid transparent; border-radius: 9px; min-height: 44px; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover, .account-menu[open] > summary { background: var(--paper); border-color: var(--rule); }
.account-avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--red-soft); color: var(--red); font-size: 12px; font-weight: 700; flex: none; }
.account-trigger-copy { display: grid; gap: 1px; max-width: 145px; }
.account-trigger-copy b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; font-weight: 600; }
.account-trigger-copy small { font-size: 10px; color: var(--ink-3); }
.account-menu .chevron { margin-left: 8px; }
.account-popover { position: absolute; right: 0; top: calc(100% + 9px); z-index: 25; width: 265px; max-width: calc(100vw - 32px); border: 1px solid var(--rule); border-radius: 12px; padding: 7px; background: var(--panel); box-shadow: 0 12px 36px rgba(27, 42, 32, .14); }
.account-popover-heading { display: grid; gap: 3px; padding: 10px 10px 13px; margin-bottom: 4px; border-bottom: 1px solid var(--rule-2); font-size: 13px; }
.account-popover-heading span { color: var(--ink-3); font-size: 11px; overflow-wrap: anywhere; }
.account-popover a, .account-popover button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 0; background: transparent; border-radius: 7px; text-decoration: none; text-align: left; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.account-popover svg { width: 17px; height: 17px; }
.account-popover a:hover { background: var(--paper); color: var(--ink); }
.account-popover button { color: var(--red); border-top: 1px solid var(--rule-2); border-radius: 0 0 7px 7px; margin-top: 4px; }
.account-popover button:hover { background: var(--red-soft); }
#range-presets button small { display: block; font-size: 10px; margin-top: 2px; opacity: .8; }
@media (max-width: 1150px) { .controls .account-trigger-copy { display: none; } }
@media (max-width: 600px) { .controls .account-menu { margin-left: auto; } }
