/* ============================================================
   Bug Bash — styles
   ============================================================ */

:root {
  --bg:            #f6f7f9;
  --surface:       #ffffff;
  --surface-2:     #f1f3f6;
  --border:        #e3e6ea;
  --border-strong: #cfd4db;
  --text:          #16191d;
  --text-dim:      #5c646e;
  --text-faint:    #8b939d;
  --accent:        #d7263d;
  --accent-hover:  #b81d31;
  --accent-soft:   #fdecee;
  --ok:            #1c7c4a;
  --ok-soft:       #e8f5ee;
  --warn:          #9a6700;
  --warn-soft:     #fff6e0;
  --radius:        10px;
  --radius-sm:     7px;
  --shadow:        0 1px 2px rgba(16, 20, 26, .05), 0 4px 14px rgba(16, 20, 26, .05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;

  /* Severity — hue carries urgency, dark to light */
  --sev-critical-fg: #ffffff;  --sev-critical-bg: #b3121f;  --sev-critical-bd: #b3121f;
  --sev-major-fg:     #9c3410;  --sev-major-bg:     #fdece3;  --sev-major-bd:     #f0b795;
  --sev-minor-fg:   #7a5300;  --sev-minor-bg:   #fdf4dd;  --sev-minor-bd:   #e8cf8d;
  --sev-trivial-fg:      #12657f;  --sev-trivial-bg:      #e3f4f9;  --sev-trivial-bd:      #a5d7e6;

  /* Status — cool = active, green = resolved, grey = dismissed */
  --st-open-fg:      #17548c;  --st-open-bg:      #e7f1fb;  --st-open-bd:      #a9cdee;
  --st-progress-fg:  #6b3f9e;  --st-progress-bg:  #f2ecfb;  --st-progress-bd:  #cbb6e8;
  --st-fixed-fg:     #14683d;  --st-fixed-bg:     #e6f5ec;  --st-fixed-bd:     #a3d8ba;
  --st-duplicate-fg: #5c646e;  --st-duplicate-bg: #f1f3f6;  --st-duplicate-bd: #d3dae0;
  --st-rejected-fg:  #5c646e;  --st-rejected-bg:  #f1f3f6;  --st-rejected-bd:  #d3dae0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #131518;
    --surface:       #1b1e22;
    --surface-2:     #23272c;
    --border:        #2e333a;
    --border-strong: #414750;
    --text:          #e9ecef;
    --text-dim:      #a2abb5;
    --text-faint:    #757e88;
    --accent:        #f2647a;
    --accent-hover:  #ff7d90;
    --accent-soft:   #2e1b1f;
    --ok:            #5fd18f;
    --ok-soft:       #15291e;
    --warn:          #e5b45c;
    --warn-soft:     #2b2213;
    --shadow:        0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);

    --sev-critical-fg: #ffe8ea;  --sev-critical-bg: #8f0d18;  --sev-critical-bd: #b3121f;
    --sev-major-fg:     #ffbb92;  --sev-major-bg:     #3a2015;  --sev-major-bd:     #6b3a22;
    --sev-minor-fg:   #ecc668;  --sev-minor-bg:   #322813;  --sev-minor-bd:   #5c4a1f;
    --sev-trivial-fg:      #6ec6de;  --sev-trivial-bg:      #102a33;  --sev-trivial-bd:      #23505d;

    --st-open-fg:      #8dc0ee;  --st-open-bg:      #16273a;  --st-open-bd:      #2d4d6f;
    --st-progress-fg:  #c2a5ea;  --st-progress-bg:  #241c33;  --st-progress-bd:  #3f3157;
    --st-fixed-fg:     #74d29c;  --st-fixed-bg:     #12291d;  --st-fixed-bd:     #264b34;
    --st-duplicate-fg: #98a1ab;  --st-duplicate-bg: #23272c;  --st-duplicate-bd: #3a4046;
    --st-rejected-fg:  #98a1ab;  --st-rejected-bg:  #23272c;  --st-rejected-bd:  #3a4046;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── Top bar ─────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 15px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark { font-size: 24px; line-height: 1; }
.brand-text {
  font-family: "Trebuchet MS", "Segoe UI Semibold", "Segoe UI", system-ui, sans-serif;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.1;
}
@media (max-width: 620px) {
  .brand-text { font-size: 20px; }
  .brand-mark { font-size: 19px; }
}

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

/* Storage meter — quiet until it matters, then loud. */
.storage {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-faint);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px 10px;
  cursor: default;
}
.storage[data-level="high"] {
  color: var(--warn);
  border-color: var(--warn);
  background: var(--warn-soft);
  font-weight: 600;
}
.storage[data-level="full"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}
@media (max-width: 620px) {
  .storage { display: none; }
}

.live {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}
.live[data-state="live"] .live-dot   { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.live[data-state="error"] .live-dot  { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.live[data-state="error"]            { color: var(--accent); }
.live[data-state="demo"] .live-dot   { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.live[data-state="demo"]             { color: var(--warn); font-weight: 600; }

/* ── Layout ──────────────────────────────────────────────── */
.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
@media (max-width: 900px) {
  .layout { padding: 16px; gap: 16px; }
}

/* Deliberately NOT sticky — a floating filter bar clipped the form
   fields sliding underneath it. It scrolls away with everything else. */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

/* Panel headings — "Report a bug", "Top Bug Hunters", "Reported bugs".
   Same family as the brand so the three sections read as siblings of it. */
.panel-title {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI Semibold", "Segoe UI", system-ui, sans-serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.25;
}
@media (max-width: 620px) {
  .panel-title { font-size: 18px; }
}
.panel-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}

/* ── Form ────────────────────────────────────────────────── */
form { margin-top: 20px; }

.field { margin-bottom: 17px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.req { color: var(--accent); font-weight: 500; }
.opt { color: var(--text-faint); font-weight: 450; font-size: 12px; }

input[type="text"], textarea {
  width: 100%;
  padding: 9px 11px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
textarea {
  resize: vertical;
  min-height: 96px;
  font-family: var(--sans);
  line-height: 1.5;
}
input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--accent);
}

.hint {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--text-faint);
}

/* Validation message for a single field, shown directly beneath it. */
.fielderr {
  margin: 6px 0 0;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--accent);
  display: flex;
  align-items: flex-start;
  gap: 5px;
}
.fielderr:empty { display: none; }
.fielderr::before { content: "⚠"; flex: none; }

.pseudo-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

select {
  width: 100%;
  padding: 9px 11px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Severity picker (segmented radios) ──────────────────── */
.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.seg { position: relative; margin: 0; }
.seg input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}
.seg span {
  display: block;
  text-align: center;
  padding: 8px 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
  user-select: none;
}
.seg span:hover { border-color: var(--border-strong); color: var(--text); }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

.seg-critical input:checked + span {
  color: var(--sev-critical-fg); background: var(--sev-critical-bg); border-color: var(--sev-critical-bd);
}
.seg-major input:checked + span {
  color: var(--sev-major-fg); background: var(--sev-major-bg); border-color: var(--sev-major-bd);
}
.seg-minor input:checked + span {
  color: var(--sev-minor-fg); background: var(--sev-minor-bg); border-color: var(--sev-minor-bd);
}
.seg-trivial input:checked + span {
  color: var(--sev-trivial-fg); background: var(--sev-trivial-bg); border-color: var(--sev-trivial-bd);
}

/* ── Badges + status dropdown on cards ───────────────────── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .035em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid;
  flex: none;
  white-space: nowrap;
}
.sev-critical { color: var(--sev-critical-fg); background: var(--sev-critical-bg); border-color: var(--sev-critical-bd); }
.sev-major     { color: var(--sev-major-fg);     background: var(--sev-major-bg);     border-color: var(--sev-major-bd); }
.sev-minor   { color: var(--sev-minor-fg);   background: var(--sev-minor-bg);   border-color: var(--sev-minor-bd); }
.sev-trivial      { color: var(--sev-trivial-fg);      background: var(--sev-trivial-bg);      border-color: var(--sev-trivial-bd); }

.status-select {
  width: auto;
  flex: none;
  padding: 3px 6px;
  font-size: 11.5px;
  font-weight: 650;
  border-radius: 5px;
  border: 1px solid;
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
  padding-right: 20px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 9px center, right 5px center;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.status-select:disabled { opacity: .55; cursor: progress; }
.status-select option { color: var(--text); background: var(--surface); font-weight: 500; }

.st-open       { color: var(--st-open-fg);      background-color: var(--st-open-bg);      border-color: var(--st-open-bd); }
.st-in-progress{ color: var(--st-progress-fg);  background-color: var(--st-progress-bg);  border-color: var(--st-progress-bd); }
.st-fixed      { color: var(--st-fixed-fg);     background-color: var(--st-fixed-bg);     border-color: var(--st-fixed-bd); }
.st-duplicate  { color: var(--st-duplicate-fg); background-color: var(--st-duplicate-bg); border-color: var(--st-duplicate-bd); }
.st-rejected   { color: var(--st-rejected-fg);  background-color: var(--st-rejected-bg);  border-color: var(--st-rejected-bd); }

/* Resolved bugs recede so open work stands out. */
.bug.is-resolved { opacity: .68; }
.bug.is-resolved:hover { opacity: 1; }

/* ── Dropzone ────────────────────────────────────────────── */
.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 18px 14px;
  text-align: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.dropzone-icon { font-size: 17px; }
.dropzone-text { font-size: 13.5px; color: var(--text-dim); }
.dropzone-text strong { color: var(--text); font-weight: 600; }

.filelist { list-style: none; margin: 9px 0 0; padding: 0; }
.filelist li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  margin-bottom: 5px;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.filelist .fl-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filelist .fl-size { color: var(--text-faint); flex: none; font-variant-numeric: tabular-nums; }
.filelist .fl-bad { color: var(--accent); }
.fl-remove {
  flex: none;
  border: 0;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 4px;
}
.fl-remove:hover { color: var(--accent); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, opacity .12s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary { color: #1a0d10; }
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }

.btn-ghost {
  background: none;
  color: var(--text-dim);
  border-color: transparent;
  font-weight: 500;
  padding: 9px 11px;
}
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.btn-sm { padding: 6px 11px; font-size: 13px; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.draft-note {
  font-size: 12px;
  color: var(--text-faint);
  font-style: italic;
}

kbd {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-dim);
}

.progress {
  height: 3px;
  margin-top: 11px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width .2s ease;
}

.formnote { margin: 0; font-size: 13px; }
.formnote:empty { display: none; }
/* Errors only — successes are shown as a toast. */
.formnote[data-kind="err"] { color: var(--accent); }

/* ── Filter inputs ───────────────────────────────────────── */
.filters {
  display: flex;
  align-items: flex-end;
  gap: 11px;
  flex-wrap: wrap;
  /* Breathing room below the sort control so the filters read as their own
     group rather than running straight into the table header. */
  margin: 13px 0 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.field-inline { margin: 0; flex: 1 1 165px; min-width: 145px; }
.field-inline label { font-size: 12px; color: var(--text-dim); }
.field-inline input,
.field-inline select { padding: 7px 10px; font-size: 13.5px; background: var(--surface); }
.field-narrow { flex: 0 1 132px; min-width: 118px; }

/* ── Repro links on a card ───────────────────────────────── */
.bug-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}
.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 550;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  color: var(--text-dim);
  text-decoration: none;
  background: var(--surface-2);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.link-chip .chip-icon { font-size: 13px; flex: none; }

/* Live count of pasted links under the textarea. */
.links-count { color: var(--ok); font-weight: 600; }
.links-bad   { color: var(--accent); font-weight: 600; }

.bug {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  background: var(--surface);
}
@keyframes flash {
  from { border-color: var(--accent); background: var(--accent-soft); }
  to   { border-color: var(--border); background: var(--surface); }
}

.bug-id {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2.5px 7px;
  border-radius: 5px;
  flex: none;
  letter-spacing: .02em;
}

.bug-desc {
  margin: 9px 0 0;
  font-size: 13.5px;
  color: var(--text-dim);
  white-space: pre-wrap;
  overflow-wrap: break-word;
  line-height: 1.55;
}

.bug-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}
.proof-img {
  display: block;
  width: 82px;
  height: 62px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
}
a.proof-link:hover .proof-img { border-color: var(--accent); }
.bug-proof video {
  width: 190px;
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: #000;
  display: block;
}
.proof-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-dim);
  text-decoration: none;
  background: var(--surface-2);
}
.proof-file:hover { border-color: var(--accent); color: var(--accent); }

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13.5px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.empty strong { display: block; color: var(--text-dim); font-size: 14.5px; margin-bottom: 4px; font-weight: 600; }

.banner {
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border: 1px solid;
  margin-top: 18px;
}
.banner-err  { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.banner-warn { color: var(--warn);   background: var(--warn-soft);   border-color: var(--warn); }
.banner code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: rgba(128, 128, 128, .16);
  padding: 1px 5px;
  border-radius: 4px;
}
.banner p { margin: 0 0 7px; }
.banner p:last-child { margin-bottom: 0; }

/* ── Top Bug Hunters (sidebar) ───────────────────────────── */
/* Form and sidebar share a row; the bug table spans full width below. */
.topgrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .topgrid { grid-template-columns: 1fr; gap: 16px; }
}

.panel-board { padding: 20px; }
.panel-board .panel-sub { margin-bottom: 2px; }

.board {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.board-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
/* Score bar, drawn behind the row content. */
.board-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--pct, 0%);
  background: var(--accent-soft);
  transition: width .25s ease;
}
.board-row:first-child::before { background: var(--warn-soft); }
.board-row > * { position: relative; }

.board-rank {
  flex: none;
  width: 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

.board-who {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.board-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.board-name {
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
/* Bug count sits top-right beside the name, and carries the emphasis. */
.board-count {
  flex: none;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.board-count b { font-size: 13.5px; color: var(--text); font-weight: 700; }

/* Points sit on their own line beneath — supporting detail, not the headline. */
.board-score {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.board-sev {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.board-sev .badge {
  font-size: 9.5px;
  padding: 1.5px 5px;
  letter-spacing: .02em;
  text-transform: none;
}

.board-foot {
  margin: 11px 0 0;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--text-faint);
}

/* ── Stat bar ────────────────────────────────────────────── */
.statbar {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 13px;
}
.statbar:empty { display: none; }

/* One row for total + severity, a second for status. */
.statrow {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.statrow-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  min-width: 54px;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, opacity .12s;
}
.stat:hover { border-color: var(--text-faint); }
.stat.is-on { box-shadow: 0 0 0 2px var(--accent); border-color: var(--accent); }
.stat-n {
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  font-size: 12.5px;
}
.stat-total { background: var(--surface); }
.statbar .stat.sev-critical,
.statbar .stat.sev-major,
.statbar .stat.sev-minor,
.statbar .stat.sev-trivial,
.statbar .stat.st-open,
.statbar .stat.st-in-progress,
.statbar .stat.st-fixed,
.statbar .stat.st-duplicate,
.statbar .stat.st-rejected { text-transform: none; letter-spacing: 0; }

/* ── Duplicate suggestions ───────────────────────────────── */
.dupes {
  margin-top: 9px;
  padding: 11px 12px;
  border: 1px solid var(--warn);
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
}
.dupes-head {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--warn);
}
.dupe {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 13px;
  padding: 7px 9px;
  margin-bottom: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .12s;
}
.dupe:last-child { margin-bottom: 0; }
.dupe:hover { border-color: var(--accent); }
.dupe-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

/* ── List header ─────────────────────────────────────────── */
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.list-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.perpage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
}
.perpage select { width: auto; padding: 5px 8px; font-size: 12.5px; }

/* ── Table ───────────────────────────────────────────────── */
.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.bugtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 720px;
}
.bugtable th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-faint);
  padding: 9px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.bugtable td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.bugtable tbody tr:last-child td { border-bottom: 0; }
.bugtable tbody tr:hover { background: var(--surface-2); }
.bugtable tr.is-new { animation: flash 1.6s ease-out; }
.bugtable tr.is-resolved .td-title {
  text-decoration: line-through;
  text-decoration-color: var(--text-faint);
  opacity: .7;
}
.td-title { font-weight: 550; min-width: 220px; }
.td-dim { color: var(--text-dim); white-space: nowrap; }
.td-id { white-space: nowrap; }

/* Whole row opens the detail panel. */
.bugrow { cursor: pointer; }
.bugrow:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.bugrow.is-open { background: var(--surface-2); }
.bugrow.is-open .rowcaret { color: var(--accent); }
.rowcaret {
  display: inline-block;
  width: 12px;
  color: var(--text-faint);
  font-size: 11px;
  transition: color .12s;
}

/* ── Expanded detail panel ───────────────────────────────── */
.bugtable tr.rowdetail td {
  background: var(--surface-2);
  padding: 0;
  border-bottom: 2px solid var(--border-strong);
}
.bugtable tr.rowdetail:hover { background: var(--surface-2); }

.detail {
  padding: 16px 18px 18px;
  white-space: normal;
}
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.detail-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  overflow-wrap: break-word;
  min-width: 0;
}
.detail-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 14px;
  margin: 0 0 14px;
  font-size: 12.5px;
  align-items: center;
  max-width: 460px;
}
.detail-meta dt {
  color: var(--text-faint);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: .04em;
}
.detail-meta dd { margin: 0; color: var(--text); }
.detail-h {
  margin: 14px 0 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-faint);
}
.detail-h:first-of-type { margin-top: 0; }
.detail .bug-desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: break-word;
  line-height: 1.6;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
}
.detail-none { margin: 10px 0 0; font-size: 12.5px; color: var(--text-faint); font-style: italic; }

/* ── Edit / delete actions ───────────────────────────────── */
.bug-actions {
  display: inline-flex;
  gap: 5px;
  flex: none;
}
.iconbtn {
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  transition: color .12s, border-color .12s, background .12s;
}
.iconbtn:hover { color: var(--text); border-color: var(--text-faint); background: var(--surface-2); }
.iconbtn-danger:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.td-actions { white-space: nowrap; }

/* The card being edited is called out so it's obvious what's in the form. */
.form.is-editing, form.is-editing {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  margin-left: -17px;
}

/* Already-saved attachments while editing */
.keptlist:empty { display: none; }
.keptlist { margin: 0 0 9px; }
.fl-tag {
  flex: none;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--ok);
  background: var(--ok-soft);
}

/* ── Pagination ──────────────────────────────────────────── */
.pager {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.pager:empty { display: none; }
.pager-info {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-right: auto;
  font-variant-numeric: tabular-nums;
}
.pager-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  min-width: 32px;
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.pager-btn:hover:not(:disabled):not(.is-on) {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--text-faint);
}
.pager-btn:disabled { opacity: .4; cursor: not-allowed; }
.pager-btn.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: default;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pager-btn.is-on { color: #1a0d10; }
}
.pager-gap { color: var(--text-faint); padding: 0 2px; font-size: 12.5px; }

/* Flash the dropzone when a screenshot is pasted in. */
.dropzone.is-pasted {
  border-color: var(--ok);
  background: var(--ok-soft);
}

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(10px);
  background: var(--text);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 550;
  padding: 10px 17px;
  border-radius: 99px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .22);
  opacity: 0;
  transition: opacity .18s, transform .18s;
  z-index: 60;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
