/*
  Keel: project tracker app (Screenery template)
  A dark product UI: near-black layered greys, hairline borders, one amber accent, 13px Inter with Fira Code for ids and keys.
  The app fills the viewport: sidebar, main panel (top bar, toolbar, cycle strip, list or board), a detail panel, and dialogs.

  Contents
   1. Tokens
   2. Base and browser surfaces
   3. Primitives: icons, buttons, kbd, avatars, labels, status and priority glyphs, tooltips
   4. App shell and sidebar
   5. Top bar, banner, toolbar, filter chips
   6. Cycle strip
   7. List view
   8. Board view and dragging
   9. Empty states and inbox
  10. Detail panel: properties, description, sub-issues, activity, comment box
  11. Menu popover
  12. Dialogs: palette, create issue, shortcuts
  13. Toasts and hints
  14. Motion
  15. Narrow screens
*/

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: dark;

  /* Layered greys, darkest at the back */
  --bg-0: #08080a;   /* app floor, behind the main panel */
  --bg-1: #0e0e11;   /* sidebar */
  --bg-2: #131317;   /* main panel */
  --bg-3: #19191e;   /* raised: cards, menus, dialogs */
  --bg-4: #212127;   /* hover on raised */
  --bg-5: #2a2a31;   /* pressed, selected */

  /* Hairlines */
  --line: rgba(255, 255, 255, .065);
  --line-2: rgba(255, 255, 255, .1);
  --line-3: rgba(255, 255, 255, .16);
  --hi: inset 0 1px 0 rgba(255, 255, 255, .045); /* subtle inner highlight on raised surfaces */

  /* Text */
  --text: #ececf0;
  --text-2: #b0b0ba;
  --text-3: #8d8d99;  /* lowest text tone; still 5:1 on --bg-3 */
  --icon: #8a8a95;

  /* The one accent: amber, like a riding light */
  --accent: #f2b155;
  --accent-hover: #f6c172;
  --accent-ink: #1c1306;
  --accent-soft: rgba(242, 177, 85, .13);
  --accent-line: rgba(242, 177, 85, .45);

  /* Functional colours: status and alerts (kept muted) */
  --s-backlog: #7f7f8a;
  --s-todo: #c2c2ca;
  --s-progress: #f2b155;
  --s-review: #9daaf7;
  --s-done: #5fcf9c;
  --danger: #f07a66;
  --danger-soft: rgba(240, 122, 102, .12);

  /* Type */
  --font: "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "Fira Code", ui-monospace, "SF Mono", monospace;
  --fs-xs: 11.5px;
  --fs-sm: 12.5px;
  --fs: 13px;
  --fs-md: 14px;
  --fs-lg: 17px;
  --fs-xl: 21px;

  /* Space, radius, size */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --r-sm: 5px; --r: 7px; --r-lg: 10px; --r-xl: 14px;
  --side-w: 244px;
  --top-h: 48px;
  --row-h: 38px;
  --detail-w: 452px;

  /* Depth: offset, soft blur */
  --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
  --sh-2: 0 6px 18px -4px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .3);
  --sh-3: 0 24px 60px -12px rgba(0, 0, 0, .7), 0 8px 20px -6px rgba(0, 0, 0, .45);

  /* Motion */
  --ease: cubic-bezier(.16, 1, .3, 1);   /* exponential ease-out */
  --t-fast: 150ms;
  --t: 200ms;
}

/* ---------- 2. Base and browser surfaces ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-0);
  color: var(--text);
  font: 400 var(--fs)/1.45 var(--font);
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  accent-color: var(--accent);
  caret-color: var(--accent);
}
::selection { background: rgba(242, 177, 85, .3); color: #fff; }
* { scrollbar-width: thin; scrollbar-color: #34343c transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2e2e35; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #3d3d46; }
::-webkit-scrollbar-track { background: transparent; }

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3 { font-weight: 600; text-wrap: balance; letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; }
a:not([class]) { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-3); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
input, textarea { background: none; border: 0; outline: 0; }
::placeholder { color: var(--text-3); opacity: 1; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
/* Text fields show focus with their own surface and the caret instead of a ring */
input[type="text"]:focus-visible, textarea:focus-visible, dialog:focus-visible, .content:focus-visible { outline: none; }
[hidden] { display: none !important; }
time, .mono, .num { font-variant-numeric: tabular-nums; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: var(--r);
  font-weight: 600; transition: top var(--t) var(--ease);
}
.skip:focus { top: 12px; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.nojs-note { padding: var(--s6); color: var(--text-2); }
.js .nojs-note { display: none; }

/* ---------- 3. Primitives ---------- */
.i {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.i-sm { width: 14px; height: 14px; }
.i-xs { width: 12px; height: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px; border-radius: var(--r);
  font-size: var(--fs); font-weight: 500; white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 1px 2px rgba(0, 0, 0, .4);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary .i { stroke-width: 1.75; }
.btn-ghost { color: var(--text-2); border: 1px solid var(--line-2); background: rgba(255, 255, 255, .02); box-shadow: var(--hi); }
.btn-ghost:hover { background: var(--bg-4); color: var(--text); border-color: var(--line-3); }
.btn-sm { height: 26px; padding: 0 9px; font-size: var(--fs-sm); gap: 5px; }
.btn-danger { color: var(--danger); }
.btn.is-busy { pointer-events: none; }
.btn.is-busy .btn-label::before {
  content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 7px; vertical-align: -1px;
  border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}

.icon-btn {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r);
  color: var(--icon); flex: none;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--bg-4); color: var(--text); }

.kbd {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 4px;
  font: 500 10.5px/1 var(--mono); color: var(--text-2); letter-spacing: 0;
  background: var(--bg-4); border: 1px solid var(--line-2); box-shadow: 0 1px 0 rgba(0, 0, 0, .4);
}
.kbd .i { width: 11px; height: 11px; }
.kbd-on { background: rgba(0, 0, 0, .14); border-color: rgba(0, 0, 0, .18); color: var(--accent-ink); box-shadow: none; }

/* Avatars are drawn initials on a hue from the member record (--h). The initials are a glyph (CSS content); names are in title and sr-only text. */
.av {
  --h: 220;
  display: inline-grid; place-items: center; flex: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: hsl(var(--h) 38% 72%); color: #121216;
  font: 600 8.5px/1 var(--font); letter-spacing: .02em;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35);
}
.av::before { content: attr(data-i); }
.av-lg { width: 26px; height: 26px; font-size: 10px; }
.av-none { background: transparent; border: 1.25px dashed #5c5c66; box-shadow: none; color: transparent; }

.label {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px 0 6px;
  border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2);
  font-size: var(--fs-xs); font-weight: 500; white-space: nowrap;
}
.label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, #888); }

.st { width: 14px; height: 14px; flex: none; display: block; }
.st circle, .st path { vector-effect: non-scaling-stroke; }
.st-backlog { color: var(--s-backlog); }
.st-todo { color: var(--s-todo); }
.st-progress { color: var(--s-progress); }
.st-review { color: var(--s-review); }
.st-done { color: var(--s-done); }

.pr { width: 16px; height: 16px; flex: none; display: block; color: var(--icon); }
.pr .off { opacity: .28; }
.pr-1 { color: var(--danger); }

.proj-dot { width: 9px; height: 9px; margin: 0 3.5px; border-radius: 3px; background: var(--c); flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }

/* Tooltips from data-tip, shown on hover and keyboard focus after a short delay */
[data-tip] { position: relative; }
@media (hover: hover) {
  [data-tip]::after {
    content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 6px); z-index: 40;
    translate: -50% -2px; opacity: 0; pointer-events: none; white-space: pre;
    background: var(--bg-5); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r-sm);
    padding: 4px 7px; font: 500 11.5px/1.2 var(--font); box-shadow: var(--sh-2);
    transition: opacity var(--t-fast) var(--ease), translate var(--t-fast) var(--ease);
  }
  [data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; translate: -50% 0; transition-delay: .45s; }
}

/* ---------- 4. App shell and sidebar ---------- */
.app {
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
  height: 100vh; height: 100dvh;
}
.side {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--bg-1); padding: 10px 8px 8px;
}
.side-top { display: flex; align-items: center; gap: 2px; padding: 0 2px 10px; }
.ws {
  display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; height: 30px; padding: 0 6px; border-radius: var(--r);
  font-weight: 600; font-size: var(--fs); color: var(--text);
  transition: background-color var(--t-fast) var(--ease);
}
.ws:hover, .ws[aria-expanded="true"] { background: var(--bg-4); }
.ws-logo {
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; flex: none;
  background: linear-gradient(180deg, #2a2a31, #1b1b20); color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 0 0 1px rgba(0, 0, 0, .5);
}
.ws-logo .i { width: 14px; height: 14px; stroke-width: 1.75; }
.ws-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-chev { color: var(--icon); }
.side-close { display: none; }

.nav { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; padding: 0 2px; }
.nav-head {
  display: flex; align-items: center; gap: 6px;
  margin: 16px 0 4px; padding: 0 8px; color: var(--text-3);
  font-size: var(--fs-xs); font-weight: 500; letter-spacing: 0;
}
.nav-head .i { color: var(--accent); }
.nav-item {
  display: flex; align-items: center; gap: 9px; height: 28px; padding: 0 8px; border-radius: var(--r);
  color: var(--text-2); font-weight: 500;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-item .i { color: var(--icon); transition: color var(--t-fast) var(--ease); }
.nav-item > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--bg-4); color: var(--text); box-shadow: var(--hi); }
.nav-item[aria-current="page"] .i { color: var(--text); }
.nav-count { color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.nav-badge {
  min-width: 18px; height: 17px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.nav-badge.is-zero { background: transparent; color: var(--text-3); font-weight: 500; }

.side-foot { border-top: 1px solid var(--line); margin-top: 8px; padding: 8px 2px 0; display: grid; gap: 6px; }
.sync { display: flex; align-items: center; gap: 8px; padding: 0 8px; height: 22px; font-size: var(--fs-xs); color: var(--text-3); }
.sync-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--s-done); box-shadow: 0 0 0 3px rgba(95, 207, 156, .12); }
.sync.is-off .sync-dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.sync.is-off { color: var(--text-2); }
.me { display: flex; align-items: center; gap: 9px; padding: 0 0 0 8px; height: 32px; }
.me-name { flex: 1; font-weight: 500; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The main panel is a raised sheet set into the floor */
.main {
  position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  margin: 8px 8px 8px 0; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--hi), var(--sh-1);
  overflow: hidden;
}
.scrim { display: none; }

/* ---------- 5. Top bar, banner, toolbar ---------- */
.top {
  display: flex; align-items: center; gap: 10px; height: var(--top-h); flex: none;
  padding: 0 10px 0 16px; border-bottom: 1px solid var(--line);
}
.burger { display: none; margin-left: -6px; }
.crumbs { flex: 1; min-width: 0; }
.crumbs ol { display: flex; align-items: center; gap: 2px; min-width: 0; font-size: var(--fs); }
.crumbs li { display: flex; align-items: center; gap: 2px; min-width: 0; white-space: nowrap; }
.crumbs li + li::before {
  content: ""; width: 14px; height: 14px; flex: none; opacity: .55;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M6.25 4.5L9.75 8l-3.5 3.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M6.25 4.5L9.75 8l-3.5 3.5'/%3E%3C/svg%3E") center / contain no-repeat;
  color: var(--text-3);
}
.crumbs a { text-decoration: none; color: var(--text-2); padding: 3px 6px; border-radius: var(--r-sm); transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.crumbs a:hover { background: var(--bg-4); color: var(--text); }
.crumbs [aria-current] { padding: 3px 6px; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.crumbs .crumb-id { font-family: var(--mono); font-size: 12px; color: var(--text-2); }

.top-actions { display: flex; align-items: center; gap: 8px; }
.search-btn {
  display: flex; align-items: center; gap: 8px; height: 30px; width: 260px; padding: 0 6px 0 10px;
  border-radius: var(--r); background: var(--bg-1); border: 1px solid var(--line-2); color: var(--text-3);
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.search-btn:hover { border-color: var(--line-3); color: var(--text-2); }
.search-label { flex: 1; text-align: left; font-size: var(--fs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.banner {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 8px 10px 8px 16px; border-bottom: 1px solid rgba(240, 122, 102, .22);
  background: linear-gradient(0deg, var(--danger-soft), var(--danger-soft)), var(--bg-2);
  color: var(--text); font-size: var(--fs);
}
.banner > .i { color: var(--danger); }
.banner p { flex: 1; min-width: 0; color: var(--text-2); }
.banner strong { color: var(--text); font-weight: 600; }

.toolbar {
  display: flex; align-items: center; gap: 10px; height: 44px; flex: none;
  padding: 0 10px 0 12px; border-bottom: 1px solid var(--line);
}
.filters { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chips { display: flex; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; height: 26px; border-radius: var(--r); flex: none;
  border: 1px solid var(--line-2); background: var(--bg-3); box-shadow: var(--hi); font-size: var(--fs-sm); overflow: hidden;
}
.chip-key { padding: 0 6px 0 9px; color: var(--text-3); }
.chip-val { padding: 0 8px; height: 100%; display: inline-flex; align-items: center; gap: 5px; border-left: 1px solid var(--line); color: var(--text); transition: background-color var(--t-fast) var(--ease); }
.chip-val:hover { background: var(--bg-4); }
.chip-x { width: 26px; height: 100%; display: grid; place-items: center; border-left: 1px solid var(--line); color: var(--icon); transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.chip-x:hover { background: var(--bg-4); color: var(--text); }
.chip-x .i { width: 12px; height: 12px; }
.chip-clear { font-size: var(--fs-sm); color: var(--text-3); padding: 0 6px; height: 26px; border-radius: var(--r); flex: none; }
.chip-clear:hover { color: var(--text); background: var(--bg-4); }
.tool-count { color: var(--text-3); font-size: var(--fs-sm); white-space: nowrap; font-variant-numeric: tabular-nums; }

.seg {
  display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r); flex: none;
  background: var(--bg-1); border: 1px solid var(--line-2);
}
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 5px;
  color: var(--text-3); font-size: var(--fs-sm); font-weight: 500;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--bg-4); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 1px 2px rgba(0, 0, 0, .4); }
.seg-xs .seg-btn { height: 22px; padding: 0 8px; font-size: var(--fs-xs); }

/* ---------- 6. Cycle strip ---------- */
.stage { container-type: inline-size; position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; transition: margin-right var(--t) var(--ease); }
.cycle {
  display: grid; grid-template-columns: auto minmax(160px, 1fr) auto auto; align-items: center; gap: 12px 24px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); flex: none;
}
.cycle-head { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.cycle h1 { font-size: var(--fs-md); font-weight: 600; }
.cycle-dates { color: var(--text-3); font-size: var(--fs-sm); }
.cycle-bar {
  display: flex; height: 6px; border-radius: 999px; overflow: hidden; gap: 2px;
  background: transparent;
}
.cycle-bar span { min-width: 0; border-radius: 2px; transition: flex-grow .5s var(--ease); }
.cb-done { background: var(--s-done); }
.cb-started { background: var(--s-progress); }
.cb-todo { background: #34343c; }
.cycle-stats { display: flex; gap: 22px; }
.cycle-stats div { display: grid; gap: 1px; }
.cycle-stats dt { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.cycle-stats dd { color: var(--text-2); font-size: var(--fs-sm); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cycle-stats b { color: var(--text); font-weight: 600; font-size: var(--fs-md); }
.cycle-stats dd span { color: var(--text-3); margin-left: 2px; }
.k { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.k-done { background: var(--s-done); }
.k-started { background: var(--s-progress); }
.k-todo { background: #4a4a53; }

/* ---------- 7. List view ---------- */
.content { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; position: relative; }
.list { padding-bottom: 48px; }
.group-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 4px; height: 36px; padding: 0 10px 0 12px;
  background: color-mix(in srgb, var(--bg-3) 70%, var(--bg-2));
  border-bottom: 1px solid var(--line); font-size: var(--fs); font-weight: 500;
}
.group-toggle { display: flex; align-items: center; gap: 8px; height: 26px; padding: 0 6px 0 4px; border-radius: var(--r-sm); }
.group-toggle:hover { background: var(--bg-4); }
.group-toggle .chev { color: var(--icon); transition: rotate var(--t) var(--ease); }
.group-toggle[aria-expanded="false"] .chev { rotate: -90deg; }
.group-count { color: var(--text-3); font-weight: 400; font-variant-numeric: tabular-nums; }
.group-pts { margin-left: auto; color: var(--text-3); font-size: var(--fs-xs); font-weight: 400; font-variant-numeric: tabular-nums; }
.group-add { width: 26px; height: 26px; }
.rows[hidden] { display: none; }

.row {
  display: grid; align-items: center; column-gap: 10px;
  grid-template-columns: 16px 62px 14px minmax(0, 1fr) auto 28px 46px 20px;
  grid-template-areas: "pr id st title labels est date av";
  height: var(--row-h); padding: 0 16px 0 18px; border-bottom: 1px solid var(--line);
  color: var(--text); cursor: default; position: relative;
  transition: background-color var(--t-fast) var(--ease);
}
.row:hover { background: rgba(255, 255, 255, .025); }
.row:focus-visible { outline: none; background: var(--bg-3); box-shadow: inset 0 0 0 1px var(--accent-line); border-radius: 0; }
.row.is-open { background: var(--accent-soft); --text-3: #a5a5af; }
.row.is-new { animation: flash 1.6s var(--ease); }
.row > .pr { grid-area: pr; }
.row-id { grid-area: id; font: 400 12px/1 var(--mono); color: var(--text-3); white-space: nowrap; }
.row > .st { grid-area: st; }
.row-title { grid-area: title; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row-title .sub-count { color: var(--text-3); font-weight: 400; margin-left: 8px; font-size: var(--fs-xs); }
.row-labels { grid-area: labels; display: flex; gap: 5px; justify-content: flex-end; min-width: 0; }
.row-est { grid-area: est; font: 400 11.5px/1 var(--mono); color: var(--text-3); text-align: right; display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.row-date { grid-area: date; color: var(--text-3); font-size: var(--fs-xs); text-align: right; white-space: nowrap; }
.row > .av { grid-area: av; }
.row .pending { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); position: absolute; left: 6px; top: 50%; margin-top: -3px; }

/* ---------- 8. Board view ---------- */
.board {
  display: flex; gap: 10px; height: 100%; padding: 12px;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
}
.col {
  display: flex; flex-direction: column; flex: 0 0 286px; min-height: 0;
  border-radius: var(--r-lg); background: rgba(255, 255, 255, .018); border: 1px solid var(--line);
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.col.is-target { background: rgba(242, 177, 85, .04); border-color: var(--accent-line); }
.col-head { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px 0 12px; flex: none; font-weight: 500; }
.col-head .group-count { margin-right: auto; }
.col-pts { color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.col-body { flex: 1; min-height: 60px; overflow-y: auto; padding: 2px 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.col-empty { margin: 2px 0; padding: 16px 10px; border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--text-3); font-size: var(--fs-sm); text-align: center; }

.card {
  display: grid; gap: 8px; padding: 10px 11px 10px; border-radius: var(--r);
  background: var(--bg-3); border: 1px solid var(--line-2); box-shadow: var(--hi), var(--sh-1);
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: pan-x pan-y;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease), transform var(--t) var(--ease);
}
.card:hover { border-color: var(--line-3); background: #1c1c22; }
.card:focus-visible { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line), var(--sh-1); border-radius: var(--r); }
.card.is-open { border-color: var(--accent-line); }
.card.is-new { animation: flash 1.6s var(--ease); }
.card-top { display: flex; align-items: center; gap: 8px; }
.card-id { font: 400 11.5px/1 var(--mono); color: var(--text-3); margin-right: auto; }
.card-title { font-weight: 500; line-height: 1.4; display: flex; gap: 8px; align-items: flex-start; }
.card-title .st { margin-top: 2px; }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-meta .row-est { margin-left: auto; }
.card-pr { display: grid; place-items: center; width: 22px; height: 20px; border-radius: 5px; border: 1px solid var(--line-2); }
.card-pr .pr { width: 14px; height: 14px; }

/* Dragging: the original stays as a slot, a lifted copy follows the pointer */
.card.is-slot { opacity: .35; border-style: dashed; box-shadow: none; }
.card.is-lifted {
  position: fixed; z-index: 60; pointer-events: none; margin: 0;
  rotate: 1.5deg; cursor: grabbing;
  border-color: var(--line-3); background: #202027;
  box-shadow: 0 18px 40px -10px rgba(0, 0, 0, .7), 0 4px 12px rgba(0, 0, 0, .4), var(--hi);
}
.card.is-carried { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 14px 30px -10px rgba(0, 0, 0, .7); transform: translateY(-2px); }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }

/* ---------- 9. Empty states and inbox ---------- */
.empty {
  display: grid; justify-items: center; align-content: center; gap: 10px; text-align: center;
  min-height: 100%; padding: 48px 24px;
}
.empty-art { width: 220px; height: auto; margin-bottom: 10px; color: var(--text-3); }
.empty h2 { font-size: var(--fs-lg); font-weight: 600; }
.empty p { color: var(--text-2); max-width: 46ch; }
.empty-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }

.inbox { max-width: 980px; }
.inbox-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; }
.inbox-head h1 { font-size: var(--fs-md); flex: 1; }
.note {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 2px 12px; align-items: start;
  width: 100%; padding: 12px 16px 12px 18px; text-align: left; border-bottom: 1px solid var(--line); position: relative;
  transition: background-color var(--t-fast) var(--ease);
}
.note:hover { background: rgba(255, 255, 255, .025); }
.note .av { grid-row: span 2; margin-top: 1px; }
.note-line { color: var(--text-2); min-width: 0; }
.note-line b { color: var(--text); font-weight: 500; }
.note-line .mono { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.note-quote { grid-column: 2; color: var(--text-3); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note time { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.note.is-unread::before { content: ""; position: absolute; left: 7px; top: 19px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.note.is-unread .note-line { color: var(--text); }

/* ---------- 10. Detail panel ---------- */
.detail {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 20; width: var(--detail-w); max-width: 100%;
  display: flex; flex-direction: column; background: var(--bg-2);
  border-left: 1px solid var(--line-2); box-shadow: -18px 0 40px -18px rgba(0, 0, 0, .7);
}
.main.has-detail .stage { margin-right: 0; }
@media (min-width: 1360px) {
  .main.has-detail .stage,
  .main.has-detail .banner,
  .main.has-detail .toolbar { margin-right: var(--detail-w); }
  .main.has-detail .top { padding-right: calc(var(--detail-w) + 10px); }
  .detail { box-shadow: none; }
}
.d-head { display: flex; align-items: center; gap: 4px; height: var(--top-h); padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); flex: none; }
.d-id { font: 500 12px/1 var(--mono); color: var(--text-2); margin-right: auto; display: flex; align-items: center; gap: 8px; }
.d-pending { font: 500 var(--fs-xs)/1 var(--font); color: var(--accent); background: var(--accent-soft); padding: 4px 7px; border-radius: 999px; }
.d-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px 28px; }
.d-title {
  width: 100%; resize: none; overflow: hidden; display: block;
  font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.015em; line-height: 1.3; color: var(--text);
  padding: 4px 6px; margin: -4px -6px 14px; border-radius: var(--r); field-sizing: content;
  transition: background-color var(--t-fast) var(--ease);
}
.d-title:hover { background: rgba(255, 255, 255, .03); }
.d-title:focus { background: var(--bg-3); box-shadow: inset 0 0 0 1px var(--line-2); }

.props { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 2px 10px; margin-bottom: 22px; align-items: center; }
.props dt { color: var(--text-3); font-size: var(--fs-sm); }
.prop {
  display: inline-flex; align-items: center; gap: 8px; min-height: 28px; max-width: 100%; padding: 3px 8px; margin-left: -8px; border-radius: var(--r);
  color: var(--text); font-weight: 500; text-align: left; flex-wrap: wrap;
  transition: background-color var(--t-fast) var(--ease);
}
.prop:hover { background: var(--bg-4); }
.prop .muted { color: var(--text-3); font-weight: 400; }
.prop .mono { font-family: var(--mono); font-size: 12px; }

.d-section { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 18px; }
.d-section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.d-section-head h3 { font-size: var(--fs); font-weight: 600; flex: 1; display: flex; align-items: center; gap: 8px; }
.d-section-head .muted { color: var(--text-3); font-weight: 400; font-variant-numeric: tabular-nums; }
.d-desc { color: var(--text-2); font-size: var(--fs-md); line-height: 1.6; max-width: 68ch; }
.d-desc p + p, .d-desc p + ol, .d-desc ol + p { margin-top: 10px; }
.d-desc ol { list-style: decimal; padding-left: 20px; }
.d-desc code { font: 400 12.5px var(--mono); background: var(--bg-4); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; color: var(--text); }
.d-desc .empty-desc { color: var(--text-3); }
.d-desc-edit { width: 100%; min-height: 120px; resize: vertical; padding: 10px 12px; border-radius: var(--r); background: var(--bg-1); border: 1px solid var(--line-2); font-size: var(--fs-md); line-height: 1.55; }
.d-desc-edit:focus { border-color: var(--accent-line); }
.d-edit-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

.sub-meter { width: 44px; height: 4px; border-radius: 999px; background: var(--bg-5); overflow: hidden; }
.sub-meter span { display: block; height: 100%; background: var(--s-done); border-radius: inherit; transition: width var(--t) var(--ease); }
.subs { display: grid; gap: 1px; }
.sub {
  display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 4px 8px; margin: 0 -8px; border-radius: var(--r);
  transition: background-color var(--t-fast) var(--ease);
}
.sub:hover { background: rgba(255, 255, 255, .03); }
.sub input { position: absolute; opacity: 0; pointer-events: none; }
.sub-box {
  width: 16px; height: 16px; border-radius: 5px; flex: none; display: grid; place-items: center;
  border: 1.5px solid #5a5a64; color: transparent;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.sub-box .i { width: 11px; height: 11px; stroke-width: 2; }
.sub input:checked + .sub-box { background: var(--s-done); border-color: var(--s-done); color: #0d2318; }
.sub input:focus-visible + .sub-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.sub-text { flex: 1; min-width: 0; }
.sub input:checked ~ .sub-text { color: var(--text-3); text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, .25); }
.sub .icon-btn { opacity: 0; width: 24px; height: 24px; transition: opacity var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
.sub:hover .icon-btn, .sub .icon-btn:focus-visible { opacity: 1; }
.sub-add { display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 8px; margin: 4px -8px 0; border-radius: var(--r); color: var(--text-3); }
.sub-add:focus-within { background: var(--bg-3); color: var(--text-2); }
.sub-add input { flex: 1; min-width: 0; height: 30px; font-size: var(--fs); color: var(--text); }

.timeline { position: relative; display: grid; gap: 14px; }
.timeline::before { content: ""; position: absolute; left: 9.5px; top: 6px; bottom: 6px; width: 1px; background: var(--line-2); }
.ev { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; font-size: var(--fs-sm); color: var(--text-3); }
.ev-dot { width: 20px; height: 20px; display: grid; place-items: center; background: var(--bg-2); color: var(--icon); position: relative; }
.ev-dot .st { width: 12px; height: 12px; }
.ev-dot .i { width: 13px; height: 13px; }
.ev-text { padding-top: 2px; }
.ev-text b { color: var(--text-2); font-weight: 500; }
.ev-text time { margin-left: 4px; }
.ev.is-comment .ev-dot { background: var(--bg-2); }
.comment-card { margin-top: 6px; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--bg-3); box-shadow: var(--hi); }
.comment-card header { display: flex; align-items: center; gap: 8px; padding: 9px 12px 0; color: var(--text-3); font-size: var(--fs-sm); }
.comment-card header b { color: var(--text); font-weight: 500; }
.comment-card p { padding: 6px 12px 11px; color: var(--text-2); font-size: var(--fs); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-card.is-new { animation: flash 1.6s var(--ease); }

.composer {
  margin-top: 18px; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--bg-1);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.composer:focus-within { border-color: var(--line-3); box-shadow: 0 0 0 3px rgba(255, 255, 255, .03); }
.composer.is-error { border-color: rgba(240, 122, 102, .55); }
.composer textarea { display: block; width: 100%; min-height: 64px; max-height: 240px; resize: none; padding: 11px 12px 4px; font-size: var(--fs); line-height: 1.55; field-sizing: content; }
.composer-foot { display: flex; align-items: center; gap: 10px; padding: 6px 8px 8px 12px; }
.composer-msg { flex: 1; font-size: var(--fs-xs); color: var(--text-3); min-width: 0; }
.composer-msg.is-error { color: var(--danger); }
.composer-count { font: 400 11px var(--mono); color: var(--text-3); }
.composer-count.is-over { color: var(--danger); }

/* ---------- 11. Menu popover ---------- */
.menu {
  position: fixed; z-index: 80; width: 272px; max-height: min(380px, calc(100dvh - 24px));
  display: flex; flex-direction: column;
  background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: var(--hi), var(--sh-3); overflow: hidden;
  transform-origin: top left;
}
.menu-search { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 38px; border-bottom: 1px solid var(--line); color: var(--icon); flex: none; }
.menu-search input { flex: 1; min-width: 0; height: 100%; font-size: var(--fs); color: var(--text); }
.menu-list { overflow-y: auto; padding: 4px; }
.menu-group { padding: 8px 8px 4px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.menu-item {
  display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 8px; border-radius: var(--r-sm);
  color: var(--text); cursor: pointer; font-size: var(--fs);
}
.menu-item[aria-selected="true"], .menu-item.is-active { background: var(--bg-5); }
.menu-item .menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item .menu-hint { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.menu-item .menu-check { color: var(--text); width: 14px; height: 14px; }
.menu-item .menu-box { width: 14px; height: 14px; border-radius: 4px; border: 1.25px solid #5f5f69; display: grid; place-items: center; color: transparent; flex: none; }
.menu-item .menu-box.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.menu-item .menu-box .i { width: 10px; height: 10px; stroke-width: 2; }
.menu-empty { padding: 14px 10px; color: var(--text-3); font-size: var(--fs-sm); text-align: center; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }

/* ---------- 12. Dialogs ---------- */
dialog {
  padding: 0; border: 0; color: var(--text); background: transparent; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px);
}
dialog::backdrop { background: rgba(4, 4, 6, .58); }
.palette {
  width: 640px; margin-top: 12vh; margin-bottom: auto;
  background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--r-xl);
  box-shadow: var(--hi), var(--sh-3); overflow: hidden;
}
.palette[open] { display: flex; flex-direction: column; }
.pal-crumb { display: flex; gap: 6px; padding: 12px 16px 0; flex-wrap: wrap; }
.pal-crumb span { font: 500 var(--fs-xs)/1 var(--font); color: var(--text-2); background: var(--bg-5); padding: 4px 8px; border-radius: var(--r-sm); }
.pal-crumb span.mono { font-family: var(--mono); }
.pal-field { display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--icon); flex: none; }
.pal-field input { flex: 1; min-width: 0; height: 100%; font-size: 15px; color: var(--text); }
.pal-list { overflow-y: auto; max-height: min(420px, 56dvh); padding: 6px; scroll-padding: 34px 0 6px; }
.pal-group { padding: 10px 10px 5px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.pal-item {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 10px; border-radius: var(--r);
  cursor: pointer; color: var(--text-2);
}
.pal-item > .i, .pal-item > .st, .pal-item > .pr { color: var(--icon); }
.pal-item[aria-selected="true"] { background: var(--bg-5); color: var(--text); }
.pal-item[aria-selected="true"] > .i { color: var(--text); }
.pal-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-label mark { background: none; color: var(--accent); font-weight: 600; }
.pal-id { font: 400 11.5px var(--mono); color: var(--text-3); width: 60px; flex: none; }
.pal-ctx { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.pal-keys { display: flex; gap: 3px; }
.pal-empty { padding: 30px 16px 34px; text-align: center; color: var(--text-3); }
.pal-empty b { color: var(--text-2); font-weight: 500; }
.pal-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); color: var(--text-3); font-size: var(--fs-xs); flex: none; }
.pal-foot span { display: inline-flex; align-items: center; gap: 4px; }
.pal-foot .kbd { height: 17px; min-width: 17px; font-size: 10px; }

.modal {
  width: 680px; background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--r-xl);
  box-shadow: var(--hi), var(--sh-3); margin-top: 10vh;
}
.modal-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 0 18px; }
.modal-head h2 { font-size: var(--fs); font-weight: 500; color: var(--text-2); flex: 1; }
.modal-head > .i { color: var(--icon); }
.team-chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; border-radius: var(--r-sm); background: var(--bg-5); font: 500 11px var(--mono); color: var(--text-2); }
.team-chip .i { color: var(--accent); }
.crumb-sep { color: var(--text-3); }
.modal-body { padding: 14px 18px 8px; }
.c-title { width: 100%; font-size: 19px; font-weight: 600; letter-spacing: -.01em; padding: 4px 0; }
.c-title[aria-invalid="true"] { caret-color: var(--danger); }
.field-err { min-height: 18px; color: var(--danger); font-size: var(--fs-sm); }
.field-err:empty { min-height: 6px; }
.c-desc { width: 100%; resize: none; font-size: var(--fs-md); line-height: 1.55; color: var(--text-2); padding: 2px 0; min-height: 84px; field-sizing: content; max-height: 260px; }
.c-props { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 0 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, .02); color: var(--text-2); font-size: var(--fs-sm); font-weight: 500;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.pill:hover { background: var(--bg-4); color: var(--text); border-color: var(--line-3); }
.pill .av { width: 16px; height: 16px; font-size: 7px; }
.pill .st { width: 13px; height: 13px; }
.pill .pr { width: 14px; height: 14px; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 12px 14px 14px 18px; border-top: 1px solid var(--line); }
.form-msg { flex: 1; font-size: var(--fs-sm); color: var(--text-3); min-width: 0; }
.form-msg.is-error { color: var(--danger); }
.switch { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 26px; height: 16px; border-radius: 999px; background: var(--bg-5); border: 1px solid var(--line-2); position: relative; transition: background-color var(--t-fast) var(--ease); }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: #9a9aa4; transition: translate var(--t) var(--ease), background-color var(--t-fast) var(--ease); }
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { translate: 10px 0; background: var(--accent-ink); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.keys { width: 760px; }
.keys .modal-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.keys .modal-head h2 { color: var(--text); font-weight: 600; }
.keys-body { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 32px; padding: 14px 20px 20px; overflow-y: auto; max-height: calc(100dvh - 140px); }
.keys h3 { font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; margin: 10px 0 4px; }
.keys dl div { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 32px; border-bottom: 1px solid var(--line); }
.keys dt { color: var(--text-2); }
.keys dd { display: flex; align-items: center; gap: 4px; color: var(--text-3); font-size: var(--fs-xs); }

/* ---------- 13. Toasts and hints ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 380px;
  padding: 9px 9px 9px 12px; border-radius: var(--r-lg);
  background: var(--bg-4); border: 1px solid var(--line-2); box-shadow: var(--hi), var(--sh-2);
  font-size: var(--fs); color: var(--text);
}
.toast > .i { color: var(--s-done); }
.toast.is-error > .i { color: var(--danger); }
.toast.is-warn > .i { color: var(--accent); }
.toast p { flex: 1; min-width: 0; }
.toast .mono { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.toast .btn { height: 24px; }
.g-hint {
  position: fixed; left: 50%; bottom: 20px; translate: -50% 0; z-index: 85;
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px;
  background: var(--bg-4); border: 1px solid var(--line-2); box-shadow: var(--sh-2); font-size: var(--fs-sm); color: var(--text-2);
}

/* ---------- 14. Motion ---------- */
@keyframes spin { to { rotate: 360deg; } }
@keyframes flash { from { background-color: rgba(242, 177, 85, .16); } }
@media (prefers-reduced-motion: no-preference) {
  .detail { animation: panel-in var(--t) var(--ease); }
  .menu:not([hidden]) { animation: pop-in var(--t-fast) var(--ease); }
  dialog[open] { animation: dialog-in var(--t) var(--ease); }
  dialog[open]::backdrop { animation: fade-in var(--t) var(--ease); }
  .toast { animation: toast-in var(--t) var(--ease); }
  .toast.is-leaving { opacity: 0; translate: 0 6px; transition: opacity var(--t) var(--ease), translate var(--t) var(--ease); }
  .g-hint:not([hidden]) { animation: fade-in var(--t-fast) var(--ease); }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; animation-timing-function: cubic-bezier(.16, 1, .3, 1); }
}
@keyframes panel-in { from { translate: 24px 0; opacity: 0; } }
@keyframes pop-in { from { opacity: 0; scale: .97; translate: 0 -3px; } }
@keyframes dialog-in { from { opacity: 0; scale: .985; translate: 0 6px; filter: blur(2px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes toast-in { from { opacity: 0; translate: 0 8px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .btn.is-busy .btn-label::before { animation: none; border-right-color: currentColor; opacity: .6; }
}

/* ---------- 15. Narrow screens ---------- */
@media (max-width: 1180px) {
  .search-btn { width: 210px; }
}
/* The stage is a size container, so the strip and rows also adapt when the detail panel docks beside them */
@container (max-width: 1060px) {
  .cycle { grid-template-columns: auto minmax(120px, 1fr) auto; }
  .cycle .seg-xs { display: none; }
}
@container (max-width: 900px) {
  .row { grid-template-columns: 16px 62px 14px minmax(0, 1fr) auto 28px 20px; grid-template-areas: "pr id st title labels est av"; }
  .row-date { display: none; }
}
@container (max-width: 820px) {
  .cycle { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .cycle-head { justify-content: space-between; }
  .cycle-stats { justify-content: space-between; gap: 8px; }
  .row-labels .label:nth-child(n + 2) { display: none; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; inset: 0 auto 0 0; z-index: 70; width: min(300px, 86vw);
    border-right: 1px solid var(--line-2); box-shadow: var(--sh-3);
    translate: -102% 0; visibility: hidden;
    transition: translate var(--t) var(--ease), visibility 0s linear var(--t);
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .side.is-open { translate: 0 0; visibility: visible; transition: translate var(--t) var(--ease), visibility 0s; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(4, 4, 6, .6); }
  .side-close { display: inline-grid; }
  .burger { display: inline-grid; }
  .main { margin: 0; border-radius: 0; border: 0; }
  .nav-item { height: 40px; }
  .search-btn { width: auto; }
  .search-label, .search-btn .kbd { display: none; }
  .search-btn { width: 36px; padding: 0; justify-content: center; }
}
@media (max-width: 640px) {
  :root { --row-h: auto; }
  .top { padding: 0 8px 0 12px; gap: 6px; height: 52px; }
  .top .btn-primary span { display: none; }
  .top .btn-primary { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .search-btn { height: 36px; }
  .icon-btn { width: 36px; height: 36px; }
  .crumbs li:not(:last-child) { display: none; }
  .crumbs li + li::before { display: none; }
  .toolbar { height: 50px; padding: 0 8px 0 10px; }
  .tool-count { display: none; }
  .seg-btn { height: 32px; padding: 0 10px; }
  .seg-btn span { display: none; }
  .btn-sm { height: 32px; }
  .chip { height: 32px; }
  .chip-x { width: 32px; }
  .cycle { padding: 12px 14px; }
  .cycle-stats b { font-size: var(--fs); }
  .cycle-dates { font-size: var(--fs-xs); }

  /* Rows become two lines: status + title, then id, labels, estimate, avatar */
  .row {
    grid-template-columns: 14px minmax(0, 1fr) auto;
    grid-template-areas: "st title av" ". meta meta";
    row-gap: 6px; padding: 11px 14px 11px 16px; min-height: 60px;
  }
  .row > .pr, .row-date { display: none; }
  .row-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; font-size: var(--fs-md); }
  .row-meta { grid-area: meta; display: flex; align-items: center; gap: 8px; min-width: 0; }
  .row-id, .row-labels, .row-est { grid-area: auto; }
  .row-labels { justify-content: flex-start; }
  .row-est { margin-left: auto; }
  .row > .av { align-self: start; }
  .group-head { height: 42px; }
  .group-add { width: 36px; height: 36px; }

  .board { padding: 10px; gap: 8px; scroll-snap-type: x proximity; scroll-padding: 10px; }
  .col { flex-basis: min(84vw, 300px); scroll-snap-align: start; }

  .detail { position: fixed; inset: 0; z-index: 75; width: 100%; border: 0; padding-top: env(safe-area-inset-top); }
  .d-head { height: 52px; }
  .d-scroll { padding: 16px 16px 32px; }
  .props { grid-template-columns: 84px minmax(0, 1fr); }
  .prop { min-height: 40px; }
  .sub { min-height: 44px; }
  .sub .icon-btn { opacity: 1; }

  .palette { width: 100%; margin-top: 8px; max-height: calc(100dvh - 16px); border-radius: var(--r-lg); }
  .pal-foot { display: none; }
  .pal-item { height: 46px; }
  .modal { width: 100%; margin-top: 8px; border-radius: var(--r-lg); }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .form-msg { order: -1; flex-basis: 100%; }
  .modal-foot .form-msg:empty { display: none; }
  .modal-foot .switch { margin-right: auto; }
  .modal-foot .kbd { display: none; }
  .keys-body { grid-template-columns: 1fr; }
  .menu-item { height: 40px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; justify-items: stretch; }
  .toast { max-width: none; }
  .banner { flex-wrap: wrap; padding: 10px 12px; }
  .banner p { flex-basis: calc(100% - 30px); }
  .banner .btn { margin-left: 26px; }
}
@media (min-width: 641px) {
  .row-meta { display: contents; }
}
