/* Productipus companion app: the Star Wheel world.
   Observatory indigo, engraved cream ink, star gold reserved for "now" and primary actions. */

@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/jost-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/jost-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* night ramp */
  --n0: #070a24;
  --n1: #0b1033;   /* ground */
  --n2: #121946;   /* chart surface */
  --n3: #1b2359;   /* raised / input */
  --n4: #2a3372;   /* engraved rule */
  --n5: #3d4790;   /* strong rule */
  --ink: #ede6d3;  /* engraved cream */
  --ink-2: #b4b6d6;/* secondary */
  --ink-3: #9196c2;/* tertiary, still 4.5:1 on n2 */

  --gold: #f5c451;     /* now, running, primary */
  --gold-ink: #1a1405;
  --peri: #8494ec;     /* ordinary blocks, links */
  --rose: #ee7598;     /* urgent, alarms, errors */
  --sage: #8fd3a8;     /* done, success */

  --r-s: 8px;
  --r-m: 12px;
  --r-l: 18px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --fs-xs: 0.75rem;
  --fs-s: 0.875rem;
  --fs-m: 1rem;
  --fs-l: 1.1875rem;
  --fs-xl: 1.625rem;
  --fs-xxl: 2.125rem;

  color-scheme: dark;
  accent-color: var(--gold);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Jost", system-ui, sans-serif;
  font-size: var(--fs-m);
  line-height: 1.45;
  color: var(--ink);
  background: var(--n1);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
::selection { background: var(--gold); color: var(--gold-ink); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: var(--n4) transparent; }
.hidden { display: none !important; }

h1 { font-size: var(--fs-xxl); font-weight: 500; letter-spacing: -0.01em; line-height: 1.1; }
h2 { font-size: var(--fs-l); font-weight: 500; letter-spacing: 0; }
h3 { font-size: var(--fs-m); font-weight: 500; }
.sub { color: var(--ink-2); font-size: var(--fs-s); }
strong, b { font-weight: 600; }
a { color: var(--peri); text-underline-offset: 3px; }

.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
#i-play path { fill: currentColor; stroke: none; }

/* ---------- Shell ---------- */
.app { min-height: 100dvh; }
main { padding: 0 16px calc(var(--tab-h) + var(--safe-b) + 28px); max-width: 1120px; margin: 0 auto; }

.tabbar {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--n0);
  border-top: 1px solid var(--n4);
}
.tabbar .brand { display: none; }
.tabbar button {
  appearance: none; background: none; border: 0; color: var(--ink-3);
  font: 500 var(--fs-xs)/1 "Jost", sans-serif; letter-spacing: 0.02em;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  cursor: pointer; position: relative; transition: color 0.2s var(--ease);
}
.tabbar button .ico { width: 24px; height: 24px; }
.tabbar button:hover { color: var(--ink); }
.tabbar button.active { color: var(--gold); }

.view-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 28px) 4px 16px;
}
.view-head .sub { margin-top: 4px; max-width: 52ch; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.sync {
  display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-xs); color: var(--ink-2); white-space: nowrap;
  background: none; border: 1px solid transparent; border-radius: 999px; padding: 5px 10px; font-family: inherit;
  cursor: pointer; transition: border-color .15s, color .15s, background-color .15s;
}
.sync:hover { border-color: var(--n4); color: var(--ink-1); background: rgba(255,255,255,.03); }
.sync:active { transform: scale(.98); }
.sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.sync.live::before { background: var(--sage); }
.sync.syncing::before { background: var(--gold, #ffb800); animation: sync-pulse .9s ease-in-out infinite; }
@keyframes sync-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.8); } }

/* ---------- Blocks & lists (no card stacks: hairline-engraved groups) ---------- */
.block { padding: 18px 4px; border-top: 1px solid var(--n4); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.block-head.sub-head { margin-top: 10px; }
.two-col { display: grid; gap: 0 40px; }
.two-col.tight { margin-top: 8px; }

.list { display: flex; flex-direction: column; }
.list:empty { display: none; }
.item {
  display: flex; align-items: center; gap: 12px; min-height: 52px;
  padding: 10px 2px; border-bottom: 1px solid var(--n3);
}
.item:last-child { border-bottom: 0; }
.item .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.item .title { font-weight: 500; }
.item .meta { font-size: var(--fs-s); color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.item .side { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.item.done .title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--n5); }
.item.editing { background: var(--n2); border-radius: var(--r-m); padding: 10px 12px; border-bottom-color: transparent; }
.empty { color: var(--ink-2); font-size: var(--fs-s); padding: 10px 2px; text-align: left; }
.time { font-weight: 500; min-width: 3.2em; color: var(--ink); }
.swatch { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tag { color: var(--ink-2); font-size: var(--fs-s); white-space: nowrap; }
.tag::before { content: "#"; color: var(--ink-3); }

/* ---------- Controls ---------- */
input, select, textarea {
  font: inherit; font-size: var(--fs-m); color: var(--ink);
  background: var(--n2); border: 1px solid var(--n4); border-radius: var(--r-s);
  padding: 10px 12px; min-height: 44px; width: 100%; min-width: 0;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
textarea { resize: vertical; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--n5); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); background: var(--n3); }
input:disabled, select:disabled { opacity: 0.5; }
select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b4b6d6' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 18px; }
input[type="date"], input[type="time"] { color-scheme: dark; }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; flex-shrink: 0; cursor: pointer; }
input.num { width: 76px; flex: 0 0 76px; text-align: center; }
.swatch-input { width: 44px; flex: 0 0 44px; padding: 4px; cursor: pointer; }
.swatch-input::-webkit-color-swatch-wrapper { padding: 0; }
.swatch-input::-webkit-color-swatch { border: 0; border-radius: 5px; }
.swatch-input::-moz-color-swatch { border: 0; border-radius: 5px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field > label, .reader-text-head > label { font-size: var(--fs-s); color: var(--ink-2); }
/* Reader review: label + live stats over the text, wrapping clean-up chips under it */
.reader-text-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.reader-text-head .sub { font-size: var(--fs-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.reader-tools { flex-wrap: wrap; overflow: visible; padding: 2px 0 0; }
#reader-text { min-height: 180px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row2 { display: flex; gap: 10px; align-items: flex-end; }
.row3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
.grow { flex: 1; }
.w-tag { flex: 0 0 34%; }
.w-time { flex: 0 0 120px; }
.self-end { align-self: flex-end; }
.addrow { display: flex; gap: 8px; align-items: center; }
.addrow input:not(.num):not(.swatch-input):not(.w-tag) { flex: 1; }
.addrow .w-tag { width: 30%; flex: 0 0 30%; }

.btn {
  appearance: none; font: 500 var(--fs-s)/1 "Jost", sans-serif; letter-spacing: 0.01em;
  min-height: 44px; padding: 0 16px; border-radius: var(--r-s);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--ink); background: var(--n3); border: 1px solid var(--n4);
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s;
}
.btn:hover { border-color: var(--n5); background: var(--n4); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn.primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-weight: 600; }
.btn.primary:hover { background: #ffd36e; border-color: #ffd36e; }
.btn.quiet { background: transparent; border-color: var(--n4); }
.btn.quiet:hover { background: var(--n2); }
.btn.danger { color: var(--rose); background: transparent; border-color: var(--n4); }
.btn.danger:hover { border-color: var(--rose); }
.btn.wide { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 12px; }
.icon-btn {
  appearance: none; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%;
  display: inline-grid; place-items: center; color: var(--ink-2);
  background: transparent; border: 1px solid var(--n4); cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--n5); background: var(--n2); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn .ico { width: 18px; height: 18px; }
.icon-btn.self-end { margin-bottom: 2px; }
.link { appearance: none; background: none; border: 0; color: var(--peri); font: 500 var(--fs-s) "Jost", sans-serif; cursor: pointer; padding: 6px 0; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--n2); border: 1px solid var(--n4); border-radius: 999px; }
.seg button { appearance: none; border: 0; background: none; color: var(--ink-2); font: 500 var(--fs-s) "Jost", sans-serif; padding: 9px 16px; border-radius: 999px; cursor: pointer; min-height: 38px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--ink); color: var(--n1); }
.sub-seg { margin: 0 0 6px 4px; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { appearance: none; flex-shrink: 0; font: 500 var(--fs-s) "Jost", sans-serif; color: var(--ink-2); background: transparent; border: 1px solid var(--n4); border-radius: 999px; padding: 7px 14px; cursor: pointer; }
.chip:hover { color: var(--ink); border-color: var(--n5); }
.chip.active { color: var(--n1); background: var(--ink); border-color: var(--ink); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--n5); color: transparent; background: transparent; cursor: pointer; flex-shrink: 0; transition: all 0.15s var(--ease); }
.check .ico { width: 15px; height: 15px; stroke-width: 2.2; }
.check:hover { border-color: var(--ink-2); }
.check.on { background: var(--sage); border-color: var(--sage); color: var(--n1); }

.msg { font-size: var(--fs-s); color: var(--sage); min-height: 0; }
.msg:empty { display: none; }
.msg.err, .msg.is-err { color: var(--rose); }
.msg.is-busy { color: var(--gold); }

/* ---------- Today: the star wheel ---------- */
.today-grid { display: grid; gap: 8px; }
.wheel-col { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-bottom: 8px; }
.wheel-wrap { position: relative; width: min(84vw, 340px); aspect-ratio: 1; }
.wheel { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; border-radius: 50%; }
.wheel:active { cursor: grabbing; }
.wheel:focus-visible { outline-offset: 6px; border-radius: 50%; }
.wheel .ring { fill: none; stroke: var(--n4); stroke-width: 1; }
.wheel .ring.strong { stroke: var(--n5); }
.wheel .face { fill: var(--n2); }
.wheel .tick { stroke: var(--n5); stroke-width: 1; }
.wheel .tick.major { stroke: var(--ink-3); stroke-width: 1.4; }
.wheel .hour { fill: var(--ink-3); font: 500 11px "Jost", sans-serif; text-anchor: middle; dominant-baseline: central; }
.wheel .night { fill: var(--n0); }
.wheel .arc { fill: none; stroke-width: 14; stroke-linecap: butt; transition: opacity 0.2s; }
.wheel .arc.blk { stroke: var(--peri); }
.wheel .arc.cur { stroke: var(--gold); }
.wheel .arc.past { opacity: 0.38; }
.wheel .arc.hit { stroke: var(--ink); }
.wheel .window { fill: var(--gold); opacity: 0.13; }
.wheel .hand { stroke: var(--gold); stroke-width: 2; stroke-linecap: round; }
.wheel .hand-knob { fill: var(--gold); }
.wheel .scrub .hand { stroke: var(--ink); }
.wheel .scrub .hand-knob { fill: var(--ink); }
.wheel .hub { fill: var(--n1); stroke: var(--n4); }

.wheel-centre {
  position: absolute; inset: 27%; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 4px; appearance: none; background: none; border: 0; color: var(--ink); font: inherit; cursor: pointer;
}
.wheel-centre:hover .plan { color: var(--ink); border-color: var(--ink-3); }
.wheel-centre .plan { margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--ink-2); border: 1px solid var(--n4); border-radius: 999px; padding: 4px 10px 4px 7px; transition: color .15s, border-color .15s; }
.wheel-centre .plan .ico { width: 13px; height: 13px; }
.wheel-centre .what { text-wrap: pretty; }
.wheel-centre .nw { white-space: nowrap; }
.wheel-centre .lbl { font-size: var(--fs-xs); color: var(--ink-2); letter-spacing: 0.08em; text-transform: uppercase; }
.wheel-centre .big { font-size: 2.5rem; font-weight: 500; line-height: 1.05; letter-spacing: -0.01em; margin: 2px 0; }
.wheel-centre .what { font-size: var(--fs-s); color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.wheel-centre.is-now .big { color: var(--gold); }
.wheel-foot { min-height: 44px; display: flex; flex-direction: column; align-items: center; gap: 6px; }

#today-list .item.cur { background: var(--n2); border-radius: var(--r-m); padding-left: 12px; padding-right: 12px; border-bottom-color: transparent; }
#today-list .item.cur .title { color: var(--gold); }
#today-list .item.past .title, #today-list .item.past .time { color: var(--ink-3); }

/* ---------- Timers ---------- */
.ring-preview { display: flex; align-items: center; gap: 14px; }
.seg-ring { width: 52px; height: 52px; flex-shrink: 0; }
.seg-ring circle { fill: none; }
.ring-preview .seg-ring { width: 76px; height: 76px; }
.ring-preview .total { font-size: var(--fs-xl); font-weight: 500; }
.seg-row { display: grid; grid-template-columns: 26px 1fr 88px auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--n3); }
.seg-row .idx { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 600; color: var(--n1); }
.seg-row .secs { position: relative; }
.seg-row .secs input { padding-right: 26px; text-align: right; }
.seg-row .secs::after { content: "s"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: var(--fs-s); pointer-events: none; }
.seg-row .acts { display: flex; gap: 4px; }
.seg-row .acts .icon-btn { width: 34px; height: 34px; flex-basis: 34px; }
.seg-row .say { grid-column: 2 / -1; display: flex; gap: 8px; align-items: center; }
.seg-row .hap { grid-column: 2 / -1; display: flex; flex-direction: column; gap: 6px; }
.seg-row .hap-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.seg-row .hap-line > .ico { width: 16px; height: 16px; color: var(--ink-3); }
.seg-row .hap select { width: auto; min-height: 34px; padding: 5px 30px 5px 10px; font-size: var(--fs-s); }
.hap-lbl { font-size: var(--fs-s); color: var(--ink-3); }
.chip.sm { padding: 5px 11px; font-size: var(--fs-xs); min-height: 30px; }
.chip[aria-pressed="true"] { color: var(--gold-ink); background: var(--gold); border-color: var(--gold); }
.chip:disabled { opacity: 0.35; cursor: default; }
.chip:disabled:hover { color: var(--ink-2); border-color: var(--n4); }
.hap-chip { color: var(--gold); }
.builder fieldset.voice { border: 0; border-top: 1px solid var(--n4); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.voice-chip { display: inline-flex; align-items: center; gap: 5px; color: var(--peri); font-size: var(--fs-s); }
.voice-chip .ico { width: 15px; height: 15px; }
.seg-trail { font-size: var(--fs-s); color: var(--ink-2); }

/* ---------- Tasks ---------- */
.task-add { border-top: 0; padding-top: 6px; }
.task-add:not(.open) .opts { display: none; }
.big-input { font-size: var(--fs-l); min-height: 52px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opts .btn { grid-column: 1 / -1; }
.prio { font-size: var(--fs-xs); font-weight: 600; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--n4); color: var(--ink-2); }
.prio.p1 { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 45%, transparent); }
.proj-edit { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; }
.proj-edit .proj-name-input { flex: 1; }

.matrix { display: grid; grid-template-columns: 1fr; gap: 0; }
.quad { padding: 16px 4px; border-top: 1px solid var(--n4); display: flex; flex-direction: column; gap: 4px; }
.quad h2 { display: flex; align-items: center; gap: 10px; }
.quad h2::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--qc); }
.q-do { --qc: var(--rose); }
.q-schedule { --qc: var(--gold); }
.q-delegate { --qc: var(--peri); }
.q-delete { --qc: var(--ink-3); }
.quad .item select { width: auto; min-height: 36px; padding: 4px 30px 4px 10px; font-size: var(--fs-s); }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--n3); border: 1px solid var(--n3); border-radius: var(--r-m); overflow: hidden; }
.cal-grid > div { background: var(--n1); min-height: 64px; padding: 6px; font-size: var(--fs-xs); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-head { min-height: 0 !important; text-align: center; color: var(--ink-3); background: var(--n2) !important; padding: 6px 2px !important; }
.cal-day strong { font-weight: 500; color: var(--ink-2); }
.cal-day.today strong { color: var(--gold-ink); background: var(--gold); border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; }
.cal-dot { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); display: flex; align-items: center; gap: 4px; }
.cal-dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; background: var(--peri); }
.cal-dot.task::before { background: var(--sage); }

/* ---------- Insights ---------- */
.mood-scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mood-btn { appearance: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 2px; min-height: 64px; border-radius: var(--r-m); background: transparent; border: 1px solid var(--n4); color: var(--ink-2); font: 500 var(--fs-xs) "Jost", sans-serif; cursor: pointer; transition: all 0.15s var(--ease); }
.mood-btn b { font-size: var(--fs-xl); font-weight: 500; color: var(--ink); line-height: 1.1; }
.mood-btn:hover { border-color: var(--n5); }
.mood-btn.selected { background: var(--ink); border-color: var(--ink); color: var(--n2); }
.mood-btn.selected b { color: var(--n1); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--n4); border-radius: var(--r-m); }
.stat { padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.stat + .stat { border-left: 1px solid var(--n4); }
.stat strong { font-size: var(--fs-l); font-weight: 500; }
.stat span { font-size: var(--fs-xs); color: var(--ink-2); }
.chart { width: 100%; height: 96px; display: block; }
.chart .grid { stroke: var(--n3); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--gold); }
.chart .axis { fill: var(--ink-3); font: 500 10px "Jost", sans-serif; }
.panel-label { font-size: var(--fs-s); color: var(--ink-2); margin: 14px 0 6px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 44px; gap: 10px; align-items: center; font-size: var(--fs-s); padding: 4px 0; }
.bar-row .tag { overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 6px; border-radius: 3px; background: var(--n3); overflow: hidden; }
.bar-fill { height: 100%; background: var(--peri); border-radius: 3px; }
.bar-row strong { text-align: right; font-weight: 500; }

.pattern { display: grid; grid-template-columns: 180px 1fr; gap: 18px; align-items: center; }
.act-ring { width: 180px; height: 180px; }
.act-ring .rim { fill: var(--n2); stroke: var(--n4); }
.act-ring path { fill: none; stroke-width: 16; }
.act-ring path.off { stroke: var(--n3); }
.act-ring path.on { stroke: var(--gold); }
.act-ring text { fill: var(--ink-3); font: 500 10px "Jost", sans-serif; text-anchor: middle; dominant-baseline: central; }
.act-ring .peak-l { fill: var(--ink-2); font-size: 10px; letter-spacing: .06em; }
.act-ring .peak { fill: var(--ink); font-size: 15px; }
@media (max-width: 420px) { .pattern { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

/* ---------- Dial ---------- */
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.feature-toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; border-bottom: 1px solid var(--n3); }
.code-input { text-transform: uppercase; letter-spacing: 0.25em; font-weight: 600; text-align: center; }
.alarm-time { font-size: var(--fs-xl); font-weight: 500; min-width: 3.4em; }
.toggle { appearance: none; position: relative; width: 50px; height: 30px; min-height: 0; border-radius: 999px; background: var(--n3); border: 1px solid var(--n4); cursor: pointer; transition: background 0.2s var(--ease); flex-shrink: 0; padding: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink-2); transition: transform 0.2s var(--ease), background 0.2s; }
.toggle[aria-checked="true"] { background: var(--gold); border-color: var(--gold); }
.toggle[aria-checked="true"]::after { transform: translateX(20px); background: var(--gold-ink); }

/* ---------- Sign in ---------- */
.auth { position: fixed; inset: 0; z-index: 50; background: var(--n1); display: grid; place-items: center; padding: 24px; overflow-y: auto; }
.auth-panel { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.auth-panel h1 { font-size: var(--fs-xl); }
.auth-panel form { width: 100%; text-align: left; margin-top: 4px; }
.auth-wheel { width: 120px; height: 120px; margin-bottom: 6px; }
.auth-wheel circle { fill: none; stroke: var(--n4); }
.auth-wheel path { fill: none; stroke-width: 7; }
.auth-wheel .arc-gold { stroke: var(--gold); }
.auth-wheel .arc-peri { stroke: var(--peri); }
.auth-wheel .arc-rose { stroke: var(--rose); }
.auth-wheel line { stroke: var(--gold); stroke-width: 1.6; stroke-linecap: round; }

/* ---------- AI breakdown ---------- */
#ai-breakdown-out .item .meta { gap: 4px 8px; }

/* ---------- Wider screens ---------- */
@media (min-width: 700px) {
  main { padding-left: 32px; padding-right: 32px; }
  .two-col { grid-template-columns: 1fr 1fr; }
  .opts { grid-template-columns: repeat(5, 1fr) auto; }
  .opts .btn { grid-column: auto; }
  .matrix { grid-template-columns: 1fr 1fr; gap: 0 40px; }
  .cal-grid > div { min-height: 84px; }
}

@media (min-width: 1000px) {
  :root { --rail: 220px; }
  .tabbar {
    top: 0; right: auto; width: var(--rail); height: 100dvh; padding: 24px 12px;
    display: flex; flex-direction: column; gap: 2px; border-top: 0; border-right: 1px solid var(--n4);
  }
  .tabbar .brand { display: flex; align-items: center; gap: 10px; padding: 0 12px 22px; color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: 0.02em; }
  .tabbar .brand img { width: 28px; height: 28px; }
  .tabbar button { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: var(--fs-m); padding: 11px 12px; border-radius: var(--r-s); }
  .tabbar button:hover { background: var(--n2); }
  .tabbar button.active { background: var(--n2); }
  main { margin-left: var(--rail); padding-bottom: 48px; }
  .today-grid { grid-template-columns: minmax(320px, 400px) 1fr; gap: 48px; align-items: start; }
  .wheel-col { position: sticky; top: 24px; }
  .wheel-wrap { width: 100%; }
}

@media (min-width: 1200px) {
  .today-grid { grid-template-columns: minmax(400px, 480px) 1fr; }
  .wheel-centre .big { font-size: 3rem; }
}

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