/* ===================================================================
   NormSight AI — Design tokens
   =================================================================== */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --page:        #0d0d0d;
  --surface:     #17171a;
  --surface-2:   #1e1e22;
  --surface-3:   #26262b;
  --border:      rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.16);
  --text:        #ffffff;
  --text-2:      #c3c2b7;
  --text-muted:  #898781;

  --brand:       #3987e5;
  --brand-ink:   #ffffff;
  --brand-soft:  rgba(57,135,229,0.16);

  --good:        #0ca30c;
  --warning:     #fab219;
  --serious:     #ec835a;
  --critical:    #e66767;
  --info:        #3987e5;

  --cat-blue:    #3987e5;
  --cat-orange:  #d95926;
  --cat-aqua:    #199e70;
  --cat-yellow:  #c98500;
  --cat-magenta: #d55181;
  --cat-green:   #008300;
  --cat-violet:  #9085e9;

  --gridline:    #2c2c2a;
  --dwg-fill:    #1c1c20;
  --dwg-line:    #d8d7cf;
  --dwg-line-faint: #6b6a63;
  --dwg-dim:     #7fa8e0;

  --shadow: 0 8px 24px rgba(0,0,0,0.35);
  --radius: 14px;
  --radius-sm: 9px;
}

[data-theme="light"] {
  color-scheme: light;
  --page:        #f9f9f7;
  --surface:     #ffffff;
  --surface-2:   #fcfcfb;
  --surface-3:   #f1f0ec;
  --border:      rgba(11,11,11,0.10);
  --border-strong: rgba(11,11,11,0.16);
  --text:        #0b0b0b;
  --text-2:      #52514e;
  --text-muted:  #898781;

  --brand:       #2a78d6;
  --brand-ink:   #ffffff;
  --brand-soft:  rgba(42,120,214,0.10);

  --good:        #0ca30c;
  --warning:     #b9790a;
  --serious:     #c85a35;
  --critical:    #d03b3b;
  --info:        #2a78d6;

  --cat-blue:    #2a78d6;
  --cat-orange:  #eb6834;
  --cat-aqua:    #1baf7a;
  --cat-yellow:  #b9790a;
  --cat-magenta: #c14775;
  --cat-green:   #006300;
  --cat-violet:  #4a3aa7;

  --gridline:    #e1e0d9;
  --dwg-fill:    #fbfbfa;
  --dwg-line:    #24232a;
  --dwg-line-faint: #8b8a83;
  --dwg-dim:     #2a78d6;

  --shadow: 0 8px 24px rgba(11,11,11,0.08);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--page);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
ul { list-style: none; margin: 0; padding: 0; }

/* ===================== layout ===================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 256px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; }
.brand-logo { width: 32px; height: 32px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 16px; }
.brand-text span { font-size: 11px; letter-spacing: 0.14em; color: var(--brand); font-weight: 700; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: none; border: none; text-align: left; cursor: pointer;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: background .12s, color .12s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }

.sidebar-foot { padding-top: 12px; }
.plan-card { background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.plan-card-title { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }
.plan-card-sub { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }

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

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(8px); z-index: 20;
}
.topbar-title h1 { margin: 0 0 2px; font-size: 21px; }
.topbar-title p { margin: 0; color: var(--text-muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 24px 28px 60px; flex: 1; }

.view { display: none; animation: fadein .18s ease; }
.view.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===================== buttons / inputs ===================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: filter .12s, background .12s, border-color .12s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-ghost { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-lg { padding: 13px 22px; font-size: 14.5px; }
.icon-btn { padding: 9px; }
.icon-btn svg { width: 18px; height: 18px; }

input[type="text"], input[type="search"], select {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 12px; color: var(--text); outline: none;
}
input[type="text"]:focus, input[type="search"]:focus, select:focus { border-color: var(--brand); }
input::placeholder { color: var(--text-muted); }

.user-chip { display: flex; align-items: center; gap: 10px; padding-left: 8px; border-left: 1px solid var(--border); margin-left: 4px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.25; }
.user-chip-text strong { font-size: 13px; }
.user-chip-text span { font-size: 11.5px; color: var(--text-muted); }

/* theme toggle icon swap */
#theme-toggle .icon-moon { display: none; }
[data-theme="light"] #theme-toggle .icon-sun { display: none; }
[data-theme="light"] #theme-toggle .icon-moon { display: block; }

/* ===================== cards / grids ===================== */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15px; }
.card-head .muted { font-size: 12.5px; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; gap: 14px; align-items: flex-start; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon-blue { background: rgba(57,135,229,0.16); color: var(--brand); }
.stat-icon-critical { background: rgba(230,103,103,0.16); color: var(--critical); }
.stat-icon-good { background: rgba(12,163,12,0.16); color: var(--good); }
.stat-icon-violet { background: rgba(144,133,233,0.16); color: var(--cat-violet); }
.stat-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--text-muted); }
.stat-value { font-size: 24px; font-weight: 700; font-variant-numeric: proportional-nums; }
.stat-value-unit { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.stat-delta { font-size: 11.5px; color: var(--text-muted); }
.stat-delta-up { color: var(--good); }
.stat-delta-down { color: var(--good); }

.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; }
.span-2 { grid-column: span 1; }

/* severity distribution bar */
.severity-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface-3); }
.severity-seg { height: 100%; }
.severity-seg + .severity-seg { border-left: 2px solid var(--surface); }
.severity-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }
.severity-legend li { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

.mini-list li { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.mini-list li:last-child { border-bottom: none; }

/* tags (categorical) */
.tag { display: inline-block; padding: 3px 9px; border-radius: 100px; font-size: 11.5px; font-weight: 600; }
.tag-blue { background: rgba(57,135,229,.16); color: var(--cat-blue); }
.tag-aqua { background: rgba(25,158,112,.16); color: var(--cat-aqua); }
.tag-violet { background: rgba(144,133,233,.18); color: var(--cat-violet); }
.tag-yellow { background: rgba(201,133,0,.18); color: var(--cat-yellow); }
.tag-orange { background: rgba(217,89,38,.18); color: var(--cat-orange); }

/* ===================== tables ===================== */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.row-link { cursor: pointer; }

.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 100px; font-size: 11.5px; font-weight: 700; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.status-offen { background: rgba(250,178,25,.16); color: var(--warning); }
.status-offen::before { background: var(--warning); }
.status-akzeptiert { background: rgba(57,135,229,.16); color: var(--info); }
.status-akzeptiert::before { background: var(--info); }
.status-geloest { background: rgba(12,163,12,.16); color: var(--good); }
.status-geloest::before { background: var(--good); }
.status-abgeschlossen { background: rgba(12,163,12,.16); color: var(--good); }
.status-abgeschlossen::before { background: var(--good); }
.status-inbearbeitung { background: rgba(250,178,25,.16); color: var(--warning); }
.status-inbearbeitung::before { background: var(--warning); }

.score-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; padding: 4px 8px; border-radius: 8px; font-weight: 700; font-size: 12.5px; }
.score-good { background: rgba(12,163,12,.16); color: var(--good); }
.score-mid { background: rgba(250,178,25,.16); color: var(--warning); }
.score-bad { background: rgba(230,103,103,.18); color: var(--critical); }

/* ===================== upload view ===================== */
.upload-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 40px 20px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone-icon { width: 34px; height: 34px; color: var(--brand); margin-bottom: 4px; }
.dropzone p { margin: 0; font-size: 14px; }

.file-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.file-list li {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; font-size: 13px;
}
.file-list .file-icon { width: 16px; height: 16px; color: var(--brand); flex-shrink: 0; }
.file-list .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .file-size { color: var(--text-muted); font-size: 12px; }
.file-list .file-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px; }
.file-list .file-remove:hover { color: var(--critical); }

.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.form-row select, .form-row input[type="text"] { width: 100%; }
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.checkbox { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 400; color: var(--text); cursor: pointer; }
.checkbox input { accent-color: var(--brand); width: 15px; height: 15px; }

.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.seg-btn { background: none; border: none; padding: 7px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.seg-btn.active { background: var(--brand); color: #fff; }

.pipeline { margin-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.pipeline-step { display: flex; align-items: center; gap: 12px; opacity: .4; transition: opacity .2s; }
.pipeline-step.active, .pipeline-step.done { opacity: 1; }
.pipeline-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); flex-shrink: 0; position: relative; }
.pipeline-step.active .pipeline-dot { border-color: var(--brand); animation: pulse-ring 1s infinite; }
.pipeline-step.done .pipeline-dot { border-color: var(--good); background: var(--good); }
.pipeline-step.done .pipeline-dot::after { content: "✓"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 var(--brand-soft); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.pipeline-text { display: flex; flex-direction: column; font-size: 13px; }
.pipeline-text span { color: var(--text-muted); font-size: 12px; }
.progress-track { height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; width: 0%; background: var(--brand); transition: width .3s ease; }

/* ===================== results view ===================== */
.results-head { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.results-head h2 { margin: 0 0 3px; font-size: 19px; }
.results-actions { display: flex; gap: 10px; margin-left: auto; }

.score-badge { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 84px; height: 62px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border); }
.score-num { font-size: 24px; font-weight: 800; line-height: 1; }
.score-label { font-size: 10px; color: var(--text-muted); margin-top: 3px; font-weight: 600; }
.score-badge.sc-good .score-num { color: var(--good); }
.score-badge.sc-mid .score-num { color: var(--warning); }
.score-badge.sc-bad .score-num { color: var(--critical); }

.results-layout { display: grid; grid-template-columns: 1.55fr 1fr; gap: 20px; align-items: start; }
.drawing-card { position: sticky; top: 92px; }
.drawing-viewport { background: var(--dwg-fill); border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
#drawing-svg { width: 100%; height: auto; display: block; }
#drawing-svg text { fill: var(--dwg-line); font-size: 11px; font-family: system-ui, sans-serif; }
.dim-text { fill: var(--dwg-dim) !important; font-size: 10px !important; }
.dim-text-overlap { fill: var(--critical) !important; }
.tb-label { fill: var(--dwg-line-faint) !important; font-size: 9.5px !important; }
.tb-value { fill: var(--dwg-line) !important; font-size: 10.5px !important; font-weight: 600; }
.tb-empty { fill: var(--critical) !important; font-weight: 700; }

.marker { cursor: pointer; }
.marker circle.ring { fill: none; stroke-width: 2; opacity: .55; }
.marker circle.dot { stroke: rgba(0,0,0,.35); stroke-width: 1; }
.marker text { fill: #fff !important; font-size: 10px !important; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.marker.selected .ring { animation: marker-pulse 1.1s infinite; }
.marker:hover circle.dot { filter: brightness(1.2); }
@keyframes marker-pulse { 0% { r: 13; opacity: .55; } 100% { r: 22; opacity: 0; } }

.findings-card { display: flex; flex-direction: column; max-height: calc(100vh - 200px); }
.findings-head { margin-bottom: 12px; }
.count-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 100px; background: var(--surface-3); font-size: 11.5px; margin-left: 6px; font-weight: 700; }
.findings-filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.findings-filters input { flex: 1; min-width: 120px; }
.findings-filters select { flex-shrink: 0; }
.findings-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding-right: 2px; }

.finding-item {
  border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 10px; padding: 12px 14px;
  cursor: pointer; transition: background .12s, border-color .12s; background: var(--surface-2);
}
.finding-item:hover { background: var(--surface-3); }
.finding-item.selected { background: var(--brand-soft); border-color: var(--brand); }
.finding-item.sev-critical { border-left-color: var(--critical); }
.finding-item.sev-major { border-left-color: var(--serious); }
.finding-item.sev-minor { border-left-color: var(--warning); }
.finding-item.sev-info { border-left-color: var(--info); }
.finding-item.resolved { opacity: .55; }

.finding-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.sev-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 100px; text-transform: uppercase; letter-spacing: .02em; }
.sev-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.sev-critical-badge { background: rgba(230,103,103,.16); color: var(--critical); }
.sev-critical-badge::before { background: var(--critical); }
.sev-major-badge { background: rgba(236,131,90,.16); color: var(--serious); }
.sev-major-badge::before { background: var(--serious); }
.sev-minor-badge { background: rgba(250,178,25,.16); color: var(--warning); }
.sev-minor-badge::before { background: var(--warning); }
.sev-info-badge { background: rgba(57,135,229,.16); color: var(--info); }
.sev-info-badge::before { background: var(--info); }
.finding-marker-num { width: 18px; height: 18px; border-radius: 50%; background: var(--surface-3); display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; margin-left: auto; }
.finding-title { font-size: 13.5px; font-weight: 600; margin: 0 0 4px; }
.finding-norm { font-size: 11.5px; color: var(--text-muted); }
.finding-body { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.finding-item.expanded .finding-body { display: block; }
.finding-body .rec { margin-top: 8px; padding: 8px 10px; background: var(--surface-3); border-radius: 7px; font-size: 12px; }
.finding-actions { display: flex; gap: 8px; margin-top: 10px; }
.finding-actions button { flex: 1; padding: 6px 8px; font-size: 11.5px; }

/* ===================== standards ===================== */
.standards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.standard-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.standard-code { font-weight: 700; font-size: 13.5px; color: var(--brand); }
.standard-title { font-size: 13px; margin: 4px 0 8px; }
.standard-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.standard-card .tag { margin-top: 10px; }

/* ===================== architecture ===================== */
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tab-btn { background: none; border: none; padding: 10px 4px; margin-right: 20px; font-size: 13.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.flow { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.flow-node { flex: 1; min-width: 190px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.flow-node strong { font-size: 13px; }
.flow-node span { font-size: 11.5px; color: var(--text-muted); line-height: 1.45; }
.flow-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; margin-bottom: 4px; }
.flow-icon-1 { background: var(--cat-blue); }
.flow-icon-2 { background: var(--cat-violet); }
.flow-icon-3 { background: var(--cat-aqua); }
.flow-icon-4 { background: var(--cat-orange); }
.flow-arrow { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 18px; }

.stack-list li, .check-list li { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stack-list li:last-child, .check-list li:last-child { border-bottom: none; }
.check-list li::before { content: "✓"; color: var(--good); font-weight: 700; flex-shrink: 0; }

/* ===================== settings ===================== */
.profile-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.profile-row strong { display: block; font-size: 14px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.setting-row:last-child { border-bottom: none; }
.setting-row strong { font-size: 13px; display: block; }
.setting-row .muted { font-size: 12px; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border); border-radius: 100px; cursor: pointer; transition: background .15s; }
.slider::before { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(18px); }

.team-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.team-list li:last-child { border-bottom: none; }
.team-list span { display: block; font-size: 11.5px; }

/* ===================== toasts ===================== */
#toast-container { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  border-radius: 10px; padding: 12px 16px; font-size: 13px; display: flex; align-items: center; gap: 10px;
  animation: toast-in .2s ease; max-width: 320px;
}
.toast-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--good); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast.leaving { animation: toast-out .18s ease forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(12px); } }

/* ===================== responsive ===================== */
@media (max-width: 1180px) {
  .results-layout { grid-template-columns: 1fr; }
  .drawing-card { position: static; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform .2s; height: 100vh; }
  .sidebar.open { transform: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .upload-layout { grid-template-columns: 1fr; }
  .checkbox-grid { grid-template-columns: 1fr; }
}

/* ===================== print ===================== */
@media print {
  .sidebar, .topbar, .results-actions, .findings-filters, .finding-actions { display: none !important; }
  .content { padding: 0; }
  .results-layout { grid-template-columns: 1fr; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  body { background: #fff; color: #000; }
}
