/* ==================================================================
   Órarend — "Board"
   A posted schedule board: a constant deep-navy band carries the
   identity, the week sits below as a bright high-contrast card.
   Each subject owns a hue (--h); clash state is hatching + outline,
   never hue alone, so it survives colour-blindness and greyscale print.
   ================================================================== */

:root {
  --page:  #eceff4;
  --card:  #ffffff;
  --sunk:  #f4f6fa;
  --ink:   #0f1420;
  --faint: #5d6675;
  --line:  #dce1e9;
  /* The band follows the theme — a light theme should look light all the way up. */
  --band:  #ffffff;
  --bandink: #0f1420;
  --bandfaint: #5d6675;
  --bandline: #d5dbe4;
  --bandctl: #f2f5f9;
  --accent: #2f6feb;
  --warn:  #b3372a;
  --warnbg: #fdecea;
  --caution: #8a5a12;
  --cautionbg: #fdf4e4;
  --ok:    #157a52;

  --hour: 42px;
  --radius: 7px;

  /* Per-subject tint. Only the S/L stops live here — the hue itself arrives as
     --h on each element, and custom properties substitute lazily, so one set of
     tokens themes every subject colour at once. */
  --bg-s: 74%; --bg-l: 94%;
  --bd-s: 55%; --bd-l: 74%;
  --bar-s: 60%; --bar-l: 46%;
  --tx-s: 62%; --tx-l: 26%;
  --sub-s: 25%; --sub-l: 38%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg-s: 40%; --bg-l: 17%;
    --bd-s: 35%; --bd-l: 32%;
    --bar-s: 60%; --bar-l: 60%;
    --tx-s: 70%; --tx-l: 82%;
    --sub-s: 20%; --sub-l: 66%;
  }
}
:root[data-theme="light"] {
  --bg-s: 74%; --bg-l: 94%; --bd-s: 55%; --bd-l: 74%;
  --bar-s: 60%; --bar-l: 46%; --tx-s: 62%; --tx-l: 26%; --sub-s: 25%; --sub-l: 38%;
}
:root[data-theme="dark"] {
  --bg-s: 40%; --bg-l: 17%; --bd-s: 35%; --bd-l: 32%;
  --bar-s: 60%; --bar-l: 60%; --tx-s: 70%; --tx-l: 82%; --sub-s: 20%; --sub-l: 66%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page:  #0c0f16;
    --card:  #161b25;
    --sunk:  #11151d;
    --ink:   #e6eaf2;
    --faint: #8b96a8;
    --line:  #262d3a;
    --band:  #080e1a;
    --bandink: #e8eef9;
    --bandfaint: #8090ad;
    --bandline: #1e2634;
    --bandctl: #161d2b;
    --accent: #6fa2ff;
    --warn:  #ff8a78;
    --warnbg: #35201d;
    --caution: #e9b45f;
    --cautionbg: #322611;
    --ok:    #4fd39b;
  }
}
:root[data-theme="light"] {
  --page:#eceff4; --card:#fff; --sunk:#f4f6fa; --ink:#0f1420; --faint:#5d6675;
  --line:#dce1e9; --accent:#2f6feb; --warn:#b3372a; --warnbg:#fdecea; --ok:#157a52; --caution:#8a5a12; --cautionbg:#fdf4e4;
  --band:#fff; --bandink:#0f1420; --bandfaint:#5d6675; --bandline:#d5dbe4; --bandctl:#f2f5f9;
}
:root[data-theme="dark"] {
  --page:#0c0f16; --card:#161b25; --sunk:#11151d; --ink:#e6eaf2; --faint:#8b96a8;
  --line:#262d3a; --accent:#6fa2ff; --warn:#ff8a78; --warnbg:#35201d; --ok:#4fd39b; --caution:#e9b45f; --cautionbg:#322611;
  --band:#080e1a; --bandink:#e8eef9; --bandfaint:#8090ad; --bandline:#1e2634; --bandctl:#161d2b;
}

* { box-sizing: border-box; }
/* class rules like .toast{display:flex} outrank the UA's [hidden] rule, so make
   the attribute authoritative — otherwise "hidden" elements still paint */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 400 14px/1.5 Archivo, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
button, input, select { font: inherit; color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 99;
  background: var(--accent); color: #fff; padding: 10px 14px;
}
.skip:focus { left: 8px; top: 8px; }

/* ---------------- band ---------------- */
.band {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--band); color: var(--bandink);
  border-bottom: 1px solid var(--bandline);
}
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
/* No font-stretch here: Bunny serves static instances, so the wdth axis is not
   available and asking for 90% would silently render at 100% anyway. */
.logo {
  font-family: "Bricolage Grotesque", Archivo, sans-serif;
  font-size: 22px; font-weight: 800;
  letter-spacing: -.02em; line-height: 1;
}
.tag {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--bandfaint); white-space: nowrap;
}
@media (max-width: 620px) { .tag { display: none; } }

.band form { display: flex; gap: 6px; flex: 1 1 340px; min-width: 220px; max-width: 620px; }
.band select, .band input {
  background: var(--bandctl); color: var(--bandink);
  border: 1px solid var(--bandline); border-radius: 5px; padding: 7px 9px;
}
#mit { flex: 1 1 auto; min-width: 0; }
#mit::placeholder { color: var(--bandfaint); }
.band button {
  background: var(--bandctl); color: var(--bandink);
  border: 1px solid var(--bandline); border-radius: 5px;
  padding: 7px 11px; cursor: pointer;
}
.band button:hover { border-color: var(--accent); color: var(--accent); }
.band button.go { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.band button.go:hover { filter: brightness(1.1); }
.tools { display: flex; gap: 6px; align-items: center; margin-left: auto; }
#lang, #theme { font-family: "IBM Plex Mono", monospace; font-size: 11px; }

/* Three jobs, three looks: a quiet progress line, a red failure, and a decision
   that stays put until you answer it. */
.note {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0; padding: 8px 20px; font-size: 12.5px;
  border-bottom: 1px solid var(--line);
}
.note b { font-weight: 600; }
.note.info  { background: transparent; color: var(--faint); }
.note.error { background: var(--warnbg); color: var(--warn); }
.note.ask   { background: var(--cautionbg); color: var(--caution); }
.note button {
  background: var(--card); border: 1px solid currentColor; border-radius: 5px;
  padding: 3px 10px; font-size: 12px; font-weight: 600; color: inherit; cursor: pointer;
}
.note button:hover { background: color-mix(in srgb, currentColor 12%, var(--card)); }

/* ---------------- shell ---------------- */
main {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .9fr);
  gap: 16px; padding: 16px 20px 32px; align-items: start;
}
.panel {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.panel > * { min-width: 0; }
.cap {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--card);
}
.cap h2 {
  margin: 0; font-family: "Bricolage Grotesque", Archivo, sans-serif;
  font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.cap .n { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--faint); }
.acts { display: flex; gap: 5px; flex-wrap: wrap; }
.acts button {
  background: none; border: 1px solid var(--line); border-radius: 5px;
  padding: 4px 9px; font-size: 12px; cursor: pointer; color: var(--faint);
}
.acts button:hover { border-color: var(--accent); color: var(--accent); }
.acts button[disabled] { opacity: .4; cursor: not-allowed; }
.acts button:hover[disabled] { border-color: var(--line); color: var(--faint); }
/* Calendar/Image/Share/Print export the week you are looking at; Export/Import
   move whole plans between machines; Clear destroys one. Three different kinds
   of action in one row, so separate them. */
.acts .sep { width: 1px; align-self: stretch; margin: 0 3px; background: var(--line); }
@media (max-width: 620px) { .acts .sep { display: none; } }

/* ---------------- week scrubber (signature) ---------------- */
.scrub {
  display: flex; gap: 3px; padding: 9px 14px; background: var(--sunk);
  border-bottom: 1px solid var(--line); overflow-x: auto;
}
.scrub button {
  flex: 1 1 0; min-width: 26px; background: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 4px; padding: 4px 2px 3px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.scrub button:hover { border-color: var(--accent); }
.scrub .wn { font-family: "IBM Plex Mono", monospace; font-size: 9.5px; color: var(--faint); line-height: 1; }
.scrub .bar { width: 100%; height: 3px; border-radius: 2px; background: var(--line); }
.scrub .bar > i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.scrub button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.scrub button.on .wn { color: var(--accent); font-weight: 600; }
.scrub button.brk { border-style: dashed; opacity: .6; }
.scrub button.brk .bar { background: repeating-linear-gradient(45deg, var(--line) 0 3px, transparent 3px 6px); }
/* A week that loses a day or two but still runs — a public holiday, or the half
   of the spring break that falls this side of the week boundary. The load bar
   is still meaningful, so only the number is marked. */
.scrub button.part .wn { color: var(--caution); }
.scrub button.part .wn::after { content: "·"; }
.scrub .all { flex: 0 0 auto; padding-inline: 9px; justify-content: center; }
.scrub .all .wn { font-size: 10px; letter-spacing: .04em; }

/* ---------------- the week ---------------- */
.sheet { padding: 0 14px 12px; overflow-x: auto; }
.week { min-width: 520px; --cols: 5; }
.week.day { min-width: 0; }
.dayrow, .body { display: grid; grid-template-columns: 40px repeat(var(--cols), 1fr); }
.dayrow div {
  padding: 8px 0 6px; text-align: center; font-size: 11px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--faint);
}
.dayrow div.free { color: var(--ok); }
/* the date, shown only when a single week is selected and the column is a real day */
.dayrow div i, .dayswitch button i {
  font-style: normal; font-family: "IBM Plex Mono", monospace;
  font-weight: 500; letter-spacing: 0; opacity: .75;
}
.dayrow div i { margin-left: 4px; }
.dayswitch button i { margin-left: 3px; }
.body { position: relative; }
.gutter { position: relative; }
.gutter i {
  display: block; height: var(--hour); font-style: normal;
  font-family: "IBM Plex Mono", monospace; font-size: 9.5px; color: var(--faint);
  text-align: right; padding-right: 7px; transform: translateY(-5px);
}
.col { position: relative; border-left: 1px solid var(--line); }
.col.edge-r { border-right: 1px solid var(--line); }
.rules { position: absolute; inset: 0; pointer-events: none; }
.rules span { display: block; height: calc(var(--hour) / 2); border-bottom: 1px solid var(--line); }
.rules span:nth-child(odd) { border-bottom-color: color-mix(in srgb, var(--line) 45%, transparent); }

.blk {
  position: absolute; overflow: hidden; border-radius: 4px;
  padding: 3px 5px 3px 7px; line-height: 1.22; cursor: default;
  /* focusable: the grid is reachable by keyboard, not mouse-only */
  outline-offset: -2px;
  background: hsl(var(--h) var(--bg-s) var(--bg-l));
  border: 1px solid hsl(var(--h) var(--bd-s) var(--bd-l));
  border-left: 3px solid hsl(var(--h) var(--bar-s) var(--bar-l));
}
/* Titles wrap in full rather than being ellipsised — if a block is too small to
   hold the whole name, enlarge the grid with the size control instead. */
.blk b {
  display: block; overflow-wrap: break-word; hyphens: auto;
  font-size: 11px; font-weight: 700;
  color: hsl(var(--h) var(--tx-s) var(--tx-l));
}
.blk em {
  display: block; font-style: normal; font-family: "IBM Plex Mono", monospace;
  font-size: 9px; color: hsl(var(--h) var(--sub-s) var(--sub-l));
}
/* the time is a fixed token and must never wrap; only the room may */
.blk .tm { white-space: nowrap; }
/* room codes are short but arbitrary — let them wrap rather than get cut */
.blk .rm { overflow-wrap: anywhere; }
/* a one-hour block has no room for three lines; drop the room there, it is
   still on the list below the grid and in the hover title */
.blk.tight .rm { display: none; }
.blk.narrow { padding-left: 5px; }

/* Clash tiers. Each differs in pattern AND glyph as well as colour, so the
   severity survives colour-blindness and greyscale printing.
   blocker = two practices (must change group) · priority = practice vs lecture
   · choice = two lectures (attend one, tell both instructors) */
.blk.k-blocker {
  border-color: var(--warn); border-left-color: var(--warn); outline: 1px solid var(--warn);
  background-image: repeating-linear-gradient(45deg,
    color-mix(in srgb, var(--warn) 26%, transparent) 0 4px, transparent 4px 8px);
}
.blk.k-blocker b { color: var(--warn); }

.blk.k-priority {
  border-color: var(--caution); border-left-color: var(--caution);
  background-image: repeating-linear-gradient(45deg,
    color-mix(in srgb, var(--caution) 20%, transparent) 0 3px, transparent 3px 12px);
}

.blk.k-choice { border-style: dashed; border-color: var(--faint); }

/* clash marker, pinned to the corner so it survives title truncation */
.blk .badge {
  position: absolute; top: 2px; right: 4px; z-index: 1;
  font-size: 10px; font-weight: 700; line-height: 1;
}
.blk.k-blocker  .badge { color: var(--warn); }
.blk.k-priority .badge { color: var(--caution); }
.blk.k-choice   .badge { color: var(--faint); }
.blk.hit b { padding-right: 12px; }

/* A class that would normally sit here but does not run this week: a holiday, or
   half of a spring break. Deliberately unlike the clash tiers — no hue, no hatch,
   struck through — because this is not a problem to solve, it is a date that
   isn't happening. */
.blk.off {
  background: var(--sunk); border-color: var(--line);
  border-left-color: var(--line); border-style: dashed;
}
.blk.off b { color: var(--faint); text-decoration: line-through; text-decoration-thickness: 1px; }
.blk.off em { color: var(--faint); opacity: .8; text-decoration: line-through; }
.blk.off .offtag {
  position: absolute; top: 2px; right: 3px; z-index: 1;
  font-family: "IBM Plex Mono", monospace; font-size: 8px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; color: var(--caution);
  background: var(--card); border: 1px solid var(--caution);
  border-radius: 3px; padding: 0 3px; line-height: 1.5;
}
.blk.off.tight .offtag, .blk.off.narrow .offtag { display: none; }  /* no room for it */
.blk.off.hit .badge { display: none; }   /* a clash on a day with no class is moot */
.blk.off b { padding-right: 0; }

.dayrow div.off { color: var(--caution); text-decoration: line-through; }
.dayswitch button.off { color: var(--caution); border-style: dashed; }
.dayswitch button.on.off { color: #fff; }

/* What you are looking at, in dates. Always present — a week number on its own
   does not tell you when it is. */
.weekbar {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 7px 14px; border-bottom: 1px solid var(--line); background: var(--sunk);
  font-size: 11.5px;
}
.weekbar .wr { display: inline-flex; align-items: baseline; gap: 7px; }
.weekbar .wr b {
  font-family: "Bricolage Grotesque", Archivo, sans-serif;
  font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--ink);
}
.weekbar .wr span {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--faint);
}
.weekbar .wn { color: var(--caution); }
.weekbar .wn::before { content: "· "; color: var(--line); }
/* names what is pinned, and how to let go of it */
.weekbar .fn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  color: var(--accent); font-weight: 600;
}
.weekbar .fn::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
@media (max-width: 620px) { .weekbar .fn { margin-left: 0; } }

.ghost {
  position: absolute; border: 1.5px dashed var(--accent); border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  pointer-events: none; padding: 3px 6px; overflow: hidden;
}
.ghost b { font-size: 10.5px; font-weight: 700; color: var(--accent); }
.blank { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; padding: 0 24px; }
.blank p { max-width: 34ch; text-align: center; font-size: 13px; color: var(--faint); margin: 0; }

/* view controls — layout and grid size */
.viewbar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--card);
}
.seg { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button {
  background: none; border: 0; cursor: pointer; color: var(--faint);
  padding: 5px 11px; font-size: 12px; font-weight: 600;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--accent); }
.seg button.on { background: var(--accent); color: #fff; }
.seg.zoom span {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--faint);
  min-width: 46px; text-align: center; padding: 0 2px;
}
.seg.zoom button { padding: 5px 10px; font-size: 14px; line-height: 1; }
.seg button[disabled] { opacity: .35; cursor: not-allowed; }

/* day tabs — a sibling of .sheet, never inside its scroll container */
.dayswitch {
  display: flex; gap: 5px; padding: 9px 14px;
  border-bottom: 1px solid var(--line); background: var(--sunk);
}
.dayswitch button {
  flex: 1 1 0; background: var(--card); border: 1px solid var(--line); border-radius: 5px;
  padding: 7px 0; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--faint); cursor: pointer;
}
.dayswitch button:hover { border-color: var(--accent); }
.dayswitch button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.dayswitch button.free { color: var(--ok); }
.dayswitch button.on.free { color: #fff; }

/* ---------------- stats ---------------- */
.stats {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  padding: 9px 14px; border-top: 1px solid var(--line); background: var(--sunk);
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--faint);
}
.stats b { color: var(--ink); font-weight: 600; }
.stats .bad b, .stats .bad { color: var(--warn); }
.stats .caution b, .stats .caution { color: var(--caution); }
.stats .good b { color: var(--ok); }

/* ---------------- picked ---------------- */
.picked { border-top: 1px solid var(--line); }
.item {
  display: grid; grid-template-columns: 4px 24px 1fr auto; gap: 9px; align-items: start;
  padding: 9px 14px 9px 0; border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: 0; }
.item .swatch { align-self: stretch; border-radius: 0 3px 3px 0; background: hsl(var(--h) 60% 50%); }
.item .t { font-size: 13px; font-weight: 500; }
.item .s { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--faint); }
.item .warn { color: var(--warn); }
.item .caution { color: var(--caution); }

/* ---- clash tiers in the list ---- */
/* The swatch keeps carrying the subject hue and the left edge carries the clash
   tier. The swatch must never be display:none — it is a grid child, and removing
   it shifts every following cell into the wrong column. */
.item { cursor: default; border-left: 3px solid transparent; }
.item.k-blocker  { background: var(--warnbg);    border-left-color: var(--warn); }
.item.k-priority { background: var(--cautionbg); border-left-color: var(--caution); }
.item.k-choice   { border-left-color: var(--faint); border-left-style: dashed; }

.tier {
  display: inline-flex; align-items: baseline; gap: 5px; flex-wrap: wrap;
  margin-top: 3px; font-size: 11px; font-weight: 600;
}
.tier .g { font-size: 11px; }
.tier .vs { font-weight: 400; color: var(--faint); font-size: 10.5px; }
.item.k-blocker  .tier { color: var(--warn); }
.item.k-priority .tier { color: var(--caution); }
.item.k-choice   .tier { color: var(--faint); }

/* ---- focus: dim everything not in the conflict ---- */
/* Hover previews, a click pins. Both are clickable, so both say so. */
.item, .blk { transition: opacity .13s ease, box-shadow .13s ease; cursor: pointer; }
.dim { opacity: .2; }
.blk.lit { box-shadow: 0 0 0 2px var(--accent); z-index: 2; }
.item.lit { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.item.k-blocker.lit  { background: color-mix(in srgb, var(--warn) 16%, transparent); }
.item.k-priority.lit { background: color-mix(in srgb, var(--caution) 18%, transparent); }
/* The pinned one is the one you chose, so it outranks the merely-lit ones it
   dragged into view — a solid ring in the grid, a solid edge in the list. */
.item.pinned { box-shadow: inset 3px 0 0 var(--accent); }
.blk.pinned { box-shadow: 0 0 0 2px var(--accent), 0 2px 10px rgba(0,0,0,.18); z-index: 3; }
.item:focus-visible { outline-offset: -2px; }
/* While pinned, dimming is the resting state rather than a hover effect, so it
   should not keep animating as the pointer crosses the grid. */
body.haspin .item, body.haspin .blk { transition: opacity .13s ease; }
.drop { border: 0; background: none; color: var(--faint); font-size: 16px; line-height: 1; padding: 2px 6px; cursor: pointer; }
.drop:hover { color: var(--warn); }
.weeks { display: flex; gap: 1.5px; margin-top: 4px; }
.weeks i { width: 5px; height: 8px; border-radius: 1px; background: var(--line); }
.weeks i.on { background: hsl(var(--h) 60% 50%); }
.weeks i.brk { background: repeating-linear-gradient(45deg, var(--line) 0 2px, transparent 2px 4px); }
/* runs in this week, but its day is a holiday — so no class after all */
.weeks i.off { background: repeating-linear-gradient(45deg, var(--caution) 0 1px, transparent 1px 3px); }
.gap {
  margin-top: 3px; font-size: 10.5px; color: var(--warn);
  border-left: 2px solid var(--warn); padding-left: 6px;
}

/* ---------------- results ---------------- */
.filters { padding: 7px 14px; border-bottom: 1px solid var(--line); background: var(--sunk); }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--faint); cursor: pointer; }
.chk input { accent-color: var(--accent); }
.list { flex: 1 1 auto; max-height: 74vh; overflow-y: auto; }
.list:has(.msg) { display: grid; place-items: center; }

.subj { border-bottom: 1px solid var(--line); }
.subj:last-child { border-bottom: 0; }
.subjhead {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 9px; align-items: center;
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 9px 12px 9px 0; border-left: 0;
}
.subjhead:hover { background: var(--sunk); }
.subjhead .swatch { align-self: stretch; min-height: 26px; border-radius: 0 3px 3px 0; background: hsl(var(--h) 60% 50%); }
.subjhead .t { font-size: 13px; font-weight: 600; }
.subjhead .s { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--faint); }
.subjhead .chev { color: var(--faint); font-size: 11px; padding-right: 2px; }
.fitcount { color: var(--ok); font-weight: 600; }
.fitcount.none { color: var(--warn); }

.hitrow {
  display: grid; grid-template-columns: 24px 1fr; gap: 9px;
  padding: 8px 14px 8px 26px; border-top: 1px solid var(--line); background: var(--sunk);
}
.hitrow .t { font-size: 12.5px; }
.hitrow .s { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--faint); }
.hitrow .w { font-weight: 600; color: var(--ink); }
.hitrow.clash.k-blocker .w { color: var(--warn); }
.hitrow.clash.k-priority .w { color: var(--caution); }
.hitrow.in { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.add {
  width: 22px; height: 22px; padding: 0; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--faint);
  font-size: 14px; line-height: 1;
}
.add:hover { border-color: var(--accent); color: var(--accent); }
.hitrow.in .add { background: var(--accent); border-color: var(--accent); color: #fff; }
.verdict { font-size: 10.5px; margin-top: 2px; }
.verdict.fits { color: var(--ok); }
.verdict.clash { color: var(--warn); }
.verdict.caution { color: var(--caution); }

.trunc { padding: 8px 14px; font-size: 11.5px; color: var(--warn); background: var(--warnbg); border-bottom: 1px solid var(--line); }
.msg { padding: 30px 20px; text-align: center; color: var(--faint); font-size: 13px; }
.msg b { display: block; color: var(--ink); font-weight: 700; margin-bottom: 4px; }

/* ---------------- footer + toast ---------------- */
footer {
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: space-between;
  padding: 14px 20px 28px; font-size: 11.5px; color: var(--faint);
}
footer a { color: var(--faint); }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; z-index: 60;
  background: var(--band); color: var(--bandink); padding: 9px 14px;
  border-radius: 7px; font-size: 13px; box-shadow: 0 8px 26px rgba(0,0,0,.28);
}
.toast button {
  background: none; border: 1px solid rgba(255,255,255,.3); color: var(--bandink);
  border-radius: 5px; padding: 3px 9px; font-size: 12px; cursor: pointer;
}
.toast button:hover { background: rgba(255,255,255,.14); }

/* ---------------- responsive ---------------- */
@media (max-width: 980px) {
  main { grid-template-columns: minmax(0, 1fr); }
  .list { max-height: 52vh; }
}
@media (max-width: 700px) {
  .dayswitch { display: flex; }
  .dayrow { display: none; }        /* the switcher already names the day */
  .week { min-width: 0; }
  .sheet { overflow-x: hidden; }
  .acts button { padding: 4px 7px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------------- print ---------------- */
@media print {
  @page { margin: 12mm; }
  .band, .scrub, .filters, .list, .acts, footer, .toast, .note, .trunc, .dayswitch, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  main { display: block; padding: 0; }
  .panel { border: 0; }
  .cap { border-bottom: 1px solid #000; }
  .sheet { overflow: visible; padding: 0; }
  .week { min-width: 0; }
  .blk { background: #fff !important; border: 1px solid #000 !important; border-left: 3px solid #000 !important; }
  .blk b, .blk em { color: #000 !important; }
  /* paper resolves finer type, so the room fits even in short blocks */
  .blk b { font-size: 8.5pt; }
  .blk em { font-size: 6.5pt; }
  /* ...but a block that is both short and half-width still has no third line */
  .blk.tight:not(.narrow) .rm { display: block; }
  /* on paper the tiers separate by hatch density and border style, not colour */
  .blk.k-blocker  { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.30) 0 4px, transparent 4px 8px) !important; }
  .blk.k-priority { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.18) 0 2px, transparent 2px 11px) !important; }
  .blk.k-choice   { border-style: dashed !important; }
  /* a class that doesn't run this week keeps its strikethrough on paper, and the
     line explaining why has to print with it or the grid is simply wrong */
  .blk.off { background-image: none !important; border-style: dashed !important; }
  .blk.off b, .blk.off em { text-decoration: line-through !important; }
  .blk.off .offtag { border-color: #000 !important; color: #000 !important; }
  /* the printed sheet has to say which week it is and when — that is the whole
     point of printing one — so the date bar always prints */
  .weekbar { display: flex !important; color: #000; background: #fff; border-bottom: 1px solid #000; }
  .weekbar .wr b, .weekbar .wr span, .weekbar .wn { color: #000 !important; }
  .stats, .picked { background: #fff; border-top: 1px solid #000; }
  .item .swatch { background: #000 !important; }
}
