:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --surface-alt: #f1f3f5;
  --text: #1d2125;
  --text-muted: #5e6c84;
  --border: #dfe1e6;
  --accent: #0052cc;
  --accent-soft: #deebff;
  --danger: #de350b;
  --success: #00875a;
  --warning: #ff8b00;
  --shadow: 0 1px 2px rgba(9, 30, 66, 0.08);
  --radius: 6px;
  --radius-lg: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-alt: #1c232c;
    --text: #c9d1d9;
    --text-muted: #8b949e;
    --border: #30363d;
    --accent: #4c9aff;
    --accent-soft: rgba(76, 154, 255, 0.15);
    --danger: #ff5630;
    --success: #36b37e;
    --warning: #ffab00;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Top bar --- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius);
}
.brand:hover { background: var(--surface-alt); text-decoration: none; }
.brand .logo { font-size: 18px; }
.brand-name { font-size: 15px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav a:hover { background: var(--surface-alt); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.poll-status { color: var(--text-muted); font-size: 12px; min-width: 110px; text-align: right; }

/* --- Profile button + popover --- */
.profile-btn {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  position: relative;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.profile-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-btn:hover .profile-avatar { border-color: var(--accent); }
/* When the user is viewing as someone else, badge the avatar so they don't
   forget they're impersonating. */
.profile-btn.is-impersonating::after {
  content: '👤';
  position: absolute;
  bottom: -2px;
  right: -4px;
  background: var(--warning);
  color: white;
  font-size: 10px;
  border-radius: 999px;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid var(--surface);
}
.profile-popover {
  min-width: 240px;
  padding: 8px;
}
.profile-popover-identity {
  padding: 6px 8px 10px;
}
.profile-popover-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.profile-popover-email {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  word-break: break-all;
}
.profile-popover-viewas {
  margin-top: 6px;
  font-size: 12px;
  color: var(--warning);
}
.profile-popover .popover-item {
  padding: 8px 10px;
  text-decoration: none;
  color: var(--text);
}
.profile-popover .popover-item:hover { text-decoration: none; }

.popover {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(9, 30, 66, 0.18);
  z-index: 100;
  min-width: 220px;
  max-width: 320px;
  padding: 4px;
}
.popover-section { display: flex; flex-direction: column; }
.popover-section-scroll { max-height: 320px; overflow-y: auto; }
.popover-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.popover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  width: 100%;
}
.popover-item:hover { background: var(--surface-alt); }
.popover-item.selected {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.popover-item-tag {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--surface-alt);
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.popover-item.selected .popover-item-tag {
  background: rgba(255, 255, 255, 0.4);
  color: var(--accent);
}
.badge {
  background: var(--accent);
  color: white;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
  font-weight: 600;
}
.ghost-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: var(--radius);
}
.ghost-btn:hover { background: var(--surface-alt); color: var(--text); }
.ghost-btn.active { color: var(--accent); }

/* --- View container --- */
.view {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
}
.view h1 { font-size: 20px; margin: 0; }
.view h2 { font-size: 16px; margin: 18px 0 8px; }

/* --- View header (title + actions) --- */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  min-height: 32px;
}
.view-header h1 { line-height: 1.2; }
.view-actions { display: flex; gap: 8px; align-items: center; }

/* --- Filter bar (chips + search) --- */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 18px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.filter-bar:last-of-type { margin-bottom: 18px; }
.filter-bar > .chips { margin-bottom: 0; }
.filter-bar > .search-input { flex: 0 1 280px; }

/* Group each cluster of related controls (chips + their dimension label,
   or the search input on its own) inside a `.filter-group`. The
   uppercase `.filter-group-label` tells the user what dimension that
   particular cluster of buttons adjusts ("Show", "Time", …) so a busy
   row of chips doesn't read as one undifferentiated mass. Used by the
   Issues and Kanban views' top filter bar. */
.filter-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px;
  background: var(--surface-alt);
  border-radius: 999px;
  border: 1px solid var(--border);
}
.filter-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  user-select: none;
  white-space: nowrap;
}
.filter-group > .chips { margin-bottom: 0; gap: 6px; }
/* The search wrapper sits flush-right and drops the pill chrome so the
   input renders as its usual standalone field. */
.filter-group-search {
  margin-left: auto;
  background: transparent;
  border: 0;
  padding: 0;
  flex: 0 1 320px;
}
.filter-group-search .search-input { flex: 1; }

/* --- Alerts: three-card control panel --- */
/* SHOW | TIME | SEARCH & VIEW. Each card is a `<fieldset>` (semantic
   grouping for related radio-style controls) with an uppercase
   `<legend>` so the dimension the controls adjust is unambiguous before
   the eye reaches the options. Cards stack vertically on narrow
   viewports via `auto-fit` minmax. */
.alerts-controls {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(240px, 1.8fr);
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 720px) {
  .alerts-controls { grid-template-columns: 1fr; }
}
.filter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px 14px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.filter-card-legend {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin: 0;
  padding: 0;
}
.filter-card-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Vertical chip — table-style row inside a filter-card. Label left,
   count right. The active state is a tinted background, not a heavy
   border, so the card doesn't feel cluttered. */
.vchip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.vchip:hover { background: var(--surface-alt); }
.vchip.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent);
  font-weight: 600;
}
.vchip-count {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
}
.vchip.active .vchip-count { color: var(--accent); }

/* Search + view card lays its children top-to-bottom; the search input
   sits at the top with a leading icon, the group-by-issue toggle drops
   beneath with breathing room. */
.filter-card-search { gap: 14px; }
.filter-card-search-input {
  position: relative;
  display: flex;
  align-items: center;
}
.filter-card-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.filter-card-search .search-input {
  flex: 1;
  width: 100%;
  padding-left: 36px;
}

/* iOS-style toggle switch. Sits on a single row: label on the right of
   the track, click-target spans both so the whole row is tappable. */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}
.toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  pointer-events: none;
}
.toggle-track {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.18s ease;
  flex-shrink: 0;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); }
.toggle-switch input:focus-visible + .toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.toggle-label { font-size: 13px; color: var(--text); }

/* --- Filter chips --- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.chip {
  --chip-color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0 14px;
  height: 32px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  box-sizing: border-box;
  font-family: inherit;
  line-height: 1;
}
/* Inactive chips show their kind color via a small dot before the label */
.chip:not(.active)::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chip-color);
  margin-right: 6px;
  flex-shrink: 0;
}
.chip:hover { background: var(--surface-alt); border-color: var(--chip-color); }
.chip.active {
  background: var(--chip-color);
  color: white;
  border-color: var(--chip-color);
}
.chip .count {
  font-weight: 600;
  font-size: 12px;
  padding: 0 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  background: color-mix(in srgb, var(--chip-color) 18%, transparent);
  color: var(--chip-color);
}
.chip.active .count {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* Chip colors match the corresponding alert-kind colors */
.chip.chip-kind-status   { --chip-color: #4c9aff; }  /* blue */
.chip.chip-kind-comments { --chip-color: #36b37e; }  /* green */
.chip.chip-kind-mentions { --chip-color: #ff8b00; }  /* orange */
.chip.chip-kind-unread   { --chip-color: var(--accent); }
.chip.chip-kind-all      { --chip-color: var(--accent); }
/* Issues view filter chips */
.chip.chip-kind-assigned { --chip-color: #4c9aff; }
.chip.chip-kind-involved { --chip-color: #9a76ff; }
/* Time-window chips (secondary row) — neutral slate, smaller */
.chip.chip-time {
  --chip-color: #6c798f;
  font-size: 12px;
  height: 26px;
  padding: 0 12px;
}
.chip.chip-time:not(.active)::before { width: 6px; height: 6px; }

/* Secondary chips row: tighter spacing */
.chips-secondary { gap: 6px; margin: 0; }
.filter-bar-secondary { margin-bottom: 18px; }

.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  height: 32px;
  box-sizing: border-box;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  min-width: 200px;
}
.search-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* Legacy .toolbar class — keep for any view not yet migrated to .filter-bar */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; }

.primary-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0 14px;
  height: 32px;
  box-sizing: border-box;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.primary-btn:hover { filter: brightness(1.05); }
.secondary-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0 14px;
  height: 32px;
  box-sizing: border-box;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.secondary-btn:hover { background: var(--surface-alt); }

/* --- Alerts list --- */
.day-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 18px 0 6px;
}
/* By-issue grouping: each group is a stacked card with a clickable
   header (the issue / PR link) and the alerts directly beneath. The
   alerts keep their own left-border kind colour. */
.alerts-group {
  margin-bottom: 18px;
  border-radius: var(--radius);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  overflow: hidden;
}
.alerts-group-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.alerts-group-header:hover { background: var(--surface-alt); text-decoration: none; }
.alerts-group-key { font-family: var(--mono); color: var(--accent); font-size: 12px; }
.alerts-group-summary { font-weight: 500; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alerts-group-count { color: var(--text-muted); font-weight: 400; font-size: 11px; white-space: nowrap; }
.alerts-group-body { padding: 8px 8px 4px; display: flex; flex-direction: column; gap: 4px; }
/* Alerts inside a group still get their kind colour, just a touch tighter. */
.alerts-group-body .alert { margin-bottom: 0; box-shadow: none; }
.alert {
  --kind-color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--kind-color);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: background 0.1s;
  box-shadow: var(--shadow);
}
.alert:hover { background: var(--surface-alt); }
.alert.unread .alert-title { font-weight: 600; }
.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--kind-color);
  margin-top: 6px;
  flex-shrink: 0;
}
.alert.read .alert-dot { background: transparent; border: 1px solid var(--border); width: 8px; height: 8px; }

/* Alert kind colors. Each kind gets a distinct hue on the left border + dot. */
.alert.kind-status_change         { --kind-color: #4c9aff; }  /* blue */
.alert.kind-comment_added         { --kind-color: #36b37e; }  /* green */
.alert.kind-comment_edited        { --kind-color: #00b8d9; }  /* teal */
.alert.kind-assignee_change       { --kind-color: #9a76ff; }  /* purple */
.alert.kind-resolution_change     { --kind-color: #ff8b00; }  /* orange */
.alert.kind-attachment_change     { --kind-color: #ffab00; }  /* amber */
.alert.kind-link_change           { --kind-color: #6c798f; }  /* slate */
.alert.kind-field_change          { --kind-color: #97a0af; }  /* gray */
/* PR alert kinds (Bitbucket) */
.alert.kind-pr_approved           { --kind-color: #00875a; }  /* deep green */
.alert.kind-pr_changes_requested  { --kind-color: #de350b; }  /* red */
.alert.kind-pr_comment_added      { --kind-color: #4c9aff; }  /* blue */
.alert.kind-pr_opened             { --kind-color: #ffab00; }  /* amber */
.alert.kind-pr_merged             { --kind-color: #6c4ad6; }  /* deep purple */
.alert.kind-pr_declined           { --kind-color: #97a0af; }  /* gray */
.alert.kind-pr_updated            { --kind-color: #97a0af; }  /* gray */

/* Chip colors for PR-activity filter */
.chip.chip-kind-pr { --chip-color: #6c4ad6; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-size: 13px; }
.alert-key { font-family: var(--mono); color: var(--accent); margin-right: 6px; }
.alert-summary { color: var(--text-muted); }
.alert-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.alert-preview {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 6px 10px;
  max-height: 80px;
  overflow: hidden;
}
.alert-mention { background: var(--warning); color: white; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 600; margin-left: 6px; }

.field-change {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
}
.field-old { color: var(--text-muted); text-decoration: line-through; }
.field-new { color: var(--success); font-weight: 600; }
.field-arrow { color: var(--text-muted); }

/* --- Issues table --- */
.issues-table {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.issues-table th, .issues-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.issues-table th {
  background: var(--surface-alt);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
}
.issues-table th:hover { background: var(--border); }
.issues-table tbody tr { cursor: pointer; }
.issues-table tbody tr:hover { background: var(--surface-alt); }
.issues-table td.key { font-family: var(--mono); color: var(--accent); white-space: nowrap; }
.issues-table td.summary { max-width: 500px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Status lozenge (hue-driven by --status-h) --- */
.status-lozenge {
  --status-h: 210;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: hsl(var(--status-h) 75% 92%);
  color: hsl(var(--status-h) 65% 28%);
  border: 1px solid hsl(var(--status-h) 50% 82%);
  white-space: nowrap;
}
.status-lozenge.empty {
  --status-h: 0;
  background: var(--surface-alt);
  color: var(--text-muted);
  border-color: var(--border);
  font-style: italic;
  font-weight: 500;
}
@media (prefers-color-scheme: dark) {
  .status-lozenge {
    background: hsl(var(--status-h) 35% 18%);
    color: hsl(var(--status-h) 75% 78%);
    border-color: hsl(var(--status-h) 35% 30%);
  }
}

/* --- Issue detail --- */
/* Issue detail top row: header (left) + description (right), 50/50 on wide screens */
.issue-detail .issue-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .issue-detail .issue-top { grid-template-columns: 1fr; }
}
.issue-detail .issue-top > .issue-header,
.issue-detail .issue-top > .issue-description-section {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.issue-detail .issue-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.issue-detail .issue-key { font-family: var(--mono); color: var(--text-muted); font-size: 13px; }
.issue-detail .issue-summary { font-size: 22px; font-weight: 600; margin: 4px 0 12px; }
.issue-detail .issue-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px 18px;
  font-size: 13px;
}
.issue-detail .meta-label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.issue-detail .meta-value { margin-top: 2px; }
.issue-detail .open-in-jira { font-size: 13px; color: var(--accent); }

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.section h2 { margin-top: 0; }

.description, .comment-body {
  font-size: 14px;
  line-height: 1.55;
}
/* Collapsible description: clamps height; toggle button reveals the rest.
   The fade-gradient `mask-image` is gated on `.is-clipped` so a short
   description (content < max-height) doesn't show a misleading fade. */
.description.collapsed {
  max-height: 280px;
  overflow: hidden;
  position: relative;
}
.description.collapsed.is-clipped {
  -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}
.description-toggle {
  margin-top: 10px;
  align-self: flex-start;
}
/* Make `[hidden]` actually hide the toggle: some sibling `.btn`-family
   rules raise the computed display to `flex`, beating the user-agent
   `[hidden] { display: none }` on specificity. !important here only
   affects this specific button so it's a local override, not a global one. */
.description-toggle[hidden] { display: none !important; }
.issue-description-section { display: flex; flex-direction: column; }
.issue-description-section .description { flex: 1; }
.description img, .comment-body img { max-width: 100%; height: auto; border-radius: 4px; }
.description pre, .comment-body pre { background: var(--surface-alt); padding: 10px; border-radius: var(--radius); overflow-x: auto; font-family: var(--mono); font-size: 13px; }
.description code, .comment-body code { background: var(--surface-alt); padding: 1px 4px; border-radius: 3px; font-family: var(--mono); font-size: 13px; }
.description table, .comment-body table { border-collapse: collapse; }
.description th, .description td, .comment-body th, .comment-body td { border: 1px solid var(--border); padding: 4px 8px; }

/* --- Combined activity feed (comments interleaved with changelog) --- */
.feed { display: flex; flex-direction: column; gap: 4px; }
.feed-entry-flash {
  animation: feed-flash 2.4s ease-out;
}
@keyframes feed-flash {
  0%   { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); }
  100% { background: inherit; box-shadow: none; }
}
.feed-entry {
  border-left: 3px solid var(--border);
  padding: 10px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
}
.feed-entry.comment {
  border-left-color: #36b37e;
  background: var(--surface-alt);
}
.feed-entry.activity {
  border-left-color: #97a0af;
  padding: 6px 14px;
}
.feed-entry-header {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 4px;
  font-size: 13px;
  flex-wrap: wrap;
}
.comment-author, .activity-author { font-weight: 600; }
.comment-time, .activity-time { color: var(--text-muted); font-size: 12px; }
.comment-edited { color: var(--text-muted); font-size: 11px; font-style: italic; }

.entry-kind-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 700;
  margin-left: auto;
}
.entry-kind-comment { background: rgba(54, 179, 126, 0.15); color: #006644; }
@media (prefers-color-scheme: dark) {
  .entry-kind-comment { background: rgba(54, 179, 126, 0.15); color: #36b37e; }
}

.activity-items {
  margin: 0;
  padding-left: 0;
  list-style: none;
  font-size: 13px;
}
.activity-items li {
  padding: 1px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.activity-items li.activity-item-block {
  display: block;
  padding: 4px 0;
}
.activity-items strong { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; margin-right: 4px; }

/* --- Inline word-level diff (long-form field changes) --- */
.activity-diff {
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.diff-eq  { color: var(--text); }
.diff-del {
  background: rgba(222, 53, 11, 0.10);
  color: #b22a09;
  text-decoration: line-through;
  text-decoration-color: rgba(222, 53, 11, 0.55);
  border-radius: 2px;
  padding: 0 2px;
}
.diff-ins {
  background: rgba(0, 135, 90, 0.14);
  color: #006644;
  border-radius: 2px;
  padding: 0 2px;
}
@media (prefers-color-scheme: dark) {
  .diff-del {
    background: rgba(255, 86, 48, 0.18);
    color: #ff8a6f;
    text-decoration-color: rgba(255, 86, 48, 0.7);
  }
  .diff-ins {
    background: rgba(54, 179, 126, 0.20);
    color: #6dd1a2;
  }
}

.alert-preview-compact {
  font-style: italic;
  color: var(--text-muted);
}
.alert-preview-compact strong {
  font-style: normal;
  color: var(--text);
}

/* --- Kanban board ---
   The board's sizing is driven by the body-level flex layout in
   `body.route-kanban` (see below). Here we only set the cross-axis layout
   inside the board so columns flow left-to-right and stretch to its height. */
.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: stretch;
}

/* Full-page flex layout for the kanban route. Toggled by kanban.js
   on mount/unmount via `document.body.classList`.

   Why a body-level flex column instead of a calc()-based height on the board?
   The board needs to fill the viewport space *below* the topbar + filter rows.
   Hard-coding that offset is fragile — when the filter rows expand or the
   topbar wraps, the math drifts by a few px and either (a) the page sprouts a
   1–14 px tall vertical scrollbar, or (b) the board ends short of the viewport
   bottom. With a flex layout, the remaining height is computed exactly by the
   browser, so the window only scrolls when the viewport is genuinely too
   short to fit even the chrome + the board's min-height. */
body.route-kanban {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
body.route-kanban > .topbar { flex: 0 0 auto; }
body.route-kanban > .view {
  flex: 1 1 0;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
/* The page title and filter rows still respect the 1100 px centered layout
   used elsewhere; only the board itself breaks out edge-to-edge. */
body.route-kanban > .view > .view-header,
body.route-kanban > .view > .filter-bar {
  width: 100%;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 18px;
  padding-right: 18px;
  box-sizing: border-box;
}
body.route-kanban > .view > .view-header { padding-top: 18px; }
body.route-kanban > .view > .kanban-board {
  flex: 1 1 0;
  /* Floor so the board never collapses below a usable height — when the
     viewport is shorter than (chrome + 280 px), the page scrolls so the user
     can reach the column headers, which matches the spec. */
  min-height: 280px;
  /* Override the legacy view-padding break-out — the view is already full-width. */
  margin: 0;
  padding: 0 24px 12px;
}
.kanban-column {
  /* Flex so columns grow to fill the row on wide screens and shrink as the
     window narrows. The horizontal scrollbar only appears once the min-width
     barrier is hit. */
  flex: 1 1 240px;
  min-width: 220px;
  max-width: 340px;
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0 4px;
  flex: 0 0 auto;
}
.kanban-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.kanban-cards {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  /* Per-column scrollbar only appears when the cards overflow the column. */
  overflow-y: auto;
}
.kanban-column.drag-over {
  background: var(--accent-soft);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}
.kanban-column.drag-over .kanban-empty-placeholder {
  border-color: var(--accent);
  color: var(--accent);
}
.kanban-column.is-empty {
  opacity: 0.6;
}
.kanban-empty-placeholder {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 20px 8px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.kanban-card {
  --status-h: 210;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid hsl(var(--status-h) 55% 55%);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: grab;
  box-shadow: var(--shadow);
  transition: transform 0.05s, box-shadow 0.1s, opacity 0.1s;
}
.kanban-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(9, 30, 66, 0.12);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.45; }
.kanban-card-key {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}
.kanban-card-summary {
  font-size: 13px;
  margin: 4px 0 6px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kanban-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  gap: 8px;
}


/* --- Status timeline (vertical) --- */
.timeline-vertical {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.timeline-vertical::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: var(--border);
}
.timeline-row {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  position: relative;
}
.timeline-row .timeline-marker {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--border);
  flex-shrink: 0;
  z-index: 1;
  margin-top: 2px;
}
.timeline-row.current .timeline-marker {
  background: hsl(var(--status-h, 210) 65% 50%);
  border-color: hsl(var(--status-h, 210) 65% 45%);
  box-shadow: 0 0 0 4px hsl(var(--status-h, 210) 75% 92%);
}
@media (prefers-color-scheme: dark) {
  .timeline-row.current .timeline-marker {
    box-shadow: 0 0 0 4px hsl(var(--status-h, 210) 35% 25%);
  }
}
.timeline-content {
  flex: 1;
  min-width: 0;
}
.timeline-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.timeline-status .pill {
  --status-h: 210;
  background: hsl(var(--status-h) 75% 92%);
  color: hsl(var(--status-h) 65% 28%);
  border: 1px solid hsl(var(--status-h) 50% 82%);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
@media (prefers-color-scheme: dark) {
  .timeline-status .pill {
    background: hsl(var(--status-h) 35% 18%);
    color: hsl(var(--status-h) 75% 78%);
    border-color: hsl(var(--status-h) 35% 30%);
  }
}
.timeline-row.current .pill {
  /* Use the status hue at higher saturation for the current row */
  background: hsl(var(--status-h, 210) 65% 50%);
  color: white;
  border-color: hsl(var(--status-h, 210) 65% 45%);
}
.current-badge {
  font-size: 10px;
  background: var(--accent);
  color: white;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.timeline-duration {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}
.timeline-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Time (relative) --- */
time.rel-time {
  font-variant-numeric: tabular-nums;
}


/* --- Empty / loading --- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty h2 { color: var(--text); }
.loading { padding: 40px; text-align: center; color: var(--text-muted); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Multi-line loading indicator with progress detail */
.loading-block {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.loading-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.loading-detail {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* --- Reviews view --- */
.reviews-viewer-tag {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  vertical-align: middle;
  margin-left: 8px;
}
.reviews-stats { font-size: 12px; color: var(--text-muted); margin-right: 6px; }

.reviews-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 14px;
  padding: 4px 10px;
  background: var(--surface-alt);
  border-radius: var(--radius);
}
.spinner.small { width: 12px; height: 12px; border-width: 2px; margin: 0; }

.reviews-section { margin-bottom: 28px; }
.reviews-section-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.reviews-section-emoji { font-size: 18px; }
.reviews-section h2 { margin: 0; font-size: 16px; }
.reviews-section-count {
  background: var(--surface-alt);
  color: var(--text-muted);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 4px;
}
.reviews-section-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: normal;
}
.reviews-waiting   .reviews-section-emoji { filter: drop-shadow(0 0 4px rgba(255,139,0,0.4)); }
.reviews-ship      .reviews-section h2 { color: var(--success); }
.reviews-empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 16px 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  text-align: center;
}

.reviews-list { display: flex; flex-direction: column; gap: 10px; }
.pr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
}
.reviews-waiting  .pr-card { border-left: 4px solid #ff8b00; }
.reviews-yours    .pr-card { border-left: 4px solid #4c9aff; }
.reviews-feedback .pr-card { border-left: 4px solid #6c4ad6; }   /* purple — same family as PR review */
.reviews-ship     .pr-card { border-left: 4px solid var(--success); }

.pr-card-main { min-width: 0; }
.pr-card-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.pr-jira-key {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}
.pr-title { font-size: 15px; font-weight: 500; word-break: break-word; }
.pr-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.pr-meta-sep { color: var(--border); }
.pr-repo { font-weight: 600; color: var(--text); }
.pr-branch {
  font-family: var(--mono);
  background: var(--surface-alt);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--text);
}
.pr-jira-status strong { color: var(--text); }

.pr-card-progress {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}
.pr-blocking {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.pr-blocking strong { color: var(--warning); }
.pr-no-reviewers { font-size: 12px; color: var(--text-muted); font-style: italic; }

/* One-line hint under the PR title explaining why the PR landed in its
   bucket. Mirrors the classifier's `myState` matrix; matched 1:1 in the
   PR detail view via `.pr-detail-state-hint`. */
.pr-state-hint,
.pr-detail-state-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.pr-card.pr-state-author_changes_requested .pr-state-hint,
.pr-card.pr-state-author_response_needed .pr-state-hint,
.pr-card.pr-state-changes_requested_with_response .pr-state-hint,
.pr-card.pr-state-approved_with_new_activity .pr-state-hint,
.pr-card.pr-state-commented_with_response .pr-state-hint {
  color: var(--warning);
  font-weight: 600;
}
.pr-card.pr-state-author_ready_to_merge .pr-state-hint,
.pr-card.pr-state-approved_all_done .pr-state-hint {
  color: var(--success);
  font-weight: 600;
}

/* Inline "Ready to merge" pill next to the title of an approved_all_done
   PR sitting in the Feedback given section. */
.pr-ready-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0,135,90,0.12);
  color: var(--success);
}

.reviewer-track {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.reviewer-track-avatars { display: inline-flex; gap: -8px; }
.reviewer-track-avatars .reviewer-dot { margin-right: -6px; }
.reviewer-track-avatars .reviewer-dot:last-child { margin-right: 0; }
.reviewer-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 2px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  overflow: hidden;
  position: relative;
}
.reviewer-dot img { width: 100%; height: 100%; object-fit: cover; }
.reviewer-dot.reviewer-dot-approved { border-color: var(--success); box-shadow: 0 0 0 2px rgba(0,135,90,0.15); }
.reviewer-dot.reviewer-dot-changes  { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(222,53,11,0.15); }
.reviewer-dot.reviewer-dot-pending  { opacity: 0.7; }
.reviewer-dot.is-me { outline: 2px solid var(--accent); outline-offset: 1px; }
.reviewer-track-summary { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.pr-confidence { flex: 1; min-width: 140px; max-width: 240px; }
.confidence-bar {
  position: relative;
  height: 8px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
}
.confidence-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}
.confidence-low  .confidence-fill { background: linear-gradient(90deg, #de350b, #ff8b00); }
.confidence-mid  .confidence-fill { background: linear-gradient(90deg, #ff8b00, #ffab00); }
.confidence-high .confidence-fill { background: linear-gradient(90deg, #00875a, #36b37e); }
.confidence-label {
  position: absolute;
  right: -36px;
  top: -3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pr-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.pr-card-actions .pr-action { white-space: nowrap; font-size: 12px; padding: 0 10px; height: 28px; }
.pr-ship-btn {
  background: linear-gradient(135deg, var(--success), #36b37e) !important;
  color: white !important;
  border: none;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0,135,90,0.3);
}
.pr-ship-btn:hover { filter: brightness(1.08); }
.pr-ship-btn:disabled { opacity: 0.6; cursor: wait; }

.ship-report {
  grid-column: 1 / -1;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
}
.ship-report-ok      { background: rgba(0,135,90,0.10); border-left: 4px solid var(--success); }
.ship-report-partial { background: rgba(255,139,0,0.10); border-left: 4px solid var(--warning); }
.ship-report-title { font-weight: 700; margin-bottom: 8px; }
.ship-report-summary {
  font-size: 13px;
  margin: 0 0 10px 0;
  padding: 6px 10px;
  border-radius: 4px;
  background: rgba(0,0,0,0.04);
}
.ship-report-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.ship-step { display: flex; gap: 8px; align-items: baseline; font-size: 13px; flex-wrap: wrap; }
.ship-step-icon { width: 16px; font-weight: 700; text-align: center; }
.ship-step-ok .ship-step-icon { color: var(--success); }
.ship-step-fail .ship-step-icon { color: var(--danger); }
.ship-step-skipped { opacity: 0.7; }
.ship-step-detail { color: var(--text-muted); font-size: 12px; font-family: var(--mono); }

/* --- Layout toggle (Queue / Board) --- */
.layout-toggle {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
}
.layout-toggle-btn {
  background: transparent;
  border: none;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 500;
}
.layout-toggle-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(9,30,66,0.1);
}

/* --- PR Board (kanban pipeline) --- */
.pr-board {
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  padding: 0 24px 12px;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  align-items: flex-start;
}
.pr-board-column {
  --col-tint: #6c798f;
  flex: 0 0 280px;
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 10px;
  max-height: calc(100vh - 220px);
  display: flex;
  flex-direction: column;
  border-top: 3px solid var(--col-tint);
}
.pr-board-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 0 4px;
}
.pr-board-column-emoji { font-size: 16px; }
.pr-board-column-label { font-weight: 600; font-size: 13px; flex: 1; }
.pr-board-column-count {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pr-board-column-cards { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 60px; }
.pr-board-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--col-tint);
  border-radius: var(--radius);
  padding: 10px;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pr-board-card:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(9,30,66,0.12); text-decoration: none; }
.pr-board-card-title { display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.pr-board-card-name { font-size: 13px; font-weight: 500; line-height: 1.35; }
.pr-board-card-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 6px; }
.pr-board-card-bottom { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.pr-board-empty {
  font-size: 12px; color: var(--text-muted); font-style: italic; text-align: center;
  padding: 16px 8px; border: 1px dashed var(--border); border-radius: var(--radius);
}

/* --- Branch handoff modal --- */
.branch-handoff-options { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.branch-handoff-row { display: flex; gap: 10px; align-items: stretch; }
.branch-handoff-code {
  flex: 1;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
  display: flex;
  align-items: center;
}
.branch-handoff-hint { font-size: 12px; color: var(--text-muted); margin: 4px 0 12px; }

/* --- PR card focus state (keyboard nav) --- */
.pr-card:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.pr-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* .pr-card-link inherits the baseline `a` styling (accent + hover underline)
   so PR titles look like links everywhere, per CLAUDE.md UI standards. */

/* --- Per-PR detail (two-panel) --- */
.pr-detail { display: flex; flex-direction: column; gap: 18px; }
.pr-detail-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}
.pr-back { font-size: 13px; }
.pr-detail-titlebar { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.pr-id { font-family: var(--mono); color: var(--text-muted); font-size: 13px; }
.pr-detail-title { margin: 0; font-size: 20px; font-weight: 600; }
.pr-detail-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.pr-two-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 1024px) {
  .pr-two-panel { grid-template-columns: 1fr; }
}
.pr-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}
.pr-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.pr-panel-header h2 { flex: 0 0 auto; }
.pr-panel-open-link {
  margin-left: auto;
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
}
.pr-panel-open-link:hover { text-decoration: underline; }
.pr-panel h2 { margin: 0; font-size: 15px; }
/* .pr-panel-jira-link inherits the baseline `a` styling (accent + hover
   underline) so the heading-link follows the same convention as every
   other text link in the app. */
.pr-panel h3 { margin: 14px 0 8px; font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.pr-state-pill {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.pr-state-open { background: #deebff; color: #0747a6; }
.pr-state-merged { background: #e3fcef; color: #006644; }
.pr-state-declined { background: rgba(222,53,11,0.15); color: var(--danger); }

.pr-meta-row { font-size: 13px; color: var(--text-muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.pr-meta-row strong { color: var(--text); }
.pr-branch-arrow { color: var(--text-muted); }

.pr-reviewers-panel { margin-top: 8px; }
.pr-reviewers-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.pr-reviewer { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.pr-reviewer.is-me { font-weight: 600; }
.pr-reviewer-state {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
  margin-left: auto;
}
.pr-reviewer-state-approved { background: rgba(0,135,90,0.12); color: var(--success); }
.pr-reviewer-state-changes  { background: rgba(222,53,11,0.12); color: var(--danger); }
.pr-reviewer-state-pending  { background: var(--surface-alt); color: var(--text-muted); }

.pr-diffstat { margin-top: 8px; }
.pr-diffstat-summary { font-weight: normal; color: var(--text-muted); font-size: 12px; margin-left: 4px; text-transform: none; }
.pr-diffstat-list { list-style: none; padding: 0; margin: 0; font-family: var(--mono); font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.pr-diffstat-list li {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 3px 6px;
  border-radius: 3px;
  background: var(--surface-alt);
}
.pr-diffstat-list li:hover { background: var(--border); }
.pr-diffstat-status {
  width: 22px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 3px; font-weight: 700; font-size: 11px;
}
.pr-diffstat-status-added    { background: rgba(0,135,90,0.15); color: var(--success); }
.pr-diffstat-status-modified { background: rgba(76,154,255,0.18); color: var(--accent); }
.pr-diffstat-status-removed  { background: rgba(222,53,11,0.15); color: var(--danger); }
.pr-diffstat-status-renamed  { background: rgba(255,139,0,0.18); color: var(--warning); }
.pr-diffstat-path { color: var(--text); word-break: break-all; }
.pr-diffstat-counts { white-space: nowrap; font-size: 11px; }
.diff-add { color: var(--success); }
.diff-del-num { color: var(--danger); }
.pr-diffstat-more { font-style: italic; color: var(--text-muted); background: transparent !important; }

.pr-description, .pr-description-body { font-size: 13px; line-height: 1.5; }
/* Long PR descriptions (raw markdown > 40 lines) start collapsed behind a
   "Show more …" toggle. ~30em ≈ ~28 visible lines at 13px/1.5; the fade
   makes the cut feel intentional. */
.pr-description-body.pr-description-collapsed {
  max-height: 30em;
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(to bottom, black 78%, transparent 100%);
          mask-image: linear-gradient(to bottom, black 78%, transparent 100%);
}
.pr-description-toggle {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 0;
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.pr-description-toggle:hover { text-decoration: underline; }
.pr-jira-summary { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.pr-jira-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pr-jira-description { font-size: 13px; line-height: 1.5; max-height: 400px; overflow-y: auto; padding: 8px; background: var(--surface-alt); border-radius: var(--radius); }

.pr-feed-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow); }
.pr-feed-section h2 { margin: 0 0 4px; font-size: 16px; }
.pr-feed-subtitle { color: var(--text-muted); font-size: 13px; margin: 0 0 12px; }
.pr-feed .feed-entry { border-left: 3px solid var(--border); padding: 10px 14px; }
.pr-feed .feed-side-pr   { border-left-color: #4c9aff; }
.pr-feed .feed-side-jira { border-left-color: #9a76ff; }

.entry-kind-pr_comment   { background: rgba(76,154,255,0.18); color: var(--accent); }
.entry-kind-pr_approval  { background: rgba(0,135,90,0.15); color: var(--success); }
.entry-kind-pr_update    { background: var(--surface-alt); color: var(--text-muted); }
.entry-kind-jira_comment { background: rgba(154,118,255,0.18); color: #6c4ad6; }
.entry-kind-jira_activity{ background: var(--surface-alt); color: var(--text-muted); }

.pr-inline-comment-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.pr-inline-comment-meta code { background: var(--surface-alt); padding: 1px 4px; border-radius: 3px; font-family: var(--mono); }

.ship-report-floating {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: 480px;
  z-index: 50;
}

/* --- Keyboard help --- */
.kbd-help-modal table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.kbd-help-modal td { padding: 6px 8px; font-size: 13px; border-bottom: 1px solid var(--border); }
.kbd-help-modal td:first-child { width: 130px; }
kbd {
  display: inline-block;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin: 0 1px;
}

/* --- Modal (used by Ship-it confirmation) --- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(9, 30, 66, 0.42);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(9, 30, 66, 0.35);
  padding: 24px 28px;
  max-width: 480px;
  width: 100%;
}
.modal h2 { margin: 0 0 4px; font-size: 18px; }
.modal-subtitle { color: var(--text-muted); margin: 0 0 16px; font-size: 13px; }
.ship-confirm-steps { list-style: none; padding: 0; margin: 0 0 18px; font-size: 14px; line-height: 1.7; }
.ship-confirm-steps li { padding: 2px 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 700px) {
  .pr-card { grid-template-columns: 1fr; }
  .pr-card-actions { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 100;
}
.toast.error { background: var(--danger); color: white; }

/* --- Settings view --- */
.settings-view-as-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-view-as-row select {
  flex: 0 1 360px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.settings-view-as-row select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.settings-section-header {
  margin-bottom: 12px;
}
.settings-section-header h2 { margin: 0 0 4px; font-size: 16px; }
.settings-section-hint {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 13px;
}
.settings-section-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.settings-section-tools .search-input { flex: 1 1 220px; min-width: 0; }
.settings-dirty-hint {
  color: var(--warning);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.settings-item {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--surface);
  transition: background 0.1s, border-color 0.1s;
}
.settings-item:hover { background: var(--surface-alt); }
.settings-item.is-selected {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.settings-item input[type=checkbox] { margin: 0; }
.settings-item-key {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
}
.settings-item-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Linked Pull Requests (issue detail) --- */
.issue-prs-section .issue-pr-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.issue-pr-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface-alt);
}
.issue-pr-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
/* .issue-pr-title inherits the baseline `a` styling so it looks like every
   other text link. The bolder weight here is a visual-hierarchy concession
   for the section's primary identifier — colour/underline behaviour stays
   on the convention. */
.issue-pr-title { font-weight: 600; }
.status-lozenge-sm { font-size: 10px; padding: 1px 6px; }
.issue-pr-row-meta {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.pr-row-branch { font-family: var(--mono); }
.pr-row-found-by {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-left: auto;
}

/* --- Responsive --- */
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .topbar-right { width: 100%; justify-content: flex-end; }
  .nav { order: 3; width: 100%; }
  .me { display: none; }
  .poll-status { display: none; }
  .issues-table td.summary { max-width: 200px; }
  .view { padding: 12px; }
}
