/* Day-to-day: the mock-up's layout on Shop's tokens.css with a blue accent. Loaded after tokens.css, so it overrides them. */

/* Layout: same family as Shop (shared tokens, fonts, rows). Sticky header with tabs + calendar chips; each tab is one column of rows.
   Day-to-day only overrides the accent (blue) so you can tell the two sites apart. */
:root {
  --paper: #EEF1F4;
  --surface: #FFFFFF;
  --ink: #17202B;
  --muted: #5A6675;
  --line: #D3DAE2;
  --accent: #2B5BA8;
  --accent-ink: #FFFFFF;
  --tag: #F4C531;
  --tag-ink: #2A2306;
  --short: #B93A26;
  --short-soft: #F8E1DC;
  --ok: #2D7A53;
  --ok-soft: #DCEFE4;
  --skip: #9AA5B1;
  --heat-0: #E3E8EE; --heat-1: #C4D4EC; --heat-2: #8EADDB; --heat-3: #5181C4; --heat-4: #2B5BA8;
    --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-num: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
  --fs-label: 13px; --fs-small: 15px; --fs-body: 17px; --fs-name: 19px; --fs-num: 20px; --fs-title: 28px; --fs-big: 34px;
  --tap: 44px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #10151B; --surface: #18202A; --ink: #E3E9F0; --muted: #93A0AF; --line: #2A3542;
    --accent: #7FA6EC; --accent-ink: #0C1626; --tag: #E5B828; --tag-ink: #221C03;
    --short: #F07F6A; --short-soft: #3A1F1A; --ok: #6FD3A0; --ok-soft: #173326; --skip: #5E6A78;
    --heat-0: #222C38; --heat-1: #24406A; --heat-2: #33609E; --heat-3: #5786D0; --heat-4: #8FB3F2;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #10151B; --surface: #18202A; --ink: #E3E9F0; --muted: #93A0AF; --line: #2A3542;
  --accent: #7FA6EC; --accent-ink: #0C1626; --tag: #E5B828; --tag-ink: #221C03;
  --short: #F07F6A; --short-soft: #3A1F1A; --ok: #6FD3A0; --ok-soft: #173326; --skip: #5E6A78;
  --heat-0: #222C38; --heat-1: #24406A; --heat-2: #33609E; --heat-3: #5786D0; --heat-4: #8FB3F2;
}
@media (max-width: 700px) { :root { --fs-body: 18px; --fs-small: 16px; --fs-name: 19px; --fs-title: 24px; --tap: 50px; } }

* { box-sizing: border-box; }
body { background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: var(--fs-body); line-height: 1.45; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h2, h3 { text-wrap: balance; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

.wrap { max-width: 1020px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-block: 14px 10px; }
.brand { display: flex; align-items: baseline; gap: 10px; margin-right: auto; flex-wrap: wrap; }
.brand h1 { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-title); letter-spacing: -0.02em; margin: 0; }
.sync { display: flex; align-items: center; gap: 6px; font-size: var(--fs-label); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--paper); cursor: pointer; }
.sync .led { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.who .dot { border: 0; cursor: pointer; position: relative; width: 28px; height: 28px; border-radius: 50%; background: #0082C9; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: var(--fs-label); }

.tabs { display: flex; gap: 2px; overflow-x: auto; padding-bottom: 0; scrollbar-width: none; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; min-height: var(--tap); font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count { font-family: var(--font-num); font-size: var(--fs-label); background: var(--tag); color: var(--tag-ink); padding: 0 6px; border-radius: 4px; }
.tabs .soon { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; border: 1px solid var(--line); padding: 0 5px; border-radius: 4px; font-weight: 500; }

.cals { display: flex; gap: 6px; flex-wrap: wrap; padding-block: 10px; align-items: center; }
.barlabel { font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 12px 3px 8px; font-size: var(--fs-small); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.chip[aria-pressed="false"] { color: var(--muted); }
.chip[aria-pressed="false"] .sw { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }

main { padding-block: 18px 60px; display: flex; flex-direction: column; gap: 18px; }
.view[hidden] { display: none !important; }
.view { display: flex; flex-direction: column; gap: 18px; }

.dayhead { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.dayhead h2 { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-big); margin: 0; letter-spacing: -0.02em; line-height: 1.1; }
.dayhead .sub { color: var(--muted); font-size: var(--fs-small); }
.progress { flex: 1 1 220px; display: flex; flex-direction: column; gap: 6px; }
.progress .meter { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress .meter i { display: block; height: 100%; background: var(--ok); border-radius: 999px; transition: width .3s; }
.progress .lbl { font-size: var(--fs-small); color: var(--muted); display: flex; justify-content: space-between; }

.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px; }
.banner.warn { border-color: color-mix(in srgb, var(--tag) 70%, var(--line)); background: color-mix(in srgb, var(--tag) 14%, var(--surface)); }
.banner .txt { flex: 1 1 260px; }
.banner .txt b { display: block; }
.banner .txt span { color: var(--muted); font-size: var(--fs-small); }

.btn { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 0 16px; min-height: var(--tap); font-weight: 600; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { min-height: var(--tap); padding: 0 10px; font-size: var(--fs-small); border-radius: 8px; }

.section { display: flex; flex-direction: column; gap: 8px; }
.sechead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sechead h3 { margin: 0; font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.sechead .meta { font-size: var(--fs-label); color: var(--muted); }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); min-height: 62px; }
.row:first-child { border-top: 0; }
.row .name { font-size: var(--fs-name); font-weight: 500; line-height: 1.25; overflow-wrap: anywhere; }
.row .info { display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: var(--fs-small); margin-top: 2px; }
.row .info .cal::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--c); margin-right: 5px; }
.row.done .name { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }
.check { width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; color: transparent; }
.check svg { width: 22px; height: 22px; }
.row.done .check { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.check:hover { border-color: var(--ok); }
.pill { font-size: var(--fs-label); font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill.streak { background: var(--tag); color: var(--tag-ink); font-family: var(--font-num); }
.pill.late { background: var(--short-soft); color: var(--short); }
.pill.prio { background: color-mix(in srgb, var(--short) 12%, transparent); color: var(--short); }
.pill.soft { background: var(--paper); color: var(--muted); }
.side { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) { .row { grid-template-columns: 44px minmax(0, 1fr); } .row .side { grid-column: 2; justify-content: flex-start; } }
.anywhere { font-size: var(--fs-small); color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.anywhere svg { flex: none; margin-top: 3px; }

/* Calendar */
.weeknav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.weeknav h2 { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-title); margin: 0 auto 0 0; letter-spacing: -0.02em; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-small); cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.pastsum { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.pastday { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: var(--fs-label); display: flex; flex-direction: column; gap: 4px; }
.pastday b { font-weight: 600; color: var(--muted); }
.pastday .bar { height: 6px; border-radius: 999px; background: var(--short-soft); overflow: hidden; }
.pastday .bar i { display: block; height: 100%; background: var(--ok); }
.pastday .detail { display: none; flex-direction: column; gap: 2px; color: var(--muted); }
.showpast .pastday .detail { display: flex; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.daycol { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-height: 260px; display: flex; flex-direction: column; }
.daycol.today { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.daycol .dh { padding: 8px 10px 6px; display: flex; align-items: baseline; gap: 6px; border-bottom: 1px solid var(--line); }
.daycol .dh b { font-family: var(--font-display); font-size: 22px; font-weight: 800; }
.daycol .dh span { font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.daycol .items { display: flex; flex-direction: column; gap: 4px; padding: 6px; }
.ev { display: flex; font: inherit; font-size: var(--fs-label); gap: 6px; align-items: flex-start; font-size: var(--fs-label); line-height: 1.3; padding: 4px 6px; border-radius: 6px; background: color-mix(in srgb, var(--c) 12%, var(--surface)); border-left: 3px solid var(--c); text-align: left; border-top: 0; border-right: 0; border-bottom: 0; width: 100%; }
.ev .t { font-family: var(--font-num); color: var(--muted); flex: none; }
.ev.done { opacity: .55; text-decoration: line-through; }
.ev.habits { background: transparent; border-left-style: dashed; cursor: pointer; color: var(--ink); }
@media (max-width: 860px) {
  .week { grid-template-columns: 1fr; }
  .daycol { min-height: 0; }
  .daycol .items { flex-direction: row; flex-wrap: wrap; }
  .ev { width: auto; }
  .pastsum { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Goals */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 700px) { .kpis { grid-template-columns: 1fr; } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.kpi .k { font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.kpi .v { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-big); line-height: 1.05; }
.kpi .d { font-size: var(--fs-small); color: var(--muted); }
.kpi .d .up { color: var(--ok); font-weight: 600; }
.kpi .d .down { color: var(--short); font-weight: 600; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.panel h3 { margin: 0; font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.panel .hint { margin: 0; font-size: var(--fs-small); color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-label); color: var(--muted); align-items: center; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.scroll { overflow-x: auto; }
.habitgrid { display: grid; grid-template-columns: minmax(150px, 210px) auto 64px 64px; gap: 8px 12px; align-items: center; min-width: 640px; }
.habitgrid .h { font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.habitgrid .hn { font-weight: 500; font-size: var(--fs-small); }
.habitgrid .r { font-family: var(--font-num); font-size: var(--fs-small); text-align: right; font-variant-numeric: tabular-nums; }
.dots { display: grid; grid-template-columns: repeat(28, 12px); gap: 3px; }
.dots i, .legend i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.d-hit { background: var(--ok); }
.d-miss { background: transparent; box-shadow: inset 0 0 0 2px var(--short); }
.d-skip { background: var(--skip); width: 12px !important; height: 4px !important; border-radius: 2px !important; align-self: center; }
.d-none { background: var(--heat-0); }
.d-today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--accent) !important; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 14px); gap: 3px; }
.heatwrap { display: grid; grid-template-columns: auto 1fr; gap: 6px; align-items: start; }
.heatdays { display: grid; grid-template-rows: repeat(7, 14px); gap: 3px; font-size: 11px; color: var(--muted); line-height: 14px; }
.heat i { width: 14px; height: 14px; border-radius: 3px; display: block; }
.heatmonths { display: flex; font-size: 11px; color: var(--muted); gap: 0; padding-left: 0; position: relative; height: 14px; }
.heatmonths span { position: absolute; }
.twocol { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
@media (max-width: 860px) { .twocol { grid-template-columns: 1fr; } }
svg.chart text { fill: var(--muted); font-family: var(--font-num); font-size: 11px; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
.tip { position: fixed; z-index: 30; pointer-events: none; background: var(--ink); color: var(--surface); font-size: var(--fs-label); padding: 6px 9px; border-radius: 6px; max-width: 240px; line-height: 1.35; }
.oneoffs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
ul.oneoffs li { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: var(--fs-small); align-items: center; }
ul.oneoffs li:first-child { border-top: 0; }
ul.oneoffs .when { color: var(--muted); font-size: var(--fs-label); display: block; }

/* Cleanup */
.group { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.group > .gh { display: flex; gap: 12px; align-items: center; padding: 12px 14px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.group > .gh .t { flex: 1 1 260px; }
.group > .gh .t b { font-size: var(--fs-name); display: block; }
.group > .gh .t span { color: var(--muted); font-size: var(--fs-small); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; background: var(--paper); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 5px 10px; min-height: calc(var(--tap) - 6px); border-radius: 7px; cursor: pointer; font-size: var(--fs-small); font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .15); }
.crow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line); align-items: center; }
.crow:first-of-type { border-top: 0; }
.crow .n { font-weight: 500; overflow-wrap: anywhere; }
.crow .w { color: var(--muted); font-size: var(--fs-label); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crow .w .cal::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--c); margin-right: 5px; }
@media (max-width: 560px) { .crow { grid-template-columns: 1fr; } }
.more { border: 0; background: transparent; color: var(--accent); font-weight: 600; padding: 10px 14px; cursor: pointer; text-align: left; width: 100%; border-top: 1px solid var(--line); }
.settings { display: flex; flex-direction: column; gap: 10px; }
.setrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.setrow .lab { flex: 1 1 260px; }
.setrow .lab span { display: block; color: var(--muted); font-size: var(--fs-small); }
.go { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.go .sum { margin-right: auto; color: var(--muted); font-size: var(--fs-small); }

/* Fitness */
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 28px 18px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; max-width: 640px; }
.empty h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: var(--fs-title); }
.empty p { margin: 0; color: var(--muted); max-width: 60ch; }
.ghostrows { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; }
@media (max-width: 560px) { .ghostrows { grid-template-columns: 1fr; } }
.ghostrows div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--muted); font-size: var(--fs-small); display: flex; flex-direction: column; gap: 2px; }
.ghostrows b { font-family: var(--font-display); font-size: 24px; color: var(--line); }

.toast[hidden] { display: none; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-weight: 500; z-index: 40; max-width: calc(100vw - 32px); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.sync, .chip, .who .dot { position: relative; font: inherit; }
.sync::before, .chip::before, .who .dot::before { content: ""; position: absolute; inset: -8px -2px; }
.sync { color: var(--muted); }
.sync.stale { border-color: color-mix(in srgb, var(--tag) 70%, var(--line)); background: color-mix(in srgb, var(--tag) 20%, var(--surface)); color: var(--ink); }
.sync.stale .led { background: var(--tag); }
.who .dot { background: var(--accent); color: var(--accent-ink); }
body { margin: 0; }
body[data-screen="connect"] .tabs, body[data-screen="reading"] .tabs, body[data-screen="connect"] #sync, body[data-screen="reading"] #sync { display: none; }
[hidden] { display: none !important; }
.emptyrow { padding: 16px 14px; color: var(--muted); font-size: var(--fs-small); }
.check-spacer { width: 44px; height: 44px; }
.row.skipped .name { color: var(--muted); }
.row.skipped .check { color: var(--skip); border-style: dashed; }
.row .side .btn.small { min-height: 36px; }
.seg-wrap { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
@media (max-width: 560px) { .seg-wrap { align-items: flex-start; } }
.datepick { font: inherit; min-height: var(--tap); border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 0 10px; }
.kpi .d .none { color: var(--muted); }
.toggle { min-height: var(--tap); }
.screen { display: flex; flex-direction: column; gap: 14px; padding-block: 30px 60px; max-width: 640px; }
.screen h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: var(--fs-title); letter-spacing: -0.02em; }
.screen p { margin: 0; color: var(--muted); max-width: 60ch; }
.screen .btn { align-self: flex-start; display: inline-flex; align-items: center; text-decoration: none; }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 18px; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog h2 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 800; font-size: 24px; }
dialog h3 { margin: 14px 0 4px; font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
dialog .hint { margin: 0; color: var(--muted); font-size: var(--fs-small); }
.sheetlist { display: flex; flex-direction: column; }
.sheetactions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.sheetactions .btn:last-child { margin-left: auto; }
.cals.wrap-hidden { display: none; }
