/* Timprisguiden web styles. Only tokens from tokens.css: no raw colours here or in components. Mobile first. */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--text-16);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--mallow); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: var(--text-36); font-weight: 300; letter-spacing: -.02em; }
h1 b { font-weight: 800; }
h2 { font-size: var(--text-18); font-weight: 600; line-height: 1.3; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--mallow); outline-offset: 2px; }
/* FocusOnNavigate moves focus to the h1 for screen readers; that programmatic focus needs no ring. */
h1:focus { outline: none; }

.eyebrow { font-family: var(--font-data); font-size: var(--text-12); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: var(--text-14); }
.num { font-family: var(--font-data); font-weight: 500; font-variant-numeric: tabular-nums; }
.num .unit { color: var(--muted); font-weight: 400; }
.loading { padding: var(--space-6) var(--space-4); color: var(--muted); }
.stack { display: grid; gap: var(--space-5); }
.stack-s { display: grid; gap: var(--space-2); }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.back { justify-self: start; padding-left: 0; }

/* Shell */
.shell { min-height: 100dvh; display: grid; grid-template-rows: 1fr auto; }
.content { width: 100%; max-width: 640px; margin: 0 auto; padding: var(--space-5) var(--space-4) calc(var(--space-7) + var(--tap)); }
.tabbar { position: fixed; inset: auto 0 0 0; display: flex; justify-content: space-around; padding: var(--space-2) var(--space-2) max(var(--space-3), env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.tab { display: grid; justify-items: center; gap: 2px; font-size: var(--text-12); color: var(--muted); min-width: 72px; min-height: var(--tap); align-content: center; text-decoration: none; }
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--mallow); }
.brand { display: none; }

@media (min-width: 900px) {
  .shell { grid-template-columns: var(--sidebar) 1fr; grid-template-rows: none; }
  .tabbar { position: sticky; top: 0; height: 100dvh; flex-direction: column; justify-content: flex-start; gap: var(--space-1); padding: var(--space-5) var(--space-3); border-top: 0; border-right: 1px solid var(--line); grid-row: 1; }
  .tab { grid-template-columns: 24px 1fr; justify-items: start; gap: var(--space-3); font-size: var(--text-16); padding: 0 var(--space-3); border-radius: var(--radius-control); }
  .tab.active { background: var(--mallow-soft); }
  .brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 800; font-size: var(--text-22); padding: 0 var(--space-3) var(--space-5); }
  .content { padding: var(--space-7) var(--space-5); }
}

.mark { width: 32px; height: 32px; border-radius: var(--radius-control); }

/* Buttons and fields */
.btn { font: inherit; font-weight: 600; font-size: var(--text-16); min-height: var(--tap); padding: 0 var(--space-4); border-radius: var(--radius-control); border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); text-decoration: none; transition: transform var(--dur-press) ease-out; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--leaf); color: var(--on-leaf); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-ghost { background: none; color: var(--muted); }
.btn-danger { background: none; color: var(--danger); border-color: var(--danger); }
.btn-lg { min-height: var(--button-lg); }
.btn-block { width: 100%; }
.btn-icon { width: var(--icon-button); min-height: var(--icon-button); padding: 0; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-icon svg { width: 20px; height: 20px; }
.btn[disabled] { opacity: .5; cursor: default; }

.field { display: grid; gap: 6px; }
.field label, .label { font-size: var(--text-14); font-weight: 500; color: var(--muted); }
.field input { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-control); min-height: var(--tap); padding: 0 var(--space-3); width: 100%; }
.field input:focus { outline: 2px solid var(--mallow); outline-offset: 0; border-color: transparent; }
.field .err { font-size: var(--text-14); color: var(--danger); }
.field input.num { font-family: var(--font-data); }

.chips { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chip { font: inherit; font-size: var(--text-14); min-height: var(--button-sm); padding: 0 var(--space-3); border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--line); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; }
.chip svg { width: 18px; height: 18px; }
.chip .num { font-size: var(--text-12); }
/* Chosen area, language or activity: mallow (here), never filled. */
.chip[aria-pressed="true"] { background: var(--mallow-soft); border-color: var(--mallow); color: var(--mallow); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 2px; border-radius: var(--radius-control); background: var(--surface-2); border: 1px solid var(--line); }
.seg button { font: inherit; font-size: var(--text-14); font-weight: 600; min-height: var(--button-sm); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-control); background: none; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
.controls { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.controls .seg { flex: 1 1 160px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.card-pad { padding: var(--space-4); }
.note { font-size: var(--text-14); color: var(--muted); }
.warn { color: var(--amber); font-size: var(--text-14); }
.err { font-size: var(--text-14); color: var(--danger); }
.actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.chev { width: 20px; height: 20px; color: var(--faint); flex: none; }
.big { font-size: var(--text-36); line-height: 1.1; font-weight: 500; }
.big .unit { font-size: var(--text-16); }

.now-card { display: grid; gap: var(--space-1); }
.level { font-size: var(--text-14); font-weight: 600; }
.level-expensive { color: var(--amber); }
.level-cheap, .level-normal { color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.stat { background: var(--surface-2); border-radius: var(--radius-control); padding: var(--space-3); display: grid; gap: var(--space-1); min-width: 0; }
.stat .num { font-size: var(--text-22); }
.stat .note.num { font-size: var(--text-14); }

.empty { display: grid; justify-items: center; text-align: center; gap: var(--space-2); padding: var(--space-6) var(--space-4); border: 1px dashed var(--line); border-radius: var(--radius-card); }
.empty h2 { font-weight: 300; font-size: var(--text-22); }
.empty p { font-size: var(--text-14); color: var(--muted); }

/* Price chart: muted bars, faint past, mallow now, amber expensive, leaf-soft window, leaf block. Flat fills only. */
.chart { margin: 0; display: grid; gap: var(--space-2); }
.chart-plot { position: relative; padding-left: 40px; }
.chart svg { display: block; width: 100%; height: 200px; overflow: visible; }
.chart .bar { fill: var(--muted); }
.chart .bar.past { fill: var(--faint); }
.chart .bar.expensive { fill: var(--amber); }
.chart .bar.now { fill: var(--mallow); }
.chart .window { fill: var(--leaf-soft); }
.chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .zero { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.y-labels { position: absolute; inset: 0 auto 0 0; width: 36px; }
.y-labels span { position: absolute; left: 0; top: 0; translate: 0 -50%; font-size: var(--text-12); color: var(--muted); }
.y-labels span.bottom { top: auto; bottom: 0; translate: 0 50%; }
.x-labels { position: relative; height: 18px; margin-left: 40px; }
.x-labels span { position: absolute; top: 0; font-size: var(--text-12); color: var(--muted); }
.block-lane { position: relative; height: 32px; margin-left: 40px; }
.block { position: absolute; top: 0; height: 100%; min-width: var(--tap); background: var(--leaf); color: var(--on-leaf); border-radius: var(--radius-control); display: grid; place-items: center; overflow: hidden; }
.block .num { font-size: var(--text-12); white-space: nowrap; }
.legend { display: flex; gap: var(--space-4); flex-wrap: wrap; font-size: var(--text-12); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: var(--space-1); }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.swatch.now { background: var(--mallow); }
.swatch.expensive { background: var(--amber); }
.swatch.window { background: var(--leaf-soft); border: 1px solid var(--leaf); }

/* Table */
.table-card { padding: 0 var(--space-4); }
.fold-toggle { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-weight: 600; }
.fold-toggle:focus-visible { outline: 2px solid var(--mallow); outline-offset: 2px; border-radius: var(--radius-control); }
.price-table { width: 100%; border-collapse: collapse; font-size: var(--text-14); margin-bottom: var(--space-3); }
.price-table th { text-align: left; font-weight: 500; color: var(--muted); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.price-table td { padding: var(--space-1) 0; border-bottom: 1px solid var(--line); }
.price-table tr.is-now td { background: var(--mallow-soft); }

/* Plan */
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-2); }
.option { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: var(--space-4); display: grid; gap: var(--space-1); }
.option.suggested { background: var(--leaf-soft); border-color: var(--leaf); }
.option .big { font-size: var(--text-28); }
.mover { display: flex; align-items: center; gap: var(--space-3); }
.mover .btn-icon { width: var(--tap); min-height: var(--tap); }
.mover-value { flex: 1; text-align: center; font-size: var(--text-16); }

/* Welcome */
.welcome { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-6) var(--space-4); }
.welcome-inner { width: 100%; max-width: 440px; display: grid; gap: var(--space-5); }
.welcome .mark { width: 72px; height: 72px; border-radius: var(--radius-sheet); }
.lead { color: var(--muted); font-size: var(--text-18); line-height: 1.4; }
.points { margin: 0; padding-left: var(--space-5); display: grid; gap: var(--space-2); color: var(--text); }

@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:active { transform: none; } }
