/* Etsy Studio — one stylesheet, no build step, no CDN. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --ink: #141922;
  --ink-2: #5a6472;
  --ink-3: #8a93a1;

  --accent: #5b4df0;
  --accent-ink: #ffffff;
  --accent-soft: #eeecfe;

  --gold: #b8860b;
  --gold-soft: #fdf4dc;
  --green: #0f7a52;
  --green-soft: #e3f5ec;
  --amber: #9a6207;
  --amber-soft: #fdf1dc;
  --red: #b3261e;
  --red-soft: #fdeceb;
  --blue: #1f5fa8;
  --blue-soft: #e8f1fc;

  /* Chart series. Validated: light ΔE 30.2 normal / 25.3 deutan on #fff. */
  --chart-1: #5b4df0;
  --chart-2: #0f7a52;
  --chart-grid: #eceef2;
  --badge-ink: #ffffff;
  --green-ink: #ffffff;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.04);
  --shadow-lg: 0 8px 24px rgba(16,24,40,.10);
  --sidebar-w: 236px;
}

/* Light is the default. Dark follows the system unless the toggle overrides. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116;
    --surface: #161a21;
    --surface-2: #1b2029;
    --line: #262c36;
    --line-strong: #353d4a;
    --ink: #e8ebf0;
    --ink-2: #a2abb9;
    --ink-3: #8b95a3;
    --accent: #8b7bff;
    --accent-ink: #11131a;
    --accent-soft: #241f45;
    --gold: #e3b341;  --gold-soft: #332a12;
    --green: #4ac58d; --green-soft: #10291f;
    --amber: #e0a33c; --amber-soft: #31250f;
    --red: #f77a72;   --red-soft: #341b19;
    --blue: #74aef0;  --blue-soft: #132333;
    /* Dark steps are chosen, not flipped: #36ad75 sits in the dark
       lightness band where the light green does not. */
    --chart-1: #8b7bff;
    --chart-2: #36ad75;
    --chart-grid: #222833;
    --badge-ink: #2a0f0d;
    --green-ink: #09231a;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
    --bg: #0e1116;
    --surface: #161a21;
    --surface-2: #1b2029;
    --line: #262c36;
    --line-strong: #353d4a;
    --ink: #e8ebf0;
    --ink-2: #a2abb9;
    --ink-3: #8b95a3;
    --accent: #8b7bff;
    --accent-ink: #11131a;
    --accent-soft: #241f45;
    --gold: #e3b341;  --gold-soft: #332a12;
    --green: #4ac58d; --green-soft: #10291f;
    --amber: #e0a33c; --amber-soft: #31250f;
    --red: #f77a72;   --red-soft: #341b19;
    --blue: #74aef0;  --blue-soft: #132333;
    --chart-1: #8b7bff;
    --chart-2: #36ad75;
    --chart-grid: #222833;
    --badge-ink: #2a0f0d;
    --green-ink: #09231a;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.15rem; }
h2 { font-size: 1.02rem; }
h3 { font-size: .92rem; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px; gap: 18px; z-index: 40;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px; }
.brand-mark {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 13px;
}
.brand strong { display: block; font-size: .93rem; line-height: 1.2; }
.brand small { display: block; color: var(--ink-3); font-size: .72rem; line-height: 1.3; }

.sidebar nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: .88rem; font-weight: 500;
}
.sidebar nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.badge {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px;
  background: var(--red); color: var(--badge-ink); font-size: .68rem; font-weight: 700;
  display: grid; place-items: center;
}

.sidebar-foot { margin-top: auto; padding: 0 8px; display: flex; flex-direction: column; gap: 6px; }
.who { display: flex; align-items: center; gap: 7px; font-size: .84rem; color: var(--ink-2); }
.dot { width: 8px; height: 8px; border-radius: 99px; flex: 0 0 8px; }
.quiet { color: var(--ink-3); font-size: .78rem; }

/* ---------- Topbar + main ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  margin-left: var(--sidebar-w);
  display: flex; align-items: center; gap: 12px;
  padding: 9px 18px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar h1 { flex: 1; }
.navbtn { display: none; font-size: 1.3rem; cursor: pointer; padding: 0 6px; color: var(--ink-2); }

main.main { margin-left: var(--sidebar-w); padding: 16px 18px; max-width: 1420px; }
main.main-bare {
  /* A column, not a grid: a flash message belongs directly above the card,
     not centred in a row of its own. */
  min-height: 100vh; padding: 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
main.main-bare > .flash { width: 100%; max-width: 360px; margin: 0; text-align: center; }

#navtoggle { display: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .18s ease; box-shadow: var(--shadow-lg); visibility: hidden; }
  #navtoggle:checked ~ .sidebar { visibility: visible; }
  #navtoggle:checked ~ .sidebar { transform: none; }
  .topbar, main.main { margin-left: 0; }
  .navbtn { display: block; }
  main.main { padding: 12px; }
  .topbar { padding: 10px 14px; }
  .topbar h1 { font-size: 1rem; }
}

/* ---------- Cards, grids ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card + .card { margin-top: 12px; }
.card-head {
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
}
.card-head h2, .card-head h3 { flex: 1; }
.card-body { padding: 14px; }
.card-body.tight { padding: 8px 14px; }

.grid { display: grid; gap: 12px; }
/* Grid items default to min-width:auto, which lets long labels push the track
   wider than its minmax floor and drop a column. This lets them shrink. */
.grid > *, .lanes > *, .split > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.split { display: grid; gap: 12px; grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

/* ---------- Stats ---------- */
.stat { padding: 14px 16px; }
.stat .n { font-size: 1.7rem; font-weight: 680; letter-spacing: -0.02em; line-height: 1.1; }
.stat .k { color: var(--ink-3); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin-top: 3px; }
.stat .sub { color: var(--ink-2); font-size: .8rem; margin-top: 5px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
/* Narrow screens scroll the table sideways rather than crushing every column. */
.table-wrap table { min-width: 640px; }
/* The research board has many columns; give it room and let the wrap scroll. */
.table-wrap table.table-board { min-width: 1040px; }
.col-keyword { min-width: 230px; }
th {
  text-align: left; padding: 7px 11px; color: var(--ink-3);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 650;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2);
}
td { padding: 7px 11px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }

.phrase { font-weight: 560; color: var(--ink); }
.phrase:hover { color: var(--accent); }
.sub { color: var(--ink-3); font-size: .78rem; }

/* ---------- Score + tiers ---------- */
.score {
  display: inline-grid; place-items: center; min-width: 38px; height: 26px; padding: 0 7px;
  border-radius: 7px; font-weight: 700; font-size: .82rem; font-variant-numeric: tabular-nums;
}
.tier-Goldmine { background: var(--gold-soft); color: var(--gold); }
.tier-Strong   { background: var(--green-soft); color: var(--green); }
.tier-Moderate { background: var(--blue-soft); color: var(--blue); }
.tier-Weak     { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  border-radius: 99px; font-size: .73rem; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.chip-gold   { background: var(--gold-soft);  color: var(--gold);  border-color: transparent; }
.chip-green  { background: var(--green-soft); color: var(--green); border-color: transparent; }
.chip-amber  { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.chip-red    { background: var(--red-soft);   color: var(--red);   border-color: transparent; }
.chip-blue   { background: var(--blue-soft);  color: var(--blue);  border-color: transparent; }
.chip-accent { background: var(--accent-soft);color: var(--accent);border-color: transparent; }

/* ---------- Buttons + forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-size: .85rem; font-weight: 560;
  cursor: pointer; font-family: inherit; white-space: nowrap; line-height: 1.3;
}
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: var(--ink-3); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); filter: brightness(1.08); color: var(--accent-ink); }
.btn-green { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.btn-green:hover {
  background: var(--green); border-color: var(--green);
  color: var(--green-ink); filter: brightness(1.08);
}
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); background: var(--surface); }
.btn-danger:hover { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); color: var(--red); }
.btn-sm { padding: 4px 9px; font-size: .78rem; }
.btn-link { border: 0; background: none; color: var(--ink-3); padding: 2px 4px; font-size: .78rem; }
.btn-link:hover { color: var(--red); background: none; text-decoration: underline; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label.field { display: block; margin-bottom: 10px; }
label.field > span {
  display: block; font-size: .78rem; font-weight: 620; color: var(--ink-2); margin-bottom: 4px;
}
label.field .hint { font-weight: 400; color: var(--ink-3); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=date], select, textarea {
  width: 100%; padding: 8px 11px; font: inherit; font-size: .88rem;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -1px;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 78px; line-height: 1.5; }
textarea.paste { min-height: 230px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
select.inline, input.inline { padding: 4px 7px; font-size: .8rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 150px; min-width: 0; }
.row > .shrink { flex: 0 0 auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
fieldset { border: 0; padding: 0; margin: 0; }

/* ---------- Flash ---------- */
.flash {
  padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px;
  font-size: .88rem; font-weight: 520; border: 1px solid transparent;
}
.flash-ok    { background: var(--green-soft); color: var(--green); }
.flash-warn  { background: var(--amber-soft); color: var(--amber); }
.flash-error { background: var(--red-soft);   color: var(--red); }

/* ---------- Alerts / opportunities ---------- */
.alert {
  display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); align-items: flex-start;
}
.alert:last-child { border-bottom: 0; }
.alert .mark {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 7px; display: grid; place-items: center;
  font-weight: 800; font-size: .78rem; background: var(--surface-2); color: var(--ink-3);
}
.alert.high .mark { background: var(--red-soft); color: var(--red); }
.alert.med  .mark { background: var(--amber-soft); color: var(--amber); }
.alert.low  .mark { background: var(--blue-soft); color: var(--blue); }
.alert .body { flex: 1; min-width: 0; }
.alert .body strong { display: block; font-weight: 600; font-size: .89rem; }
.alert .body p { margin: 2px 0 0; color: var(--ink-2); font-size: .82rem; }

/* ---------- Misc ---------- */
.empty { padding: 24px 18px; text-align: center; color: var(--ink-3); font-size: .86rem; }
.empty strong { display: block; color: var(--ink-2); margin-bottom: 4px; font-size: .95rem; }
.meter { height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); }
.sep { height: 1px; background: var(--line); margin: 11px 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.toolbar label.field { margin: 0; }
.muted { color: var(--ink-3); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.break { overflow-wrap: anywhere; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
details.box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 13px; background: var(--surface-2); }
details.box summary { cursor: pointer; font-weight: 600; font-size: .86rem; }
details.box[open] summary { margin-bottom: 10px; }

/* Login */
.login { width: 100%; max-width: 360px; }
.login .brand { justify-content: center; margin-bottom: 18px; padding: 0; }

/* Kanban-ish columns on Working */
.lanes { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); align-items: start; }
.lane-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.lane-head h3 { flex: 1; }
.pcard { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.pcard:last-child { border-bottom: 0; }
.pcard .t { font-weight: 600; font-size: .9rem; }
.pcard .m { color: var(--ink-3); font-size: .78rem; margin-top: 3px; }
.warn-list { color: var(--amber); font-size: .78rem; margin-top: 6px; }

/* Preview table */
.preview-row.dupe { background: var(--amber-soft); }
.linkbar { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Theme toggle ---------- */
.theme-btn { padding: 5px 9px; font-size: .95rem; line-height: 1; }

/* ---------- Sidebar extras ---------- */
.nav-sep { height: 1px; background: var(--line); margin: 10px 6px; }
.sidebar nav a.small { font-size: .82rem; padding: 6px 10px; color: var(--ink-3); }
.sidebar nav a.small:hover { color: var(--ink-2); }

/* ---------- Verdicts ---------- */
.verdict {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 99px; font-size: .78rem; font-weight: 700; white-space: nowrap;
}
.v-make    { background: var(--green-soft); color: var(--green); }
.v-look    { background: var(--blue-soft);  color: var(--blue); }
.v-crowded { background: var(--amber-soft); color: var(--amber); }
.v-skip    { background: var(--surface-2);  color: var(--ink-3); border: 1px solid var(--line); }

/* ---------- The decide card ---------- */
.decide { max-width: 640px; margin: 0 auto; }
.decide .phrase-big {
  font-size: 1.7rem; font-weight: 680; letter-spacing: -0.02em;
  line-height: 1.2; margin: 0 0 6px; overflow-wrap: anywhere;
}
.decide .numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-radius: var(--radius-sm); overflow: hidden; margin: 18px 0; }
.decide .numbers > div { background: var(--surface); padding: 14px 12px; text-align: center; }
.decide .numbers .n { font-size: 1.3rem; font-weight: 680; font-variant-numeric: tabular-nums; }
.decide .numbers .k { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 650; margin-top: 3px; }
.decide .big-score { font-size: 3rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.decide .why { color: var(--ink-2); font-size: .92rem; margin: 8px 0 0; }
.decide-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.decide-actions .btn { padding: 13px; font-size: .95rem; font-weight: 620; }
.progress-line { height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; margin-bottom: 18px; }
.progress-line > i { display: block; height: 100%; background: var(--accent); }

/* ---------- Step chips ---------- */
.steps { display: flex; gap: 5px; flex-wrap: wrap; }
.step {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 99px; font-size: .74rem; font-weight: 600; cursor: pointer;
  background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line);
  font-family: inherit;
}
.step:hover { border-color: var(--ink-3); }
.step.done    { background: var(--green-soft); color: var(--green); border-color: transparent; }
.step.partial { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.step[disabled] { cursor: default; opacity: .9; }
.step form { display: contents; }

/* ---------- Product rows ---------- */
.prow { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.prow:last-child { border-bottom: 0; }
.prow .pmain { flex: 1 1 280px; min-width: 0; }
.prow .t { font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }
.prow .m { color: var(--ink-3); font-size: .78rem; margin-top: 3px; }
.ring { font-variant-numeric: tabular-nums; font-size: .78rem; font-weight: 650; color: var(--ink-2); white-space: nowrap; }

/* ---------- Month plan ---------- */
.plan-box { white-space: pre-wrap; font-size: .87rem; line-height: 1.65; color: var(--ink-2); }

/* ---------- Charts ---------- */
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: .78rem; color: var(--ink-2); }
.legend b { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.bars { display: flex; align-items: flex-end; gap: 9px; height: 150px; padding-top: 18px; }
.bars .col { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 0; }
.bars .stack { display: flex; flex-direction: column-reverse; gap: 2px; justify-content: flex-start; position: relative; }
.bars .seg { width: 100%; min-height: 3px; cursor: default; transition: filter .12s ease; }
.bars .seg:hover { filter: brightness(1.12); }
.bars .stack > .seg:last-child { border-radius: 4px 4px 0 0; }
.bars .total {
  position: absolute; left: 0; right: 0; top: -18px; text-align: center;
  font-size: .72rem; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.bars .xlab { text-align: center; font-size: .68rem; color: var(--ink-3); margin-top: 7px; white-space: nowrap; }
.bars-base { height: 1px; background: var(--line-strong); }

#charttip {
  position: fixed; z-index: 90; pointer-events: none; opacity: 0;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 8px 11px; font-size: .78rem; color: var(--ink);
  transition: opacity .1s ease; max-width: 220px;
}
#charttip .tt-h { font-weight: 650; margin-bottom: 4px; }
#charttip .tt-r { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }

/* ---------- Donut ---------- */
.donut { display: flex; align-items: center; gap: 16px; }
.donut svg { flex: 0 0 auto; transform: rotate(-90deg); }
.donut .ring-bg { stroke: var(--line); }
.donut .ring-fg { stroke: var(--chart-1); stroke-linecap: round; transition: stroke-dasharray .4s ease; }
.donut .mid { font-size: 1.5rem; font-weight: 680; letter-spacing: -0.02em; }

/* ---------- Month calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.cal .dow { background: var(--surface-2); padding: 7px 8px; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 650; color: var(--ink-3); text-align: center; }
.cal .day { background: var(--surface); min-height: 84px; padding: 5px 6px; display: flex; flex-direction: column; gap: 3px; }
.cal .day.out { background: var(--surface-2); }
.cal .day.today { background: var(--accent-soft); }
.cal .dnum { font-size: .74rem; font-weight: 650; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cal .day.today .dnum { color: var(--accent); }
.cal .ev {
  display: block; font-size: .68rem; line-height: 1.3; padding: 2px 5px; border-radius: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550;
}
.cal .ev-pub   { background: var(--green-soft); color: var(--green); }
.cal .ev-new   { background: var(--accent-soft); color: var(--accent); }
.cal .ev-kw    { background: var(--blue-soft); color: var(--blue); }
.cal .ev-sea   { background: var(--gold-soft); color: var(--gold); font-weight: 650; }
.cal .more { font-size: .66rem; color: var(--ink-3); padding-left: 5px; }
@media (max-width: 760px) {
  .cal .day { min-height: 62px; padding: 4px; }
  .cal .ev { font-size: .62rem; padding: 1px 3px; }
}

/* ---------- Month strip ---------- */
.mstrip { display: flex; gap: 8px; flex-wrap: wrap; }
.mstrip a {
  padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line-strong);
  font-size: .8rem; font-weight: 560; color: var(--ink-2);
}
.mstrip a:hover { border-color: var(--ink-3); text-decoration: none; color: var(--ink); }
.mstrip a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Shop meter rows ---------- */
.shoprow { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.shoprow:last-child { border-bottom: 0; }
.shoprow .nm { flex: 0 0 92px; font-weight: 600; font-size: .86rem; display: flex; align-items: center; gap: 7px; }
.shoprow .track { flex: 1; height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.shoprow .track > i { display: block; height: 100%; border-radius: 99px; }
.shoprow .val { flex: 0 0 auto; font-size: .78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- Shop switcher ---------- */
.shopswitch { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 2px; }
.shopswitch a {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px;
  font-size: .78rem; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.shopswitch a:hover { color: var(--ink); text-decoration: none; }
.shopswitch a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
@media (max-width: 760px) { .shopswitch a { padding: 4px 8px; font-size: .72rem; } .shopswitch .dot { display: none; } }

/* ---------- Sheet-style status buttons ---------- */
.mark {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-width: 92px; padding: 5px 10px; border-radius: 7px; border: 1px solid transparent;
  font-size: .76rem; font-weight: 650; font-family: inherit; cursor: pointer; line-height: 1.3;
  white-space: nowrap; transition: transform .08s ease, filter .12s ease;
}
.mark:hover { filter: brightness(.96); transform: translateY(-1px); }
.mark:active { transform: none; }
.mark-todo  { background: var(--surface-2); color: var(--ink-3); border-color: var(--line-strong); }
.mark-go    { background: var(--green-soft); color: var(--green); }
.mark-wip   { background: var(--amber-soft); color: var(--amber); }
.mark-draft { background: var(--blue-soft);  color: var(--blue); }
.mark-off   { background: var(--red-soft);   color: var(--red); }

.linkcell {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 56px; padding: 5px 9px; border-radius: 7px; font-size: .74rem; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
}
.linkcell:hover { text-decoration: none; filter: brightness(.96); }
.linkcell.missing { background: var(--surface-2); color: var(--ink-3); border: 1px dashed var(--line-strong); }

table.sheet th { position: sticky; top: 0; z-index: 2; }
table.sheet td { padding: 6px 10px; }
table.sheet .pname { font-weight: 600; font-size: .86rem; display: block; overflow-wrap: anywhere; }
table.sheet tbody tr:hover { background: var(--surface-2); }
table.sheet form { display: inline; }

/* ---------- Season strip, front and centre ---------- */
.seasons { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.season-card {
  border-radius: var(--radius); padding: 10px 13px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.season-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--ink-3); }
.season-card.go::before   { background: var(--green); }
.season-card.late::before { background: var(--red); }
.season-card .nm { font-weight: 650; font-size: .92rem; margin-bottom: 3px; }
.season-card .dd { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.season-card .dl { font-size: .74rem; color: var(--ink-3); }
.season-card .tag { margin-top: 8px; display: inline-block; }

/* ---------- Status picker: a small menu, never a blind cycle ---------- */
.pick { position: relative; display: inline-block; }
.pick > summary { list-style: none; cursor: pointer; }
.pick > summary::-webkit-details-marker { display: none; }
.pick > summary::marker { content: ""; }
.pick .menu {
  /* Fixed, not absolute: the table wrapper scrolls horizontally and would
     otherwise clip the menu. JavaScript places it; this is the fallback. */
  position: fixed; z-index: 90; min-width: 160px;
  top: 0; left: 0;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 4px; display: flex; flex-direction: column; gap: 2px;
}
/* A closed <details> must not lay out at all. Browsers keep its contents in
   the box tree, and a wide form or menu inside one drags the whole page
   sideways on a phone even though nothing is visible. */
details:not([open]) > *:not(summary) { display: none; }

.pick .menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 7px 9px; border: 0; border-radius: 5px; background: none; cursor: pointer;
  font: inherit; font-size: .8rem; font-weight: 550; color: var(--ink);
}
.pick .menu button:hover { background: var(--surface-2); }
.pick .menu button.current { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.pick .menu .pipdot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }
.mark .caret { opacity: .55; font-size: .62rem; margin-left: 1px; }

/* ---------- The six steps, each with its own field ---------- */
.steplist { display: flex; flex-direction: column; }
.steprow {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
}
.steprow:last-child { border-bottom: 0; }
.stepno {
  flex: 0 0 26px; width: 26px; height: 26px; border-radius: 99px;
  background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: .78rem; font-weight: 700;
}
.stepbody { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.steplabel { font-weight: 620; font-size: .9rem; color: var(--ink); }
.stephint { font-size: .79rem; color: var(--ink-3); line-height: 1.45; }
.stepbody input[type=text] { margin-top: 2px; }
.stepside { flex: 0 0 auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding-top: 1px; }

@media (max-width: 640px) {
  .steprow { flex-wrap: wrap; }
  .stepside { width: 100%; padding-left: 40px; }
}

/* ---------- Save bar ---------- */
.savebar {
  position: sticky; bottom: 0; z-index: 20; margin-top: 16px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}

/* ---------- Daily goals ---------- */
.goalrow { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.goalrow .gl { flex: 0 0 128px; font-size: .83rem; font-weight: 550; color: var(--ink-2); }
.goalrow .track { flex: 1; height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.goalrow .track > i { display: block; height: 100%; border-radius: 99px; transition: width .3s ease; }
.goalrow .gv { flex: 0 0 auto; font-size: .78rem; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.goalrow .gv.done { color: var(--green); }

.goalset {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.goalset:last-of-type { border-bottom: 0; }

/* ---------- Seven-day goal strip ---------- */
.weekstrip { display: flex; gap: 4px; margin-top: 10px; }
.weekstrip .wday {
  flex: 1; text-align: center; padding: 4px 0; border-radius: 5px;
  font-size: .68rem; font-weight: 700; background: var(--surface-2);
  color: var(--ink-3); border: 1px solid var(--line);
}
.weekstrip .wday.some { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.weekstrip .wday.all  { background: var(--green-soft); color: var(--green); border-color: transparent; }
.weekstrip .wday.now  { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Narrow screens: the top bar wraps rather than overflowing ----- */
.topbar h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 680px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  /* flex-basis 0 so a long page title shrinks and shares the first row with
     the menu button, instead of wrapping onto a line of its own. */
  .topbar h1 { font-size: .95rem; flex: 1 1 0; min-width: 0; }
  .topbar .btn-primary { padding: 6px 10px; font-size: .78rem; }
  .topbar .btn-primary .long { display: none; }
  /* The shop switcher takes a line of its own instead of squeezing the rest. */
  .shopswitch { order: 10; flex: 1 1 100%; justify-content: flex-start; }
  .shopswitch a { padding: 5px 10px; font-size: .74rem; }
  .shopswitch .dot { display: inline-block; }
}

/* Cards in a grid row share the row's height, so no card leaves a gap below it. */
.grid > .card { height: 100%; }
.missedbar { border-color: color-mix(in srgb, var(--amber) 40%, var(--line)); background: var(--amber-soft); }
.missedbar .card-body { background: transparent; }
