@import url('https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Fraunces:ital,wght@1,500&display=swap');

/* Smart Snag Plans: site chrome, cards, login and the comment layer.
   Brand (public/styles/snagmap-ds.css in snag-map): navy #08191F carries the layout,
   green is the one accent per view. The --red* names are kept from the site this
   was copied from (nethubdev.net) so the scripts need no change: they hold GREEN here.
   Figtree body. The plan documents are styled by document.css (smartsnag-project). */


/* ---------- colour tokens: light (default) ----------
   Dark mode follows the system (prefers-color-scheme) unless the bar's
   sun/moon toggle stored an override: html[data-theme="light" | "dark"], set
   before first paint by the inline script in <head> (src/lib/theme.ts).
   The plan / report sheets (.sheet) re-declare the light set, so documents stay
   white paper on a dark desk, like a PDF on a dark screen. --navy, --red and
   --white are brand constants and never change; surfaces use --surface, and
   anything "navy because it is selected / focused" uses --sel / --on-sel. */
:root, .sheet {
  color-scheme: light;
  --navy: #08191f;
  --navy-2: #13303a;
  --red: #1a6b4a;
  --red-deep: #14553b;
  --red-hover: #22885e;
  --red-tint: #e3f5ed;
  --white: #ffffff;
  --bg: #f2f2f2;
  --desk: #dfe4e6;
  --surface: #ffffff;
  --surface-2: #f7f8f8;
  --surface-3: #fafbfb;
  --grey: #f2f2f2;
  --hover: #f7f9f9;
  --hover-2: #e9ecec;
  --row-on: #eef3f5;
  --chip: #e6ecee;
  --chip-hover: #d3dde0;
  --chip-soft: #eef1f2;
  --track: #e3e8ea;
  --rule: #d8dcde;
  --line: #e3e6e7;
  --line-strong: #9fb0b6;
  --ink: #08191f;
  --ink-2: #3d4c52;
  --muted: #5a6a70;
  --faint: #9fb0b6;
  --sel: #08191f;
  --on-sel: #ffffff;
  --green: #16805f;
  --green-tint: #e3f5ed;
  --green-line: #9fd4bd;
  --on-green: #ffffff;
  --amber: #9a5b00;
  --amber-tint: #fdf2dc;
  --amber-line: #e7c78a;
  --amber-ink: #5c3a00;
  --on-amber: #ffffff;
  --purple: #5d1f77;
  --purple-tint: #ece3f2;
  --purple-line: #c9b1d8;
  --purple-wash: #f5eff9;
  --purple-wash-2: #f0eaf5;
  --todo-bg: #e6eef1;
  --todo-line: #b8c8ce;
  --info-tint: #ddf4ff;
  --info-ink: #0a3069;
  --link: #0b5a73;
  --link-chip: #e3eef2;
  --pri-2: #d97a00;
  --pri-3: #3d6f80;
  --pri-4: #9fb0b6;
  --tab-hover: #f3f6f7;
  --tab-hover-line: #9aa7ad;
  --toast: #08191f;
  --flash: #fff6e0;
  --seg-sep: rgba(255, 255, 255, 0.6);
  --scrim-1: rgba(8, 25, 31, 0.28);
  --scrim-2: rgba(8, 25, 31, 0.45);
  --scrim-3: rgba(8, 25, 31, 0.5);
  --pop-edge: transparent;
  --badge-ring: transparent;
  --focus: 0 0 0 3px rgba(231, 55, 70, 0.35);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4' fill='none' stroke='%233d4c52' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --show-sun: none;
  --show-moon: block;
  /* diff lines (light measured 2026-10-14, see .df-code) */
  --df-ctx-ln: #f6f8f9;
  --df-ln-ink: #3d4c52;
  --df-add: #dafbe1;
  --df-add-bar: #1f883d;
  --df-add-ln: #c7f0d2;
  --df-add-mk: #aceebb;
  --df-add-mk-ink: #0f5323;
  --df-add-wd: #abf2bc;
  --df-add-wd-line: #8fe0a3;
  --df-del: #ffebe9;
  --df-del-bar: #cf222e;
  --df-del-ln: #ffd7d5;
  --df-del-mk: #ffcecb;
  --df-del-mk-ink: #82071e;
  --df-del-wd: #ffc1c0;
  --df-del-wd-line: #f5a3a1;
  --df-hunk: #ddf4ff;
  --df-hunk-ink: #0a3069;
  --df-hunk-line: #b6e3ff;
}

:root {
  --bar-h: 100px;
  --rail-w: 360px;
  --radius: 10px;
}

/* ---------- colour tokens: dark ----------
   The same block twice: once for "follow the system" (no override stored),
   once for the explicit toggle. Contrast measured 2026-10-15 on --surface
   #111e23: ink 14.4, ink-2 10.8, muted 7.6, faint 5.3, red text 6.8, green 8.1,
   amber 9.2, purple 8.4, link 9.1; pills on their tints 6.5-9.4. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --navy-2: #1d3a45;
    --red-deep: #2aaf78;
    --red-hover: #22885e;
    --red-tint: #0f2e22;
    --bg: #0b1418;
    --desk: #0a1215;
    --surface: #111e23;
    --surface-2: #16262c;
    --surface-3: #142328;
    --grey: #1a2a30;
    --hover: #1a2c33;
    --hover-2: #22363e;
    --row-on: #1f343c;
    --chip: #22363e;
    --chip-hover: #2c444d;
    --chip-soft: #1f3138;
    --track: #24363d;
    --rule: #2e434b;
    --line: #24363d;
    --line-strong: #5f7279;
    --ink: #e6edef;
    --ink-2: #c3d0d4;
    --muted: #9fb0b6;
    --faint: #80939a;
    --sel: #d5e1e5;
    --on-sel: #08191f;
    --green: #4cc79a;
    --green-tint: #12301f;
    --green-line: #2a6a4d;
    --on-green: #08191f;
    --amber: #f0b44c;
    --amber-tint: #33260c;
    --amber-line: #6b5220;
    --amber-ink: #f3d9a4;
    --on-amber: #08191f;
    --purple: #d3a6ea;
    --purple-tint: #2c1a38;
    --purple-line: #5b3b70;
    --purple-wash: #2a1a35;
    --purple-wash-2: #2a1a35;
    --todo-bg: #1c2e35;
    --todo-line: #3d5560;
    --info-tint: #10283a;
    --info-ink: #9cd2ff;
    --link: #7cc8e3;
    --link-chip: #16323d;
    --pri-2: #f0a040;
    --pri-3: #6fa7ba;
    --pri-4: #6b7f86;
    --tab-hover: #1a2c33;
    --tab-hover-line: #5f7279;
    --toast: #22363e;
    --flash: #3a2f12;
    --seg-sep: rgba(17, 30, 35, 0.75);
    --scrim-1: rgba(0, 0, 0, 0.45);
    --scrim-2: rgba(0, 0, 0, 0.6);
    --scrim-3: rgba(0, 0, 0, 0.62);
    --pop-edge: #2e434b;
    --badge-ring: rgba(255, 255, 255, 0.4);
    --focus: 0 0 0 3px rgba(255, 122, 133, 0.55);
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4' fill='none' stroke='%23c3d0d4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --show-sun: block;
    --show-moon: none;
    --df-ctx-ln: #142328;
    --df-ln-ink: #c3d0d4;
    --df-add: #12301c;
    --df-add-bar: #3fb950;
    --df-add-ln: #173a23;
    --df-add-mk: #1d4a2c;
    --df-add-mk-ink: #8be3a8;
    --df-add-wd: #1f5a33;
    --df-add-wd-line: #2b7444;
    --df-del: #3a1418;
    --df-del-bar: #f85149;
    --df-del-ln: #45191e;
    --df-del-mk: #552027;
    --df-del-mk-ink: #ffa3ab;
    --df-del-wd: #6b1f27;
    --df-del-wd-line: #85303a;
    --df-hunk: #10283a;
    --df-hunk-ink: #9cd2ff;
    --df-hunk-line: #1d4560;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --navy-2: #1d3a45;
  --red-deep: #2aaf78;
  --red-hover: #22885e;
  --red-tint: #0f2e22;
  --bg: #0b1418;
  --desk: #0a1215;
  --surface: #111e23;
  --surface-2: #16262c;
  --surface-3: #142328;
  --grey: #1a2a30;
  --hover: #1a2c33;
  --hover-2: #22363e;
  --row-on: #1f343c;
  --chip: #22363e;
  --chip-hover: #2c444d;
  --chip-soft: #1f3138;
  --track: #24363d;
  --rule: #2e434b;
  --line: #24363d;
  --line-strong: #5f7279;
  --ink: #e6edef;
  --ink-2: #c3d0d4;
  --muted: #9fb0b6;
  --faint: #80939a;
  --sel: #d5e1e5;
  --on-sel: #08191f;
  --green: #4cc79a;
  --green-tint: #12301f;
  --green-line: #2a6a4d;
  --on-green: #08191f;
  --amber: #f0b44c;
  --amber-tint: #33260c;
  --amber-line: #6b5220;
  --amber-ink: #f3d9a4;
  --on-amber: #08191f;
  --purple: #d3a6ea;
  --purple-tint: #2c1a38;
  --purple-line: #5b3b70;
  --purple-wash: #2a1a35;
  --purple-wash-2: #2a1a35;
  --todo-bg: #1c2e35;
  --todo-line: #3d5560;
  --info-tint: #10283a;
  --info-ink: #9cd2ff;
  --link: #7cc8e3;
  --link-chip: #16323d;
  --pri-2: #f0a040;
  --pri-3: #6fa7ba;
  --pri-4: #6b7f86;
  --tab-hover: #1a2c33;
  --tab-hover-line: #5f7279;
  --toast: #22363e;
  --flash: #3a2f12;
  --seg-sep: rgba(17, 30, 35, 0.75);
  --scrim-1: rgba(0, 0, 0, 0.45);
  --scrim-2: rgba(0, 0, 0, 0.6);
  --scrim-3: rgba(0, 0, 0, 0.62);
  --pop-edge: #2e434b;
  --badge-ring: rgba(255, 255, 255, 0.4);
  --focus: 0 0 0 3px rgba(255, 122, 133, 0.55);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4' fill='none' stroke='%23c3d0d4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --show-sun: block;
  --show-moon: none;
  --df-ctx-ln: #142328;
  --df-ln-ink: #c3d0d4;
  --df-add: #12301c;
  --df-add-bar: #3fb950;
  --df-add-ln: #173a23;
  --df-add-mk: #1d4a2c;
  --df-add-mk-ink: #8be3a8;
  --df-add-wd: #1f5a33;
  --df-add-wd-line: #2b7444;
  --df-del: #3a1418;
  --df-del-bar: #f85149;
  --df-del-ln: #45191e;
  --df-del-mk: #552027;
  --df-del-mk-ink: #ffa3ab;
  --df-del-wd: #6b1f27;
  --df-del-wd-line: #85303a;
  --df-hunk: #10283a;
  --df-hunk-ink: #9cd2ff;
  --df-hunk-line: #1d4560;
}

/* form fields without their own background take the surface (zero specificity,
   so every component rule still wins) */
:where(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) { background-color: var(--surface); color: var(--ink); }

/* popovers, menus, drawers and modals get a hairline edge in dark, where a
   navy shadow on a dark page no longer separates them */
.nh-menu, .trk-pop, .nh-diff, .nh-rail, .bl-drawer, .rl-rail, .rl-im, .rl-modal, .rl-legend-pop, .nh-toast { outline: 1px solid var(--pop-edge); outline-offset: -1px; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: Figtree, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: inherit; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

/* ---------- bar ---------- */

.nh-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--navy);
  color: var(--white);
}

.nh-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 24px;
  max-width: 1440px;
  margin: 0 auto;
}

.nh-home { display: flex; flex-shrink: 0; }
.nh-home img { display: block; height: 20px; width: auto; }

.nh-crumb { color: #c7d0d4; text-decoration: none; font-size: 14px; flex-shrink: 0; }
.nh-crumb:hover { color: var(--white); }
.nh-sep { color: #5f7279; }

.nh-title {
  font-weight: 600;
  font-size: 15px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nh-user { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.nh-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* who's online: overlapping initials, you first */
.nh-people { display: flex; align-items: center; gap: 6px; }
.nh-av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--white);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 2px solid var(--navy);
  flex-shrink: 0;
  position: relative;
  transition: transform 0.15s ease;
}
a.nh-av:hover { transform: translateY(-2px); z-index: 1; }
.nh-av.you { box-shadow: 0 0 0 2px var(--white); }

.nh-link {
  font: inherit;
  font-size: 13px;
  color: #c7d0d4;
  background: none;
  border: 0;
  padding: 6px 2px;
  cursor: pointer;
}
.nh-link:hover { color: var(--white); text-decoration: underline; }
/* the same text button inside the page (e.g. "+15 more", "Clear") reads as a
   link on the surface, not in the bar's pale grey */
:where(.nh-page, .rl-rail, .rl-im, .rl-modal, .bl-drawer) .nh-link { color: var(--ink-2); }
:where(.nh-page, .rl-rail, .rl-im, .rl-modal, .bl-drawer) .nh-link:hover { color: var(--ink); }

/* the sun/moon theme toggle (public/doc/theme.js): the icon shows the theme a
   click switches to */
.nh-theme {
  font: inherit;
  width: 32px;
  height: 32px;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: none;
  color: #c7d0d4;
  cursor: pointer;
}
.nh-theme:hover { color: var(--white); border-color: rgba(255, 255, 255, 0.45); }
.nh-theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nh-theme .i-sun { display: var(--show-sun); }
.nh-theme .i-moon { display: var(--show-moon); }

.nh-bar-tools {
  min-height: 44px;
  border-top: 1px solid var(--navy-2);
  max-width: none;
  background: var(--surface);
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  gap: 10px;
}

.nh-tabs { display: flex; align-self: stretch; gap: 4px; margin-right: auto; overflow-x: auto; scrollbar-width: none; }
.nh-tabs::-webkit-scrollbar { display: none; }

.nh-tab {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.nh-tab:hover { color: var(--ink); }
.nh-tab.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--red); }

.nh-ver { font-size: 12px; color: var(--muted); white-space: nowrap; }

.nh-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.nh-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nh-btn-red { background: var(--red); color: var(--white); }
.nh-btn-red:hover { background: var(--red-hover); }
.nh-btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.nh-btn-ghost:hover { border-color: var(--ink-2); }
.nh-btn-ghost[aria-expanded="true"] { border-color: var(--sel); background: var(--grey); }
.nh-btn[disabled] { opacity: 0.55; cursor: default; }

.nh-count {
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  padding: 0 6px;
  background: var(--grey);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nh-count.has { background: var(--red); color: var(--white); }

/* ---------- status badges ---------- */

.nh-status {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.s-draft { background: var(--grey); color: var(--ink-2); }
.s-review { background: var(--red-tint); color: var(--red-deep); }
.s-agreed { background: var(--green-tint); color: var(--green); }
.s-building { background: var(--navy); color: var(--white); box-shadow: inset 0 0 0 1px #5f7279; }
.s-complete { background: var(--green); color: var(--on-green); }
.s-feedback { background: var(--amber-tint); color: var(--amber); }

/* status: the badge in the bar is a menu button */
.nh-status-wrap { position: relative; flex-shrink: 0; }
.nh-status-btn {
  font-family: inherit;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-right: 5px;
}
.nh-status-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nh-status-btn:hover { filter: brightness(0.96); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35); }
.nh-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 70;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(8, 25, 31, 0.28);
  padding: 6px;
}
.nh-menu[hidden] { display: none; }
.nh-menu-head { font-size: 12px; font-weight: 600; padding: 8px 10px 6px; display: flex; flex-direction: column; gap: 2px; }
.nh-menu-head small { font-weight: 400; color: var(--muted); }
.nh-menu [role="menuitemradio"] {
  font: inherit;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.nh-menu [role="menuitemradio"]:hover, .nh-menu [role="menuitemradio"]:focus-visible { background: var(--grey); box-shadow: none; }
.nh-menu [role="menuitemradio"][aria-checked="true"] { background: var(--grey); box-shadow: inset 3px 0 0 var(--sel); }
.nh-menu [role="menuitemradio"] small { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* ---------- home: plan cards ---------- */

.nh-page { max-width: 1240px; margin: 0 auto; padding: 36px 24px 72px; }

.nh-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.nh-page-head h1 { font-size: 28px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
.nh-page-head p { margin: 0; color: var(--muted); font-size: 14px; max-width: 60ch; }

.nh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

.nh-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.nh-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(8, 25, 31, 0.12); }

.nh-card-banner { aspect-ratio: 2 / 1; background: var(--navy); overflow: hidden; position: relative; }
.nh-card-banner img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.nh-card-banner .nh-status { position: absolute; top: 12px; left: 12px; box-shadow: 0 1px 4px rgba(8, 25, 31, 0.2); }

.nh-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.nh-card h2 { font-size: 17px; font-weight: 600; margin: 0; line-height: 1.3; }
.nh-card p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nh-card-foot { margin-top: auto; padding-top: 10px; display: flex; gap: 14px; font-size: 12px; color: var(--muted); align-items: center; }
.nh-card-foot .open { color: var(--red-deep); font-weight: 600; }

.nh-empty {
  background: var(--surface);
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}
.nh-empty h2 { color: var(--ink); font-size: 18px; margin: 0 0 6px; }
.nh-empty p { margin: 0 auto; max-width: 46ch; font-size: 14px; line-height: 1.6; }
.nh-empty code { background: var(--grey); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* ---------- login ---------- */

.nh-login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.nh-login-side {
  background: var(--navy);
  color: var(--white);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.nh-login-side img { width: 180px; height: auto; }
.nh-login-side h1 { font-size: 34px; line-height: 1.15; font-weight: 700; margin: 0 0 12px; max-width: 14ch; }
.nh-login-side p { color: #c7d0d4; margin: 0; max-width: 40ch; line-height: 1.6; }
.nh-login-side small { color: #8fa1a8; font-size: 12px; }

.nh-login-main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: var(--surface); }
.nh-login form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.nh-login h2 { font-size: 22px; margin: 0; }
.nh-login .hint { color: var(--muted); font-size: 14px; margin: -8px 0 4px; }
.nh-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.nh-field input {
  font: inherit;
  font-size: 15px;
  padding: 11px 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
}
.nh-field input:focus { outline: none; border-color: var(--sel); box-shadow: var(--focus); }
.nh-login .nh-btn { min-height: 44px; justify-content: center; font-size: 15px; }
.nh-error { background: var(--red-tint); color: var(--red-deep); padding: 10px 12px; border-radius: 8px; font-size: 14px; }

/* ---------- plan document layout ---------- */

body.nh-doc { padding: 0; background: var(--desk); }

.nh-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 24px;
  padding: 26px 24px 80px;
}

.nh-main { position: relative; flex: 0 1 210mm; min-width: 0; }
.nh-main .sheet { margin: 0; max-width: 210mm; }
/* the sheet re-declares the light tokens (top of file); its text must not inherit the dark page colour */
.sheet { color: var(--ink); }

/* Tables in plans are wide; on narrow screens they scroll inside the sheet. */
.tablewrap { overflow-x: auto; margin: 0 0 5mm 0; }
.tablewrap > table { margin-bottom: 0; }

.nh-rail {
  flex: 0 0 var(--rail-w);
  position: sticky;
  top: calc(var(--bar-h) + 16px);
  max-height: calc(100vh - var(--bar-h) - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 3px 22px rgba(8, 25, 31, 0.12);
  font-size: 14px;
}

/* ---------- comment affordances on the document ---------- */

[data-b] { scroll-margin-top: calc(var(--bar-h) + 40px); transition: background-color 0.3s; }
.nh-doc [data-b].nh-hover { background-color: rgba(231, 55, 70, 0.05); }
.nh-doc [data-b].nh-has { background-color: rgba(42, 175, 120, 0.09); box-shadow: inset 3px 0 0 var(--red); }
.nh-doc tr[data-b].nh-has { box-shadow: none; }
.nh-doc tr[data-b].nh-has > td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.nh-doc [data-b].nh-target { background-color: rgba(231, 55, 70, 0.16); }
.nh-doc .cover [data-b].nh-hover,
.nh-doc .cover [data-b].nh-has { background-color: rgba(255, 255, 255, 0.08); }

.nh-add, .nh-badge {
  position: absolute;
  z-index: 5;
  border: 0;
  cursor: pointer;
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nh-add {
  z-index: 6;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(8, 25, 31, 0.25);
}
.nh-add svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.nh-add[hidden] { display: none; }
.nh-badge {
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px 11px 11px 3px;
  background: var(--navy);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  gap: 3px;
  box-shadow: 0 0 0 1px var(--badge-ring);
}
.nh-badge.resolved { background: #8fa1a8; }

/* ---------- comment rail ---------- */

.nh-rail-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.nh-rail-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.nh-rail-title h2 { font-size: 15px; margin: 0; padding: 0; border: 0; font-weight: 600; }
.nh-x { background: none; border: 0; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--ink-2); display: none; }
.nh-x:hover { background: var(--grey); }
.nh-x svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }

.nh-seg { display: flex; background: var(--grey); border-radius: 8px; padding: 3px; gap: 2px; }
.nh-seg button {
  flex: 1;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  border: 0;
  background: none;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink-2);
}
.nh-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(8, 25, 31, 0.12); }

.nh-rail-body { padding: 12px 12px 20px; display: flex; flex-direction: column; gap: 10px; }

.nh-hint { color: var(--muted); font-size: 13px; line-height: 1.55; padding: 18px 8px; text-align: center; }
.nh-group { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 8px 4px 0; }

.nh-thread {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.nh-thread.on { border-color: var(--sel); box-shadow: 0 0 0 1px var(--sel); }
.nh-thread.is-resolved { background: var(--surface-3); }

.nh-quote {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  background: var(--grey);
  border: 0;
  border-left: 3px solid var(--red);
  border-radius: 4px;
  padding: 6px 8px;
  margin-bottom: 10px;
  cursor: pointer;
}
.nh-quote[disabled] { cursor: default; border-left-color: #8fa1a8; }
.nh-quote b { display: block; color: var(--ink-2); font-weight: 600; margin-bottom: 1px; }
.nh-quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.nh-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.nh-tags .nh-tag { margin: 0; }
.nh-tag.gotcha { background: var(--amber); color: var(--on-amber); }
.nh-quote.whole { cursor: default; border-left-color: var(--sel); }

.nh-whole {
  margin-top: 10px;
  width: 100%;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px dashed var(--rule);
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}
.nh-whole:hover { border-color: var(--ink-2); color: var(--ink); }
.nh-whole svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.nh-tag { display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; margin: 0 0 8px; }
.nh-tag.outdated { background: var(--amber-tint); color: var(--amber); }
.nh-tag.resolved { background: var(--green-tint); color: var(--green); }

.nh-c { display: grid; grid-template-columns: 28px 1fr; gap: 0 10px; }
.nh-c + .nh-c { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.nh-c .nh-avatar { width: 28px; height: 28px; font-size: 10.5px; letter-spacing: 0.02em; }
.nh-c .nh-avatar.claude { background: var(--navy); box-shadow: 0 0 0 1px var(--pop-edge); }
.nh-c-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.nh-c-head b { font-weight: 600; font-size: 13px; }
.nh-c-head time { font-size: 12px; color: var(--muted); }
.nh-c-head .nh-act.del { margin-left: auto; padding: 2px 6px; }
.nh-c-body { grid-column: 2; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.nh-c-body.deleted { color: var(--muted); font-style: italic; }

.nh-actions { display: flex; gap: 4px; margin-top: 10px; flex-wrap: wrap; }
.nh-act {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  background: none;
  border: 0;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink-2);
}
.nh-act:hover { background: var(--grey); color: var(--ink); }
.nh-act.del { color: var(--red-deep); }

.nh-compose { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.nh-compose textarea {
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  min-height: 76px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  width: 100%;
}
.nh-compose textarea:focus { outline: none; border-color: var(--sel); box-shadow: var(--focus); }
.nh-compose-row { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.nh-compose-row small { color: var(--muted); font-size: 11px; margin-right: auto; }
.nh-new { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.nh-new .nh-compose { margin-top: 0; }
.nh-err { color: var(--red-deep); font-size: 12px; }

.nh-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--toast);
  color: var(--white);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 60;
  box-shadow: 0 6px 20px rgba(8, 25, 31, 0.3);
}

/* ---------- design tab ---------- */

body.nh-design { background: var(--surface); display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.nh-dlayout { flex: 1; min-height: 0; display: flex; }
/* the design is a page of its own: it stays light, like the plan sheets */
.nh-frame { display: block; flex: 1; min-width: 0; height: 100%; border: 0; background: #ffffff; color-scheme: light; }
#nh-pick[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: var(--white); }

@media (min-width: 1240px) {
  .nh-rail-dock {
    position: static;
    flex: 0 0 var(--rail-w);
    max-height: none;
    border-radius: 0;
    box-shadow: none;
    border-left: 1px solid var(--rule);
  }
}

/* ---------- narrower screens: the rail becomes a drawer ---------- */

@media (max-width: 1239px) {
  .nh-rail {
    position: fixed;
    top: var(--bar-h);
    right: 0;
    bottom: 0;
    width: min(400px, 100vw);
    max-height: none;
    border-radius: 0;
    z-index: 50;
    transform: translateX(105%);
    transition: transform 0.22s ease;
    box-shadow: -8px 0 28px rgba(8, 25, 31, 0.18);
  }
  .nh-rail.open { transform: none; }
  .nh-x { display: inline-flex; align-items: center; justify-content: center; }
}

@media (min-width: 1240px) {
  #nh-toggle { display: none; }
}

@media (max-width: 760px) {
  :root { --bar-h: 96px; }
  .nh-bar-row { padding: 0 16px; gap: 10px; min-height: 52px; }
  .nh-crumb, .nh-sep, .nh-ver { display: none; }
  .nh-home img { height: 17px; }
  .nh-people { gap: 0; }
  .nh-av { width: 28px; height: 28px; font-size: 10.5px; margin-left: -4px; }
  .nh-av.you { margin-left: 0; margin-right: 4px; }
  .nh-bar-tools { padding: 0 8px 0 4px; min-height: 44px; gap: 6px; }
  .nh-btn { padding: 0 10px; }
  .nh-layout { padding: 0 0 64px; }
  .nh-main { flex-basis: 100%; }
  .nh-main .sheet { box-shadow: none; }
  .nh-doc .content { padding: 0 18px 40px 18px; overflow-wrap: anywhere; }
  .nh-tab { padding: 0 10px; }
  .nh-doc .cover { padding: 28px 18px 20px; margin-bottom: 24px; }
  .nh-doc .cover img.logo { margin-bottom: 28px; }
  .nh-doc .cover h1, .nh-doc .cover h1.t-long, .nh-doc .cover h1.t-xlong { font-size: 24px; }
  .nh-doc .cover .meta { flex-wrap: wrap; gap: 14px 28px; }
  .nh-doc h2 { font-size: 18px; }
  .nh-rail { width: 100vw; }
  .nh-page { padding: 24px 16px 56px; }
  .nh-page-head h1 { font-size: 24px; }
  .nh-grid { grid-template-columns: 1fr; }
  .nh-login { grid-template-columns: 1fr; }
  .nh-login-side { padding: 28px 20px; gap: 28px; }
  .nh-login-side h1 { font-size: 26px; }
  .nh-login-side small { display: none; }
}

@media (max-width: 520px) {
  .nh-bar-row:first-child .nh-title { display: none; }
  .lbl-wide { display: none; }
  #nh-toggle { padding: 0 8px; gap: 4px; }
}

/* ---------- wide docs (meta.wide: review docs with an issue tracker) ---------- */

/* A4 width suits plans; a doc with a wide issue table gets the room the
   screen has, up to 1200px, keeping the same sheet look. */
.nh-wide .nh-main { flex-basis: 1200px; }
.nh-wide .nh-main .sheet { max-width: 1200px; }

/* ---------- issue tracker (public/doc/tracker.js) ---------- */

.trk-head { display: flex; flex-direction: column; gap: 12px; margin: 0 0 14px; }
.trk-merge { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; min-height: 34px; }
.trk-merge-hint { color: var(--muted); font-size: 12.5px; }
.trk-merged { display: inline-flex; align-items: center; gap: 6px; background: var(--grey); padding: 6px 12px; border-radius: 8px; flex-wrap: wrap; }
.trk-tick {
  width: 18px; height: 18px; border-radius: 50%; background: var(--sel); color: var(--on-sel);
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
}
.trk-undo { color: var(--red-deep); }

.trk-progress { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; }
.trk-n.chk { color: var(--sel); font-weight: 600; }
.trk-meter .chk { background: var(--sel); }
.trk-progress[hidden] { display: none; }
.trk-env { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.trk-env-top { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 12.5px; }
.trk-env-top b { font-size: 12px; letter-spacing: 0.04em; }
.trk-n { color: var(--muted); }
.trk-n.pass { color: var(--green); font-weight: 600; }
.trk-n.fail { color: var(--red-deep); font-weight: 600; }
.trk-meter { display: flex; height: 6px; margin-top: 6px; border-radius: 3px; overflow: hidden; background: var(--grey); }
.trk-meter .pass { background: var(--green); }
.trk-meter .fail { background: var(--red); }

.trk-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.trk-chip {
  font: inherit; font-size: 12.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.trk-chip:hover { border-color: var(--ink-2); color: var(--ink); }
.trk-chip[aria-pressed="true"] { background: var(--sel); border-color: var(--sel); color: var(--on-sel); }
.trk-chip-n { font-size: 11px; opacity: 0.75; }
.trk-chip-seg { padding: 0 3px 0 11px; gap: 2px; cursor: default; }
.trk-chip-seg:hover { border-color: var(--rule); }
.trk-chip-seg.on { border-color: var(--sel); }
.trk-chip-lbl { margin-right: 4px; }
.trk-chip-seg button {
  font: inherit; font-size: 12px; font-weight: 600; border: 0; background: none; color: inherit;
  border-radius: 999px; padding: 3px 8px; cursor: pointer; display: inline-flex; gap: 4px; align-items: center;
}
.trk-chip-seg button:hover { background: var(--grey); }
.trk-chip-seg button[aria-pressed="true"] { background: var(--sel); color: var(--on-sel); }
.trk-sep { width: 1px; height: 20px; background: var(--rule); margin: 0 4px; }
.trk-none { color: var(--muted); text-align: center; font-size: 13px; padding: 14px; margin: 0 0 5mm; background: var(--grey); border-radius: 8px; }
.trk-none[hidden] { display: none; }

/* the Testing column appears once the fixes are merged */
.trk.merged th.trk-test, .trk.merged td.trk-test { display: table-cell; }
.trk-table td.trk-test { white-space: nowrap; width: 1%; }
.tst-row { display: flex; gap: 4px; }
.tst {
  font: inherit; font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
  min-width: 54px; min-height: 30px; padding: 0 6px; border-radius: 6px;
  border: 1px dashed var(--line-strong); background: var(--surface); color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
}
.tst:hover { border-style: solid; border-color: var(--ink-2); color: var(--ink); }
.tst-pass { border: 1px solid var(--green); background: var(--green-tint); color: var(--green); }
.tst-fail { border: 1px solid var(--red); background: var(--red-tint); color: var(--red-deep); }
.tst-pass:hover { border-color: var(--green); color: var(--green); }
.tst-fail:hover { border-color: var(--red-deep); color: var(--red-deep); }
.nh-doc tr.trk-diffrow > td { background: rgba(8, 25, 31, 0.06); }

.trk-pop {
  position: absolute; z-index: 65; width: 320px; max-width: calc(100vw - 16px);
  background: var(--surface); color: var(--ink); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(8, 25, 31, 0.28); padding: 12px;
  display: flex; flex-direction: column; gap: 8px; font-size: 13px;
}
.trk-pop-title b { color: var(--red-deep); }
.trk-pop textarea {
  font: inherit; font-size: 14px; line-height: 1.5; width: 100%; resize: vertical;
  padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; color: var(--ink); background: var(--surface);
}
.trk-pop textarea:focus { outline: none; border-color: var(--sel); box-shadow: var(--focus); }
.trk-pop-row { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.trk-pop-row small { margin-right: auto; color: var(--muted); font-size: 11px; }

/* Checked (ready to merge), every row */
.trk-table th.trk-chk, .trk-table td.trk-chk { width: 1%; white-space: nowrap; text-align: center; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; padding: 4px; border-radius: 6px; }
.chk input { width: 18px; height: 18px; margin: 0; accent-color: var(--sel); cursor: pointer; }
.chk input:focus-visible { outline: none; box-shadow: var(--focus); }
.chk-lbl, .trk .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chk-by { display: block; font-size: 11px; line-height: 1.3; color: var(--muted); max-width: 9em; margin: 0 auto; overflow: hidden; text-overflow: ellipsis; }
.chk-by[hidden], .chk-warn[hidden] { display: none; }
.chk-warn { display: block; font-size: 10.5px; line-height: 1.3; color: var(--amber); font-weight: 600; }

/* line-comment count in the Fix cell */
.trk-lc {
  font: inherit; font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px;
  min-height: 24px; padding: 0 7px 0 5px; margin-right: 1.5mm; vertical-align: middle;
  border: 1px solid var(--sel); border-radius: 999px; background: var(--surface); color: var(--sel); cursor: pointer;
}
.trk-lc svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.trk-lc:hover { background: var(--sel); color: var(--on-sel); }
.trk-lc.done { border-color: var(--rule); color: var(--muted); font-weight: 500; }
.trk-lc.done:hover { background: var(--grey); color: var(--ink); }

/* split view: a commit's diff beside the doc (a full-screen sheet on phones) */
.nh-diff {
  position: fixed; top: var(--bar-h); right: 0; bottom: 0; z-index: 55;
  width: min(820px, 60vw); background: var(--surface);
  box-shadow: -8px 0 28px rgba(8, 25, 31, 0.22);
  display: flex; flex-direction: column; font-size: 14px;
}
.nh-diff[hidden] { display: none; }
.df-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); }
.nh-diff h2.df-title { flex: 1; min-width: 0; margin: 0; padding: 0; border: 0; font-size: 15px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.df-title code, .df-path { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.df-title code { font-size: 13px; background: var(--chip); padding: 1px 6px; border-radius: 4px; }
.df-issue { font-size: 12px; font-weight: 500; color: var(--muted); }
.nh-diff .df-x { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.df-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 14px 16px 48px; }
.df-body:focus { outline: none; }
.df-loading { color: var(--muted); }
.df-commit { margin-bottom: 14px; }
.df-subject { margin: 0 0 6px; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.nh-diff pre.df-msgbody { background: none; padding: 0; border-radius: 0; margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; font-size: 13px; color: var(--ink-2); }
.df-meta, .df-files { margin: 0; font-size: 12px; color: var(--muted); }
.df-files { margin-bottom: 8px; }
.df-file { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 14px; overflow: hidden; }
.nh-diff h3.df-path {
  margin: 0; padding: 8px 10px; font-size: 12.5px; font-weight: 600; background: var(--grey);
  border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px;
}
.df-p { overflow-wrap: anywhere; min-width: 0; }
.df-stat { white-space: nowrap; font-weight: 500; }
.df-stat .add { color: var(--green); }
.df-stat .del { color: var(--red-deep); }
.df-fmeta { margin: 0; padding: 6px 10px; font-size: 12px; color: var(--muted); }
/* Diff lines: old no. | new no. | +/- marker | code (wrapped, so threads and
   the composer sit full width under their line). Every text meets 4.5:1 on its
   background (checked 2026-10-14: code 11.7-16.1, markers 6.9/7.5, line
   numbers 6.8/7.2, hunk header 11.3). */
.df-code { background: var(--surface); color: var(--ink); padding: 2px 0; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; line-height: 1.6; tab-size: 4; }
.df-l { position: relative; display: grid; grid-template-columns: 4.6ch 4.6ch 1.9ch minmax(0, 1fr); }
.df-ln { padding: 0 6px 0 2px; text-align: right; font-size: 11px; color: var(--muted); user-select: none; -webkit-user-select: none; }
.df-mk { text-align: center; font-weight: 700; user-select: none; -webkit-user-select: none; }
.df-tx { padding: 0 10px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.df-l.ctx .df-ln { background: var(--df-ctx-ln); }
.df-l.add { background: var(--df-add); box-shadow: inset 3px 0 0 var(--df-add-bar); }
.df-l.add .df-ln { background: var(--df-add-ln); color: var(--df-ln-ink); }
.df-l.add .df-mk { background: var(--df-add-mk); color: var(--df-add-mk-ink); }
.df-l.add .wd { background: var(--df-add-wd); border-radius: 2px; box-shadow: 0 0 0 1px var(--df-add-wd-line); }
.df-l.del { background: var(--df-del); box-shadow: inset 3px 0 0 var(--df-del-bar); }
.df-l.del .df-ln { background: var(--df-del-ln); color: var(--df-ln-ink); }
.df-l.del .df-mk { background: var(--df-del-mk); color: var(--df-del-mk-ink); }
.df-l.del .wd { background: var(--df-del-wd); border-radius: 2px; box-shadow: 0 0 0 1px var(--df-del-wd-line); }
.df-l.hunk, .df-l.note { display: block; }
.df-l.hunk { background: var(--df-hunk); color: var(--df-hunk-ink); border-top: 1px solid var(--df-hunk-line); border-bottom: 1px solid var(--df-hunk-line); margin: 2px 0; }
.df-l.hunk .df-tx, .df-l.note .df-tx { display: block; padding: 2px 10px; }
.df-l.note { color: var(--muted); font-style: italic; }
.df-l[data-line]:focus-visible { box-shadow: inset 0 0 0 2px var(--sel); border-radius: 0; outline: none; }
.df-l.has-thread .df-ln { font-weight: 700; color: var(--sel); }
.df-hint { color: var(--muted); }

/* the + that starts a line comment: one button, moved to the hovered or focused line */
.df-plus {
  position: absolute; left: 2px; top: 0; z-index: 2; width: 22px; height: 19px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 5px; background: var(--sel); color: var(--on-sel); cursor: pointer;
}
.df-plus[hidden] { display: none; }
.df-plus svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; }
.df-plus:hover { background: var(--red-hover); color: var(--white); }

/* threads under a line */
.df-thread {
  margin: 6px 12px 8px 84px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--surface); font-family: Figtree, "Segoe UI", Arial, sans-serif; font-size: 13px; line-height: 1.5;
  box-shadow: 0 1px 3px rgba(8, 25, 31, 0.08);
}
.df-thread:focus { outline: none; }
.df-thread:focus-visible { box-shadow: var(--focus); }
.df-compose { border-color: var(--sel); box-shadow: 0 0 0 1px var(--sel); }
.df-th-head { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.df-c { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; padding: 4px 0; }
.df-c + .df-c { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.df-c .nh-avatar { width: 26px; height: 26px; font-size: 10px; letter-spacing: 0.02em; }
.df-c-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.df-c-head time { color: var(--muted); font-size: 11.5px; }
.df-c-head .nh-act.del { margin-left: auto; padding: 2px 6px; }
.df-c-body { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
.df-c.deleted .df-c-body { color: var(--muted); font-style: italic; }
.df-th-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.df-th-actions[hidden] { display: none; }
.df-th-res { color: var(--green); font-size: 12px; margin-left: 4px; }
.df-thread.resolved:not(.collapsed) { background: var(--surface-3); }
.df-thread.collapsed { padding: 0; border-style: dashed; box-shadow: none; background: var(--grey); }
.df-th-marker {
  font: inherit; font-size: 12.5px; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px;
  padding: 4px 10px; border: 0; background: none; color: var(--ink-2); cursor: pointer; text-align: left; border-radius: 8px;
}
.df-th-marker:hover { color: var(--ink); background: var(--hover-2); }
.df-th-sum { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.df-th-tick {
  flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: var(--on-green);
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
}
.df-form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.df-compose .df-form { margin-top: 0; }
.df-form textarea {
  font: inherit; font-size: 14px; line-height: 1.5; width: 100%; min-height: 72px; resize: vertical;
  padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; color: var(--ink); background: var(--surface);
}
.df-form textarea:focus { outline: none; border-color: var(--sel); box-shadow: var(--focus); }
.df-form-row { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.df-form-row small { margin-right: auto; color: var(--muted); font-size: 11px; }
.df-flash { animation: df-flash 2.2s ease-out; }
@keyframes df-flash {
  0%, 35% { box-shadow: 0 0 0 3px var(--red); background: var(--flash); }
  100% { box-shadow: 0 1px 3px rgba(8, 25, 31, 0.08); }
}
@media (prefers-reduced-motion: reduce) { .df-flash { animation: none; box-shadow: 0 0 0 3px var(--red); } }
.df-orphans { margin: 0 0 14px; padding: 10px; border: 1px dashed var(--rule); border-radius: 8px; }
.df-orphans[hidden] { display: none; }
.df-orphans .df-thread { margin: 4px 0 10px; }
.df-orph-h { margin: 0 0 4px; font-size: 12.5px; font-weight: 600; }
.df-orph-at { margin: 6px 0 0; font-size: 12px; color: var(--muted); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere; }

.df-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px; background: var(--grey); border-radius: 8px; }
.df-msg p { margin: 0; color: var(--ink-2); }

@media (max-width: 760px) {
  /* phones: plain tables fit the screen (words may break); the tracker table
     keeps its columns and scrolls inside its own box */
  .nh-doc .content table:not(.trk-table) th,
  .nh-doc .content table:not(.trk-table) td { padding: 2.2mm 2mm; overflow-wrap: anywhere; }
  /* the tracker becomes one card per issue: ID, severity, repo on top, then
     the issue, the fix and the test controls, so nothing needs a side scroll */
  .trk-table thead { display: none; }
  .trk-table, .trk-table tbody { display: block; }
  .trk-table tr { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 6px 10px; padding: 12px 8px; border-bottom: 1px solid var(--rule); }
  .trk-table td, .trk-table td.trk-id, .trk-table td.trk-sev, .trk-table td.trk-repo { display: block; width: auto; padding: 0; border: 0; }
  .trk-table td.trk-repo { color: var(--muted); font-size: 12px; text-align: right; }
  .trk-table td.trk-title, .trk-table td.trk-fix { grid-column: 1 / -1; }
  .trk.merged .trk-table td.trk-test { display: block; grid-column: 1 / -1; padding-top: 4px; }
  .trk-table td.trk-fix, .trk-table td.trk-chk { width: auto; }
  .trk-table td.trk-chk { grid-column: 1 / -1; text-align: left; display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; white-space: normal; }
  .chk { min-height: 36px; padding: 4px 8px 4px 2px; }
  .chk input { width: 22px; height: 22px; }
  .chk-lbl { position: static; width: auto; height: auto; overflow: visible; clip: auto; font-size: 13px; font-weight: 500; }
  .chk-by, .chk-warn { margin: 0; max-width: none; font-size: 12px; }
  .chk-by::before { content: "by "; }
  .trk-lc { min-height: 32px; padding: 0 10px 0 8px; }
  .df-l { grid-template-columns: 4ch 4ch 1.7ch minmax(0, 1fr); }
  .df-ln { padding: 0 3px 0 1px; font-size: 10px; }
  .df-tx { padding: 0 6px 0 4px; }
  .df-plus { width: 28px; height: 22px; }
  .df-thread { margin: 6px 6px 8px; }
  .df-form-row small { display: none; }
  .df-hint { display: none; }
  .nh-doc .trk-table tr[data-b].nh-has { box-shadow: inset 3px 0 0 var(--red); }
  .nh-doc .trk-table tr[data-b].nh-has > td:first-child { box-shadow: none; }
  .tst { min-height: 36px; flex: 1; }
  .nh-diff { top: 0; width: 100vw; z-index: 80; box-shadow: none; }
  body.nh-diff-open { overflow: hidden; }
  .trk-progress { grid-auto-flow: row; grid-template-columns: 1fr; gap: 6px; }
  .trk-merge-hint { flex-basis: 100%; }
}

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

/* ---------- backlog (/backlog, public/doc/backlog.js) ---------- */

.nh-backlog { --bar-h: 100px; }
.bl-page { max-width: 1320px; }
.bl-loading { color: var(--muted); }
.bl-dim { color: var(--muted); }

.bl-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.bl-searchbox {
  display: flex; align-items: center; gap: 8px; flex: 0 1 360px; min-height: 38px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
}
.bl-searchbox:focus-within { border-color: var(--sel); box-shadow: var(--focus); }
.bl-searchbox svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.bl-search { font: inherit; font-size: 14px; border: 0; outline: none; background: none; width: 100%; color: var(--ink); min-width: 0; }
.bl-count { margin: 0 0 0 auto; font-size: 13px; color: var(--muted); }
.bl-filters { margin-bottom: 14px; }
.bl-pchip.p1 { box-shadow: inset 3px 0 0 var(--red); }
.bl-pchip.p2 { box-shadow: inset 3px 0 0 var(--pri-2); }
.bl-pchip.p3 { box-shadow: inset 3px 0 0 var(--pri-3); }
.bl-pchip.p4 { box-shadow: inset 3px 0 0 var(--pri-4); }

/* selects that look like pills; native so they work on phones and keyboards */
.bl-sel {
  font: inherit; font-size: 12.5px; font-weight: 500; color: var(--ink); cursor: pointer;
  min-height: 30px; padding: 0 26px 0 10px; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--chev) no-repeat right 7px center / 14px, var(--surface);
  -webkit-appearance: none; appearance: none; max-width: 100%;
}
.bl-sel:hover { border-color: var(--ink-2); }
.bl-sel:focus-visible { outline: none; border-color: var(--sel); box-shadow: var(--focus); }
.bl-sel.big { min-height: 34px; font-size: 13.5px; }
.bl-status { font-weight: 600; }
.bl-status.bs-backlog { background: var(--chev) no-repeat right 7px center / 14px, var(--grey); }
.bl-status.bs-todo { background: var(--chev) no-repeat right 7px center / 14px, var(--todo-bg); border-color: var(--todo-line); }
.bl-status.bs-progress { background: var(--chev) no-repeat right 7px center / 14px, var(--amber-tint); border-color: var(--amber-line); color: var(--amber); }
.bl-status.bs-review { background: var(--chev) no-repeat right 7px center / 14px, var(--purple-tint); border-color: var(--purple-line); color: var(--purple); }
.bl-status.bs-done { background: var(--chev) no-repeat right 7px center / 14px, var(--green-tint); border-color: var(--green-line); color: var(--green); }
.bl-pri {
  padding-left: 24px;
  background: radial-gradient(circle at 13px 50%, var(--dot, var(--pri-4)) 4px, transparent 4.5px) no-repeat, var(--chev) no-repeat right 7px center / 14px, var(--surface);
}
.bl-pri.p1 { --dot: var(--red); font-weight: 600; color: var(--red-deep); }
.bl-pri.p2 { --dot: var(--pri-2); }
.bl-pri.p3 { --dot: var(--pri-3); }
.bl-pri.p4 { --dot: var(--pri-4); color: var(--ink-2); }
.bl-who.none { color: var(--muted); }
.bl-whobox { display: inline-flex; align-items: center; gap: 6px; }
.bl-av { width: 24px; height: 24px; font-size: 10px; letter-spacing: 0.02em; }

.bl-tablewrap-outer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.bl-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bl-table th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.bl-sort { font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; gap: 4px; }
.bl-sort:hover, .bl-sort.on { color: var(--ink); }
.bl-arrow { opacity: 0.6; }
.bl-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.bl-table tbody tr { cursor: pointer; }
.bl-table tbody tr:hover > td { background: var(--hover); }
.bl-table tbody tr.on > td { background: var(--row-on); }
.bl-table tbody tr.on > td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.bl-table tbody tr:last-child > td { border-bottom: 0; }
.bl-table tr.done .bl-open { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.bl-key { white-space: nowrap; width: 1%; font-size: 12.5px; font-weight: 600; }
.bl-key a { color: var(--ink-2); text-decoration: none; }
.bl-title { min-width: 260px; }
.bl-open { color: var(--ink); text-decoration: none; font-weight: 500; line-height: 1.4; }
.bl-open:hover { text-decoration: underline; }
.bl-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.bl-sub:empty { display: none; }
.bl-labels { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.bl-label {
  font: inherit; font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 999px;
  background: var(--chip-soft); color: var(--ink-2); border: 1px solid transparent; cursor: default; line-height: 1.6;
}
button.bl-label { cursor: pointer; }
button.bl-label:hover { border-color: var(--ink-2); }
.bl-label.on { background: var(--sel); color: var(--on-sel); }
.bl-cc, .bl-links { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); }
.bl-cc svg, .bl-links svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.bl-links.merged { color: var(--green); font-weight: 600; }
.bl-merged-n { margin-left: 2px; }
.bl-c-status, .bl-c-pri, .bl-c-who, .bl-c-size, .bl-c-links, .bl-c-upd { white-space: nowrap; width: 1%; }
.bl-c-size, .bl-c-upd { font-size: 12.5px; color: var(--ink-2); }

/* ticket drawer */
.bl-scrim { position: fixed; inset: 0; z-index: 54; background: var(--scrim-1); }
.bl-scrim[hidden] { display: none; }
.bl-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 56; width: min(820px, 100vw);
  background: var(--surface); box-shadow: -8px 0 28px rgba(8, 25, 31, 0.22); display: flex; flex-direction: column;
}
.bl-drawer[hidden] { display: none; }
body.bl-drawer-open { overflow: hidden; }
.bl-d-head { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--line); }
.bl-d-titlebar { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.bl-d-key { flex: 1; min-width: 0; margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-2); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.bl-d-titlebar .bl-d-key { flex: 0 1 auto; }
.bl-ib { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bl-ib svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bl-d-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 24px 56px; }
.bl-d-body:focus { outline: none; }
.bl-d-h { font-size: 21px; line-height: 1.3; font-weight: 700; margin: 0 0 10px; overflow-wrap: anywhere; }
.bl-d-actions { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.bl-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; padding: 14px 16px; background: var(--surface-2); border-radius: var(--radius); margin-bottom: 8px; }
.bl-field { display: grid; grid-template-columns: 82px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 13.5px; min-height: 34px; }
.bl-field-l { font-size: 12px; font-weight: 600; color: var(--muted); }
.bl-field-v { min-width: 0; overflow-wrap: anywhere; }
.bl-src { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.bl-sec { margin-top: 22px; }
.bl-sec-h { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
details.bl-activity summary { cursor: pointer; list-style: revert; }
.bl-activity ul { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--ink-2); }
.bl-activity li { padding: 4px 0; }
.bl-activity time { color: var(--muted); font-size: 12px; }

/* rendered markdown */
.bl-md { font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; }
.bl-md > :first-child { margin-top: 0; }
.bl-md > :last-child { margin-bottom: 0; }
.bl-md h3 { font-size: 15.5px; font-weight: 600; margin: 20px 0 6px; }
.bl-md h4 { font-size: 14.5px; font-weight: 600; margin: 16px 0 4px; }
.bl-md p { margin: 0 0 10px; }
.bl-md ul, .bl-md ol { margin: 0 0 10px; padding-left: 22px; }
.bl-md li { margin: 3px 0; }
.bl-md li > ul, .bl-md li > ol, .bl-md li > pre { margin-top: 6px; }
.bl-md a { color: var(--link); text-underline-offset: 2px; }
.bl-md a:hover { color: var(--red-deep); }
.bl-md code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.86em; background: var(--chip-soft); padding: 1px 5px; border-radius: 4px; }
.bl-md a code { background: var(--link-chip); color: var(--link); }
.bl-md pre.bl-code { margin: 6px 0 12px; padding: 10px 12px; background: var(--navy); color: #e6edf0; border-radius: 8px; overflow-x: auto; font-size: 12.5px; line-height: 1.55; }
.bl-md pre.bl-code code { background: none; padding: 0; color: inherit; font-size: inherit; }
.bl-md blockquote { margin: 0 0 10px; padding: 2px 12px; border-left: 3px solid var(--rule); color: var(--ink-2); }
.bl-md .bl-tablewrap { overflow-x: auto; margin: 0 0 12px; }
.bl-md table { border-collapse: collapse; font-size: 13px; }
.bl-md th, .bl-md td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
.bl-md th { background: var(--surface-2); }
.bl-md-c { font-size: 14px; white-space: normal; }

/* Bitbucket links */
.bl-linklist { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bl-lk { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 2px 4px 2px 2px; }
.bl-lk-main {
  font: inherit; flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 10px; text-align: left;
  background: none; border: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: inherit;
}
button.bl-lk-main:hover { background: var(--hover); }
.bl-lk-main.static { cursor: default; }
.bl-lk-ic { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.bl-lk-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bl-lk-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.bl-lk-title { font-size: 13.5px; overflow-wrap: anywhere; }
.bl-lk-branch { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.bl-state { font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; background: var(--grey); color: var(--ink-2); }
.bl-state.st-open { background: var(--info-tint); color: var(--info-ink); }
.bl-state.st-merged { background: var(--green-tint); color: var(--green); }
.bl-state.st-declined, .bl-state.st-superseded { background: var(--grey); color: var(--muted); text-decoration: line-through; }
.bl-state.st-commit { background: var(--chip); color: var(--ink); }
.bl-addlink { display: flex; gap: 8px; }
.bl-input {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); width: 100%; min-width: 0;
  min-height: 36px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 8px;
}
.bl-input:focus { outline: none; border-color: var(--sel); box-shadow: var(--focus); }
.bl-findrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.bl-findrow small { font-size: 12px; }
.bl-find { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--sel); }
.bl-find svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.bl-found { margin-top: 10px; }
.bl-linked { font-size: 12px; padding: 0 10px; }

.bl-comment { margin-bottom: 4px; }

/* new / edit form */
.bl-form { display: flex; flex-direction: column; gap: 14px; }
.bl-flabel { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.bl-flabel small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.bl-form-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.bl-tabs { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bl-tabset { display: inline-flex; background: var(--grey); border-radius: 8px; padding: 2px; }
.bl-tab { font: inherit; font-size: 12px; font-weight: 600; border: 0; background: none; color: var(--muted); padding: 4px 12px; border-radius: 6px; cursor: pointer; }
.bl-tab.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(8, 25, 31, 0.12); }
.bl-bodyta { min-height: 320px; resize: vertical; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; line-height: 1.55; }
.bl-bodyta[hidden], .bl-preview[hidden] { display: none; }
.bl-preview { min-height: 320px; border: 1px dashed var(--rule); border-radius: 8px; padding: 12px 14px; font-weight: 400; color: var(--ink); }
.bl-form-foot { display: flex; justify-content: flex-end; gap: 8px; }
.nh-err[hidden] { display: none; }

/* read-only diff in the drawer (styles shared with the tracker's panel) */
.bl-diff pre.df-msgbody { background: none; padding: 0; margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; font-size: 13px; color: var(--ink-2); }
.bl-diff h3.df-path {
  margin: 0; padding: 8px 10px; font-size: 12.5px; font-weight: 600; background: var(--grey);
  border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px;
}
.bl-d-key.df-title code { font-size: 13px; }
.df-repo { color: var(--ink); }

@media (max-width: 900px) {
  .bl-c-size, .bl-c-upd, .bl-table th:nth-child(6), .bl-table th:nth-child(8) { display: none; }
}

@media (max-width: 760px) {
  .nh-backlog { --bar-h: 96px; }
  .bl-searchbox { flex-basis: 100%; }
  .bl-count { margin-left: 0; }
  .bl-tablewrap-outer { background: none; border: 0; border-radius: 0; overflow: visible; }
  /* one card per ticket */
  .bl-table thead { display: none; }
  .bl-table, .bl-table tbody { display: block; }
  .bl-table tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 10px; align-items: center;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px;
  }
  .bl-table td { display: block; padding: 0; border: 0; width: auto; min-width: 0; }
  .bl-table td.bl-key { grid-row: 1; grid-column: 1; }
  .bl-table td.bl-c-size { display: none; }
  .bl-table td.bl-c-links { grid-row: 1; grid-column: 2; justify-self: start; }
  .bl-table td.bl-c-upd { display: block; grid-row: 1; grid-column: 3; }
  .bl-table td.bl-title { grid-row: 2; grid-column: 1 / -1; }
  .bl-table td.bl-c-status { grid-row: 3; grid-column: 1; }
  .bl-table td.bl-c-pri { grid-row: 3; grid-column: 2; justify-self: start; }
  .bl-table td.bl-c-who { grid-row: 3; grid-column: 3; justify-self: end; }
  .bl-table tbody tr.on > td:first-child { box-shadow: none; }
  .bl-table tbody tr:hover > td, .bl-table tbody tr.on > td { background: none; }
  .bl-table tbody tr.on { border-color: var(--red); }
  .bl-sel { min-height: 36px; }
  .bl-d-body { padding: 14px 16px 48px; }
  .bl-fields { grid-template-columns: 1fr; padding: 12px; }
  .bl-form-row3 { grid-template-columns: 1fr; }
  .bl-d-h { font-size: 19px; }
  .bl-scrim { display: none; }
}

/* a plan whose review moved to a release checklist (/p/<slug> banner) */
.nh-moved { max-width: 1200px; margin: 16px auto 0; padding: 12px 16px; border-radius: var(--radius); background: var(--amber-tint); border: 1px solid var(--amber-line); color: var(--amber-ink); font-size: 14px; }
.nh-moved a { font-weight: 600; color: var(--ink); }

/* ---------- design comments: mode toggle, tags, images, @mentions ---------- */

.nh-mode { display: inline-flex; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 2px; gap: 2px; }
.nh-mode button {
  font: inherit; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
  min-height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.nh-mode button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nh-mode button:hover { background: var(--grey); color: var(--ink); }
.nh-mode button[aria-pressed="true"] { background: var(--red); color: var(--white); }
.nh-mode button:focus-visible { outline: 2px solid var(--sel); outline-offset: 1px; }

#nh-toggle { position: relative; }
.nh-at {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--purple); color: var(--white); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}

.nh-tag.at { background: var(--purple); color: var(--white); }
.nh-tag.t-bug { background: var(--red-tint); color: var(--red-deep); }
.nh-tag.t-ux { background: var(--info-tint); color: var(--info-ink); }
.nh-tag.t-copy { background: var(--amber-tint); color: var(--amber-ink); }
.nh-tag.t-question { background: var(--purple-tint); color: var(--purple); }

.nh-tagpick, .nh-tagfilter { display: flex; flex-wrap: wrap; gap: 6px; }
.nh-tagfilter { margin-top: 10px; }
.nh-tagpick .nh-tag, .nh-tagfilter .nh-tag {
  margin: 0; border: 1px solid transparent; cursor: pointer; font-family: inherit; padding: 4px 10px; font-size: 10.5px;
}
.nh-tagfilter .nh-tag:not([class*="t-"]) { background: var(--grey); color: var(--ink-2); }
.nh-tagpick .nh-tag[aria-pressed="false"] { opacity: 0.6; }
.nh-tagpick .nh-tag[aria-pressed="true"], .nh-tagfilter .nh-tag[aria-pressed="true"] { border-color: currentColor; opacity: 1; }
.nh-tagfilter .nh-tag[aria-pressed="false"] { opacity: 0.75; }

.nh-mention { background: var(--purple-tint); color: var(--purple); border-radius: 4px; padding: 0 3px; font-weight: 600; }

.nh-imgs { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.nh-img { position: relative; display: block; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--grey); }
.nh-img img { display: block; max-width: 100%; max-height: 140px; object-fit: contain; }
.nh-img.shot { flex-basis: 100%; }
.nh-img.shot img { width: 100%; max-height: 180px; object-fit: cover; object-position: center; }
.nh-img span {
  position: absolute; left: 6px; bottom: 6px; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  background: rgba(8, 25, 31, 0.8); color: #fff; padding: 2px 6px; border-radius: 999px;
}
.nh-img:hover { border-color: var(--ink-2); }

.nh-shotnote { font-size: 12px; color: var(--muted); margin: -4px 0 10px; position: relative; }
.nh-shotnote img { display: block; width: 100%; max-height: 160px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; }
.nh-shotnote span {
  position: absolute; left: 6px; bottom: 6px; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  background: rgba(8, 25, 31, 0.8); color: #fff; padding: 2px 6px; border-radius: 999px;
}

.nh-ta-wrap { position: relative; }
.nh-ta-wrap textarea { width: 100%; box-sizing: border-box; }
.nh-at-menu {
  position: absolute; left: 8px; top: 100%; z-index: 30; margin-top: 2px; min-width: 180px; padding: 4px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 8px 24px rgba(8, 25, 31, 0.18);
}
.nh-at-menu[hidden] { display: none; }
.nh-at-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; font: inherit; font-size: 13px; text-align: left;
  border: 0; background: none; color: var(--ink); padding: 5px 8px; border-radius: 6px; cursor: pointer;
}
.nh-at-menu button[aria-selected="true"], .nh-at-menu button:hover { background: var(--grey); }
.nh-at-menu .nh-avatar { width: 22px; height: 22px; font-size: 9px; }

.nh-thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.nh-thumbs:empty { display: none; }
.nh-thumb { position: relative; width: 64px; height: 48px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--grey); }
.nh-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nh-thumb button {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(8, 25, 31, 0.8); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.nh-thumb button svg { width: 10px; height: 10px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; }
.nh-attach { display: inline-flex; align-items: center; gap: 5px; margin-right: auto; }
.nh-attach svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.nh-attach + small { margin-right: 0; }
.nh-compose.drop { outline: 2px dashed var(--red); outline-offset: 4px; border-radius: 8px; }
.nh-card-at {
  display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 999px; background: var(--purple); color: var(--white);
  font-size: 11px; font-weight: 700; line-height: 18px;
}
