:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --sidebar-bg: #ffffff;
  --text: #1a1c1e;
  --text-muted: #5f6b7a;
  --border: #e4e7eb;

  --primary: #1976d2;
  --primary-soft: #e3f2fd;
  --primary-foreground: #ffffff;

  --success: #4caf50;
  --success-soft: #e8f5e9;
  --danger: #f44336;
  --danger-soft: #fdecea;
  --warning: #ff9800;
  --warning-soft: #fff3e0;
  --neutral: #78909c;
  --neutral-soft: #eceff1;

  --radius: 10px;
  --radius-lg: 14px;

  --elevation-1: 0 1px 2px rgba(20, 24, 30, 0.06), 0 1px 3px rgba(20, 24, 30, 0.05);
  --elevation-2: 0 2px 4px rgba(20, 24, 30, 0.06), 0 4px 12px rgba(20, 24, 30, 0.08);
  --elevation-3: 0 4px 8px rgba(20, 24, 30, 0.08), 0 8px 24px rgba(20, 24, 30, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1c1f24;
    --sidebar-bg: #191c21;
    --text: #e7e9ec;
    --text-muted: #9aa2ad;
    --border: #2c3038;

    --primary: #6d9eeb;
    --primary-soft: #1c2e46;
    --primary-foreground: #0d1117;

    --success: #6fdb92;
    --success-soft: #123420;
    --danger: #ff8a80;
    --danger-soft: #3a1a17;
    --warning: #ffc46b;
    --warning-soft: #3a2c0c;
    --neutral: #9aa2ad;
    --neutral-soft: #262a30;

    --elevation-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    --elevation-2: 0 2px 4px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.35);
    --elevation-3: 0 4px 10px rgba(0, 0, 0, 0.45), 0 10px 28px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  --bg: #14161a; --surface: #1c1f24; --sidebar-bg: #191c21;
  --text: #e7e9ec; --text-muted: #9aa2ad; --border: #2c3038;
  --primary: #6d9eeb; --primary-soft: #1c2e46; --primary-foreground: #0d1117;
  --success: #6fdb92; --success-soft: #123420;
  --danger: #ff8a80; --danger-soft: #3a1a17;
  --warning: #ffc46b; --warning-soft: #3a2c0c;
  --neutral: #9aa2ad; --neutral-soft: #262a30;
  --elevation-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
  --elevation-2: 0 2px 4px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.35);
  --elevation-3: 0 4px 10px rgba(0, 0, 0, 0.45), 0 10px 28px rgba(0, 0, 0, 0.4);
}

:root[data-theme="light"] {
  --bg: #f4f6f8; --surface: #ffffff; --sidebar-bg: #ffffff;
  --text: #1a1c1e; --text-muted: #5f6b7a; --border: #e4e7eb;
  --primary: #1976d2; --primary-soft: #e3f2fd; --primary-foreground: #ffffff;
  --success: #4caf50; --success-soft: #e8f5e9;
  --danger: #f44336; --danger-soft: #fdecea;
  --warning: #ff9800; --warning-soft: #fff3e0;
  --neutral: #78909c; --neutral-soft: #eceff1;
  --elevation-1: 0 1px 2px rgba(20, 24, 30, 0.06), 0 1px 3px rgba(20, 24, 30, 0.05);
  --elevation-2: 0 2px 4px rgba(20, 24, 30, 0.06), 0 4px 12px rgba(20, 24, 30, 0.08);
  --elevation-3: 0 4px 8px rgba(20, 24, 30, 0.08), 0 8px 24px rgba(20, 24, 30, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: var(--primary); }

/* ---------- app shell: sidebar + topbar + content ---------- */
/* Fixed-height shell so the sidebar spans the full viewport regardless of how
   tall the content is — .content-area is the only element that scrolls. */

.app-shell {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.15s ease;
}

.sidebar.collapsed { width: 64px; }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-header .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sidebar-header .brand-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-count {
  display: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 10px 4px;
}

.sidebar.collapsed .nav-section-title { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  cursor: pointer;
  margin-bottom: 2px;
  text-align: left;
}

.nav-item:hover { background: var(--primary-soft); }

.nav-item .nav-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.95rem;
}

.nav-item .nav-label { flex: 1; }

.nav-item .nav-count {
  font-size: 0.72rem;
  background: var(--neutral-soft);
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: 999px;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-toggle-btn {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
}

.sidebar-toggle-btn:hover { color: var(--text); }

.shell-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 60px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title { font-weight: 600; font-size: 1rem; }

.topbar-meta { font-size: 0.78rem; color: var(--text-muted); }

.theme-toggle-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.theme-toggle-btn:hover { border-color: var(--primary); }

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 64px;
}

/* Narrow viewports: force icon-only sidebar so content gets most of the
   width, same visual as the manually-collapsed state. */
@media (max-width: 640px) {
  .sidebar { width: 64px; }
  .sidebar .brand-name,
  .sidebar .nav-label,
  .sidebar .nav-count,
  .sidebar .nav-section-title,
  .sidebar-footer {
    display: none;
  }
  .content-area { padding: 16px 14px 48px; }
}

main { max-width: 1080px; margin: 0 auto; }

section { margin-bottom: 32px; }

h2 {
  font-size: 1.15rem;
  margin: 0 0 4px;
  letter-spacing: -0.005em;
}

.section-hint {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.intro-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-1);
  padding: 20px 24px;
  margin-bottom: 24px;
  font-size: 1rem;
}

/* ---------- metric cards ---------- */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--elevation-1);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  transition: box-shadow 0.12s ease;
}

.metric-card:hover { box-shadow: var(--elevation-2); }

.metric-card.tone-success { border-left-color: var(--success); }
.metric-card.tone-danger { border-left-color: var(--danger); }
.metric-card.tone-warning { border-left-color: var(--warning); }
.metric-card.tone-neutral { border-left-color: var(--neutral); }

.metric-card-body { flex: 1; min-width: 0; }

.metric-card-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.metric-card-value {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
}

.metric-card-progress-track {
  margin-top: 10px;
  height: 6px;
  border-radius: 999px;
  background: var(--neutral-soft);
  overflow: hidden;
}

.metric-card-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}

.metric-card.tone-success .metric-card-progress-fill { background: var(--success); }
.metric-card.tone-danger .metric-card-progress-fill { background: var(--danger); }
.metric-card.tone-warning .metric-card-progress-fill { background: var(--warning); }

.metric-card-progress-label {
  margin: 5px 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.metric-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.metric-card.tone-success .metric-card-icon { background: var(--success-soft); color: var(--success); }
.metric-card.tone-danger .metric-card-icon { background: var(--danger-soft); color: var(--danger); }
.metric-card.tone-warning .metric-card-icon { background: var(--warning-soft); color: var(--warning); }
.metric-card.tone-neutral .metric-card-icon { background: var(--neutral-soft); color: var(--neutral); }

/* ---------- suite coverage grid ---------- */

.suite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.suite-tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--elevation-1);
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.08s ease, border-color 0.08s ease;
}

.suite-tile.has-tests { border-color: var(--primary); cursor: pointer; }
.suite-tile.has-tests:hover { transform: translateY(-1px); box-shadow: var(--elevation-2); }
.suite-tile.not-started { opacity: 0.68; }

.suite-tile .suite-order {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.suite-tile .suite-label { font-weight: 600; margin: 3px 0 6px; }
.suite-tile .suite-blurb { font-size: 0.85rem; color: var(--text-muted); }

.suite-tile .suite-status {
  margin-top: 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

.suite-tile.has-tests .suite-status { color: var(--primary); }
.suite-tile.not-started .suite-status { color: var(--text-muted); }

/* ---------- findings-by-suite chart ---------- */

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-1);
  padding: 18px 22px;
}

.chart-row {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.donut-wrap { flex-shrink: 0; }

.donut-center-label { font-size: 0.7rem; fill: var(--text-muted); }
.donut-center-value { font-size: 1.4rem; font-weight: 700; fill: var(--text); }

.chart-legend {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chart-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
}

.chart-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.chart-legend-row .legend-name { flex: 1; }
.chart-legend-row .legend-count { color: var(--text-muted); }

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge.working { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.badge.issue   { background: var(--warning-soft); color: var(--warning); border-color: var(--warning); }
.badge.blocked { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.badge.na      { background: var(--neutral-soft); color: var(--neutral); border-color: var(--neutral); }

/* ---------- test case cards ---------- */

.suite-group { margin-bottom: 28px; }

.suite-group-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.suite-group-heading h3 { margin: 0; font-size: 1.05rem; }

.suite-group-heading .suite-order {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.test-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--elevation-1);
  padding: 18px 22px;
  margin-bottom: 14px;
}

.test-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.test-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--neutral-soft);
  padding: 2px 7px;
  border-radius: 6px;
}

.test-priority { font-size: 0.75rem; color: var(--text-muted); }

.test-title { font-size: 1.05rem; font-weight: 600; margin: 4px 0 2px; }

.test-status-note { color: var(--text-muted); font-size: 0.92rem; margin: 0 0 4px; }

details.test-detail summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.9rem;
  padding: 8px 0 4px;
  list-style: none;
}

details.test-detail summary::-webkit-details-marker { display: none; }
details.test-detail summary::before { content: "▸ "; }
details.test-detail[open] summary::before { content: "▾ "; }

/* info panel + findings layout, echoing the reference's detail-page sidebar */

.detail-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-top: 6px;
}

@media (max-width: 720px) {
  .detail-layout { grid-template-columns: 1fr; }
}

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

.info-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  align-self: start;
}

.info-panel-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.85rem;
}

.info-panel-row:last-child { border-bottom: none; }
.info-panel-row .info-label { color: var(--text-muted); }
.info-panel-row .info-value { font-weight: 600; text-align: right; }

.detail-block { margin: 14px 0; }

.detail-block h4 {
  margin: 0 0 6px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.detail-block ul { margin: 4px 0 0; padding-left: 20px; }
.detail-block li { margin-bottom: 6px; }

.history-list { list-style: none; margin: 0; padding: 0; font-size: 0.88rem; }

.history-list li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}

.history-list li:last-child { border-bottom: none; }
.history-list time { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.screenshot-grid figure {
  margin: 0;
  background: var(--neutral-soft);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.screenshot-link {
  display: block;
  position: relative;
  cursor: zoom-in;
}

.screenshot-link img {
  display: block;
  width: 100%;
  height: auto;
  border-bottom: 1px solid var(--border);
  transition: transform 0.15s ease;
}

.screenshot-link::after {
  content: "⤢ View full size";
  position: absolute;
  inset: 0;
  bottom: 1px; /* sit above the caption's top border */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 17, 20, 0.55);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.screenshot-link:hover::after,
.screenshot-link:focus-visible::after {
  opacity: 1;
}

.screenshot-link:hover img,
.screenshot-link:focus-visible img {
  transform: scale(1.03);
}

.screenshot-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.screenshot-grid figcaption { padding: 8px 10px; font-size: 0.78rem; color: var(--text-muted); }

.links-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

.links-row a {
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
}

.links-row a:hover { border-color: var(--primary); }

.tech-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.tech-section h2 { color: var(--text); }

.tech-section code { background: var(--neutral-soft); padding: 1px 5px; border-radius: 5px; font-size: 0.85em; }

.empty-note { color: var(--text-muted); font-style: italic; }

footer { text-align: center; color: var(--text-muted); font-size: 0.8rem; padding: 20px; }
