/* Layout: a warm tinted band carries the header; the dashboard sits on its own softly rounded sheet that scrolls under it, with a floating bar for moving between periods. */
:root {
  color-scheme: light;
  --band: #EFE9E2; --bg: #FBF9F6; --panel: #FFFFFF; --panel-2: #F5F1EC; --ink: #221D18; --muted: #6F665D; --faint: #A69C91; --line: #ECE5DD; --line-strong: #DCD3C8;
  --accent: #2F5BEA; --accent-ink: #FFFFFF; --accent-hover: #2650D6; --accent-soft: #ECF0FD; --accent-line: #CCD8FA;
  --good: #1E8A57; --bad: #D4472F; --good-soft: #E6F4EC; --bad-soft: #FCEBE7; --warn: #C98410;
  --c1: #2F5BEA; --c2: #EE9F3A; --c3: #8064DE; --c4: #1AA3A8; --c5: #E36A6F; --c6: #7393F2; --c7: #52B07F; --c8: #CFC6BA;
  --grid: #F2EDE7; --bar-muted: #E2DAD0; --ref: #A69C91; --overlay: rgba(34, 29, 24, .32);
  --shadow-sm: 0 1px 2px rgba(60, 40, 20, .04);
  --shadow: 0 1px 2px rgba(60, 40, 20, .04), 0 6px 18px rgba(60, 40, 20, .06);
  --shadow-lg: 0 14px 36px rgba(60, 40, 20, .13), 0 2px 6px rgba(60, 40, 20, .06);
  --font-display: "Plus Jakarta Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --fs-xs: .75rem; --fs-sm: .8125rem; --fs-md: .875rem; --fs-lg: 1rem; --fs-xl: 1.5rem; --fs-2xl: 1.875rem;
  --r: 18px; --r-sm: 12px; --sheet-r: 28px; --accent-deep: #1B3A9C;
  /* Page width parameters. The header row, the widget grid and the toasts share one content column.
     --content-max: the widest the header row and widgets get (88rem = 1408px; in rem so it follows browser zoom and font size).
     --pad: side padding for the header and inside the sheet (16px on phones).
     --sheet-max: the sheet is the content column plus its padding, so it stops growing exactly when the widgets do. */
  --content-max: 88rem; --pad: 28px; --sheet-max: calc(var(--content-max) + 2 * var(--pad));
}
html, body { height: 100%; margin: 0; }
body { background: var(--band); color: var(--ink); font-family: var(--font-body); font-size: var(--fs-md); line-height: 1.5; -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.good { color: var(--good); } .bad { color: var(--bad); }

.shell { display: flex; flex-direction: column; min-height: 100%; }
.title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.title-row .logo { flex: none; filter: drop-shadow(0 2px 5px color-mix(in srgb, var(--accent) 30%, transparent)); }
.store-line { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); } .dot.warn { background: var(--warn); }

/* Toolbar */
.main { min-width: 0; display: flex; flex-direction: column; width: 100%; flex: 1; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--band); }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: color-mix(in srgb, var(--band) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding-block: 20px 18px; padding-left: max(var(--pad), env(safe-area-inset-left, 0px), calc((100% - var(--content-max)) / 2)); padding-right: max(var(--pad), env(safe-area-inset-right, 0px), calc((100% - var(--content-max)) / 2)); display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; }
.top h1 { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xl); margin: 0; letter-spacing: -.03em; text-wrap: balance; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* The sheet hugs its widgets: it ends one padding below the last widget, with rounded corners and band showing beneath. */
.content { flex: none; overflow-x: clip; background: var(--bg); border-radius: var(--sheet-r); box-shadow: 0 0 0 1px rgba(60, 40, 20, .04), 0 -10px 30px rgba(60, 40, 20, .05); padding-block: var(--pad); margin-bottom: var(--pad); padding-left: max(var(--pad), env(safe-area-inset-left, 0px)); padding-right: max(var(--pad), env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 16px; }
.content > * { width: 100%; max-width: var(--content-max); margin-inline: auto; }
/* Large screens: below 96rem (1536px) the sheet runs edge to edge. From there the band has room for at least --pad of margin on each side
   (1408 content + 2 × 28 padding + 2 × 28 margin, plus a scrollbar), so the sheet stops at --sheet-max and sits centred on the band.
   Nothing scales up past this point; extra room becomes margin, so text and charts stay the same size. */
@media (min-width: 96rem) {
  .content { width: 100%; max-width: var(--sheet-max); margin-inline: auto; padding-inline: var(--pad); box-shadow: 0 0 0 1px rgba(60, 40, 20, .05), 0 -10px 30px rgba(60, 40, 20, .05); }
}

/* Controls */
.seg { display: inline-flex; background: var(--panel-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; color: var(--muted); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(60, 40, 20, .1), 0 0 0 1px var(--line); }
.select { appearance: none; -webkit-appearance: none; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23667085' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center; border: 1px solid var(--line); border-radius: 10px; padding: 6px 30px 6px 12px; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; box-shadow: var(--shadow-sm); }
.select:hover { border-color: var(--line-strong); }
.period-nav { display: inline-flex; align-items: center; gap: 8px; }
.period-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-size: var(--fs-sm); font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; cursor: pointer; min-width: 10.5rem; justify-content: space-between; white-space: nowrap; }
.period-btn:hover { border-color: var(--line-strong); }
.period-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.period-btn .pv { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 3px 9px; }
.period-btn svg { color: var(--muted); }
.cal { position: fixed; z-index: 9; top: 0; left: 0; width: min(23rem, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 12px; display: grid; gap: 10px; }
.cal .seg { display: flex; }
.cal .seg button { flex: 1; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; }
.cal-nav b { font-weight: 600; font-size: var(--fs-md); }
.cal-nav .icon-btn:disabled { opacity: .35; cursor: default; }
.cal-grid { display: grid; gap: 2px; }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow span { font-size: 11px; color: var(--faint); text-align: center; padding-bottom: 2px; }
.cal-weeks { display: grid; gap: 2px; }
.cal-day { height: 38px; display: grid; place-items: center; align-content: center; gap: 3px; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.cal-day.out { color: var(--faint); }
.d { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex: none; }
.d.up { background: var(--good); } .d.down { background: var(--bad); } .d.none { background: transparent; }
.cal-months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cal-month { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 6px; cursor: pointer; }
.cal-month:hover:not(:disabled) { border-color: var(--accent-line); background: var(--bg); }
.cal-month:disabled { opacity: .4; cursor: default; }
.cal-month[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.cal-week { border: 0; background: transparent; border-radius: 10px; padding: 0; cursor: pointer; color: inherit; font: inherit; }
.cal-week:hover:not(:disabled) { background: var(--panel-2); }
.cal-week[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); color: var(--accent); }
.cal-week[aria-pressed="true"] .cal-day.out { color: color-mix(in srgb, var(--accent) 45%, transparent); }
.cal-week:disabled { cursor: default; opacity: .4; }
.cal-month .mn { font-weight: 600; font-size: var(--fs-sm); }
.cal-actions { display: flex; justify-content: flex-end; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.cal-actions .btn { padding: 5px 13px; font-size: var(--fs-xs); }

.arrows { display: inline-flex; height: 36px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm); overflow: hidden; }
.arrows .step { border: 0; background: transparent; width: 38px; height: 100%; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.arrows .step + .step { border-left: 1px solid var(--line); }
.arrows .step:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
.arrows .step:disabled { color: var(--faint); opacity: .5; cursor: default; }
.arrows .step:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; border-radius: 999px; }
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 8px 15px; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; box-shadow: var(--shadow-sm); }
.btn:hover { border-color: var(--line-strong); background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); box-shadow: none; }
.btn.ghost:hover { color: var(--ink); background: var(--panel-2); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; color: var(--faint); width: 28px; height: 28px; border-radius: 7px; display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--panel-2); color: var(--ink); }

.banner { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r); padding: 10px 12px 10px 14px; font-size: var(--fs-sm); color: var(--accent-deep); }
.banner .btn { margin-left: auto; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.chip.sample { background: var(--panel); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-line); }
.chip.ok { background: var(--good-soft); color: var(--good); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }

/* Widgets */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 8px; grid-auto-flow: row dense; column-gap: 16px; row-gap: 0; margin-bottom: -16px; }
.board > .w, .board > .empty { margin-bottom: 16px; }
.board > .w { grid-row: span 57; }
.board > .empty { grid-row: span 32; align-content: center; }
.board.measuring > .w:not(.wide):not([data-hidden="true"]) { grid-row: auto !important; align-self: start; }
.board.measuring > .w:not(.wide):not([data-hidden="true"]) .w-body { flex: none; overflow: visible; }
@media (max-width: 1180px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .board { grid-template-columns: minmax(0, 1fr); } }
.w { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); min-width: 0; display: flex; flex-direction: column; position: relative; transition: box-shadow .2s ease, border-color .2s ease; }
.w:hover { box-shadow: var(--shadow); }
.w.wide { grid-column: 1 / -1; }
.w.dragging { opacity: .4; }
.w.drop-before { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.w-head { display: flex; align-items: center; gap: 4px; padding: 14px 10px 10px 18px; }
.grip { cursor: grab; color: var(--muted); display: inline-grid; place-items: center; width: 22px; height: 28px; border: 0; background: transparent; border-radius: 7px; padding: 0; }
.grip:hover { background: var(--panel-2); color: var(--ink); }
.w-head .grip { margin-left: -8px; }
.w-title { flex: 1; min-width: 0; }
.w-title h2 { margin: 0; font-size: var(--fs-md); font-weight: 600; letter-spacing: -.01em; }
.w-title p { margin: 0; font-size: var(--fs-xs); color: var(--faint); }
.w-body { padding: 4px 18px 18px; position: relative; flex: 1; min-height: 0; overflow: hidden; container-type: inline-size; }
.chev { transition: transform .2s ease; }
.hidden-ph { flex: 1; width: 100%; min-height: 0; display: grid; place-items: center; color: var(--line-strong); }
.w.stat[data-hidden="true"] .stat-tools { opacity: 1; }
body:not(.editing) .w.stat[data-hidden="true"]:not(:hover):not(:focus-within) .stat-tools > :not(.eye-btn) { opacity: 0; }
.w-body:has(> .hidden-ph) { display: flex; }
.w.stat .hidden-ph { margin: 4px -6px -6px; }
.w-head .eye-btn { opacity: 0; transition: opacity .15s ease; }
.w:hover .w-head .eye-btn, .w:focus-within .w-head .eye-btn, .w[data-hidden="true"] .w-head .eye-btn { opacity: 1; }
.w[data-hidden="true"] .eye-btn { color: var(--accent); }
.menu { position: absolute; right: 10px; top: 42px; z-index: 6; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; min-width: 10rem; display: grid; }
.menu button { text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 6px; font-size: var(--fs-sm); cursor: pointer; }
.menu button:hover:not(:disabled) { background: var(--panel-2); }
.menu button:disabled { color: var(--faint); cursor: default; }
.menu button.danger { color: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-xs); color: var(--muted); margin-bottom: 10px; }
.sw { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; flex: none; }
.sw.line { height: 2px; width: 14px; border-radius: 2px; vertical-align: 3px; }
.sw.dash { height: 0; width: 14px; border-top: 2px dashed var(--ref); border-radius: 0; vertical-align: 3px; background: none !important; }
.chart { position: relative; }
.chart text { font-family: var(--font-body); font-size: 11.5px; font-variant-numeric: tabular-nums; }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: 9rem; gap: 16px; }
@media (max-width: 1180px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .stats .val { font-size: var(--fs-xl); } }
.w.stat { padding: 16px 18px; gap: 4px; overflow: hidden; }
.w.stat .stat-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; opacity: 0; transition: opacity .15s ease; }
.w.stat:hover .stat-tools, .w.stat:focus-within .stat-tools, body.editing .w.stat .stat-tools { opacity: 1; }
.w.stat .grip { position: absolute; top: 8px; left: 6px; }
body.editing .w.stat .lab { padding-left: 18px; }
.w.stat .menu { top: 40px; }
.stat .lab { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; padding-right: 48px; }
.stat .val { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-2xl); letter-spacing: -.035em; line-height: 1.05; font-variant-numeric: tabular-nums; margin-top: auto; }
.stat .val small { font-size: var(--fs-md); color: var(--muted); font-weight: 500; letter-spacing: 0; }
.stat .cmp { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.period .pill { align-self: flex-start; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.period .val { letter-spacing: -.03em; }
.delta { font-weight: 600; padding: 1px 6px; border-radius: 6px; }
.delta.good { background: var(--good-soft); } .delta.bad { background: var(--bad-soft); }

.table-wrap { overflow: hidden; }
@container (max-width: 360px) { .t { font-size: var(--fs-xs); } .t th, .t td { padding: 8px 4px; } }
table.t { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.t th, .t td { padding: 9px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t th:first-child, .t td:first-child { text-align: left; padding-left: 0; }
.t th:last-child, .t td:last-child { padding-right: 0; }
.t thead th { font-size: var(--fs-xs); color: var(--faint); font-weight: 500; border-bottom-color: var(--line); }
.t tbody tr:hover td { background: var(--bg); }
.t tfoot td, .t tfoot th { font-weight: 600; border-bottom: 0; padding-top: 12px; }
.t td.cat { white-space: normal; }

.donut { display: flex; flex-wrap: nowrap; gap: 20px; align-items: center; justify-content: center; height: 100%; }
.donut.stacked { flex-direction: column; gap: 16px; justify-content: center; }
.donut.stacked .dl { flex: none; width: 100%; }
.donut svg { flex: none; }
.dl { list-style: none; margin: 0; padding: 0; flex: 1 1 0; max-width: 22rem; display: grid; grid-auto-rows: 26px; align-items: center; font-size: var(--fs-sm); min-width: 0; align-content: center; }
.dl li + li { border-top: 1px solid var(--grid); }
.dl li { display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.dl .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl .s { color: var(--faint); width: 3em; text-align: right; flex: none; }
.dl .a { width: 4.6em; text-align: right; font-weight: 500; flex: none; }


.gauges { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: 16px 8px; height: 100%; align-content: center; }
.gauge { display: grid; justify-items: center; gap: 2px; text-align: center; }
.gauge .n { font-size: var(--fs-xs); font-weight: 600; margin-top: 4px; }
.gauge .m { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }

.movers { list-style: none; margin: 0; padding: 0; display: grid; }
.movers li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.movers li:last-child { border-bottom: 0; }
.movers .from { color: var(--faint); font-size: var(--fs-xs); }

.tip { position: absolute; z-index: 4; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px 10px; font-size: var(--fs-xs); white-space: nowrap; min-width: 9rem; }
.tip .t1 { color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.tip div { display: flex; align-items: center; line-height: 1.7; }
.tip div .v { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; font-weight: 600; }

.empty { border: 1px dashed var(--line-strong); border-radius: var(--r); padding: 48px 24px; text-align: center; display: grid; justify-items: center; gap: 10px; background: var(--panel); color: var(--accent); }
.empty h2 { font-weight: 600; font-size: var(--fs-xl); letter-spacing: -.02em; margin: 0; color: var(--ink); }
.empty p { color: var(--muted); margin: 0; max-width: 34rem; }

/* Data page */
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: 16px; }
.src { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); padding: 18px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.src-head { display: flex; align-items: center; gap: 8px; }
.src-head h2 { margin: 0; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -.015em; flex: 1; }
.src dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: var(--fs-sm); padding-top: 12px; border-top: 1px solid var(--line); }
.src dt { color: var(--muted); }
.src dd { margin: 0; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.cols { display: flex; flex-wrap: wrap; gap: 4px; }
.cols code { font-family: var(--font-mono); font-size: 11.5px; background: var(--panel-2); border-radius: 6px; padding: 2px 7px; color: var(--ink); }
.src-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Loading skeletons */
.sk { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--panel-2) 0%, #FBF8F4 45%, var(--panel-2) 90%); background-size: 220% 100%; }
@media (prefers-reduced-motion: no-preference) { .sk { animation: shimmer 1.3s ease-in-out infinite; } @keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } } }
.sk-wrap { height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.sk-line { height: 10px; }
.sk-block { flex: 1; min-height: 120px; border-radius: 12px; }
.sk-donut { flex: none; width: 150px; height: 150px; border-radius: 50%; margin: 8px auto 6px; }
.w.stat .sk-lab { width: 45%; height: 12px; }
.w.stat .sk-val { width: 70%; height: 30px; margin-top: auto; border-radius: 10px; }
.w.stat .sk-cmp { width: 55%; height: 10px; }

/* Data inside the import window */
.data-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.data-head h3 { margin: 12px 0 0; font-size: var(--fs-md); font-weight: 600; }
.modal .sources { grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 10px; }
.modal .src { padding: 14px; gap: 10px; box-shadow: none; }
.modal .src-head h2 { font-size: var(--fs-md); }
.modal .src dl { padding-top: 10px; font-size: var(--fs-xs); }
.modal .src .btn { padding: 5px 10px; font-size: var(--fs-xs); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 4px; }
.tab { border: 0; background: transparent; padding: 9px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab .count { font-size: 11px; font-weight: 600; background: var(--panel-2); color: var(--muted); border-radius: 999px; padding: 0 7px; line-height: 18px; }
.tab[aria-selected="true"] .count { background: var(--accent-soft); color: var(--accent); }
.tab-panel { display: grid; gap: 14px; }
.tab-panel > .store-line { margin-bottom: -2px; }

/* Settings */
body.no-motion *, body.no-motion *::before, body.no-motion *::after { animation: none !important; transition: none !important; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); display: grid; place-items: center; color: #FFFFFF; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--swatch, var(--accent)); }
.swatch svg { opacity: 0; } .swatch[aria-pressed="true"] svg { opacity: 1; }
.set-hint { grid-column: 2; font-size: var(--fs-xs); color: var(--muted); margin-top: -4px; }
@media (max-width: 560px) { .set-hint { grid-column: 1; } }

/* Widget editor */
.del-btn:hover { color: var(--bad); background: var(--bad-soft); }
body.editing .w:not(.period) { border-style: dashed; border-color: var(--line-strong); }
body.editing .w:not(.period):hover { border-color: var(--accent-line); }
body.editing .w.period { opacity: .6; }
.notices { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(36px + env(safe-area-inset-bottom, 0px)); width: min(calc(var(--content-max) * 2 / 3), calc((100vw - 2 * var(--pad)) * 2 / 3)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.notices > * { pointer-events: auto; }
.notice { width: 100%; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r); box-shadow: 0 18px 40px rgba(60, 40, 20, .16), 0 6px 14px rgba(60, 40, 20, .08), 0 1px 3px rgba(60, 40, 20, .06); padding: 10px 12px 10px 14px; font-size: var(--fs-sm); color: var(--accent-deep); }
.notice .n-text { flex: 1 1 14rem; min-width: 0; }
.notice .chip { flex: none; }
.notice .btn { flex: none; }
.notice .icon-btn { color: var(--accent-deep); }
.notice .icon-btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.notice b { font-weight: 600; }
@media (max-width: 860px) { .notices { width: calc(100vw - 32px); } }
@media (min-width: 861px) and (max-width: 1200px) { .notices { width: calc((100vw - 2 * var(--pad)) * 5 / 6); } }
body.has-notices .main { padding-bottom: 112px; }
/* Rule: notices and toasts step aside in edit mode and come back afterwards */
body.editing #notices { display: none; }
body.editing.has-notices .main { padding-bottom: 0; }
.edit-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r); padding: 10px 12px 10px 16px; font-size: var(--fs-sm); color: var(--accent-deep); }
.edit-bar > span { flex: 1 1 18rem; }
.edit-bar b { font-weight: 600; }
.add-tile { grid-row: span 32; margin-bottom: 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--r); background: transparent; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 8px; font-weight: 600; font-size: var(--fs-sm); cursor: pointer; transition: border-color .15s ease, color .15s ease, background .15s ease; }
.add-tile:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.ed-section { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.ed-section:first-child { border-top: 0; padding-top: 0; }
.ed-section > h3 { margin: 0; font-size: var(--fs-sm); font-weight: 600; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ed-section > h3 small { color: var(--muted); font-weight: 400; font-size: var(--fs-xs); }
.ed-row { display: grid; grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr); align-items: center; gap: 8px 14px; font-size: var(--fs-sm); }
.ed-row > label, .ed-row > .lab { color: var(--ink); font-weight: 500; }
.ed-row .hint { grid-column: 2; font-size: var(--fs-xs); color: var(--muted); margin-top: -4px; }
@media (max-width: 560px) { .ed-row { grid-template-columns: minmax(0, 1fr); } .ed-row .hint { grid-column: 1; } }
.input { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.input:hover { border-color: var(--line-strong); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.bad-input { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.affix { position: relative; display: flex; align-items: center; }
.affix .input { padding-left: 22px; }
.affix.suffix .input { padding-left: 10px; padding-right: 28px; }
.affix > span { position: absolute; left: 10px; color: var(--muted); font-size: var(--fs-sm); pointer-events: none; }
.affix.suffix > span { left: auto; right: 10px; }
.choice { display: inline-flex; flex-wrap: wrap; background: var(--panel-2); border-radius: 10px; padding: 3px; gap: 2px; justify-self: start; }
.choice button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; color: var(--muted); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; }
.choice button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(60, 40, 20, .08), 0 0 0 1px var(--line); }
.switch { appearance: none; -webkit-appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .15s ease; justify-self: start; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(60, 40, 20, .2); transition: transform .15s ease; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.bud { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.bud th { text-align: left; font-size: var(--fs-xs); color: var(--faint); font-weight: 500; padding: 0 6px 6px; }
.bud td { padding: 3px 6px; vertical-align: middle; }
.bud td:first-child, .bud th:first-child { padding-left: 0; }
.bud td:last-child, .bud th:last-child { padding-right: 0; width: 1%; }
.bud .cat-name { font-weight: 500; }
.bud select.input { padding-right: 8px; min-width: 6.5rem; }
.bud tfoot td { padding-top: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ed-error { color: var(--bad); font-size: var(--fs-sm); margin: 0; }
.modal-foot .spacer { flex: 1; }

/* Modal */
html.scroll-locked, html.scroll-locked body { overflow: hidden; }
.overlay { overscroll-behavior: contain; touch-action: none; position: fixed; inset: 0; z-index: 20; background: var(--overlay); backdrop-filter: blur(2px); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.modal { overscroll-behavior: contain; touch-action: pan-y; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow-lg); width: min(100%, 44rem); max-height: 100%; overflow: auto; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.modal-head h2 { margin: 0; flex: 1; font-weight: 600; font-size: var(--fs-lg); letter-spacing: -.015em; }
.modal-body { padding: 12px 20px 20px; display: grid; gap: 14px; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); }
.drop { border: 1.5px dashed var(--line-strong); border-radius: var(--r); padding: 32px 16px; text-align: center; display: grid; gap: 8px; justify-items: center; background: var(--bg); cursor: pointer; color: var(--accent); transition: border-color .15s ease, background .15s ease; }
.drop:hover { border-color: var(--accent-line); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop p { margin: 0; color: var(--ink); }
.drop p.muted { color: var(--muted); }
.field { display: grid; gap: 6px; font-size: var(--fs-sm); }
.field label, .field .lab { font-weight: 500; }
.field select, .field textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.field textarea { min-height: 7rem; font-family: var(--font-mono); font-size: var(--fs-xs); resize: vertical; }
.radios { display: grid; gap: 8px; }
.radios label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.radios label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radios input { accent-color: var(--accent); margin-top: 3px; }
.radios small { color: var(--muted); display: block; }
.issues { margin: 0; padding-left: 18px; color: var(--bad); font-size: var(--fs-sm); }
.summary-line { font-size: var(--fs-sm); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 10px; }
.pick { text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 14px; cursor: pointer; display: grid; gap: 6px; align-content: start; transition: border-color .15s ease, box-shadow .15s ease; }
.pick:hover:not(:disabled) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pick:disabled { cursor: default; opacity: .5; }
.pick h3 { margin: 0; font-size: var(--fs-md); font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pick p { margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.pick svg { color: var(--accent); }

.toast { background: var(--ink); color: #FFFFFF; padding: 9px 16px; border-radius: 10px; font-size: var(--fs-sm); box-shadow: var(--shadow-lg); }

/* Floating action bar */
.period-nav[hidden] { display: none; }
#btn-privacy[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.pm { position: relative; color: transparent !important; }
.pm::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: .34em; transform: translateY(-50%); background: radial-gradient(circle closest-side, var(--pm-c, currentColor) 85%, transparent 100%) 0 50% / .52em .34em space no-repeat; pointer-events: none; }
body.privacy :is(.good, .bad) { color: var(--muted) !important; }
body.privacy .delta, body.privacy .chip.ok, body.privacy .chip.bad { background: var(--panel-2) !important; color: var(--muted) !important; }
.btn.icon { width: 36px; height: 36px; padding: 0; justify-content: center; }
#btn-edit .lbl { display: none; }
#btn-add-widget { display: none; }
body.editing #btn-add-widget { display: inline-flex; }
body.editing :is(#stepper, #btn-privacy, #btn-import, #btn-settings) { display: none !important; }
body.editing #btn-edit { width: auto; height: 36px; padding: 0 16px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
body.editing #btn-edit:hover { background: var(--accent-hover); }
body.editing #btn-edit svg { display: none; }
body.editing #btn-edit .lbl { display: inline; }
@media (max-width: 420px) { .tools .btn .lbl { display: none; } .tools .btn { padding: 8px 10px; } }

@media (max-width: 860px) {
  :root { --pad: 16px; }
  .content { --sheet-r: 22px; }
  .top { position: static; }
}
@media (prefers-reduced-motion: no-preference) {
  .intro > .w { animation: rise .4s cubic-bezier(.2, .7, .2, 1) both; }
  .intro > .w:nth-child(2) { animation-delay: .03s; } .intro > .w:nth-child(3) { animation-delay: .06s; } .intro > .w:nth-child(n+4) { animation-delay: .09s; }
  @keyframes rise { from { transform: translateY(8px); opacity: .001; } to { transform: none; opacity: 1; } }
}
