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

:root {
  --bg:         #f1f5f9;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --border-md:  #cbd5e1;
  --text:       #0f172a;
  --text-2:     #475569;
  --text-3:     #94a3b8;
  --blue:       #1d4ed8;
  --blue-light: #dbeafe;
  --green:      #16a34a;
  --green-lt:   #dcfce7;
  --amber:      #d97706;
  --amber-lt:   #fef3c7;
  --red:        #dc2626;
  --red-lt:     #fee2e2;
  --sky:        #0284c7;
  --sky-lt:     #e0f2fe;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 4px 12px rgba(0,0,0,.08);
}

html { font-size: 15px; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.header-sub {
  font-size: 0.8rem;
  color: var(--text-3);
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

/* ── Main ────────────────────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 1140px;
  margin: 0 auto;
  width: 100%;
  padding: 32px 24px;
}

/* ── Upload section ──────────────────────────────────────────────────────── */
.upload-wrap {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone {
  width: 100%;
  max-width: 520px;
  border: 2px dashed var(--border-md);
  border-radius: 16px;
  padding: 56px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--surface);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--blue);
  background: var(--blue-light);
}

.drop-zone:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.drop-icon { margin-bottom: 16px; }

.drop-label {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.drop-label code {
  font-family: "SF Mono", "Cascadia Code", monospace;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .9em;
}

.drop-sub {
  font-size: .9rem;
  color: var(--text-2);
  margin-bottom: 12px;
}

.drop-hint {
  font-size: .8rem;
  color: var(--text-3);
}

.link-btn {
  background: none;
  border: none;
  color: var(--blue);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:hover { opacity: .75; }

/* ── Loading ─────────────────────────────────────────────────────────────── */
.loading-wrap {
  min-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.loading-text {
  font-size: .95rem;
  color: var(--text-2);
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

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

.card-title {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 16px;
}

/* ── File bar ────────────────────────────────────────────────────────────── */
.file-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.file-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.result-filename {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-reset {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border-md);
  border-radius: 6px;
  padding: 6px 12px;
  font: inherit;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}

.btn-reset:hover {
  background: var(--bg);
  color: var(--text);
}

/* ── Alert ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

.alert-warn {
  background: var(--amber-lt);
  border: 1px solid #fbbf24;
  color: #92400e;
}

.subsheet-list {
  margin-top: 6px;
  font-size: .82rem;
  opacity: .85;
}

/* ── Top grid ────────────────────────────────────────────────────────────── */
.top-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}

/* ── Score card ──────────────────────────────────────────────────────────── */
.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.score-ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
}

.score-ring {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 9;
}

.ring-fill {
  fill: none;
  stroke: var(--green);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 251.3;
  stroke-dashoffset: 251.3;
  transition: stroke-dashoffset .9s cubic-bezier(.4,0,.2,1),
              stroke .3s;
}

.score-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0;
}

.score-number {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
  color: var(--text);
}

.score-denom {
  font-size: .72rem;
  color: var(--text-3);
  font-weight: 500;
}

.score-grade {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.grade-A { color: var(--green); }
.grade-B { color: #2563eb; }
.grade-C { color: var(--amber); }
.grade-D { color: #ea580c; }
.grade-F { color: var(--red); }

/* Category bars */
.score-cats { display: flex; flex-direction: column; gap: 10px; }

.cat-row {
  display: grid;
  grid-template-columns: 100px 1fr 36px;
  align-items: center;
  gap: 8px;
}

.cat-label {
  font-size: .78rem;
  color: var(--text-2);
  white-space: nowrap;
}

.cat-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.cat-fill {
  height: 100%;
  border-radius: 3px;
  width: 0;
  transition: width .9s cubic-bezier(.4,0,.2,1);
}

.cat-val {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-2);
  text-align: right;
}

/* Parse stats pills */
.parse-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.stat-pill {
  font-size: .73rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg);
  border-radius: 20px;
  padding: 3px 9px;
}

/* ── Issues card ─────────────────────────────────────────────────────────── */
.issues-card {
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

.issues-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.issues-header .card-title { margin-bottom: 0; }

.badge-row { display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  font-size: .73rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .02em;
}

.badge-error   { background: var(--red-lt);   color: var(--red);   }
.badge-warning { background: var(--amber-lt); color: #92400e;      }
.badge-info    { background: var(--sky-lt);   color: var(--sky);   }
.badge-warn    { background: var(--amber-lt); color: #92400e;      }
.badge-ok      { background: var(--green-lt); color: var(--green); }

.issues-list {
  flex: 1;
  overflow-y: auto;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.no-issues {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: var(--green-lt);
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--green);
}

.issue-item {
  border-radius: 8px;
  padding: 10px 12px;
  border-left: 3px solid transparent;
  background: var(--bg);
}

.issue-item.issue-error   { border-left-color: var(--red);   }
.issue-item.issue-warning { border-left-color: var(--amber); }
.issue-item.issue-info    { border-left-color: var(--sky);   }

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

.issue-sev {
  font-size: .68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .05em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.sev-error   { background: var(--red-lt);   color: var(--red);   }
.sev-warning { background: var(--amber-lt); color: #92400e;      }
.sev-info    { background: var(--sky-lt);   color: var(--sky);   }

.issue-code {
  font-size: .74rem;
  font-weight: 700;
  font-family: "SF Mono", "Cascadia Code", monospace;
  color: var(--text-3);
  flex-shrink: 0;
}

.issue-msg {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

.issue-detail {
  margin-top: 5px;
  margin-left: 1px;
  font-size: .8rem;
  color: var(--text-2);
  line-height: 1.45;
}

/* ── Bottom grid ─────────────────────────────────────────────────────────── */
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.table-card { padding-bottom: 0; }

.table-wrap {
  overflow: auto;
  max-height: 320px;
  margin: 0 -20px;
  padding: 0 20px 20px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
}

.data-table th {
  text-align: left;
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--surface);
}

.data-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td { background: var(--bg); }

.cell-ref {
  font-family: "SF Mono", "Cascadia Code", monospace;
  font-weight: 700;
  font-size: .8rem;
  color: var(--blue);
}

.cell-missing {
  color: var(--text-3);
  font-style: italic;
}

.flag-dnp {
  font-size: .68rem;
  font-weight: 700;
  background: var(--amber-lt);
  color: #92400e;
  border-radius: 4px;
  padding: 1px 5px;
}

.flag-nobom {
  font-size: .68rem;
  font-weight: 700;
  background: var(--bg);
  color: var(--text-3);
  border: 1px solid var(--border-md);
  border-radius: 4px;
  padding: 1px 5px;
}

.net-named { color: var(--text); }
.net-unnamed { color: var(--text-3); font-style: italic; }

/* ── Graph card ──────────────────────────────────────────────────────────── */
.graph-card { margin-top: 16px; }

.graph-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.graph-header .card-title { margin-bottom: 0; }

.graph-sub {
  font-size: .75rem;
  color: var(--text-3);
}

.graph-stats {
  margin-left: auto;
  font-size: .73rem;
  font-weight: 600;
  color: var(--text-3);
  background: var(--bg);
  border-radius: 20px;
  padding: 2px 9px;
}

.graph-subsheet-note {
  font-size: .76rem;
  color: #92400e;
  background: var(--amber-lt);
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 10px;
}

.graph-body {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  min-height: 200px;
}

.graph-canvas-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  background: #f8fafc;
}

.graph-svg {
  display: block;
  width: 100%;
  height: 450px;
  cursor: grab;
}
.graph-svg:active { cursor: grabbing; }

.graph-toolbar {
  position: absolute;
  bottom: 10px;
  right: 10px;
}

.graph-tool-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  padding: 0;
}
.graph-tool-btn:hover { background: var(--bg); color: var(--text); }

/* ── SVG graph elements ── */

/* Sheet frame */
.g-frame {
  fill: none;
  stroke: #cbd5e1;
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 6 4;
  opacity: 0.7;
  pointer-events: none;
}

/* Edge lines — non-scaling so they stay 1.5px regardless of zoom */
.ge {
  fill: none;
  stroke: #94a3b8;
  opacity: 0.5;
  vector-effect: non-scaling-stroke;
  stroke-width: 1.5px;
  pointer-events: none;
}
.ge.ge-named  { stroke: #2563eb; opacity: 0.65; }
.ge.ge-error  { stroke: #dc2626; opacity: 0.9; stroke-width: 2px; }
.ge.ge-warn   { stroke: #d97706; opacity: 0.9; stroke-width: 2px; }

/* Transparent wide hit targets for edge clicks */
.ge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 10px;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}

.gn-label {
  fill: #64748b;
  text-anchor: middle;
  font-family: system-ui, sans-serif;
  pointer-events: none;
  opacity: 0.75;
}

/* ERC001 floating pin markers */
.erc-fp { cursor: pointer; }
.erc-fp-dot {
  fill: #dc2626;
  opacity: 0.9;
  pointer-events: none;
}
.erc-fp-ring {
  fill: none;
  stroke: #dc2626;
  stroke-width: 1.2px;
  vector-effect: non-scaling-stroke;
  opacity: 0.55;
  pointer-events: none;
}

/* Nodes */
.gnode { cursor: pointer; }
.gnode rect {
  fill: #ffffff;
  stroke: #1d4ed8;
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  transition: fill .12s;
}
.gnode:hover rect          { fill: #eff6ff; }
.gnode.selected rect       { fill: #dbeafe; stroke-width: 2px; }
.gnode-erc rect            { stroke: #dc2626; }
.gnode-erc.selected rect   { fill: #fee2e2; stroke: #dc2626; }

.gref {
  fill: #1d4ed8;
  text-anchor: middle;
  font-family: system-ui, sans-serif;
  font-weight: 700;
  pointer-events: none;
}
.gval {
  fill: #64748b;
  text-anchor: middle;
  font-family: system-ui, sans-serif;
  pointer-events: none;
}

/* ── Inspection panel ── */
.graph-panel {
  width: 260px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
  max-height: 450px;
  position: relative;
  padding: 14px;
}

.graph-panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 0;
}
.graph-panel-close:hover { background: var(--bg); color: var(--text); }

.graph-panel-content { }

.panel-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--text-3);
  margin-bottom: 6px;
  padding-right: 24px; /* clear close btn */
}

.panel-ref-chip {
  display: inline-block;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: .82rem;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-light);
  border-radius: 5px;
  padding: 2px 8px;
  margin-bottom: 8px;
  word-break: break-all;
}

.panel-erc-note {
  font-size: .71rem;
  font-weight: 600;
  border-radius: 5px;
  padding: 3px 7px;
  margin-bottom: 8px;
  display: inline-block;
}
.panel-erc-err  { background: var(--red-lt);   color: var(--red); }
.panel-erc-warn { background: var(--amber-lt); color: #92400e; }

.panel-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 5px;
  font-size: .78rem;
}
.pf-key {
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
}
.pf-val { color: var(--text); word-break: break-all; line-height: 1.35; }
.pf-mono { font-family: "SF Mono", "Cascadia Code", Consolas, monospace; font-size: .72rem; }

.panel-sep { height: 1px; background: var(--border); margin: 8px 0; }

/* Pin rows */
.pplist { font-size: .72rem; }

.pprow {
  display: grid;
  grid-template-columns: 2.4em 1fr auto;
  gap: 4px;
  align-items: center;
  padding: 2px 0;
  border-bottom: 1px solid var(--border);
}
.pprow:last-child { border-bottom: none; }
.pprow-float { background: #fff7f7; border-radius: 3px; }

.pp-num {
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-weight: 700;
  color: var(--text);
}
.pp-name {
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pp-type {
  font-size: .62rem;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg);
  color: var(--text-3);
  white-space: nowrap;
}
.pin-type-output      { background: var(--green-lt);   color: var(--green); }
.pin-type-input       { background: var(--blue-light);  color: var(--blue); }
.pin-type-power-in    { background: var(--amber-lt);   color: #92400e; }
.pin-type-power-out   { background: var(--red-lt);     color: var(--red); }
.pin-type-bidirectional { background: var(--sky-lt);   color: var(--sky); }

.pp-float-mark {
  grid-column: 1 / -1;
  font-size: .65rem;
  font-weight: 600;
  color: var(--red);
  padding-top: 1px;
}

/* ── BOM card ────────────────────────────────────────────────────────────── */
.bom-card {
  margin-top: 16px;
  padding-bottom: 0;
}

.bom-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.bom-header .card-title { margin-bottom: 0; }

.bom-sub {
  font-size: .75rem;
  color: var(--text-3);
}

.bom-wrap { max-height: 360px; }

.qty-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: .72rem;
  font-weight: 700;
  border-radius: 20px;
  padding: 0 6px;
}

.fp-cell {
  font-family: "SF Mono", "Cascadia Code", monospace;
  font-size: .77rem;
  color: var(--text-2);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lcsc-pn {
  font-family: "SF Mono", "Cascadia Code", monospace;
  font-size: .77rem;
  font-weight: 600;
  color: var(--text);
}

.lcsc-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .77rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}

.lcsc-link:hover {
  background: var(--blue-light);
  border-color: var(--blue);
}

/* ── Checklist ───────────────────────────────────────────────────────────── */
.checklist-card { margin-top: 16px; margin-bottom: 0; }

.checklist-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.checklist-score {
  font-size: .9rem;
  font-weight: 700;
}

.cl-all-pass   { color: var(--green); }
.cl-mostly-pass { color: var(--amber); }
.cl-fail        { color: var(--red); }

.cl-ready-badge {
  font-size: .73rem;
  font-weight: 700;
  background: var(--green-lt);
  color: var(--green);
  border-radius: 20px;
  padding: 2px 10px;
  letter-spacing: .02em;
}

.checklist-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cl-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.cl-ok       { border-color: #bbf7d0; background: #f0fdf4; }
.cl-fail-item { border-color: #fecaca; background: #fff5f5; }

.cl-icon { flex-shrink: 0; margin-top: 1px; }

.cl-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cl-label {
  font-size: .83rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.cl-detail {
  font-size: .75rem;
  color: var(--text-2);
  line-height: 1.3;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 16px;
  font-size: .75rem;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: auto;
}

/* ── Error toast ─────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e293b;
  color: #f1f5f9;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 999;
  max-width: 480px;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .top-grid        { grid-template-columns: 1fr; }
  .bottom-grid     { grid-template-columns: 1fr; }
  .score-card      { max-width: 100%; }
  .checklist-grid  { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  main { padding: 16px; }
  .cat-row { grid-template-columns: 80px 1fr 32px; }
}
