/* Work Tracker — iPhone-first, restrained, light and dark. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #1b1e23;
  --muted: #646b76;
  --line: #dfe2e7;
  --accent: #1f5f8b;
  --accent-text: #ffffff;
  --accent-soft: #e3eef6;
  --strong: #1b1e23;
  --strong-text: #ffffff;
  --danger: #b42318;
  --positive: #157347;
  --negative: #b42318;
  /* Series colours: categorical slots 1–2 of the validated palette (checked against these surfaces). */
  --vl: #2a78d6;
  --phd: #eb6834;
  --vl-leave: color-mix(in srgb, var(--vl) 42%, var(--surface));
  --phd-leave: color-mix(in srgb, var(--phd) 42%, var(--surface));
  --grid: #e8eaee;
  --axis: #c3c7cf;
  --attention: #fff4e0;
  --attention-line: #e8b65a;
  --radius: 14px;
  --tap: 48px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --surface: #1c1f24;
    --surface-2: #262a30;
    --text: #eceef1;
    --muted: #a0a7b2;
    --line: #333841;
    --accent: #5aa4d6;
    --accent-text: #0d1b26;
    --accent-soft: #1d3240;
    --strong: #eceef1;
    --strong-text: #121417;
    --danger: #ff7b6e;
    --positive: #5ccf8e;
    --negative: #ff8a7e;
    --vl: #3987e5;
    --phd: #d95926;
    --grid: #2b2f36;
    --axis: #454b55;
    --attention: #3a2e17;
    --attention-line: #8a6a2b;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
.muted { color: var(--muted); font-weight: normal; }

.boot { padding: 40vh 24px 0; text-align: center; color: var(--muted); }

/* ---- shell ----------------------------------------------------------------------- */

.app { display: flex; flex-direction: column; min-height: 100dvh; }

.app-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-top) + 12px) 20px 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.app-header h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.site-badge {
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
  padding: 2px 8px; border-radius: 999px; background: #c2410c; color: #fff;
}

.app-main {
  flex: 1;
  width: 100%; max-width: 640px; margin: 0 auto;
  padding: 4px 16px calc(var(--safe-bottom) + 96px);
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center;
  padding: 6px 8px calc(var(--safe-bottom) + 6px);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; max-width: 160px; min-height: var(--tap);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600;
}
.tab[aria-current="page"] { color: var(--accent); }
.tab-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.update-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 16px 8px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--accent-soft);
}

/* ---- buttons & controls ------------------------------------------------------------ */

.button {
  min-height: var(--tap); padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 600;
}
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.button.strong { background: var(--strong); border-color: var(--strong); color: var(--strong-text); }
.button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.button.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.button.big { min-height: 60px; font-size: 19px; border-radius: 16px; flex: 1; }
.button:disabled { opacity: 0.55; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.icon-button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--surface-2); font-size: 16px; }
.link { border: 0; background: none; padding: 4px 0; color: var(--accent); font-weight: 600; }

.segmented {
  display: flex; padding: 3px; gap: 3px;
  border-radius: 12px; background: var(--surface-2);
}
.segment {
  flex: 1; min-height: 40px; padding: 0 10px;
  border: 0; border-radius: 9px; background: transparent; color: var(--text); font-weight: 600;
}
.segment.selected { background: var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); color: var(--accent); }
.segment:disabled { opacity: 0.5; }

input[type="text"], input[type="date"], input[type="time"], select {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  font-size: 17px; /* ≥16px stops iOS from zooming in */
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text);
  -webkit-appearance: none; appearance: none;
}
input[type="date"], input[type="time"] { display: block; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

/* ---- forms --------------------------------------------------------------------------- */

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.field-hint { font-size: 13px; color: var(--muted); }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.times { display: flex; flex-direction: column; gap: 10px; }
.signed-duration { display: grid; grid-template-columns: 96px 1fr; gap: 8px; align-items: center; }
.signed-duration .segment { font-size: 20px; }
.fold-choice { padding: 10px 12px; border-radius: 12px; background: var(--attention); display: flex; flex-direction: column; gap: 6px; }
.radio, .checkbox { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.radio input, .checkbox input { width: 20px; height: 20px; accent-color: var(--accent); }
.preview { font-size: 14px; color: var(--muted); }
.notice { font-size: 14px; padding: 10px 12px; border-radius: 12px; background: var(--attention); }
.form h3 { font-size: 16px; margin-top: 6px; }

/* ---- sheets, toasts ------------------------------------------------------------------ */

dialog.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh;
  margin: auto auto 0; padding: 0; border: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface); color: var(--text);
  box-shadow: 0 -8px 30px rgb(0 0 0 / 0.18);
}
dialog.sheet::backdrop { background: rgb(0 0 0 / 0.38); }
@media (min-width: 700px) {
  dialog.sheet { margin: auto; border-radius: 20px; }
}
.sheet-inner { display: flex; flex-direction: column; max-height: 92dvh; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 8px 20px; }
.sheet-header h2 { font-size: 19px; }
.sheet-body { padding: 8px 20px 12px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-error { margin: 0 20px 8px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-size: 14px; }
.sheet-actions { display: flex; gap: 10px; padding: 8px 20px calc(var(--safe-bottom) + 16px); }
.sheet-actions .button { flex: 1; }
.confirm-message ul { padding-left: 20px; margin: 8px 0; }
.confirm-message p + p { margin-top: 8px; }

.toast-host {
  position: fixed; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 78px); z-index: 50;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none;
}
.toast {
  pointer-events: auto; max-width: 520px; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 14px;
  background: var(--strong); color: var(--strong-text); box-shadow: 0 6px 20px rgb(0 0 0 / 0.25);
  font-size: 15px;
}
.toast.error { background: var(--danger); color: #fff; }
.toast-action { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; padding: 4px; }

/* ---- timer --------------------------------------------------------------------------- */

.banners { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.banner { padding: 12px 14px; border-radius: var(--radius); background: var(--accent-soft); display: flex; flex-direction: column; gap: 10px; }
.banner.attention { background: var(--attention); border: 1px solid var(--attention-line); }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.timer-card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px; border-radius: 20px; background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}
.elapsed {
  text-align: center; font-size: clamp(56px, 19vw, 84px); font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; line-height: 1.05; padding: 6px 0 0;
}
.timer-view[data-state="running"] .elapsed { color: var(--accent); }
.timer-view[data-state="paused"] .elapsed { color: var(--muted); }
.timer-status { text-align: center; min-height: 28px; color: var(--muted); font-size: 15px; }
.controls { display: flex; gap: 12px; }

.secondary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 18px; }

.summary { display: flex; flex-direction: column; gap: 12px; }
.summary-row { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.summary-row h3 { font-size: 15px; }
.progress { display: flex; flex-direction: column; gap: 6px; }
.progress-head { display: flex; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums; }
.progress-head .muted { margin-left: auto; font-size: 14px; }
.position { font-weight: 700; min-width: 40px; }
.bar { position: relative; display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.bar span { display: block; height: 100%; }
.progress.vl .bar-work { background: var(--vl); }
.progress.phd .bar-work { background: var(--phd); }
.bar .bar-leave { margin-left: 2px; }
.progress.vl .bar-leave { background: var(--vl-leave); }
.progress.phd .bar-leave { background: var(--phd-leave); }
.legend { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.swatch { display: inline-block; width: 14px; height: 8px; border-radius: 2px; background: var(--muted); }
.swatch.leave { background: color-mix(in srgb, var(--muted) 42%, var(--surface)); margin-left: 10px; }
.balance-row { display: flex; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums; }
.balance-row .muted { margin-left: auto; font-size: 14px; }
.balance { font-size: 18px; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }

/* ---- history ------------------------------------------------------------------------- */

.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.filter-row { display: grid; grid-template-columns: 1fr 120px; gap: 8px; }
.history-list { display: flex; flex-direction: column; }
.week-header {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin: 18px 0 4px; font-size: 15px;
}
.week-header .muted { font-size: 13px; }
.day-header { margin: 10px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.entry {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  min-height: 56px; padding: 10px 14px; margin-bottom: 6px;
  border: 0; border-radius: 12px; background: var(--surface); color: var(--text);
}
.entry.running { border: 1px solid var(--accent); }
.entry.leave { background: color-mix(in srgb, var(--surface) 70%, var(--surface-2)); }
.entry-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.entry-title { font-weight: 600; font-variant-numeric: tabular-nums; }
.entry-detail { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-amount { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; font-weight: 600; }
.entry-share { font-size: 12px; color: var(--muted); font-weight: normal; }
/* Text stays in ink; the coloured dot carries the position. */
.alloc-badge {
  flex: none; min-width: 60px; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 12px; font-weight: 700; padding: 3px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--text);
}
.alloc-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.alloc-badge.vl::before { background: var(--vl); }
.alloc-badge.phd::before { background: var(--phd); }
.alloc-badge.split::before { background: linear-gradient(90deg, var(--vl) 50%, var(--phd) 50%); }
.empty { text-align: center; padding: 40px 12px; display: flex; flex-direction: column; gap: 6px; }

/* ---- settings ------------------------------------------------------------------------ */

.settings-section { margin: 18px 0; display: flex; flex-direction: column; gap: 10px; }
.settings-section > h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.settings-section > div { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.setting .segmented { flex: 0 1 220px; }
.balance-block { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.balance-block .entry { background: var(--surface-2); margin: 0; }
.balance-title { display: flex; justify-content: space-between; }
.help details { padding: 10px 0; border-bottom: 1px solid var(--line); }
.help details:last-child { border-bottom: 0; }
.help summary { font-weight: 600; cursor: pointer; }
.help details p { margin-top: 8px; color: var(--muted); }

/* ---- gate / fatal --------------------------------------------------------------------- */

.gate { max-width: 460px; margin: 0 auto; padding: calc(var(--safe-top) + 48px) 24px 48px; display: flex; flex-direction: column; gap: 16px; }
.gate-icon { border-radius: 22px; }
.gate h1 { font-size: 26px; }
.gate ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }

/* ---- dashboard ----------------------------------------------------------------------- */

.overview-compact { display: flex; flex-direction: column; gap: 12px; }
.overview-compact .tiles, .overview-compact .charts { margin: 0; }
.progress.total .bar-work { background: var(--muted); }
.progress.total .bar-leave { background: color-mix(in srgb, var(--muted) 42%, var(--surface)); }
.progress.total .position { font-weight: 700; }
.glance ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.details-button { width: 100%; }
.back-link { margin: 4px 0 10px; }

.period-nav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; margin: 12px 0 2px; }
.period-label { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1px; }
.period-label strong { font-size: 16px; }
.period-label .muted { font-size: 13px; }
.period-today { display: flex; justify-content: center; min-height: 10px; margin: 2px 0 10px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tile { padding: 12px 14px; border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tile-value { font-size: 28px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; }
.tile-sub { font-size: 12px; color: var(--muted); }
.pos-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .pos-grid { grid-template-columns: 1fr 1fr; } }
.pos-card { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.pos-card.combined { margin-top: 12px; }
.pos-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.pos-head h3 { font-size: 16px; }
.status-tag { margin-left: auto; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.status-tag.live { background: var(--accent-soft); color: var(--text); }
.figure-heading { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-top: 8px; }
.figure-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 15px; font-variant-numeric: tabular-nums; }
.figure-row.strong { font-weight: 700; }
.figure-name { color: var(--muted); }
.figure-row.strong .figure-name { color: var(--text); }
.figure-value { text-align: right; }
.figure-note { font-size: 12px; color: var(--muted); font-weight: normal; }
.footnote { font-size: 12px; color: var(--muted); margin: 16px 2px; }
.small { font-size: 13px; }

/* ---- charts (SVG, see js/ui/charts.js) ------------------------------------------------ */

.charts { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.chart { margin: 0; padding: 14px 14px 10px; border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.chart-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.chart-group-title { font-size: 15px; margin: 6px 2px 0; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--muted); }
.legend-line { display: inline-block; flex: none; width: 16px; border-top: 2px solid var(--muted); border-radius: 1px; }
.series-vl.legend-swatch { background: var(--vl); }
.series-phd.legend-swatch { background: var(--phd); }
.series-vl-leave.legend-swatch { background: var(--vl-leave); }
.series-phd-leave.legend-swatch { background: var(--phd-leave); }
.series-vl.legend-line { border-color: var(--vl); }
.series-phd.legend-line { border-color: var(--phd); }
.target-key.legend-line { border-color: var(--text); }
.chart-plot { width: 100%; max-width: 560px; margin: 0 auto; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .axis-base { stroke: var(--axis); stroke-width: 1; }
.chart-svg .tick { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart-svg path.series-vl { fill: var(--vl); }
.chart-svg path.series-phd { fill: var(--phd); }
.chart-svg path.series-vl-leave { fill: var(--vl-leave); }
.chart-svg path.series-phd-leave { fill: var(--phd-leave); }
.chart-svg path.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-svg path.line.series-vl { stroke: var(--vl); }
.chart-svg path.line.series-phd { stroke: var(--phd); }
.chart-svg .end-dot { stroke: var(--surface); stroke-width: 2; }
.chart-svg .end-dot.series-vl { fill: var(--vl); }
.chart-svg .end-dot.series-phd { fill: var(--phd); }
.chart-svg .target-tick { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.chart-svg .target-line { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-linejoin: round; }
.chart-svg .over-label { fill: var(--text); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-svg .column.current { opacity: 0.55; }
.chart-svg .crosshair { stroke: var(--axis); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-svg .hit { fill: transparent; cursor: pointer; outline: none; }
.chart-svg .hit:focus-visible { stroke: var(--accent); stroke-width: 2; }
.chart-svg .dim { opacity: 0.35; }
.chart-readout { min-height: 21px; font-size: 14px; color: var(--muted); }
.chart-readout strong, .readout-heading { color: var(--text); }
.chart-table summary { font-size: 13px; color: var(--accent); cursor: pointer; padding: 2px 0; }
.table-scroll { overflow-x: auto; margin-top: 6px; }
.chart-table table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { padding: 4px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.chart-table th[scope="row"], .chart-table thead th:first-child { text-align: left; font-weight: normal; }
.empty-chart .muted { font-size: 14px; }

/* ---- version 2: Today, Weeks, sheets ---------------------------------------------------- */

:root {
  --good-tint: color-mix(in srgb, #0ca30c 16%, var(--surface));
  --over-tint: color-mix(in srgb, #fab219 30%, var(--surface));
  --short-tint: color-mix(in srgb, #6b7a90 18%, var(--surface));
  --ring-track: var(--surface-2);
}
.app-header .gear { margin-left: auto; background: transparent; }
.app-header .gear svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.screen-title { font-size: 24px; margin: 4px 0 8px; }

/* week card with rings */
.week-card { padding: 16px; border-radius: 22px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 1px 2px rgb(0 0 0 / 0.05); }
.week-title { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; }
.week-title .muted { font-size: 14px; font-weight: normal; }
.rings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ring-block { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ring { width: min(132px, 38vw); height: auto; }
.ring-track { fill: none; stroke: var(--ring-track); }
.ring-work, .ring-leave { fill: none; transition: stroke-dasharray 0.6s ease; }
.ring.vl .ring-work { stroke: var(--vl); }
.ring.phd .ring-work { stroke: var(--phd); }
.ring.vl .ring-leave { stroke: var(--vl-leave); }
.ring.phd .ring-leave { stroke: var(--phd-leave); }
.ring-center { font-size: 20px; font-weight: 700; fill: var(--text); }
.ring-sub { font-size: 11px; fill: var(--muted); }
.ring.complete .ring-sub { fill: var(--positive); font-weight: 700; }
.ring.complete { animation: ring-pop 0.6s ease 1; }
@keyframes ring-pop { 0% { transform: scale(0.94); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
.ring-name { font-weight: 700; margin-top: 2px; }
.ring-balance { font-size: 15px; font-weight: 600; }
.streak { text-align: center; font-weight: 600; font-size: 15px; }

/* start buttons and running card */
.timer-area { margin: 14px 0; }
.start-buttons { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.start {
  min-height: 92px; border: 0; border-radius: 20px; color: #fff; font-size: 20px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.12); transition: transform 0.1s ease;
}
.start:active { transform: scale(0.97); }
.start.vl { background: var(--vl); }
.start.phd { background: var(--phd); }
.start.split { background: linear-gradient(135deg, var(--vl) 0 50%, var(--phd) 50% 100%); }
.start-icon { font-size: 18px; opacity: 0.9; }
.start:disabled { opacity: 0.6; }
.running-card {
  padding: 16px; border-radius: 22px; display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 2px solid var(--line);
}
.running-card.vl { border-color: var(--vl); background: color-mix(in srgb, var(--vl) 7%, var(--surface)); }
.running-card.phd { border-color: var(--phd); background: color-mix(in srgb, var(--phd) 7%, var(--surface)); }
.running-card.split { border-color: var(--vl); background: linear-gradient(135deg, color-mix(in srgb, var(--vl) 7%, var(--surface)), color-mix(in srgb, var(--phd) 7%, var(--surface))); }
.running-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.running-head .link { margin-left: auto; }
.running-card .elapsed { padding: 0; }
.running-card.paused .elapsed { color: var(--muted); }
.running-card.running .elapsed { color: var(--text); }
.running-note { text-align: center; color: var(--muted); }
.job-chip { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; color: #fff; border: 0; }
.job-chip.vl { background: var(--vl); }
.job-chip.phd { background: var(--phd); }
.job-chip.split { background: linear-gradient(135deg, var(--vl) 0 50%, var(--phd) 50% 100%); }
.button-chip { min-height: 36px; padding: 0 14px; }
.switch-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.switch-row .note-link { margin-left: auto; }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.button.quick { min-height: 56px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 16px; }
.quick-icon { font-size: 18px; }
.today-list { display: flex; flex-direction: column; }
.list-title { display: flex; justify-content: space-between; font-weight: 700; margin: 4px 2px 8px; }
.empty-today { padding: 8px 2px; }

/* weeks */
.year-nav { display: grid; grid-template-columns: 44px 1fr 44px auto; align-items: center; gap: 8px; margin: 8px 0 12px; }
.year-label { text-align: center; font-size: 20px; }
.weeks-content { display: flex; flex-direction: column; gap: 12px; }
.year-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.year-figure { display: flex; flex-direction: column; gap: 2px; }
.year-net { font-size: 26px; font-weight: 650; }
.streak-line { font-size: 15px; }
.streak-big { font-size: 22px; font-weight: 700; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.badge {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  filter: grayscale(1); opacity: 0.55;
}
.badge.earned { filter: none; opacity: 1; background: var(--surface); color: var(--text); border-color: color-mix(in srgb, #fab219 50%, var(--line)); }
.badge-icon { font-size: 26px; line-height: 1; }
.badge-title { font-size: 12px; font-weight: 600; text-align: center; }
.month-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 10px 2px 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.month-nets { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; }
.week-block { border-radius: 16px; background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.week-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 0; border: 0; background: none; color: var(--text); text-align: left; min-height: 32px; }
.week-name .muted { font-size: 14px; }
.chip { flex: none; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.chip.good { background: var(--good-tint); }
.chip.over { background: var(--over-tint); }
.chip.short { background: var(--short-tint); }
.chip.live { background: var(--accent-soft); }
.minis { display: flex; flex-direction: column; gap: 6px; }
.mini { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.mini-label { font-weight: 700; }
.mini-value { color: var(--muted); }
.mini .bar { height: 8px; }
.mini.vl .bar-work { background: var(--vl); }
.mini.phd .bar-work { background: var(--phd); }
.mini.vl .bar-leave { background: var(--vl-leave); }
.mini.phd .bar-leave { background: var(--phd-leave); }
.week-days { border-top: 1px solid var(--line); padding-top: 4px; }
.week-days .entry { background: var(--surface-2); }
.filter-chip { align-self: flex-start; border: 0; border-radius: 999px; padding: 8px 14px; background: var(--accent-soft); color: var(--text); font-weight: 600; }
.history summary { cursor: pointer; font-weight: 600; margin: 10px 0 6px; }
.history .entry { background: var(--surface-2); }

/* simple sheets */
.form.simple { gap: 16px; }
.job-picker .segment { min-height: 52px; font-size: 18px; }
.job-picker .segment.selected[data-value="VL"] { background: var(--vl); color: #fff; }
.job-picker .segment.selected[data-value="PhD"] { background: var(--phd); color: #fff; }
.job-picker .segment.selected[data-value="SPLIT"] { background: linear-gradient(135deg, var(--vl) 0 50%, var(--phd) 50% 100%); color: #fff; }
.day-picker { display: flex; flex-direction: column; gap: 8px; }
.hours-stepper { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stepper-row { display: grid; grid-template-columns: 56px 1fr 56px; gap: 10px; width: 100%; align-items: center; }
.step { min-height: 56px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); font-size: 26px; font-weight: 600; color: var(--text); }
.hours-input { text-align: center; font-size: 30px !important; font-weight: 700; min-height: 56px; }
.link.reveal { align-self: flex-start; }
.details, .range { display: flex; flex-direction: column; gap: 12px; }

/* celebration */
.celebration { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgb(0 0 0 / 0.18); overflow: hidden; }
.celebration-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 22px 26px; margin: 0 24px; border-radius: 24px; background: var(--surface); color: var(--text);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.25); animation: card-in 0.35s ease;
}
.celebration-card strong { font-size: 24px; }
.heart { position: absolute; bottom: -40px; animation: float-up 2.4s ease-in forwards; pointer-events: none; }
@keyframes float-up { 0% { transform: translateY(0) scale(0.8); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-105vh) scale(1.2); opacity: 0; } }
@keyframes card-in { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
