/* styles.css — calm, trustworthy wellbeing tool. Large numbers, no flashy claims. OWNER: web tab. */
:root {
  --bg: #0e141c;
  --panel: #161f2b;
  --panel-2: #1d2836;
  --line: #2a3850;
  --fg: #e8eef6;
  --muted: #a9b8cc;
  --accent: #5b9df0;
  --accent-soft: #223455;
  --good: #58c08a;
  --warn: #e0b24a;
  --danger: #e07a6a;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
/* The `hidden` attribute must always win, even over elements that set an explicit
   `display` (e.g. .demo-corner:display flex, .live-panel/.field:display grid). Without
   this, `hidden` silently does nothing on those elements — which leaked the demo strip
   and the access-key field before a mode was chosen (W13 defects 1-3). */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #16202e 0%, var(--bg) 60%);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: var(--accent); }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .3px; }
.brand .dot { color: var(--accent); }
.spacer { flex: 1; }
.lang-toggle button {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 13px;
}
.lang-toggle button.active { color: var(--fg); border-color: var(--accent); background: var(--accent-soft); }
.mock-badge {
  background: #3a2d12; color: var(--warn); border: 1px solid #5a471f;
  border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600;
}

main { flex: 1; width: 100%; max-width: 920px; margin: 0 auto; padding: 24px 20px 48px; }
.screen { display: none; }
.screen.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card + .card { margin-top: 16px; }
h1 { font-size: 26px; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 0 0 12px; }
.tagline { color: var(--muted); font-size: 16px; margin: 0 0 20px; max-width: 60ch; }
.lead { color: var(--fg); font-weight: 600; margin: 0 0 10px; }
ul.privacy { margin: 0 0 18px; padding-left: 18px; color: var(--muted); }
ul.privacy li { margin: 6px 0; }

.btn {
  background: var(--accent); color: #07121f; border: 0; border-radius: 10px;
  padding: 12px 20px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.consent { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 18px; color: var(--muted); }
.consent input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); }

/* error states */
.state-icon { font-size: 34px; }
.err-title { color: var(--warn); }

/* calibrate */
.calib-wrap { display: grid; grid-template-columns: 1fr; gap: 18px; place-items: center; text-align: center; }
.preview {
  position: relative; width: 320px; max-width: 100%; aspect-ratio: 4/3;
  background: #0a0f16; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.preview .layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.preview .mirror { object-fit: cover; transform: scaleX(-1); }
.preview .overlay { pointer-events: none; z-index: 2; } /* overlay.js mirrors coords itself — no CSS flip */
.preview .overlay.hidden { display: none; }
.cam-badge {
  position: absolute; left: 8px; top: 8px; display: flex; gap: 6px; align-items: center;
  background: rgba(10,16,22,.78); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; color: var(--good);
}
.cam-badge .led { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.countdown { font-size: 54px; font-weight: 800; color: var(--accent); min-width: 72px; }
.progress { width: 260px; max-width: 80%; height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s linear; }
.discard-note { color: #c3d0e2; font-size: 12px; margin-top: 4px; }

/* run */
.run-grid { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.metrics { display: grid; gap: 14px; }
.metric { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.metric .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.metric .value { font-size: 28px; font-weight: 800; }
.metric .bar { height: 6px; background: #0c131c; border-radius: 999px; margin-top: 8px; overflow: hidden; }
.metric .bar > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .25s ease; }
.metric.na .value { color: var(--muted); font-weight: 600; font-size: 18px; }
/* "measuring" skeleton while quality is poor / no face yet (correction 3) */
.metric.skeleton .value { color: var(--muted); font-weight: 600; font-size: 15px; }
.metric.skeleton .bar > span {
  width: 100% !important; background: linear-gradient(90deg, #22304a 25%, #2c3c5a 50%, #22304a 75%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite; opacity: .6;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* overlay toggle */
.overlay-row { margin-top: 10px; }.switch { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.overlay-hint { color: var(--muted); font-size: 12px; margin: 6px 0 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; min-height: 30px; }.chip { background: var(--accent-soft); border: 1px solid var(--line); color: var(--fg); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.chip.fresh { border-color: var(--accent); }

.quality-banner {
  display: none; background: #3a2d12; color: var(--warn); border: 1px solid #5a471f;
  border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px;
}
.quality-banner.show { display: block; }
.temp-error {
  display: none; background: #2a1f1c; color: var(--danger); border: 1px solid #4a2f29;
  border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px;
}
.temp-error.show { display: block; }

/* demo-only realtime playback progress (W13 defect 4) — shows elapsed/total so a judge
   knows how long the demo runs; hidden in live/mock and in fast demo mode. */
.demo-progress { margin-top: 12px; }
.demo-progress .progress { width: 100%; max-width: none; }
.demo-progress-note { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }

/* toast / nudge — bottom-right stack (W5 ①): top-right overlapped the live metric cards,
   so toasts now sit at the bottom-right, newest on top, clear of the right-column metrics.
   Capped to 2 in JS; sits above the demo corner marker. */
.toast-host {
  position: fixed; right: 20px; bottom: 64px; z-index: 46;
  width: min(360px, calc(100vw - 40px));
  display: flex; flex-direction: column-reverse; gap: 10px;
  max-height: calc(100vh - 140px); overflow-y: auto; pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--panel); border: 1px solid var(--accent); border-left: 4px solid var(--accent);
  border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; animation: slidein .2s ease;
}
@keyframes slidein { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.toast.confirm { border-color: var(--warn); border-left-color: var(--warn); }
.toast .msg { margin: 0 0 10px; }
.toast .btn-row { justify-content: flex-end; }
.toast .btn { padding: 8px 16px; font-size: 14px; }

/* report */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 8px 0 18px; }
.num-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.num-card .n { font-size: 34px; font-weight: 800; }
.num-card .k { color: var(--muted); font-size: 13px; margin-top: 2px; }
.report-text { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; color: var(--fg); line-height: 1.6; }
.sub { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin: 22px 0 10px; }
.highlights { margin: 0; padding-left: 18px; color: var(--fg); }
.highlights li { margin: 5px 0; }
.compare { display: flex; flex-wrap: wrap; gap: 12px; }
.compare .pill {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; font-size: 14px; display: inline-flex; align-items: center; gap: 8px;
}
.compare .pill .k { color: var(--muted); }
.compare .trend-up { color: var(--warn); }
.compare .trend-down { color: var(--good); }
.compare .trend-flat { color: var(--muted); }
.compare .first { color: var(--muted); font-size: 14px; }
.compare-note { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.table-wrap { overflow-x: auto; }
table.breakdown { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 14px; }
table.breakdown th, table.breakdown td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.breakdown th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
table.breakdown td:first-child { color: var(--fg); }
table.breakdown td { color: var(--muted); }
table.breakdown tr:last-child td { border-bottom: 0; }
table.breakdown .empty { color: var(--muted); text-align: center; padding: 16px; }

/* Solid background so contrast is always resolvable (axe can't fall back to white when the
   footer sits over the body gradient or a fixed strip's layout box) — W17 task 6. */
footer { color: #c3d0e2; font-size: 12px; text-align: center; padding: 16px; background: var(--bg); position: relative; z-index: 1; }

/* ---------- W3: accessibility, agent panel, modal, errors, responsive ---------- */

/* keyboard focus visible everywhere (color is not the only signal) */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
/* header privacy link */
.link-btn {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; padding: 4px 10px; font-size: 13px; cursor: pointer; margin-right: 10px;
}
.link-btn:hover { color: var(--fg); border-color: var(--accent); }
.icon-btn {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; width: 34px; height: 34px; font-size: 15px; cursor: pointer; line-height: 1;
}
.icon-btn:hover { color: var(--fg); border-color: var(--accent); }

/* dev-only frame throughput indicator */
.dev-stats {
  position: absolute; right: 8px; top: 8px; z-index: 3;
  background: rgba(10,16,22,.8); border: 1px solid var(--line); border-radius: 8px;
  padding: 3px 8px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}

/* agent activity panel — evidence of perceive→decide→act */
.agent-panel {
  margin-top: 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.agent-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.agent-title { font-size: 17px; margin: 0; }
.agent-hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.agent-filter { margin: 12px 0 8px; }
.agent-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.agent-row {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-size: 13px;
}
.agent-row.none { opacity: .72; }
.agent-row.highlight { border-left-color: var(--accent); background: var(--accent-soft); }
.agent-row.needs-human { border-left-color: var(--warn); }
.agent-row .ts { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 8px; }
.agent-row .act { font-weight: 700; }
.agent-row .ico { margin-right: 6px; }
.agent-row .reason { color: var(--muted); margin-left: 6px; }
.agent-row .recheck { display: block; color: var(--accent); font-size: 12px; margin-top: 4px; }
.agent-row .tools { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.agent-empty { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(6,10,16,.72);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); width: min(560px, 100%); max-height: 86vh; overflow-y: auto; padding: 22px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-body p { color: var(--fg); line-height: 1.6; margin: 0 0 6px; }
.modal-body .note { color: var(--muted); font-size: 13px; }
.modal-body .sub { margin: 16px 0 6px; }

/* reduced motion: stop all non-essential animation */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .screen.active { animation: none; }
  .cam-badge .led { animation: none; }
  .metric.skeleton .bar > span { animation: none; }
}

/* responsive down to 360px */
@media (max-width: 680px) {
  .run-grid { grid-template-columns: 1fr; }
  .preview { width: 100%; }
  /* agent panel becomes a bottom sheet on small screens */
  .agent-panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0;
    border-radius: 16px 16px 0 0; max-height: 72vh; overflow-y: auto;
  }
}
@media (max-width: 400px) {
  main { padding: 16px 12px 40px; }
  .card { padding: 16px; }
  h1 { font-size: 22px; }
  .num-card .n { font-size: 28px; }
  .toast-host { right: 10px; bottom: 56px; width: calc(100vw - 20px); max-height: 50vh; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
}

/* demo mode: badge + persistent corner marker ("playback, not a real camera").
   Pinned bottom-left (W5 ②) so it never overlaps body text or the bottom-right toast stack,
   including at narrow widths; wraps as a pill with its own background instead of running into prose. */
.mock-badge.demo { background: #12303a; color: #7fd4e0; border-color: #1f5a67; }
/* Demo marker: a full-width bottom strip so it is always visible but never floats over
   content (the old bottom-left pill clipped the buddy's rewind hint on narrow widths).
   Page content reserves space via body padding-bottom below. */
.demo-corner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 47;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(10,16,22,.96); color: #7fd4e0; border-top: 1px solid #1f5a67;
  padding: 7px 12px; font-size: 12px; font-weight: 600; text-align: center;
  box-shadow: 0 -4px 16px rgba(0,0,0,.3); pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.demo-corner::before { content: "●"; color: #7fd4e0; font-size: 10px; }
/* reserve space at the bottom of the page so nothing hides under the fixed strip
   (the strip is ~30px + shadow; keep a comfortable margin so card footers like the
   comparison card's "Example data" note are never covered — W17 task 4). */
body.has-demo-strip { padding-bottom: 60px; }
@media (max-width: 400px) {
  .demo-corner { font-size: 11px; padding: 6px 10px; }
  body.has-demo-strip { padding-bottom: 56px; }
}
@media (prefers-reduced-motion: no-preference) {
  .demo-corner { animation: demoPulse 2.4s ease-in-out infinite; }
}
@keyframes demoPulse { 0%,100% { opacity: .9; } 50% { opacity: 1; } }

/* ---------- W6: mode select (Demo / Live), access key, service status ---------- */
.mode-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0 18px; }
.mode-card {
  text-align: left; display: flex; flex-direction: column; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; cursor: pointer; color: var(--fg); font: inherit;
}
.mode-card:hover { border-color: var(--accent); }
.mode-card[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.mode-card .mode-name { font-weight: 700; font-size: 16px; }
.mode-card .mode-desc { color: var(--muted); font-size: 13px; line-height: 1.5; }

.live-panel { margin: 0 0 18px; display: grid; gap: 8px; }
.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; color: var(--fg); font-weight: 600; }
.field input[type="password"] {
  background: #0c131c; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; color: var(--fg); font-size: 15px; font-family: ui-monospace, monospace;
}
.field input[type="password"]:focus-visible { border-color: var(--accent); }
.field-hint { color: var(--muted); font-size: 12px; margin: 0; line-height: 1.5; }
.live-status { font-size: 13px; margin: 2px 0 0; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.live-status .led { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.live-status.up { color: var(--good); }
.live-status.up .led { background: var(--good); box-shadow: 0 0 8px var(--good); }
.live-status.down { color: var(--danger); }
.live-status.down .led { background: var(--danger); }
.live-status .runtime { color: var(--muted); font-variant-numeric: tabular-nums; }
/* W21 trial key */
.trial-key { display: grid; gap: 6px; margin: 2px 0 2px; }
.trial-key-btn { justify-self: start; }
.trial-key-ipnote { color: var(--muted); font-size: 11.5px; margin: 0; line-height: 1.45; }
.trial-key-remaining {
  font-size: 12.5px; margin: 2px 0 0; color: var(--fg);
  font-variant-numeric: tabular-nums; line-height: 1.45; overflow-wrap: anywhere;
}
.start-hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.start-hint.warn { color: var(--warn); }

@media (max-width: 400px) {
  .mode-group { grid-template-columns: 1fr; }
}

/* ---------- posture buddy (W10) ---------- */
.buddy-wrap {
  margin-top: 16px; padding: 14px 14px 18px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel-2);
}
.buddy-head { margin-bottom: 8px; }
.buddy-title { margin: 0; font-size: 15px; }
.buddy-hint { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
/* W14 honesty line: measured vs estimated. Slightly emphasised so it isn't missed. */
.buddy-measured-note {
  margin: 6px 0 0; color: var(--fg); font-size: 12px; line-height: 1.45;
  border-left: 3px solid var(--accent); padding: 4px 0 4px 9px;
  background: rgba(91,157,240,.08); border-radius: 0 6px 6px 0;
}
.buddy-stage { position: relative; width: 100%; }
.buddy-canvas {
  display: block; width: 100%; height: 300px; border-radius: 12px;
  background: radial-gradient(120% 90% at 50% 20%, #1b2736 0%, #141d29 70%);
  cursor: grab; touch-action: none; outline-offset: 3px;
}
.buddy-canvas:active { cursor: grabbing; }
.buddy-canvas.buddy-2d { background: #141d29; }
.buddy-exag, .buddy-unsure {
  position: absolute; left: 10px; font-size: 11.5px; padding: 3px 8px;
  border-radius: 999px; pointer-events: none;
}
.buddy-exag { bottom: 10px; background: rgba(0,0,0,.45); color: var(--muted); }
.buddy-unsure {
  top: 10px; right: 10px; left: auto; background: #3a2d12; color: var(--warn);
  border: 1px solid #5a471f;
}
.buddy-2dnote { margin: 8px 0 0; color: var(--warn); font-size: 12px; }
.buddy-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-top: 10px;
}
.buddy-views { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip-btn {
  background: var(--accent-soft); border: 1px solid var(--line); color: var(--fg);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer;
}
.chip-btn:hover { border-color: var(--accent); }
.buddy-rotate-hint { margin: 8px 0 0; color: var(--muted); font-size: 11.5px; }
.buddy-ghost-legend { margin: 6px 0 0; color: #8fd0ff; font-size: 11.5px; }
.buddy-state {
  margin: 8px 0 4px; color: var(--fg); font-size: 13px; line-height: 1.45;
  /* grow to fit the full status (up to ~4 lines on forward-head) — height is automatic, never
     truncated. A comfortable min keeps the layout from jumping between short/long states. */
  min-height: 2.9em; overflow-wrap: anywhere; overflow: visible;
}

@media (max-width: 680px) {
  .buddy-canvas { height: 260px; }
}
@media (prefers-reduced-motion: reduce) {
  .buddy-canvas { cursor: default; }
}

/* ---------- session rewind (W10 stage 2) ---------- */
.buddy-rewind { margin-top: 12px; }
.rewind-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.rewind-title { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.rewind-track { position: relative; }
.rewind-marks { display: block; width: 100%; height: 10px; border-radius: 4px; }
.rewind-track input[type="range"] { width: 100%; margin-top: 4px; accent-color: var(--accent); cursor: pointer; }
.rewind-time { margin: 6px 0 0; color: var(--fg); font-size: 12.5px; min-height: 1.2em; }

/* ---------- W16: quiet mode + timeline report + session comparison ---------- */
/* Quiet bar (run screen): default-on toggle + a calm status chip (no sound, no flash). */
.quiet-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 6px;
}
.quiet-chip {
  background: var(--accent-soft); border: 1px solid var(--line); color: var(--fg);
  border-radius: 999px; padding: 4px 12px; font-size: 13px; font-variant-numeric: tabular-nums;
}
.quiet-chip.has-notes { border-color: var(--warn); color: var(--warn); }
.quiet-hint { color: var(--muted); font-size: 12px; margin: 0 0 12px; }
/* merged-count tag on a toast when more of the same kind arrive while one is showing */
.toast .more {
  display: inline-block; margin-left: 8px; font-size: 12px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
}

/* timeline / history cards */
.tl-hint { color: var(--muted); font-size: 12.5px; margin: 0 0 8px; }
.tl-card {
  position: relative; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px;
}
.tl-tabs { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tl-tab {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer;
}
.tl-tab[aria-selected="true"] { color: var(--fg); border-color: var(--accent); background: var(--accent-soft); }
.tl-rate { color: var(--fg); font-size: 14px; font-weight: 600; margin: 0 0 10px; }
/* bar chart: flex columns; height encodes count, label underneath. Orange = bad posture. */
.tl-chart { display: flex; align-items: flex-end; gap: 6px; min-height: 120px; padding-top: 6px; }
.tl-chart.history-chart { gap: 8px; }
.tl-bar { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.tl-bar .bar-fill {
  width: 100%; max-width: 34px; background: var(--warn); border-radius: 6px 6px 0 0;
  min-height: 2px; transition: height .25s ease;
}
.tl-bar.is-this .bar-fill { background: var(--accent); }
.tl-bar .bar-n { font-size: 12px; color: var(--fg); font-variant-numeric: tabular-nums; }
.tl-bar .bar-x { font-size: 10.5px; color: var(--muted); text-align: center; overflow-wrap: anywhere; line-height: 1.2; }
.tl-short, .history-none { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.tl-view-toggle { margin-top: 10px; }
.tl-table { margin-top: 10px; }
.history-trend { color: var(--fg); font-size: 14px; font-weight: 600; margin: 0 0 10px; }
.example-badge {
  position: absolute; right: 12px; top: 12px;
  background: #12303a; color: #7fd4e0; border: 1px solid #1f5a67;
  border-radius: 999px; padding: 3px 10px; font-size: 11.5px; font-weight: 600;
}
.example-note { color: #7fd4e0; font-size: 12px; margin: 8px 0 0; }
.stored-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-top: 18px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px;
}
.stored-title { font-weight: 600; font-size: 13px; }
.stored-note { color: var(--muted); font-size: 12px; margin: 4px 0 0; max-width: 60ch; }
@media (max-width: 400px) {
  .tl-chart { min-height: 96px; }
  .tl-bar .bar-fill { max-width: 26px; }
}
