/*
  ChoreBoy's Daily Schedule (web/schedule.js) and Stats (web/stats.js) views. Uses choreboy.css's
  tokens (--bg, --surface, --accent… copied from DressBoy), so light and dark follow the device.
  Every class here starts with sch- (schedule) or st- (stats) so it can't clash with choreboy.css.
*/

/* ================================================================= */
/* ---------- Daily Schedule ---------- */
/* ================================================================= */

.sch { --sch-gutter: 58px; }
.sch-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The header: ◀ day ▶ Today [date] · totals · ✨ Auto-plan */
.sch-head { display: flex; align-items: center; gap: .75rem 1.25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.sch-nav { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.sch-arrow { min-width: 2.3rem; }
.sch-day { min-width: 9.5rem; text-align: center; line-height: 1.2; }
.sch-day b { display: block; font-size: 1.15rem; font-weight: 750; letter-spacing: -.01em; }
.sch-day small { display: block; font-size: .78rem; color: var(--text-3); }
.sch .sch-date { width: auto; padding: .38rem .55rem; font-size: .85rem; }
.sch-loading { font-size: .8rem; color: var(--text-3); }
.sch-totals { display: flex; flex-wrap: wrap; gap: .35rem .5rem; flex: 1; min-width: 14rem; font-variant-numeric: tabular-nums; }
.sch-totals > span { display: inline-flex; align-items: baseline; gap: .3rem; padding: .3rem .65rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .85rem; white-space: nowrap; }
.sch-totals small { font-size: .72rem; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.sch-totals b { font-weight: 700; color: var(--text); }

/* A day inside a trip: "🏖️ Osoyoos vacation · you're away", and the tasks that wait for you. */
.sch-trip { margin: -.2rem 0 1rem; padding: .7rem .95rem; border-radius: var(--radius-lg, 14px); background: var(--info-soft); color: var(--info); font-size: .9rem; }
.sch-trip-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .7rem; }
.sch-trip-head b { font-weight: 700; }
.sch-trip-dates { font-size: .82rem; opacity: .85; }
.sch-trip-link, .sch-trip-more { padding: 0; background: none; border: 0; font: 650 .82rem var(--font, system-ui, sans-serif); color: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.sch-trip-link { margin-left: auto; }
.sch-trip-what { margin: .3rem 0 0; }
.sch-trip-list { list-style: none; margin: .45rem 0 .2rem; padding: 0; display: flex; flex-direction: column; gap: .15rem; }
.sch-trip-list li { display: flex; align-items: baseline; justify-content: space-between; gap: .2rem .8rem; flex-wrap: wrap; padding: .3rem .55rem; border-radius: var(--radius-sm, 8px); background: var(--surface); }
.sch-trip-list small { font-size: .78rem; color: var(--text-3); white-space: nowrap; }
.sch-trip-task { min-width: 0; padding: 0; background: none; border: 0; text-align: left; font: 600 .85rem/1.3 var(--font, system-ui, sans-serif); color: var(--text); cursor: pointer; overflow-wrap: anywhere; }
.sch-trip-task:hover { color: var(--accent-text); }
.sch-trip-more { margin-top: .2rem; }

/* Two columns: the day's tasks, and the timeline. */
.sch-body { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 1.25rem; align-items: start; }

/* Wide windows: three columns, the day's tasks | the first half of the day | the second half.
   schedule.js sizes the halves to the room it measures under the header, so the whole day shows
   with no page scrolling; the list is as tall as they are and scrolls inside (size containment keeps
   a long list from making the row taller). */
.sch-body.sch-fit { grid-template-columns: minmax(250px, 320px) repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: stretch; }
.sch-fit .sch-list { position: static; max-height: none; contain: size; overflow: auto; }
.sch-fit .sch-tl { padding: .45rem .7rem .45rem .3rem; }
.view:has(> .sch > .sch-fit) { padding-bottom: 1rem; } /* the page's bottom padding: room for the day instead */

/* ---------- the list ---------- */

.sch-list { position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg, 14px); box-shadow: var(--shadow-sm); padding: .9rem .85rem; transition: background .12s, outline-color .12s; outline: 2px dashed transparent; outline-offset: -2px; }
.sch-list.sch-drop { outline-color: var(--bad); background: var(--bad-soft); }
.sch-hint { margin: 0 0 .8rem; font-size: .8rem; color: var(--text-3); }
.sch-group { margin-bottom: .9rem; }
.sch-group-h { display: flex; align-items: center; gap: .45rem; margin: 0 0 .45rem; font-size: .74rem; font-weight: 700; color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; }
.sch-group.overdue .sch-group-h { color: var(--bad); }
.sch-count { font-size: .7rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); letter-spacing: 0; text-transform: none; }
.sch-note { margin: 0 0 .4rem; font-size: .78rem; color: var(--text-3); }
.sch-empty { margin: .4rem 0 .8rem; font-size: .9rem; color: var(--text-3); }
.sch-error { margin: 0 0 .8rem; padding: .5rem .7rem; border-radius: var(--radius-sm, 8px); background: var(--bad-soft); color: var(--bad); font-size: .85rem; }
.sch-add { width: 100%; margin-top: .2rem; }

.sch-task { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: .45rem; align-items: center; padding: .5rem .55rem .5rem .35rem; margin-bottom: .4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius, 10px); cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: border-color .12s, opacity .12s; }
.sch-task:hover { border-color: var(--border-strong); }
.sch-task.maybe { border-style: dashed; }
.sch-task.done { cursor: default; background: var(--surface-2); }
.sch-task.done .sch-open { color: var(--text-3); text-decoration: line-through; }
.sch-task.busy, .sch-block.busy { opacity: .7; pointer-events: none; }
.sch-task.sch-lifted-item { opacity: .45; border-style: dashed; }
.sch-grip { align-self: stretch; display: grid; place-items: center; color: var(--text-3); font-size: 1rem; line-height: 1; cursor: grab; touch-action: none; border-radius: 6px; }
.sch-grip:hover { background: var(--surface-2); color: var(--text-2); }
.sch-grip.off { visibility: hidden; }
.sch-task-main { min-width: 0; }
.sch-open { display: block; width: 100%; padding: 0; margin: 0; background: none; border: 0; text-align: left; font: 600 .9rem/1.3 var(--font, system-ui, sans-serif); color: var(--text); cursor: inherit; overflow-wrap: anywhere; }
.sch-open:hover { color: var(--accent-text); }
.sch-meta { display: flex; flex-wrap: wrap; gap: .1rem .6rem; margin-top: .15rem; font-size: .75rem; color: var(--text-3); }
.sch-late { color: var(--bad); font-weight: 650; }
/* The XP a task earns ("+25"), like the rows on ☀️ Tasks. */
.sch-xp { display: inline-block; padding: 0 .4rem; border-radius: 999px; background: var(--warn-soft); color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.sch-task.done .sch-xp { background: none; padding: 0; }
/* ⚡ Quickie (10 minutes or less): first among a row's chips, warm; and its group first in the list. */
.sch-quick { color: var(--warn); font-weight: 700; }
.sch-group.quickies .sch-group-h { color: var(--warn); }
.sch-maybe { color: var(--info, var(--text-2)); }
.sch-task-acts { display: flex; align-items: center; gap: .3rem; align-self: start; }
.sch-task-plan { display: flex; align-items: center; gap: .35rem; margin-top: .35rem; }
.sch-plan { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; color: var(--text-3); cursor: default; }
.sch-plan > span { white-space: nowrap; }
.sch .sch-at-input { width: 7.4rem; padding: .2rem .35rem; font-size: .78rem; }
.sch-task-plan .sch-act { width: 1.6rem; height: 1.6rem; font-size: .72rem; }

/* Round buttons: ✓ done, ↶ not done yet, ✕ off the schedule */
.sch-act { flex-shrink: 0; display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; padding: 0; border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: 700 .85rem/1 var(--font, system-ui, sans-serif); cursor: pointer; }
.sch-act:hover { color: var(--text); border-color: var(--text-3); }
.sch-tick:hover, .sch-tick:focus-visible { background: var(--good); border-color: var(--good); color: #fff; }

/* ✅ Completed: the day's done and skipped tasks, folded under the list (closed by default). */
.sch-fold { margin: .9rem 0 0; padding-top: .7rem; border-top: 1px solid var(--border); }
.sch-fold .sch-group-h { margin: 0; }
.sch-fold-btn { display: inline-flex; align-items: center; gap: .45rem; padding: .25rem .35rem .25rem .1rem; margin-left: -.1rem; background: none; border: 0; border-radius: var(--radius-sm, 8px); font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.sch-fold-btn:hover { color: var(--text); background: var(--surface-2); }
.sch-fold-caret { display: inline-block; transition: transform .15s; }
.sch-fold.open .sch-fold-caret { transform: rotate(90deg); }
.sch-fold-list { margin-top: .45rem; }
.sch-fold-list[hidden] { display: none; }

/* Ticking off: the ✓ fills with a pop and the title strikes through, then the row folds away
   (schedule.js sets its height, then 0). ↶ in Completed does the same the other way. A row that
   lands in the list (or in an open Completed) slides in, and the Completed count pops. */
.sch-task.sch-ticking .sch-tick, .sch-block.sch-ticking .sch-tick { background: var(--good); border-color: var(--good); color: #fff; animation: sch-pop .26s ease-out; }
.sch-task.sch-ticking .sch-open { color: var(--text-3); text-decoration: line-through; }
.sch-task.sch-unticking .sch-act { background: var(--surface-2); color: var(--text); animation: sch-pop .26s ease-out; }
.sch-task.sch-unticking .sch-open { color: var(--text); text-decoration: none; }
.sch-task.sch-leaving { overflow: hidden; margin-bottom: 0; padding-top: 0; padding-bottom: 0; border-width: 0; opacity: 0; transform: translateX(28px); pointer-events: none;
  transition: height .24s ease, margin .24s ease, padding .24s ease, border-width .24s ease, opacity .2s ease, transform .24s ease; }
.sch-task.sch-arrive { animation: sch-arrive .32s ease-out; }
.sch-count.sch-bump { animation: sch-pop .3s ease-out; }
@keyframes sch-pop { 0% { transform: scale(1); } 45% { transform: scale(1.28); } 100% { transform: scale(1); } }
@keyframes sch-arrive { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }

/* ---------- the timeline ---------- */

.sch-tl { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg, 14px); box-shadow: var(--shadow-sm); padding: .9rem .85rem .9rem .4rem; min-width: 0; }
.sch-grid { position: relative; margin: .5rem 0; }
.sch-line { position: absolute; left: var(--sch-gutter); right: 0; border-top: 1px dashed color-mix(in srgb, var(--border) 70%, transparent); }
.sch-line.hour { border-top: 1px solid var(--border); }
.sch-hour { position: absolute; left: 0; width: calc(var(--sch-gutter) - 8px); text-align: right; transform: translateY(-50%); font-size: .72rem; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sch-hour.half { font-size: .68rem; font-weight: 650; color: var(--text-2); } /* a half that starts or ends on the half hour */
.sch-lane { position: absolute; top: 0; bottom: 0; left: var(--sch-gutter); right: 0; }
.sch-tl-empty { position: absolute; left: var(--sch-gutter); right: 0; top: 2.5rem; text-align: center; font-size: .88rem; color: var(--text-3); pointer-events: none; padding: 0 1rem; }

.sch-block { position: absolute; z-index: 1; display: flex; gap: .3rem; align-items: flex-start; padding: .3rem .4rem .45rem .55rem; overflow: hidden; background: var(--accent-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-left: 4px solid var(--accent); border-radius: var(--radius-sm, 8px); box-shadow: var(--shadow-sm); cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: opacity .12s, box-shadow .12s; }
.sch-block:hover { box-shadow: var(--shadow-md); z-index: 2; }
.sch-block:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 2; }
.sch-block.maybe { border-style: dashed; border-left-style: solid; }
.sch-block.saving { opacity: .8; }
.sch-block.sch-lifted { opacity: .3; }
.sch-block.done { background: var(--surface-2); border-color: var(--border); border-left-color: var(--text-3); color: var(--text-3); cursor: pointer; box-shadow: none; }
.sch-block-body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.sch-block-title { font-weight: 650; font-size: .84rem; overflow: hidden; text-overflow: ellipsis; overflow-wrap: anywhere; }
.sch-block-time { font-size: .72rem; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sch-block.done .sch-block-time { color: var(--text-3); }
.sch-block-acts { display: flex; gap: .2rem; flex-shrink: 0; }
.sch-block .sch-act { width: 1.5rem; height: 1.5rem; font-size: .75rem; border-width: 1px; }
.sch-block.short { align-items: center; padding-top: 0; padding-bottom: 0; }
.sch-block.short .sch-block-body { flex-direction: row; align-items: baseline; gap: .45rem; }
.sch-block.short .sch-block-title { white-space: nowrap; font-size: .78rem; }
.sch-block.short .sch-block-time { font-size: .68rem; flex-shrink: 50; min-width: 0; overflow: hidden; text-overflow: ellipsis; } /* narrow: the time gives way to the title */
.sch-block.short .sch-act { width: 1.25rem; height: 1.25rem; font-size: .66rem; }
/* Quarter hours in the fitted halves can be 12–20 px tall: one line, small buttons. */
.sch-block.tiny { padding: 0 .3rem 0 .45rem; gap: .2rem; border-left-width: 3px; }
.sch-block.tiny .sch-block-title { font-size: .7rem; line-height: 1.1; }
.sch-block.tiny .sch-block-time { font-size: .64rem; }
.sch-block.tiny .sch-act { width: .8rem; height: .8rem; font-size: .5rem; }
/* A block that crosses the middle of the day: the part before ends, and the part after starts, on a
   dashed edge (and the part after says it carries on with ↳). */
.sch-block.cut-end { border-bottom: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.sch-block.cut-top { border-top: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent); border-top-left-radius: 0; border-top-right-radius: 0; }
.sch-block.done.cut-end { border-bottom-color: var(--border-strong); }
.sch-block.done.cut-top { border-top-color: var(--border-strong); }
.sch-cont { color: var(--accent-text); font-weight: 700; }
.sch-block.done .sch-cont { color: inherit; }
/* The bottom edge: drag it to change how long the block is. */
.sch-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 9px; cursor: ns-resize; touch-action: none; }
.sch-resize::after { content: ''; position: absolute; left: 50%; bottom: 3px; width: 26px; height: 3px; margin-left: -13px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 55%, transparent); opacity: 0; transition: opacity .12s; }
.sch-block:hover .sch-resize::after, .sch-block:focus-visible .sch-resize::after { opacity: 1; }
.sch-block.short .sch-resize::after { display: none; }
.sch-block.tiny .sch-resize { height: 5px; }
@media (pointer: coarse) {
  .sch-resize { height: 14px; }
  .sch-resize::after { opacity: 1; }
  .sch-block.short .sch-resize { height: 7px; } /* leave most of a short block for holding and moving it */
  .sch-block.tiny .sch-resize { height: 6px; }
}

/* Done without a block: a small ✓ at the time it was ticked off. */
.sch-mark { position: absolute; right: 4px; z-index: 3; display: inline-flex; align-items: center; gap: .3rem; max-width: 60%; height: 20px; padding: 0 .5rem; border: 0; border-radius: 999px; background: var(--good-soft); color: var(--good); font: 650 .72rem var(--font, system-ui, sans-serif); cursor: pointer; box-shadow: var(--shadow-sm); white-space: nowrap; }
.sch-mark span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sch-mark small { font-weight: 500; opacity: .8; font-size: .66rem; }

/* Now */
.sch-now { position: absolute; left: calc(var(--sch-gutter) - 5px); right: 0; z-index: 4; height: 0; border-top: 2px solid var(--bad); pointer-events: none; }
.sch-now::before { content: ''; position: absolute; left: -4px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.sch-now span { position: absolute; right: 0; top: -9px; padding: 0 .4rem; border-radius: 999px; background: var(--bad); color: #fff; font-size: .66rem; font-weight: 700; line-height: 16px; font-variant-numeric: tabular-nums; }

/* While dragging: where it will land, and a label that follows the pointer elsewhere. */
.sch-preview { position: absolute; left: 2px; right: 2px; z-index: 5; display: flex; flex-direction: column; justify-content: flex-start; gap: .1rem; padding: .25rem .5rem; overflow: hidden; border: 2px dashed var(--accent); border-radius: var(--radius-sm, 8px); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--text); font-size: .78rem; line-height: 1.2; pointer-events: none; }
.sch-preview b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sch-preview span { color: var(--accent-text); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sch-ghost { position: fixed; z-index: 600; max-width: 260px; padding: .4rem .7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm, 8px); box-shadow: var(--shadow-lg); font: 650 .82rem var(--font, system-ui, sans-serif); pointer-events: none; }
.sch-ghost.off { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.sch-preview[hidden], .sch-ghost[hidden] { display: none !important; }
body.sch-dragging, body.sch-dragging * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }

/* Phones and narrow windows: the list stacks above the timeline. */
@media (max-width: 760px) {
  .sch-body { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .sch-list { position: static; max-height: none; overflow: visible; }
  .sch-head { gap: .6rem; }
  .sch-nav { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
  .sch-day { min-width: 0; }
  .sch .sch-date { grid-column: 2 / -1; width: 100%; }
  .sch-loading { grid-column: 1 / -1; }
  .sch-totals { min-width: 0; }
  .sch-auto { width: 100%; }
  .sch { --sch-gutter: 46px; }
  .sch-tl { padding-left: .2rem; padding-right: .5rem; }
}
@media (max-width: 420px) {
  .sch-task { grid-template-columns: 24px minmax(0, 1fr) auto; }
}
/* No movement: the change just happens (schedule.js skips the fold-away too). */
@media (prefers-reduced-motion: reduce) {
  .sch-task, .sch-block, .sch-list, .sch-fold-caret, .sch-resize::after { transition: none; }
  .sch-task.sch-ticking .sch-tick, .sch-block.sch-ticking .sch-tick, .sch-task.sch-unticking .sch-act, .sch-task.sch-arrive, .sch-count.sch-bump { animation: none; }
  .sch-task.sch-leaving { transition: none; transform: none; }
}

/* ================================================================= */
/* ---------- Stats ---------- */
/* ================================================================= */

/* Medal colors for the achievement tiers (their own, never the status colors), light and dark. */
.st { --st-bronze: #b4683a; --st-silver: #8a94a6; --st-gold: #c99a06; --st-platinum: #4f9fb3; --st-long: var(--warn); --st-quick: var(--info); }
@media (prefers-color-scheme: dark) {
  .st { --st-bronze: #d99a6c; --st-silver: #c3cad6; --st-gold: #f1c84b; --st-platinum: #8fd6e6; }
}

.st-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.st-title { margin: 0; font-size: 1.15rem; font-weight: 750; letter-spacing: -.01em; }
.st-tabs { display: inline-flex; flex-wrap: wrap; padding: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; }
.st-tabs button { font: 650 .82rem var(--font, system-ui, sans-serif); padding: .38rem .85rem; background: none; color: var(--text-2); border: 0; border-radius: 999px; cursor: pointer; }
.st-tabs button:hover { color: var(--text); }
.st-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.st-refresh { display: block; margin: -.6rem 0 .6rem; font-size: .78rem; color: var(--text-3); }

/* Your level: the badge, the title, a thin bar to the next level, XP to go; and the tiers reached. */
.st-level { display: flex; align-items: center; gap: .9rem 1.1rem; flex-wrap: wrap; margin-bottom: .8rem; padding: .9rem 1.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg, 14px); box-shadow: var(--shadow-sm); }
.st-level-badge { flex-shrink: 0; display: grid; place-items: center; align-content: center; width: 3.6rem; height: 3.6rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); line-height: 1; font-size: 1.4rem; }
.st-level-badge small { font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.st-level-badge b { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.st-level-main { flex: 1 1 14rem; min-width: 0; }
.st-level-title { font-size: 1.12rem; font-weight: 750; letter-spacing: -.01em; }
.st-level-main .st-progress { max-width: 28rem; }
.st-level-side { flex-shrink: 0; padding: .4rem .8rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: .85rem; text-decoration: none; white-space: nowrap; }
.st-level-side:hover { color: var(--text); border-color: var(--border-strong); }
.st-level-side b { color: var(--text); }
.st-level.is-loading .st-level-badge { background: var(--surface-2); box-shadow: none; }

.st-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: .7rem; margin-bottom: 1rem; }
.st-tile { padding: .8rem .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg, 14px); box-shadow: var(--shadow-sm); min-width: 0; }
.st-num { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.st-num small { font-size: .85rem; font-weight: 650; color: var(--text-2); letter-spacing: 0; }
.st-label { margin: .15rem 0; font-size: .72rem; font-weight: 700; color: var(--text-3); letter-spacing: .05em; text-transform: uppercase; }
.st-sub { font-size: .8rem; color: var(--text-3); }
.st-sub b { color: var(--text-2); font-weight: 650; }
.st-progress { height: 6px; margin: .4rem 0 .3rem; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.st-progress span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

/* The panels flow in columns (three on a wide window, one on a phone), each kept whole, so short and
   tall panels pack together without gaps. */
.st-grid { columns: 3 340px; column-gap: 1rem; }
.st-grid > .st-panel { break-inside: avoid; margin-bottom: 1rem; }
.st-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg, 14px); box-shadow: var(--shadow-sm); padding: 1.1rem 1.15rem; min-width: 0; }
.st-panel.st-wide, .st-ach-panel { margin-bottom: 1rem; }
.st-ach-panel { margin-top: 0; }
.st-panel-title { margin: 0 0 .5rem; font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.st-loading { color: var(--text-3); margin-bottom: 1rem; }
.st-error { color: var(--bad); margin-bottom: 1rem; }
.st-error p { margin: 0 0 .7rem; }
.st-note { margin: 0 0 .6rem; font-size: .88rem; color: var(--text-2); }
.st-note b { color: var(--text); }
.st-fine { margin: 0 0 .6rem; font-size: .78rem; color: var(--text-3); }
.st-empty { margin: .2rem 0; font-size: .88rem; color: var(--text-3); }
.st-more { margin-top: .5rem; }

/* Share bars: the label and the numbers on a line, the bar under them (one measure: tasks done). */
.st-shares { display: flex; flex-direction: column; gap: .55rem; }
.st-share { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label val" "bar bar"; gap: .2rem .7rem; align-items: baseline; }
.st-share-label { grid-area: label; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
.st-share-val { grid-area: val; font-size: .8rem; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-share-val b { color: var(--text); font-weight: 650; }
.st-share-track { grid-area: bar; display: flex; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.st-bar { height: 100%; border-radius: 0 4px 4px 0; background: var(--accent); }
.st-share:hover .st-bar { filter: brightness(1.1); }

/* Two heatmaps (⏱ Time, ✅ Tasks): the same grid, each shaded by its own measure in one hue,
   light (a little) to dark (a lot), mixed over the surface so it reads in light and dark. */
.st-heats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1rem 2rem; }
.st-heat-one { min-width: 0; }
.st-heat-h { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .2rem .8rem; margin: 0 0 .45rem; font-size: .9rem; font-weight: 700; }
.st-heat-h span { font-size: .78rem; font-weight: 500; color: var(--text-3); }
.st-heat { display: grid; gap: 3px; }
.st-heat-mon { font-size: .68rem; color: var(--text-3); white-space: nowrap; overflow: visible; }
.st-heat-dow { grid-column: 1; align-self: center; font-size: .66rem; color: var(--text-3); }
.st-cell { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 70%, transparent); }
.st-cell.l1 { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); box-shadow: none; }
.st-cell.l2 { background: color-mix(in srgb, var(--accent) 45%, var(--surface)); box-shadow: none; }
.st-cell.l3 { background: color-mix(in srgb, var(--accent) 70%, var(--surface)); box-shadow: none; }
.st-cell.l4 { background: var(--accent); box-shadow: none; }
.st-cell.future, .st-cell.out { background: transparent; box-shadow: none; }
.st-cell.today { outline: 1.5px solid var(--text-2); outline-offset: 1px; }
.st-cell[data-i]:hover { outline: 2px solid var(--text); outline-offset: 1px; }
.st-cell[data-i]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.st-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; margin-top: .5rem; font-size: .72rem; color: var(--text-3); }
.st-legend .st-cell { width: 11px; height: 11px; }
.st-legend > span:first-child { margin-right: 3px; }
.st-legend > span:last-child { margin-left: 3px; }
.st-heat-read { margin: .7rem 0 0; min-height: 1.2em; font-size: .82rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.st-heat-read.on { color: var(--text); font-weight: 600; }

/* The trend: one 2px line over a light fill, a recessive grid, points to hover. */
.st-trend { position: relative; height: 140px; margin: 0 .3rem 0 1.9rem; }
.st-trend-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.st-trend-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.st-trend-area { fill: color-mix(in srgb, var(--accent) 12%, transparent); stroke: none; }
.st-grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.st-trend::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; border-bottom: 1px solid var(--border); }
.st-trend-max { position: absolute; right: calc(100% + .4rem); top: 0; transform: translateY(-50%); font-size: .68rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.st-dot { position: absolute; z-index: 1; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.st-dot::before { content: ''; position: absolute; inset: -8px; } /* a bigger target than the mark */
.st-dot:hover, .st-dot.top { width: 10px; height: 10px; margin: -5px 0 0 -5px; }
.st-trend-axis { position: relative; height: 1.2rem; margin: .3rem .3rem 0 1.9rem; font-size: .7rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.st-trend-axis span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.st-trend-axis span:first-child { transform: none; }
.st-trend-axis span:last-child:not(:first-child) { transform: translateX(-100%); }

/* By day of the week, and by hour: columns from a baseline. */
.st-cols { display: flex; align-items: flex-end; gap: 6px; height: 130px; }
.st-col { flex: 1; height: 100%; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: .25rem; }
.st-col-bar { flex: 1; display: flex; align-items: flex-end; border-bottom: 1px solid var(--border); }
.st-col-bar span { display: block; width: 100%; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.st-col.top .st-col-bar span { background: var(--accent); }
.st-col:hover .st-col-bar span { filter: brightness(1.1); }
.st-col small { text-align: center; font-size: .72rem; color: var(--text-3); }
.st-hours { display: flex; align-items: flex-end; gap: 2px; height: 120px; border-bottom: 1px solid var(--border); }
.st-hour { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.st-hour span { display: block; width: 100%; border-radius: 3px 3px 0 0; background: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.st-hour.top span { background: var(--accent); }
.st-hour:hover span { filter: brightness(1.1); }
.st-hours-axis { position: relative; height: 1.2rem; margin-top: .25rem; font-size: .7rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.st-hours-axis span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.st-hours-axis span:first-child { transform: none; }

/* Estimate vs. real time per category: a bar out from the middle (right: longer, left: quicker). */
.st-ests { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .6rem; }
.st-est { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label val" "bar words"; gap: .15rem .7rem; align-items: center; }
.st-est-label { grid-area: label; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
.st-est-val { grid-area: val; font-size: .8rem; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-est-track { grid-area: bar; position: relative; height: 8px; border-radius: 4px; background: var(--surface-2); }
.st-est-track::after { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1px solid var(--border-strong); }
.st-est-bar { position: absolute; top: 0; bottom: 0; }
.st-est-bar.over { background: var(--st-long); border-radius: 0 4px 4px 0; }
.st-est-bar.under { background: var(--st-quick); border-radius: 4px 0 0 4px; }
.st-est-words { grid-area: words; min-width: 6.5rem; text-align: right; font-size: .76rem; font-weight: 650; color: var(--text-2); white-space: nowrap; }

/* 🏆 Achievements: a card each; grey until its first tier, then its medal's color. */
.st-ach-group { margin: .9rem 0 .5rem; font-size: .72rem; font-weight: 700; color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; }
.st-achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: .7rem; }
.st-ach { --medal: var(--border-strong); display: flex; gap: .75rem; align-items: flex-start; padding: .75rem .85rem; border: 1px solid var(--border); border-left: 4px solid var(--medal); border-radius: var(--radius, 10px); background: var(--surface); min-width: 0; }
.st-ach.tier-1 { --medal: var(--st-bronze); }
.st-ach.tier-2 { --medal: var(--st-silver); }
.st-ach.tier-3 { --medal: var(--st-gold); }
.st-ach.tier-4 { --medal: var(--st-platinum); }
.st-ach-icon { flex-shrink: 0; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; font-size: 1.3rem; line-height: 1; background: color-mix(in srgb, var(--medal) 18%, var(--surface)); box-shadow: inset 0 0 0 2px var(--medal); }
.st-ach.none .st-ach-icon { filter: grayscale(1); opacity: .55; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.st-ach-main { flex: 1; min-width: 0; }
.st-ach-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: .2rem .5rem; font-weight: 700; font-size: .92rem; line-height: 1.3; }
.st-ach-tier { padding: 0 .45rem; border-radius: 999px; font-size: .7rem; font-weight: 700; letter-spacing: .02em; color: var(--text); background: color-mix(in srgb, var(--medal) 22%, var(--surface)); }
.st-ach-tier.none { color: var(--text-3); background: var(--surface-2); font-weight: 600; }
.st-ach-cat { font-size: .76rem; color: var(--text-3); }
.st-ach-what { margin-top: .15rem; font-size: .8rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.st-ach .st-progress { height: 5px; margin: .3rem 0 .4rem; }
.st-ach .st-progress span { background: var(--medal); }
.st-ach.none .st-progress span { background: var(--text-3); }
.st-pips { list-style: none; margin: .3rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .15rem .6rem; }
.st-pip { display: flex; align-items: center; gap: .35rem; min-width: 0; font-size: .72rem; color: var(--text-3); }
.st-pip-dot { flex-shrink: 0; width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.st-pip.on .st-pip-dot { box-shadow: none; }
.st-pip.on.bronze .st-pip-dot { background: var(--st-bronze); }
.st-pip.on.silver .st-pip-dot { background: var(--st-silver); }
.st-pip.on.gold .st-pip-dot { background: var(--st-gold); }
.st-pip.on.platinum .st-pip-dot { background: var(--st-platinum); }
.st-pip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-pip-text b { font-weight: 650; }
.st-pip.on { color: var(--text-2); }
.st-pip.on .st-pip-text b { color: var(--text); }

@media (max-width: 600px) {
  .st-tabs { width: 100%; justify-content: space-between; }
  .st-tabs button { flex: 1; padding: .38rem .4rem; }
  .st-num { font-size: 1.35rem; }
  .st-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .st-panel { padding: .95rem .9rem; }
  .st-level { padding: .8rem .9rem; }
  .st-level-side { order: 3; }
  .st-cols { gap: 4px; }
}
@media (max-width: 480px) {
  .st-pips { grid-template-columns: minmax(0, 1fr); } /* each tier and its day on a line of its own */
}
@media (prefers-reduced-motion: reduce) {
  .st-share:hover .st-bar, .st-col:hover .st-col-bar span, .st-hour:hover span { filter: none; }
}
