/* Workout Calendar - styles. Calendar-dominant, light by default.
 * Tokens first; every colour below is a token so dark mode is one block. */
:root, :root[data-theme="light"] {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface2: #f9fafd;
  --ink: #0f1830;
  --muted: #5b6684;
  --line: #e1e5ef;
  --line2: #eef1f7;
  --accent: #1f3fd1;
  --accent-ink: #ffffff;
  --accent-soft: #e8edff;
  --paint: #bfd0ff;
  --band: #eef3ff;
  --busy: #eceef4;
  --busy-stripe: #dcdfe8;
  --bad: #d92d3a;
  --warn: #c98200;
  --good: #11804f;
  --shadow: 0 1px 2px rgba(15, 24, 48, .06), 0 8px 24px rgba(15, 24, 48, .07);
  --c-easy: #d3f1e2;     --c-easy-ink: #0b6142;
  --c-long: #d5e5fc;     --c-long-ink: #14498c;
  --c-quality: #fcd8d0;  --c-quality-ink: #9b2f1c;
  --c-strength: #e5dcfc; --c-strength-ink: #4a2d9c;
  --c-mobility: #f9eec2; --c-mobility-ink: #725300;
  --c-cross: #fde1c6;    --c-cross-ink: #87470c;
  --c-race: #1f3fd1;     --c-race-ink: #ffffff;
  --font: "Avenir Next", Avenir, "Century Gothic", Futura, "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c1020;
  --surface: #141a2d;
  --surface2: #182039;
  --ink: #e9edf9;
  --muted: #98a2c2;
  --line: #262e48;
  --line2: #1d2540;
  --accent: #7d95ff;
  --accent-ink: #0c1020;
  --accent-soft: #1f2a55;
  --paint: #33479a;
  --band: rgba(125, 149, 255, .10);
  --busy: #222a42;
  --busy-stripe: #2b3452;
  --bad: #ff5d68;
  --warn: #f0b23c;
  --good: #46d18f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
  --c-easy: #1b4535;     --c-easy-ink: #aef0cf;
  --c-long: #1b3558;     --c-long-ink: #b7d5ff;
  --c-quality: #55261f;  --c-quality-ink: #ffc2b5;
  --c-strength: #33285c; --c-strength-ink: #d6c9ff;
  --c-mobility: #4a3e12; --c-mobility-ink: #f7e29a;
  --c-cross: #523313;    --c-cross-ink: #ffcf9f;
  --c-race: #7d95ff;     --c-race-ink: #0c1020;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.mark { width: 30px; height: 30px; color: var(--accent); flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.tagline { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.home-link { font-size: 13px; color: var(--muted); text-decoration: none; font-weight: 600; }
.home-link:hover { color: var(--accent); }
.credits { font: 600 13px var(--mono); background: var(--accent-soft); color: var(--accent); padding: 5px 9px; border-radius: 6px; }
.topup { font-size: 13px; font-weight: 700; }

/* Buttons */
.primary, .ghost, .chip, .icon-btn, .mini { border-radius: 8px; cursor: pointer; font-weight: 700; border: 1px solid transparent; }
.primary { background: var(--accent); color: var(--accent-ink); padding: 10px 16px; }
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.primary:disabled { opacity: .55; cursor: not-allowed; }
.ghost { background: var(--surface); border-color: var(--line); padding: 9px 14px; }
.ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.small { padding: 6px 11px; font-size: 13px; }
.wide { width: 100%; }
.chip { background: var(--surface2); border-color: var(--line); padding: 5px 10px; font-size: 12.5px; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.icon-btn { background: transparent; border-color: var(--line); width: 32px; height: 32px; display: inline-grid; place-items: center; font-size: 18px; line-height: 1; padding: 0; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.mini { background: transparent; border-color: var(--line); font-size: 11px; padding: 1px 7px; color: var(--muted); vertical-align: middle; }
.mini:hover { color: var(--accent); border-color: var(--accent); }
:root[data-theme="light"] .moon, :root[data-theme="dark"] .sun { display: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }

/* Shell */
.shell { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; padding: 16px 20px 28px; align-items: start; }
.rail { position: sticky; top: 70px; max-height: calc(100vh - 86px); overflow: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.rail-sec { padding: 14px 16px; border-bottom: 1px solid var(--line2); }
.rail-sec h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 10px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.num { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-grid; place-items: center; font-size: 11px; }
.fld { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 12.5px; font-weight: 700; color: var(--muted); min-width: 0; }
.fld em { font-style: normal; font-weight: 500; }
.fld input, .fld select, .fld textarea { width: 100%; background: var(--surface2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 14px; font-weight: 500; color: var(--ink); }
.fld textarea { resize: vertical; }
.fld input[type="range"] { padding: 0; accent-color: var(--accent); background: transparent; border: 0; }
.fld output { color: var(--accent); font-weight: 800; margin-left: 4px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 6px; align-items: center; font-size: 13px; margin: 2px 0 8px; }
.drop { border: 2px dashed var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
#icsCard.dragover .drop { border-color: var(--accent); background: var(--accent-soft); }
.commit-list { list-style: none; margin: 6px 0; padding: 0; max-height: 210px; overflow: auto; }
.commit-list li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 5px 0; border-bottom: 1px solid var(--line2); }
.commit-list li.off { opacity: .45; text-decoration: line-through; }
.commit-list .cl-main { flex: 1; min-width: 0; }
.commit-list .cl-title { font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.commit-list .cl-when { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.add-commit summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--accent); margin: 6px 0; }
.rail-run { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.meter { font-size: 12.5px; color: var(--muted); margin: 0; min-height: 1em; }
.gate { font-size: 12.5px; margin: 0; background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; }
.gate-act { font-weight: 800; font-size: 13px; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.examples .hint { width: 100%; }

/* Stage + toolbar */
.stage { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 7px; font-weight: 800; cursor: pointer; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.weeknav { display: flex; align-items: center; gap: 8px; }
.week-label { font-weight: 800; letter-spacing: -.01em; min-width: 190px; text-align: center; }
.paint-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.paint-tools .hint { margin: 0 6px 0 0; }
.avail-totals { margin-left: auto; font-weight: 800; color: var(--accent); font-size: 13px; }

/* Progress */
.progress { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.pp-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.pp-bar { height: 6px; background: var(--line2); border-radius: 6px; margin-top: 8px; overflow: hidden; }
.pp-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width .4s; }

/* Calendar */
.cal-wrap { height: clamp(540px, calc(100vh - 190px), 980px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; position: relative; scroll-margin-top: 76px; }
.cal-host { height: 100%; }
.cal { height: 100%; display: grid; grid-template-columns: 50px repeat(7, minmax(0, 1fr)); position: relative; user-select: none; -webkit-user-select: none; }
.agenda { display: none; }
.axis { display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.axis-head, .day-head { height: 62px; flex: none; border-bottom: 1px solid var(--line); }
.axis-body { position: relative; flex: 1; }
.tick { position: absolute; right: 6px; transform: translateY(-50%); font: 600 10.5px var(--mono); color: var(--muted); }
.tick:first-child { transform: none; }
.day { display: flex; flex-direction: column; border-right: 1px solid var(--line2); min-width: 0; }
.day:last-child { border-right: 0; }
.day-head { padding: 6px 6px 4px; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.dname { font-weight: 800; font-size: 13px; letter-spacing: -.01em; }
.dsub { font-size: 11px; color: var(--muted); font-weight: 600; }
.day.today .dname { background: var(--accent); color: var(--accent-ink); border-radius: 6px; padding: 1px 7px; align-self: flex-start; }
.day.out { background: repeating-linear-gradient(135deg, transparent 0 7px, var(--line2) 7px 8px); }
.day.event .dsub { color: var(--accent); font-weight: 800; }
.load { height: 4px; background: var(--line2); border-radius: 4px; overflow: hidden; }
.load-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.allday { font-size: 10.5px; font-weight: 700; background: var(--busy); border-radius: 4px; padding: 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.allday.block { background: repeating-linear-gradient(135deg, var(--busy) 0 5px, var(--busy-stripe) 5px 10px); }
.day-body { position: relative; flex: 1; }
.gl { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line2); }
.band { position: absolute; left: 0; right: 0; background: var(--band); border-left: 3px solid var(--paint); }
.busy { position: absolute; left: 2px; right: 2px; border-radius: 6px; overflow: hidden; font-size: 10.5px; font-weight: 700; color: var(--muted);
  background: repeating-linear-gradient(135deg, var(--busy) 0 6px, var(--busy-stripe) 6px 12px); padding: 2px 5px; }
.busy.soft { opacity: .55; }
.now { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 3; }
.now::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* Paint cells */
.paint-body { display: grid; grid-template-rows: repeat(36, 1fr); touch-action: none; cursor: crosshair; }
.cell { border-bottom: 1px solid var(--line2); }
.cell.hour { border-top: 1px solid var(--line); }
.cell.on { background: var(--paint); border-bottom-color: transparent; }
.cell.on + .cell.on { border-top-color: transparent; }
.cell:hover { box-shadow: inset 0 0 0 2px var(--accent); }

/* Session blocks */
.blk { position: absolute; left: 4px; right: 4px; border-radius: 6px; border: 0; text-align: left; padding: 3px 6px; overflow: hidden;
  display: flex; flex-direction: column; gap: 1px; cursor: grab; z-index: 2; font-size: 11.5px; line-height: 1.2; touch-action: none;
  box-shadow: 0 1px 2px rgba(15, 24, 48, .12); }
.blk.short { flex-direction: row; gap: 6px; align-items: center; padding-top: 1px; padding-bottom: 1px; }
.blk-time { font: 700 10px var(--mono); opacity: .85; white-space: nowrap; }
.blk-title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk-mark { position: absolute; right: 5px; bottom: 2px; font-weight: 900; }
.blk-flag { position: absolute; right: 3px; top: 3px; width: 15px; height: 15px; border-radius: 50%; background: var(--bad); color: #fff;
  font-size: 10px; font-weight: 900; display: grid; place-items: center; }
.blk.bad { outline: 2.5px solid var(--bad); outline-offset: 1px; }
.blk.warn { outline: 2px dashed var(--warn); outline-offset: 1px; }
.blk.moved::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.blk.dragging { cursor: grabbing; z-index: 10; box-shadow: 0 10px 24px rgba(15, 24, 48, .28); transform: scale(1.02); }
.blk.st-done { opacity: .78; }
.blk.st-missed { opacity: .6; text-decoration: line-through; filter: grayscale(.7); }
.cat-easy { background: var(--c-easy); color: var(--c-easy-ink); }
.cat-long { background: var(--c-long); color: var(--c-long-ink); }
.cat-quality { background: var(--c-quality); color: var(--c-quality-ink); }
.cat-strength { background: var(--c-strength); color: var(--c-strength-ink); }
.cat-mobility { background: var(--c-mobility); color: var(--c-mobility-ink); }
.cat-cross { background: var(--c-cross); color: var(--c-cross-ink); }
.cat-race { background: var(--c-race); color: var(--c-race-ink); }
.cal-empty { position: absolute; inset: 62px 0 0 50px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; pointer-events: none; text-align: center; padding: 20px; }
.cal-empty strong { font-size: 18px; letter-spacing: -.01em; background: var(--surface); padding: 2px 10px; border-radius: 6px; }
.cal-empty span { color: var(--muted); font-size: 13.5px; background: var(--surface); padding: 2px 10px; border-radius: 6px; max-width: 420px; }

/* Legend + week strip */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; font-weight: 600; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg-sw { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-free { background: var(--paint); } .sw-none { background: var(--surface); border: 1px solid var(--line); }
.sw-band { background: var(--band); border-left: 3px solid var(--paint); }
.sw-busy { background: repeating-linear-gradient(135deg, var(--busy) 0 3px, var(--busy-stripe) 3px 6px); }
.sw-bad { background: var(--surface); outline: 2px solid var(--bad); }
.week-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.week-strip:empty { display: none; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.stat b { display: block; font-size: 19px; letter-spacing: -.02em; }
.stat span { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stat.bad b { color: var(--bad); } .stat.good b { color: var(--good); }

/* Plan panel */
.plan-panel, .history, .how { scroll-margin-top: 76px; }
.plan-panel, .history, .how { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 16px 18px; }
.plan-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.plan-head h2 { margin: 6px 0 4px; font-size: 22px; letter-spacing: -.02em; font-weight: 800; }
.plan-head p { margin: 0 0 4px; max-width: 70ch; }
.badge { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; background: var(--accent-soft); color: var(--accent); padding: 3px 8px; border-radius: 6px; }
.exports { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.note { border-radius: 8px; padding: 8px 12px; font-size: 13.5px; background: var(--accent-soft); margin: 10px 0 0; }
.note.warn { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); }
.plan-cols { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 18px; margin-top: 14px; }
.plan-col h3, .replan h3, .history h3, .how h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; margin: 4px 0 8px; font-weight: 800; }
.count { background: var(--bad); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; }
.count.ok { background: var(--good); }
.checks, .notes, .phases { margin: 0 0 12px; padding-left: 18px; font-size: 13.5px; }
.checks li { margin-bottom: 5px; }
.checks li.error::marker { color: var(--bad); } .checks li.warn::marker { color: var(--warn); }
.checks li button { margin-left: 6px; }
.phases li b { font-weight: 800; }
.season { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; }
.sw { display: grid; grid-template-columns: 76px auto 1fr 44px; gap: 8px; align-items: center; background: transparent; border: 1px solid transparent;
  border-radius: 6px; padding: 2px 4px; cursor: pointer; text-align: left; font-size: 11.5px; }
.sw:hover { border-color: var(--line); }
.sw.cur { border-color: var(--accent); background: var(--accent-soft); }
.sw-lbl { font-weight: 700; white-space: nowrap; }
.sw-days { display: grid; grid-template-columns: repeat(7, 13px); gap: 2px; }
.sw-day { height: 13px; background: var(--line2); border-radius: 3px; display: flex; flex-direction: column; overflow: hidden; }
.pip { flex: 1; display: block; }
.pip.st-missed { opacity: .3; }
.sw-bar { height: 6px; background: var(--line2); border-radius: 6px; overflow: hidden; }
.sw-fill { display: block; height: 100%; background: var(--accent); }
.sw-num { font: 600 11px var(--mono); color: var(--muted); text-align: right; }
.replan { display: grid; grid-template-columns: 1fr auto; gap: 8px 18px; align-items: end; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line2); }
.replan-row { display: flex; gap: 10px; align-items: flex-end; }
.replan-row .fld { margin: 0; }
.replan .meter { grid-column: 1 / -1; }
.raw { margin-top: 12px; } .raw pre { white-space: pre-wrap; font: 12px/1.5 var(--mono); background: var(--surface2); padding: 10px; border-radius: 8px; max-height: 360px; overflow: auto; }

/* History */
.hist-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.hist-search { display: flex; gap: 6px; align-items: center; }
.hist-search input { background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 260px; }
.hist-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.hist-item { display: flex; gap: 6px; align-items: stretch; }
.hist-row { flex: 1; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; text-align: left; background: var(--surface2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.hist-row:hover { border-color: var(--accent); }
.hist-label { font-weight: 800; }
.hist-sub { font-size: 12px; color: var(--muted); }
.hist-del { background: transparent; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; padding: 0 10px; cursor: pointer; color: var(--muted); }
.hist-del:hover { color: var(--bad); border-color: var(--bad); }
.hist-empty { color: var(--muted); font-size: 13px; }
.how ol { margin: 0; padding-left: 20px; font-size: 14px; } .how li { margin-bottom: 4px; }

/* Popover */
.pop { position: fixed; z-index: 50; width: 300px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(15, 24, 48, .25); padding: 12px 14px; }
.pop-head { display: flex; justify-content: space-between; align-items: center; }
.pop-cat { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 6px; }
.pop h4 { margin: 8px 0 2px; font-size: 16px; letter-spacing: -.01em; }
.pop p { margin: 4px 0; font-size: 13.5px; }
.pop-flags { margin: 6px 0; padding-left: 18px; font-size: 12.5px; color: var(--bad); }
.pop-flags:empty { display: none; }
.pop-status { display: flex; gap: 6px; margin: 8px 0 10px; }
.pop-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Toasts + footer */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; box-shadow: var(--shadow); transition: opacity .5s; }
.toast.err { background: var(--bad); color: #fff; }
.toast a { color: inherit; font-weight: 800; margin-left: 8px; }
.toast.gone { opacity: 0; }
footer { display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: center; padding: 18px 16px 28px; font-size: 12.5px; color: var(--muted); }
.foot-sep { opacity: .5; }

/* Responsive */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; max-height: none; }
  .plan-cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .top { padding: 10px 16px; }
  .tagline { display: none; }
  .shell { padding: 12px 16px 24px; gap: 12px; }
  .pair { grid-template-columns: 1fr; gap: 0; }
  .plan-cols, .replan { grid-template-columns: 1fr; }
  .week-label { min-width: 0; font-size: 14px; }
  .cal { grid-template-columns: 36px repeat(7, minmax(0, 1fr)); }
  .tick { font-size: 9px; right: 3px; }
  .dname { font-size: 11.5px; }
  .day-head .dsub, .day-head .load { display: none; }
  .cal-wrap.is-paint { height: 620px; }
  .cal-wrap.is-plan { height: auto; overflow: visible; border: 0; box-shadow: none; background: transparent; }
  .cal-wrap.is-plan .cal-host { display: none; }
  .cal-wrap.is-plan .agenda { display: flex; flex-direction: column; gap: 8px; }
  .ag-day { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
  .ag-day.today { border-color: var(--accent); }
  .ag-head { display: flex; justify-content: space-between; }
  .ag-blk { text-align: left; border: 0; border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; cursor: pointer; }
  .ag-blk.bad { outline: 2.5px solid var(--bad); } .ag-blk.warn { outline: 2px dashed var(--warn); }
  .ag-blk.st-missed { text-decoration: line-through; opacity: .6; }
  .ag-time { font: 700 11px var(--mono); } .ag-title { font-weight: 800; }
  .ag-busy { font-size: 12.5px; color: var(--muted); background: repeating-linear-gradient(135deg, var(--busy) 0 6px, var(--busy-stripe) 6px 12px); border-radius: 6px; padding: 5px 9px; }
  .ag-free { font-size: 12.5px; color: var(--muted); }
  .hist-search input { min-width: 0; width: 100%; }
  .pop { left: 8px !important; right: 8px; bottom: 8px; top: auto !important; width: auto; }
  .sw { grid-template-columns: 64px auto 1fr 40px; }
}
