/* Colours and type follow lecoffee.shop: linen backgrounds, moss greens, sage accents,
   DM Sans headings and Poppins body text. Chart colours are validated for contrast and
   colour-blind separation.

   The look: a deep moss backdrop at the top fading into linen, with frosted glass cards
   over soft patches of colour. The most important numbers sit in dark glass cards. */

:root {
  color-scheme: light;
  --bg: #e9efe3;            /* linen */
  --surface: #ffffff;
  --surface-2: #f7f9f4;
  --border: #dde6d5;        /* linen dark */
  --text: #1a2e1b;          /* moss dark */
  --text-2: #4a5f4c;
  --text-3: #6b7f6d;
  --brand: #2c4a2e;         /* moss */
  --brand-2: #3d6340;       /* moss light */
  --on-brand: #f0f4eb;
  --on-brand-2: #c5d6c3;
  --on-brand-3: #a9c2a6;
  --mint: #bdf0c5;          /* highlights on dark glass */
  --pill: #2c4a2e;          /* selected buttons */
  --on-pill: #f0f4eb;
  --on-pill-2: #c5d6c3;
  --sage: #9dbda1;
  --accent: #3a7d44;        /* bars, buttons */
  --accent-hi: #67a571;     /* top of the bar gradient */
  --accent-soft: #cfe0cf;   /* unfinished day */
  --line: #1a2e1b;          /* 7-day average */
  --grid: rgb(26 46 27 / 0.08);
  --track: rgb(26 46 27 / 0.07);
  --good: #2f7a3b;
  --good-bg: #e2f1e2;
  --bad: #b3362b;
  --bad-bg: #fbe9e6;
  --amber: #fbbf24;
  --series-1: #3a7d44;
  --series-2: #2a78d6;
  --series-3: #b26f10;
  --series-4: #7a5cc8;
  --series-5: #c2477e;
  --radius: 24px;
  --glass: linear-gradient(155deg, rgb(255 255 255 / 0.86), rgb(255 255 255 / 0.66));
  --glass-border: rgb(255 255 255 / 0.72);
  --glass-shadow: inset 0 1px 0 rgb(255 255 255 / 0.9), 0 10px 30px -14px rgb(26 46 27 / 0.28);
  --glass-solid: rgb(250 252 247 / 0.94); /* overlays that need to be read over anything */
  --dark-glass: linear-gradient(150deg, rgb(44 74 46 / 0.84), rgb(26 46 27 / 0.76));
  --row-line: rgb(26 46 27 / 0.07);
  --soft-tile: linear-gradient(135deg, #e2f1e2, #f6ecd9);
  --shadow: var(--glass-shadow);
  --font-display: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-body: "Poppins", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d1a0f;
    --surface: #1a2e1b;
    --surface-2: #21382a;
    --border: #2c4a2e;
    --text: #f0f4eb;
    --text-2: #c5d3c2;
    --text-3: #93a692;
    --pill: #f0f4eb;
    --on-pill: #1a2e1b;
    --on-pill-2: #4a5f4c;
    --accent: #4f9a5a;
    --accent-hi: #7cc087;
    --accent-soft: #2f5233;
    --line: #f0f4eb;
    --grid: rgb(240 244 235 / 0.08);
    --track: rgb(240 244 235 / 0.09);
    --good: #8fd39b;
    --good-bg: rgb(143 211 155 / 0.14);
    --bad: #f0857a;
    --bad-bg: rgb(240 133 122 / 0.14);
    --series-1: #4f9a5a;
    --series-2: #3987e5;
    --series-3: #c98500;
    --series-4: #9085e9;
    --series-5: #d95926;
    --glass: linear-gradient(155deg, rgb(40 66 43 / 0.62), rgb(24 42 26 / 0.5));
    --glass-border: rgb(240 244 235 / 0.1);
    --glass-shadow: inset 0 1px 0 rgb(240 244 235 / 0.06), 0 14px 34px -16px rgb(0 0 0 / 0.6);
    --glass-solid: rgb(24 40 26 / 0.95);
    --dark-glass: linear-gradient(150deg, rgb(58 96 61 / 0.6), rgb(30 52 32 / 0.6));
    --row-line: rgb(240 244 235 / 0.08);
    --soft-tile: linear-gradient(135deg, rgb(143 211 155 / 0.16), rgb(233 211 155 / 0.12));
  }
}

* { box-sizing: border-box; }

html { background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  font: 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, .summary strong, .donut-center strong { font-family: var(--font-display); }
h1 { font-size: 1.5rem; margin: 0; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.08rem; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--text-2); font-size: 0.85rem; }
.eyebrow {
  font: 600 0.68rem var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2px;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
button { font-family: inherit; }

/* ---------- Backdrop ---------- */

.dash { position: relative; min-height: 100vh; }
/* Scrolls with the page: the dark top stays at the top, and further down the glass sits on linen */
.backdrop { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--bg); }
/* Almost black moss at the very top, fading out slowly so there's no edge */
.backdrop::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: min(640px, 80vh); z-index: 1;
  background: linear-gradient(180deg, #0b170d 0%, #112013 18%, #182c1a 36%, rgb(24 44 26 / 0.86) 50%,
    rgb(24 44 26 / 0.62) 62%, rgb(24 44 26 / 0.36) 74%, rgb(24 44 26 / 0.14) 86%, rgb(24 44 26 / 0) 100%);
}
.backdrop i { position: absolute; border-radius: 50%; filter: blur(60px); }
.backdrop i:nth-child(1) { z-index: 2; width: 380px; height: 300px; left: -140px; top: -90px; background: radial-gradient(circle, rgb(61 99 64 / 0.55), transparent 70%); opacity: 0.7; }
.backdrop i:nth-child(2) { z-index: 2; width: 280px; height: 260px; right: -130px; top: 240px; background: #4f8a5a; opacity: 0.28; }
.backdrop i:nth-child(3) { width: 340px; height: 340px; left: -110px; top: 52vh; background: #f1d9b8; opacity: 0.75; }
.backdrop i:nth-child(4) { width: 300px; height: 300px; right: -100px; bottom: -40px; background: #b7d8c0; opacity: 0.75; }
@media (prefers-color-scheme: dark) {
  .backdrop i:nth-child(3) { background: #3b3324; opacity: 0.45; }
  .backdrop i:nth-child(4) { background: #1f4a2c; opacity: 0.6; }
}

/* ---------- Glass ---------- */

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius);
}
.glass.dark {
  background: var(--dark-glass);
  border-color: rgb(255 255 255 / 0.14);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.16), 0 18px 40px -16px rgb(10 25 12 / 0.55);
  color: var(--on-brand);
}
.glass.dark .eyebrow { color: #a8e0b0; }

/* ---------- Top bar ---------- */

.topbar {
  display: flex; align-items: center; gap: 12px;
  max-width: 1100px; margin: 0 auto;
  padding: calc(var(--safe-top) + 14px) 18px 14px;
  color: var(--on-brand);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { display: block; flex: none; border-radius: 50%; box-shadow: 0 0 0 1px rgb(240 244 235 / 0.18), 0 10px 24px -12px rgb(0 0 0 / 0.6); }
.brand-text { min-width: 0; }
.brand h1 { font-size: 1.05rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.updated { display: flex; align-items: center; gap: 7px; color: var(--on-brand-2); font-size: 0.76rem; margin-top: 1px; }
.live-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #7cd18a; box-shadow: 0 0 0 0 rgb(124 209 138 / 0.6); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgb(124 209 138 / 0); } 100% { box-shadow: 0 0 0 0 rgb(124 209 138 / 0); } }
.tab-title { display: none; min-width: 0; }
.tab-title h1 { font-size: 1.85rem; line-height: 1.1; letter-spacing: -0.025em; }
.tab-title p { font-size: 0.8rem; color: var(--on-brand-2); margin-top: 2px; }
body:not([data-tab="today"]) .brand { display: none; }
body:not([data-tab="today"]) .tab-title { display: block; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.top-links { display: flex; align-items: center; gap: 8px; }
.badge {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 5px 10px; border-radius: 999px;
  background: rgb(251 191 36 / 0.18); color: #ffe7a3;
}
.glass-btn {
  width: 40px; height: 40px; display: grid; place-items: center; padding: 0; cursor: pointer;
  border-radius: 50%; color: var(--on-brand);
  background: rgb(255 255 255 / 0.1); border: 1px solid rgb(255 255 255 / 0.2);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: background 0.2s, transform 0.2s var(--ease);
}
.glass-btn:hover { background: rgb(255 255 255 / 0.18); }
.glass-btn:active { transform: scale(0.94); }
.glass-btn:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.glass-btn:disabled { cursor: progress; }
#sync:disabled svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Layout ---------- */

main { max-width: 1100px; margin: 0 auto; padding: 0 16px calc(var(--safe-bottom) + 112px); }
.panel { animation: panel-in 0.35s var(--ease); }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } }

.notice, .error { padding: 12px 16px; border-radius: 16px; margin: 0 0 12px; font-size: 0.88rem; }
.notice { background: var(--glass-solid); color: var(--text-2); box-shadow: var(--glass-shadow); }
.error { background: var(--bad-bg); color: var(--bad); }

/* "Turn on notifications" bubble, until they're on (or dismissed for a week) */
.notify-nudge {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 12px; padding: 8px 8px 8px 14px; border-radius: 999px;
  background: rgb(251 191 36 / 0.16); color: #fde7ad; font-size: 0.84rem;
  border: 1px solid rgb(251 191 36 / 0.22);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.notify-nudge svg { flex: none; }
.notify-nudge p { flex: 1; min-width: 0; line-height: 1.35; }
.nudge-on {
  flex: none; padding: 7px 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--on-brand); color: var(--brand); font: 600 0.8rem var(--font-body);
}
.nudge-on:disabled { opacity: 0.7; cursor: progress; }
.notify-nudge-close {
  flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; cursor: pointer;
  background: none; color: inherit; font-size: 1.2rem; line-height: 1; opacity: 0.75;
}
.notify-nudge-close:hover { opacity: 1; background: rgb(240 244 235 / 0.1); }

/* ---------- Today: the headline card ---------- */

.headline {
  position: relative; overflow: hidden;
  padding: 18px 18px 16px; margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
  animation: rise 0.6s var(--ease) both;
}
.headline::before, .feature::before {
  content: ""; position: absolute; right: -70px; top: -80px; width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgb(168 224 176 / 0.26), transparent 65%); pointer-events: none;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.hl-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 500 0.8rem/1 var(--font-body); color: var(--on-brand-2); }
.hl-label > span { display: flex; align-items: center; gap: 7px; min-width: 0; }
.hl-label .live-dot { box-shadow: 0 0 0 3px rgb(124 209 138 / 0.18); animation: none; }
.hl-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.hl-num, .feature-big {
  display: flex; align-items: flex-start; gap: 5px;
  font: 700 3.6rem/0.9 var(--font-display); letter-spacing: -0.035em; color: #f4f8f1;
  font-variant-numeric: tabular-nums;
}
.cur { font: 600 1.1rem/1 var(--font-display); letter-spacing: 0; color: var(--on-brand-3); padding-top: 0.5rem; }
.hl-chip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 4px 10px; border-radius: 999px;
  font: 500 0.76rem/1.2 var(--font-body);
  background: rgb(240 244 235 / 0.1); color: var(--on-brand); border: 1px solid rgb(240 244 235 / 0.16);
}
.hl-chip.up { background: rgb(168 224 176 / 0.16); color: var(--mint); border-color: rgb(168 224 176 / 0.28); }
.hl-chip.down { background: rgb(240 133 122 / 0.16); color: #ffc9c1; border-color: rgb(240 133 122 / 0.28); }
.hl-top .hl-chip { margin-bottom: 4px; }
.hl-bar { margin-top: 18px; }
.hl-bar.has-tick { margin-top: 34px; }
.hl-track { position: relative; height: 10px; border-radius: 999px; background: rgb(255 255 255 / 0.1); }
.hl-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, #e9d39b, #8af59c); box-shadow: 0 0 14px rgb(138 245 156 / 0.45);
  transition: width 1.1s var(--ease);
}
.hl-tick { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; border-radius: 2px; background: #f0f4eb; }
.hl-tick span { position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%); font: 500 0.66rem/1 var(--font-body); color: var(--on-brand-2); white-space: nowrap; }
.hl-legend { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; font: 400 0.72rem/1.25 var(--font-body); color: var(--on-brand-3); }
.hl-legend b { color: var(--on-brand); font-weight: 500; }
.hl-note { margin-top: 6px; font: 400 0.68rem/1.35 var(--font-body); color: var(--on-brand-3); }
.hl-stats, .feature-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px; padding-top: 14px; border-top: 1px solid rgb(255 255 255 / 0.1);
}
.hl-stats:empty { display: none; }
.hl-stats div, .feature-stats div { padding: 0 12px; border-left: 1px solid rgb(255 255 255 / 0.1); font: 400 0.7rem/1.25 var(--font-body); color: var(--on-brand-3); min-width: 0; }
.hl-stats div:first-child, .feature-stats div:nth-child(3n + 1) { padding-left: 0; border-left: 0; }
.hl-stats strong, .feature-stats strong { display: block; font: 600 1rem/1.25 var(--font-display); color: var(--on-brand); margin-bottom: 2px; overflow-wrap: anywhere; }
.feature-stats { row-gap: 12px; }
.hl-recap { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgb(255 255 255 / 0.1); animation: rise 0.6s var(--ease) both; }
.day-summary-text { font: 400 1rem/1.58 var(--font-body); color: #eef4ec; white-space: pre-line; }
.day-summary-cheer { font: 700 1.15rem var(--font-display); margin-bottom: 4px; }
.day-summary-trend { display: inline-flex; margin-bottom: 10px; }
.day-summary-alerts { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.day-summary-alerts li { padding: 8px 12px; border-radius: 12px; background: rgb(251 191 36 / 0.16); color: #fde7ad; font-size: 0.86rem; }
.hl-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.hl-stats:empty + .hl-recap[hidden] + .hl-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgb(255 255 255 / 0.1); }
.hl-by { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 0.72rem; color: var(--on-brand-3); }
.spark-tile {
  flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px;
  background: linear-gradient(135deg, #a8e0b0, #e9d39b); color: #1a2e1b;
}
.spark-tile svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.hl-ask {
  margin-left: auto; flex: none; min-height: 34px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  background: rgb(255 255 255 / 0.1); border: 1px solid rgb(255 255 255 / 0.18); color: var(--on-brand);
  font: 500 0.8rem var(--font-body); transition: background 0.2s;
}
.hl-ask:hover { background: rgb(255 255 255 / 0.18); }

/* Yesterday and the month, side by side */
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.tile { padding: 13px 14px; min-width: 0; animation: rise 0.6s var(--ease) 0.08s both; }
.tile h2 { font: 500 0.76rem/1.3 var(--font-body); color: var(--text-3); letter-spacing: 0; }
.tile-value { font: 700 1.4rem/1.2 var(--font-display); letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile-chip { display: inline-flex; margin-top: 6px; padding: 3px 8px; border-radius: 999px; font: 500 0.7rem/1.3 var(--font-body); background: var(--track); color: var(--text-2); }
.tile-chip.up { background: var(--good-bg); color: var(--good); }
.tile-chip.down { background: var(--bad-bg); color: var(--bad); }
.tile-chip:empty { display: none; }
.tile-spark { height: 32px; margin-top: 8px; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.tile-detail { margin-top: 6px; font-size: 0.7rem; line-height: 1.35; color: var(--text-3); }
.tile-detail:empty { display: none; }

/* ---------- Cards ---------- */

.card { padding: 16px; margin: 0 0 12px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 12px; }
.card-head .muted { margin-top: 3px; }
.card-head-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.card-note { margin: -4px 0 12px; }
.card-sub { margin: 3px 0 0; }
.card-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
.link-button { border: 0; background: none; padding: 4px 0; color: var(--accent); font: 500 0.82rem var(--font-body); cursor: pointer; }

/* Small two-way switches inside cards */
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--track); }
.segmented button {
  border: 0; background: transparent; color: var(--text-2);
  font: 500 0.76rem var(--font-body); padding: 6px 12px; min-height: 32px; border-radius: 999px; cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease); white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: linear-gradient(135deg, #2c4a2e, #3d6340); color: #f0f4eb; font-weight: 600; box-shadow: 0 4px 12px -4px rgb(44 74 46 / 0.6); }
.segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
  .segmented button[aria-pressed="true"] { background: #f0f4eb; color: #1a2e1b; }
}

/* ---------- The period bar (Sales, Products, Busy) ---------- */

.period-sentinel { height: 1px; }
.period-wrap {
  position: sticky; top: 0; z-index: 20;
  margin: -1px -16px 12px; padding: calc(var(--safe-top) + 6px) 16px 10px;
  transition: background 0.25s, box-shadow 0.25s;
}
.period-wrap.stuck {
  -webkit-backdrop-filter: blur(20px) saturate(140%); backdrop-filter: blur(20px) saturate(140%);
  background: linear-gradient(rgb(14 28 16 / 0.88), rgb(22 40 24 / 0.78));
  box-shadow: 0 10px 24px -14px rgb(10 25 12 / 0.6);
}
body[data-tab="today"] .period-wrap, body[data-tab="tools"] .period-wrap,
body[data-tab="today"] .period-sentinel, body[data-tab="tools"] .period-sentinel { display: none; }
.pseg {
  display: flex; gap: 2px; padding: 3px; border-radius: 14px;
  background: rgb(255 255 255 / 0.08); border: 1px solid rgb(255 255 255 / 0.12);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.15);
}
.pseg button {
  flex: 1; min-width: 0; height: 36px; border: 0; border-radius: 11px; padding: 0 4px; cursor: pointer;
  background: none; color: var(--on-brand-2); font: 500 0.8rem var(--font-body); white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.pseg button:hover { color: var(--on-brand); }
.pseg button:focus-visible { outline: 2px solid var(--mint); outline-offset: 1px; }
.pseg .pseg-cal { flex: 0 0 42px; display: grid; place-items: center; border-left: 1px solid rgb(255 255 255 / 0.1); border-radius: 0 11px 11px 0; }
.pseg button[aria-pressed="true"] {
  background: linear-gradient(180deg, #f7faf4, #e3ecdd); color: #1a2e1b; font-weight: 600;
  box-shadow: 0 2px 8px -2px rgb(0 0 0 / 0.35), inset 0 1px 0 #fff;
}
.pseg .pseg-cal[aria-pressed="true"] { border-radius: 11px; border-left-color: transparent; }
.period-label { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; padding: 0 2px; font: 400 0.74rem/1.2 var(--font-body); color: var(--on-brand-3); font-variant-numeric: tabular-nums; }
#period-label { color: var(--on-brand); font-weight: 500; }

/* More periods and any dates, under the calendar button */
.custom-range {
  margin-top: 8px; padding: 12px; border-radius: 16px;
  background: rgb(255 255 255 / 0.08); border: 1px solid rgb(255 255 255 / 0.12);
  animation: rise 0.25s var(--ease);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  min-height: 34px; padding: 0 13px; border-radius: 999px; cursor: pointer;
  background: rgb(255 255 255 / 0.06); border: 1px solid rgb(255 255 255 / 0.16); color: var(--on-brand);
  font: 500 0.8rem var(--font-body);
}
.chips button[aria-pressed="true"] { background: #f0f4eb; color: #1a2e1b; border-color: transparent; font-weight: 600; }
.range-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.range-fields label { display: grid; gap: 4px; color: var(--on-brand-2); font-size: 0.74rem; }
.range-fields .wide { grid-column: 1 / -1; }
.range-fields input, .range-fields select {
  /* 16px or more, or iPhones zoom in when the box is tapped */
  width: 100%; min-width: 0; min-height: 40px; padding: 7px 10px; border-radius: 12px;
  font: 500 16px var(--font-body); color: #1a2e1b; background: rgb(250 252 247 / 0.95); border: 0;
}
.range-fields input:focus-visible, .range-fields select:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }

/* ---------- Headline cards at the top of Sales, Products and Busy ---------- */

.feature { position: relative; overflow: hidden; padding: 18px; margin-bottom: 12px; animation: rise 0.5s var(--ease) both; }
.feature-big { font-size: 2.6rem; margin: 6px 0 12px; }
.feature-big .cur { font-size: 1rem; padding-top: 0.4rem; }
.feature-name { display: block; font-size: 2.1rem; line-height: 1.05; overflow-wrap: anywhere; }
.feature-spark { height: 64px; margin-top: 14px; color: var(--mint); }
.feature-spark .spark-line { stroke: var(--mint); stroke-width: 2.2; }
.feature-spark .spark stop { stop-color: var(--mint); }
.feature-spark .spark-dot { fill: #f0f4eb; stroke: #2c4a2e; }
.feature-stats div:nth-child(3n + 1) { padding-left: 0; border-left: 0; }

/* ---------- Bottom tab bar ---------- */

.tabbar {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 12px);
  width: min(calc(100% - 28px), 460px); height: 66px; padding: 0 6px;
  display: grid; grid-template-columns: repeat(4, 1fr); align-items: center;
  border-radius: 26px;
  background: linear-gradient(155deg, rgb(255 255 255 / 0.82), rgb(255 255 255 / 0.62));
}
@media (prefers-color-scheme: dark) {
  .tabbar { background: linear-gradient(155deg, rgb(40 66 43 / 0.82), rgb(20 36 22 / 0.78)); }
}
.tab {
  height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-radius: 20px; color: var(--text-3); text-decoration: none; font: 500 0.66rem var(--font-body);
  -webkit-tap-highlight-color: transparent; transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] {
  color: #f0f4eb; background: linear-gradient(135deg, #2c4a2e, #3d6340);
  box-shadow: 0 6px 14px -6px rgb(44 74 46 / 0.7), inset 0 1px 0 rgb(255 255 255 / 0.15);
}
.tab[aria-current="page"] svg { stroke-width: 2.3; }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (prefers-color-scheme: dark) {
  .tab[aria-current="page"] { background: #f0f4eb; color: #1a2e1b; }
}

/* ---------- Tools ---------- */

.status-main { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.orb { flex: none; width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #d9dfd3, #8c968a); }
.orb.ok { background: radial-gradient(circle at 35% 35%, #8af59c, #2f9a43); box-shadow: 0 0 0 7px rgb(63 185 80 / 0.15), 0 0 24px rgb(63 185 80 / 0.5); }
.orb.warn { background: radial-gradient(circle at 35% 35%, #ffe08a, #d99a06); box-shadow: 0 0 0 7px rgb(217 154 6 / 0.15), 0 0 24px rgb(217 154 6 / 0.45); }
.orb.idle { background: radial-gradient(circle at 35% 35%, #cfe0cf, #6f8f73); box-shadow: 0 0 0 7px rgb(111 143 115 / 0.15); }
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.status-grid div { padding: 9px 11px; border-radius: 12px; background: rgb(255 255 255 / 0.45); border: 1px solid var(--glass-border); font-size: 0.72rem; color: var(--text-3); min-width: 0; }
.status-grid strong { display: block; font: 600 0.92rem/1.3 var(--font-display); color: var(--text); overflow-wrap: anywhere; }
.status-grid .bad strong { color: var(--bad); }
@media (prefers-color-scheme: dark) { .status-grid div { background: rgb(255 255 255 / 0.04); } }

.list { margin-top: 6px; }
.list-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 2px; border: 0; border-top: 1px solid var(--row-line); background: none; cursor: pointer;
  color: var(--text); font: 500 0.92rem var(--font-body); text-align: left; text-decoration: none; list-style: none;
}
.list > :first-child, .list > :first-child > .list-row { border-top: 0; }
.list-row::-webkit-details-marker { display: none; }
.list-row:disabled { opacity: 0.6; cursor: progress; }
.list-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--soft-tile); color: var(--accent); }
.list-text { flex: 1; min-width: 0; }
.list-text small { display: block; font: 400 0.74rem/1.35 var(--font-body); color: var(--text-3); }
.chev { flex: none; color: var(--text-3); font-size: 1.2rem; transition: transform 0.2s; }
details[open] > .list-row .chev { transform: rotate(90deg); }
.switch { flex: none; position: relative; width: 46px; height: 28px; border-radius: 999px; background: var(--track); transition: background 0.2s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform 0.25s var(--ease); }
.notify-button[aria-pressed="true"] .switch { background: var(--accent); }
.notify-button[aria-pressed="true"] .switch::after { transform: translateX(18px); }
.notify-status { margin: 4px 2px 0; }
.about ul { list-style: none; padding: 0 0 6px 46px; margin: 0; display: grid; gap: 10px; font-size: 0.84rem; }

.recon-box { display: grid; gap: 8px; margin-top: 12px; }
.field {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 14px;
  border: 1px solid var(--glass-border); background: rgb(255 255 255 / 0.6); color: var(--text);
  font: 500 16px var(--font-body);
}
.field:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-button {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 14px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--glass-border); background: rgb(255 255 255 / 0.5); color: var(--text); font: 500 0.88rem var(--font-body); text-align: center;
}
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-button:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.recon-hint { font-size: 0.74rem; }
.primary-button {
  min-height: 46px; padding: 10px 16px; border: 0; border-radius: 14px; cursor: pointer;
  background: linear-gradient(135deg, #2c4a2e, #3d6340); color: #f0f4eb; font: 500 0.92rem var(--font-body);
  box-shadow: 0 6px 16px -6px rgb(44 74 46 / 0.6); transition: transform 0.2s var(--ease);
}
.primary-button:active { transform: scale(0.98); }
.primary-button:disabled { opacity: 0.7; cursor: progress; }
@media (prefers-color-scheme: dark) {
  .field, .file-button { background: rgb(255 255 255 / 0.05); }
  .primary-button { background: #f0f4eb; color: #1a2e1b; }
}
.quiet-button {
  margin-top: 10px; padding: 8px 14px; min-height: 38px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--row-line); background: none; color: var(--text-2); font: 500 0.85rem var(--font-body);
}
.quiet-button:hover { color: var(--text); background: var(--track); }

/* ---------- Ask Claude: spotlight ---------- */

.ask { position: fixed; inset: 0; z-index: 100; }
.ask-dim {
  position: absolute; inset: 0; background: rgb(8 18 10 / 0.5);
  -webkit-backdrop-filter: blur(18px) saturate(120%); backdrop-filter: blur(18px) saturate(120%);
  animation: fade 0.25s ease both;
}
.ask-spot {
  position: relative; max-width: 560px; height: 100%; margin: 0 auto; overflow-y: auto; overscroll-behavior: contain;
  padding: calc(var(--safe-top) + 14px) 14px calc(var(--safe-bottom) + 24px);
}
.ask-row { display: flex; align-items: center; gap: 10px; animation: drop 0.35s var(--ease) both; }
@keyframes drop { from { opacity: 0; transform: translateY(-12px); } }
.ask-field {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 0 8px 0 12px; border-radius: 20px;
  background: var(--glass-solid); box-shadow: 0 18px 40px -16px rgb(0 0 0 / 0.55), 0 0 0 4px rgb(168 224 176 / 0.25);
}
.ask-field .spark-tile { width: 36px; height: 36px; border-radius: 11px; }
.ask-field .spark-tile svg { width: 18px; height: 18px; }
.ask-field input {
  flex: 1; min-width: 0; height: 56px; border: 0; outline: none; background: none; color: var(--text);
  font: 400 16.5px var(--font-body); /* 16px or more, or iPhones zoom in */
}
.ask-field input::placeholder { color: var(--text-3); }
.ask-clear { flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%; cursor: pointer; background: var(--track); color: var(--text-3); font-size: 1rem; line-height: 1; }
.ask-send {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 13px; cursor: pointer;
  background: linear-gradient(135deg, #2c4a2e, #3d6340); color: #f0f4eb;
}
.ask-send:disabled { opacity: 0.55; cursor: progress; }
.ask-cancel { flex: none; border: 0; background: none; padding: 8px 2px; cursor: pointer; color: #e4ede1; font: 500 0.92rem var(--font-body); }
.ask-panel, .ask-card {
  margin-top: 12px; border-radius: 22px; background: var(--glass-solid);
  box-shadow: 0 18px 40px -18px rgb(0 0 0 / 0.5); animation: drop 0.4s var(--ease) 0.05s both;
}
.ask-panel { padding: 8px 14px; }
.ask-lab { font: 600 0.64rem var(--font-display); letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); margin: 8px 0 2px; }
.ask-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 0; border: 0; border-top: 1px solid var(--row-line);
  background: none; cursor: pointer; color: var(--text); font: 400 0.9rem/1.35 var(--font-body); text-align: left;
}
.ask-lab + div > .ask-item:first-child { border-top: 0; }
.ask-item .ask-ic { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--soft-tile); color: var(--accent); }
.ask-item.recent .ask-ic { background: none; color: var(--text-3); }
.ask-ic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ask-card { padding: 16px; }
.ask-q { font-size: 0.78rem; color: var(--text-3); margin-bottom: 8px; }
.ask-who { display: flex; align-items: center; gap: 7px; font: 600 0.72rem var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.ask-who svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.ask-text { font: 400 1rem/1.58 var(--font-body); color: var(--text); margin-top: 9px; white-space: pre-line; overflow-wrap: anywhere; }
.ask-text b { font-weight: 600; color: var(--accent); }
.ask-card.thinking .ask-text { color: var(--text-3); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.45; } }
.ask-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.ask-tiles div { padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--row-line); font-size: 0.7rem; line-height: 1.3; color: var(--text-3); min-width: 0; }
.ask-tiles strong { display: block; font: 700 1.05rem/1.25 var(--font-display); color: var(--text); overflow-wrap: anywhere; }
.ask-tiles div:first-child { background: linear-gradient(135deg, #2c4a2e, #3d6340); color: #c5d6c3; border: 0; }
.ask-tiles div:first-child strong { color: #f0f4eb; }
.ask-actions { display: flex; gap: 8px; margin-top: 14px; }
.ask-follow {
  flex: 1; min-height: 42px; border: 0; border-radius: 13px; cursor: pointer;
  background: linear-gradient(135deg, #2c4a2e, #3d6340); color: #f0f4eb; font: 500 0.88rem var(--font-body);
}
.ask-copy { flex: none; width: 46px; min-height: 42px; display: grid; place-items: center; border-radius: 13px; cursor: pointer; background: var(--surface); border: 1px solid var(--row-line); color: var(--text-2); }
.ask-copy svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ask-foot { font-size: 0.7rem; color: var(--text-3); margin-top: 10px; line-height: 1.4; }
.ask-related { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; animation: drop 0.4s var(--ease) 0.1s both; }
.ask-related button {
  min-height: 34px; padding: 0 13px; border-radius: 999px; cursor: pointer; text-align: left;
  background: rgb(255 255 255 / 0.14); border: 1px solid rgb(255 255 255 / 0.24); color: #f0f4eb; font: 500 0.8rem var(--font-body);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
@media (prefers-color-scheme: dark) {
  .ask-tiles div:first-child, .ask-follow, .ask-send { background: #f0f4eb; color: #4a5f4c; }
  .ask-tiles div:first-child strong, .ask-follow, .ask-send { color: #1a2e1b; }
}
html.ask-open, html.ask-open body { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .ask-row, .ask-panel, .ask-card, .ask-related, .ask-dim, .panel, .headline, .tile, .feature, .hl-recap, .custom-range { animation: none; }
  .ask-card.thinking .ask-text { animation: none; }
  .live-dot { animation: none; }
  .hl-fill { transition: none; }
}

/* ---------- Loading: skeletons, and Claude writing the recap ---------- */

.sk-on .sk, .sk-row .sk {
  color: transparent !important; border-radius: 8px; display: inline-block;
  background: linear-gradient(90deg, var(--track) 0%, rgb(26 46 27 / 0.14) 50%, var(--track) 100%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.sk-on .glass.dark .sk {
  background-image: linear-gradient(90deg, rgb(255 255 255 / 0.08) 0%, rgb(255 255 255 / 0.2) 50%, rgb(255 255 255 / 0.08) 100%);
}
@media (prefers-color-scheme: dark) {
  .sk-on .sk, .sk-row .sk { background-image: linear-gradient(90deg, rgb(255 255 255 / 0.06) 0%, rgb(255 255 255 / 0.15) 50%, rgb(255 255 255 / 0.06) 100%); }
}
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-on .hl-num .cur { display: none; }
.sk-on .hl-num .sk { line-height: 0.95; }
.sk-on .tile-spark, .sk-on .feature-spark, .sk-on .plot { border-radius: 12px; background: linear-gradient(90deg, var(--track) 0%, rgb(26 46 27 / 0.12) 50%, var(--track) 100%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
.sk-on .feature-spark { background-image: linear-gradient(90deg, rgb(255 255 255 / 0.06) 0%, rgb(255 255 255 / 0.16) 50%, rgb(255 255 255 / 0.06) 100%); }
.sk-on .plot { min-height: 200px; }
.sk-on .tile-chip:empty { display: inline-flex; width: 64px; height: 20px; }
.sk-row { display: grid; gap: 8px; padding: 6px 0 10px; }
.sk-row .sk-line { width: var(--w, 70%); height: 14px; }
.sk-row .sk-bar { width: 100%; height: 8px; border-radius: 999px; }

/* Claude writing: a glowing sparkle, and shimmering lines in mint and gold */
.ai-writing { display: grid; gap: 9px; }
.ai-writing-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font: 500 0.82rem var(--font-body); color: var(--mint); }
.ai-orb {
  position: relative; flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #a8e0b0, #e9d39b); color: #1a2e1b;
  animation: orb 2.4s ease-in-out infinite;
}
.ai-orb::before {
  content: ""; position: absolute; inset: -4px; border-radius: 13px; z-index: -1;
  background: conic-gradient(from var(--ask-angle, 0deg), #8af59c, #e9d39b, #67a571, #8af59c);
  filter: blur(6px); opacity: 0.8; animation: orb-turn 2.4s linear infinite;
}
.ai-orb svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; animation: twinkle 2.4s ease-in-out infinite; }
@property --ask-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes orb-turn { to { --ask-angle: 360deg; } }
@keyframes orb { 50% { transform: scale(1.06); box-shadow: 0 0 22px rgb(138 245 156 / 0.55); } }
@keyframes twinkle { 50% { transform: rotate(18deg) scale(0.9); } }
.dots i { font-style: normal; animation: dot 1.4s infinite; opacity: 0.2; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot { 30% { opacity: 1; } }
.ai-line {
  display: block; width: var(--w); height: 12px; border-radius: 999px;
  background: linear-gradient(90deg, rgb(168 224 176 / 0.12), rgb(168 224 176 / 0.55), rgb(233 211 155 / 0.5), rgb(168 224 176 / 0.12)) 0 0 / 250% 100%;
  animation: ai-flow 1.8s ease-in-out infinite;
}
.ai-line:nth-of-type(2) { animation-delay: 0.15s; }
.ai-line:nth-of-type(3) { animation-delay: 0.3s; }
@keyframes ai-flow { from { background-position: 100% 0; } to { background-position: -150% 0; } }
/* ...then the recap's words drift in */
.day-summary-text .word { display: inline-block; animation: word-in 0.5s var(--ease) both; animation-delay: calc(var(--i) * 35ms); }
@keyframes word-in { from { opacity: 0; filter: blur(6px); transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) {
  .sk-on .sk, .sk-row .sk, .sk-on .plot, .sk-on .tile-spark, .sk-on .feature-spark, .ai-line, .ai-orb, .ai-orb::before, .ai-orb svg, .dots i, .day-summary-text .word { animation: none; }
  .dots i { opacity: 1; }
}

/* ---------- Product search ---------- */

.product-search {
  width: 100%; margin-bottom: 12px; padding: 10px 16px; min-height: 46px;
  border: 1px solid var(--glass-border); border-radius: 14px;
  /* 16px or more, or iPhones zoom in when the box is tapped */
  background: rgb(255 255 255 / 0.6); color: var(--text); font: 400 16px var(--font-body);
}
@media (prefers-color-scheme: dark) { .product-search { background: rgb(255 255 255 / 0.05); } }
.product-search:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.product-suggestions {
  list-style: none; margin: -6px 0 12px; padding: 4px;
  border: 1px solid var(--glass-border); border-radius: 16px; background: var(--glass-solid);
}
.product-suggestions li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 48px; padding: 8px 12px; border-radius: 12px; cursor: pointer;
}
.product-suggestions li[aria-selected="true"], .product-suggestions li:hover { background: var(--track); }
.product-suggestions .suggestion-name { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.product-suggestions .suggestion-detail { color: var(--text-3); font-size: 0.75rem; text-align: right; white-space: nowrap; }
.product-suggestions .suggestion-empty { color: var(--text-3); cursor: default; }
.product-suggestions .suggestion-empty:hover { background: none; }
/* Chosen products, in their chart colours */
.product-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 12px; padding: 0; }
.product-chips li {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--track); font-size: 0.85rem; font-weight: 500;
}
.product-chips .chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-chips .legend-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.product-chips button {
  flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: none; color: var(--text-2); font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.product-chips button:hover { background: var(--surface); color: var(--text); }
.product-chips button:focus-visible { outline: 2px solid var(--accent); }
.product-chips .chip-total { padding-right: 12px; background: none; border: 1px dashed var(--border); color: var(--text-2); }
.product-chips .total-key { width: 16px; border-top: 2px dashed var(--text-2); }

/* Products that didn't sell */
.sub-head { font-size: 0.95rem; margin: 22px 0 4px; }
.unsold-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.unsold-list li > * {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: calc(100% + 20px);
  padding: 8px 10px; margin: 0 -10px; border-radius: 10px; font: inherit; color: inherit; text-align: left;
  background: none; border: 0;
}
.unsold-list button { cursor: pointer; }
.unsold-list button:hover { background: var(--track); }
.unsold-list button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.unsold-name { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.unsold-detail { color: var(--text-3); font-size: 0.75rem; white-space: nowrap; }

/* ---------- Charts ---------- */

.plot { position: relative; width: 100%; }
.plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.bar { fill: var(--accent); transition: opacity 0.2s; }
.bar-partial { fill: var(--accent-soft); }
.bars.has-active .bar:not(.active) { opacity: 0.45; }
.trend-line { fill: none; stroke: var(--line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-glow { fill: none; stroke: var(--surface); stroke-width: 6; stroke-linecap: round; opacity: 0.9; }
.series-line { fill: none; stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; }
.series-dot { stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.series-dot.series-1 { fill: var(--series-1); } .series-dot.series-2 { fill: var(--series-2); }
.series-dot.series-3 { fill: var(--series-3); } .series-dot.series-4 { fill: var(--series-4); }
.series-dot.series-5 { fill: var(--series-5); }
.series-line.series-total { stroke: var(--text-2); stroke-dasharray: 5 4; }
.series-dot.series-total { fill: var(--text-2); }
line.gridline { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 2 4; }
line.baseline { stroke: var(--border); stroke-width: 1; }
.tick { fill: var(--text-3); font: 11px var(--font-body); font-variant-numeric: tabular-nums; }
.hit { fill: transparent; cursor: pointer; outline: none; }
.hover-line { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }

.tooltip {
  position: absolute; pointer-events: none; z-index: 3;
  background: var(--text); color: var(--surface);
  padding: 8px 12px; border-radius: 12px;
  font-size: 0.78rem; white-space: nowrap;
  box-shadow: 0 10px 30px -10px rgb(0 0 0 / 0.45);
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s var(--ease);
}
.tooltip.visible { opacity: 1; transform: none; }
.tooltip-value { font: 700 1rem var(--font-display); }
.tooltip-label { opacity: 0.8; }

.legend { list-style: none; display: flex; gap: 14px; margin: 0; padding: 0; font-size: 0.78rem; color: var(--text-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.key { display: inline-block; }
.key-bar { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.key-line { width: 16px; height: 2px; background: var(--line); border-radius: 1px; }
.chart-key { margin: 4px 0 12px; }
.chart-note { margin-top: 10px; font-size: 0.85rem; color: var(--text-2); }

/* Entrance animations (only when .animate is set, and never with reduced motion) */
.animate .bar { transform-box: fill-box; transform-origin: bottom; animation: grow 0.8s var(--ease) both; animation-delay: var(--delay, 0ms); }
@keyframes grow { from { transform: scaleY(0); } }
.animate .trend-line, .animate .trend-glow, .animate .spark-line, .animate .series-line {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: draw 1.2s var(--ease) 0.35s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.animate .spark-area { animation: fade 0.8s ease 0.6s both; }
.animate .spark-dot { animation: pop 0.4s var(--ease) 1.3s both; transform-box: fill-box; transform-origin: center; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0); } }
.animate .ring-arc { stroke-dasharray: 0 999; animation: ring 1.2s var(--ease) 0.3s forwards; }
@keyframes ring { to { stroke-dasharray: var(--len) 999; } }
.animate .donut-seg { animation: ring 0.9s var(--ease) both; animation-delay: var(--delay, 0ms); }
.animate .bar-fill { transform-origin: left; animation: fill 0.9s var(--ease) both; animation-delay: var(--delay, 0ms); }
@keyframes fill { from { transform: scaleX(0); } }
.animate .bar-list li { animation: fade 0.5s ease both; animation-delay: var(--delay, 0ms); }

@media (prefers-reduced-motion: reduce) {
  .kpi { animation: none; opacity: 1; transform: none; }
  .live-dot { animation: none; }
}

/* Ranked bar lists */
.bar-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.bar-list li { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.bar-list-body { flex: 1; min-width: 0; }
.bar-list-row {
  display: flex; gap: 12px; align-items: flex-start; flex: 1; min-width: 0;
  margin: -6px -8px; padding: 6px 8px; border: 0; border-radius: 12px;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background 0.2s var(--ease);
}
.bar-list-row:hover { background: var(--track); }
.bar-list-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rank {
  flex: none; display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 9px;
  background: var(--track); color: var(--text-2);
  font: 700 0.78rem var(--font-display);
}
.ranked li:first-child .rank { background: var(--pill); color: var(--on-pill); }
/* Products that didn't sell */
.sub-head { font-size: 0.95rem; margin: 22px 0 4px; }
.unsold-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.unsold-list li > * {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: calc(100% + 20px);
  padding: 8px 10px; margin: 0 -10px; border-radius: 10px; font: inherit; color: inherit; text-align: left;
  background: none; border: 0;
}
.unsold-list button { cursor: pointer; }
.unsold-list button:hover { background: var(--track); }
.unsold-list button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.unsold-name { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.unsold-detail { color: var(--text-3); font-size: 0.75rem; white-space: nowrap; }
.quiet-button {
  margin-top: 10px; padding: 8px 14px; min-height: 38px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: none; color: var(--text-2); font: 500 0.85rem var(--font-body);
}
.quiet-button:hover { color: var(--text); background: var(--track); }

.bar-list-head { display: flex; justify-content: space-between; gap: 10px; font-size: 0.88rem; margin-bottom: 6px; }
.bar-list-label { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.bar-list-value { font: 700 0.9rem var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-list-sub { color: var(--text-3); font-size: 0.75rem; margin-top: 4px; }
.bar-track { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); }

/* Donut */
.donut { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: center; }
.donut-figure { position: relative; width: 180px; aspect-ratio: 1; }
.donut-figure svg { width: 100%; height: 100%; }
.donut-track { fill: none; stroke: var(--track); }
.donut-seg { fill: none; stroke-linecap: butt; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center strong { font-size: 1.15rem; letter-spacing: -0.02em; }
.donut-center span { font-size: 0.72rem; color: var(--text-3); }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.donut-legend li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; font-size: 0.86rem; }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; }
.legend-share { color: var(--text-3); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.legend-value { font: 700 0.88rem var(--font-display); font-variant-numeric: tabular-nums; }
.series-1 { stroke: var(--series-1); background: var(--series-1); }
.series-2 { stroke: var(--series-2); background: var(--series-2); }
.series-3 { stroke: var(--series-3); background: var(--series-3); }
.series-4 { stroke: var(--series-4); background: var(--series-4); }
.series-5 { stroke: var(--series-5); background: var(--series-5); }

/* Missing data, about, tables */
.missing ul { margin: 10px 0; padding-left: 20px; font-size: 0.88rem; }
.missing li { margin: 3px 0; }
.missing li::marker { color: var(--accent); }
.file-used { color: var(--good); font-size: 0.78rem; font-weight: 600; }
.file-skipped { color: var(--text-3); font-size: 0.78rem; }

details { margin-top: 12px; font-size: 0.85rem; }
summary { cursor: pointer; color: var(--text-2); }
table { width: 100%; border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--text-2); font-weight: 600; }

/* ---------- Upload page ---------- */

.hero.compact { padding-bottom: 24px; }
.hero.compact a { color: var(--on-brand-2); font-size: 0.85rem; }
.step { margin-top: 8px; }
.step-list { margin: 10px 0; padding-left: 20px; font-size: 0.9rem; }
.step-list li::marker { color: var(--accent); }
.file-picker { display: block; }
.file-picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-picker span {
  display: grid; place-items: center; gap: 6px;
  margin-top: 14px; padding: 28px 16px;
  border: 2px dashed var(--border); border-radius: 16px;
  color: var(--text-2); font-weight: 500; cursor: pointer; text-align: center;
  transition: border-color 0.2s, background 0.2s;
}
.file-picker span:hover { border-color: var(--accent); background: var(--surface-2); }
.file-picker input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary {
  margin-top: 14px; padding: 12px 22px; border: 0; border-radius: 999px;
  font: 600 0.95rem var(--font-body); background: var(--pill); color: var(--on-pill); cursor: pointer;
  transition: transform 0.2s var(--ease);
}
button.primary:hover:not(:disabled) { transform: translateY(-1px); }
button.primary:disabled { opacity: 0.5; cursor: default; }
.file-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; font-size: 0.88rem; }


/* Pages without the backdrop (the upload page) */
body:not(.dash) { background: var(--bg); }
/* Cards on pages without the glass (the upload page) */
.card:not(.glass) { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px; margin: 14px 0; box-shadow: 0 1px 2px rgb(26 46 27 / 0.04), 0 8px 24px -12px rgb(26 46 27 / 0.12); }
.hero { background: linear-gradient(180deg, #0b170d, #1d3520); color: var(--on-brand); border-radius: 0 0 24px 24px; padding: calc(var(--safe-top) + 20px) 0 28px; margin-bottom: 20px; }
.hero-inner { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---------- Wider screens ---------- */

@media (min-width: 760px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .card-grid > #category-card { grid-column: 1 / -1; }
  #panel-today { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 12px; align-items: start; }
  #panel-today[hidden] { display: none; }
  #panel-today > .notify-nudge { grid-column: 1 / -1; }
  #panel-today > .headline { grid-column: 1; grid-row: 1; }
  #panel-today > .duo { grid-column: 2; grid-row: 1; grid-template-columns: minmax(0, 1fr); align-self: stretch; margin-bottom: 12px; }
  #panel-today:has(> .notify-nudge:not([hidden])) > .headline, #panel-today:has(> .notify-nudge:not([hidden])) > .duo { grid-row: 2; }
  .hl-num { font-size: 4.2rem; }
  .tab-title h1 { font-size: 2.1rem; }
}
@media (max-width: 380px) {
  .hl-num { font-size: 3.1rem; }
  .pseg button { font-size: 0.74rem; }
  .feature-big { font-size: 2.2rem; }
  .feature-name { font-size: 1.8rem; }
}
@media (max-width: 759px) {
  .donut { grid-template-columns: 1fr; justify-items: center; }
  .donut-legend { width: 100%; }
}
#product-card { scroll-margin-top: 110px; } /* clear of the sticky period bar */
.list-details { margin-top: 0; }
