/* Traction walking skeleton. The running app is the design (PRD decision 42); colours come from the
   Moss tokens in moss.css, which loads first. */

:root {
  /* Colours come from the Moss roles in moss.css. These are Traction's own: schedule states and geometry. */
  --confirmed: var(--positive);
  --weekend: var(--moss-gray-100);
  --hatch: var(--moss-gray-500); /* 3:1 against white and the surface */
  --sel-row: var(--accent-weak);
  --skeleton: var(--moss-gray-100);
  --skeleton-2: var(--moss-gray-50);
  --tree-w: 432px;
  --side-w: 534px; /* the detail panel's place, which the optimizer and the docked assistant take */
  --hatch-bg: repeating-linear-gradient(135deg, var(--hatch) 0 1px, transparent 1px 5.66px) var(--surface);
  --hatch-strip: repeating-linear-gradient(135deg, var(--hatch) 0 1px, transparent 1px 4.24px) var(--surface);
  color-scheme: light;
}

html, body { height: 100%; }
/* No minimum width: below 1024 px every page reflows ("Below 1024 px" for the schedule's). */
body {
  display: flex;
  flex-direction: column;
  min-height: 600px;
  overflow-x: hidden;
  overflow-y: auto;
}
/* One-element icons for schedule rows: a CSS mask over currentColor (thousands of rows, so no <svg><use>). */
.ic {
  display: inline-block; flex: none; width: 13px; height: 13px; vertical-align: -2px;
  background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat;
}
.bar .ic, .mk .ic, .lane-note .ic, .t2 .ic, .idle .ic { width: 12px; height: 12px; }
.t2 .ic { width: 10px; height: 10px; margin-right: 2px; }
.tog .ic { width: 15px; height: 15px; }
.ic-sun { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 13' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 1.0829V2.16632M6.5 10.8337V11.9171M2.66994 2.66994L3.43375 3.43375M9.56616 9.56616L10.33 10.33M1.0829 6.5H2.16632M10.8337 6.5H11.9171M3.43375 9.56616L2.66994 10.33M10.33 2.66994L9.56616 3.43375M8.66684 6.5C8.66684 7.69671 7.69671 8.66684 6.5 8.66684C5.30329 8.66684 4.33316 7.69671 4.33316 6.5C4.33316 5.30329 5.30329 4.33316 6.5 4.33316C7.69671 4.33316 8.66684 5.30329 8.66684 6.5Z'/%3E%3C/svg%3E"); }
.ic-moon { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 13' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11.3668 6.76329C11.316 7.7036 10.994 8.60908 10.4395 9.37026C9.88503 10.1315 9.12192 10.7158 8.24242 11.0526C7.36292 11.3894 6.40468 11.4642 5.48352 11.2681C4.56237 11.072 3.71775 10.6133 3.05177 9.94748C2.38578 9.28165 1.92693 8.43719 1.7307 7.51618C1.53447 6.59517 1.60924 5.63705 1.94599 4.75762C2.28275 3.8782 2.86705 3.11513 3.62828 2.56066C4.38951 2.00619 5.29507 1.68405 6.2355 1.63319C6.45488 1.62128 6.56971 1.88233 6.45325 2.0681C6.06372 2.69125 5.89693 3.42801 5.98009 4.15814C6.06325 4.88827 6.39146 5.56866 6.91114 6.08828C7.43083 6.60789 8.11131 6.93605 8.84153 7.0192C9.57176 7.10235 10.3086 6.93558 10.9318 6.54611C11.1182 6.42966 11.3787 6.54394 11.3668 6.76329Z'/%3E%3C/svg%3E"); }
.ic-corner-down-right { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 13' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8.12484 10.8329L10.8329 8.12484L8.12484 5.41677M10.8329 8.12484H4.33355C3.75897 8.12484 3.20793 7.89659 2.80164 7.4903C2.39535 7.08401 2.1671 6.53297 2.1671 5.95839V2.1671'/%3E%3C/svg%3E"); }
.ic-chevron-down { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 15' fill='none' stroke='black' stroke-width='1.73' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.75 5.625L7.5 9.375L11.25 5.625'/%3E%3C/svg%3E"); }
.ic-clock-3 { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='1.62' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3.49972V7H9.33352M12.8338 7C12.8338 10.2219 10.2219 12.8338 7 12.8338C3.77808 12.8338 1.1662 10.2219 1.1662 7C1.1662 3.77808 3.77808 1.1662 7 1.1662C10.2219 1.1662 12.8338 3.77808 12.8338 7Z'/%3E%3C/svg%3E"); }
.ic-arrow-left-right { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.77' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3 4 7l4 4'/%3E%3Cpath d='M4 7h16'/%3E%3Cpath d='m16 21 4-4-4-4'/%3E%3Cpath d='M20 17H4'/%3E%3C/svg%3E"); }
.ic-flag-triangle-right { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.77' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 22V2l10 5-10 5'/%3E%3C/svg%3E"); }
.ic-history { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.77' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3Cpath d='M12 7v5l4 2'/%3E%3C/svg%3E"); }
.ic-triangle-alert { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.38' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.99999 4.49964V6.49964M5.99999 8.49964H6.00499M10.8652 8.99975L6.8652 1.99975C6.77798 1.84585 6.6515 1.71784 6.49866 1.62878C6.34582 1.53972 6.17209 1.4928 5.9952 1.4928C5.8183 1.4928 5.64458 1.53972 5.49174 1.62878C5.3389 1.71784 5.21242 1.84585 5.1252 1.99975L1.1252 8.99975C1.03704 9.15243 0.990812 9.3257 0.991202 9.502C0.991593 9.67831 1.03859 9.85137 1.12742 10.0037C1.21626 10.1559 1.34377 10.282 1.49705 10.3692C1.65032 10.4563 1.8239 10.5013 2.0002 10.4997H10.0002C10.1756 10.4996 10.348 10.4532 10.4998 10.3654C10.6517 10.2775 10.7778 10.1513 10.8655 9.99931C10.9531 9.84732 10.9992 9.67494 10.9992 9.49949C10.9991 9.32404 10.9529 9.15169 10.8652 8.99975Z'/%3E%3C/svg%3E"); }
.ic-lock { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.38' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 4.99992V3.4998C3.5 2.83671 3.76339 2.20077 4.23223 1.73189C4.70107 1.26301 5.33696 0.9996 6 0.9996C6.66304 0.9996 7.29893 1.26301 7.76777 1.73189C8.23661 2.20077 8.5 2.83671 8.5 3.4998V4.99992M3.5 4.99992H2.5C1.94772 4.99992 1.5 5.44767 1.5 6V10.0003C1.5 10.5526 1.94772 11.0004 2.5 11.0004H9.5C10.0523 11.0004 10.5 10.5526 10.5 10.0003V6C10.5 5.44767 10.0523 4.99992 9.5 4.99992H8.5M3.5 4.99992H8.5M6.5 8.00016C6.5 8.27632 6.27614 8.5002 6 8.5002C5.72386 8.5002 5.5 8.27632 5.5 8.00016C5.5 7.724 5.72386 7.50012 6 7.50012C6.27614 7.50012 6.5 7.724 6.5 8.00016Z'/%3E%3C/svg%3E"); }
.ic-ban { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.38' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.7 6C10.7 8.59574 8.59574 10.7 6 10.7C3.40426 10.7 1.3 8.59574 1.3 6C1.3 3.40426 3.40426 1.3 6 1.3C8.59574 1.3 10.7 3.40426 10.7 6Z'/%3E%3Cpath d='M2.7 2.7L9.3 9.3'/%3E%3C/svg%3E"); }
.ic-flag { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.38' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.0004 11.0004V7.76414M2.0004 7.76414V1.99968C2.0004 1.92205 2.01847 1.84549 2.05318 1.77606C2.08789 1.70662 2.13829 1.64623 2.20038 1.59965C2.71962 1.21015 3.35115 0.9996 4.0002 0.9996C5.50005 0.9996 6.49995 1.99968 7.66633 1.99968C8.33293 1.99968 8.84405 1.86634 9.19968 1.59965C9.27396 1.54393 9.36228 1.51 9.45475 1.50166C9.54722 1.49332 9.64019 1.5109 9.72323 1.55243C9.80628 1.59396 9.87612 1.6578 9.92493 1.73679C9.97375 1.81579 9.9996 1.90682 9.9996 1.99968V7.00008C9.9996 7.07771 9.98153 7.15427 9.94682 7.2237C9.91211 7.29314 9.86171 7.35353 9.79962 7.40011C9.28038 7.78961 8.64885 8.00016 7.9998 8.00016C6.49995 8.00016 5.50005 7.00008 4.0002 7.00008C3.26233 7.0001 2.55036 7.27212 2.0004 7.76414Z'/%3E%3C/svg%3E"); }
.ic-diamond { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.38' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.35054 5.14998C1.23852 5.26188 1.14966 5.39476 1.08903 5.54102C1.02841 5.68729 0.9972 5.84407 0.9972 6.0024C0.9972 6.16073 1.02841 6.31751 1.08903 6.46377C1.14966 6.61004 1.23852 6.74292 1.35054 6.85482L5.14518 10.6495C5.25708 10.7615 5.38996 10.8503 5.53622 10.911C5.68249 10.9716 5.83927 11.0028 5.9976 11.0028C6.15593 11.0028 6.31271 10.9716 6.45897 10.911C6.60524 10.8503 6.73812 10.7615 6.85002 10.6495L10.6447 6.85482C10.7567 6.74292 10.8455 6.61004 10.9062 6.46377C10.9668 6.31751 10.998 6.16073 10.998 6.0024C10.998 5.84407 10.9668 5.68729 10.9062 5.54102C10.8455 5.39476 10.7567 5.26188 10.6447 5.14998L6.85002 1.35534C6.73812 1.24332 6.60524 1.15446 6.45897 1.09383C6.31271 1.03321 6.15593 1.002 5.9976 1.002C5.83927 1.002 5.68249 1.03321 5.53622 1.09383C5.38996 1.15446 5.25708 1.24332 5.14518 1.35534L1.35054 5.14998Z'/%3E%3C/svg%3E"); }
.ic-circle { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.38' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.4 6C10.4 8.43005 8.43005 10.4 6 10.4C3.56995 10.4 1.6 8.43005 1.6 6C1.6 3.56995 3.56995 1.6 6 1.6C8.43005 1.6 10.4 3.56995 10.4 6Z'/%3E%3C/svg%3E"); }
.ic-square { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.38' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 1.5H9.5C10.0523 1.5 10.5 1.94772 10.5 2.5V9.5C10.5 10.0523 10.0523 10.5 9.5 10.5H2.5C1.94772 10.5 1.5 10.0523 1.5 9.5V2.5C1.5 1.94772 1.94772 1.5 2.5 1.5Z'/%3E%3C/svg%3E"); }
.ic-check { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.77' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
.ic-info { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.77' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E"); }
.muted { color: var(--ink-2); }
.small { font-size: 11px; }
.strong { font-weight: 600; }
.red { color: var(--danger); }
/* Small labels show in capitals, but are written in sentence case so a screen reader reads them as
   words rather than spelling them out. */
.k, .tree-h > span:first-child, .rt-h { text-transform: uppercase; }
.k { font-size: 10px; color: var(--ink-2); letter-spacing: 0.02em; }

/* ---------- Skip links ---------- */
/* The schedule's first Tab stops (views::page): out of sight until focused, then over the toolbar's
   top left corner. The detail panel's shows only while that panel is. */
.skip {
  position: fixed; z-index: 70; left: 16px; top: 8px; padding: 8px 12px; border-radius: 6px;
  background: var(--white); color: var(--accent); box-shadow: var(--shadow-pop); font-weight: 600;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }
body:not(:has(.workspace:not(.opt-open) > .detail.open)) .skip-detail,
body:has(.workspace.help-docked:not(.help-behind)) .skip-detail { display: none; }
body:not(:has(.workspace.help-docked)) .skip-help { display: none; }

/* ---------- Toolbar ---------- */
/* One row of view, date and plan controls, so the schedule gets the height. */
.toolbar {
  flex: none; display: flex; align-items: center; gap: 16px;
  height: 52px; padding: 0 24px; background: var(--white);
}
.actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.signout { display: flex; }
.signin-page { display: grid; place-items: center; min-height: 100vh; background: var(--white); }
.signin { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 24px; max-width: 360px; }
.signin .btn { text-decoration: none; }
/* Also styles the crew sub-rows (.row.sub). */
.sub { margin-top: 3px; color: var(--ink-2); }
.datenav { display: flex; align-items: center; gap: 8px; }
.winlabel { margin-left: 8px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.filters {
  flex: none; display: flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 24px;
  background: var(--white); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}

/* ---------- Notices ---------- */
.notices { flex: none; }
.notices .notice { height: 37px; white-space: nowrap; }
.stale-badge { display: inline-flex; align-items: center; gap: 5px; flex: none; color: var(--ink); font-size: 11px; }
.notice.loading {
  position: fixed; z-index: 30; left: 50%; top: 150px; transform: translateX(-50%);
  border: 1px solid var(--line); border-radius: 6px; background: var(--white);
  box-shadow: var(--shadow-pop);
  visibility: hidden; opacity: 0; transition: opacity 120ms, visibility 120ms;
}
/* As with .skeleton, visibility waits for the delay, so the notice never catches clicks unseen. */
body.busy .notice.loading { visibility: visible; opacity: 1; transition-delay: 250ms; }
.notice.loading .i { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Workspace ---------- */
/* The schedule keeps about three rows before the tray gives way: more room for the 90-day strip and
   for the plan key, which wraps when the detail panel narrows the board. */
.workspace { flex: 1 1 0; min-height: 328px; display: flex; gap: 16px; padding: 18px 24px 16px; }
.workspace:has(> .detail.open) { --tree-w: 322px; }
.workspace:has(.outlook) { min-height: 372px; }
.workspace:has(> .detail.open) { min-height: 348px; }
.workspace:has(> .detail.open):has(.outlook) { min-height: 392px; }
.board-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.ctx { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ctx-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ctx h2 { font-size: 13px; white-space: nowrap; }
.ctx .muted { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board {
  position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column;
  background: var(--white); border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
/* scroll-padding keeps a control the arrow keys focus clear of the sticky header (WCAG 2.4.11). */
.scroller { flex: 1; min-height: 0; overflow: auto; overflow-x: hidden; overscroll-behavior: contain; scroll-padding-top: 56px; }
.outlook .scroller { scroll-padding-top: 108px; }
.mkkey { flex: none; display: flex; gap: 24px; align-items: center; padding: 0 16px; color: var(--ink-2); font-size: 11px; }
.mkkey span { display: inline-flex; gap: 5px; align-items: center; }

/* Header: tree title and week columns. Sticky while the rows scroll. */
.hdr, .sumrow {
  position: sticky; z-index: 4; display: grid; grid-template-columns: var(--tree-w) 1fr;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.hdr { top: 0; height: 56px; color: var(--ink-2); }
.outlook .sumrow { top: 0; height: 68px; }
.outlook .hdr { top: 68px; height: 40px; }
.tree-h { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; font-size: 11px; border-right: 1px solid var(--line); }
.tree-h .n { font-size: 10px; }
/* minmax(0, 1fr): every row's week columns stay equal and line up with the header, whatever they hold. */
.weeks { display: grid; grid-template-columns: repeat(var(--weeks), minmax(0, 1fr)); }
.wk { display: flex; flex-direction: column; align-items: center; gap: 7px; padding-top: 8px; border-left: 1px solid var(--line); font-size: 11px; min-width: 0; }
.wk:first-child { border-left: 0; }
.outlook .wk { justify-content: center; padding-top: 0; }
.ticks { display: grid; grid-template-columns: repeat(7, 1fr); width: 100%; font-size: 9px; text-align: center; }
.cell.sum-def { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; padding: 0 16px; border-right: 1px solid var(--line); }
.cell.sum-def > * { grid-row: auto; }
.sum-def .t1 { font-size: 12px; }
.sum-def .t2 { font-size: 10px; color: var(--ink-2); }
.sum { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; overflow: hidden; border-left: 1px solid var(--line); background: var(--white); }
.sum:first-child { border-left: 0; }
.sum.short { background: var(--hatch-bg); }
/* Narrow weeks (90 days with the panel open) wrap the counts onto more lines; they are never cut. */
.sum b { padding: 2px 4px; border-radius: 3px; background: var(--white); font-size: 12px; font-weight: 700; line-height: 1.2; text-align: center; }
.sum span:not(.sr) { max-width: 100%; padding: 0 3px; overflow: hidden; text-overflow: ellipsis; background: var(--white); color: var(--ink-2); font-size: 9px; white-space: nowrap; }

/* ---------- Rows ---------- */
.rows { position: relative; }
.grp { content-visibility: auto; contain-intrinsic-size: auto 240px; }
.grp.collapsed > .row:not(:first-child) { display: none; }
.row { display: grid; grid-template-columns: var(--tree-w) 1fr; border-bottom: 1px solid var(--line); background: var(--white); }
.row.job, .row.crew { background-color: var(--surface); }
.row.job { height: 56px; }
.row.req { height: 46px; }
.row.alloc { height: 36px; }
.row.crew { height: 88px; }
.row.sub { height: 40px; }
.row.obs { height: 38px; }
.cell {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-content: center; align-items: center;
  column-gap: 8px; row-gap: 2px; min-width: 0;
  padding: 0 12px 0 14px; border-right: 1px solid var(--line); color: var(--ink-2);
}
.cell > :first-child { grid-row: 1 / span 3; align-self: center; }
.cell > :not(:first-child) { grid-column: 2; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-h { grid-template-columns: 1fr auto; }
.tree-h > :first-child { grid-row: auto; }
.tree-h > :not(:first-child) { grid-column: 2; }
.row.req .cell:focus-visible, .row.sub .cell:focus-visible { outline-offset: -2px; }
.row.req .cell, .row.sub .cell { padding-left: 31px; }
.row.alloc .cell { padding-left: 48px; }
.t1 { color: var(--ink); font-size: 12px; }
.row.job .t1, .row.crew .t1 { font-size: 13px; }
.t1.strong { font-weight: 500; }
.t2 { color: var(--ink-2); font-size: 10px; }
.t2 .blk, .t2 .ok, .t2 .unk { display: inline-flex; align-items: center; gap: 2px; }
.tog {
  display: grid; place-items: center; width: 24px; height: 24px; margin: 0 -5px;
  border: 0; border-radius: 4px; background: none; color: var(--ink-2); cursor: pointer;
}
.tog:hover { background: var(--line); }
/* On a touch screen the small controls that have room around them take a 44 px target (LABS-509)
   without growing, so the rows keep their height. */
@media (pointer: coarse) {
  .tog, .tour-foot .linkbtn { position: relative; }
  .tog::after, .lin-tog::after, .tour-foot .linkbtn::after {
    content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%);
  }
}
.tog .i { transition: transform 120ms; }
.grp.collapsed .tog .i { transform: rotate(-90deg); }
.tags { display: flex; gap: 4px; }
.tag { padding: 2px 5px; border: 1px solid var(--line); border-radius: 3px; background: var(--white); color: var(--ink-2); font-size: 9px; }
.pill {
  padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--white);
  color: var(--ink-2); font-size: 9px;
}
.row.ended .t1 { color: var(--ink-2); }

/* Timeline lane: week boundaries, weekend shading and the today line are backgrounds, not DOM. */
.lane {
  position: relative; min-width: 0;
  background:
    linear-gradient(to right, transparent calc(var(--today) - 0.75px), var(--accent) calc(var(--today) - 0.75px), var(--accent) calc(var(--today) + 0.75px), transparent calc(var(--today) + 0.75px)),
    linear-gradient(to right, var(--line) 1px, transparent 1px) 0 0 / calc(100% / var(--weeks)) 100%,
    var(--wkend-bg, linear-gradient(transparent, transparent));
}
.wkend .lane { --wkend-bg: linear-gradient(to right, transparent 71.4286%, var(--weekend) 71.4286%) 0 0 / calc(100% / var(--weeks)) 100%; }
/* One line, cut with an ellipsis at the lane's edge (left-placed notes also get an inline
   max-width up to the edge). app.js puts the full text in a tooltip when a note is cut. */
.lane-note {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: block; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis;
  color: var(--ink-2); font-size: 11px; white-space: nowrap;
}
.lane-note .ic { display: inline-block; vertical-align: -2px; margin-right: 5px; }
.row.alloc .lane-note, .row.obs .lane-note { font-size: 10px; }
.lane-note.at-start { left: 12px; }
.lane-note.at-end { right: 12px; }
.lane-note.stale { color: var(--ink); }
.row.job .lane-note { font-size: 10px; }

/* ---------- Bars: one style per state, never colour alone ---------- */
.bar, tr-bar {
  position: absolute; top: 8px; height: 30px;
  display: flex; align-items: center; gap: 5px; padding: 0 9px;
  border: 1px solid var(--ink-2); border-radius: 4px; overflow: hidden; z-index: 1;
  font-size: 11px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.row.crew .bar, .row.crew tr-bar { top: 12px; }
.bar .lbl { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bar.s-conf { background: var(--confirmed); border-color: var(--confirmed); color: var(--white); }
.bar.s-prop { background: var(--accent-weak); border-color: var(--accent); }
.bar.s-open, .bar.s-blocked, .bar.s-tent { background: var(--hatch-bg); background-color: var(--white); }
.bar.s-tent { border-style: dashed; }
.bar:not(.hard):is(.s-open, .s-blocked, .s-tent) .lbl { padding: 1px 4px; margin-left: -4px; border-radius: 3px; background: var(--white); }
.bar.s-blocked .i { position: relative; z-index: 1; background: var(--white); border-radius: 6px; }
/* A hard rule check is laid over the state (decision 41): after the state rules, so it wins their
   hatched background and dashed border at the same specificity. */
.bar.hard { background: var(--danger-weak); border: 2px solid var(--danger); color: var(--danger); }
.bar.strip { padding-bottom: 7px; }
.bar.strip::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 7px;
  background: var(--hatch-strip); border-top: 1px solid var(--white);
}
.bar.ghost { background: none; border: 1px dotted var(--ink-2); color: var(--ink-2); font-weight: 500; cursor: default; z-index: 0; }
.bar.ghost .lbl { background: var(--white); padding: 1px 4px; border-radius: 3px; }
/* Touch pans and zooms over a bar as anywhere else on the board: only a mouse drags one (app.js). */
.bar[data-drag] { cursor: grab; touch-action: manipulation; }
.bar.dragging { cursor: grabbing; z-index: 5; box-shadow: var(--shadow-lift); opacity: 0.92; }
.bar.saving { opacity: 0.6; }
.bar:hover:not(.ghost) { filter: brightness(0.97); }
.bar:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
/* A broken rule in words, as a white tag before the label (never colour alone). A hard one sits on the
   hard-check look in its colour; a soft one has an info icon and is readable on every bar state. */
.bar .badge {
  flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis;
  padding: 1px 5px; border-radius: 3px; background: var(--white); font-weight: 700; box-shadow: inset 0 0 0 1px currentColor;
}
.bar .badge.soft { color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line-strong); }
.bar .badge.soft .ic { margin-right: 3px; }

/* Rocket comparison bars (?bars=rocket): the host carries position and state; internals live in its shadow root. */
tr-bar { padding: 0; }
tr-bar[state="confirmed"] { background: var(--confirmed); border-color: var(--confirmed); color: var(--white); }
tr-bar[state="proposed"] { background: var(--accent-weak); border-color: var(--accent); }
tr-bar[state="open"], tr-bar[state="blocked"], tr-bar[state="tentative"] { background: var(--hatch-bg); }
tr-bar[state="tentative"] { border-style: dashed; }
tr-bar[hard] { background: var(--danger-weak); border: 2px solid var(--danger); color: var(--danger); }
tr-bar.ghost { background: none; border: 1px dotted var(--ink-2); color: var(--ink-2); cursor: default; z-index: 0; }
tr-bar[data-drag] { cursor: grab; touch-action: manipulation; }
tr-bar.dragging { cursor: grabbing; z-index: 5; box-shadow: var(--shadow-lift); }
tr-bar.saving { opacity: 0.6; }

/* Date markers on job rows and release flags on crew lanes. */
.mk {
  position: absolute; display: flex; flex-direction: column; gap: 3px;
  margin-left: -6px; color: var(--ink-2); cursor: default; z-index: 2;
}
.mk-sym { display: flex; align-items: center; gap: 4px; height: 16px; }
.mk-sym .q { color: var(--ink); font-size: 10px; font-weight: 700; }
.mk-l { font-size: 9px; white-space: nowrap; }
.mk.flip { align-items: flex-end; margin-left: 6px; transform: translateX(-100%); }
.mk.edge { margin-left: 0; }
.mk.flip .mk-sym { flex-direction: row-reverse; }
/* The symbol is 12 px; the target around it is 24 px square (WCAG 2.5.8), centred on the first
   symbol, which sits on the marker's day. */
.mk::before { content: ""; position: absolute; top: -4px; left: -6px; width: 24px; height: 24px; }
.mk.flip::before { left: auto; right: -6px; }
/* The panel narrows the lanes below what the labels were laid out for; symbols, tooltips and
   accessible names still carry every marker. */
.workspace:has(> .detail.open) .mk-l { display: none; }
.mk .tip { display: none; }
/* An activity's late finish often falls on its own bar: a chip keeps the symbol readable. */
.mk.late-finish .mk-sym { padding: 0 2px; border-radius: 3px; background: var(--white); }
.mk:focus-visible { box-shadow: none; outline-offset: 2px; border-radius: 2px; }
.idle.unknown { color: var(--ink); }
.idle .ic { display: inline-block; vertical-align: -2px; margin-right: 4px; }
.idle { position: absolute; z-index: 0; top: 18px; color: var(--ink-2); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track { position: absolute; top: 9px; height: 5px; background: var(--hatch); }
.track.miss { background: none; border: 1px dotted var(--ink-2); height: 7px; top: 8px; }
.histbar { position: absolute; top: 12px; height: 14px; border: 1px dashed var(--line); border-radius: 3px; background: var(--surface); }
.lane-note.obs-t { top: 4px; transform: none; }
#tooltip {
  position: fixed; z-index: 50; display: none; flex-direction: column; gap: 4px;
  max-width: 340px; padding: 12px; border-radius: 6px;
  background: var(--shell); color: var(--shell-ink-2); font-size: 10px;
  box-shadow: var(--shadow-pop);
}
#tooltip.on { display: flex; }
#tooltip .tip-h { color: var(--white); font-size: 11px; }

/* Legend */
.legend {
  position: relative; z-index: 7; background: var(--white);
  flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px;
  padding: 12px 16px; border-top: 1px solid var(--line); font-size: 10px;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 22px; height: 12px; border-radius: 2px; }
.key.k-open { background: var(--hatch-bg); }
.key.k-tent { border: 1px dashed var(--ink-2); }
.key.k-prop { background: var(--accent-weak); border: 1px solid var(--accent); }
.key.k-conf { background: var(--confirmed); }
.key.k-obs { height: 5px; border-radius: 1px; background: var(--hatch); }
.key.k-miss { height: 7px; border: 1px dotted var(--ink-2); border-radius: 0; }

/* Loading placeholders: shown over the rows while a slow request is in flight. Never look like bars. */
.skeleton {
  position: absolute; z-index: 6; left: 0; right: 0; top: 56px; bottom: 0;
  background: var(--white); visibility: hidden; opacity: 0; transition: opacity 120ms, visibility 120ms; overflow: hidden;
}
/* Visibility follows the delayed fade, so the overlay never catches clicks before it shows. The plan
   key sits above it, so no stale rows show between them whatever the key's height. */
.outlook .skeleton { top: 108px; }
body.busy .skeleton { visibility: visible; opacity: 1; transition-delay: 350ms; }
.skel-note { display: flex; align-items: center; gap: 8px; padding: 12px 16px; color: var(--ink-2); font-size: 11px; background: var(--surface); border-bottom: 1px solid var(--line); }
.skel-row { position: relative; height: 48px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: var(--tree-w) 1fr; }
.skel-t { align-self: center; height: 8px; width: 240px; margin-left: 16px; border-radius: 4px; background: var(--skeleton); box-shadow: 0 14px 0 -1px var(--skeleton-2); }
.skel-t.indent { margin-left: 42px; width: 180px; }
.skel-b { position: absolute; top: 20px; height: 8px; margin-left: var(--tree-w); border-radius: 4px; background: var(--skeleton); max-width: calc(100% - var(--tree-w)); }

/* Empty state */
.empty { display: grid; grid-template-columns: var(--tree-w) 1fr; min-height: 300px; }
.empty-plain { display: flex; gap: 8px; align-items: center; padding: 22px 20px; color: var(--ink-2); }
.empty-l { display: flex; flex-direction: column; gap: 16px; padding: 22px 20px; border-right: 1px solid var(--line); }
.empty-h { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink); }
.retained { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; }
.retained b { font-weight: 600; }
.empty-c { display: grid; place-items: start center; padding: 24px; }
.empty-card {
  display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 592px; padding: 28px 32px;
  text-align: center; border: 1px solid var(--line); border-radius: 8px; background: var(--white);
}
.empty-card h3 { font-size: 18px; }
.empty-card p { color: var(--ink-2); font-size: 13px; }
.empty-card p.small { font-size: 11px; }
.empty-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 22px; background: var(--surface); color: var(--ink-2); }
.btns { display: flex; gap: 8px; }

/* ---------- Detail panel ---------- */
.detail { display: none; }
/* The side panel's place on Schedule, and each panel that takes it. */
.detail.open, .optpanel, .workspace > .help-dialog:not(:modal) {
  flex: none; width: var(--side-w); background: var(--white); border: 1px solid var(--line); border-radius: 8px;
}
.detail.open { display: flex; flex-direction: column; overflow: auto; }
.detail.open > * { flex: none; }
.d-head { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.d-title-row { display: flex; align-items: center; justify-content: space-between; }
.d-title-row .k { font-size: 11px; }
.d-title { font-size: 20px; }
.d-stage { display: flex; align-items: center; gap: 8px; }
.d-stage b { font-weight: 600; font-size: 12px; }
.d-line { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.src { color: var(--ink-2); font-size: 10px; }
.mverr { color: var(--danger); font-size: 11px; }
.rt-r .other { display: block; }
em.prop { font-style: normal; color: var(--accent); font-size: 11px; }
.d-moved { display: flex; gap: 6px; align-items: center; color: var(--accent); font-size: 11px; }
.lockrow { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--accent); }
.lock-t { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.lock-t b { color: var(--ink); font-weight: 500; }
.lock-t span { color: var(--ink-2); font-size: 11px; }
.moveform, .editrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 4px; }
.moveform label, .editrow label { font-size: 11px; color: var(--ink-2); }
.moveform input, .editrow input { height: 36px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; }
.tabs { display: flex; gap: 24px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.tab { padding: 11px 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--ink-2); cursor: pointer; }
.tab.active { border-color: var(--accent); color: var(--accent); }
.d-sec { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.d-sec h3 { font-size: 14px; }
.d-sec h3.d-req { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.d-sec p { font-size: 12px; }
.d-sec p.small { font-size: 11px; }
.d-sec p.big { font-size: 14px; }
.d-sec .src { font-size: 10px; }
.d-sum { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.d-sum.left { justify-content: flex-start; }
.rtable { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.rt-h, .rt-r { display: grid; grid-template-columns: 116px 1fr 140px; gap: 10px; padding: 10px; }
.rt-h { background: var(--surface); font-size: 10px; }
.rt-r { border-top: 1px solid var(--line); font-size: 11px; }
.rt-r > span:first-child { font-size: 12px; }
.rt-r .names { display: block; }
.openrole {
  display: flex; align-items: center; height: 25px; margin-top: 5px; padding: 0 6px;
  background: var(--hatch-bg); font-weight: 600;
}
.openrole { color: var(--ink); text-shadow: 0 0 2px var(--white), 0 0 2px var(--white), 0 0 3px var(--white); }
.fresh { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 11px !important; }
.d-sec.gap { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.steps { display: flex; gap: 5px; padding: 8px 0; }
.step { flex: 1; display: flex; flex-direction: column; gap: 7px; color: var(--ink-2); font-size: 10px; }
.step i { height: 3px; background: var(--line); }
.step.done i, .step.now i { background: var(--accent); }
.step.now span { color: var(--accent); font-weight: 700; }
.d-checks .check { display: flex; gap: 6px; align-items: flex-start; }
.d-checks .check .i { flex: none; margin-top: 2px; }
.d-checks .check b { font-weight: 600; }
.d-facts { display: flex; flex-direction: column; gap: 8px; }
.d-facts > div { display: grid; grid-template-columns: 88px 1fr; gap: 10px; }
.d-list { display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.d-sec.hist { gap: 12px; }
.h-entry { display: flex; flex-direction: column; gap: 3px; }

/* ---------- Tray ---------- */
.tray { flex: none; min-height: 52px; display: flex; flex-direction: column; background: var(--white); border-top: 1px solid var(--line); }
.tray.open { flex: 0 1 auto; min-height: min(170px, 42vh); max-height: min(42vh, 320px); border-top: 2px solid var(--line); box-shadow: var(--shadow-up); }
.tray-h { flex: none; display: flex; align-items: center; justify-content: space-between; height: 52px; padding: 0 24px; }
.tray-t { display: flex; align-items: center; gap: 9px; }
.tray-t h2 { font-size: 13px; }
.tray .when-open { display: none; }
.tray.open .when-open { display: inline-flex; align-items: center; gap: 6px; }
.tray.open .when-closed { display: none; }
.when-closed { display: inline-flex; align-items: center; gap: 6px; }
.tray-preview { display: flex; gap: 24px; padding: 0 24px 14px; overflow: hidden; }
.tray.open .tray-preview { display: none; }
.prev { display: inline-flex; border: 0; background: none; padding: 0; color: var(--ink-2); font-size: 12px; white-space: nowrap; cursor: pointer; }
.prev span { display: inline-flex; align-items: center; gap: 5px; }
.tray-body { display: none; }
.tray.open .tray-body { display: flex; flex-direction: column; gap: 16px; overflow: auto; padding: 4px 24px 20px; }
.tray-body > * { flex: none; }
.mv-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.mv-head h3 { font-size: 18px; }
.sub-h { font-size: 13px; color: var(--ink-2); }
.decs { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
/* Findings (AI pairing PRD section 2): the browser orders the rows (`order`) for the sort control. */
.findings { display: flex; flex-direction: column; gap: 8px; }
.findings-h { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.findings-sort { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.findings-status { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.findings-rows { display: flex; flex-direction: column; }
.findings-rows:empty { display: none; }
.finding-slot { border-bottom: 1px solid var(--line); }
.finding-slot .dec { border-bottom: 0; }
.dec.finding { grid-template-columns: minmax(240px, 1fr) minmax(200px, 1fr); }
.dec.finding .dec-title { font-size: 12px; }
.dec.finding .dec-opts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.finding-changes { grid-column: 1 / -1; font-size: 11px; color: var(--ink-2); }
.finding-changes ul { margin: 4px 0 0 16px; }
.finding-reason { flex: 1 1 200px; height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; }
.dec-text .cleared { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); }
.dec {
  display: grid; grid-template-columns: 20px minmax(200px, 270px) 1fr 140px 110px; gap: 10px 16px; align-items: center;
  padding: 14px; border-bottom: 1px solid var(--line); background: var(--white);
}
.dec:last-child { border-bottom: 0; }
.dec.done { background: var(--surface); }
.chk { display: grid; place-items: center; width: 24px; height: 24px; margin: -2px; padding: 0; border: 0; background: none; color: var(--ink-2); cursor: pointer; }
.dec.done .chk { color: var(--accent); }
.dec-what { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dec-what b { font-weight: 400; font-size: 12px; cursor: pointer; }
.dec-what span { font-size: 10px; color: var(--ink-2); }
.dec-text { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--ink-2); }
.dec-text .i { margin-top: 2px; }
.dec-owner, .dec-act { display: flex; flex-direction: column; gap: 3px; }
.dec-owner .k, .dec-act .k { font-size: 9px; }
/* The date to act by is text, not a control: no button outline (WCAG 3.2.4). As tall as the owner
   menu beside it, so the two line up. */
.dec-date { display: inline-flex; align-items: center; gap: 7px; height: 36px; color: var(--ink); font-size: 12px; font-weight: 500; white-space: nowrap; }
.dec-owner select { height: 36px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--white); font-weight: 500; max-width: 140px; }
.dec-opts { grid-column: 2 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dec-opts .muted { font-size: 11px; }
/* A rule check: one line, since a window can hold a hundred of them. */
.dec.rule { grid-template-columns: 20px minmax(200px, 270px) 1fr auto auto; padding: 8px 14px; }
.dec.rule .dec-owner select { height: 28px; }
.dec.rule .dec-text { display: block; }
.dec-acts { display: flex; gap: 6px; }
.tray-body .more { margin-top: -8px; font-size: 11px; }
.flash-slot { flex: none; padding: 0 24px 12px; }
/* With a save message the open tray keeps room for the list. A decision leaves the message in place
   (POST /decide patches only the list), so the tray does not change size under the pointer. */
.tray.open:has(#flash .flash) { min-height: min(240px, 42vh); }
.flash-slot:empty, .tray:not(.open) .flash-slot { padding: 0; }
.tray:not(.open) .flash-slot > * { display: none; }
.flash { display: flex; gap: 16px; }
.linkbtn.dec-title { color: var(--ink); font-size: 12px; text-align: left; }
.linkbtn.dec-title:hover { text-decoration: underline; }
.ok-card, .err-card, .note-card { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px; border-radius: 6px; }
.ok-card { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 10px; background: var(--accent-weak); }
.ok-h { display: flex; align-items: center; gap: 7px; color: var(--accent); font-size: 14px; }
/* One heading line, then the detail and its button side by side, so the card stays short. */
.err-card { flex: 1; flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 12px; background: var(--danger-weak); border: 1px solid var(--danger); }
.err-card .err-h { flex-basis: 100%; }
.err-h { color: var(--danger); font-size: 13px; font-weight: 600; }
.note-card { flex: 1; background: var(--surface); border: 1px solid var(--line); }
.note-card p { display: flex; gap: 8px; align-items: center; }

/* ---------- Footer ---------- */
.foot {
  flex: none; display: flex; justify-content: space-between; gap: 16px;
  padding: 13px 24px; color: var(--ink-2); font-size: 11px;
  background: var(--surface); border-top: 1px solid var(--line);
}
.foot .dev { color: var(--ink-3); }
.foot a { color: var(--accent); }

@media (max-width: 1280px) {
  :root { --tree-w: 320px; --side-w: 440px; }
  .workspace:has(> .detail.open) { --tree-w: 260px; }
  kbd { display: none; }
  .toolbar { gap: 12px; }
  .winlabel { margin-left: 4px; }
  /* Shorter toolbar labels, so the one row fits down to the 1024px minimum. */
  .toolbar .wide, .toolbar .seg .i { display: none; }
}
/* Short laptop screens: tighter page chrome, so the schedule keeps about three rows with the tray open. */
@media (max-height: 860px) {
  .toolbar { height: 48px; }
  .filters { height: 48px; }
  .workspace { padding: 12px 24px 10px; min-height: 296px; }
  .tray.open { min-height: min(150px, 42vh); }
  .workspace:has(.outlook) { min-height: 340px; }
  .workspace:has(> .detail.open) { min-height: 316px; }
  .workspace:has(> .detail.open):has(.outlook) { min-height: 360px; }
  .board-wrap { gap: 8px; }
  .legend { padding: 6px 16px; }
  .foot { padding: 8px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  /* Keep transition delays (they stop the loading overlay flashing on fast requests); drop the motion. */
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
}

/* Error and status toast for requests that fail outside the tray (network, server error). */
/* #toast is on every page, empty until it has something to say: hidden by clipping rather than
   display: none, so it stays a live region (app.js toast). */
#toast {
  position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: min(560px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 6px;
  background: var(--shell); color: var(--white); font-size: 12px; box-shadow: var(--shadow-lift);
}
#toast:not(.on) { width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); box-shadow: none; }
#toast.error { background: var(--danger-weak); color: var(--danger); border: 1px solid var(--danger); font-weight: 600; }
#toast button { flex: none; padding: 4px 10px; border: 1px solid currentColor; border-radius: 4px; background: none; color: inherit; font: inherit; cursor: pointer; }

/* ---------- Navigation ---------- */
/* Schedule · Risk · Workforce (ui::PageNav, styled in moss.css). */
/* The links take about 240 px of the toolbar's one row, and the row still fits down to the 1024 px
   minimum (measured with Chromium at each breakpoint, for a 6-week window and for a 90-day one
   across a new year, the longest label). Below 1540 px the view and horizon controls and the
   review button drop their icons and long words, as they did below 1280 px before; below 1350 px
   the gaps tighten and Confirm drops "changes". Below 1215 px the window label hides (the weeks
   show the dates; screen readers still hear it) and the view buttons show their icons instead of
   their words. The window label is the one item that gives way, so where a label across a new year
   is still too long (1215–1254 px) it ends in an ellipsis, with the whole label as its title,
   rather than push the actions off. */
.datenav { min-width: 0; }
.winlabel { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1540px) {
  .toolbar .seg .wide, #review .wide, .toolbar .seg .i { display: none; }
}
@media (max-width: 1350px) {
  .toolbar { gap: 8px; }
  .toolbar .wide { display: none; }
}
@media (max-width: 1214px) {
  .winlabel, .toolbar .seg .word {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .toolbar .seg .i { display: inline; }
}
/* The risk and workforce pages: a heading, then the region their routes patch. */
.page { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 18px 24px 24px; border-top: 1px solid var(--line); }
.page h1 { font-size: 16px; font-weight: 600; }
/* Risk and Workforce (page::tool_page) are laid out for phones too, where the header's page links, Help,
   tour and avatar do not fit one row: they wrap. */
@media (max-width: 640px) {
  .tool-page .toolbar { height: auto; flex-wrap: wrap; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
}
/* The optimizer panel beside the detail panel takes no room until a run fills it. */
.optpanel:empty { display: none; }

/* ---------- Crew fatigue ---------- */
/* By crew rows: the crew name, then its latest fatigue score (PRD 6.1). The name gives way first.
   Ink colours only: the words and icons carry the state. */
.crew-t { display: flex; align-items: baseline; gap: 10px; }
.crew-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fatigue { flex: none; display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 11px; }
.fatigue.high { color: var(--ink); font-weight: 600; }
.fatigue .ic { width: 12px; height: 12px; }

/* ---------- Charts ---------- */
/* Server-rendered charts for the risk and workforce pages (src/views/charts.rs), after the dataviz
   guidance. x is a percentage of the plot and y is in px, so a chart fills its container and its text
   keeps its size; each figure sets its margins in --l and --r. /catalog inlines this section.
   The series colours pass the dataviz palette validator on white, adjacent and all pairs (worst CVD
   ΔE 9.2, normal vision 26.3). --series-3 is 2.82:1 on white, so it always has a direct label and the
   table. Text never wears a series colour; status marks use --danger with an icon and a word. */
:root {
  --series-1: var(--moss-blue-600); /* #0368c1, the same as --accent */
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-muted: var(--moss-gray-600); /* baselines and context: 3:1 or more on white, and dashed */
  --chart-grid: var(--moss-gray-200);
  --chart-axis: var(--moss-gray-300);
  --chart-bg: var(--white); /* the surface behind marks: their 2 px rings and the halo behind labels */
  --chart-hover: rgba(3, 104, 193, 0.07);
}
.chart { display: flex; flex-direction: column; gap: 8px; min-width: 0; margin: 0; }
.s1 { --sc: var(--series-1); }
.s2 { --sc: var(--series-2); }
.s3 { --sc: var(--series-3); }
.sb { --sc: var(--series-muted); }
.ch-cap { display: flex; flex-direction: column; gap: 2px; }
.chart .ch-title { margin: 0; color: var(--ink); font: 600 13px/1.3 var(--font-sans); text-transform: none; }
.ch-sub { color: var(--ink-2); font-size: 11px; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; color: var(--ink-2); font-size: 11px; }
.ch-legend li { display: inline-flex; align-items: center; gap: 6px; }
.ch-key { width: 16px; height: 2px; border-radius: 1px; background: var(--sc); }
.ch-key.box { width: 10px; height: 10px; border-radius: 2px; }
.ch-empty { padding: 24px 0; color: var(--ink-2); }

/* The plot: the SVG between its margins, row labels in the left one, and hit targets over the marks. */
.ch-plot { position: relative; container-type: inline-size; }
.ch-svg { display: block; overflow: visible; width: calc(100% - var(--l) - var(--r)); margin-left: var(--l); }
.ch-svg text { fill: var(--ink-2); font: 400 11px var(--font-sans); font-feature-settings: "tnum" 1; }
.ch-svg .ch-ty { text-anchor: end; }
.ch-svg .ch-tx, .ch-svg .ch-xtitle { text-anchor: middle; }
.ch-svg .ch-ytitle, .ch-svg .ch-xtitle { fill: var(--ink-3); }
.ch-svg .ch-val, .ch-svg .ch-mk-l, .ch-svg .ch-end-v, .ch-svg .ch-zero-l { fill: var(--ink); font-weight: 600; }
.ch-svg .ch-note { fill: var(--ink-2); }
/* Labels over marks keep a ring of the surface, so a line through them never cuts the text. */
.ch-halo { paint-order: stroke; stroke: var(--chart-bg); stroke-width: 3px; stroke-linejoin: round; }
/* The denser label set replaces the sparser one on a plot 600 px wide or more, where line end
   labels also show their last value and take a wider right margin (--rw). The plot is the container,
   not the figure: containment would keep a figure in small multiples from sharing rows with the
   charts beside it. */
.ch-w { display: none; }
@container (min-width: 600px) {
  .ch-w { display: inline; }
  .ch-n { display: none; }
  .ch-svg { width: calc(100% - var(--l) - var(--rw, var(--r))); }
  .ch-hits { right: var(--rw, var(--r)); }
}
.ch-grid, .ch-axis, .ch-mk, .ch-zero { stroke-width: 1px; shape-rendering: crispEdges; }
.ch-grid { stroke: var(--chart-grid); }
.ch-axis { stroke: var(--chart-axis); }
.ch-mk { stroke: var(--ink-2); }
.ch-zero { stroke: var(--ink-3); }
/* Columns: at most 24 px wide, 2 px apart, centred in their bin (--cx, --cw). Browsers without CSS
   geometry for SVG keep the x and width attributes. */
.ch-col {
  fill: var(--series-1);
  x: calc(var(--cx) - min(12px, var(--cw) / 2 - 1px));
  width: max(1px, min(24px, calc(var(--cw) - 2px)));
}
.ch-bar { fill: var(--series-1); }
.ch-line { fill: none; stroke: var(--sc); stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; }
/* A baseline is dashed, so it differs from the series by more than its colour (WCAG 1.4.1). */
.ch-line.sb { stroke-dasharray: 6 4; stroke-linecap: butt; }
.ch-key.sb { background: repeating-linear-gradient(to right, var(--sc) 0 6px, transparent 6px 10px); }
.ch-end, .ch-dot { fill: var(--sc, var(--series-1)); stroke: var(--chart-bg); stroke-width: 4px; paint-order: stroke; }
.ch-dot.open { fill: var(--chart-bg); stroke: var(--series-1); stroke-width: 2px; }
.ch-whisk { stroke: var(--series-1); stroke-width: 2px; }
.ch-whisk-end { stroke: var(--series-1); stroke-width: 1.5px; }
.ch-lead { stroke: var(--ink-3); stroke-width: 1px; }
.ch-rows { position: absolute; top: 0; left: 0; width: calc(var(--l) - 8px); }
.ch-rl {
  position: absolute; left: 0; right: 0; height: 16px; overflow: hidden;
  color: var(--ink); font-size: 12px; line-height: 16px; white-space: nowrap; text-overflow: ellipsis;
}
.ch-hits { position: absolute; left: var(--l); right: var(--r); }
.ch-hits.rows { left: 0; right: 0; }
.ch-hit { position: absolute; top: 0; height: 100%; border-radius: 2px; }
.ch-hits.rows .ch-hit { left: 0; right: 0; }
.ch-hit:hover, .ch-hit:focus-visible { background: var(--chart-hover); }
.ch-hits[data-lines] { cursor: crosshair; }
/* The line crosshair: charts.js moves it to the nearest x and shows it. */
.ch-xh { visibility: hidden; pointer-events: none; }
.ch-xh.on { visibility: visible; }
.ch-xh line { stroke: var(--ink-2); stroke-width: 1px; }
.ch-xh circle { fill: var(--sc); stroke: var(--chart-bg); stroke-width: 4px; paint-order: stroke; }
.ch-left-out { margin: 2px 0 0; color: var(--ink-2); font-size: 11px; }
/* Small multiples: each chart spans four rows of the grid (caption, legend, plot, table) and lays its
   parts in them, so plots side by side start at one height even when one chart has a sub-line or a
   legend that wraps. The 8 px row gap is the gap inside a chart; charts below keep 24 px. */
.ch-multiples { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 8px 32px; }
.ch-multiples > .chart { display: grid; grid-row: span 4; grid-template-rows: subgrid; align-content: start; margin-bottom: 16px; }
.ch-multiples > .chart > .ch-cap { grid-row: 1; }
.ch-multiples > .chart > .ch-legend { grid-row: 2; }
.ch-multiples > .chart > .ch-plot, .ch-multiples > .chart > .ch-empty { grid-row: 3; }
.ch-multiples > .chart > .ch-table { grid-row: 4; }

/* The table toggle: every plotted value, and the keyboard path through them. */
.chart .ch-table > summary { width: max-content; color: var(--accent); font-size: 11px; cursor: pointer; }
.ch-tw { max-height: 320px; margin-top: 6px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ch-tw table { width: 100%; border-collapse: collapse; font-size: 11px; }
.ch-tw th, .ch-tw td { padding: 4px 10px; border-bottom: 1px solid var(--moss-gray-100); text-align: left; font-weight: 400; white-space: nowrap; }
.ch-tw td { text-align: right; font-feature-settings: "tnum" 1; }
.ch-tw thead th, .ch-tw .ch-tg th { background: var(--surface); color: var(--ink-2); font-weight: 600; }
.ch-tw thead th { position: sticky; top: 0; }

/* One tooltip for every chart, fed by charts.js from data-tip or the crosshair's data. */
#chart-tip {
  position: fixed; z-index: 50; display: none; flex-direction: column; gap: 3px;
  max-width: 280px; padding: 10px 12px; border-radius: 6px;
  background: var(--shell); color: var(--shell-ink-2); font-size: 11px; box-shadow: var(--shadow-pop);
}
#chart-tip.on { display: flex; }
#chart-tip.follow { pointer-events: none; }
#chart-tip .ch-tip-v { color: var(--white); font-size: 13px; font-weight: 600; }
#chart-tip .ch-tip-row { display: flex; align-items: baseline; gap: 6px; }
#chart-tip .ch-tip-row .ch-tip-v { font-size: 12px; }
#chart-tip .ch-tip-key { flex: none; align-self: center; width: 12px; height: 2px; background: var(--sc); }

/* Figures that are a number, not a plot. Big numbers use proportional figures. */
.ch-meter { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; }
.ch-meter-track { position: relative; flex: none; width: 96px; height: 8px; border-radius: 2px; background: var(--moss-blue-100); overflow: hidden; }
.ch-meter-fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 0 4px 4px 0; background: var(--series-1); }
.ch-meter.alert .ch-meter-track { background: var(--moss-red-100); }
.ch-meter.alert .ch-meter-fill { background: var(--danger); }
.ch-meter-n { min-width: 32px; color: var(--ink); font-weight: 600; }
.ch-meter-alert { display: inline-flex; align-items: center; gap: 4px; color: var(--danger); font-weight: 600; }
.ch-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ch-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--white); }
.ch-stat-l, .ch-stat-s { color: var(--ink-2); font-size: 11px; }
.ch-stat-v { color: var(--ink); font-size: 22px; font-weight: 600; line-height: 1.2; font-feature-settings: "tnum" 0, "cv11" 1; }
.ch-hero { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.ch-hero-l { color: var(--ink-2); font-size: 12px; }
.ch-hero-v { color: var(--ink); font-size: 48px; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; font-feature-settings: "tnum" 0, "cv11" 1; }
.ch-hero-s { max-width: 560px; color: var(--ink-2); font-size: 13px; }

/* ---------- Risk ---------- */
/* The risk and hiring page (src/views/risk.rs): the settings row, then the region a sweep patches.
   It works down to a phone's width. While a sweep runs the
   last result stays in place, dimmed, and the settings row says so; both wait 250 ms, like the
   schedule's loading notice, so a kept result never flashes. With no result (.none) there is nothing
   to dim: the row says so at once, and the region's own sentences give way to it. It says so only
   while a request is on its way (body.busy, which a request waiting to retry clears, and a new sweep
   sets again). A region with no result says "Press Run" until a sweep ends without an answer, when
   app.js marks it .unanswered and it says that instead. */
.risk-set { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.risk-field { display: flex; align-items: center; gap: 8px; }
.risk-k { color: var(--ink-2); font-size: 11px; }
.risk-running {
  display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2);
  visibility: hidden; opacity: 0; transition: opacity 120ms, visibility 120ms;
}
.risk-running .i { animation: spin 0.9s linear infinite; }
body.busy .risk-running { visibility: visible; opacity: 1; transition-delay: 250ms; }
body.busy .risk-set:has(+ .risk-result.none) .risk-running { transition-delay: 0s; }
/* A running sweep's progress (AI pairing PRD decision 41): the chart meter's track, and the count.
   It holds only its screen-reader text while no sweep runs. */
.risk-progress { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.risk-count { font-variant-numeric: tabular-nums; }
.risk-result { display: flex; flex-direction: column; gap: 24px; min-width: 0; transition: opacity 120ms; }
body.busy .risk-result:not(.none) { opacity: 0.5; transition-delay: 250ms; }
body.busy .risk-result.none > * { visibility: hidden; }
.risk-none { color: var(--ink-2); }
.risk-message { display: flex; align-items: center; gap: 8px; color: var(--danger); font-weight: 600; }
.risk-result.none:not(.unanswered) > .risk-message, .risk-result.unanswered > .risk-none { display: none; }
/* A stale result (the plan has moved on since its sweep) stays, dimmed, under the sentence that says so. */
.risk-result.stale > :not(.risk-stale) { opacity: 0.5; }
.risk-stale { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; }
/* Held work (PRD decision 44): the work a sweep left out, above the headline in the warning style and
   never collapsed, each requirement a link to it on the Schedule. A held job's row in "Jobs at risk"
   reads "Held" in the same colour. */
.risk-held {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px;
  border: 1px solid var(--danger); border-radius: var(--radius-md); background: var(--danger-weak); color: var(--ink);
}
.risk-held-t { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-weight: 600; }
.risk-held-t .i { flex: none; margin-top: 2px; color: var(--danger); }
.risk-held ul { display: flex; flex-direction: column; gap: 4px; margin: 0; padding-left: 23px; }
.risk-held a { color: var(--accent); }
.risk-heldrow strong { color: var(--danger); }
/* What the result is for: "180 days, Oct 23 to Apr 20, 2027 · Weather as seeded · With proposed changes". */
.risk-scope { display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; color: var(--ink-2); }
.risk-scope > span + span::before { content: "·"; padding: 0 8px; }
.risk-scope > .risk-changed { display: inline-flex; align-items: center; gap: 5px; margin-left: 16px; color: var(--ink); font-weight: 600; }
.risk-scope > .risk-changed::before { content: none; }
/* The hero, then the stat tiles across the width: five in a row at 1280 px, two at 375 px. A tile is
   never narrower than its value on one line: the widest, a date like "May 30, 2027", is 146 px at the
   tiles' 22 px and 133 px at the 20 px of a phone, inside 30 px of padding and border. */
.risk-kpis { display: flex; flex-direction: column; gap: 16px; }
.risk-kpis .ch-stats { grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); }
.risk-about {
  display: flex; flex-direction: column; gap: 6px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--white);
}
.risk-about-t { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--ink-2); }
.risk-about-t strong { color: var(--ink); font-weight: 600; }
.risk-assume > summary { width: max-content; color: var(--accent); font-size: 11px; cursor: pointer; }
.risk-assume ul { display: flex; flex-direction: column; gap: 4px; max-width: 880px; margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); }
/* Sections that are tables rather than charts, headed like a chart. */
.risk-jobs, .risk-one { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.risk-head { display: flex; flex-direction: column; gap: 2px; }
.risk-h { margin: 0; color: var(--ink); font: 600 13px/1.3 var(--font-sans); }
.risk-sub { color: var(--ink-2); font-size: 11px; }
.risk-jobs > .linkbtn { align-self: flex-start; }
/* A wide table scrolls in its own box at narrow widths; the box is in the tab order for the arrow keys. */
.risk-tw { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--white); }
.risk-tw table { width: 100%; border-collapse: collapse; }
.risk-tw th, .risk-tw td { padding: 7px 12px; border-top: 1px solid var(--line); text-align: left; font-weight: 400; white-space: nowrap; }
.risk-tw thead th { border-top: 0; background: var(--surface); color: var(--ink-2); font-size: 11px; font-weight: 600; }
/* A long job or candidate name wraps before the numbers beside it go out of view. */
.risk-tw tbody th { min-width: 160px; white-space: normal; }
.risk-tw .n { text-align: right; }
.risk-jn { font-weight: 600; }
@media (max-width: 640px) {
  body:has(#risk-result) .toolbar, body:has(#risk-result) .page { padding-left: 16px; padding-right: 16px; }
  .risk-kpis .ch-stats { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
  .risk-kpis .ch-stat-v { font-size: 20px; }
}

/* ---------- Workforce ---------- */
/* The workforce sandbox (src/views/workforce.rs): one row of scenario controls, then the flags, the
   small multiples and the engine's assumptions. The page works down to a phone's width. */
.wf-lead { max-width: 720px; color: var(--ink-2); }
.wf-controls {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--white);
}
/* Label and value on one line, the slider under them. The value text is the input's aria-valuetext.
   Six controls and Reset share one row from about 1200 px; narrower, they wrap. */
.wf-ctl { flex: 1 1 136px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px 8px; min-width: 0; }
.wf-ctl label { color: var(--ink-2); font-size: 11px; }
.wf-v { color: var(--ink); font-weight: 600; white-space: nowrap; }
.wf-ctl input[type="range"] { grid-column: 1 / -1; width: 100%; height: 24px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.wf-controls > .btn { flex: none; }
.wf-hint { flex-basis: 100%; color: var(--ink-3); font-size: 11px; }
/* While the charts scroll under them on a large screen, the controls stay in reach: only where the six
   sliders and Reset fit one row, so the bar is 115 px tall. The page keeps that height and a 16 px gap
   free at the top when it scrolls an element into view (the root is the scroller), so a focused Table
   is never under the bar (WCAG 2.4.11). */
@media (min-width: 1200px) and (min-height: 700px) {
  .wf-controls { position: sticky; top: 0; z-index: 10; }
  html:has(#wf-result) { scroll-padding-top: 132px; }
}
.wf-result { display: flex; flex-direction: column; gap: 16px; min-width: 0; transition: opacity 120ms; }
/* A slow answer keeps the last result on screen, dimmed, never a skeleton. */
body.busy .wf-result { opacity: 0.6; transition-delay: 250ms; }
/* The flags' live region stays in the page when there are none, without its gap. */
.wf-flags { display: flex; flex-direction: column; gap: 8px; }
.wf-flags:empty { margin-bottom: -16px; }
.wf-flag .notice, .opt-flag .notice { align-items: flex-start; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--white); color: var(--ink); }
.wf-flag .notice .i, .opt-flag .notice .i { margin-top: 1px; }
.wf-flag strong, .opt-flag strong { font-weight: 600; }
.wf-flag.danger .notice { border-color: var(--danger); background: var(--danger-weak); }
.wf-flag.danger .notice .i { color: var(--danger); }
.wf-flag.info .notice .i { color: var(--accent); }
.wf-hires { color: var(--ink-2); }
.wf-assume { max-width: 880px; }
.wf-assume h2 { font-size: 13px; font-weight: 600; }
.wf-assume ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 11px; }
.wf-assume li + li { margin-top: 2px; }
@media (max-width: 600px) {
  body:has(#wf-result) .toolbar, body:has(#wf-result) .page { padding-left: 16px; padding-right: 16px; }
}

/* ---------- Optimizer ---------- */
/* The optimizer panel (src/views/optimize.rs) takes the detail panel's place while it is open
   (.opt-open on the workspace, from $opt.open): the same width, and the board narrows the same way.
   The detail panel keeps its requirement underneath and comes back when the optimizer closes. The
   panel's body scrolls; its header and its actions stay in view. */
.workspace.opt-open > .detail { display: none; }
.workspace:not(.opt-open) > .optpanel { display: none; }
.workspace:is(.opt-open, .help-docked) { --tree-w: 322px; min-height: 348px; }
.workspace:is(.opt-open, .help-docked) .mk-l { display: none; }
.optpanel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.opt-head {
  order: -1; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px 10px 20px; border-bottom: 1px solid var(--line);
}
.opt-head h2 { font-size: 16px; font-weight: 600; }
.opt-body { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 16px; padding: 16px 20px 20px; }
.opt-body > * { flex: none; }
.opt-foot { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface); }
/* A sentence alone leads the region (it is announced first) and shows under the header. */
.optpanel > p:first-child { flex: 1 1 auto; padding: 16px 20px; }
.opt-lede { color: var(--ink-2); }
.opt-hint { color: var(--ink-2); font-size: 11px; }
.opt-loading { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.opt-loading .i { animation: spin 0.9s linear infinite; }

/* The settings: a label over each control, the unit after each number. */
.opt-field { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.opt-l { color: var(--ink); font-size: 11px; font-weight: 600; }
.opt-num { display: inline-flex; align-items: center; gap: 8px; }
.opt-num input { width: 72px; height: 36px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--white); }
.opt-unit { color: var(--ink-2); font-size: 11px; }

/* A run: its progress, how it ended, and the settings it used. */
.opt-progress { display: flex; flex-direction: column; gap: 8px; }
.opt-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.opt-status .muted { font-size: 12px; font-weight: 400; }
.opt-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 11px; }
.opt-facts > div { display: contents; }
.opt-facts dt { color: var(--ink-2); }
.opt-facts dd { margin: 0; }

/* The cost of each objective term before and after the run. */
.opt-costs { width: 100%; border-collapse: collapse; font-size: 11px; }
.opt-costs caption { padding-bottom: 6px; color: var(--ink-2); text-align: left; }
.opt-costs th, .opt-costs td { padding: 5px 8px; border-bottom: 1px solid var(--line); font-weight: 400; text-align: right; white-space: nowrap; }
.opt-costs thead th { background: var(--surface); color: var(--ink-2); font-weight: 600; }
.opt-costs th:first-child { text-align: left; }
.opt-costs tfoot th, .opt-costs tfoot td { border-bottom: 0; font-weight: 600; }
.opt-notes h3, .opt-props h3 { font-size: 13px; font-weight: 600; }
.opt-notes ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 11px; }

/* The proposals, by job: a check box, what it does, its cost change, and a badge for confirmed work. */
.opt-props { display: flex; flex-direction: column; gap: 8px; }
.opt-props-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.opt-props-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.opt-props-tools .linkbtn { font-size: 12px; }
.opt-job { margin: 6px 0 0; font-size: 12px; font-weight: 600; }
.opt-picks { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 6px; }
.opt-picks li + li { border-top: 1px solid var(--line); }
.opt-pick { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 10px; cursor: pointer; }
.opt-pick:hover { background: var(--surface); }
.opt-pick input { width: 14px; height: 14px; margin: 1px 0 0; accent-color: var(--accent); }
.opt-pick-t { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.opt-pick-t .muted { font-size: 11px; }
.opt-pick-c { font-weight: 600; white-space: nowrap; }

/* The preview's notice ends with "Stop preview". */
.notices .notice .linkbtn { flex: none; font-size: 12px; }
/* By crew, confirmed work a shown proposal takes off the crew has a row under the crew's lane
   (board.rs, `taken_rows`): its words in the cell, and a ghost bar in the work's place, centred in
   the row, which opens that work as the crew's bars do. */
.row.taken .bar, .row.taken tr-bar { top: 5px; }
.bar.ghost[data-open], tr-bar.ghost[data-open] { cursor: pointer; }

/* The Optimize button takes about 90 px of the toolbar's one row, so the steps that make room come
   sooner: the view and horizon controls and the review button drop their icons and long words below
   1640 px instead of 1541 px, and the window label hides below 1400 px instead of 1215 px (the
   weeks show the dates; screen readers still hear it). Measured with Chromium as in "Navigation":
   a 90-day label across a new year still ends in an ellipsis from 1400 to 1439 px. */
@media (min-width: 1541px) and (max-width: 1639px) {
  .toolbar .seg .wide, #review .wide, .toolbar .seg .i { display: none; }
}
@media (max-width: 1399px) {
  .winlabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* Below 1100 px the schedule toolbar's buttons also take less padding, so every one stays whole at
   1024 px. Only the schedule's (the toolbar with the date navigation): the risk and workforce
   toolbars have room, and their page links keep their padding. */
@media (max-width: 1099px) {
  .toolbar:has(.datenav) .btn, .toolbar:has(.datenav) .btn.icon-only { padding: 0 8px; }
}

@media (max-width: 1280px) {
  .workspace:is(.opt-open, .help-docked) { --tree-w: 260px; }
}
@media (max-height: 860px) {
  .workspace:is(.opt-open, .help-docked) { min-height: 316px; }
}
/* Beside the optimizer panel the board's header is narrow, and with nothing selected its hint is
   long: the title, stage chip and count keep their room, and the hint ends in an ellipsis (it is
   still in the page for screen readers). */
.workspace.opt-open .ctx-l { flex: none; }
.workspace.opt-open .ctx-r { min-width: 0; }

/* The tray's decisions wait while the board previews a run (their controls are disabled, and the
   preview's notice says so). */
.tray .dec .chk:disabled { cursor: not-allowed; opacity: 0.5; }

/* Onboarding tour (src/views/tour.rs, traction.tour in app.js). The dialog covers the window and draws
   nothing itself: the spotlight's shadow dims the page around the step's target, and the card sits
   beside it. A step without a target dims the whole page. */
#tour {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: none; color: var(--ink);
  overflow: hidden; overscroll-behavior: contain;
}
#tour::backdrop { background: none; }
#tour.bare { background: var(--scrim); }
#tour [hidden], #tour.bare .tour-spot { display: none; }
.tour-spot {
  position: absolute; border-radius: var(--radius-lg); box-shadow: 0 0 0 100vmax var(--scrim);
  transition: var(--motion-fast) var(--motion-ease); transition-property: left, top, width, height;
}
.tour-card {
  position: absolute; width: 320px; display: flex; flex-direction: column; gap: 6px; padding: 16px;
  background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lift);
}
.tour-n { color: var(--ink-3); font-size: 11px; }
.tour-step h2 { font-size: 14px; font-weight: 600; }
.tour-step p { margin-top: 6px; color: var(--ink-2); line-height: 1.5; }
/* Why the step's press brought nothing, as the page words it (app.js). */
.tour-why { color: var(--danger); font-weight: 600; line-height: 1.5; }
.tour-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.tour-foot .linkbtn { margin-right: auto; }
/* A callout step (the Traction assistant's): a chip in its heading, on a line of its own over the
   title, and the accent colour on the card's top edge and around the spotlight. */
.tour-step.callout .chip { display: flex; width: fit-content; margin-bottom: 8px; }
#tour:has(.tour-step.callout:not([hidden])) .tour-card { border-top: 3px solid var(--accent); }
#tour:has(.tour-step.callout:not([hidden])) .tour-spot { outline: 2px solid var(--accent); }

/* Detail panel edits (decision 28): a gate's date and workaround, an assignment's productivity. */
.d-gates .gate { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); }
.d-gates .gate:first-of-type { border-top: 0; }
.d-gates .gate p { margin: 0; }
.d-gates .gate .i { vertical-align: -2px; margin-right: 4px; }
.gateform { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.editrow label { min-width: 88px; }
.editrow input[type="number"] { width: 80px; }
.editrow input[type="text"] { flex: 1 1 200px; min-width: 0; }
.editrow .small { flex-basis: 100%; }

/* ---------- SPIKE: linear schedule (src/views/linear.rs) ---------- */
.row.job .cell:has(.lin-tog) { position: relative; padding-right: 64px; }
.lin-tog {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  padding: 3px 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--white);
  color: var(--ink-2); font: inherit; font-size: 10px; cursor: pointer;
}
.lin-tog:hover { border-color: var(--ink-2); color: var(--ink); }
.lin-tog.on { border-color: var(--accent); color: var(--accent); }
.row.linear { height: 240px; }
.lin-tree { position: relative; display: block; padding: 10px 56px 10px 31px; }
.lin-legend { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--ink); }
.lin-legend li { display: flex; min-width: 0; }
.lin-open {
  display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; padding: 0; border: 0; border-radius: 2px;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Each series' planned line has its own dash as well as its colour (WCAG 1.4.1); its key shows it. */
.lin-legend i { flex: none; width: 14px; height: 2px; background: repeating-linear-gradient(to right, var(--sc) 0 var(--dash), transparent var(--dash) calc(var(--dash) + 3px)); }
.lin-legend .s1, .lin-lane .s1 { --dash: 4px; }
.lin-legend .s2, .lin-lane .s2 { --dash: 8px; }
.lin-legend .s3, .lin-lane .s3 { --dash: 1.5px; }
.lin-lane .s2 .lin-plan { stroke-dasharray: 8 3; }
.lin-lane .s3 .lin-plan { stroke-dasharray: 1.5 3; }
.lin-tick { position: absolute; right: 8px; transform: translateY(-50%); font-size: 9px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.lin-lane { overflow: hidden; }
.lin-lane svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lin-grid { stroke: var(--chart-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.lin-lane path { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.lin-plan { stroke: var(--sc); stroke-width: 1.5; stroke-dasharray: 4 3; opacity: 0.8; }
.lin-act { stroke: var(--sc); stroke-width: 2.5; }
.lin-hit { stroke: transparent; stroke-width: 12; pointer-events: stroke; cursor: pointer; }
.lin-lane g:hover .lin-plan { opacity: 1; stroke-width: 2.5; }
.lin-lbl {
  position: absolute; transform: translate(4px, -50%); padding: 0 3px; border-radius: 3px;
  background: var(--chart-bg); color: var(--sc); font-size: 10px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.lin-blk { fill: var(--sc); fill-opacity: 0.1; stroke: var(--sc); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; cursor: pointer; }
.lin-lane g:hover .lin-blk { fill-opacity: 0.18; }
.lin-legend li.blk i { height: 10px; border: 1px dashed var(--sc); background: color-mix(in srgb, var(--sc) 10%, transparent); }
.lin-lbl.in { transform: translate(4px, 3px); background: none; }
.lin-zone {
  position: absolute; z-index: 1; box-sizing: border-box; border: 1.5px solid var(--danger); cursor: help;
  background: repeating-linear-gradient(var(--a), var(--danger) 0 1.5px, transparent 1.5px 6px);
}
.lin-zone.near { border: 1px dashed var(--danger); background: repeating-linear-gradient(var(--a), color-mix(in srgb, var(--danger) 55%, transparent) 0 1px, transparent 1px 9px); }
.lin-zone:hover { background-color: color-mix(in srgb, var(--danger) 12%, transparent); }
.lin-clashes { display: flex; align-items: center; gap: 4px; margin: 0 0 6px; color: var(--danger); font-size: 11px; font-weight: 600; }

/* Help and feedback: the Traction assistant (traction.help in app.js). The panel is one conversation (AI
   pairing PRD decision 42): a heading, a column that scrolls, and one place to type that stays at
   the bottom. From 1024 px it docks beside the page (decision 43). On Schedule it takes the detail
   panel's place as the optimizer panel does, at the same width; .help-behind shows the panel it
   stands in for instead, and the switch in each head goes between the two. On Risk and Workforce
   it is a column at the right, under the toolbar, and the page scrolls beside it. Narrower, it is
   a modal dialog along the right edge, and the scrim says the page behind it waits until it closes. */
.help-dialog {
  max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: hidden;
  background: var(--surface); color: var(--ink);
}
.help-dialog:modal {
  position: fixed; inset: 0 0 0 auto; width: min(36rem, 100vw); height: 100%;
  border-left: 1px solid var(--line); box-shadow: var(--shadow-lift);
}
.help-dialog::backdrop { background: var(--scrim); }
/* A dialog's own height is fit-content; auto lets the row or the grid give it the height. */
.help-dialog[open]:not(:modal) { position: static; display: flex; flex-direction: column; width: var(--side-w); height: auto; min-height: 0; }
.workspace.help-docked:not(.help-behind) > .detail, .workspace.help-docked:not(.help-behind) > .optpanel,
.workspace.help-behind > .help-dialog[open] { display: none; }
/* Risk and Workforce: the toolbar across the top, then the page and the assistant side by side,
   each scrolling by itself. */
body:has(> .help-dialog[open]:not(:modal)) {
  display: grid; grid-template: auto minmax(0, 1fr) / minmax(0, 1fr) var(--side-w); min-height: 0; overflow: hidden;
}
body:has(> .help-dialog[open]:not(:modal)) > .toolbar { grid-column: 1 / -1; }
body:has(> .help-dialog[open]:not(:modal)) > .page { min-height: 0; overflow-y: auto; }
body > .help-dialog:not(:modal) { border-left: 1px solid var(--line); }
/* The switch shows only while the assistant is docked, and in its head only while the panel it
   stands in for holds something: the optimizer while it is open, else a selected requirement. */
.help-switch { display: none; }
.workspace.help-docked .d-head .help-switch,
.workspace.help-docked.opt-open .help-switch-optimizer,
.workspace.help-docked:not(.opt-open):has(> .detail.open) .help-heading .help-switch-detail { display: block; }
.d-title-row .help-switch, .opt-head .help-switch { margin-left: auto; }
.help-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; height: 100%; }
.help-panel > .muted { padding: 24px; }
.help-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.help-heading h2 { margin: 0; }
.help-column { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 24px 16px; }
.help-column p { margin: 0; line-height: 1.5; }
.help-turns { display: flex; flex-direction: column; gap: 12px; }
.help-turns:not(:empty) { margin-top: 12px; }
.help-intro { padding: 8px 0; }
/* The screen a run of questions was asked from: a rule with its name in the middle. */
.help-screen, .help-kicker { margin: 0; color: var(--ink-2); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.help-screen { display: flex; align-items: center; gap: 12px; }
.help-screen::before, .help-screen::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
/* What the person said sits right, tinted; what Help said is plain prose on the left. */
.help-said { align-self: flex-end; max-width: 85%; padding: 8px 12px; border-radius: 12px 12px 2px 12px; background: var(--accent-weak); overflow-wrap: anywhere; white-space: pre-wrap; }
.help-heard { display: grid; gap: 6px; justify-items: start; overflow-wrap: anywhere; }
.help-cite { margin: 0 1px; padding: 0 4px; border-radius: 8px; background: var(--accent-weak); color: var(--accent); font-size: 11px; font-weight: 600; text-decoration: none; vertical-align: 1px; }
.help-sources { display: flex; flex-wrap: wrap; gap: 6px; }
.help-sources .chip { white-space: normal; text-decoration: none; }
/* A source whose document has changed since the answer: named, not linked. */
span.help-cite, .help-sources span.chip { background: none; border: 1px dashed var(--line); color: inherit; }
.help-sources a:hover, .help-cite:hover { border-color: var(--accent); color: var(--accent-strong); }
.help-n { font-weight: 700; color: var(--accent); }
/* A callout is a turn that is not Help's: its kind is the small-caps line over it. One sent to the
   product team has a plain rule down its left; the team's own words have the accent rule. */
.help-callout { display: grid; gap: 6px; justify-items: start; padding: 2px 0 2px 12px; border-left: 3px solid var(--line-strong); }
.help-from { border-left-color: var(--accent); }
.help-from .help-kicker { color: var(--accent); }
.help-quote, .help-excerpt { font-style: italic; overflow-wrap: anywhere; }
.help-reply { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5; }
.help-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.help-receipt { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.help-receipt .i { align-self: center; color: var(--accent); }
/* The draft report is the one card in the column: the person edits it where it stands. */
.help-draft { display: grid; gap: 8px; margin-top: 12px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--white); }
.help-draft form { display: grid; gap: 8px; }
.help-draft textarea { min-height: 120px; }
.help-attach { display: flex; gap: 8px; align-items: baseline; font-size: 12px; }
.help-panel textarea, .help-panel input:not([type=checkbox]) { display: block; width: 100%; padding: 8px; font: inherit; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); }
.help-foot { display: grid; gap: 8px; padding: 12px 24px 16px; border-top: 1px solid var(--line); }
.help-foot p { margin: 0; }
.help-entry { display: flex; gap: 8px; align-items: flex-end; }
.help-entry textarea { flex: 1; resize: none; }
.help-to { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 6px; padding: 4px 8px; border-left: 3px solid var(--line-strong); font-size: 12px; overflow-wrap: anywhere; }
.help-more { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.help-build { margin-left: auto; overflow-wrap: anywhere; }
/* The panel's own waiting line: a Help request does not put the schedule in its loading state. */
.help-panel .help-wait { display: none; align-items: center; gap: 8px; margin-top: 12px; color: var(--ink-2); }
.help-panel[aria-busy=true] .help-wait { display: flex; }
.help-wait .i { animation: spin 0.9s linear infinite; }
#help-open[aria-busy=true] { cursor: progress; }

/* ---------- Below 1024 px: the schedule reflows (WCAG 1.4.10) ---------- */
/* A tablet held upright, a phone, or a desktop zoomed to 200 %. The page scrolls down, never
   sideways: the toolbar, filters and tray wrap; the board keeps most of the window's height, and
   the detail and optimizer panels stack under it at the full width. Only the board's rows scroll
   sideways, inside the board (a two-dimensional chart, which 1.4.10 exempts), with the tree column
   held at the left edge so each row keeps its name. */
@media (max-width: 1023px) {
  :root, .workspace:has(> .detail.open), .workspace.opt-open { --tree-w: min(220px, 45vw); }
  .toolbar, .filters { flex-wrap: wrap; height: auto; gap: 8px; padding: 8px 16px; }
  .actions { flex-wrap: wrap; margin-left: 0; }
  .notices .notice { flex-wrap: wrap; height: auto; white-space: normal; }
  .workspace, .workspace:has(> .detail.open), .workspace:has(.outlook), .workspace.opt-open {
    flex: none; flex-direction: column; min-height: 0; padding: 12px 16px;
  }
  /* The rows get the height; the plan key and marker key wrap under them. */
  .board-wrap, .board { flex: none; }
  .scroller { flex: none; height: max(320px, 64vh); }
  .ctx, .ctx-l { flex-wrap: wrap; row-gap: 4px; }
  .ctx .muted { white-space: normal; }
  .workspace.opt-open .ctx-l { flex: 0 1 auto; }
  .mkkey { flex-wrap: wrap; gap: 4px 16px; padding: 0; }
  .detail.open, .optpanel { width: auto; }
  .rt-h, .rt-r { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr); gap: 8px; overflow-wrap: anywhere; }
  .optpanel { max-height: 80vh; }
  .scroller { overflow-x: auto; scroll-padding-left: var(--tree-w); }
  .scroller > .hdr, .scroller > .sumrow, .scroller > .rows { min-width: calc(var(--tree-w) + 560px); }
  .row > .cell:first-child, .hdr > .tree-h, .sumrow > .sum-def {
    position: sticky; left: 0; z-index: 3; background: inherit;
  }
  .empty { grid-template-columns: 1fr; }
  .empty-l { border-right: 0; border-bottom: 1px solid var(--line); }
  .tray.open { flex: none; max-height: 80vh; }
  .tray-h { flex-wrap: wrap; height: auto; min-height: 52px; gap: 8px; padding: 8px 16px; }
  .tray-preview { flex-wrap: wrap; gap: 8px 24px; padding: 0 16px 14px; }
  .tray.open .tray-body { padding: 4px 16px 20px; }
  .flash-slot { padding: 0 16px 12px; }
  .mv-head, .flash { flex-wrap: wrap; }
  .dec, .dec.rule, .dec.finding { grid-template-columns: 24px minmax(0, 1fr); }
  .dec > *:not(.chk) { grid-column: 2; }
  .dec.finding > * { grid-column: 1 / -1; }
}
