/* ==========================================================================
   vial — terminal/agentic UI, Flexoki palette
   https://stephango.com/flexoki
   ========================================================================== */

/* --- Design tokens: dark (default) --------------------------------------- */
:root {
  /* Neutral ramp (Flexoki black ramp) */
  --bg: #100f0f;
  --bg-2: #1c1b1a;
  --ui: #282726;
  --ui-2: #343331;
  --ui-3: #403e3c;
  --tx-3: #575653; /* faint */
  --tx-2: #878580; /* muted */
  --tx: #cecdc3;

  /* Accents (400-level, tuned for dark) */
  --red: #d14d41;
  --orange: #da702c;
  --yellow: #d0a215;
  --green: #879a39;
  --cyan: #3aa99f;
  --blue: #4385be;
  --purple: #8b7ec8;
  --magenta: #ce5d97;

  /* Code/diff panes stay dark in both themes (syntect base16-ocean.dark) */
  --code-bg: #100f0f;
  --code-fg: #cecdc3;
  --diff-add: rgba(135, 154, 57, 0.16);
  --diff-del: rgba(209, 77, 65, 0.16);

  /* Back-compat aliases (used by older rules) */
  --surface: var(--bg-2);
  --overlay: var(--ui);
  --text: var(--tx);
  --text-muted: var(--tx-2);

  --nav-h: 42px;
  --radius: 2px;
}

/* --- Design tokens: light ------------------------------------------------- */
:root[data-theme='light'] {
  --bg: #fffcf0;
  --bg-2: #f2f0e5;
  --ui: #e6e4d9;
  --ui-2: #dad8ce;
  --ui-3: #cecdc3;
  --tx-3: #b7b5ac;
  --tx-2: #6f6e69;
  --tx: #100f0f;

  /* Accents (600-level, tuned for light) */
  --red: #af3029;
  --orange: #bc5215;
  --yellow: #ad8301;
  --green: #66800b;
  --cyan: #24837b;
  --blue: #205ea6;
  --purple: #5e409d;
  --magenta: #a02f6f;

  /* Code panes follow the theme; syntax colors switch with it (base16-ocean.light) */
  --code-bg: #fffcf0;
  --code-fg: #100f0f;
  --diff-add: rgba(102, 128, 11, 0.14);
  --diff-del: rgba(175, 48, 41, 0.14);
}

/* --- Reset --------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background-color: var(--bg);
  color: var(--tx);
  font-family: ui-monospace, 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 14px;
  line-height: 1.6;
  /* Mobile-only base default: stop iOS/Android from auto-inflating text after
     orientation changes so our explicit sizing is honored. No effect on
     desktop browsers. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* --- Typography ---------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.3;
}

h1 {
  font-size: 1.4rem;
  color: var(--tx);
}

/* `$ ` prompt prefix on top-level page titles */
h1::before {
  content: '$ ';
  color: var(--green);
}

h2 {
  font-size: 1.1rem;
  color: var(--tx);
}

h2::before {
  content: '# ';
  color: var(--tx-3);
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  color: var(--cyan);
}

hr {
  border: none;
  border-top: 1px solid var(--ui);
}

code {
  font-family: inherit;
}

::selection {
  background: var(--blue);
  color: var(--bg);
}

/* --- Form controls ------------------------------------------------------- */
input,
textarea,
select,
button {
  background-color: var(--bg-2);
  border: 1px solid var(--ui-2);
  border-radius: var(--radius);
  color: var(--tx);
  font-family: inherit;
  font-size: inherit;
  padding: 6px 10px;
}

input::placeholder,
textarea::placeholder {
  color: var(--tx-3);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 1px var(--blue);
}

textarea {
  min-height: 90px;
  resize: vertical;
  width: 100%;
}

label {
  color: var(--tx-2);
}

button {
  cursor: pointer;
  color: var(--tx);
  transition:
    background-color 0.1s ease,
    border-color 0.1s ease,
    color 0.1s ease;
}

button:hover {
  background-color: var(--ui);
  border-color: var(--ui-3);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Terminal-style radios and checkboxes ------------------------------------- */
input[type='radio'],
input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  display: inline-grid;
  place-content: center;
  border: 1px solid var(--ui-3);
  background: var(--bg);
  cursor: pointer;
  vertical-align: -2px;
  transition:
    border-color 0.1s ease,
    background-color 0.1s ease;
}

/* Square, sharp-cornered to fit the terminal aesthetic. */
input[type='radio'],
input[type='checkbox'] {
  border-radius: 0;
}

input[type='radio']:hover,
input[type='checkbox']:hover {
  border-color: var(--tx-2);
}

input[type='radio']:checked,
input[type='checkbox']:checked {
  border-color: var(--cyan);
}

/* The indicator is hidden (scaled to 0) until the input is checked. */
input[type='radio']::before,
input[type='checkbox']::before {
  transform: scale(0);
  transition: transform 0.08s ease-in-out;
}

/* Radio: a filled accent square. */
input[type='radio']::before {
  content: '';
  width: 7px;
  height: 7px;
  background: var(--cyan);
}

/* Checkbox: an accent fill with a checkmark glyph in the background color. */
input[type='checkbox']:checked {
  background: var(--cyan);
}

input[type='checkbox']::before {
  content: '\2713';
  color: var(--bg);
  font-size: 11px;
  line-height: 1;
}

input[type='radio']:checked::before,
input[type='checkbox']:checked::before {
  transform: scale(1);
}

input[type='radio']:focus-visible,
input[type='checkbox']:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--cyan) 45%, transparent);
}

/* Terminal-style scrollbars — square, blocky ------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--ui-3) var(--bg-2);
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-2);
}

::-webkit-scrollbar-thumb {
  background: var(--ui-3);
  border: 2px solid var(--bg-2);
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--tx-3);
}

::-webkit-scrollbar-corner {
  background: var(--bg-2);
}

/* Accent button variants (matched against existing class names) */
.delete-btn,
.rv-ann-remove {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 50%, var(--ui-2));
}

.delete-btn:hover,
.rv-ann-remove:hover {
  background: color-mix(in srgb, var(--red) 14%, var(--bg-2));
  border-color: var(--red);
}

.rv-create-btn,
.rv-modal-actions button:first-child,
.rv-popover-actions button:first-child {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 55%, var(--ui-2));
}

.rv-create-btn:hover,
.rv-modal-actions button:first-child:hover,
.rv-popover-actions button:first-child:hover {
  background: color-mix(in srgb, var(--green) 14%, var(--bg-2));
  border-color: var(--green);
}

/* --- Utilities ----------------------------------------------------------- */
.muted {
  color: var(--tx-2);
}

.faint {
  color: var(--tx-3);
}

.error {
  color: var(--red);
}

.warning {
  color: var(--yellow);
}

.error,
.warning {
  padding: 4px 0;
}

/* Bordered panel helper used across pages */
.overlay-border {
  border: 1px solid var(--ui);
  border-radius: var(--radius);
  background: var(--bg-2);
}

.container {
  border: 1px solid var(--ui);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 16px;
}

/* Reusable blinking cursor */
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Top navigation
   ========================================================================== */
.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-2);
  border-bottom: 1px solid var(--ui);
}

.topnav-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  height: var(--nav-h);
}

.topnav-brand {
  color: var(--yellow);
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: baseline;
}

.topnav-brand:hover {
  color: var(--yellow);
}

.topnav-cursor {
  color: var(--green);
  animation: blink 1.1s step-end infinite;
}

.topnav-links {
  display: flex;
  gap: 4px;
  flex: 1;
  flex-wrap: wrap;
}

.topnav-link {
  color: var(--tx-2);
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.topnav-link:hover {
  color: var(--tx);
  background: var(--ui);
}

/* leptos_router marks the active <A> with aria-current */
.topnav-link[aria-current] {
  color: var(--cyan);
  border-color: var(--ui-2);
  background: var(--bg);
}

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topnav-theme,
.topnav-logout {
  padding: 4px 10px;
  font-size: 0.92em;
}

.topnav-theme {
  color: var(--tx-2);
}

.topnav-logout {
  color: var(--red);
  border-color: transparent;
}

.topnav-logout:hover {
  border-color: color-mix(in srgb, var(--red) 50%, var(--ui-2));
  background: color-mix(in srgb, var(--red) 12%, var(--bg-2));
}

/* ==========================================================================
   Page shell
   ========================================================================== */
.page-shell {
  display: block;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

/* Per-repo sub-navigation (graph / files / review / tickets / mrs) */
.repo-subnav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--ui);
  padding-bottom: 8px;
}

.repo-subnav-link {
  color: var(--tx-2);
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.repo-subnav-link:hover {
  color: var(--tx);
  background: var(--ui);
}

.repo-subnav-link[aria-current] {
  color: var(--cyan);
  border-color: var(--ui-2);
  background: var(--bg-2);
}

/* Section title used inside panels */
.panel-title,
.rv-sidebar-title,
.rv-panel-title {
  color: var(--tx);
  font-weight: 600;
  border-bottom: 1px solid var(--ui);
  padding: 8px 12px;
}

.panel-title::before,
.rv-sidebar-title::before,
.rv-panel-title::before {
  content: '// ';
  color: var(--tx-3);
}

/* Shared header rows: title on the left, actions on the right */
.repo-list-header,
.tickets-header,
.mrs-header,
.repo-overview-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.repo-list-header h1,
.tickets-header h1,
.mrs-header h1 {
  flex: 1;
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.form-group-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.form-group label {
  color: var(--tx-2);
  font-size: 0.9em;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.tag-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tag-shortcut {
  font-size: 0.82em;
  padding: 2px 8px;
  border: 1px solid var(--ui);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--tx-2);
  cursor: pointer;
}

.tag-shortcut:hover {
  border-color: var(--tx-3);
  color: var(--tx);
}

.tag-shortcut.active {
  border-color: var(--green);
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, var(--bg-2));
}

/* Tag autocomplete: comma-separated input with a clickable dropdown */
.tag-input-wrapper {
  position: relative;
}

.tag-input-wrapper input {
  width: 100%;
}

.tag-dropdown {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  right: 0;
  margin: 2px 0 0;
  padding: 4px 0;
  list-style: none;
  border: 1px solid var(--ui);
  border-radius: var(--radius);
  background: var(--bg-2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  max-height: 240px;
  overflow-y: auto;
}

.tag-dropdown-item {
  padding: 4px 10px;
  cursor: pointer;
  color: var(--tx);
  font-size: 0.9em;
}

.tag-dropdown-item:hover {
  background: color-mix(in srgb, var(--green) 12%, var(--bg-2));
  color: var(--green);
}

/* New-entity forms (repos, tickets, mrs, tokens, keys) */
.repo-new-form,
.ticket-new-form,
.mr-new-form,
.token-new-form,
.key-new-form {
  border: 1px solid var(--ui);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 16px;
  margin-bottom: 20px;
}

/* Filter bar (tickets / mrs) */
.tickets-filters,
.mrs-filters {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 12px 0;
  margin-bottom: 8px;
  border-top: 1px solid var(--ui);
  border-bottom: 1px solid var(--ui);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
}

/* Pushes a filter group (and those after it) to the right of the bar. */
.filter-right {
  margin-left: auto;
}

.filter-group legend {
  color: var(--tx-3);
  padding-right: 6px;
}

.filter-group label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* ==========================================================================
   Status badges (open / closed / merged / …)
   ========================================================================== */
.status-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius);
  border: 1px solid currentColor;
  font-size: 0.82em;
  text-transform: lowercase;
  letter-spacing: 0.03em;
}

.status-badge::before {
  content: '● ';
  font-size: 0.8em;
}

.status-open {
  color: var(--green);
}

.status-closed {
  color: var(--red);
}

.status-merged {
  color: var(--purple);
}

.status-reviewing {
  color: var(--blue);
}

.status-complete,
.status-done {
  color: var(--green);
}

.status-draft,
.status-decomposing,
.status-pending,
.status-awaiting-review {
  color: var(--yellow);
}

.status-approved {
  color: var(--green);
}

/* ==========================================================================
   Login
   ========================================================================== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-container form {
  width: 100%;
  max-width: 360px;
  border: 1px solid var(--ui);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 28px;
}

.login-container h1 {
  margin-bottom: 20px;
  font-size: 1.5rem;
}

.login-container button[type='submit'] {
  width: 100%;
  margin-top: 8px;
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 55%, var(--ui-2));
}

.login-container button[type='submit']:hover:not(:disabled) {
  background: color-mix(in srgb, var(--green) 14%, var(--bg-2));
  border-color: var(--green);
}

/* ==========================================================================
   Repo list & overview
   ========================================================================== */
.repo-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 8px 4px 8px 18px;
  position: relative;
}

.repo-row::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--tx-3);
}

.repo-row:hover::before {
  color: var(--cyan);
}

.repo-row > a {
  font-weight: 600;
  min-width: 180px;
}

/* Expandable row arrow + preview (repos / tickets / mrs) */
.row-arrow {
  background: none;
  border: none;
  border-radius: 0;
  color: var(--tx-3);
  cursor: pointer;
  padding: 0 4px 0 0;
  line-height: 1;
  align-self: center;
}

.row-arrow:hover {
  color: var(--cyan);
  background: none;
}

/* Rows with a real arrow button drop the static ::before marker and its inset. */
.repo-row:has(.row-arrow),
.ticket-row:has(.row-arrow),
.mr-row:has(.row-arrow) {
  padding-left: 4px;
}

.repo-row:has(.row-arrow)::before,
.ticket-row:has(.row-arrow)::before,
.mr-row:has(.row-arrow)::before {
  content: none;
}

.row-preview {
  margin: 0 0 4px 22px;
  padding: 8px 12px;
  border-left: 2px solid var(--ui-2);
  background: var(--bg-2);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92em;
}

.repo-delete-confirm {
  font-size: 0.9em;
}

.repo-desc {
  flex: 1;
}

/* Right-hand metadata columns: fixed widths + right alignment so the ticket,
   MR, and last-updated values line up vertically down the whole list instead
   of drifting with each row's digit count. */
.repo-tickets,
.repo-mrs {
  font-size: 0.85em;
  white-space: nowrap;
  text-align: right;
  flex: 0 0 auto;
}

.repo-tickets {
  width: 6.5em;
}

.repo-mrs {
  width: 5em;
}

.repo-pushed {
  font-size: 0.88em;
  white-space: nowrap;
  text-align: right;
  flex: 0 0 auto;
  width: 8.5em;
  color: var(--cyan);
}

.repo-overview-header .branch-selector {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Fixed-width branch picker: native selects otherwise grow to fit the longest
   branch name. Pin to a width a bit beyond "main" and ellipsize the rest. */
.branch-selector select {
  width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repo-graph {
  border: 1px solid var(--ui);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 12px;
  overflow-x: auto;
}

/* Graph commit labels use fill="currentColor"; set it to the themed text color */
.git-graph,
.git-graph-svg {
  color: var(--tx);
}

/* Lane SVG + clickable commit rows, aligned by row height */
.gg-graph-row {
  display: flex;
  align-items: flex-start;
}

.gg-lanes {
  flex-shrink: 0;
}

.gg-lanes svg {
  display: block;
}

.gg-commits {
  display: flex;
  flex-direction: column;
}

.gg-commit,
.gg-spacer {
  height: 24px; /* == ROW_H, keeps rows aligned with the lane nodes */
}

.gg-commit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  cursor: pointer;
  white-space: nowrap;
  border-radius: var(--radius);
}

.gg-commit:hover {
  background: var(--ui);
}

.gg-commit.selected {
  background: var(--ui-2);
}

.gg-sha {
  color: var(--blue);
}

.gg-date {
  font-size: 0.88em;
}

/* Flat commit list view */
.commits-page {
  display: flex;
  flex-direction: column;
}

.commits-page > h1 {
  margin-bottom: 16px;
}

.commit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--ui);
  cursor: pointer;
  white-space: nowrap;
}

.commit-row:hover {
  background: var(--ui);
}

.commit-row.selected {
  background: var(--ui-2);
}

.commit-msg {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--tx);
}

.commit-date {
  font-size: 0.88em;
}

.commit-diff {
  margin: 0 0 10px;
}

/* Commit diff panel */
.gg-diff-panel {
  margin-top: 12px;
  border: 1px solid var(--ui);
  border-radius: var(--radius);
}

.gg-diff-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--ui);
  background: var(--bg-2);
}

.gg-diff-title {
  color: var(--tx-2);
}

/* ==========================================================================
   File browser
   ========================================================================== */
.file-browser {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fb-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fb-repo {
  font-weight: 600;
  color: var(--tx);
}

.fb-sep {
  color: var(--tx-3);
}

/* Live indexing-status pill, sitting immediately after the branch selector. */
.index-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 10px;
  border: 1px solid var(--ui-2);
  font-size: 11px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.index-pill-idle {
  color: var(--tx-3);
  background: var(--bg-2);
}

.index-pill-indexing {
  color: var(--yellow);
  background: color-mix(in srgb, var(--yellow) 12%, var(--bg-2));
  border-color: color-mix(in srgb, var(--yellow) 45%, var(--ui-2));
}

/* A soft pulse signals the counter is live without being distracting. */
.index-pill-indexing::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
  animation: index-pill-pulse 1.2s ease-in-out infinite;
}

@keyframes index-pill-pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

/* The error pill is a button: clicking it jumps to the settings indexing log. */
button.index-pill-error {
  cursor: pointer;
  color: var(--red);
  background: color-mix(in srgb, var(--red) 12%, var(--bg-2));
  border-color: color-mix(in srgb, var(--red) 45%, var(--ui-2));
}

button.index-pill-error:hover {
  background: color-mix(in srgb, var(--red) 20%, var(--bg-2));
  border-color: var(--red);
}

.fb-breadcrumb {
  color: var(--tx-2);
}

.fb-crumb-cur {
  color: var(--tx);
}

.fb-main {
  display: flex;
  gap: 0;
  border: 1px solid var(--ui);
  border-radius: var(--radius);
  min-height: 60vh;
}

.fb-sidebar {
  width: 230px;
  flex-shrink: 0;
  padding: 10px;
  overflow-y: auto;
  max-height: 75vh;
  background: var(--bg-2);
}

.fb-divider {
  width: 1px;
  background: var(--ui);
  color: transparent;
  overflow: hidden;
  flex-shrink: 0;
}

.fb-content {
  flex: 1;
  min-width: 0;
  overflow: auto;
  max-height: 75vh;
}

.fb-tree-entry {
  padding: 2px 6px;
  border-radius: var(--radius);
  white-space: nowrap;
}

/* Nerd Font file-type icons rendered as inline SVG */
.file-icon {
  display: inline-flex;
  width: 1.1em;
  height: 1.1em;
  margin-right: 6px;
  vertical-align: -0.18em;
  flex-shrink: 0;
}

.file-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.fb-tree-entry:hover {
  background: var(--ui);
}

.fb-tree-dir > a {
  color: var(--blue);
}

.fb-tree-file {
  cursor: pointer;
  color: var(--tx);
}

.fb-tree-file:hover {
  color: var(--cyan);
}

.fb-loading,
.fb-placeholder {
  display: block;
  padding: 16px;
  color: var(--tx-3);
}

/* Code panes stay dark in both themes (syntect dark highlighting) */
.fb-code,
.rv-code-inner {
  background: var(--code-bg);
  color: var(--code-fg);
}

.fb-code {
  padding: 8px 0;
  min-width: max-content;
}

.code-line {
  display: flex;
  align-items: flex-start;
}

.code-num {
  flex-shrink: 0;
  width: 3.5em;
  padding: 0 12px 0 8px;
  text-align: right;
  color: var(--tx-3);
  user-select: none;
  border-right: 1px solid var(--ui-2);
}

.code-text {
  white-space: pre;
  padding: 0 12px;
  tab-size: 4;
}

/* Clickable identifier spans in the file view. The wrapper sits inside the
   syntect color span, so it inherits the token color and only adds affordance. */
.ident-token {
  cursor: pointer;
  border-radius: 2px;
}

.ident-token:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: underline;
}

/* Transient lookup state and the resolved popover, positioned (fixed) at the
   clicked identifier via inline left/top. */
.symbol-loading,
.symbol-popover {
  position: fixed;
  z-index: 50;
  font-size: 12px;
  background: var(--bg-2);
  color: var(--tx);
  border: 1px solid var(--ui-2);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.symbol-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
}

.symbol-spinner {
  width: 10px;
  height: 10px;
  border: 2px solid var(--ui-2);
  border-top-color: var(--tx);
  border-radius: 50%;
  animation: symbol-spin 0.6s linear infinite;
}

@keyframes symbol-spin {
  to {
    transform: rotate(360deg);
  }
}

.symbol-popover {
  width: 380px;
  max-width: 90vw;
  max-height: 60vh;
  overflow-y: auto;
  padding: 0;
}

.symbol-banner {
  padding: 6px 10px;
  border-bottom: 1px solid var(--ui-2);
  background: var(--bg-3, var(--ui-1));
  color: var(--tx-2);
  font-size: 11px;
  line-height: 1.4;
}

.symbol-popover-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--ui-2);
  position: sticky;
  top: 0;
  background: var(--bg-2);
}

.symbol-popover-name {
  font-weight: 600;
  font-family: var(--font-mono, monospace);
}

.symbol-popover-kind {
  color: var(--tx-3);
  font-size: 11px;
}

.symbol-popover-hint {
  display: block;
  padding: 6px 10px;
  color: var(--tx-3);
}

.symbol-section {
  padding: 6px 0;
  border-bottom: 1px solid var(--ui-2);
}

.symbol-section:last-child {
  border-bottom: none;
}

.symbol-section-title {
  margin: 0;
  padding: 2px 10px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tx-3);
}

.symbol-empty {
  margin: 0;
  padding: 2px 10px 4px;
  color: var(--tx-3);
}

.symbol-loc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.symbol-loc {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 2px;
  padding: 4px 10px;
  border: none;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.symbol-loc:hover,
.symbol-loc-active {
  background: var(--ui-1);
}

.symbol-loc-active {
  outline: 2px solid var(--ac-2, var(--tx));
  outline-offset: -2px;
}

.symbol-popover-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-top: 1px solid var(--ui-2);
  background: var(--bg-2);
  color: var(--tx-3);
  font-size: 11px;
}

.symbol-popover-footer kbd {
  padding: 1px 5px;
  border: 1px solid var(--ui-2);
  border-radius: 3px;
  background: var(--bg-3, var(--ui-1));
  color: var(--tx-2);
  font-family: var(--font-mono, monospace);
  font-size: 10px;
}

.symbol-loc-ref {
  color: var(--ac-2, var(--tx));
}

.symbol-loc-preview {
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--tx-2);
  font-family: var(--font-mono, monospace);
}

/* "Open in panel" affordance at the top of the popover. */
.symbol-open-panel {
  display: block;
  width: 100%;
  padding: 4px 10px;
  border: none;
  border-bottom: 1px solid var(--ui-2);
  background: var(--bg-3, var(--ui-1));
  color: var(--ac-2, var(--tx));
  text-align: right;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.symbol-open-panel:hover {
  text-decoration: underline;
}

/* Persistent right-hand reference panel: a flex column inside `.fb-main`,
   holding the same result set as the popover but surviving later clicks. */
.symbol-panel {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: 75vh;
  overflow-y: auto;
  background: var(--bg-2);
  font-size: 12px;
}

.symbol-panel-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--ui-2);
  background: var(--bg-2);
}

.symbol-panel-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tx-3);
}

.symbol-panel-close {
  border: none;
  background: none;
  color: var(--tx-2);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
}

.symbol-panel-close:hover {
  color: var(--tx);
}

.symbol-panel-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  color: var(--tx-3);
}

/* ==========================================================================
   Revision review (3-column diff/annotation workspace)
   ========================================================================== */
.revision-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rv-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rv-repo {
  font-weight: 600;
}

.rv-label {
  color: var(--tx-2);
}

.rv-header-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.rv-success {
  border: 1px solid color-mix(in srgb, var(--green) 50%, var(--ui));
  background: color-mix(in srgb, var(--green) 12%, var(--bg-2));
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--green);
}

.rv-body {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.rv-sidebar,
.rv-panel {
  width: 260px;
  flex-shrink: 0;
  border: 1px solid var(--ui);
  border-radius: var(--radius);
  background: var(--bg-2);
  max-height: 78vh;
  overflow-y: auto;
}

.rv-center {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--ui);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  position: relative;
  max-height: 78vh;
}

.rv-sidebar-title,
.rv-panel-title {
  position: sticky;
  top: 0;
  background: var(--bg-2);
}

.rv-crumb-cur {
  color: var(--tx-2);
  padding: 0 10px;
  display: inline-block;
}

.rv-crumb-cur {
  color: var(--tx);
}

.rv-crumb-link {
  color: var(--blue);
  cursor: pointer;
}

.rv-crumb-link:hover {
  color: var(--cyan);
}

.rv-tree-entry {
  padding: 2px 10px;
  cursor: pointer;
  white-space: nowrap;
}

.rv-tree-entry:hover {
  background: var(--ui);
}

.rv-tree-dir {
  color: var(--blue);
}

.rv-tree-file {
  color: var(--tx);
}

.rv-tree-file-active {
  background: var(--ui);
  color: var(--cyan);
}

.rv-loading,
.rv-err,
.rv-muted,
.rv-placeholder,
.rv-panel-empty {
  padding: 12px;
  color: var(--tx-3);
}

.rv-err {
  color: var(--red);
}

.rv-file-name {
  padding: 8px 12px;
  border-bottom: 1px solid var(--ui);
  color: var(--tx-2);
  position: sticky;
  top: 0;
  background: var(--bg-2);
}

.rv-code-wrapper {
  flex: 1;
  overflow: auto;
  background: var(--code-bg);
}

.rv-code-inner {
  min-width: max-content;
}

.rv-line {
  display: flex;
  align-items: flex-start;
  white-space: pre;
}

.rv-line:hover {
  background: rgba(255, 255, 255, 0.03);
}

.rv-line-selected {
  background: color-mix(in srgb, var(--blue) 22%, transparent);
}

.rv-gutter {
  flex-shrink: 0;
  width: 48px;
  text-align: right;
  padding: 0 8px;
  user-select: none;
  color: var(--tx-3);
  border-right: 1px solid var(--ui-2);
}

.rv-line-num {
  color: var(--tx-3);
}

.rv-ann-marker {
  color: var(--yellow);
  cursor: default;
}

.rv-line-code {
  padding: 0 12px;
  flex: 1;
}

/* Annotation popover */
.rv-popover {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 320px;
  border: 1px solid var(--ui-3);
  border-radius: var(--radius);
  background: var(--bg-2);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  padding: 12px;
  z-index: 5;
}

.rv-popover-label {
  color: var(--cyan);
  margin-bottom: 6px;
}

.rv-popover-input {
  min-height: 70px;
}

.rv-popover-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Staged annotations panel */
.rv-ann-item {
  margin: 10px;
  padding: 10px;
}

.rv-ann-location code {
  color: var(--cyan);
}

.rv-ann-snippet {
  display: block;
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 4px 6px;
  margin: 6px 0;
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre;
}

.rv-ann-comment {
  color: var(--tx);
  margin-bottom: 8px;
}

/* Modal */
.rv-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}

.rv-modal {
  width: 100%;
  max-width: 520px;
  border: 1px solid var(--ui-3);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.rv-modal-title {
  margin-bottom: 16px;
}

.rv-modal-summary {
  margin: 8px 0;
}

.rv-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ==========================================================================
   Tickets & Merge Requests — list rows
   ========================================================================== */
.ticket-row,
.mr-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 4px 8px 18px;
  position: relative;
  flex-wrap: wrap;
}

.ticket-row::before,
.mr-row::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--tx-3);
}

.ticket-row:hover::before,
.mr-row:hover::before {
  color: var(--cyan);
}

.ticket-number,
.mr-number {
  color: var(--tx-3);
  min-width: 48px;
}

.ticket-title,
.mr-title {
  font-weight: 600;
  /* Let a long title or URL wrap inside its flex slot instead of pushing the
     row's metadata off-screen. */
  overflow-wrap: anywhere;
  min-width: 0;
}

.ticket-repo,
.mr-repo {
  color: var(--tx-2);
  font-size: 0.9em;
}

.mr-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ticket-tags,
.mr-tags {
  display: inline-flex;
  gap: 4px;
}

.ticket-dates,
.mr-date,
.ticket-date {
  font-size: 0.88em;
}

.ticket-assignee {
  color: var(--purple);
}

/* Inline indicator that surfaces, on the detail page, who currently holds
   the claim on an ticket. Paired with the "Unassign" button next to it. */
.claimed-by-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  padding: 1px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--purple);
  color: var(--purple);
  font-size: 0.82em;
  letter-spacing: 0.03em;
}

.claimed-by-chip strong {
  font-weight: 600;
}

.unassign-btn {
  border-color: var(--purple);
  color: var(--purple);
}

/* ==========================================================================
   Plan / north-star page
   ========================================================================== */
.plan-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.plan-header h1 {
  margin: 0 0 0.25em 0;
}

.plan-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  flex-wrap: wrap;
}

.plan-actions {
  display: inline-flex;
  gap: 0.5em;
}

.plan-body {
  padding: 1.25em 1.5em;
  border-radius: var(--radius);
}

.plan-editor {
  width: 100%;
  min-height: 24em;
  font-family: inherit;
  font-size: 0.95em;
  line-height: 1.5;
  background: transparent;
  color: inherit;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  padding: 0.75em;
  resize: vertical;
}

/* --- Rendered markdown (output of crate::markdown::render_markdown) ------- */
.plan-rendered {
  line-height: 1.6;
  color: var(--tx);
}

.plan-rendered > :first-child {
  margin-top: 0;
}

.plan-rendered > :last-child {
  margin-bottom: 0;
}

/* Suppress the global "$ " / "# " prompt prefix that decorates page-level
   h1/h2 — inside the rendered plan, headings come from the user's markdown
   and should print plain. */
.plan-rendered h1::before,
.plan-rendered h2::before {
  content: none;
}

.plan-rendered h1,
.plan-rendered h2,
.plan-rendered h3,
.plan-rendered h4 {
  color: var(--yellow);
  margin: 1.2em 0 0.4em;
}

/* Lists: explicit indent so bullets and numbers sit clearly to the right of
   the surrounding paragraph text, independent of the browser default. */
.plan-rendered ul,
.plan-rendered ol {
  padding-left: 1.75em;
  margin: 0.6em 0;
}

.plan-rendered li {
  margin: 0.15em 0;
}

.plan-rendered p {
  margin: 0.6em 0;
}

/* Inline code: gentle tint that visually separates code from prose, without
   pretending to be a syntax highlighter. */
.plan-rendered code {
  background: var(--ui);
  padding: 1px 4px;
  border-radius: var(--radius);
  font-size: 0.95em;
}

/* Fenced code blocks: full background panel, scroll horizontally when lines
   are wider than the body. */
.plan-rendered pre {
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--ui);
  border-radius: var(--radius);
  padding: 0.6em 0.8em;
  overflow-x: auto;
  margin: 0.8em 0;
}

.plan-rendered pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.plan-rendered blockquote {
  border-left: 3px solid var(--ui);
  margin: 0.6em 0;
  padding: 0.2em 0.8em;
  color: var(--tx-2);
}

.plan-rendered a {
  color: var(--blue);
}

/* Ticket / MR detail */
.ticket-detail-page,
.mr-detail-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ticket-meta {
  display: block;
  padding: 16px;
}

/* Detail header: title/label on the left, action buttons on the right, so the
   box spans the full width of the page. */
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.detail-head-main {
  min-width: 0;
}

.detail-titleline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-titleline .ticket-title,
.detail-titleline .mr-title {
  font-size: 1.3rem;
}

.detail-title-label {
  color: var(--tx-2);
}

.detail-head .ticket-actions,
.detail-head .mr-actions {
  flex-shrink: 0;
}

.ticket-edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-edit-form > input {
  width: 100%;
}

.ticket-body,
.mr-description {
  padding: 12px 0;
  border-top: 1px solid var(--ui);
  margin-top: 12px;
}

/* The body markup wraps text in a <pre> to preserve newlines; without these
   overrides its default `white-space: pre` would prevent any wrapping and a
   long line escapes the card. */
.ticket-body pre {
  margin: 0;
  font-family: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ticket-actions,
.mr-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.mr-actions .close-branch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85em;
  color: var(--tx-2);
  white-space: nowrap;
}

/* Ticket comments — free-form notes; the agent reads them as task context. */
.ticket-comments {
  display: block;
  padding: 16px;
}

.ticket-comments h2 {
  margin-top: 0;
}

.ticket-comments .comment {
  padding: 10px 12px;
  margin: 8px 0;
}

.ticket-comments .comment-head {
  font-size: 0.85em;
  margin-bottom: 4px;
}

.ticket-comments .comment-body pre {
  margin: 0;
  font-family: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.comment-input {
  min-height: 80px;
  resize: vertical;
}

/* Ticket dependencies */
.ticket-deps {
  display: block;
  padding: 16px;
}

.ticket-deps h2 {
  margin-top: 0;
}

.deps-hint {
  font-size: 0.88em;
  margin: 0 0 10px;
}

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

.dep-link {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dep-remove {
  flex-shrink: 0;
  line-height: 1;
  padding: 2px 8px;
}

.dep-add-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.dep-add-form input {
  flex: 1;
  min-width: 0;
}

.dependents-block {
  margin-top: 16px;
  border-top: 1px solid var(--ui);
  padding-top: 12px;
}

.dependents-block h3 {
  margin: 0 0 4px;
}

.mr-branches {
  color: var(--tx-2);
}

.mr-branches code,
.mr-meta code {
  color: var(--cyan);
}

.mr-merged-notice {
  border: 1px solid color-mix(in srgb, var(--purple) 50%, var(--ui));
  background: color-mix(in srgb, var(--purple) 12%, var(--bg-2));
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--purple);
}

.mr-diff-section,
.mr-comments-section,
.revision-comments {
  border-top: 1px solid var(--ui);
  padding-top: 16px;
}

/* Structured per-file diff: one section per changed file */
.diff-file {
  border: 1px solid var(--ui);
  border-radius: var(--radius);
  margin-top: 16px;
  overflow: hidden;
}

.diff-file-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--ui);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.diff-file-chevron {
  flex: none;
  width: 0.7em;
  color: var(--tx-2);
  transition: transform 0.1s ease;
}

.diff-file-chevron::before {
  content: '\25be'; /* ▾ expanded */
}

.diff-file.collapsed .diff-file-chevron {
  transform: rotate(-90deg);
}

/* Hide the hunk body when collapsed; the section (with its id) stays in the
   DOM so the changed-files tree can still scroll to it. */
.diff-file.collapsed .diff-view {
  display: none;
}

.diff-file.collapsed .diff-file-header {
  border-bottom: none;
}

.mr-diff-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.diff-collapse-all {
  margin-left: auto;
  flex: none;
}

.diff-file-path {
  font-family: ui-monospace, 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--tx);
  word-break: break-all;
}

.diff-file-status {
  flex: none;
  padding: 1px 6px;
  border-radius: var(--radius);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bg);
}

.diff-file-status.status-added {
  background: var(--green);
}

.diff-file-status.status-modified {
  background: var(--blue);
}

.diff-file-status.status-deleted {
  background: var(--red);
}

.diff-file-status.status-renamed {
  background: var(--purple);
}

.diff-file-stats {
  margin-left: auto;
  flex: none;
  display: flex;
  gap: 8px;
  font-family: ui-monospace, 'JetBrains Mono', 'Fira Code', monospace;
}

.diff-stat-add {
  color: var(--green);
}

.diff-stat-del {
  color: var(--red);
}

.diff-view {
  background: var(--code-bg);
  color: var(--code-fg);
  overflow-x: auto;
}

.diff-line {
  display: flex;
  width: max-content;
  min-width: 100%;
  box-sizing: border-box;
  font-family: ui-monospace, 'JetBrains Mono', 'Fira Code', monospace;
}

.diff-gutter {
  flex: none;
  width: 3.5em;
  padding: 0 8px;
  text-align: right;
  color: var(--tx-3);
  user-select: none;
  white-space: pre;
}

.diff-marker {
  flex: none;
  width: 1.5em;
  text-align: center;
  color: var(--tx-2);
  user-select: none;
  white-space: pre;
}

.diff-content {
  flex: 1;
  padding-right: 12px;
  white-space: pre;
}

.diff-line-add {
  background: var(--diff-add);
}

.diff-line-add .diff-marker {
  color: var(--green);
}

.diff-line-remove {
  background: var(--diff-del);
}

.diff-line-remove .diff-marker {
  color: var(--red);
}

.diff-line-context {
  background: transparent;
}

.diff-line-binary {
  padding: 8px 12px;
  color: var(--tx-2);
}

.diff-line-binary .diff-content {
  white-space: normal;
}

/* Changed-files tree sidebar beside the diff column ----------------------- */
.mr-diff-layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 12px;
}

.mr-diff-sidebar {
  flex: none;
  width: 260px;
  position: sticky;
  top: 12px;
  align-self: flex-start;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  border: 1px solid var(--ui);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 8px 0;
}

.mr-diff-main {
  flex: 1;
  min-width: 0;
}

/* The first diff-file section sits flush against the sticky sidebar top. */
.mr-diff-main > .diff-file:first-child {
  margin-top: 0;
}

.diff-tree {
  font-size: 13px;
}

.diff-tree-dir-header,
.diff-tree-file {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 2px;
  padding-bottom: 2px;
  padding-right: 8px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.diff-tree-dir-header:hover,
.diff-tree-file:hover {
  background: var(--ui);
}

.diff-tree-chevron {
  flex: none;
  width: 0.8em;
  color: var(--tx-2);
  transition: transform 0.1s ease;
}

.diff-tree-chevron::before {
  content: '\25be'; /* ▾ expanded */
}

.diff-tree-chevron.collapsed {
  transform: rotate(-90deg);
}

.diff-tree-children.collapsed {
  display: none;
}

.diff-tree-dir-name {
  color: var(--blue);
}

.diff-tree-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--tx);
}

.diff-tree-file:hover .diff-tree-name {
  color: var(--cyan);
}

.diff-tree-status {
  flex: none;
  width: 1.3em;
  text-align: center;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  color: var(--bg);
}

.diff-tree-status.status-added {
  background: var(--green);
}

.diff-tree-status.status-modified {
  background: var(--blue);
}

.diff-tree-status.status-deleted {
  background: var(--red);
}

.diff-tree-status.status-renamed {
  background: var(--purple);
}

.diff-tree-stats {
  flex: none;
  display: flex;
  gap: 6px;
  font-family: ui-monospace, 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 11px;
}

/* Comments (MR + revision) */
.mr-comment,
.rev-comment {
  border: 1px solid var(--ui);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 12px;
  margin-bottom: 12px;
}

.mr-comment-header {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 6px;
}

.mr-comment-author {
  color: var(--cyan);
  font-weight: 600;
}

.mr-comment-date,
.rev-comment-meta {
  color: var(--tx-3);
  font-size: 0.85em;
}

.mr-comment-body {
  word-break: break-word;
}

.mr-comment-form {
  margin-top: 12px;
}

.rev-comment-location code {
  color: var(--cyan);
}

.rev-selected {
  display: block;
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 6px 8px;
  margin: 6px 0;
  border-radius: var(--radius);
  white-space: pre;
  overflow-x: auto;
}

.rev-comment-text {
  white-space: pre-wrap;
}

.revision-ticket-badge {
  color: var(--red);
}

/* Author identity on a discussion message */
.mr-comment-kind {
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: var(--radius);
  border: 1px solid currentColor;
}

.kind-operator {
  color: var(--blue);
}

.kind-review-agent {
  color: var(--purple);
}

.kind-system {
  color: var(--tx-2);
}

/* Tint the left edge of a message by who authored it */
.mr-comment-operator {
  border-left: 3px solid var(--blue);
}

.mr-comment-review-agent {
  border-left: 3px solid var(--purple);
}

.mr-comment-system {
  border-left: 3px solid var(--tx-3);
}

/* ==========================================================================
   MR review (risk verdict + approve / request-changes)
   ========================================================================== */
.mr-risk {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.mr-risk-label {
  color: var(--tx-2);
  font-weight: 600;
}

.risk-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius);
  border: 1px solid currentColor;
  font-size: 0.82em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.risk-low {
  color: var(--green);
}

.risk-medium {
  color: var(--orange);
}

.risk-high {
  color: var(--red);
}

.mr-risk-rationale {
  flex-basis: 100%;
  margin: 4px 0 0;
  color: var(--tx-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.mr-review-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.approve-btn {
  color: var(--green);
  border-color: var(--green);
}

.request-changes-btn {
  color: var(--orange);
  border-color: var(--orange);
}

.mr-request-changes-form {
  margin-top: 10px;
}

.mr-request-changes-form textarea {
  width: 100%;
  min-height: 80px;
}

/* ==========================================================================
   Tags
   ========================================================================== */
.tag-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Two-tone pill: the outer .tag clips the inner halves to the rounded
   silhouette; .tag-cat (category, base accent) and .tag-sub (subcategory,
   pastel of the same hue) abut directly — the colour transition is the
   divider in place of a literal ":". */
.tag {
  display: inline-flex;
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.82em;
  line-height: 1.5;
  white-space: nowrap;
}

.tag > .tag-cat,
.tag > .tag-sub {
  padding: 0 6px;
}

/* ==========================================================================
   Settings
   ========================================================================== */
.settings-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-page > h1 {
  margin-bottom: 4px;
}

.settings-panel {
  padding: 0;
  overflow: hidden;
}

.settings-panel .panel-title {
  background: var(--bg);
}

.settings-panel > *:not(.panel-title):not(form) {
  margin-left: 16px;
  margin-right: 16px;
}

.settings-panel > .form,
.settings-panel form {
  padding: 0 16px 16px;
  margin-left: 0;
  margin-right: 0;
}

/* A trailing bare action row (e.g. "Save Skip List") would otherwise sit flush
   against the panel's bottom border, since only forms carry bottom padding. */
.settings-panel > .form-actions {
  margin-bottom: 16px;
}

.token-row,
.key-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ui);
  flex-wrap: wrap;
}

.token-name,
.key-name {
  font-weight: 600;
  min-width: 120px;
}

.token-meta,
.key-meta {
  flex: 1;
  font-size: 0.85em;
}

.key-pubkey {
  color: var(--tx-2);
  font-size: 0.85em;
}

.skip-pattern-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--ui);
}

.skip-pattern {
  flex: 1;
  color: var(--tx-2);
  font-size: 0.9em;
}

/* Keep every Remove button on the right edge regardless of pattern length. */
.skip-pattern-row .delete-btn {
  margin-left: auto;
  flex: 0 0 auto;
}

.new-token-banner {
  padding: 14px;
  margin: 14px 16px;
  border-color: color-mix(in srgb, var(--green) 50%, var(--ui));
}

.token-display {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

.token-value {
  flex: 1;
  background: var(--code-bg);
  color: var(--green);
  padding: 6px 10px;
  border-radius: var(--radius);
  word-break: break-all;
}

/* ==========================================================================
   Repo settings
   ========================================================================== */
.repo-settings {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.repo-settings-header h1 {
  margin-bottom: 4px;
}

.repo-settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 560px;
}

.repo-settings-field label {
  color: var(--tx-2);
  font-size: 0.9em;
}

.repo-settings-input {
  width: 100%;
}

.repo-settings-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.share-link-new .save-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.repo-settings-danger {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid color-mix(in srgb, var(--red) 40%, var(--ui-2));
}

.repo-settings-shares {
  max-width: 720px;
}

.share-link-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid var(--ui);
}

.share-link-row.expired {
  opacity: 0.6;
}

.share-link-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-link-expired-tag {
  color: var(--red);
  font-size: 0.8em;
  border: 1px solid color-mix(in srgb, var(--red) 40%, var(--ui-2));
  border-radius: var(--radius);
  padding: 0 6px;
}

.share-link-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-link-url {
  flex: 1;
  background: var(--code-bg);
  padding: 6px 10px;
  border-radius: var(--radius);
  word-break: break-all;
}

/* ==========================================================================
   Activity heatmap
   ========================================================================== */
.activity-heatmap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hm-range-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hm-range-btn {
  background: var(--bg-2);
  border: 1px solid var(--ui-2);
  color: var(--tx-2);
  padding: 2px 10px;
  font: inherit;
  font-size: 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.hm-range-btn:hover {
  color: var(--tx);
  border-color: var(--ui-3);
}

.hm-range-btn.active {
  background: color-mix(in srgb, var(--green) 18%, var(--bg-2));
  border-color: color-mix(in srgb, var(--green) 55%, var(--ui-2));
  color: var(--green);
}

.hm-grid {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.hm-wdays {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 0;
  flex: 0 0 auto;
}

.hm-wday {
  font-size: 0.7rem;
  color: var(--tx-3);
  height: 11px;
  line-height: 11px;
}

.hm-weeks {
  display: flex;
  gap: 3px;
}

.hm-week {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hm-cell {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  flex: 0 0 11px;
}

.hm-cell-day {
  cursor: default;
}

.hm-cell-empty {
  background: transparent;
}

.hm-cell-loading {
  background: var(--ui-2);
}

.hm-grid-wrap {
  position: relative;
}

.hm-grid-empty {
  opacity: 0.55;
}

.hm-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  margin: 0;
  font-size: 0.85rem;
}

.activity-section {
  margin-bottom: 24px;
}

.stats-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  width: 100%;
}

.stats-tile {
  background: var(--bg-2);
  border: 1px solid var(--ui-2);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.stats-tile-value {
  color: var(--tx);
  font-size: 1.6rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.stats-tile-label {
  color: var(--tx-2);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.activity-section-error {
  font-size: 0.9rem;
  margin: 4px 0;
}

/* ==========================================================================
   Stats time-series chart
   ========================================================================== */
.stats-timeseries {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.ts-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ts-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--ui-2);
  color: var(--tx-2);
  padding: 2px 10px;
  font: inherit;
  font-size: 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.ts-legend-item:hover {
  color: var(--tx);
  border-color: var(--ui-3);
}

.ts-legend-hidden {
  opacity: 0.45;
}

.ts-legend-hidden .ts-legend-label {
  text-decoration: line-through;
}

.ts-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: 0 0 auto;
}

.ts-chart {
  width: 100%;
  height: auto;
  display: block;
  max-height: 320px;
}

.ts-tick-label {
  fill: var(--tx-3);
  font-size: 10px;
  font-family: inherit;
}

.ts-dot {
  cursor: default;
}

/* Shared empty-state for SVG chart panels — see chart::empty_state. The
   zeroed gridline scaffold sits dimmed behind a centred overlay message
   so a windowed section keeps its shape instead of collapsing. */
.chart-empty {
  position: relative;
}

.chart-empty-plot {
  width: 100%;
  height: auto;
  display: block;
  max-height: 320px;
  opacity: 0.55;
}

.chart-tick-label {
  fill: var(--tx-3);
  font-size: 10px;
  font-family: inherit;
}

.chart-empty-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  margin: 0;
  font-size: 0.9rem;
}

/* ==========================================================================
   Stats repo leaderboard
   ========================================================================== */
.leaderboard {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--ui-2);
  border-radius: var(--radius);
  overflow: hidden;
}

.leaderboard thead {
  background: var(--bg-2);
}

.leaderboard-th {
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--tx-2);
  padding: 0;
  border-bottom: 1px solid var(--ui-2);
}

.leaderboard-th-numeric {
  text-align: right;
}

.leaderboard-th-active {
  color: var(--tx);
}

.leaderboard-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 8px 12px;
  cursor: pointer;
  text-align: inherit;
}

.leaderboard-th-numeric .leaderboard-sort {
  justify-content: flex-end;
}

.leaderboard-sort:hover {
  color: var(--tx);
}

.leaderboard-arrow {
  font-size: 0.7rem;
  color: var(--tx-3);
}

.leaderboard-th-active .leaderboard-arrow {
  color: var(--tx);
}

.leaderboard-row td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--ui-2);
  color: var(--tx);
}

.leaderboard-row:last-child td {
  border-bottom: 0;
}

.leaderboard-row:nth-child(even) td {
  background: var(--bg-2);
}

.leaderboard-td-repo a {
  color: var(--tx);
  text-decoration: none;
}

.leaderboard-td-repo a:hover {
  text-decoration: underline;
}

.leaderboard-td-numeric {
  text-align: right;
}

.leaderboard-td-total {
  font-weight: 600;
}

.leaderboard-empty {
  text-align: center;
  color: var(--tx-3);
  padding: 16px 12px;
}

/* ==========================================================================
   Stats code volume + language breakdown
   ========================================================================== */
.stats-code-volume {
  display: flex;
  flex-direction: row;
  gap: 24px;
  width: 100%;
  align-items: stretch;
}

.scv-sub {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scv-heading {
  margin: 0;
  font-size: 0.95rem;
  color: var(--tx-2);
  font-weight: 600;
}

.scv-chart {
  width: 100%;
  height: auto;
  display: block;
  max-height: 320px;
}

.scv-tick-label {
  fill: var(--tx-3);
  font-size: 10px;
  font-family: inherit;
}

.scv-bar-hit {
  cursor: default;
}

.scv-bar-hit:hover ~ .scv-bar-segment,
.scv-bar:hover .scv-bar-segment {
  filter: brightness(1.1);
}

.scv-lang-bar {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--ui-2);
}

.scv-lang-segment {
  display: block;
  height: 100%;
  min-width: 0;
}

.scv-lang-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scv-lang-row {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--tx-2);
  font-variant-numeric: tabular-nums;
}

.scv-lang-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
}

.scv-lang-name {
  color: var(--tx);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scv-lang-bytes {
  color: var(--tx-3);
}

.scv-lang-pct {
  color: var(--tx);
}

/* ==========================================================================
   Stats workflow metrics
   ========================================================================== */
.stats-workflow {
  /* Re-use the `stats-totals` grid layout so the workflow tiles line
     up with the totals tiles above them. Defined here as a no-op
     selector so future workflow-specific tweaks have a home. */
}

.sw-oldest-tile .stats-tile-label {
  order: -1;
}

.sw-oldest-title {
  color: var(--tx);
  font-size: 1rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sw-oldest-title a {
  color: inherit;
  text-decoration: none;
}

.sw-oldest-title a:hover {
  text-decoration: underline;
}

.sw-oldest-age {
  color: var(--tx-2);
  font-size: 0.85rem;
}

/* ==========================================================================
   Stats tag distribution
   ========================================================================== */
.stats-tags-wrap {
  width: 100%;
}

.stats-tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.st-row {
  display: grid;
  grid-template-columns: minmax(80px, 22%) 1fr auto;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--tx);
  font-variant-numeric: tabular-nums;
}

.st-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--tx);
}

.st-bar-track {
  display: block;
  width: 100%;
  height: 10px;
  border-radius: var(--radius);
  background: var(--ui-2);
  overflow: hidden;
}

.st-bar-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius);
}

.st-meta {
  color: var(--tx-2);
  font-size: 0.85rem;
  white-space: nowrap;
}

.st-empty {
  margin: 4px 0;
  font-size: 0.9rem;
}

/* ==========================================================================
   Stats punch card
   ========================================================================== */
.punch-card-wrap {
  width: 100%;
  overflow-x: auto;
}

.punch-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 480px;
}

.pc-header,
.pc-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pc-day,
.pc-day-spacer {
  flex: 0 0 36px;
  font-size: 0.8rem;
  color: var(--tx-2);
  text-align: right;
}

.pc-day-spacer {
  visibility: hidden;
}

.pc-cells {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
}

.pc-hour {
  font-size: 0.7rem;
  color: var(--tx-3);
  text-align: center;
  line-height: 1;
  min-height: 12px;
}

.pc-cell {
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: 2px;
  background: var(--ui-2);
}

/* ==========================================================================
   Stats dashboard composition
   ========================================================================== */
.stats-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stats-page-header h1 {
  margin: 0;
}

.stats-dashboard {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.stats-range-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stats-range-btn {
  background: var(--bg-2);
  border: 1px solid var(--ui-2);
  color: var(--tx-2);
  padding: 2px 10px;
  font: inherit;
  font-size: 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.stats-range-btn:hover {
  color: var(--tx);
  border-color: var(--ui-3);
}

.stats-range-btn.active {
  color: var(--tx);
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, var(--bg-2));
}

.stats-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.stats-section-heading {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--tx-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stats-section-skeleton {
  width: 100%;
  background: var(--ui-2);
  border-radius: var(--radius);
  opacity: 0.6;
}

.stats-dashboard-error {
  font-size: 0.9rem;
  margin: 4px 0;
}

.stats-computing {
  font-size: 0.9rem;
  margin: 4px 0;
}

.scv-lang-error {
  font-size: 0.85rem;
  margin: 4px 0;
}

.repo-stats-section {
  margin-bottom: 24px;
}

/* ==========================================================================
   Responsive — mobile scaffolding

   Breakpoint convention
   ---------------------
   vial uses a single mobile breakpoint at 820px. Widths below it are treated
   as "mobile"; at or above it the desktop layout is left exactly as designed.
   Every responsive rule lives behind `@media (max-width: 820px)`, so the
   desktop presentation is never altered.

   Follow-up mobile fixes (e.g. the top-nav overflow and the home-page repo
   table) belong in this section — add to it rather than introducing new
   breakpoints, so the convention stays in one place.
   ========================================================================== */
@media (max-width: 820px) {
  /* --- Base mobile defaults --------------------------------------------- */
  /* Replaceable embeds must never force horizontal scrolling on small
     screens; shrink them to the available width and preserve aspect ratio. */
  img,
  svg,
  video,
  canvas {
    max-width: 100%;
    height: auto;
  }

  /* Reclaim the desktop page gutters so content uses the device width. */
  .page-shell {
    padding: 20px 12px 56px;
  }

  /* Tighter box padding to match the reduced page gutters. */
  .container {
    padding: 12px;
  }

  /* --- Component overrides ---------------------------------------------- */
  /* The desktop top nav packs the brand, five "~/section" links, and the
     theme/logout actions into one fixed-height row that is far wider than a
     phone viewport. Let the bar wrap and grow vertically: keep the brand and
     actions on the first row, drop the section links onto their own full-width
     row below, and tighten spacing so every link stays reachable and tappable. */
  .topnav-inner {
    flex-wrap: wrap;
    height: auto;
    gap: 6px 10px;
    padding: 8px 12px;
  }

  .topnav-actions {
    margin-left: auto;
  }

  .topnav-links {
    order: 1;
    flex: 1 0 100%;
    gap: 4px 6px;
  }

  .topnav-link {
    padding: 6px 8px;
  }

  .stats-code-volume {
    flex-direction: column;
  }

  .rv-body {
    flex-direction: column;
  }

  .rv-sidebar,
  .rv-panel,
  .fb-sidebar,
  .symbol-panel {
    width: 100%;
    max-height: 320px;
  }

  .fb-main {
    flex-direction: column;
  }

  .fb-divider {
    width: 100%;
    height: 1px;
  }

  /* Stack the changed-files tree above the diff column on narrow screens. */
  .mr-diff-layout {
    flex-direction: column;
  }

  .mr-diff-sidebar {
    width: 100%;
    position: static;
    max-height: 320px;
  }

  /* Home page repo list -------------------------------------------------- */
  /* The desktop repo row aligns items to the text baseline and reserves a
     wide (180px) column for the repo name, alongside a description and a
     created date. On a phone that combined width overflows, and the baseline
     alignment leaves the name visually off-centre in its row. Center the row
     items vertically, drop the name's wide min-width, tighten the gap, and
     hide the least-important counts and last-commit columns so the name and
     description fit a ~375px screen without horizontal scrolling. */
  .repo-row {
    align-items: center;
    gap: 8px;
  }

  .repo-row > a {
    min-width: 0;
  }

  .repo-tickets,
  .repo-mrs,
  .repo-pushed {
    display: none;
  }
}

/* ==========================================================================
   Assay map view
   ========================================================================== */
.assay-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.assay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  flex-wrap: wrap;
}

.assay-titleline {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  flex-wrap: wrap;
}

/* "clear" vs "charting" pill — mirrors .status-badge, tinted by state. */
.assay-clear-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius);
  border: 1px solid currentColor;
  font-size: 0.82em;
  text-transform: lowercase;
  letter-spacing: 0.03em;
  color: var(--yellow);
}

.assay-clear-badge.is-clear {
  color: var(--green);
}

.assay-file-form {
  display: flex;
  flex-direction: column;
  gap: 0.75em;
  padding: 1.25em 1.5em;
  border-radius: var(--radius);
}

.assay-prose {
  padding: 1.25em 1.5em;
  border-radius: var(--radius);
}

.assay-section {
  padding: 1em 1.5em 1.25em;
  border-radius: var(--radius);
}

.assay-section h2 {
  margin: 0 0 0.25em 0;
}

.assay-child-row,
.assay-decision-head {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.35em 0;
}

.assay-decision-row {
  padding: 0.35em 0;
}

.assay-decision-gist {
  padding-left: 1.5em;
  font-size: 0.9em;
}

/* Sub-ticket kind chip, tinted per assay kind. */
.assay-kind-chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--radius);
  border: 1px solid currentColor;
  font-size: 0.78em;
  letter-spacing: 0.03em;
  color: var(--tx-2);
}

.assay-kind-chip.kind-research {
  color: var(--blue);
}

.assay-kind-chip.kind-probe {
  color: var(--purple);
}

.assay-kind-chip.kind-grill {
  color: var(--yellow);
}

.assay-kind-chip.kind-task {
  color: var(--green);
}

/* Link from an assay-map ticket detail to its computed map view. */
.assay-map-link {
  display: inline-block;
  margin: 0.5em 0;
  color: var(--blue);
}

/* Per-repo assay list (`/repos/:name/assays`): plain list of `.repo-row`s. */
.assay-list {
  list-style: none;
  margin: 1em 0 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}
