/* Quantum · Пульт — warehouse dispatch console.
   Dark graphite floor, signal-amber accent, PROD in hazard red, TEST in teal. */

:root {
  --font: "Geologica", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --bg: #0c0e0d;
  --bg-grid: rgba(255, 255, 255, 0.025);
  --surface: #141715;
  --surface-2: #1a1e1b;
  --surface-3: #222723;
  --line: #262b27;
  --line-strong: #353b36;
  --text: #e9ece6;
  --muted: #8b938c;
  --faint: #5d655e;

  --accent: #ffb000;
  --accent-ink: #1a1300;
  --accent-soft: rgba(255, 176, 0, 0.12);
  --test: #2dd4bf;
  --test-soft: rgba(45, 212, 191, 0.12);
  --prod: #ff4d3d;
  --prod-soft: rgba(255, 77, 61, 0.12);
  --ok: #7bd88f;
  --warn: #ffb000;
  --down: #6b736c;
  --info: #8ab4ff;
  /* Trackers: client (support) violet, programmers (qtracker) blue. */
  --client: #c9a2ff;
  --client-soft: rgba(201, 162, 255, 0.13);
  --dev: #6cc6ff;
  --dev-soft: rgba(108, 198, 255, 0.12);

  --prio-a: #ff4d3d;
  --prio-b: #ffb000;
  --prio-c: #8ab4ff;
  --prio-d: #6b736c;

  --radius: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -18px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f1eee6;
  --bg-grid: rgba(26, 28, 26, 0.04);
  --surface: #fbfaf6;
  --surface-2: #f4f1e9;
  --surface-3: #ebe7dc;
  --line: #e0dbcf;
  --line-strong: #cfc8b8;
  --text: #191b19;
  --muted: #5f655f;
  --faint: #8d918a;
  --accent: #c47a00;
  --accent-ink: #fffaf0;
  --accent-soft: rgba(196, 122, 0, 0.12);
  --test: #0f8f80;
  --test-soft: rgba(15, 143, 128, 0.1);
  --prod: #d0362a;
  --prod-soft: rgba(208, 54, 42, 0.1);
  --ok: #2f8f4a;
  --warn: #c47a00;
  --down: #9aa09a;
  --info: #3d6fd6;
  --client: #7a3fd0;
  --client-soft: rgba(122, 63, 208, 0.1);
  --dev: #0f6db3;
  --dev-soft: rgba(15, 109, 179, 0.1);
  --prio-a: #d0362a;
  --prio-b: #c47a00;
  --prio-c: #3d6fd6;
  --prio-d: #9aa09a;
  --shadow: 0 1px 2px rgba(40, 36, 20, 0.06), 0 10px 24px -20px rgba(40, 36, 20, 0.5);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }

/* ---------- shell ---------- */

.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.topbar, .rail-backdrop { display: none; }

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 12px 14px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 4px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 7px;
  background:
    repeating-linear-gradient(-45deg, var(--accent) 0 5px, var(--accent-ink) 5px 10px);
  box-shadow: 0 0 0 1px var(--line-strong);
}

.brand-name { font-weight: 700; letter-spacing: -0.01em; font-size: 15px; }
.brand-sub { font-family: var(--mono); font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }

.rail-section { display: grid; gap: 2px; }
.rail-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 6px 10px 4px;
}

.rail-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.rail-link:hover { background: var(--surface-2); color: var(--text); }
.rail-link:focus-visible, .icon-btn:focus-visible, .btn:focus-visible, .tabs a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.rail-link.active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}
.rail-link svg { width: 16px; height: 16px; flex: none; }
.rail-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Project group: the project's sections nest under its name. */
.proj > summary { list-style: none; }
.proj > summary::-webkit-details-marker { display: none; }
.proj-head { font-weight: 600; color: var(--text); }
.rail-projects[data-sortable] .proj-head { -webkit-touch-callout: none; user-select: none; }
.rail-projects.sorting .proj-head { cursor: grabbing; }
.proj.dragging { opacity: 0.85; }
.proj.dragging > .proj-head { background: var(--surface-2, rgba(127,127,127,0.12)); box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
.proj-head .chev { margin-left: auto; width: 14px; height: 14px; color: var(--faint); transition: transform 0.15s; }
.proj[open] > .proj-head .chev { transform: rotate(90deg); }
.proj.current > .proj-head { color: var(--text); }
.proj-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 6px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.proj-mark.lg { width: 40px; height: 40px; border-radius: 10px; font-size: 14px; }
.proj-items {
  display: grid;
  gap: 1px;
  margin: 2px 0 6px 20px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}
.rail-link.sub { min-height: 32px; padding: 6px 10px; font-size: 13px; }
.rail-link.sub svg { width: 15px; height: 15px; }

.rail-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.rail-user { display: flex; align-items: center; gap: 8px; padding: 8px 4px 0 6px; }
.rail-user .avatar { width: 28px; height: 28px; font-size: 11px; }
.rail-user-name { flex: 1; display: grid; line-height: 1.2; font-weight: 600; font-size: 13px; }
.rail-user-name { min-width: 0; }
.rail-user-name small { font-weight: 400; color: var(--faint); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-logout { display: contents; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-3); }
.icon-btn svg { width: 16px; height: 16px; }

.main { min-width: 0; padding: 28px 32px 48px; }

/* Compact rail: icons only (pages that need the width, e.g. the warehouse map). */
.shell.compact { grid-template-columns: 64px minmax(0, 1fr); }
.shell.compact .rail { padding: 16px 10px 12px; align-items: stretch; }
.shell.compact .brand { padding: 0; justify-content: center; }
.shell.compact .brand > span:last-child,
.shell.compact .rail-label,
.shell.compact .rail-text,
.shell.compact .proj-head .chev,
.shell.compact .rail-user .avatar,
.shell.compact .rail-badge { display: none; }
.shell.compact .rail-link { justify-content: center; padding: 9px; gap: 0; }
.shell.compact .rail-link svg { width: 18px; height: 18px; }
.shell.compact .proj:not(.current) > .proj-items { display: none; }
.shell.compact .proj-items { margin: 2px 0 6px; padding: 0; border-left: 0; }
.shell.compact .rail-user { flex-direction: column; padding: 8px 0 0; }
.shell.compact .main { padding: 14px 18px 18px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
h1 { font-size: 30px; line-height: 1.1; letter-spacing: -0.025em; margin: 0; font-weight: 700; }
h2 { font-size: 17px; margin: 0; letter-spacing: -0.01em; font-weight: 650; }
h3 { font-size: 14px; margin: 0; font-weight: 650; }
.lede { color: var(--muted); margin: 6px 0 0; max-width: 64ch; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* ---------- primitives ---------- */

.btn {
  --b: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--b);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 550;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn.ghost { background: transparent; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.accent:hover { filter: brightness(1.06); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }

.btn.env {
  height: 44px;
  min-width: 112px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
}
.btn.env.test { --b: var(--test); background: var(--test-soft); color: var(--test); }
.btn.env.test:hover { background: color-mix(in srgb, var(--test) 22%, transparent); }
.btn.env.prod {
  --b: var(--prod);
  color: var(--prod);
  background:
    repeating-linear-gradient(-45deg, var(--prod-soft) 0 8px, transparent 8px 16px),
    var(--surface-2);
}
.btn.env.prod:hover { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--prod) 24%, transparent) 0 8px, var(--prod-soft) 8px 16px); }
.btn.env.disabled, .btn[disabled] { opacity: 0.4; pointer-events: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
}
.chip.mono { font-family: var(--mono); font-size: 11px; }
.chip.client { color: var(--client); border-color: color-mix(in srgb, var(--client) 45%, var(--line)); background: var(--client-soft); }
.chip.dev { color: var(--dev); border-color: color-mix(in srgb, var(--dev) 45%, var(--line)); background: var(--dev-soft); }
.chip.trk { gap: 5px; font-weight: 650; }
.chip.trk svg { width: 12px; height: 12px; flex: none; }
.chip.trk .tag { color: var(--text); }
.chip.trk .tag::before { display: none; }
.chip.report { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); background: color-mix(in srgb, var(--ok) 10%, transparent); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--down); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 20%, transparent); }
.dot.down { background: var(--down); }
.dot.error { background: var(--prod); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-body { padding: 16px; }

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px dashed color-mix(in srgb, var(--accent) 50%, var(--line));
  background: var(--accent-soft);
  color: var(--text);
  margin-bottom: 18px;
}
.notice.error { border-color: color-mix(in srgb, var(--prod) 50%, var(--line)); background: var(--prod-soft); }

.empty { padding: 28px; text-align: center; color: var(--faint); }

/* ID label: looks like a printed warehouse tag with a tiny barcode */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}
.tag::before {
  content: "";
  width: 14px;
  height: 11px;
  background: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 2px, currentColor 2px 4px, transparent 4px 5px);
  opacity: 0.55;
}

/* ---------- overview ---------- */

.overview {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
}
.stack { display: grid; gap: 16px; }

.station { position: relative; overflow: hidden; }
.station::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--down);
}
.station.tone-ok::after { background: var(--ok); }
.station.tone-warn::after { background: var(--warn); }

.station-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 18px 18px 0 20px; }
.station-name { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.station-state { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.station-env { display: flex; gap: 10px; flex-wrap: wrap; padding: 16px 18px 0 20px; }

.services { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 18px 0 20px; }
.service {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.station-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 14px 18px 16px 20px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.tally { display: grid; grid-template-columns: repeat(6, 1fr); border-bottom: 1px solid var(--line); }
.tally a { padding: 14px 16px; border-right: 1px solid var(--line); transition: background 0.15s; }
.tally a:last-child { border-right: 0; }
.tally a:hover { background: var(--surface-2); }
.tally-num { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.tally-label { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

.list { display: grid; }
.list-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  transition: background 0.15s;
}
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--surface-2); }
.list-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.feed { max-height: 420px; overflow: auto; font-family: var(--mono); font-size: 11.5px; }
.feed-row {
  display: grid;
  grid-template-columns: 10px 86px 74px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 6px 16px;
  border-top: 1px solid var(--line);
}
.feed-row .dot { align-self: center; width: 6px; height: 6px; box-shadow: none; }
.feed-row .src { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-row .msg { overflow-wrap: anywhere; }
.feed-row.error .msg { color: var(--prod); }

/* ---------- board ---------- */

.toolbar-filters { display: contents; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}
.search {
  position: relative;
  flex: 1 1 260px;
  max-width: 420px;
}
.search input {
  width: 100%;
  height: 36px;
  padding: 0 64px 0 36px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.search input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; }
.search svg { position: absolute; left: 11px; top: 10px; width: 16px; height: 16px; color: var(--faint); }
.kbd {
  position: absolute;
  right: 8px;
  top: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 1px 6px;
}

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.seg button {
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
}
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); }

.select {
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  padding: 0 10px;
}

/* Columns share the width; an empty one shrinks so the rest fit on screen. */
.board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
}
.column {
  flex: 1 1 0;
  min-width: 225px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  border: 1px solid var(--line);
}
.column-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
}
.column-head::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--col, var(--down));
}
.column-head h3 { min-width: 0; }
.column-head .n { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.column[data-col="Нова"] { --col: var(--accent); }
.column[data-col="В роботі"] { --col: var(--prod); }
.column[data-col="Тестувати"] { --col: var(--test); }
.column[data-col="Чекаю програмістів"] { --col: var(--info); }
.column[data-col="Чекаю клієнта"] { --col: var(--client); }
.column[data-col="Вирішено"] { --col: var(--ok); }
.column.is-empty { flex: 0 0 150px; min-width: 150px; }
.column.is-empty .column-head h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.column-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 10px; align-content: start; }

.card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
  gap: 9px;
  padding: 12px 12px 11px 15px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
  min-width: 0;
  transition: border-color 0.15s, transform 0.12s;
  animation: rise 0.35s ease both;
  animation-delay: calc(var(--i, 0) * 25ms);
}
.card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--prio, var(--prio-d));
}
.card[data-prio="A"] { --prio: var(--prio-a); }
.card[data-prio="B"] { --prio: var(--prio-b); }
.card[data-prio="C"] { --prio: var(--prio-c); }

.card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-meta .age { color: var(--faint); }
.card-meta .age.stale { color: var(--warn); }
.card-title { font-weight: 550; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); font-size: 12px; }
.card-meta .who { display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 110px; }
.card-meta .who .avatar { flex: none; }
.card-meta .who span:not(.avatar) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta .stat { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.card-meta .stat svg { width: 12px; height: 12px; }
.card-meta .spacer { display: none; }
.card-meta > :not(.who) { flex: none; }

.avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  flex: none;
}
.avatar.none { background: var(--surface-3); color: var(--faint); }

.pair {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  font-size: 12px;
  color: var(--muted);
  min-width: 0;
}
.pair svg { width: 13px; height: 13px; flex: none; color: var(--faint); }
.pair .st { margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.table-wrap { overflow-x: auto; }
table.issues { width: 100%; border-collapse: collapse; }
table.issues th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
table.issues td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.issues tr { cursor: pointer; }
table.issues tr:hover td { background: var(--surface-2); }

/* ---------- issue drawer ---------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 40;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(720px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 50;
  display: flex;
  flex-direction: column;
}
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
.drawer-scroll { overflow: auto; flex: 1; }
.drawer-head {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.drawer-head h2 { font-size: 19px; line-height: 1.3; }
.drawer-close { position: absolute; top: 16px; right: 16px; }
.drawer-section { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer-section > h3 {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 12px;
}
.facts { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.linked {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  margin-bottom: 6px;
}
button.linked {
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
button.linked { grid-template-columns: auto minmax(0, 1fr) auto auto; transition: border-color .12s, background .12s; }
button.linked .linked-go { color: var(--muted); font-size: 18px; line-height: 1; transition: transform .12s, color .12s; }
button.linked:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
}
button.linked:hover .list-title { color: var(--accent); }
button.linked:hover .linked-go { color: var(--accent); transform: translateX(2px); }
button.linked:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.report-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--ok) 25%, var(--line));
  background: color-mix(in srgb, var(--ok) 6%, var(--surface-2));
  margin-bottom: 6px;
  transition: border-color 0.15s;
}
.report-row:hover { border-color: var(--ok); }
.report-row svg { color: var(--ok); }
.report-row.review-unverified { border-color: var(--line); background: var(--surface-2); }
.report-row.review-unverified svg { color: var(--faint); }
.report-row.review-wrong { border-color: var(--line); background: var(--surface-2); opacity: 0.6; }
.report-row.review-wrong .list-title { text-decoration: line-through; }
.report-row.review-wrong svg { color: var(--prod); }
.ready-text {
  border: 1px solid color-mix(in srgb, var(--ok) 25%, var(--line));
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.ready-text.review-unverified { border-color: var(--line); }
.ready-text-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.ready-text-actions { margin-left: auto; display: inline-flex; gap: 6px; }
.ready-text .prose { max-height: 320px; overflow: auto; }
.report-meta { display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.chip.review.unverified { color: var(--faint); }
.chip.review.verified { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.chip.review.wrong { color: var(--prod); border-color: color-mix(in srgb, var(--prod) 40%, var(--line)); }

.comment { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.comment:first-child { border-top: 0; padding-top: 0; }
.comment .avatar { width: 28px; height: 28px; font-size: 11px; }
.comment .avatar.side-developer_team { background: var(--info); }
.comment .avatar.side-customer { background: var(--prod); color: #fff; }
.comment-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 12.5px; }
.comment-head b { font-weight: 650; }

/* Possible reply: a highlighted draft in the thread; folded to a marker with a popup once answered. */
.comment.draft {
  margin: 4px 0; padding: 12px; border: 1px dashed color-mix(in srgb, var(--test) 60%, var(--line));
  border-radius: 8px; background: var(--test-soft);
}
.comment.draft + .comment { border-top: 0; }
.comment .avatar.draft-avatar { background: var(--test); color: var(--bg); }
.comment.draft .comment-head b { color: var(--test); }
.comment.draft .ready-text-actions { margin-left: auto; }
.draft-fold { position: relative; padding: 4px 0 8px 40px; }
.draft-mark {
  display: inline-block; font-size: 11.5px; color: var(--test); cursor: help;
  border: 1px dashed color-mix(in srgb, var(--test) 60%, var(--line)); border-radius: 999px;
  padding: 2px 10px; background: var(--test-soft);
}
.draft-pop {
  display: none; position: absolute; z-index: 20; left: 40px; top: calc(100% - 4px);
  width: min(520px, calc(100% - 40px)); max-height: 360px; overflow: auto; padding: 12px;
  background: var(--surface-2); border: 1px solid color-mix(in srgb, var(--test) 50%, var(--line));
  border-radius: 8px; box-shadow: var(--shadow);
}
.draft-fold:hover .draft-pop, .draft-fold:focus-within .draft-pop { display: block; }

.timeline { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.timeline div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; }

.prose { font-size: 13.5px; line-height: 1.6; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h1 { font-size: 24px; margin: 0 0 14px; }
.prose h2 { font-size: 18px; margin: 26px 0 10px; }
.prose h3 { font-size: 15px; margin: 20px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 10px; }
.prose pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
}
.prose code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 12.5px; margin: 0 0 12px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose blockquote { margin: 0 0 10px; padding-left: 12px; border-left: 3px solid var(--line-strong); color: var(--muted); }

.report-page { max-width: 920px; }
.report-page .panel-body { padding: 28px 32px; }

/* ---------- project pages ---------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a {
  padding: 10px 14px;
  color: var(--muted);
  font-weight: 550;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-color: var(--accent); }

.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 16px; }
.conn-head { display: flex; align-items: center; gap: 12px; padding: 16px; }
.conn-head > div { flex: 1; min-width: 0; }
.conn-head .host { font-family: var(--mono); font-size: 12px; color: var(--muted); overflow-wrap: break-word; }
.conn-head .btn { margin-left: auto; flex-shrink: 0; }

details.edit { border-top: 1px solid var(--line); }
details.edit > summary {
  cursor: pointer;
  list-style: none;
  padding: 11px 16px;
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
details.edit > summary::-webkit-details-marker { display: none; }
details.edit > summary::before { content: "▸"; font-size: 10px; transition: transform 0.15s; }
details.edit[open] > summary::before { transform: rotate(90deg); }
details.edit > summary:hover { color: var(--text); }
.form { padding: 4px 16px 16px; display: grid; gap: 16px; }
.fieldset-title {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
label.field { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
label.field input, label.field select {
  height: 34px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 0 10px;
  min-width: 0;
}
label.field input:focus, label.field select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

pre.logs {
  margin: 0;
  padding: 16px;
  max-height: 70vh;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.drive-group + .drive-group { border-top: 1px solid var(--line); }
.drive-date { display: flex; justify-content: space-between; padding: 10px 16px; font-family: var(--mono); font-size: 11px; color: var(--faint); background: var(--surface-2); }
.drive-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 60px auto; gap: 12px; align-items: center; padding: 9px 16px; border-top: 1px solid var(--line); }
.drive-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.upload input[type="file"] { color: var(--muted); font: inherit; font-size: 12.5px; }

/* ---------- motion ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.reveal > * { animation: rise 0.4s ease both; }
.reveal > *:nth-child(2) { animation-delay: 60ms; }
.reveal > *:nth-child(3) { animation-delay: 120ms; }
.reveal > *:nth-child(4) { animation-delay: 180ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- small screens ---------- */

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

@media (max-width: 820px) {
  .shell, .shell.compact { grid-template-columns: 1fr; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(8px);
  }
  .topbar .brand { padding: 0; gap: 8px; }
  .topbar .brand-mark { width: 24px; height: 24px; border-radius: 6px; }
  .topbar-where { margin-left: auto; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
  .rail, .shell.compact .rail {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(300px, 86vw);
    height: 100dvh;
    padding: 18px 12px calc(14px + env(safe-area-inset-bottom));
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgb(0 0 0 / 0.35);
    background: var(--surface);
    align-items: stretch;
  }
  body.nav-open .rail, body.nav-open .shell.compact .rail { transform: none; }
  .rail-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgb(0 0 0 / 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  body.nav-open .rail-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  /* In the drawer the compact (icon) rail shows full labels again. */
  .shell.compact .brand > span:last-child, .shell.compact .rail-label, .shell.compact .rail-text,
  .shell.compact .proj-head .chev, .shell.compact .rail-user .avatar, .shell.compact .rail-badge { display: revert; }
  .shell.compact .rail-text { display: block; }
  .shell.compact .rail-user-name { display: grid; }
  .shell.compact .brand { justify-content: flex-start; padding: 0 8px 4px; }
  .shell.compact .rail-link { justify-content: flex-start; gap: 10px; padding: 7px 10px; }
  .shell.compact .rail-link svg { width: 16px; height: 16px; }
  .shell.compact .proj:not(.current) > .proj-items { display: grid; }
  .shell.compact .proj-items { margin: 2px 0 6px 20px; padding-left: 8px; border-left: 1px solid var(--line); }
  .shell.compact .rail-user { flex-direction: row; padding: 8px 4px 0 6px; }
  .shell.compact .main { padding: 12px 16px 24px; }
  .rail-link { min-height: 42px; }
  .rail-link.sub { min-height: 40px; }
  .main { padding: 20px 16px 40px; }
  h1 { font-size: 24px; }
  .board .column, .board .column.is-empty { flex: 0 0 86vw; }
  .tally-num { font-size: 22px; }
  .feed-row { grid-template-columns: 8px 70px minmax(0, 1fr); }
  .feed-row .svc { display: none; }
  .facts { grid-template-columns: 100px 1fr; }
  .drawer-head, .drawer-section { padding-left: 16px; padding-right: 16px; }
  .report-page .panel-body { padding: 18px; }
  .drive-row { grid-template-columns: minmax(0, 1fr) auto; }
  .drive-row .size, .drive-row .time { display: none; }
}

/* --- reports feed & notifications --- */
.report-row-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.report-row-issues { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; }
.rail-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--ok);
  color: var(--bg);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}
.rail-badge[hidden] { display: none; }
.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
}
.toast {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--ok) 40%, var(--line));
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
  color: inherit;
  text-decoration: none;
  animation: toast-in 0.2s ease-out;
}
.toast-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.toast-title { margin-bottom: 6px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 640px) {
  .report-row { grid-template-columns: auto minmax(0, 1fr); }
  .report-row .report-meta { grid-column: 2; }
}

/* --- ownership: my issues vs other consultants' --- */
.chip.owner.mine { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.chip.owner.none { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.card.owner-mine { box-shadow: inset 3px 0 0 var(--ok); }
.card.owner-other { opacity: 0.62; }
.card.owner-other:hover, .card.owner-other:focus-visible { opacity: 1; }
tr.row.owner-other { opacity: 0.62; }
.owner-summary { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 0; }
.prose a.shot { display: block; margin: 10px 0; }
.prose a.shot img { max-width: min(100%, 760px); height: auto; border: 1px solid var(--border, #d0d4dc); border-radius: 6px; cursor: zoom-in; }

/* --- trackers: client vs programmers, same colour + icon everywhere --- */
.card.side-client { border-top: 2px solid var(--client); }
.card.side-dev { border-top: 2px solid var(--dev); }
.card.selected { border-top-width: 1px; }
tr.row.side-client td:first-child { box-shadow: inset 3px 0 0 var(--client); }
tr.row.side-dev td:first-child { box-shadow: inset 3px 0 0 var(--dev); }
.seg button.trk { display: inline-flex; align-items: center; gap: 5px; }
.seg button.trk svg { width: 12px; height: 12px; }
.seg button.trk.client { color: var(--client); }
.seg button.trk.dev { color: var(--dev); }
.seg button.trk.on.client { background: var(--client-soft); box-shadow: 0 0 0 1px var(--client); }
.seg button.trk.on.dev { background: var(--dev-soft); box-shadow: 0 0 0 1px var(--dev); }
.pair .chip.trk { height: 20px; min-width: 0; max-width: 100%; }
/* Narrow columns: the status goes under the chip instead of overflowing. */
.pair { flex-wrap: wrap; row-gap: 4px; }

.pair-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pair-col { border: 1px solid var(--line); border-top: 3px solid var(--line); border-radius: 8px; padding: 10px; background: var(--surface-2); min-width: 0; }
.pair-col.client { border-top-color: var(--client); }
.pair-col.dev { border-top-color: var(--dev); }
.pair-col-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.pair-col .linked { margin-bottom: 6px; }
.pair-col .linked.current { border-style: dashed; }
.pair-empty { font-size: 12.5px; }
@media (max-width: 640px) { .pair-cols { grid-template-columns: minmax(0, 1fr); } }

/* --- analysis: sections as tabs --- */
.sec-flags { display: inline-flex; gap: 3px; }
.sec-flag { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); }
.sec-flag svg { width: 12px; height: 12px; color: currentColor !important; }
.sec-flag.client { color: var(--client); border-color: color-mix(in srgb, var(--client) 45%, var(--line)); background: var(--client-soft); }
.sec-flag.dev { color: var(--dev); border-color: color-mix(in srgb, var(--dev) 45%, var(--line)); background: var(--dev-soft); }
.report-row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 160px; }
.report-row.current { box-shadow: 0 0 0 1px var(--accent); }
.analysis-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; color: inherit; text-decoration: none; }
.analysis-head .list-title { flex: 1 1 100%; min-width: 0; }
.analysis-head:hover .list-title { color: var(--accent); }
.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tab svg { width: 14px; height: 14px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab.client { color: color-mix(in srgb, var(--client) 75%, var(--muted)); }
.tab.dev { color: color-mix(in srgb, var(--dev) 75%, var(--muted)); }
.tab.on.client { color: var(--client); border-bottom-color: var(--client); }
.tab.on.dev { color: var(--dev); border-bottom-color: var(--dev); }
.tab-mark { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.tab-mark.verified { background: var(--ok); }
.tab-mark.wrong { background: var(--prod); }
.tab-pane .prose { overflow-wrap: anywhere; }
.drawer .tab-pane .prose { max-height: 420px; overflow: auto; }
.pane-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.pane-title { font-size: 13px; }
.dest {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 8px 10px; margin-bottom: 10px; border-radius: 8px; font-size: 13px;
  border: 1px solid var(--line); border-left: 3px solid var(--line); background: var(--surface-2);
}
.dest.client { border-left-color: var(--client); background: var(--client-soft); }
.dest.dev { border-left-color: var(--dev); background: var(--dev-soft); }
.dest-label { font-weight: 650; }
.review-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; margin: 0 0 16px; }
.tab-pane .review-form { padding: 10px 0 0; margin: 14px 0 0; border-top: 1px solid var(--line); }
.review-form .select { min-width: 200px; flex: 1 1 200px; }
.seg.wrap { flex-wrap: wrap; max-width: 100%; }
.pair-col .linked.from-analysis { border-style: dotted; }
@media (max-width: 640px) {
  .report-row .report-meta { flex-wrap: wrap; white-space: normal; }
  .page-head { flex-wrap: wrap; }
}

/* Board: last comment on hover. */
.peek {
  position: fixed;
  z-index: 40;
  width: min(440px, calc(100vw - 32px));
  max-height: min(360px, 60vh);
  overflow: hidden;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.peek.on { opacity: 1; }
.peek::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 36px;
  background: linear-gradient(transparent, var(--surface));
}
.peek .comment-head { margin-bottom: 8px; align-items: center; }
.peek .comment-head .spacer { flex: 1; }
.peek .avatar.side-developer_team { background: var(--info); }
.peek .avatar.side-customer { background: var(--prod); color: #fff; }
.peek .prose { font-size: 12.5px; line-height: 1.5; }
.peek-change { margin-top: 6px; font-size: 12px; color: var(--muted); }
.peek .prose blockquote { max-height: 4.5em; overflow: hidden; }
@media (hover: none) { .peek { display: none; } }

/* Issue numbers in texts: tracker colour, popup on hover (base.html). */
a.issue-ref {
  color: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}
a.issue-ref.client { color: var(--client); }
a.issue-ref.dev { color: var(--dev); }
a.issue-ref:hover { text-decoration-style: solid; }
.prose code a.issue-ref { color: inherit; }
.prose code:has(> a.issue-ref.client) { box-shadow: inset 0 -2px 0 var(--client); }
.prose code:has(> a.issue-ref.dev) { box-shadow: inset 0 -2px 0 var(--dev); }
.ref-peek .ref-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.ref-peek .ref-head b { font-size: 13px; line-height: 1.35; }
.ref-peek .ref-meta { font-size: 12px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }

/* --- server page (§17.1) --- */
.rail-badge.warn { background: var(--warn); color: var(--accent-ink); }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; background: var(--down); }
.live-dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); animation: live-pulse 2s ease-in-out infinite; }
.live-dot.off { background: var(--prod); }
@keyframes live-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ok) 0%, transparent); } }
.srv-alerts { margin-bottom: 16px; border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.srv-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.srv-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.srv-tile.hot { border-color: color-mix(in srgb, var(--warn) 60%, var(--line)); }
.srv-tile.hot .srv-tile-value::after { content: " !"; color: var(--warn); }
.srv-tile-label { color: var(--muted); font-size: 12px; }
.srv-tile-value { font-family: var(--mono); font-size: 26px; font-weight: 600; line-height: 1.2; margin-top: 2px; }
.srv-tile-sub { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin-bottom: 16px; }
.srv-chart { margin: 0; padding: 12px 12px 6px; min-width: 0; }
.srv-chart figcaption { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.srv-cores { grid-column: 1 / -1; }
.cores-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.core-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.chart-box { width: 100%; min-width: 0; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-box .grid { stroke: var(--line); stroke-width: 1; }
.chart-box .axis { fill: var(--faint); font: 10px var(--mono); }
.chart-box .threshold { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-box .line { fill: none; stroke: var(--info); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-box .line.hot { stroke: var(--warn); }
.chart-box .area { fill: color-mix(in srgb, var(--info) 12%, transparent); stroke: none; }
.chart-box .dot-end { fill: var(--info); stroke: var(--surface); stroke-width: 2; }
.chart-box .cross { stroke: var(--line-strong); stroke-width: 1; }
.chart-box .cross-dot { fill: var(--text); stroke: var(--surface); stroke-width: 2; }
.chart-box .hit { fill: transparent; cursor: crosshair; }
.chart-tip { position: fixed; z-index: 50; pointer-events: none; display: flex; flex-direction: column; gap: 2px; padding: 6px 9px; border-radius: 8px; background: var(--surface-3); border: 1px solid var(--line-strong); font-size: 12px; opacity: 0; transition: opacity 0.1s; }
.chart-tip.on { opacity: 1; }
.srv-tables { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; }
.table-scroll { overflow-x: auto; }
.srv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.srv-table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.srv-table td { padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.srv-table tr:last-child td { border-bottom: 0; }
.srv-table .num { text-align: right; white-space: nowrap; }
.ctr-name { display: inline-flex; align-items: center; gap: 8px; }

.ctr-warn { color: var(--warn); }
.bar { display: inline-block; width: 60px; height: 6px; border-radius: 3px; background: var(--surface-3); margin-right: 8px; vertical-align: middle; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--info); border-radius: 3px; }
@media (max-width: 820px) { .srv-tables { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .srv-charts { grid-template-columns: minmax(0, 1fr); }
  .srv-tile-value { font-size: 22px; }
  .srv-table th, .srv-table td { padding: 6px 8px; }
  .bar { display: none; }
}

/* --- project environment health (§17.3) --- */
.health-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.health-env.env-prod { border-top: 3px solid var(--prod); }
.health-env.env-test { border-top: 3px solid var(--test); }
.health-env-name { display: flex; align-items: baseline; gap: 10px; }
.env-tag { font-family: var(--mono); font-weight: 700; letter-spacing: 0.04em; }
.env-prod .env-tag { color: var(--prod); }
.env-test .env-tag { color: var(--test); }
.hc-list { list-style: none; margin: 0; padding: 4px 0; }
.hc { display: flex; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.hc:last-child { border-bottom: 0; }
.hc-mark { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--muted); }
.hc-ok .hc-mark { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.hc-info .hc-mark { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.hc-warn .hc-mark { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.hc-down .hc-mark { background: color-mix(in srgb, var(--prod) 20%, transparent); color: var(--prod); }
.hc-main { min-width: 0; flex: 1; }
.hc-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.hc-level { font-size: 11px; color: var(--muted); }
.hc-ms { margin-left: auto; font-size: 11px; }
.hc-summary { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.hc-details { margin-top: 6px; font-size: 12px; }
.hc-details summary { cursor: pointer; color: var(--faint); }
.hc-details ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.hc-details li { overflow-wrap: anywhere; }
.hc-pill { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.hc-pill.hc-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.hc-pill.hc-info { color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, var(--line)); }
.hc-pill.hc-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.hc-pill.hc-down { color: var(--prod); border-color: color-mix(in srgb, var(--prod) 45%, var(--line)); }

/* --- settings (§17.2) --- */
.settings-panel { max-width: 640px; }
.project-toggles { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 4px; }
.toggle { display: flex; align-items: center; gap: 12px; padding: 8px 4px; cursor: pointer; border-radius: 8px; }
.toggle:hover { background: var(--surface-2); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { position: relative; flex: none; width: 34px; height: 20px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line-strong); transition: background 0.15s; }
.toggle-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform 0.15s, background 0.15s; }
.toggle input:checked + .toggle-track { background: var(--accent-soft); border-color: var(--accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(14px); background: var(--accent); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle-name { font-weight: 500; }
.settings-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; }
.nowrap { white-space: nowrap; }
.srv-tile-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health-env .panel-head { flex-wrap: wrap; }
.ctr-proj { display: none; }
@media (max-width: 640px) {
  .srv-table .ctr-status { display: none; }
  .ctr-proj { display: block; margin-left: 16px; font-size: 11px; }
}

/* --- project page: header + section tabs (Задачі · Карта · Стан · Підключення · Диск · Логи) --- */
.proj-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.proj-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.proj-title h1 { font-size: 26px; }
.proj-state { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.proj-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.proj-actions form { display: contents; }
.btn.env.compact { height: 34px; min-width: 0; padding: 0 14px; font-size: 12px; }
.proj-tabs { margin-bottom: 20px; scrollbar-width: none; }
.proj-tabs::-webkit-scrollbar { display: none; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.tabs a svg { width: 15px; height: 15px; flex: none; }
.proj-page-head.slim { margin-bottom: 8px; }
.proj-page-head.slim h1 { font-size: 20px; }
.proj-page-head.slim .proj-mark.lg { width: 32px; height: 32px; font-size: 12px; }
.proj-page-head.slim + .proj-tabs { margin-bottom: 12px; }
.services.flush { padding: 0 0 18px; }

/* --- overview: KPIs, «Потребує уваги», project cards --- */
.ov-project { margin-bottom: 18px; }
.ov-project-name { margin: 0 0 10px; font-size: 13px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi {
  --tone: var(--muted);
  position: relative;
  display: grid;
  gap: 6px;
  padding: 14px 16px 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.12s;
}
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--tone); }
.kpi:hover { border-color: color-mix(in srgb, var(--tone) 55%, var(--line)); transform: translateY(-1px); }
.kpi-num { font-family: var(--mono); font-size: 30px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; color: var(--text); }
.kpi-label { font-size: 12.5px; color: var(--muted); }
.tone-accent { --tone: var(--accent); }
.tone-ok { --tone: var(--ok); }
.tone-warn { --tone: var(--warn); }
.tone-info { --tone: var(--info); }
.tone-client { --tone: var(--client); }
.tone-test { --tone: var(--test); }

.todo { display: grid; }
.todo-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  transition: background 0.12s;
}
.todo-row:first-child { border-top: 0; }
.todo-row:hover { background: var(--surface-2); }
.todo-row:hover .todo-title { color: var(--accent); }
.todo-reason {
  justify-self: start;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tone, var(--muted));
  background: color-mix(in srgb, var(--tone) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone) 35%, var(--line));
  white-space: nowrap;
}
.todo-main { display: grid; gap: 5px; min-width: 0; }
.todo-title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.12s; }
.todo-meta { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; flex-wrap: wrap; }
.todo-age { font-family: var(--mono); font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.todo-age.stale { color: var(--warn); }
.panel-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.panel-foot a:hover { color: var(--accent); }
.empty-state { display: grid; justify-items: center; gap: 6px; padding: 32px 16px; text-align: center; }
.empty-state svg { width: 28px; height: 28px; color: var(--ok); margin-bottom: 4px; }
.report-list { display: grid; gap: 8px; }

.station-top { align-items: center; padding: 16px 16px 0 18px; }
.station-id { flex: 1; min-width: 0; }
.station-name { font-size: 18px; }
.station-name:hover { color: var(--accent); }
.station-start { margin-left: auto; }
.station-env { padding: 14px 16px 0 18px; }
.station-env .btn.env { flex: 1 1 120px; }
.station-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 2px;
  margin-top: 14px;
  padding: 8px;
  border-top: 1px solid var(--line);
}
.station-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.station-links a:hover { background: var(--surface-2); color: var(--text); }
.station-links svg { width: 15px; height: 15px; flex: none; }

.srv-feed { margin-top: 16px; }

@media (max-width: 820px) {
  .proj-title h1 { font-size: 22px; }
  .proj-mark.lg { width: 34px; height: 34px; font-size: 12px; }
  .proj-actions { width: 100%; }
  .proj-actions .btn.env { flex: 1 1 0; }
  .proj-tabs { margin: 0 -16px 16px; padding: 0 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px 12px 12px 15px; }
  .kpi-num { font-size: 24px; }
  .todo-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px 14px; }
  .todo-reason { grid-column: 1 / -1; }
  .todo-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

/* --- phone fixes: filters in one scrollable row, tab overflow hint, cards that fit --- */
@media (max-width: 820px) {
  .toolbar { gap: 8px; }
  .toolbar .search { flex: 1 1 100%; max-width: none; }
  .toolbar .kbd { display: none; }
  .toolbar-filters { display: flex; gap: 8px; flex: 1 1 0; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .toolbar-filters::-webkit-scrollbar { display: none; }
  .toolbar-filters > * { flex: none; }
  .toolbar .seg[id="view"] { margin-left: 0 !important; flex: none; }
  .proj-tabs {
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
    mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .conn-head { flex-wrap: wrap; }
  .conn-head .btn { margin-left: 0; }
  .station-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .report-row > svg { display: none; }
  .report-row { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  .report-row .report-meta { grid-column: 1; flex-wrap: wrap; white-space: normal; }
}

/* ---------- issue drawer v2: description first, drafts in the thread, actions at the bottom ---------- */
.drawer-head { padding: 16px 56px 12px 22px; gap: 6px; }
.drawer-head h2 { font-size: 18px; }
.drawer-section > h3 { margin-bottom: 10px; }
.drawer-meta { display: grid; gap: 12px; padding-top: 12px; padding-bottom: 14px; }
.meta-line { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 16px; margin: 0; font-size: 12.5px; }
.meta-line div { min-width: 0; }
.meta-line dt { color: var(--faint); font-size: 11px; }
.meta-line dd { margin: 1px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; }
.rel-label { color: var(--faint); font-size: 11px; margin-right: 4px; }
.rel, .elsewhere {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0;
  height: 28px; padding: 0 10px; border-radius: 999px; font: inherit; font-size: 12px; color: var(--text);
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer;
  transition: border-color .12s, background .12s;
}
.rel svg, .elsewhere svg { width: 13px; height: 13px; flex-shrink: 0; }
.rel.client svg, .elsewhere.client svg { color: var(--client); }
.rel.dev svg, .elsewhere.dev svg { color: var(--dev); }
.rel.from-analysis { border-style: dashed; }
.rel-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.rel-st { color: var(--faint); white-space: nowrap; }
.rel-side { font-weight: 600; white-space: nowrap; }
.rel.client .rel-side { color: var(--client); }
.rel.dev .rel-side { color: var(--dev); }
.rel:hover, .elsewhere:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface-2)); }
.elsewhere { margin-top: 10px; }

/* Long text: clamped with «Показати…» (board.html shows the button only when it overflows). */
.prose.clamp { max-height: 240px; overflow: hidden; position: relative; }
.prose.clamp.clipped::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 48px;
  background: linear-gradient(transparent, var(--surface));
}
.new-task .prose.clamp.clipped::after { background: linear-gradient(transparent, var(--surface-2)); }
.prose.clamp.open { max-height: none; }
.prose.clamp.open::after { display: none; }
.clamp-more { margin-top: 6px; }

/* Attachments: small chips, folded when there are many. */
.files { margin-top: 12px; }
.files summary { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; font-size: 12px; color: var(--muted); list-style: none; }
.files summary::-webkit-details-marker { display: none; }
.files summary::after { content: "▸"; font-size: 10px; transition: transform .12s; }
.files[open] summary::after { transform: rotate(90deg); }
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 240px; height: 26px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); font-size: 11.5px; color: var(--text);
}
.file-chip:hover { border-color: var(--accent); }
.file-chip.img .file-name { color: var(--info); }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--faint); font-family: var(--mono); font-size: 10.5px; flex-shrink: 0; }

/* Images and logs inside the drawer stay small: thumbnails open full size in a new tab. */
.drawer .prose a.shot { display: flex; justify-content: center; width: 100%; margin: 8px 0; }
.drawer .prose a.shot img { display: block; max-width: min(100%, 420px); max-height: 280px; width: auto; object-fit: contain; }
/* Screenshot opened over the page; click or Esc closes. */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px;
  background: rgba(0, 0, 0, 0.85); cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #fff; }
.lightbox a { position: absolute; top: 14px; right: 18px; color: #fff; font-size: 13px; }
.drawer .prose pre { max-height: 220px; overflow: auto; }
.drawer .prose table { display: block; max-width: 100%; overflow: auto; }

/* New task for the programmers' tracker. */
.new-task {
  border: 1px solid color-mix(in srgb, var(--dev) 45%, var(--line)); border-left: 3px solid var(--dev);
  border-radius: 8px; background: var(--surface-2); padding: 12px 14px; display: grid; gap: 8px;
}
.new-task-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.draft-title { font-weight: 650; font-size: 13px; margin: 4px 0 6px; }
.chip.draft-chip { height: 18px; font-size: 10.5px; color: var(--test); border-color: color-mix(in srgb, var(--test) 50%, var(--line)); background: transparent; }

/* Thread: older comments fold behind one line. */
.older { margin-bottom: 4px; }
.older > summary {
  cursor: pointer; list-style: none; font-size: 12px; color: var(--muted); padding: 6px 10px; margin-bottom: 8px;
  border: 1px dashed var(--line); border-radius: 8px; text-align: center;
}
.older > summary::-webkit-details-marker { display: none; }
.older[open] > summary { margin-bottom: 4px; }
.thread .comment.draft { scroll-margin: 80px; }

/* Analysis folded under its title; history folded. */
.analysis-box { border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); margin-bottom: 6px; }
.analysis-box > summary {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 12px; cursor: pointer; list-style: none;
}
.analysis-box > summary::-webkit-details-marker { display: none; }
.analysis-box > .prose { padding: 4px 14px 14px; border-top: 1px solid var(--line); max-height: 480px; overflow: auto; }
.history > summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.history .timeline { margin-top: 10px; }

/* Actions pinned to the bottom of the drawer. */
.drawer-foot {
  position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 22px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-top: 1px solid var(--line-strong); backdrop-filter: blur(6px);
}
.drawer-foot .spacer { flex: 1; }
@media (max-width: 640px) {
  .meta-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer-foot { padding: 8px 12px; gap: 6px; }
  .drawer-foot .btn { height: 32px; padding: 0 10px; font-size: 12px; }
  .drawer-foot .btn.ghost { display: none; }
  .rel-title { max-width: 160px; }
}

/* ---------- «Звіти»: search, filters with counts, rows grouped by day ---------- */
.reports-toolbar { margin-bottom: 18px; }
.seg button .count, .day-head .count { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-left: 4px; }
.seg button.on .count { color: var(--muted); }
.report-days { display: grid; gap: 18px; }
.day-head {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--faint); margin: 0 0 8px 2px;
}
.task-row {
  position: relative; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px;
  padding: 9px 12px; margin-bottom: 4px;
}
.task-row-link { position: absolute; inset: 0; border-radius: inherit; }
.task-row-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.task-row .report-row-main { gap: 2px; }
.task-row .report-row-sub { font-size: 12px; flex: none; }
.task-row-issues { position: relative; z-index: 1; display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.issue-chip { display: inline-flex; border-radius: 6px; }
.issue-chip:hover .chip { border-color: currentColor; filter: brightness(1.15); }
.task-row .report-meta { position: relative; pointer-events: none; }
@media (max-width: 900px) {
  .task-row { grid-template-columns: minmax(0, 1fr) auto; }
  .task-row-issues { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .task-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .task-row .report-meta { grid-row: 3; }
}
.analysis-box > summary { grid-template-columns: auto minmax(0, 1fr) auto; }
.analysis-box > summary::before { content: "▸"; color: var(--faint); font-size: 11px; transition: transform .12s; }
.analysis-box[open] > summary::before { transform: rotate(90deg); }
.history > summary::marker { color: var(--faint); }
@media (max-width: 640px) {
  .drawer-foot { flex-wrap: nowrap; }
  .drawer-foot .btn:not(.accent) svg { display: none; }
  .drawer-foot .btn.accent { flex: 1 1 auto; min-width: 0; overflow: hidden; }
}
/* Decisions agreed in the threads: visible, the report itself stays folded. */
.decisions {
  margin: 8px 0; padding: 10px 14px; border-radius: 8px; background: var(--surface-2);
  border: 1px solid var(--line); border-left: 3px solid var(--ok);
}
.decisions-head { display: flex; gap: 8px; align-items: center; font-size: 12.5px; margin-bottom: 6px; }
.decisions .prose.clamp.clipped::after { background: linear-gradient(transparent, var(--surface-2)); }
/* Analyses of other issues that only mention this one as similar. */
.mentioned { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; font-size: 12px; }
.mention {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; padding: 3px 8px;
  border: 1px dashed var(--line); border-radius: 8px; color: var(--muted);
}
.mention:hover { border-color: var(--accent); color: var(--text); }

/* Team, journal, sessions */
.seg a { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 6px; color: var(--muted); font-size: 12.5px; font-weight: 550; text-decoration: none; white-space: nowrap; }
.seg a.on { background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); }
.btn.danger { color: var(--prod); border-color: color-mix(in srgb, var(--prod) 45%, var(--line)); }
.team-list { display: grid; gap: 8px; }
.member { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.member.pending { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.member.off { opacity: 0.65; }
.member > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.member > summary::-webkit-details-marker { display: none; }
.member-main { flex: 1; min-width: 180px; display: grid; gap: 2px; }
.member-body { padding: 4px 12px 14px; display: grid; gap: 14px; border-top: 1px solid var(--line); }
.member-sessions { display: grid; gap: 6px; font-size: 13px; }
.access-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.access-proj { margin: 0; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px 8px; min-width: 0; }
.access-conns { display: flex; gap: 10px; flex-wrap: wrap; padding-left: 4px; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.session-row { display: grid; grid-template-columns: minmax(90px, auto) minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.session-row:last-child { border-bottom: 0; }
.session-row .clamp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.invite-copy { display: flex; gap: 8px; }
.invite-copy input { flex: 1; min-width: 0; height: 36px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); padding: 0 10px; }
.journal-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.journal-filters .seg { overflow-x: auto; max-width: 100%; }
.srv-table.journal tr.tone-warn td { background: color-mix(in srgb, var(--prod) 7%, transparent); }
.journal-details { max-width: 520px; overflow-wrap: anywhere; font-size: 12.5px; }
.chip.warn { color: var(--prod); border-color: color-mix(in srgb, var(--prod) 45%, var(--line)); }
@media (max-width: 640px) {
  .session-row { grid-template-columns: minmax(0, 1fr) auto; }
  .session-row .clamp { grid-column: 1 / -1; order: 3; }
  .journal-details { max-width: 260px; }
}
.journal-filters .search { height: 36px; min-width: 200px; flex: 1; max-width: 320px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; padding: 0 10px; }
@media (max-width: 640px) { .journal-filters .search { max-width: none; width: 100%; } }

/* Telegram Mini App: fullscreen safe areas (telegram.js sets --tg-top / --tg-bottom). */
.tg-app .topbar { height: calc(56px + var(--tg-top, 0px)); padding-top: var(--tg-top, 0px); }
.tg-app .rail, .tg-app .shell.compact .rail { padding-top: calc(18px + var(--tg-top, 0px)); padding-bottom: calc(14px + var(--tg-bottom, 0px)); }
.tg-app .main { padding-bottom: calc(48px + var(--tg-bottom, 0px)); }
@media (min-width: 821px) { .tg-app .main { padding-top: calc(28px + var(--tg-top, 0px)); } }
/* Telegram has its own Back and Settings buttons: the web logout stays, the theme switch follows Telegram. */
.tg-app #theme-toggle { display: none; }
.tg-bindings { display: grid; gap: 8px; }
.tg-binding { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(200px, 2fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tg-binding:last-child { border-bottom: 0; }
@media (max-width: 640px) { .tg-binding { grid-template-columns: 1fr; } }

/* ---------- board on a phone (and in the Telegram Mini App) ----------
   Statuses go top to bottom instead of side by side; a sticky strip of statuses with counts
   jumps between them, a status heading folds its list. */
.col-jump { display: none; }
.column-head .chev { display: none; }
@media (max-width: 820px) {
  .proj-page-head.phone-row { flex-wrap: nowrap; gap: 10px; margin-bottom: 10px; }
  .proj-page-head.phone-row .proj-title { gap: 10px; flex: 1 1 auto; }
  .proj-page-head.phone-row .proj-title > div { min-width: 0; }
  .proj-page-head.phone-row h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .proj-page-head.phone-row .proj-mark.lg { width: 30px; height: 30px; font-size: 11px; }
  .proj-page-head.phone-row .proj-state { margin-top: 1px; font-size: 11.5px; }
  .proj-page-head.phone-row .proj-actions { width: auto; flex-wrap: nowrap; gap: 6px; }
  .proj-page-head.phone-row .proj-actions .btn { flex: none; height: 30px; padding: 0 9px; font-size: 11.5px; }
  .proj-page-head.phone-row .btn-label { display: none; }
  .proj-page-head.phone-row + .proj-tabs { margin-bottom: 10px; }

  .toolbar { margin-bottom: 6px; }
  .toolbar .seg[id="view"] { display: none; }

  .col-jump {
    position: sticky;
    top: calc(56px + var(--tg-top, 0px));
    z-index: 30;
    display: flex;
    gap: 6px;
    margin: 0 -16px 10px;
    padding: 8px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }
  .col-jump::-webkit-scrollbar { display: none; }
  .col-jump a {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 11px;
    border-radius: 15px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 550;
    text-decoration: none;
    white-space: nowrap;
  }
  .col-jump a[hidden] { display: none; }
  .col-jump a i { width: 8px; height: 8px; border-radius: 2px; background: var(--col, var(--down)); }
  .col-jump a span { font-family: var(--mono); font-size: 11px; color: var(--faint); }
  .col-jump a.is-empty { opacity: 0.55; }
  .col-jump a.on { color: var(--text); border-color: var(--col, var(--line-strong)); background: color-mix(in srgb, var(--col, var(--surface-3)) 14%, var(--surface)); }
  .col-jump a.on span { color: var(--muted); }
  .col-jump a[data-col="Нова"] { --col: var(--accent); }
  .col-jump a[data-col="В роботі"] { --col: var(--prod); }
  .col-jump a[data-col="Тестувати"] { --col: var(--test); }
  .col-jump a[data-col="Чекаю програмістів"] { --col: var(--info); }
  .col-jump a[data-col="Чекаю клієнта"] { --col: var(--client); }
  .col-jump a[data-col="Вирішено"] { --col: var(--ok); }

  /* No horizontal scroller around the columns: sticky headings follow the page. */
  .board { display: block; overflow: visible; padding: 0; scroll-snap-type: none; }
  .board .column, .board .column.is-empty {
    min-width: 0;
    min-height: 0;
    margin-bottom: 14px;
    border: 0;
    background: none;
    scroll-margin-top: calc(56px + 47px + var(--tg-top, 0px));
  }
  .column-head {
    top: calc(56px + 47px + var(--tg-top, 0px));
    z-index: 20;
    padding: 9px 2px;
    border-bottom: 0;
    background: var(--bg);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .column-head h3 { font-size: 14px; }
  .column-head .chev { display: block; width: 16px; height: 16px; color: var(--faint); transform: rotate(90deg); transition: transform 0.15s; }
  .column.collapsed .column-head .chev { transform: none; }
  .column.collapsed .column-body { display: none; }
  .column.is-empty .column-body { display: none; }
  .column.is-empty .column-head { opacity: 0.6; }
  .column-body { padding: 0; gap: 8px; }

  .card { gap: 7px; padding: 11px 12px 10px 14px; animation: none; }
  .card:hover { transform: none; }
  .card:active { background: var(--surface-2); }
  .card-title { font-size: 14.5px; -webkit-line-clamp: 4; }
}

/* Mini App fullscreen: the issue sheet stays clear of Telegram's own buttons and the home bar. */
.tg-app .drawer { padding-top: var(--tg-top, 0px); }
.tg-app .drawer-foot { padding-bottom: calc(8px + var(--tg-bottom, 0px)); }

/* Tables in analyses: words never break inside a cell (a column no longer shrinks to one letter);
   a table wider than the screen scrolls sideways instead. */
.prose table { max-width: 100%; -webkit-overflow-scrolling: touch; }
.prose th, .prose td { overflow-wrap: normal; word-break: normal; min-width: 64px; max-width: 340px; }
.prose th { white-space: nowrap; }
.prose td code { white-space: nowrap; }
@media (max-width: 640px) {
  .prose table { font-size: 12px; margin-left: -2px; margin-right: -2px; }
  .prose th, .prose td { padding: 5px 7px; max-width: 240px; }
}
@media (max-width: 640px) {
  .prose table.cards, .prose table.cards tbody { display: block; overflow: visible; border: 0; font-size: 12.5px; }
  .prose table.cards thead { display: none; }
  .prose table.cards tr {
    display: block; margin: 0 0 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2);
  }
  .prose table.cards td {
    position: relative; display: block; min-width: 0; max-width: none;
    padding: 3px 0 3px 90px; border: 0; overflow-wrap: anywhere;
  }
  .prose table.cards td::before {
    content: attr(data-label); position: absolute; left: 0; top: 3px; width: 82px;
    color: var(--faint); font-size: 11px; line-height: 1.75; overflow-wrap: anywhere;
  }
  .prose table.cards td:first-child { font-weight: 600; }
  .prose table.cards td code { white-space: normal; overflow-wrap: anywhere; }
  .prose table.cards td:empty { display: none; }
}
