/* ==========================================================================
   ReqOps — design tokens
   Night is the default theme; .theme-day (on <html>) swaps the neutral ramp
   to paper, per the DS tokens.css. Brand constants (amber, radius, motion,
   type) are shared across both themes — never themed.
   ========================================================================== */
:root {
  color-scheme: dark;
  /* vector chevron used by expand/collapse carets (masked, so it inherits color) */
  --vic-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 6 15 12 9 18'/%3E%3C/svg%3E");

  /* --- Brand constants (shared across themes) --- */
  --accent: #f4a259;           /* the warm capture/commit amber — the one hue */
  --accent-rgb: 244, 162, 89;
  --accent-hover: #f7b478;
  --accent-dim: #c8762f;       /* warm-strong */
  --on-accent: #0b0c0f;        /* ink on amber fills — dark in BOTH themes (DS ::selection) */
  --radius: 10px;              /* ReqOps radius scale: 6 · 10 · 16 · pill */
  --radius-lg: 16px;
  --radius-xl: 16px;
  /* ReqOps motion tokens: taps · panels · the loop */
  --dur-tap: 120ms;
  --dur-panel: 240ms;
  --dur-loop: 700ms;
  --ease-loop: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  /* DS control-density tokens at the app's deliberate density (body 13px —
     standing exception #6); [data-density="mobile"] raises them to touch size */
  --ctrl-py: 7px;
  --ctrl-px: 14px;
  --ctrl-minh: 30px;
  --ctrl-fs: 13px;

  /* --- Night ramp — from the ReqOps design system tokens.css --- */
  --bg: #0b0c0f;
  --surface: #101116;
  --surface-2: #1a1d23;        /* DS surface3 */
  --border: #1e2128;
  --border-2: #2a2f38;         /* raised / hover borders (DS edge2) */
  --edge: #3a414c;             /* strong control borders (DS edge) */
  --card: #14161c;             /* board cards / skeleton base — lifts off --surface */
  --hair: rgba(255,255,255,.06); /* hover overlay, works on any surface */
  --text: #e9edf3;
  --text-soft: #cdd3db;        /* secondary body text (bright) */
  --text-dim: #9aa3b0;         /* slate */
  --muted: #7e8894;            /* metadata, mono keys — AA at 13px on surface-2 (DS tokens.css adopted this value 2026-07-28) */
  --text-faint: #5a6472;       /* placeholders/hints — NON-ESSENTIAL text only (register exception #7) */
  --ink: #0b0c0f;              /* text on filled color (DS ink) */
  --accent-tint: rgba(var(--accent-rgb), .09);  /* amber-tinted surfaces */
  --accent-line: rgba(var(--accent-rgb), .32);  /* amber-tinted borders */
  --epic: #a78bc8;             /* epic type hue */
  --ok: #62c28d;    --ok-rgb: 98, 194, 141;
  --warn: #d9ad6b;  --warn-rgb: 217, 173, 107;
  --err: #e06a57;   --err-rgb: 224, 106, 87;
  --info: #7b9fd4;  --info-rgb: 123, 159, 212;
  --todo: #8b93a1;  --todo-rgb: 139, 147, 161;
  --ok-line: rgba(var(--ok-rgb), .33);
  --ok-tint: rgba(var(--ok-rgb), .12);
  --warn-line: rgba(var(--warn-rgb), .33);
  --warn-tint: rgba(var(--warn-rgb), .08);
  --err-line: rgba(var(--err-rgb), .33);
  --err-tint: rgba(var(--err-rgb), .12);
  --info-tint: rgba(var(--info-rgb), .12);
  --todo-tint: rgba(var(--todo-rgb), .12);
  --in_progress: var(--info);
  --done: var(--ok);
  /* dark-baked surfaces, themed for Day */
  --scrim: rgba(5,7,10,.5);
  --stripe: rgba(255,255,255,.02);
  --code-bg: rgba(0,0,0,.3);
  --shadow: 0 8px 30px rgba(0,0,0,.45);
  --shadow-pop: 0 16px 40px rgba(0,0,0,.55);
  --shadow-toast: 0 10px 30px rgba(0,0,0,.5);
  --shadow-fab: 0 4px 18px rgba(0,0,0,.45);
  --shadow-panel: -8px 0 32px rgba(0,0,0,.35);
}

/* --- Day theme — DS .theme-day paper ramp (tokens.css). Status hues sit
   darker than the DS night set so 11–13px chip text clears WCAG AA on their
   tints; tints re-derive automatically via the -rgb channel overrides. --- */
.theme-day {
  color-scheme: light;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #eef0ee;        /* DS day surface3 */
  --border: #e4e6ea;
  --border-2: #dadce0;         /* DS day edge2 */
  --edge: #cfd2d8;             /* DS day edge */
  --card: #ffffff;
  --hair: rgba(0,0,0,.06);
  --text: #1d2128;
  --text-soft: #2a2f38;        /* DS day bright */
  --text-dim: #5b636e;         /* DS day slate */
  --muted: #646e7c;            /* AA at 13px on day surface-2 (DS tokens.css adopted this value 2026-07-28) */
  --text-faint: #9aa0aa;
  --ink: #fbfaf7;
  --accent-tint: rgba(var(--accent-rgb), .14);
  --epic: #74549e;
  --ok: #29714c;    --ok-rgb: 41, 113, 76;
  --warn: #7d5e1f;  --warn-rgb: 125, 94, 31;
  --err: #b6402e;   --err-rgb: 182, 64, 46;
  --info: #44669c;  --info-rgb: 68, 102, 156;
  --todo: #646c78;  --todo-rgb: 100, 108, 120;
  --scrim: rgba(29,33,40,.4);
  --stripe: rgba(0,0,0,.025);
  --code-bg: rgba(0,0,0,.06);
  --shadow: 0 8px 30px rgba(29,33,40,.14);
  --shadow-pop: 0 16px 40px rgba(29,33,40,.18);
  --shadow-toast: 0 10px 30px rgba(29,33,40,.16);
  --shadow-fab: 0 4px 18px rgba(29,33,40,.22);
  --shadow-panel: -8px 0 32px rgba(29,33,40,.12);
}
/* DS ReqopsMark day variant (shipped upstream 2026-07-28): ink mark on paper.
   :where() keeps specificity low so explicit variants (.rq-ink FAB) still win. */
:where(.theme-day) .rq-svg { --glow: transparent; --comet: #0c0e12; } /* brand-exception: 1:1 port of DS ReqopsMark.css day variant (register #1) */
:where(.theme-day) .rq-svg .rq-ghost { opacity: .16; }
:where(.theme-day) .rq-svg .rq-trail { opacity: .6; }

/* DS density switch — set on <html> from (pointer: coarse) at boot */
[data-density="mobile"] {
  --ctrl-py: 11px;
  --ctrl-px: 16px;
  --ctrl-minh: 44px;
  --ctrl-fs: 15px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; accent-color: var(--accent); }
.num, .tabular { font-variant-numeric: tabular-nums; }
/* [hidden] must always win — display rules on .chip etc. would otherwise override the UA default */
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--on-accent); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

/* ==========================================================================
   App shell
   ========================================================================== */
#app { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  height: 48px; min-height: 48px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 40;
}
.breadcrumbs { display: flex; align-items: center; gap: 6px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs .crumb-sep { color: var(--text-faint); }
.breadcrumbs .crumb-current { color: var(--text); }

.topbar-center { flex: 1; display: flex; justify-content: center; min-width: 0; padding: 0 12px; }
.search-launcher {
  width: 100%; max-width: 520px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 10px; cursor: pointer; color: var(--text-faint);
}
.search-launcher:hover { border-color: var(--border-2); color: var(--text-dim); }
.search-launcher-icon { opacity: .8; }
.search-launcher-text { flex: 1; text-align: left; }
.kbd-hint { display: flex; gap: 3px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

/* ReqOps brand lockup — loop mark + lowercase wordmark (Space Grotesk 500) */
.brand-lockup { display: flex; align-items: center; gap: 8px; user-select: none; }
.brand-word { font-weight: 500; letter-spacing: -0.035em; font-size: 15.5px; color: var(--text); line-height: 1; }

.icon-btn {
  background: transparent; border: 1px solid transparent; border-radius: var(--radius);
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-dim);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn.spinning { animation: spin 1s linear infinite; color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.shell { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: 240px; min-width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 10px 8px;
  overflow-y: auto;
  transition: margin-left var(--dur-panel) var(--ease-loop), opacity var(--dur-panel) var(--ease-loop);
}
.shell.sidebar-collapsed .sidebar { margin-left: -240px; opacity: 0; pointer-events: none; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--radius);
  color: var(--text-dim);
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.nav a.active .nav-ic { color: var(--text); }
.nav-ic { width: 16px; display: inline-flex; justify-content: center; opacity: .85; }

.sidebar-section { margin-bottom: 14px; }
.sidebar-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
  color: var(--text-faint); padding: 4px 10px; display: flex; align-items: center; justify-content: space-between;
}
.sidebar-list { display: flex; flex-direction: column; gap: 1px; }
.sidebar-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--radius);
  color: var(--text-dim); cursor: pointer; position: relative;
}
.sidebar-item:hover { background: var(--surface-2); color: var(--text); }
.sidebar-item.active { background: var(--surface-2); color: var(--text); }
.sidebar-item .key-chip { font-size: 10px; }
.sidebar-item .proj-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-item .pin-star {
  opacity: 0; cursor: pointer; color: var(--text-dim); font-size: 13px; padding: 2px;
}
.sidebar-item:hover .pin-star, .sidebar-item .pin-star.pinned { opacity: 1; }
.sidebar-item .pin-star.pinned { color: var(--text); }
.sidebar-empty-hint { color: var(--text-faint); font-size: 12px; padding: 6px 10px; }

.main { flex: 1; min-width: 0; overflow-y: auto; position: relative; }
.view { padding: 20px 24px 60px; max-width: 1400px; margin: 0 auto; }

/* ==========================================================================
   Typography helpers
   ========================================================================== */
h1, h2, h3 { margin: 0 0 4px; font-weight: 600; letter-spacing: -0.01em; }
.h-page { font-size: 19px; }
.h-section { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mt-12 { margin-top: 12px; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }
.text-right { text-align: right; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: var(--ctrl-py) var(--ctrl-px); min-height: var(--ctrl-minh); font-size: var(--ctrl-fs); border-radius: var(--radius);
  border: 1px solid var(--border-2); background: transparent; color: var(--text-dim);
  cursor: pointer; white-space: nowrap; font-weight: 600;
}
.btn:hover { border-color: var(--edge); background: transparent; color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: transparent; border-color: var(--err); color: var(--err); }
.btn.danger:hover { background: rgba(var(--err-rgb), .1); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--text-soft); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn.lg { padding: 12px 26px; font-size: 14px; }
.btn.block { width: 100%; }

/* ==========================================================================
   Chips / badges / avatars
   ========================================================================== */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--surface-2); border: 1px solid transparent; color: var(--text-dim);
  white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.status-todo { color: var(--todo); background: var(--todo-tint); }
.chip.status-in_progress { color: var(--in_progress); background: var(--info-tint); }
.chip.status-done { color: var(--done); background: var(--ok-tint); }
.chip.blocked-chip { color: var(--err); background: var(--err-tint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; }
.chip.clickable { cursor: pointer; }
.chip.clickable:hover { filter: brightness(1.25); }
.chip.clickable.active { border-color: var(--edge); color: var(--text); }
.chip.removable { padding-right: 5px; }
.chip .chip-x { cursor: pointer; opacity: .7; margin-left: 2px; }
.chip .chip-x:hover { opacity: 1; }

/* overdue / due-soon chip */
.chip.due-chip { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; }
.chip.due-chip.overdue { color: var(--err); border-color: var(--err-line); background: var(--err-tint); }
.chip.due-chip.due-soon { color: var(--warn); border-color: var(--warn-line); background: var(--warn-tint); }

/* SLA clock chips (REQ-12.5) */
.sla-clocks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip.sla-chip { font-size: 11px; font-weight: 600; padding: 2px 8px; }
.chip.sla-chip.sla-ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-tint); }
.chip.sla-chip.sla-due-soon { color: var(--warn); border-color: var(--warn-line); background: var(--warn-tint); }
.chip.sla-chip.sla-overdue { color: var(--err); border-color: var(--err-line); background: var(--err-tint); }
.sla-settings .mini-input { max-width: 100px; }

.key-chip {
  font-family: var(--mono);
  font-size: 11px; font-weight: 500; color: var(--muted);
  background: transparent; border-radius: 6px;
  padding: 1px 6px;
}

.badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--radius);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  background: transparent; color: var(--text-dim); border: 1px solid var(--border);
}
.badge.active { color: var(--ok); border-color: var(--ok-line); }
.badge.future { color: var(--info); border-color: rgba(var(--info-rgb), .35); }
.badge.closed { color: var(--todo); border-color: var(--border-2); }

.type-dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.type-dot.story { background: var(--ok); border-radius: 2px; }
.type-dot.bug { background: var(--err); border-radius: 50%; }
.type-dot.task { background: var(--info); border-radius: 2px; }
.type-dot.subtask { background: var(--info); border-radius: 2px; opacity: .6; }
.type-dot.epic { background: var(--epic); border-radius: 2px; }
.type-dot.default { background: var(--text-dim); }

/* Derived activity signals (plan 12 P1/P2): ambient dot + drift chip.
   Healthy motion stays near-silent; only staleness asks for the eye. */
.sig-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.sig-dot.sig-motion { background: var(--ok); opacity: .55; }
.sig-dot.sig-quiet { background: var(--text-dim); opacity: .45; }
.sig-dot.sig-stalled { background: var(--warn); opacity: .85; }
.chip.drift-chip { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; color: var(--warn); border-color: var(--warn-line); background: var(--warn-tint); }
.board-card .chip.drift-chip { background: transparent; border-color: transparent; padding: 2px 0; } /* on cards the stale marker is plain text, not a pill */
.board-card.card-aged { opacity: .82; }
.board-card.card-aged:hover, .board-card.card-aged:focus-visible { opacity: 1; }

/* Backlog auto-rest (plan 12 M4): one quiet collapsed section; rows fade. */
.resting-section .backlog-section-title { cursor: pointer; user-select: none; }
.resting-section .backlog-section-title:hover { color: var(--text); }
.backlog-row.row-resting { opacity: .6; }
.backlog-row.row-resting:hover, .backlog-row.row-resting.kb-focus { opacity: 1; }

.priority-tick { font-size: 12px; line-height: 1; }
.priority-tick.p-highest, .priority-tick.p-high { color: var(--err); }
.priority-tick.p-medium { color: var(--warn); }
.priority-tick.p-low, .priority-tick.p-lowest { color: var(--info); }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-weight: 700; color: var(--ink); flex-shrink: 0;
  letter-spacing: -.02em;
}
/* unassigned: neutral dashed outline, not an error-looking "?" */
.avatar.unassigned { background: transparent; border: 1px dashed var(--border-2); color: var(--text-faint); }
.avatar.xs { width: 18px; height: 18px; font-size: 8.5px; }
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.md { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -6px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

.project-avatar {
  width: 36px; height: 36px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: var(--text); flex-shrink: 0;
}
.project-avatar.lg { width: 48px; height: 48px; font-size: 16px; border-radius: var(--radius); }
/* ==========================================================================
   Card / surface / skeleton
   ========================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius-lg);
  padding: 16px;
}
.card.pad-sm { padding: 12px; }
.card.hover:hover { border-color: var(--border-2); cursor: pointer; }

.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--border) 37%, var(--card) 63%);
  background-size: 400% 100%;
  animation: sk 1.4s ease infinite;
  border-radius: 6px;
}
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skeleton.line { height: 12px; margin-bottom: 8px; }
.skeleton.line.w-60 { width: 60%; }
.skeleton.line.w-40 { width: 40%; }
.skeleton.line.w-80 { width: 80%; }
.skeleton.block { height: 80px; }
.skeleton.circle { border-radius: 50%; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 20px; color: var(--muted); text-align: center; gap: 6px;
}
.empty-state .empty-icon { font-size: 28px; opacity: .45; margin-bottom: 6px; }
.empty-state .empty-hint { font-size: 12.5px; color: var(--text-faint); }

/* ==========================================================================
   Stat cards / dashboard
   ========================================================================== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-card { display: flex; flex-direction: column; gap: 4px; }
.stat-card .stat-value { font-size: 26px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.stat-card .stat-label { color: var(--muted); font-size: 12px; }

.progress-bar { height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--done); border-radius: 3px; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.project-card { display: flex; flex-direction: column; gap: 10px; }
.project-card .pc-top { display: flex; align-items: center; gap: 10px; }
.project-card .pc-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-card .pc-meta { color: var(--muted); font-size: 12px; }
.project-card .pin-star { opacity: 0; cursor: pointer; color: var(--text-faint); font-size: 14px; padding: 2px; }
.project-card:hover .pin-star, .project-card .pin-star.pinned { opacity: 1; }
.project-card .pin-star.pinned { color: var(--text); }

.activity-feed { display: flex; flex-direction: column; }
.activity-row { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--surface-2); cursor: pointer; }
.activity-row:last-child { border-bottom: none; }
.activity-row:hover .activity-text { color: var(--text); }
.activity-row.no-click { cursor: default; }
.activity-row.no-click:hover .activity-text { color: inherit; }
.activity-text { flex: 1; color: var(--text-soft); }
.activity-time { color: var(--text-faint); font-size: 11.5px; white-space: nowrap; }

.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }

/* dashboards (REQ-18) */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: start;
}
.gadget-card { display: flex; flex-direction: column; min-height: 180px; overflow: hidden; }
.gadget-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-bottom: 10px; border-bottom: 1px solid var(--surface-2); margin-bottom: 10px;
}
.gadget-title { font-weight: 600; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gadget-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.gadget-body { flex: 1; overflow: auto; }
.gadget-move-btns { display: inline-flex; gap: 2px; }
.data-table.compact th, .data-table.compact td { padding: 6px 8px; font-size: 12.5px; }
.btn.xs { padding: 2px 6px; font-size: 11px; min-height: 0; }

/* migration hero */
.sync-banner {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 8px 16px; background: linear-gradient(180deg, var(--warn-tint), var(--surface));
  border-bottom: 1px solid var(--warn-line); font-size: 13px; color: var(--text);
}
.sync-banner-text { flex: 1; text-align: center; }
.migration-hero {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 60px 20px; gap: 18px;
}
.migration-hero .mh-title { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.migration-hero .mh-sub { color: var(--text-dim); max-width: 460px; }
.phase-bars { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 560px; text-align: left; }
.phase-bar-row { display: flex; flex-direction: column; gap: 4px; }
.phase-bar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.phase-bar-label .ph-name { text-transform: capitalize; color: var(--text); font-weight: 600; }
.phase-bar-track { height: 6px; background: var(--border); border-radius: 6px; overflow: hidden; }
.phase-bar-track > span { display: block; height: 100%; background: var(--accent); transition: width var(--dur-panel) var(--ease-loop); }
.phase-bar-row.done .phase-bar-track > span { background: var(--ok); }
.log-tail {
  width: 100%; max-width: 560px; text-align: left; background: var(--bg);
  border: 1px solid var(--surface-2); border-radius: var(--radius); padding: 10px 12px;
  height: 160px; overflow-y: auto; font-family: var(--mono); font-size: 11.5px; color: var(--muted);
}
.log-tail div { padding: 1px 0; }
.verify-report { width: 100%; max-width: 560px; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.verify-row { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: var(--radius); background: var(--surface-2); font-size: 12.5px; }
.verify-row.ok { color: var(--ok); }
.verify-row.bad { color: var(--err); }
.verify-row.warn { color: var(--warn); }
.verify-gap-list { margin: 4px 0 0; padding-left: 18px; color: var(--text-dim); }
.verify-samples, .verify-phase-stats { margin-top: 8px; }
/* ==========================================================================
   Tabs
   ========================================================================== */
.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--surface-2); margin-bottom: 16px; }
.tab-bar button {
  background: transparent; border: none; border-bottom: 2px solid transparent;
  padding: 8px 4px 12px; margin-right: 18px; color: var(--muted); cursor: pointer; font-weight: 500; font-size: 13.5px;
}
.tab-bar button.active { font-weight: 600; }
.tab-bar button:hover { color: var(--text); opacity: 1; }
.tab-bar button.active { color: var(--text); border-bottom-color: var(--text); opacity: 1; }
.tab-bar button.is-empty { opacity: .55; }
.tab-bar button .tab-count { color: var(--text-faint); font-weight: 500; font-size: 11px; margin-left: 4px; font-family: var(--mono); }
/* Inside the drawer the tab strip reads as filter chips — pills with a neutral
   active state (amber is reserved for capture/commit; DS ruling 2026-07-28) —
   while page-level tab bars keep the underline. The strip also becomes the
   Activity section separator (top border). */
.drawer .tab-bar { border-bottom: none; border-top: 1px solid var(--surface-2); gap: 6px; margin-top: 24px; margin-bottom: 14px; padding-top: 16px; }
.drawer .tab-bar button { border: 1px solid transparent; border-radius: 999px; padding: 3px 10px; margin-right: 0; font-size: 11.5px; font-weight: 600; }
.drawer .tab-bar button.active { color: var(--text); background: var(--surface-2); border-color: var(--edge); }
.drawer .tab-bar button:hover { color: var(--text); }
.drawer .empty-state { padding: 20px; }
.drawer .empty-state .empty-icon { font-size: 20px; }

/* ==========================================================================
   Project header
   ========================================================================== */
.project-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.project-header .ph-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.project-header .ph-count { color: var(--muted); font-size: 12px; }
.star-toggle { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--muted); }
.star-toggle.pinned { color: var(--text); }
.sync-btn { display: inline-flex; align-items: center; gap: 6px; }
.sync-btn .vic { font-size: 14px; }
.sync-btn.syncing { color: var(--accent); }
.sync-btn.syncing .vic { animation: spin 1s linear infinite; }
/* ==========================================================================
   Board
   ========================================================================== */
.board-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.board-toolbar select { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; }
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-input {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 10px; min-width: 200px;
}
.filter-input:focus, input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
.assignee-filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.assignee-chip {
  display: flex; align-items: center; gap: 5px; padding: 3px 9px 3px 3px; border-radius: 999px;
  background: transparent; border: 1px solid var(--border); cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-dim);
}
.assignee-chip.active { border-color: var(--edge); color: var(--text); background: var(--surface-2); }

.board-columns { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.board-column { flex: 1; min-width: 260px; max-width: 320px; background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius-xl); display: flex; flex-direction: column; max-height: calc(100vh - 260px); }
.board-column-head {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 12px;
  border-bottom: 1px solid var(--surface-2); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint);
}
.board-column-head .count { color: var(--text-faint); font-weight: 500; text-transform: none; letter-spacing: 0; font-family: var(--mono); font-size: 11px; }
.board-column.cat-todo .board-column-head { color: var(--todo); }
.board-column.cat-in_progress .board-column-head { color: var(--in_progress); }
.board-column.cat-done .board-column-head { color: var(--done); }
.board-column-body { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.board-column-body.drag-over { background: rgba(var(--accent-rgb), .06); outline: 2px dashed var(--accent-dim); outline-offset: -4px; }
.board-column.wip-exceeded .board-column-head { outline: 1px solid var(--warn); }
.board-column-add {
  flex: 0 0 auto; min-width: 140px; padding: 14px 18px;
  background: transparent; border: 1px dashed var(--border-2); border-radius: var(--radius-xl);
  color: var(--text-faint); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; align-self: stretch;
  max-height: calc(100vh - 260px); justify-content: center;
}
.board-column-add:hover { color: var(--accent); border-color: var(--accent-line); background: transparent; }
.board-column-head .count.wip-warn { color: var(--warn); }
.board-config-columns { display: flex; flex-direction: column; gap: 14px; }
.board-config-col { padding: 10px; border: 1px solid var(--surface-2); border-radius: var(--radius); background: var(--surface); }
.board-config-statuses { display: flex; flex-wrap: wrap; gap: 6px; }

.board-card {
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius-lg);
  padding: 12px 14px; cursor: grab; display: flex; flex-direction: column; gap: 6px;
}
.board-card:hover { border-color: var(--border-2); }
.board-card.dragging { opacity: .4; }
.board-card .bc-top { display: flex; align-items: center; gap: 6px; }
.board-card .bc-summary { font-size: 13.5px; font-weight: 500; color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.board-card .bc-bottom { display: flex; align-items: center; justify-content: space-between; }
.board-card .bc-key { font-family: var(--mono); font-size: 11px; color: var(--muted); font-weight: 500; }
.points-chip { font-size: 10.5px; font-weight: 600; color: var(--muted); background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; }

/* ==========================================================================
   Table (List / Search / Backlog)
   ========================================================================== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--surface-2); cursor: pointer; white-space: nowrap; user-select: none;
}
.data-table th:hover { color: var(--text); }
.data-table th.sorted { color: var(--text); }
/* Sortable headers: the arrow slot is always reserved so a label never shifts
   sideways when it becomes the active sort. Non-sortable headers (action and
   icon columns) keep the default cursor so they don't advertise a click. */
.data-table th:not(.th-sortable) { cursor: default; }
.data-table th:not(.th-sortable):hover { color: var(--text-faint); }
.data-table th.th-sortable { cursor: pointer; }
.data-table th.th-sortable:focus-visible { outline: 1px solid var(--accent); outline-offset: -2px; }
.th-sort-arrow { display: inline-flex; align-items: center; width: 12px; height: 12px; margin-left: 4px; vertical-align: middle; }
.th-sort-arrow svg { width: 12px; height: 12px; }
.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--surface-2); vertical-align: middle; }
.data-table tr.row-clickable { cursor: pointer; }
.data-table tr.row-clickable:hover td { background: var(--surface-2); }
.data-table td.cell-summary { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; color: var(--muted); font-size: 12px; }
.pagination .pg-btns { display: flex; gap: 6px; }

/* backlog */
.backlog-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 600; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.backlog-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; }
.backlog-row:hover { background: var(--surface-2); }
.backlog-row .bl-summary { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--text-soft); }

/* sprints tab */
.sprint-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.sprint-card { display: flex; flex-direction: column; gap: 8px; }
.sprint-card .sc-top { display: flex; align-items: center; justify-content: space-between; }
.sprint-card .sc-dates { color: var(--muted); font-size: 11.5px; }
.sprint-card .sc-goal { font-size: 12px; color: var(--muted); }

/* about tab */
.meta-table { width: 100%; border-collapse: collapse; }
.meta-table td { padding: 6px 8px; border-bottom: 1px solid var(--surface-2); font-size: 12.5px; }
.meta-table td:first-child { color: var(--muted); width: 140px; }
/* ==========================================================================
   Drawer / Modal / Menu / Toast
   ========================================================================== */
.scrim {
  position: fixed; inset: 0; background: var(--scrim); z-index: 90;
  animation: fadein var(--dur-tap) ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 620px; max-width: 100vw;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: none;
  z-index: 91; display: flex; flex-direction: column; animation: slidein var(--dur-panel) var(--ease-loop);
}
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--surface-2); }
/* Full-page item view (#/item/KEY/full): the same drawer, as a whole page.
   Content stays at a readable measure, centered; the panel fills the viewport. */
.drawer.full-page { width: 100vw; max-width: 100vw; border-left: none; }
.drawer.full-page .drawer-header { width: 100%; max-width: 1080px; margin: 0 auto; }
.drawer.full-page .drawer-body { width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 32px 48px; }
.drawer-header .dh-back { cursor: pointer; color: var(--text-dim); }
.drawer-header .dh-back:hover { color: var(--text); }
.drawer-header .dh-key { cursor: pointer; font-family: var(--mono); font-weight: 600; font-size: 12px; color: var(--muted); }
.drawer-header .dh-key:hover { color: var(--text); }
.drawer-header .dh-spacer { flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 32px; }
.drawer-title-input, .item-title {
  font-size: 19px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; width: 100%; background: transparent; border: 1px solid transparent;
  border-radius: var(--radius); padding: 5px 7px; margin: 0 0 6px -7px;
}
.item-title:hover { background: var(--surface-2); cursor: text; }
.drawer-title-input:focus { background: var(--surface); border-color: var(--accent); }

/* essentials strip: unlabeled, self-describing controls under the title */
.essentials { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; margin: 0 0 18px -8px; }
.essentials .ess-points { display: inline-flex; align-items: baseline; gap: 3px; margin-left: 4px; }
.labels-row { margin: -8px 0 16px; }

/* details disclosure: the metadata long tail, collapsed by default */
.details-section { margin: 2px 0 18px; }
.utility-row { display: flex; align-items: center; gap: 18px; }
.utility-row .quiet-add { margin: 0; }
.details-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 4px 0; cursor: pointer;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint);
}
.details-toggle::before { content: ''; display: inline-block; width: 9px; height: 9px; vertical-align: middle; background-color: currentColor; -webkit-mask: var(--vic-chevron) center / contain no-repeat; mask: var(--vic-chevron) center / contain no-repeat; transition: transform var(--dur-tap) ease; }
.details-toggle.open::before { transform: rotate(90deg); }
.details-toggle:hover { color: var(--text); }
.details-body { padding-top: 12px; }

.link-btn.quiet-add { color: var(--muted); font-size: 12px; font-weight: 600; margin: 2px 0 6px; }
.link-btn.quiet-add:hover { color: var(--text); text-decoration: none; }

.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-bottom: 18px; }
.meta-field { display: flex; flex-direction: column; gap: 4px; }
.meta-field .mf-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.meta-field .mf-value { display: flex; align-items: center; gap: 6px; min-height: 26px; }
.meta-field-full { grid-column: 1 / -1; }
.custom-fields-section .cf-value { cursor: pointer; min-height: 22px; }
.custom-fields-section .cf-value:hover { color: var(--text); }
.screen-pick-list { max-height: 220px; overflow-y: auto; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.menu-trigger { display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 3px 8px; border-radius: var(--radius); border: 1px solid transparent; }
.menu-trigger:hover { background: var(--surface-2); border-color: var(--border); }
.chip-row { display: flex; gap: 5px; flex-wrap: wrap; }

.desc-block { margin-bottom: 18px; white-space: pre-wrap; line-height: 1.6; font-size: 13.5px; color: var(--text-soft); }
.desc-block.empty { color: var(--text-faint); font-style: italic; }

/* ADF rich text (descriptions, comments) — CX-AUDIT-FIX item 6 */
.adf-body { white-space: normal; }
.adf-p { margin: 0 0 10px; }
.adf-p:last-child { margin-bottom: 0; }
.adf-h1, .adf-h2, .adf-h3, .adf-h4, .adf-h5 { margin: 16px 0 8px; line-height: 1.3; font-weight: 600; }
.adf-h1 { font-size: 18px; }
.adf-h2 { font-size: 16px; }
.adf-h3 { font-size: 14.5px; }
.adf-h4 { font-size: 13.5px; }
.adf-h5 { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; }
.adf-list { margin: 0 0 10px; padding-left: 22px; }
.adf-list .adf-list { margin-bottom: 0; }
.adf-quote { margin: 0 0 10px; padding: 2px 12px; border-left: 3px solid var(--border-2); color: var(--text-dim); }
.adf-code {
  margin: 0 0 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--surface-2);
  border-radius: var(--radius); overflow-x: auto; font-size: 12px; line-height: 1.5;
  font-family: var(--mono);
}
.adf-code code { background: none; padding: 0; border: none; }
.adf-body code { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; font-size: 12px; font-family: var(--mono); }
.adf-body a { color: var(--accent); text-decoration: underline; }
.adf-body hr { border: none; border-top: 1px solid var(--surface-2); margin: 14px 0; }
.adf-table-wrap { overflow-x: auto; margin: 0 0 12px; }
.adf-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.adf-table th, .adf-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.adf-table th { background: var(--surface); font-weight: 600; color: var(--text-dim); }
.adf-table tr:nth-child(even) td { background: var(--stripe); }
.adf-mention { color: var(--accent); background: var(--accent-tint); border: 1px solid var(--accent-line); border-radius: 6px; padding: 0 5px; font-weight: 600; font-size: 12px; }
.adf-media-single, .adf-media-group { margin: 8px 0 12px; }
.adf-media-img { max-width: 100%; height: auto; border-radius: var(--radius-lg); border: 1px solid var(--surface-2); display: block; }
.adf-media-unavailable { font-size: 12px; color: var(--muted); background: var(--surface); border: 1px dashed var(--border-2); border-radius: var(--radius); padding: 8px 12px; }

/* ---- rich description editor (WYSIWYG ⇄ ADF) ---- */
.rte { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.rte:focus-within { border-color: var(--accent); }
.rte-toolbar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 5px 8px; border-bottom: 1px solid var(--border); background: var(--surface); }
.rte-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border: none; border-radius: 6px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.rte-btn:hover { background: var(--surface-2); color: var(--text); }
.rte-btn.active { background: var(--surface-2); color: var(--text); }
.rte-btn-text { font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.rte-sep { width: 1px; height: 16px; background: var(--border); margin: 0 5px; }
.rte-spacer { flex: 1; }
.rte-linkrow { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); color: var(--muted); }
.rte-linkrow input { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; outline: none; }
.rte-linkrow input:focus { border-color: var(--accent); }
.rte-surface {
  min-height: 130px; max-height: 55vh; overflow-y: auto;
  padding: 10px 12px; outline: none;
  font-size: 13.5px; line-height: 1.6; cursor: text;
}
.rte-surface.rte-empty::before { content: attr(data-placeholder); color: var(--text-faint); font-style: italic; float: left; pointer-events: none; }
/* newly typed blocks are bare tags (no adf-* classes), so style tags directly */
.rte-surface p { margin: 0 0 10px; }
.rte-surface p:last-child { margin-bottom: 0; }
.rte-surface h1, .rte-surface h2, .rte-surface h3, .rte-surface h4, .rte-surface h5 { margin: 16px 0 8px; line-height: 1.3; font-weight: 600; }
.rte-surface h1:first-child, .rte-surface h2:first-child, .rte-surface h3:first-child { margin-top: 0; }
.rte-surface h1 { font-size: 18px; }
.rte-surface h2 { font-size: 16px; }
.rte-surface h3 { font-size: 14.5px; }
.rte-surface ul, .rte-surface ol { margin: 0 0 10px; padding-left: 22px; }
.rte-surface ul ul, .rte-surface ol ol, .rte-surface ul ol, .rte-surface ol ul { margin-bottom: 0; }
.rte-surface blockquote { margin: 0 0 10px; padding: 2px 12px; border-left: 3px solid var(--border-2); color: var(--text-dim); }
.rte-surface pre {
  margin: 0 0 10px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--surface-2);
  border-radius: var(--radius); overflow-x: auto; font-size: 12px; line-height: 1.5;
  font-family: var(--mono); white-space: pre-wrap;
}
.rte-surface code { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; font-size: 12px; font-family: var(--mono); }
.rte-surface pre code { background: none; border: none; padding: 0; }
.rte-surface hr { border: none; border-top: 1px solid var(--surface-2); margin: 14px 0; }

/* Comments tab empty state: a quiet inline line, not a hero block — the
   composer right below it is the call to action. */
.comments-empty { display: flex; align-items: center; gap: 8px; padding: 12px 2px; color: var(--text-faint); font-size: 12.5px; }
.comments-empty svg, .comments-empty .empty-icon { opacity: .5; }

.comment { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--surface-2); }
.comment:last-child { border-bottom: none; }
.comment-body { flex: 1; }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.comment-author { font-weight: 600; color: var(--text-soft); }
.comment-time { color: var(--text-faint); font-size: 11.5px; }
.zilla-badge { font-size: 9.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0 4px; }
.comment-text { white-space: pre-wrap; font-size: 13px; color: var(--text-soft); line-height: 1.55; }
/* Integrated composer: avatar gutter + one card that holds the textarea and
   its footer (hints + send). The card carries the border/focus ring; the
   textarea inside is chromeless and auto-grows, so at rest the whole thing
   reads as one quiet input line. */
.comment-composer { display: flex; gap: 10px; padding-top: 14px; position: sticky; bottom: 0; background: var(--surface); }
.composer-card {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color var(--dur-tap) ease;
}
.composer-card:focus-within { border-color: var(--accent-line); }
.comment-composer textarea {
  width: 100%; display: block; background: transparent; border: none; border-radius: var(--radius);
  padding: 9px 12px 4px; min-height: 38px; max-height: 240px; resize: none; overflow-y: auto; line-height: 1.5;
}
.comment-composer textarea:focus { outline: none; }
.composer-card .composer-paste-strip { margin: 0; padding: 0 12px 8px; }
.composer-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 6px 6px 12px;
}
.composer-hint { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; }
.composer-hint .hint-sep { opacity: .6; }

/* history timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 1px; background: var(--surface-2); }
.timeline-entry { position: relative; margin-bottom: 18px; }
.timeline-entry::before {
  content: ""; position: absolute; left: -26px; top: 3px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--edge); border: 2px solid var(--surface);
}
.timeline-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.timeline-author { font-weight: 600; color: var(--text-soft); font-size: 12px; }
.timeline-time { color: var(--text-faint); font-size: 11.5px; }
.timeline-changes { display: flex; flex-direction: column; gap: 5px; }
.timeline-change { font-size: 12.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.timeline-field { color: var(--muted); font-weight: 600; }
.timeline-arrow { color: var(--text-faint); }
.timeline-val { color: var(--text-soft); }
.timeline-val.empty-val { color: var(--text-faint); font-style: italic; }

.attachment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.attachment-tile { border: 1px solid var(--surface-2); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); cursor: pointer; }
.attachment-tile.skipped { opacity: .45; cursor: help; }
.attachment-thumb { width: 100%; height: 80px; object-fit: cover; display: block; background: var(--bg); }
.attachment-ext { width: 100%; height: 80px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.attachment-cap { padding: 6px 8px; font-size: 10.5px; color: var(--muted); }
.attachment-cap .ac-name { color: var(--text-soft); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.link-group-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--text-faint); margin: 14px 0 6px; text-transform: uppercase; }
.link-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; cursor: pointer; border-bottom: 1px solid var(--surface-2); }
.link-row:hover .link-summary { color: var(--text); }
.link-summary { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* generic modal (quick-open, status picker) */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.modal {
  width: 560px; max-width: 92vw; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop); overflow: hidden; animation: popin var(--dur-tap) ease;
}
@keyframes popin { from { transform: scale(.98); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.qo-input-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.qo-input-row input { flex: 1; background: transparent; border: none; font-size: 15px; }
.qo-input-row input:focus { outline: none; }
.qo-results { max-height: 420px; overflow-y: auto; padding: 6px; }
.qo-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--text-faint); padding: 8px 10px 4px; }
.qo-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; }
.qo-item.active, .qo-item:hover { background: var(--surface-2); }
.qo-item .qo-summary { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qo-empty { padding: 30px; text-align: center; color: var(--text-faint); font-size: 12.5px; }
.qo-footer { display: flex; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }

/* popover menu */
.menu-popover {
  position: fixed; z-index: 120; min-width: 200px; max-width: 320px;
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop); padding: 6px; max-height: 340px; overflow-y: auto;
}
.menu-search { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; margin-bottom: 6px; }
.menu-group-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--text-faint); padding: 6px 8px 2px; }
.menu-option { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.menu-option:hover, .menu-option.active { background: var(--surface-2); }
.menu-option .mo-count { margin-left: auto; color: var(--text-faint); font-size: 11px; font-family: var(--mono); }
.menu-empty { padding: 10px; color: var(--text-faint); font-size: 12px; text-align: center; }

/* toast */
.toast-host { position: fixed; top: 58px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius-lg);
  background: var(--surface-2); border: 1px solid var(--border-2); box-shadow: var(--shadow-toast);
  animation: toastin var(--dur-tap) ease; font-size: 13px; max-width: 340px;
}
@keyframes toastin { from { transform: translateY(-6px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast.ok { border-color: rgba(var(--ok-rgb), .4); }
.toast.ok .toast-ic { color: var(--ok); }
.toast.err { border-color: rgba(var(--err-rgb), .4); }
.toast.err .toast-ic { color: var(--err); }
.toast.info .toast-ic { color: var(--info); }

/* kbd */
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px;
  padding: 0 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 3px;
  font-size: 10px; color: var(--muted); font-family: var(--mono);
}

/* my-work */
.mywork-section { margin-bottom: 26px; }
.mywork-list { display: flex; flex-direction: column; gap: 6px; }
.mywork-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-lg); cursor: pointer; background: var(--surface); border: 1px solid var(--surface-2); }
.mywork-row:hover { border-color: var(--edge); }
.mywork-row .mw-summary { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.assignee-picker { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }

/* search view */
.zql-box { margin-bottom: 8px; }
.zql-input { width: 100%; padding: 12px 14px; font-size: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.search-mode-bar { display: flex; align-items: center; }
.ask-english-toggle { cursor: pointer; font-size: 13px; }
.nl-explanation { padding: 8px 12px; background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius); }
.similar-items-section, .dup-warning { padding: 8px 0; }
/* similar items read as one quiet line, not a stacked section */
.similar-items-section { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.similar-items-section .mb-4 { margin-bottom: 0; }
.similar-items-section .similar-list { display: flex; flex-direction: row; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.similar-items-section .similar-row { margin-bottom: 0; }
.similar-items-section .cell-summary { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zql-error { color: var(--err); font-size: 12.5px; margin: 6px 2px 14px; }
.zql-examples { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.zql-example { cursor: pointer; }

/* responsive */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
  .breadcrumbs { max-width: 120px; }
  .search-launcher-text { display: none; }
  .kbd-hint { display: none; }
  .wordmark { display: none; }
  .view { padding: 16px 14px 48px; }
  .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 640px; }
  .tab-bar { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .ni-row { grid-template-columns: 1fr; }
  .ni-modal { width: 100%; max-width: 100vw; }
}

@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 0 8px; }
  .topbar-center { padding: 0 4px; }
  #newItemBtn .btn-label { display: none; }
  .meta-grid { grid-template-columns: 1fr; }
  .board-columns { flex-direction: column; overflow-x: visible; gap: 10px; }
  .board-column { min-width: 0; max-width: none; max-height: none; }
  .board-column-body { max-height: 420px; }
  .board-card { cursor: pointer; }
  .board-card[draggable="true"] { cursor: default; }
  .board-card .bc-move { display: inline-flex; font-size: 11px; padding: 2px 7px; }
  .board-card:not(:hover) .bc-move { opacity: 1; }
  .board-toolbar { gap: 6px; }
  .board-toolbar select, .filter-input { flex: 1; min-width: 0; }
  .filter-bar { flex-wrap: wrap; }
  .assignee-filter-chips { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .project-grid { grid-template-columns: 1fr; }
  .modal-wrap { padding-top: 6vh; align-items: flex-start; padding-left: 8px; padding-right: 8px; }
  .modal { width: 100%; max-width: 100%; }
  .notif-popover { min-width: calc(100vw - 16px); max-width: calc(100vw - 16px); left: 8px !important; right: 8px; }
  .comment-composer textarea { min-height: 44px; font-size: 16px; } /* 16px stops iOS focus-zoom */
  .composer-hint { display: none; } /* keyboard hints are meaningless on touch */
  .drawer-body { padding: 12px; }
  .drawer-header { padding: 10px 12px; flex-wrap: wrap; }
  .item-title { font-size: 16px; word-break: break-word; }
  .digest-summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 375px) {
  .view { padding: 12px 10px 40px; }
  .h-page { font-size: 18px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 10px; }
  .topbar-right { gap: 6px; }
  .btn.sm { padding: 4px 7px; }
  .board-column-head { font-size: 12px; padding: 8px; }
  .board-card .bc-summary { font-size: 13px; -webkit-line-clamp: 3; }
  .digest-summary-grid { grid-template-columns: 1fr 1fr; }
  .digest-rag-row { grid-template-columns: 28px 1fr auto; gap: 8px; font-size: 12px; }
}

/* board keyboard focus */
.board-columns:focus { outline: none; }
.board-columns:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius); }
.board-card.kb-focus { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.board-card .bc-move { display: none; }
@media (max-width: 640px), (pointer: coarse) {
  .board-card .bc-move { display: inline-flex; }
  .board-card[draggable="true"] { -webkit-user-drag: none; user-select: none; }
}

/* executive digest (read-only, mobile-first) */
.digest-view { max-width: 720px; }
.digest-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.digest-stat { background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius-lg); padding: 12px; text-align: center; }
.digest-stat .ds-val { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.digest-stat .ds-label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-top: 2px; }
.digest-stat.rag-red .ds-val { color: var(--err); }
.digest-stat.rag-amber .ds-val { color: var(--warn); }
.digest-stat.rag-green .ds-val { color: var(--ok); }
.digest-section { margin-bottom: 24px; }
.digest-rag-list { display: flex; flex-direction: column; gap: 6px; }
.digest-rag-row {
  display: grid; grid-template-columns: 32px 1fr auto auto; gap: 10px; align-items: center;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius-lg);
  cursor: pointer;
}
.digest-rag-row:hover { border-color: var(--edge); }
.digest-rag-row .dr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.digest-watch-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius-lg); cursor: pointer;
}
.digest-watch-row:hover { border-color: var(--edge); }
.digest-watch-row .dw-summary { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.digest-readonly-hint { font-size: 12px; color: var(--text-faint); margin-bottom: 16px; }

/* visually hidden (a11y) */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* long change values in history timeline */
.timeline-val-clamped { cursor: pointer; }
.timeline-val-clamped:hover { color: var(--text); text-decoration: underline dotted; }
.timeline-val-clamped.expanded { white-space: pre-wrap; }
/* ==========================================================================
   V3 additions
   ========================================================================== */

/* notifications */
.notif-badge {
  position: absolute; top: -3px; right: -3px; min-width: 15px; height: 15px; padding: 0 3px;
  background: var(--err); color: var(--ink); border-radius: 999px; font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
/* display:flex above beats the UA's [hidden] rule — restore it so a 0-count badge
   actually disappears instead of showing a red "0" */
.notif-badge[hidden] { display: none; }
.notif-popover {
  min-width: 340px; max-width: 400px; max-height: 460px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop); display: flex; flex-direction: column;
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.notif-list { overflow-y: auto; }
.notif-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-row:hover { background: var(--hair); }
.notif-row.unread { background: rgba(var(--info-rgb), .07); }
.notif-row.unread .notif-text { color: var(--text); }
.notif-text { flex: 1; font-size: 12.5px; color: var(--text-dim); }
.notif-time { color: var(--text-faint); font-size: 11px; white-space: nowrap; }

/* sidebar user */
.sidebar-user { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.sidebar-user-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; }
.sidebar-user-row .su-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-row .su-role { text-transform: capitalize; }
.icon-btn.sm { width: 24px; height: 24px; }
.sidebar { display: flex; flex-direction: column; }

/* auth card */
.auth-overlay { position: fixed; inset: 0; z-index: 300; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.auth-card { width: 360px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 11px; }
.auth-brand .brand-word { font-size: 26px; }
.auth-sub { color: var(--text-dim); font-size: 12.5px; text-align: center; margin-bottom: 6px; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.auth-tabs button { flex: 1; background: transparent; border: 1px solid var(--border); border-radius: var(--radius); padding: 7px; cursor: pointer; color: var(--text-dim); font-weight: 600; }
.auth-tabs button.active { color: var(--text); border-color: var(--edge); background: var(--surface-2); }
.auth-input { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 11px; }
.auth-err { color: var(--err); font-size: 12px; min-height: 14px; }
.auth-hint { color: var(--text-faint); font-size: 11.5px; margin-top: -6px; }
.auth-session-expired { background: rgba(var(--err-rgb), .1); border: 1px solid var(--err); color: var(--err); font-size: 12.5px; border-radius: var(--radius); padding: 8px 11px; margin-bottom: 2px; }
.auth-claim-link { display: block; text-align: center; color: var(--text-dim); font-size: 12px; margin-top: 8px; cursor: pointer; }
.auth-claim-link:hover { color: var(--accent); text-decoration: underline; }
.auth-token-row { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
/* Auth0 / SSO sign-in on the login card (same ReqOps tenant as the other apps). */
.auth-sso-btn { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--edge); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.auth-sso-btn:hover { border-color: var(--accent); background: var(--surface); }
.auth-sso-btn:disabled { opacity: .6; cursor: progress; }
.auth-sso-btn .auth-sso-mark { width: 16px; height: 16px; flex: none; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--text-faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; margin: 2px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-sso-err { background: rgba(var(--err-rgb), .1); border: 1px solid var(--err); color: var(--err); font-size: 12.5px; border-radius: var(--radius); padding: 8px 11px; }
.auth-sso-only-note { color: var(--text-dim); font-size: 12px; text-align: center; }
.auth-sso-only-note a { color: var(--text-dim); cursor: pointer; text-decoration: underline; }


/* new item modal */
.ni-modal { width: 520px; }
.ni-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.ni-form { padding: 16px; display: flex; flex-direction: column; gap: 10px; max-height: 66vh; overflow-y: auto; }
.ni-label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 600; }
.ni-input { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; color: var(--text); font-weight: 400; text-transform: none; letter-spacing: 0; }
.ni-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ni-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }

/* inline editors */
.inline-edit { cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.inline-edit:hover { background: var(--surface-2); }
.mini-input { background: var(--surface); border: 1px solid var(--accent); border-radius: 6px; padding: 3px 6px; max-width: 130px; }
.mini-select { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; }
.chip.add-chip { cursor: pointer; color: var(--text-faint); }
.chip.add-chip:hover { color: var(--accent); }
.labels-editor { align-items: center; }

/* watch btn */
.watch-btn { font-size: 14px; }
.watch-btn.on { color: var(--text); }

/* subtasks */
.subtasks-section { margin-bottom: 8px; }
.subtask-list { display: flex; flex-direction: column; gap: 4px; }
.subtask-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.subtask-row:hover { background: var(--surface-2); }
.subtask-row .st-summary { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--text-soft); }

/* comments extras */
.comment-actions { display: inline-flex; gap: 6px; margin-left: auto; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 11.5px; padding: 0; }
.link-btn.danger { color: var(--err); }
.link-btn:hover { text-decoration: underline; }
.comment-edit, .desc-edit { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; resize: vertical; min-height: 60px; }
.composer-wrap { position: relative; }
.composer-paste-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.composer-paste-thumb { max-height: 72px; max-width: 140px; border-radius: var(--radius); border: 1px solid var(--border-2); object-fit: cover; }
.mention-box { position: absolute; bottom: 100%; left: 0; margin-bottom: 4px; min-width: 200px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow-pop); z-index: 130; max-height: 200px; overflow-y: auto; }
.mention-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; cursor: pointer; }
.mention-opt:hover { background: var(--hair); }

/* attachments extras */
.attachment-tile { position: relative; }
.at-del { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 12px; line-height: 1; display: none; } /* brand-exception: overlay on image thumbnails, theme-independent (register #1) */
.attachment-tile:hover .at-del { display: block; }
.drawer.drop-target { outline: 2px dashed var(--accent); outline-offset: -6px; }

/* links extras */
.link-unlink { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 15px; padding: 0 4px; }
.link-unlink:hover { color: var(--err); }
.link-search-results { max-height: 220px; overflow-y: auto; margin-top: 6px; }

/* development panel (REQ-20) */
.dev-event-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--surface-2);
}
.dev-event-row:last-child { border-bottom: none; }
.dev-event-icon { flex: 0 0 auto; font-size: 16px; line-height: 1.4; opacity: .85; }
.dev-event-body { flex: 1; min-width: 0; }
.dev-event-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-event-meta { flex-wrap: wrap; margin-top: 4px; }
.dev-event-link { color: var(--muted); flex: 0 0 auto; }
.dev-status { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border); text-transform: lowercase; }
.dev-status-ok { color: var(--ok); border-color: rgba(var(--ok-rgb), .35); }
.dev-status-err { color: var(--err); border-color: rgba(var(--err-rgb), .35); }
.dev-status-pending { color: var(--warn); border-color: rgba(var(--warn-rgb), .35); }

/* board column add */
.col-add { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 3px; }
.col-add:hover { color: var(--accent); }

/* backlog drag */
.backlog-sprint-section { margin-bottom: 20px; }
.backlog-drop { min-height: 30px; border-radius: var(--radius); }
.backlog-drop.drag-over { background: rgba(var(--accent-rgb), .06); outline: 2px dashed var(--accent-dim); outline-offset: -3px; }
.backlog-row { cursor: pointer; }
.backlog-row.dragging { opacity: .4; }
.drag-handle { color: var(--border-2); cursor: grab; font-size: 11px; letter-spacing: -2px; }
.sprint-goal-inline { color: var(--muted); font-size: 12px; cursor: pointer; border-bottom: 1px dashed var(--border); }
.sprint-goal-inline:hover { color: var(--text); }

/* charts */
.chart-card { background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius-xl); padding: 16px; margin-bottom: 20px; }
.chart-svg { display: block; }
.chart-legend { display: flex; gap: 16px; margin-top: 8px; }
.legend-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.burndown-slot { margin-top: 8px; }
.burndown-wrap .sparkline { margin-top: 2px; }

/* epics */
.epic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.epic-card { display: flex; flex-direction: column; }
.epic-children { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }

/* Epics outline — the epic workroom. Full-width rows: hierarchy reads vertically,
   every read surface is the edit surface. Same palette/type as the rest of the app. */
.epic-outline { display: flex; flex-direction: column; outline: none; }
.epic-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius-lg);
  margin-top: 8px;
}
.epic-row:hover { background: var(--surface); border-color: var(--border-2); }
.epic-caret { color: var(--text-faint); font-size: 11px; transition: transform var(--dur-tap) ease; width: 12px; text-align: center; }
.epic-caret.open { transform: rotate(90deg); }
.epic-title { font-weight: 500; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The title is the row's only elastic cell: it absorbs the slack and ellipsizes
   so the fixed right-hand columns (progress/status/modified/add) always fit.
   The min-width is a floor, not 0 — with 0 the fixed columns ate the whole row
   and titles collapsed to a single character. Below that floor we drop columns
   (see the media queries) rather than shrink the title into uselessness. */
.epic-row .epic-title { flex: 1 1 0; min-width: 160px; }

/* Narrow: the progress BAR is decorative next to its own "3/8 · 5/13 pts"
   label, so it goes first and the title gets its 120px back.
   NOTE: `.epic-row`/`.epic-head` prefixes are load-bearing — media queries add
   no specificity, and the plain `.epic-progress { display: flex }` rule below
   is later in the file, so an unprefixed rule here loses to it. */
@media (max-width: 1200px) {
  .epic-row .epic-progress-bar { display: none; }
  .epic-head .eh-progress { width: 70px; }
}
/* Narrower still: drop Progress entirely — header and cell together, or the
   remaining columns would sit under the wrong labels. */
@media (max-width: 1000px) {
  .epic-row .epic-progress, .epic-head .eh-progress { display: none; }
}
.epic-title:hover, .kid-summary:hover { text-decoration: underline dotted var(--text-faint); text-underline-offset: 3px; }
/* Sortable column header. Mirrors .epic-row's flex track widths (lead spacer =
   caret 12 + gap 10 + type-dot 9) so each label sits over the cell it sorts. */
.epic-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px 4px; margin-top: 4px;
  border-bottom: 1px solid var(--surface-2);
}
.epic-head-lead { flex: 0 0 auto; width: 31px; }
.epic-head-cell {
  background: none; border: 0; padding: 2px 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  font: inherit; font-size: 10.5px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-faint); white-space: nowrap;
}
.epic-head-cell:hover { color: var(--text-dim); }
.epic-head-cell.active { color: var(--text-soft); }
.epic-head-cell:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
/* Reserve the arrow slot always, so a label never shifts when it becomes active. */
.epic-head-arrow { display: inline-block; min-width: 8px; font-size: 9px; }
.epic-head .eh-key { flex: 0 0 auto; min-width: 58px; }
.epic-head .eh-title { flex: 1 1 auto; justify-content: flex-start; }
.epic-head .eh-progress { flex: 0 0 auto; width: 190px; justify-content: flex-end; }
.epic-head .eh-status { flex: 0 0 auto; width: 86px; justify-content: flex-end; }
.epic-head .eh-modified { flex: 0 0 auto; width: 74px; justify-content: flex-end; }
.epic-head-tail { flex: 0 0 auto; width: 78px; }

.epic-modified {
  flex: 0 0 auto; width: 74px; text-align: right;
  font-size: 11.5px; color: var(--text-dim);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

.epic-progress { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: 0 0 auto; }
.epic-progress-bar { width: 120px; }
.epic-progress-label { font-variant-numeric: tabular-nums; white-space: nowrap; font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); }
.epic-add-btn { flex: 0 0 auto; }
.epic-kids { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 4px 34px; }
.epic-kids[hidden] { display: none; } /* display:flex would beat the UA [hidden] rule */
.kid-row .key-chip, .epic-row .key-chip { white-space: nowrap; flex: 0 0 auto; min-width: 58px; } /* fixed key slot keeps titles column-aligned across rows */
.kid-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer;
  border-radius: 6px; border-left: 2px solid var(--surface-2);
}
.kid-row:hover { background: var(--card); }
.kid-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--text-soft); }
.kid-row .pts-chip { min-width: 26px; text-align: center; color: var(--muted); }
.kid-row .assignee-cell { display: inline-flex; }
/* click-to-assign: every assignee display is a quiet button (avatar or
   avatar+name); hover reveals the affordance without shouting */
.assignee-cell { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; border-radius: 999px; padding: 1px 3px; margin: -1px -3px; }
.assignee-cell:hover, .assignee-cell:focus-visible { background: var(--surface-2); box-shadow: 0 0 0 1px var(--border-2); outline: none; }
.assignee-cell.readonly { cursor: inherit; }
.assignee-cell.readonly:hover { background: transparent; box-shadow: none; }
.kb-focus { box-shadow: inset 0 0 0 1px var(--accent); background: var(--surface-2); }
.epic-edit-input {
  flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--accent);
  border-radius: 6px; color: var(--text); font: inherit; padding: 2px 6px;
}
.epic-edit-input.pts-input { flex: 0 0 56px; }
.add-row { display: flex; align-items: center; gap: 8px; padding: 4px 10px; }
.add-row-plus { color: var(--text-faint); }
.add-row-input {
  flex: 1; background: transparent; border: 1px dashed var(--border-2); border-radius: var(--radius);
  color: var(--text); font: inherit; padding: 7px 12px;
}
.add-row-input:focus { border-style: solid; border-color: var(--accent); outline: none; }
.add-row-input::placeholder { color: var(--text-faint); }
.epic-kbd-hint { margin: 14px 2px 4px; user-select: none; }

/* reports RAG */
.rag-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.rag-red, .rag-badge.rag-red { color: var(--err); }
.rag-dot.rag-red { background: var(--err); }
.rag-amber, .rag-badge.rag-amber { color: var(--warn); }
.rag-dot.rag-amber { background: var(--warn); }
.rag-green, .rag-badge.rag-green { color: var(--ok); }
.rag-dot.rag-green { background: var(--ok); }
.rag-badge.rag-red { border-color: rgba(var(--err-rgb), .35); }
.rag-badge.rag-amber { border-color: rgba(var(--warn-rgb), .35); }
.rag-badge.rag-green { border-color: rgba(var(--ok-rgb), .35); }
/* empty projects: nothing to rate — muted, not amber */
.rag-na, .rag-badge.rag-na { color: var(--muted); }
.rag-dot.rag-na { background: transparent; border: 1px dashed var(--border-2); }

/* saved filters */
.saved-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

/* notification prefs panel */
.notify-pref-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius-lg); cursor: pointer; }
.notify-pref-row .np-label { font-weight: 500; }
.notify-pref-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.notify-matrix-wrap { overflow-x: auto; }
.notify-matrix th, .notify-matrix td { white-space: nowrap; font-size: 12px; }
.notify-matrix-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.notify-matrix-select { min-width: 72px; font-size: 11px; }

/* toast action button (Undo etc.) */
.toast .toast-action { margin-left: 8px; padding: 3px 10px; font-size: 11.5px; }
.toast-progress { max-width: 360px; align-items: flex-start; }
.toast-progress-body { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.toast-progress-track { width: 100%; height: 4px; background: var(--border); border-radius: 2px; }
.toast-progress-pct { font-size: 11px; color: var(--muted); align-self: flex-end; font-family: var(--mono); }

/* invites / tokens */
.invite-links { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }

/* QA module */
.qa-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.qa-count-chip { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius); border: 1px solid var(--border); }
.qa-count-chip.qa-pass { color: var(--ok); border-color: rgba(var(--ok-rgb), .35); }
.qa-count-chip.qa-fail { color: var(--err); border-color: rgba(var(--err-rgb), .35); }
.qa-count-chip.qa-blocked { color: var(--warn); border-color: rgba(var(--warn-rgb), .35); }
.qa-count-chip.qa-skipped, .qa-count-chip.qa-norun { color: var(--muted); }
.qa-badge { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: var(--radius); border: 1px solid var(--border); text-transform: uppercase; letter-spacing: .04em; }
.qa-badge.qa-pass { color: var(--ok); border-color: rgba(var(--ok-rgb), .35); }
.qa-badge.qa-fail { color: var(--err); border-color: rgba(var(--err-rgb), .35); }

/* REQ-10 permission scheme matrix */
.perm-matrix { font-size: 12px; }
.perm-matrix th.perm-matrix-col,
.perm-matrix .perm-matrix-cell { text-align: center; white-space: nowrap; }
.perm-matrix .perm-matrix-cell input { margin: 0 auto; display: block; }
.group-member-list { list-style: none; padding: 0; margin: 8px 0 0; }
.group-members-panel { padding: 8px 0; }
.qa-badge.qa-blocked { color: var(--warn); border-color: rgba(var(--warn-rgb), .35); }
.qa-badge.qa-skipped, .qa-badge.qa-norun { color: var(--muted); }
.qa-case-row { padding: 12px 0; border-bottom: 1px solid var(--surface-2); }
.qa-case-row:last-child { border-bottom: none; }
.qa-case-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.qa-case-title { font-weight: 500; color: var(--text); }
.qa-case-detail { margin-bottom: 2px; }
.qa-case-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.qa-case-actions .danger-text { color: var(--err); }
.qa-defects .link-row { cursor: pointer; }
.invite-row { display: flex; align-items: center; gap: 8px; }
.invite-row .mini-input { flex: 1; max-width: none; font-size: 11px; }
.token-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--surface-2); }
.token-plain { font-family: var(--mono); font-size: 12px; background: var(--accent-tint); border: 1px solid var(--accent-line); border-radius: var(--radius); padding: 8px 10px; word-break: break-all; color: var(--accent); }

/* Impediment flag (sprint-lifecycle "Blocked?") */
.flag-btn.on { color: var(--err); }
.board-card.flagged { border-left: 3px solid var(--err); }
.bc-flag { font-size: 11px; line-height: 1; }

/* ============================================================================
   Sprints tab — PM workspace
   ========================================================================== */
.sprints-view { max-width: 960px; }
.sprints-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.sprint-section { margin-top: 24px; }
.sprint-callout {
  padding: 14px 16px; border: 1px dashed var(--accent-line); border-radius: var(--radius-lg);
  background: var(--bg); color: var(--text-dim); font-size: 13px; margin-bottom: 8px;
}

/* Active sprint panel */
.active-sprint-panel { padding: 18px 20px; margin-bottom: 16px; }
.asp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.asp-name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.asp-goal { margin: 10px 0 14px; display: flex; align-items: baseline; gap: 6px; }
.asp-goal-label { flex-shrink: 0; }
.asp-goal-text { font-size: 14px; }
.asp-goal-text:hover { text-decoration: underline dotted; }

.asp-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 4px 0 12px; }
@media (max-width: 640px) {
  .asp-metrics { grid-template-columns: repeat(2, 1fr); }
  .sprints-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .asp-head { gap: 8px; }
}
.asp-metric { background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius-lg); padding: 10px 12px; }
.asp-metric-val { font-size: 20px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.asp-metric-lbl { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-top: 3px; }
.asp-metric.danger .asp-metric-val { color: var(--err); }
.asp-progress { margin-bottom: 12px; }
.asp-burndown { margin-bottom: 8px; }
.asp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }

.asp-items { margin-top: 14px; border-top: 1px solid var(--surface-2); padding-top: 12px; }
.asp-group-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); margin: 12px 0 4px;
}
.asp-group-label.cat-in_progress { color: var(--in_progress); }
.asp-group-label.cat-done { color: var(--done); }
.asp-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px;
  cursor: pointer;
}
.asp-item:hover { background: var(--card); }
.asp-item-summary { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--text-soft); }
.asp-item-flag { flex-shrink: 0; font-size: 12px; }
.muted-avatar { display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-dim); border-radius: 50%; }
.asp-empty { padding: 10px 2px; }

.chip.subtle { color: var(--muted); border-color: var(--border); }
.chip.warn { color: var(--warn); border-color: var(--warn-line); }
.chip.danger { color: var(--err); border-color: rgba(var(--err-rgb), .4); }

/* Past sprints */
.past-sprint-list { display: flex; flex-direction: column; gap: 2px; }
.past-sprint-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 6px;
}
.past-sprint-row:hover { background: var(--card); }
.past-sprint-name { font-weight: 500; font-size: 13.5px; color: var(--text-soft); }
.past-sprint-goal { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sprint-board-setting { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--surface-2); }

/* ============================================================================
   Quick edit affordances — inline list cells, row/card action buttons
   ========================================================================== */
.inline-editable { cursor: pointer; border-radius: var(--radius); padding: 1px 4px; margin: -1px -4px; transition: background var(--dur-tap); }
.inline-editable:hover { background: var(--surface-2); box-shadow: 0 0 0 1px var(--border-2) inset; }

.bc-actions {
  background: none; border: none; color: var(--text-faint); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 2px; border-radius: var(--radius);
  opacity: 0; transition: opacity var(--dur-tap);
}
.board-card:hover .bc-actions, .bc-actions:focus { opacity: .75; }
.bc-actions:hover { opacity: 1; color: var(--text); background: var(--surface-2); }

/* Undo button inside a toast */
.toast-action { margin-left: 10px; }
/* ==========================================================================
   ORGANIZATION CARD (universal org model — zillaplan/09)
   ========================================================================== */
.mt-8 { margin-top: 8px; }
.chip.clickable.active { border-color: var(--edge); color: var(--text); }

/* ---- master-detail: tree left, selected node right ---- */
.org-layout { display: flex; gap: 24px; align-items: flex-start; }
.org-layout .org-tree {
  flex: 0 0 340px; min-width: 0; max-height: 68vh; overflow-y: auto;
  border-right: 1px solid var(--surface-2); padding-right: 16px; margin-bottom: 0;
}
.org-layout .org-detail { flex: 1; min-width: 0; }
@media (max-width: 980px) {
  .org-layout { flex-direction: column; }
  .org-layout .org-tree { flex: none; width: 100%; max-height: 40vh; border-right: none; padding-right: 0; }
}

/* ---- tree browser ---- */
.org-tree { margin-bottom: 16px; }
.org-row {
  display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: var(--radius);
  cursor: pointer; position: relative;
}
.org-row:hover { background: var(--card); }
.org-row.selected { background: var(--surface-2); }
.org-row.selected .org-row-name { color: var(--text); font-weight: 600; }
.org-row.synthetic .org-row-name { color: var(--text-dim); font-style: italic; }
.org-twisty {
  display: inline-flex; align-items: center; justify-content: center; width: 14px; flex: none;
  color: var(--text-faint); font-size: 10px; cursor: pointer;
}
.org-twisty.empty { cursor: default; visibility: hidden; }
.org-row-label { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.org-level-badge {
  font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint); flex: none;
}
/* The name is the information — it gets the spare space and never collapses
   below a readable stub; badges/chips are secondary and stay compact. */
.org-row-name { font-size: 13px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 64px; }
.org-synthetic-tag { color: var(--text-faint); font-size: 11px; flex: none; }
.org-row-actions { display: flex; gap: 6px; flex: none; opacity: 0; transition: opacity var(--dur-tap); }
.org-row:hover .org-row-actions { opacity: 1; }
.org-row-action {
  background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 11px;
  padding: 2px 5px; border-radius: 6px;
}
.org-row-action:hover { background: var(--surface-2); color: var(--text); }
.org-inline-input { max-width: 220px; }
.org-inline-add { padding: 4px 8px 4px 36px; }

/* ---- detail panel ---- */
.org-detail { border-top: 1px solid var(--surface-2); padding-top: 16px; }
.org-detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.org-detail-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.org-detail-path { font-family: var(--mono); color: var(--muted); }
.org-detail-section { margin-bottom: 24px; }
.org-detail-section:last-child { margin-bottom: 0; }
.org-detail-subhead { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text); }

.org-value-code {
  font-family: var(--mono); font-size: 11.5px;
  background: var(--surface-2); color: var(--muted); padding: 1px 6px; border-radius: 6px;
}
.org-lock { cursor: help; }
.org-override-form {
  margin-top: 8px; padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius);
}

/* ---- access ---- */
.org-access-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--surface-2); }
.org-access-row:last-child { border-bottom: none; }
.org-access-name { font-size: 13px; color: var(--text-soft); }
.chip.role-admin { color: var(--text); border-color: var(--edge); }
.chip.role-member { color: var(--text); }
.chip.role-viewer { color: var(--text-dim); }

/* ---- AI context ---- */
.org-context-stack { display: flex; flex-direction: column; gap: 10px; }
.org-context-block { padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.org-context-path {
  font-family: var(--mono); margin-bottom: 4px; color: var(--muted);
}
.org-context-value { font-size: 12.5px; line-height: 1.5; color: var(--text-soft); white-space: pre-wrap; }

/* ==========================================================================
   decision cockpit (Decisions view — risks / decision log / next 14 days)
   Ported from zilla-audit-sandbox.
   ========================================================================== */

.mt-16 { margin-top: 16px; }

.overdue-text { color: var(--err); font-weight: 600; }
.form-error { color: var(--err); }

.stat-subnote { font-size: 11px; color: var(--text-faint); }
.stat-card.clickable { cursor: pointer; transition: border-color var(--dur-tap) ease; }
.stat-card.clickable:hover { border-color: var(--border-2); }
.stat-card .stat-go { margin-left: 6px; opacity: 0; transition: opacity var(--dur-tap); }
.stat-card.clickable:hover .stat-go { opacity: .8; }

.empty-actions { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }

/* ---- dashboard "needs attention" primitives ---- */
.attention-ok { color: var(--muted); font-size: 12.5px; padding: 10px 12px; border: 1px dashed var(--border-2); border-radius: var(--radius); }
.attention-list { display: flex; flex-direction: column; gap: 6px; }
.attention-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attention-reason { color: var(--muted); font-size: 12px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Risks now ---- */
.risk-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius-lg);
  margin-bottom: 6px;
}
.risk-row:hover { border-color: var(--border-2); }
.risk-text { flex: 1; min-width: 0; font-size: 13px; color: var(--text-soft); }
.risk-actions { display: flex; gap: 10px; flex-shrink: 0; white-space: nowrap; }

/* ---- Decisions list ---- */
.decision-list { display: flex; flex-direction: column; gap: 6px; }
.decision-row {
  background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius-lg);
  padding: 10px 12px;
}
.decision-row:hover { border-color: var(--border-2); }
.decision-row.expanded { border-color: var(--edge); }
.decision-row-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer;
}
.decision-title { flex: 1; min-width: 160px; color: var(--text-soft); }
.decision-title.struck { text-decoration: line-through; color: var(--text-dim); flex: initial; }
.decision-scope, .decision-byline { white-space: nowrap; }
.decision-detail {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--surface-2);
  cursor: default;
}
.decision-rationale { font-size: 13px; line-height: 1.5; color: var(--text-soft); white-space: pre-wrap; margin-bottom: 8px; }
.history-row { opacity: .92; }

.chip.decision-impact-high { color: var(--err); border-color: var(--err-line); background: var(--err-tint); }
.chip.decision-impact-medium { color: var(--warn); border-color: var(--warn-line); background: var(--warn-tint); }
.chip.decision-impact-low { color: var(--text-dim); background: var(--surface-2); }

/* ---- inline create/edit form ---- */
.decision-form {
  border: 1px dashed var(--accent-line); border-radius: var(--radius-lg);
  padding: 14px 16px; margin-bottom: 12px; background: var(--bg);
  display: flex; flex-direction: column; gap: 10px;
}
.decision-field { display: flex; flex-direction: column; gap: 4px; }
.decision-field .ni-input { width: 100%; }

/* ---- decisions popup (global, topbar diamond / 'd') ---- */
.decisions-modal { width: 680px; display: flex; flex-direction: column; max-height: 76vh; }
.dm-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--surface-2); flex-shrink: 0; }
.dm-ic { color: var(--accent); display: flex; }
.dm-titles { flex: 1; min-width: 0; }
.dm-body { overflow-y: auto; padding: 12px 16px 16px; }
.dm-group-title {
  display: flex; align-items: baseline; gap: 6px; margin: 14px 0 6px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint);
}
.dm-body > .dm-group-title:first-child, .dm-body > .decision-form + .dm-group-title { margin-top: 0; }
.dm-body .decision-form { margin-top: 2px; }

/* ---- decision history disclosure ---- */
.decision-history summary { cursor: pointer; color: var(--text-dim); font-size: 13px; padding: 4px 0; }
.decision-history summary:hover { color: var(--text); }

/* ---- Coming up — next 14 days ---- */
.upcoming-group { margin-bottom: 14px; }
.upcoming-date { font-size: 11px; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.upcoming-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; cursor: pointer;
  border-radius: var(--radius);
}
.upcoming-row:hover { background: var(--card); }
.upcoming-ic { flex-shrink: 0; width: 16px; text-align: center; color: var(--text-faint); }
.upcoming-label { flex: 1; min-width: 0; color: var(--text-soft); }

/* flash highlight for scroll-to targets (Open →, upcoming decision_due) */
@keyframes flashPulse { 0%, 100% { background: transparent; } 30% { background: rgba(var(--accent-rgb), .18); } }
.flash-target { animation: flashPulse 1.4s ease; }

/* Tickets widget: reason sits right-aligned and muted so key + summary keep
   the left-to-right reading order (severity, key, summary, reason) */
.ticket-reason {
  color: var(--muted); font-size: 12px; flex: 0 0 auto; margin-left: auto;
  padding-left: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42%;
}

/* ==========================================================================
   dashboard widget grid
   The Dashboard is one organisation-wide risk snapshot rendered as a grid of
   uniform widgets (Do next/Momentum/Projects/People/Blockers/Systems/Process/
   Decisions/Tickets/Coming up/Activity), all but Activity fed by one
   Api.riskOverview() fetch.
   ========================================================================== */

.widget-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px; align-items: start;
}

.widget { display: flex; flex-direction: column; gap: 12px; }
.widget.tall { grid-row: span 2; }

.widget-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.widget-icon { font-size: 14px; flex: none; color: var(--text-faint); }
.widget-title { font-size: 13px; font-weight: 600; color: var(--text); }
.widget-subnote { font-size: 11px; color: var(--text-faint); margin-left: -2px; }
.widget-foot { margin-left: auto; }
.widget-foot-link {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 11.5px; padding: 0;
}
.widget-foot-link:hover { color: var(--text); text-decoration: underline; }

.widget-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--muted);
}
.widget-count.bad { color: var(--err); background: var(--err-tint); }

.widget-body { display: flex; flex-direction: column; gap: 6px; }

.widget-ok {
  color: var(--muted); font-size: 12.5px; padding: 10px 12px;
  border: 1px dashed var(--border-2); border-radius: var(--radius);
}

.widget-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius-lg);
  font-size: 13px;
}
.widget-row:hover { border-color: var(--border-2); }
.widget-row .rag-dot { flex: none; }
.widget-row .key-chip { flex: none; }
.widget-row .attention-name {
  font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%;
}
.widget-row .attention-reason {
  color: var(--muted); font-size: 12px; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

@media (max-width: 760px) {
  .widget-grid { grid-template-columns: 1fr; }
}

/* balanced column flow under the full-width hero */
.widget-flow { columns: 2 360px; column-gap: 16px; margin-top: 16px; }
.widget-flow > .widget { break-inside: avoid; margin-bottom: 16px; }

/* ==========================================================================
   do-next + momentum widgets
   ========================================================================== */

.widget.hero { grid-column: 1 / -1; }

.donext-row { align-items: center; gap: 10px; padding: 10px 12px; }
.donext-rank {
  font-family: var(--mono); color: var(--muted);
  font-size: 11.5px; flex: none; width: 16px;
}
.donext-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.donext-title { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donext-why { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donext-go {
  flex: none; color: var(--text-dim); font-size: 12px; opacity: 0; transition: opacity var(--dur-tap) ease;
}
.donext-row:hover .donext-go { opacity: 1; }

.momentum-clickable { display: flex; flex-direction: column; gap: 12px; cursor: pointer; }
.momentum-numbers { display: flex; gap: 22px; }
.momentum-figure { display: flex; flex-direction: column; gap: 2px; }
.momentum-value { font-size: 20px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.momentum-label { font-size: 11.5px; color: var(--muted); }
.momentum-verdict { font-size: 12.5px; font-weight: 600; padding-top: 2px; border-top: 1px solid var(--surface-2); }
.momentum-up { color: var(--ok); }
.momentum-down { color: var(--err); }

/* compact migration hero — the home-dashboard card above the widget grid */
.migration-hero.compact {
  padding: 14px 18px; margin: 0; min-height: 0; gap: 6px;
  flex-direction: row; align-items: center; justify-content: space-between;
  flex-wrap: wrap; text-align: left;
  background: var(--surface); border: 1px solid var(--surface-2); border-radius: var(--radius-lg);
}
.migration-hero.compact .mh-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; flex-basis: 100%; }
.migration-hero.compact .mh-sub { font-size: 12.5px; max-width: none; flex: 1; min-width: 200px; }
.migration-hero.compact .btn.lg { padding: 6px 14px; font-size: 13px; }

/* ============================== Zilla Chat ============================== */
#chatFab {
  position: fixed; right: 22px; bottom: 22px; z-index: 89; /* below the drawer scrim (90) so it never buries drawer controls; the chat panel has its own close */
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-fab);
}
#chatFab:hover { filter: brightness(1.08); }
#chatFab svg { width: 22px; height: 22px; }
.chat-busy-dot { position: absolute; top: 3px; right: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--err); animation: chatpulse 1.2s ease-in-out infinite; }
@keyframes chatpulse { 50% { opacity: .35; } }

#chatPanel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 899;
  width: 420px; max-width: 100vw;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-panel);
}
@media (max-width: 640px) { #chatPanel { width: 100vw; } }

.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--surface-2);
}
.chat-head-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.chat-head-title svg { width: 16px; height: 16px; color: var(--accent); }
.chat-head-actions { display: flex; gap: 6px; }

.chat-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { max-width: 92%; padding: 8px 12px; border-radius: var(--radius-xl); line-height: 1.45; font-size: 13.5px; word-wrap: break-word; }
.chat-msg.user { align-self: flex-end; background: var(--accent-tint); border: 1px solid var(--accent-line); color: var(--text); border-bottom-right-radius: 4px; }
.chat-msg.assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-msg code { background: var(--code-bg); padding: 1px 5px; border-radius: 6px; font-size: 12px; }
.chat-key { color: var(--accent); text-decoration: none; font-weight: 600; }
.chat-key:hover { text-decoration: underline; }

.chat-chip { align-self: flex-start; font-size: 11.5px; color: var(--muted); padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.chat-chip.err { color: var(--err); border-color: var(--err-line); }

.chat-plan { align-self: stretch; border: 1px solid var(--accent-line); border-radius: var(--radius-xl); background: var(--surface-2); padding: 10px 12px; }
.chat-plan.is-done { border-color: var(--ok); }
.chat-plan.is-failed, .chat-plan.is-cancelled { border-color: var(--border); opacity: .8; }
.chat-plan-title { font-weight: 600; font-size: 13.5px; }
.chat-plan-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.chat-plan-steps { margin: 8px 0 0 18px; padding: 0; font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.chat-plan-steps li.destructive { color: var(--err); }
.chat-step-status { display: inline-block; width: 14px; font-weight: 700; }
.chat-plan-actions { display: flex; gap: 6px; margin-top: 10px; }

.chat-inputbar { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--surface-2); }
.chat-inputbar textarea {
  flex: 1; resize: none; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 8px 10px; font-size: 13.5px; font-family: var(--font);
}
.chat-inputbar textarea:focus { outline: none; border-color: var(--accent-dim); }

.chat-empty { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin-top: 24px; }
.chat-empty-title { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.chat-example { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; text-align: left; }
.chat-example:hover { border-color: var(--accent-line); }

/* Confirm reality (plan 12 §2 P1 "run"): the weekly review. The strip is an
   invitation, not an alarm — amber-tinted like the drift chip it aggregates.
   Cards keep the board's visual grammar: chips carry the state, evidence is
   quiet text, one primary action. */
.reality-strip { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 8px 12px; font-size: 12.5px; color: var(--text); background: linear-gradient(180deg, var(--warn-tint), var(--surface)); border: 1px solid var(--warn-line); border-radius: var(--radius-lg); cursor: pointer; user-select: none; }
.reality-strip:hover { background: var(--accent-tint); border-color: var(--accent-line); }
.reality-strip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.reality-strip-count { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.reality-strip .muted { color: var(--accent); font-weight: 600; } /* the "Confirm reality →" CTA reads as the banner's action, not metadata */
.reality-card { padding: 12px 14px; margin-bottom: 8px; }
.reality-card.kb-focus { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .3) inset; }
.reality-summary { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.reality-line { margin-top: 6px; color: var(--muted); }
.reality-evidence-list { margin-top: 2px; }
.reality-evidence { line-height: 1.55; }
.plan-intro { margin-bottom: 16px; }
.plan-intro .muted { margin-top: 2px; }

/* ==========================================================================
   external migration wizard (Admin > Data > "Migrate from another tool")
   ========================================================================== */
.toolbar-label { display: inline-flex; align-items: center; gap: 6px; }
.mig-tools { display: flex; flex-wrap: wrap; gap: 10px; }
.mig-tile {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; user-select: none; font-size: 13px; transition: border-color var(--dur-tap), background var(--dur-tap);
}
.mig-tile:hover { border-color: var(--border-2); background: var(--hair); }
.mig-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mig-tile.selected { border-color: var(--edge); background: var(--surface-2); }
.mig-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }

.mig-step { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--surface-2); }
.mig-step input[type="password"],
.mig-step input[type="text"],
.mig-step input[type="email"] {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 8px; width: 100%; max-width: 320px;
}
.mig-step input[type="password"]:focus,
.mig-step input[type="text"]:focus,
.mig-step input[type="email"]:focus { border-color: var(--accent); outline: none; }
/* Jira connect form inside the migration hero: the hero is a centred column,
   so the field stack has to left-align itself rather than inherit that. */
.migration-hero .mig-step { width: 100%; max-width: 360px; text-align: left; }
.mig-step .mig-field { display: flex; flex-direction: column; gap: 4px; }
.migration-hero .mig-step input { max-width: none; }
.mig-error { color: var(--err); }

/* Migration scope picker — "All projects" or a checklist of Jira projects,
   sat between the connected line and Start in the migration hero. */
.mig-scope { width: 100%; max-width: 560px; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.mig-scope-choice { display: flex; flex-wrap: wrap; gap: 8px; }
.mig-scope-opt {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); font-size: 13px; font-weight: 600;
  transition: border-color var(--dur-tap) var(--ease-loop), background var(--dur-tap) var(--ease-loop);
}
.mig-scope-opt:has(input:checked) { border-color: var(--accent-line); background: var(--accent-tint); }
.mig-scope-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.mig-scope-opt.disabled { cursor: not-allowed; opacity: .55; }
.mig-scope-summary { font-weight: 400; }
.mig-scope-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mig-pick { display: flex; flex-direction: column; gap: 8px; }
.mig-pick-tools { display: flex; align-items: center; gap: 8px; }
.mig-pick-tools .mig-pick-search {
  flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 8px;
}
.mig-pick-tools .mig-pick-search:focus { border-color: var(--accent); outline: none; }
.mig-pick-list {
  max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.mig-pick-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer;
  border-bottom: 1px solid var(--hair);
}
.mig-pick-row:last-child { border-bottom: 0; }
.mig-pick-row:hover { background: var(--surface-2); }
.mig-pick-row.on { background: var(--accent-tint); }
.mig-pick-row input[type="checkbox"] { width: 16px; height: 16px; flex: none; }
.mig-pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mig-pick-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mig-pick-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mig-pick-key { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.mig-pick-done.chip { color: var(--ok); background: var(--ok-tint); font-size: 10.5px; padding: 0 7px; }
.mig-pick-count { flex: none; white-space: nowrap; }
.mig-pick-empty { padding: 14px 10px; text-align: center; }
.mig-pick-total { color: var(--text-dim); }
.mig-pick-total strong { color: var(--text); }
.mig-included {
  width: 100%; max-width: 560px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; text-align: left;
}
.mig-included-keys { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.mig-included-keys .chip { font-family: var(--mono); }
.mig-report-scope { color: var(--text-dim); gap: 12px; }
.mig-report-scope > span:last-child { text-align: right; }
/* Compact hero (dashboard card): scope choice, Re-sync and the connection link
   share one full-width row under the last-run line; the checklist opens below. */
.migration-hero.compact .mig-connect-host {
  flex-basis: 100%; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start;
}
.migration-hero.compact .mig-scope { flex: 1 1 320px; max-width: none; }
.migration-hero.compact .mig-scope-opt { padding: 4px 10px; font-size: 12.5px; }

.mig-log {
  max-height: 180px; overflow-y: auto; font-family: var(--mono);
  font-size: 11.5px; line-height: 1.6; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 10px;
}

.mig-result-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 4px 0; font-size: 12.5px;
}
a.mig-result-row { color: var(--info); }
a.mig-result-row:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .mig-tools { gap: 8px; }
  .mig-tile { padding: 7px 10px; font-size: 12px; }
  .mig-step input[type="password"],
  .mig-step input[type="text"],
  .mig-step input[type="email"] { max-width: 100%; }
  .mig-scope-choice { flex-direction: column; }
  .mig-pick-tools { flex-wrap: wrap; }
  .mig-pick-tools .mig-pick-search { flex-basis: 100%; }
  .mig-pick-list { max-height: 50vh; }
}

/* Vocabulary presets (plan 12 §2 M3): non-software teams don't estimate in
   story points — the chip disappears, the column stays. */
.preset-marketing .points-chip, .preset-ops .points-chip,
.preset-marketing .pts-chip, .preset-ops .pts-chip { display: none; }

/* ==========================================================================
   Admin › Integrations — app directory
   ========================================================================== */
.integration-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.integration-tile {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.integration-tile.clickable { cursor: pointer; }
.integration-tile.clickable:hover { border-color: var(--border-2); }
.int-dot {
  flex: none; width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700; /* brand-exception: third-party brand tiles, dot colors set in JS (register #8) */
  border: 1px solid rgba(255,255,255,.12); /* brand-exception: hairline on brand tiles (register #8) */
}
.int-info { min-width: 0; flex: 1; }
.int-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.int-cat { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.int-badge {
  flex: none; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 999px; color: var(--text-faint);
  border: 1px solid var(--border); background: var(--surface);
}
.int-badge.live { color: var(--ok); border-color: var(--ok-line); background: var(--ok-tint); }
.int-badge.ready { color: var(--info); border-color: rgba(var(--info-rgb), .35); background: var(--info-tint); }

@media (max-width: 560px) {
  .integration-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Company risk — the home view. Profile strip + intent list.
   ========================================================================== */
.risk-profile { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.risk-level { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border-2); }
.risk-level.risk-low { color: var(--ok); border-color: var(--ok-line); background: var(--ok-tint); }
.risk-level.risk-elevated { color: var(--warn); border-color: var(--warn-line); background: var(--warn-tint); }
.risk-level.risk-high { color: var(--err); border-color: var(--err-line); background: var(--err-tint); }
.risk-counts { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.risk-count b { font-size: 16px; margin-right: 4px; }
.risk-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.risk-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.risk-summary { min-width: 160px; }
.risk-row:last-child { border-bottom: none; }
.risk-row:hover { background: var(--surface-2); }
.risk-row .rag-dot { flex: none; }
.risk-summary { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.risk-chip { flex: none; max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.risk-chip.ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-tint); }
.chip.risk-chip.breach { color: var(--err); border-color: var(--err-line); background: var(--err-tint); }
.filter-bar .btn.active { border-color: var(--edge); color: var(--text); background: var(--surface-2); }

/* Column drag-reorder (grab the header, drop on another column) */
.board-column-head[draggable="true"] { cursor: grab; }
.board-column-head[draggable="true"]:active { cursor: grabbing; }
.board-column.col-dragging { opacity: .45; }
.board-column.col-drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; border-radius: var(--radius); }

/* ==========================================================================
   ReqOps mark — the brand loop, ported from the ReqOps design system
   (ReqopsMark.css). A single open loop tilted -34deg with an anchor node
   (last decision held in view) and a head node (the live edge). State is
   signalled by how it MOVES; the head warms to amber only on capture.
   ========================================================================== */
.rq-svg {
  display: block; overflow: visible;
  --cold: var(--text);
  --warm: var(--accent);
  --glow: rgba(233, 237, 243, 0.45); /* brand-exception: 1:1 port of DS ReqopsMark.css (register #1) */
  transform: rotate(-34deg); transform-origin: center;
  flex: none;
}
.rq-svg .rq-ghost { fill: none; stroke: var(--cold); opacity: .12; stroke-linecap: round; }
.rq-svg .rq-trail { fill: none; stroke: var(--cold); opacity: .5; stroke-linecap: round; }
.rq-svg .rq-comet {
  fill: none; stroke: var(--comet, #ffffff); stroke-linecap: round; opacity: 0; /* brand-exception: 1:1 port of DS ReqopsMark.css (register #1) */
  filter: drop-shadow(0 0 2.5px var(--glow));
}
.rq-svg .rq-anchor { fill: var(--cold); opacity: .55; transform-box: fill-box; transform-origin: center; }
.rq-svg .rq-head { fill: var(--cold); transform-box: fill-box; transform-origin: center; filter: drop-shadow(0 0 2px var(--glow)); }
.rq-svg .rq-ripple { fill: none; stroke: var(--warm); stroke-width: 3; opacity: 0; transform-box: fill-box; transform-origin: center; }

/* ink variant — for the mark on amber fills (chat FAB) */
.rq-ink { --cold: var(--on-accent); --comet: var(--on-accent); --glow: transparent; }

/* IDLE — gentle breathe at rest (topbar) */
.rq-mode-idle .rq-trail { animation: rqBreathe 4.6s ease-in-out infinite; }
.rq-mode-idle .rq-head { animation: rqHeadBreathe 4.6s ease-in-out infinite; }

/* LIVE — eased comet with dwell (auth hero, agent thinking) */
.rq-mode-live .rq-comet { animation: rqComet 3.6s ease-in-out infinite; }

/* CAPTURE — comet base + periodic warm flare that decays */
.rq-mode-capture .rq-comet { animation: rqComet 3.6s ease-in-out infinite; }
.rq-mode-capture .rq-head { animation: rqFlare 3s ease-in-out infinite; }
.rq-mode-capture .rq-ripple { animation: rqRipple 3s ease-in-out infinite; }

@keyframes rqComet {
  0% { stroke-dashoffset: 0; opacity: 0; }
  7% { opacity: 1; }
  62% { stroke-dashoffset: -86; }
  77% { stroke-dashoffset: -86; opacity: 1; }
  90% { opacity: 0; }
  100% { stroke-dashoffset: -86; opacity: 0; }
}
@keyframes rqBreathe { 0%, 100% { opacity: .42; } 50% { opacity: .82; } }
@keyframes rqHeadBreathe { 0%, 100% { transform: scale(1); opacity: .78; } 50% { transform: scale(1.13); opacity: 1; } }
@keyframes rqFlare {
  0%, 100% { fill: var(--cold); transform: scale(1); }
  10% { fill: var(--warm); transform: scale(1.45); }
  34% { fill: var(--warm); transform: scale(1.08); }
  64% { fill: var(--cold); transform: scale(1); }
}
@keyframes rqRipple {
  0% { opacity: 0; transform: scale(.5); }
  8% { opacity: .55; }
  48% { opacity: 0; transform: scale(2.4); }
  100% { opacity: 0; transform: scale(2.4); }
}
/* DS rule: motion is a courtesy, never a requirement (tokens.css) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
