@font-face { font-family: Inter; font-weight: 100 900; font-display: swap; src: url(inter-latin.woff2) format("woff2"); }
@font-face { font-family: Inter; font-weight: 100 900; font-display: swap; src: url(inter-latin-ext.woff2) format("woff2"); unicode-range: U+0100-024F, U+1E00-1EFF; }
@font-face { font-family: "Instrument Serif"; font-display: swap; src: url(instrument-serif-latin.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-display: swap; src: url(instrument-serif-latin-ext.woff2) format("woff2"); unicode-range: U+0100-024F, U+1E00-1EFF; }

:root {
    color-scheme: light;
    --canvas: #f3f5ef;
    --surface: #fffefa;
    --line: #dce2d7;
    --ink: #1d2c25;
    --muted: #526357;
    --dark: #172f28;
    --green: #2d6250;
    --gold: #f3d9a1;
    --accent: #e6eee6;
    --gutter: clamp(.85rem, 3.8vw, 3.75rem);
    color: var(--ink);
    background: var(--canvas);
    font: 400 .9375rem/1.45 Inter, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
h1, h2, p { margin: 0; }
h1 { font: 400 clamp(2.7rem, 5vw, 4rem)/1 "Instrument Serif", Georgia, serif; }
h2 { font-size: .99rem; font-weight: 690; }
a { color: var(--green); }
button, input, select { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #558965; outline-offset: 3px; }
.muted, .empty, .period-note { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.topbar { background: var(--dark); border-bottom: 3px solid #436451; color: white; }
.top-inner { max-width: 90rem; margin: auto; min-height: 4.65rem; display: flex; align-items: center; gap: 1rem; padding: .65rem var(--gutter); }
.brand { flex: 0 0 auto; display: inline-flex; flex-direction: column; gap: .07rem; color: var(--gold); line-height: 1; text-decoration: none; }
.brand b { font-size: 1.65rem; font-weight: 850; letter-spacing: -.075em; }
.brand span { font-size: .53rem; font-weight: 700; letter-spacing: .19em; }
.brand-dark { color: var(--dark); }
.topbar nav { display: flex; gap: .25rem; margin-left: auto; }
.topbar nav a, .logout button { border-radius: .4rem; color: white; text-decoration: none; font-size: .85rem; font-weight: 620; padding: .48rem .7rem; }
.topbar nav a:hover, .logout button:hover { background: #355749; }
.topbar nav a[aria-current] { color: var(--dark); background: var(--gold); }
.logout button { background: transparent; border: 1px solid #677d70; }
.dashboard { max-width: 90rem; margin: auto; padding: 1.4rem var(--gutter) 3rem; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: .55rem 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.sync { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .8rem; }
.sync::before { content: ""; width: .44rem; height: .44rem; border-radius: 50%; background: #477656; }
.sync-stale::before { background: #a45b25; }
.filters, .panel, .metric, .login-card { background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; }
.filters { display: flex; align-items: end; flex-wrap: wrap; gap: .6rem; padding: .7rem; margin-bottom: .95rem; }
.presets, .filter-label { display: flex; align-items: center; flex: 1 1 auto; gap: .36rem; align-self: end; }
.filter-label { padding: .5rem; color: var(--muted); }
.presets a { text-decoration: none; border: 1px solid var(--line); padding: .4rem .62rem; border-radius: .4rem; font-size: .81rem; font-weight: 600; white-space: nowrap; }
.presets a:hover, .presets a[aria-current] { background: var(--accent); border-color: #b6c8b7; }
.filters label, .login-form label { display: grid; gap: .23rem; min-width: 0; color: var(--muted); font-size: .77rem; font-weight: 660; }
input, select, .primary { min-height: 2.45rem; border-radius: .4rem; padding: .43rem .62rem; }
input, select { width: 100%; background: #fff; color: var(--ink); border: 1px solid #c7d1c7; }
.primary { color: #fff; background: var(--green); border: 1px solid var(--green); font-weight: 680; }
.primary:hover { background: var(--dark); border-color: var(--dark); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
.metric { min-width: 0; padding: .85rem 1rem; border-top: 3px solid #8eaa91; }
.metric h2 { font-size: .8rem; color: var(--muted); }
.metric strong { display: block; font-size: clamp(1.05rem, 2.3vw, 1.7rem); font-variant-numeric: tabular-nums; margin: .28rem 0; letter-spacing: -.041em; overflow-wrap: anywhere; }
.change { display: inline-block; padding: .12rem .33rem; font-size: .74rem; font-weight: 680; background: var(--canvas); border-radius: .25rem; }
.change.up { color: #235a3b; background: #e4efe3; }
.change.down { color: #953821; background: #f6e8df; }
.period-note { font-size: .79rem; margin: .47rem 0 .85rem; }
.panels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: .7rem; margin-top: .7rem; align-items: start; }
.panel { min-width: 0; overflow: hidden; }
.panel-heading { display: flex; flex-wrap: wrap; gap: .45rem .7rem; align-items: center; padding: .8rem .9rem; }
.panel-heading h2 { flex: 1 1 auto; }
.panel-heading > a { font-size: .77rem; text-decoration: none; font-weight: 670; }
.panel-heading > a:hover { text-decoration: underline; }
.table-search { display: flex; flex: 0 0 auto; }
.table-search[open] { display: flex; flex: 1 1 100%; }
.table-search summary { width: 2rem; height: 2rem; display: grid; place-items: center; list-style: none; border: 1px solid var(--line); border-radius: .4rem; }
.table-search summary::-webkit-details-marker { display: none; }
.table-search input { margin-top: .4rem; }
.search-icon { position: relative; display: block; width: .68rem; height: .68rem; border: 1.6px solid var(--green); border-radius: 50%; }
.search-icon::after { content: ""; width: .39rem; height: 1.6px; background: var(--green); position: absolute; left: 75%; top: 90%; transform: rotate(45deg); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
thead { color: var(--muted); background: #f0f3ea; }
th, td { padding: .55rem .68rem; text-align: left; vertical-align: middle; border-top: 1px solid var(--line); }
th:first-child, td:first-child { padding-left: .9rem; }
th:last-child, td:last-child { padding-right: .9rem; }
thead th { font-size: .73rem; font-weight: 650; }
tbody th { font-weight: 620; overflow-wrap: anywhere; }
tbody th small { display: block; color: var(--muted); font-weight: 400; }
tbody tr:nth-child(even) { background: #fafbf6; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { white-space: nowrap; }
.empty { padding: .8rem .9rem; }
.empty.search-empty { display: none; }
.chart { margin-bottom: .7rem; }
.chart-unit { color: var(--muted); font-size: .75rem; }
.chart-area { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .6rem; margin: .35rem .9rem .8rem; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; height: 7rem; color: var(--muted); font-size: .68rem; text-align: right; font-variant-numeric: tabular-nums; }
.bars { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: .2rem; background: linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 50%, var(--line) 50% calc(50% + 1px), transparent calc(50% + 1px) calc(100% - 1px), var(--line) calc(100% - 1px)); background-size: 100% 7rem; background-repeat: no-repeat; }
.bar { min-width: 0; text-align: center; }
.bar > div { position: relative; height: 7rem; }
.bar meter { width: 7rem; height: clamp(.48rem, 2.65vw, 2rem); position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-90deg); appearance: none; background: transparent; }
meter::-webkit-meter-bar { background: transparent; border: 0; }
meter::-webkit-meter-optimum-value { background: #4a7961; border-radius: .15rem; }
meter::-moz-meter-bar { background: #4a7961; border-radius: .15rem; }
.bar small { color: var(--muted); font-size: .65rem; }
.notice { margin-bottom: .75rem; padding: .68rem .8rem; background: #f9eee0; border: 1px solid #eed9bd; color: #784b26; border-radius: .45rem; }
.login-shell { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(ellipse at 18% 0%, #d7e6d6, transparent 58%), var(--canvas); }
.login-card { width: min(100%, 28rem); padding: clamp(1.25rem, 5vw, 2.5rem); box-shadow: 0 18px 70px #172f2810; }
.login-card .brand { margin-bottom: 1.2rem; }
.login-card h1 { font-size: clamp(2.4rem, 8vw, 3.2rem); }
.login-card .muted { margin: .65rem 0 1.3rem; }
.login-form { display: grid; gap: .8rem; }
.login-form input { font-size: .95rem; }
.login-form .primary { text-align: left; display: flex; justify-content: space-between; margin-top: .2rem; }

@media (max-width: 740px) {
    .top-inner { flex-wrap: wrap; justify-content: space-between; gap: .65rem; }
    .topbar nav { flex: 1 0 100%; flex-wrap: wrap; order: 2; margin-left: 0; }
    .topbar nav a { padding: .42rem .52rem; font-size: .8rem; }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    .panels { grid-template-columns: minmax(0, 1fr); }
    .metric { padding: .68rem; }
    .presets, .filter-label { flex-basis: 100%; }
    .filters label { flex: 1 1 7.5rem; }
    .filters .store-select { flex: 1 1 10rem; }
    td.num { white-space: normal; }
    th, td { padding: .44rem .38rem; }
    table { font-size: .75rem; }
}
