:root {
  color-scheme: light;
  --paper: #f4f6f8;
  --panel: #fff;
  --ink: #18253b;
  --muted: #4f5e72;
  --stroke: #dce3ea;
  --rail: #17263b;
  --rail-raised: #293e56;
  --rail-text: #c3d0dc;
  --accent: #185d55;
  --accent-hover: #124941;
  --accent-soft: #e6f3ee;
  --accent-light: #9bcbbd;
  --warn-ink: #6c460a;
  --warn-soft: #fcf0d9;
  --error-ink: #8b3139;
  --error-soft: #faecee;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.6 var(--font); }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid #318e83; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 2; left: 16px; top: 16px; transform: translateY(-150%); background: var(--panel); padding: 8px 16px; }
.skip-link:focus { transform: none; }
.muted { color: var(--muted); }

.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-size: 20px; font-weight: 750; letter-spacing: .045em; }
.brand-mark { display: inline-flex; align-items: end; gap: 3px; width: 26px; height: 26px; padding: 5px; border-radius: 6px; background: #7bc9b2; }
.brand-mark i { width: 3px; border-radius: 1px; background: var(--rail); height: 6px; }
.brand-mark i:nth-child(2) { height: 10px; }
.brand-mark i:nth-child(3) { height: 15px; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 650; letter-spacing: .04em; }
.eyebrow span { margin: 0 4px; color: #728198; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 7px 15px; border: 1px solid transparent; border-radius: 7px; font-weight: 650; line-height: 1.45; white-space: nowrap; cursor: pointer; }
.button-primary { background: var(--accent); color: #fff; }
.button-primary:hover { background: var(--accent-hover); }
.button-secondary { background: var(--panel); color: var(--ink); border-color: var(--stroke); }
.button-secondary:hover { border-color: #94a4b7; }
.download-mark { font-size: 18px; line-height: 1; font-weight: 700; }
.text-button { padding: 4px 0; border: 0; background: transparent; color: inherit; cursor: pointer; }
.text-button:hover { text-decoration: underline; }

.login-layout { display: grid; grid-template-columns: minmax(300px, 42%) 1fr; min-height: 100vh; }
.login-aside { display: flex; flex-direction: column; justify-content: space-between; padding: clamp(32px, 5vw, 78px); background: var(--rail); color: #fff; }
.login-aside-content h2 { margin: 15px 0; font-weight: 680; font-size: clamp(34px, 4vw, 62px); letter-spacing: -.04em; line-height: 1.14; }
.login-aside-content .eyebrow { color: #91d5be; }
.login-aside-content p:not(.eyebrow), .login-aside-footer { color: var(--rail-text); }
.login-aside-footer { font-size: 12px; }
.login-main { display: grid; place-items: center; padding: clamp(24px, 6vw, 90px); }
.login-form { display: flex; flex-direction: column; width: min(100%, 390px); }
.login-form h1 { margin-bottom: 3px; font-size: 32px; letter-spacing: -.04em; }
.login-form > p { margin-bottom: 18px; }
.login-form label { margin: 12px 0 6px; font-weight: 650; }
.login-form input:not([type=hidden]), .filter-control input, .filter-control select { min-width: 0; min-height: 42px; padding: 7px 11px; border: 1px solid #c9d4df; border-radius: 7px; background: var(--panel); color: var(--ink); }
.login-form .button { margin-top: 24px; }
.form-error { margin: 0; padding: 9px 12px; border-radius: 6px; color: var(--error-ink); background: var(--error-soft); }

.shell { display: grid; grid-template-columns: 219px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 28px 16px 18px; background: var(--rail); color: var(--rail-text); }
.rail-brand { align-self: start; margin: 0 9px; }
.rail-title { margin: 12px 9px 28px; font-size: 13px; }
.rail-nav { display: grid; gap: 4px; }
.rail-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 7px; font-weight: 650; }
.rail-nav a:hover, .rail-nav a[aria-current=page] { color: #fff; background: var(--rail-raised); }
.rail-nav a[aria-current=page] .nav-mark { color: #9cdbca; }
.nav-mark { position: relative; width: 15px; height: 15px; color: inherit; border: 1px solid currentColor; border-radius: 3px; }
.daily-mark::after { content: ""; position: absolute; inset: 4px 3px; border-block: 1px solid currentColor; }
.weekly-mark::after { content: ""; position: absolute; inset: 3px 4px; border-inline: 1px solid currentColor; }
.stores-mark { height: 13px; border-top-left-radius: 5px; border-top-right-radius: 5px; }
.stores-mark::after { content: ""; position: absolute; inset: 4px 4px 0; border: 1px solid currentColor; border-bottom: 0; }
.rail-account { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 7px; margin-top: auto; padding: 14px 0 0; border-top: 1px solid #394c62; font-size: 12px; }
.account-avatar { height: 28px; display: grid; place-items: center; border-radius: 50%; background: #3c5669; color: #fff; font-weight: 750; }
.account-detail { display: grid; gap: 1px; }
.account-detail strong { overflow: hidden; color: #fff; text-overflow: ellipsis; white-space: nowrap; }
.account-detail span { font-size: 11px; }
.workbench { width: min(100%, 1590px); padding: 33px clamp(20px, 3.5vw, 56px) 48px; }
.screen-header { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 22px; }
.screen-header h1 { font-size: clamp(25px, 3vw, 36px); font-weight: 710; letter-spacing: -.04em; line-height: 1.2; margin-top: 5px; }

.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 14px; padding: 12px 14px; border: 1px solid var(--stroke); border-radius: 9px; background: var(--panel); }
.filter-control { display: grid; gap: 4px; }
.filter-control label, .filter-label { color: var(--muted); font-size: 12px; font-weight: 650; }
.city-control select { min-width: 118px; }
.country-nav { display: flex; align-items: center; min-height: 42px; padding: 4px; gap: 2px; border: 1px solid var(--stroke); border-radius: 7px; background: var(--paper); }
.country-nav a { padding: 4px 9px; color: var(--muted); border-radius: 4px; }
.country-nav a[aria-current=true] { background: var(--panel); color: var(--accent); font-weight: 700; }
.country-nav a:hover { text-decoration: underline; }
.filter-bar > .badge { align-self: center; margin-left: auto; }
.report-context { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 16px 0; }
.report-period, .batch-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 11px; }
.report-period time, .number { font-variant-numeric: tabular-nums; }
.report-period time { font-weight: 700; }
.period-zone, .batch-info { font-size: 12px; color: var(--muted); }
.batch-failures { color: var(--error-ink); }
.badge { display: inline-flex; align-items: center; max-width: 100%; padding: 3px 8px; border-radius: 5px; background: #edf1f5; color: #415267; font-size: 12px; font-weight: 650; line-height: 1.45; white-space: nowrap; }
.market-active, .batch-complete, .quality-exact { background: var(--accent-soft); color: var(--accent); }
.market-pilot, .batch-partial, .quality-partial, .quality-tier, .quality-estimated { background: var(--warn-soft); color: var(--warn-ink); }
.batch-failed, .batch-missed, .quality-rollback { background: var(--error-soft); color: var(--error-ink); }

.report-overview { display: grid; grid-template-columns: minmax(0, 2.25fr) minmax(190px, 1fr); gap: 14px; margin-bottom: 17px; }
.trend-panel, .metric-panel, .table-panel { background: var(--panel); border: 1px solid var(--stroke); border-radius: 9px; }
.section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 5px 12px; padding: 14px 17px 8px; }
.section-head h2 { font-size: 17px; font-weight: 700; }
.section-head .muted { font-size: 12px; }
.chart-wrap { overflow-x: auto; }
.trend-chart { display: block; width: 100%; min-width: 370px; padding: 2px 11px 10px; }
.chart-grid { stroke: var(--stroke); stroke-width: 1; fill: none; }
.chart-bar { fill: var(--accent-light); }
.chart-bar-emphasis { fill: var(--accent); }
.chart-value { fill: var(--ink); font-size: 14px; font-weight: 650; }
.chart-label { fill: var(--muted); font-size: 13px; }
.chart-meta { fill: var(--muted); font-size: 11px; }
.metric-panel { display: flex; flex-direction: column; justify-content: center; padding: 12px 17px; }
.metric { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 9px 0; color: var(--muted); }
.metric + .metric { border-top: 1px solid var(--stroke); }
.metric strong { color: var(--ink); font-size: 23px; font-variant-numeric: tabular-nums; font-weight: 700; line-height: 1; }
.metric-primary strong { color: var(--accent); font-size: 35px; letter-spacing: -.045em; }
.metric small { font-size: 15px; font-weight: 500; }
.coverage-note { margin-top: 6px; color: var(--muted); font-size: 12px; }

.table-panel .section-head { padding-bottom: 12px; }
.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline-offset: -3px; }
table { width: 100%; min-width: 610px; border-collapse: collapse; text-align: left; font-size: 13px; }
tr { border-top: 1px solid var(--stroke); }
th, td { padding: 9px 12px; vertical-align: middle; }
th:first-child { padding-left: 17px; }
th:last-child, td:last-child { padding-right: 17px; }
th { font-weight: 650; }
thead th { color: var(--muted); background: var(--paper); white-space: nowrap; }
tbody tr:hover { background: #f7f9fb; }
.store-number, .tier-note, .store-context span { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.store-name { display: block; min-width: 130px; }
.tier-note { color: var(--warn-ink); margin-top: 3px; }
.store-context { min-width: 105px; }
.empty-panel, .empty-chart { padding: 22px 17px; color: var(--muted); }
.empty-panel span { display: block; margin-top: 4px; }

@media (max-width: 950px) {
  .shell { grid-template-columns: 174px minmax(0, 1fr); }
  .rail { padding-inline: 12px; }
  .rail-account { grid-template-columns: minmax(0, 1fr) auto; }
  .account-avatar { display: none; }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .rail { position: static; flex-flow: row wrap; align-items: center; height: auto; padding: 9px 14px; gap: 8px 12px; }
  .rail-brand { margin: 0; align-self: center; }
  .rail-title, .account-detail { display: none; }
  .rail-nav { display: flex; flex-wrap: wrap; }
  .rail-nav a { padding: 6px 8px; gap: 6px; }
  .rail-account { display: block; border: 0; margin: 0 0 0 auto; padding: 0; }
  .workbench { padding: 19px 14px 35px; }
  .report-overview { grid-template-columns: 1fr; }
  .metric-panel { grid-row: 1; }
  .trend-chart { min-width: 0; }
  .chart-value { font-size: 20px; }
  .chart-label { font-size: 18px; }
  .chart-meta { font-size: 16px; }
  .login-layout { grid-template-columns: 1fr; }
  .login-aside { padding: 19px 22px; }
  .login-aside-content, .login-aside-footer { display: none; }
  .login-main { align-items: start; min-height: 78vh; padding-top: 48px; }
}
@media (max-width: 425px) {
  .screen-header { align-items: start; flex-direction: column; gap: 10px; margin-bottom: 15px; }
  .rail-nav { order: 3; width: 100%; }
  .filter-bar { padding: 9px; gap: 8px; }
  .filter-bar > .badge { margin-left: 0; }
}
