:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f7;
  --bg-elevated: #ffffff;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-2: rgba(255, 255, 255, 0.96);
  --surface-hover: #f8fafc;
  --solid: #ffffff;
  --subtle: #f1f5f9;
  --glass: rgba(255, 255, 255, 0.92);
  --glass-soft: rgba(255, 255, 255, 0.75);
  --glass-strong: rgba(255, 255, 255, 0.96);
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --accent: #4f6df5;
  --accent-dim: #3d57e8;
  --accent-glow: rgba(79, 109, 245, 0.22);
  --accent-soft: rgba(79, 109, 245, 0.1);
  --critical: #dc3b43;
  --warning: #d97706;
  --info: #4f6df5;
  --success: #16a34a;
  --on-accent: #ffffff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 2px 4px rgba(15, 23, 42, 0.03), 0 12px 36px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 20px rgba(15, 23, 42, 0.06), 0 28px 56px rgba(15, 23, 42, 0.1);
  --viewer-bg: linear-gradient(180deg, #e8edf4 0%, #dfe6ef 100%);
  --viewer-inset: rgba(255, 255, 255, 0.9);
  --upload-bg: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(248,250,252,0.6) 100%);
  --upload-hover: linear-gradient(180deg, rgba(255,255,255,0.7) 0%, rgba(248,250,252,0.5) 100%);
  --scan-overlay-bg: rgba(238, 242, 248, 0.72);
  --stage-bg: #ffffff;
  --marker-spot-ring: rgba(255, 255, 255, 0.85);
  --toast-error-bg: #fff5f5;
  --fm-ribbon-bg: linear-gradient(135deg, rgba(79, 109, 245, 0.06) 0%, rgba(255, 255, 255, 0.9) 55%);
  --tabs-bar-bg: rgba(248, 250, 252, 0.8);
  --app-bg-base: linear-gradient(165deg, #f6f8fc 0%, #eef1f7 42%, #e9edf5 100%);
  --app-bg-blob-a: rgba(99, 130, 255, 0.22);
  --app-bg-blob-b: rgba(186, 154, 255, 0.16);
  --app-bg-radial-a: rgba(79, 109, 245, 0.14);
  --app-bg-radial-b: rgba(167, 139, 250, 0.1);
  --app-bg-radial-c: rgba(56, 189, 248, 0.08);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f17;
  --bg-elevated: #141b26;
  --surface: rgba(20, 27, 38, 0.88);
  --surface-2: rgba(24, 32, 45, 0.96);
  --surface-hover: #1a2332;
  --solid: #141b26;
  --subtle: rgba(148, 163, 184, 0.12);
  --glass: rgba(20, 27, 38, 0.92);
  --glass-soft: rgba(20, 27, 38, 0.78);
  --glass-strong: rgba(24, 32, 45, 0.98);
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #e8edf5;
  --text-soft: #cbd5e1;
  --muted: #94a3b8;
  --accent: #6b8cff;
  --accent-dim: #8ba3ff;
  --accent-glow: rgba(107, 140, 255, 0.28);
  --accent-soft: rgba(107, 140, 255, 0.14);
  --critical: #f87171;
  --warning: #fbbf24;
  --info: #6b8cff;
  --success: #4ade80;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 14px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.3), 0 12px 36px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.35), 0 28px 56px rgba(0, 0, 0, 0.45);
  --viewer-bg: linear-gradient(180deg, #121820 0%, #0e131b 100%);
  --viewer-inset: rgba(255, 255, 255, 0.04);
  --upload-bg: linear-gradient(180deg, rgba(24, 32, 45, 0.85) 0%, rgba(20, 27, 38, 0.65) 100%);
  --upload-hover: linear-gradient(180deg, rgba(30, 40, 56, 0.9) 0%, rgba(20, 27, 38, 0.75) 100%);
  --scan-overlay-bg: rgba(11, 15, 23, 0.78);
  --stage-bg: #ffffff;
  --marker-spot-ring: rgba(15, 23, 42, 0.85);
  --toast-error-bg: rgba(127, 29, 29, 0.35);
  --fm-ribbon-bg: linear-gradient(135deg, rgba(107, 140, 255, 0.1) 0%, rgba(20, 27, 38, 0.95) 55%);
  --tabs-bar-bg: rgba(14, 19, 27, 0.85);
  --app-bg-base: linear-gradient(165deg, #0b0f17 0%, #0e131b 42%, #121820 100%);
  --app-bg-blob-a: rgba(79, 109, 245, 0.12);
  --app-bg-blob-b: rgba(139, 92, 246, 0.08);
  --app-bg-radial-a: rgba(79, 109, 245, 0.08);
  --app-bg-radial-b: rgba(167, 139, 250, 0.06);
  --app-bg-radial-c: rgba(56, 189, 248, 0.05);
}

[data-theme="dark"] .fm-stat.critical { background: rgba(248, 113, 113, 0.12); }
[data-theme="dark"] .fm-stat.warning { background: rgba(251, 191, 36, 0.12); }
[data-theme="dark"] .fm-stat.info { background: rgba(107, 140, 255, 0.12); }
[data-theme="dark"] .fc-status.open { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
[data-theme="dark"] .fc-status.fixed { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
[data-theme="dark"] .fc-tag.ai { background: rgba(139, 92, 246, 0.18); color: #c4b5fd; }
[data-theme="dark"] .fc-conf.hi { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
[data-theme="dark"] .fc-conf.mid { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
[data-theme="dark"] .fc-conf.lo { background: rgba(248, 113, 113, 0.15); color: #f87171; }
[data-theme="dark"] .badge-ok { color: #4ade80; background: rgba(74, 222, 128, 0.12); }
[data-theme="dark"] .badge-warn { color: #fbbf24; background: rgba(251, 191, 36, 0.12); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(2%, -3%) scale(1.04); }
  66% { transform: translate(-2%, 2%) scale(0.98); }
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes scanSweep {
  0% { top: -4%; opacity: 0.6; }
  10% { opacity: 1; }
  50% { top: 100%; opacity: 1; }
  90% { opacity: 0.6; }
  100% { top: -4%; opacity: 0.6; }
}
@keyframes markerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 109, 245, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(79, 109, 245, 0); }
}
@keyframes ringPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.08); opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse 85% 55% at 12% -8%, var(--app-bg-radial-a), transparent 58%),
    radial-gradient(ellipse 55% 45% at 92% 8%, var(--app-bg-radial-b), transparent 52%),
    radial-gradient(ellipse 50% 40% at 48% 105%, var(--app-bg-radial-c), transparent 55%),
    var(--app-bg-base);
}
.app-bg::before,
.app-bg::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  animation: floatBlob 22s ease-in-out infinite;
}
.app-bg::before {
  width: 520px; height: 520px;
  top: -120px; left: -80px;
  background: var(--app-bg-blob-a);
}
.app-bg::after {
  width: 440px; height: 440px;
  bottom: -100px; right: -60px;
  background: var(--app-bg-blob-b);
  animation-delay: -11s;
  animation-duration: 26s;
}

body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
}
button, select, input, textarea { font: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: .78rem; }

.app-shell {
  max-width: 1720px;
  margin: 0 auto;
  padding: 1.1rem 1.35rem 1.6rem;
  animation: panelIn 0.55s var(--ease-out) both;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: .75rem 1.1rem;
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  animation: panelIn 0.6s var(--ease-out) 0.05s both;
  transition: box-shadow 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.header:hover { box-shadow: var(--shadow-md); }
.brand { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.brand-mark {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(79, 109, 245, 0.2);
  box-shadow: 0 4px 16px rgba(79, 109, 245, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 0.35s var(--ease-spring), box-shadow 0.35s var(--ease-out);
}
.brand-mark:hover { transform: scale(1.04) rotate(-2deg); box-shadow: 0 8px 24px rgba(79, 109, 245, 0.18); }
.brand-logo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.brand-text { min-width: 0; }
.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.2;
}
.brand p {
  margin: .12rem 0 0;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-status { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass-soft);
  color: var(--text-soft);
  transition: border-color 0.2s var(--ease-out), background 0.2s, color 0.2s, transform 0.2s var(--ease-spring), box-shadow 0.2s;
}
.theme-toggle:hover {
  border-color: var(--border-strong);
  background: var(--solid);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.theme-icon { display: none; }
html[data-theme-pref="light"] .theme-icon-sun { display: block; }
html[data-theme-pref="dark"] .theme-icon-moon { display: block; }
html[data-theme-pref="system"] .theme-icon-system { display: block; }
.badge {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .02em;
  padding: .34rem .62rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
  background: var(--glass-soft);
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease-out);
}
.badge:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.badge-muted { color: var(--muted); }
.badge-ok { color: #15803d; border-color: rgba(22, 163, 74, 0.25); background: rgba(22, 163, 74, 0.08); }
.badge-off { color: var(--muted); }
.badge-warn { color: #b45309; border-color: rgba(217, 119, 6, 0.25); background: rgba(217, 119, 6, 0.08); }
.badge-plan { color: var(--accent-dim, #0f766e); border-color: rgba(15, 118, 110, 0.28); background: rgba(15, 118, 110, 0.08); }
.badge-plan.pro { color: #1d4ed8; border-color: rgba(37, 99, 235, 0.28); background: rgba(37, 99, 235, 0.1); }
.btn-upgrade {
  width: auto;
  margin: 0;
  padding: .34rem .75rem;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f766e, #1d4ed8);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-sm);
}
.btn-upgrade:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.05); }
.btn-upgrade[hidden] { display: none !important; }
[data-theme="dark"] .badge-plan { color: #5eead4; background: rgba(45, 212, 191, 0.12); border-color: rgba(45, 212, 191, 0.28); }
[data-theme="dark"] .badge-plan.pro { color: #93c5fd; background: rgba(59, 130, 246, 0.16); border-color: rgba(59, 130, 246, 0.35); }

.layout { display: grid; grid-template-columns: 320px 1fr 360px; gap: .9rem; height: calc(100vh - 112px); }
.layout-ready .panel { animation: panelIn 0.55s var(--ease-out) both; }
.layout-ready .panel:nth-child(1) { animation-delay: 0.08s; }
.layout-ready .panel:nth-child(2) { animation-delay: 0.14s; }
.layout-ready .panel:nth-child(3) { animation-delay: 0.2s; }
.panel {
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.35s var(--ease-out), transform 0.35s var(--ease-out);
}
.panel:hover { box-shadow: var(--shadow-lg); }
.panel-header {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .82rem;
  letter-spacing: .02em;
  color: var(--text-soft);
  background: var(--upload-bg);
}
.panel-body { padding: 1rem; overflow: auto; flex: 1; min-height: 0; }

/* upload */
.upload-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 1.4rem 1rem;
  text-align: center;
  transition: border-color 0.25s var(--ease-out), background 0.25s var(--ease-out),
              box-shadow 0.25s var(--ease-out), transform 0.25s var(--ease-spring);
  cursor: pointer;
  background: var(--upload-hover);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: rgba(79, 109, 245, 0.45);
  background: rgba(79, 109, 245, 0.06);
  box-shadow: inset 0 0 0 1px rgba(79, 109, 245, 0.1), var(--shadow-sm);
  transform: translateY(-2px);
}
.upload-zone input { display: none; }
.dz-icon {
  color: var(--accent);
  margin-bottom: .5rem;
  display: inline-flex;
  padding: .6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(79, 109, 245, 0.15);
  transition: transform 0.35s var(--ease-spring);
}
.upload-zone:hover .dz-icon { transform: scale(1.06) translateY(-2px); }
.dz-name { margin: 0; font-weight: 600; font-size: .9rem; word-break: break-all; color: var(--text-soft); }
.dz-hint { margin: .35rem 0 0; font-size: .76rem; color: var(--muted); }

.field { margin-top: .85rem; }
.field label { display: block; font-size: .7rem; color: var(--muted); margin-bottom: .35rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.field select {
  width: 100%;
  padding: .58rem .7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
.field select:focus { outline: none; border-color: rgba(79, 109, 245, 0.45); box-shadow: 0 0 0 3px var(--accent-glow); }
.ai-mode { margin-top: .8rem; }
.ai-mode > label:first-child {
  display: block; font-size: .7rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: .35rem;
}
.engine-summary { margin: .35rem 0 .6rem; padding: 0 .1rem; }
.preflight-box {
  margin-top: .85rem; padding: .75rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--glass-soft);
  animation: fadeUp 0.45s var(--ease-out) both;
}
.preflight-head { display: flex; justify-content: space-between; align-items: center;
  font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .35rem; }
.preflight-score { font-family: 'IBM Plex Mono', monospace; font-size: .82rem; padding: .15rem .45rem; border-radius: 6px; border: 1px solid var(--border); }
.preflight-score.good { color: #15803d; border-color: rgba(22, 163, 74, 0.3); background: rgba(22, 163, 74, 0.06); }
.preflight-score.fair { color: #b45309; border-color: rgba(217, 119, 6, 0.3); background: rgba(217, 119, 6, 0.06); }
.preflight-score.poor { color: #dc3b43; border-color: rgba(220, 59, 67, 0.3); background: rgba(220, 59, 67, 0.06); }
.preflight-list { margin: .35rem 0 0; padding-left: 1.1rem; font-size: .76rem; color: var(--text-soft); line-height: 1.45; }
.preflight-details { margin-top: .45rem; font-size: .76rem; color: var(--muted); }
.preflight-details summary { cursor: pointer; color: var(--accent); }
.check { display: flex; align-items: center; gap: .5rem; font-size: .84rem; margin-top: .8rem; color: var(--text-soft); }
.check input[type="checkbox"] { accent-color: var(--accent); }

.btn {
  width: 100%;
  padding: .74rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .88rem;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.25s var(--ease-out), background 0.2s, opacity 0.2s;
  margin-top: 1rem;
}
.btn-primary {
  background: linear-gradient(135deg, #5b7cfa 0%, #4f6df5 48%, #4560eb 100%);
  color: var(--on-accent);
  box-shadow: 0 4px 16px rgba(79, 109, 245, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.18) 50%, transparent 60%);
  background-size: 200% 100%;
  opacity: 0;
  transition: opacity 0.3s;
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #6785fb 0%, #5a76f6 48%, #4f6df5 100%);
  box-shadow: 0 8px 24px rgba(79, 109, 245, 0.38);
  transform: translateY(-2px);
}
.btn-primary:hover:not(:disabled)::after { opacity: 1; animation: shimmer 1.2s ease infinite; }
.btn-primary:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-ghost { background: var(--glass-soft); color: var(--text-soft); border: 1px solid var(--border); margin-top: 0; }
.btn-ghost:hover:not(:disabled) { border-color: var(--border-strong); background: var(--solid); color: var(--text); transform: translateY(-1px); }
.export-box { display: flex; flex-direction: column; gap: .45rem; margin-top: 1rem; }
.tbtn-accent { background: linear-gradient(135deg, #5b7cfa, #4f6df5); color: var(--on-accent); border-color: transparent; font-weight: 600; box-shadow: 0 2px 10px rgba(79, 109, 245, 0.25); }
.tbtn-accent:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(79, 109, 245, 0.32); }

.loading { display: flex; align-items: center; gap: .65rem; color: var(--muted); font-size: .86rem; margin-top: 1rem; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.error-msg { color: var(--critical); font-size: .84rem; margin-top: .75rem; }

/* DWG converter setup */
.dwg-setup {
  margin-top: .8rem;
  padding: .75rem;
  border: 1px solid rgba(107, 156, 247, 0.2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: rgba(107, 156, 247, 0.05);
}
.dwg-head { display: flex; align-items: center; gap: .45rem; font-size: .88rem; margin-bottom: .4rem; }
.dwg-icon { font-size: 1rem; }
.dwg-msg { font-size: .8rem; color: var(--muted); margin: 0 0 .6rem; line-height: 1.45; }
.dwg-bar { height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-bottom: .6rem; }
.dwg-bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.dwg-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.btn-sm { padding: .4rem .7rem; font-size: .8rem; margin-top: 0; width: auto; }
.dwg-manual { font-size: .78rem; color: var(--accent); text-decoration: none; }
.dwg-manual:hover { text-decoration: underline; }

.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: .45rem; margin-top: 1rem; }
.stat {
  background: var(--glass-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .5rem;
  text-align: center;
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease-out);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat .num { font-size: 1.35rem; font-weight: 700; font-family: 'IBM Plex Mono', monospace; letter-spacing: -0.02em; }
.stat .lbl { font-size: .64rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin-top: .1rem; }
.stat.critical .num { color: var(--critical); }
.stat.warning .num { color: var(--warning); }
.stat.info .num { color: var(--info); }

/* viewer */
.viewer {
  background: var(--viewer-bg);
  position: relative;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 var(--viewer-inset);
  overflow: hidden;
}

/* scanning animation overlay */
.scan-overlay {
  position: absolute; inset: 0; z-index: 20; overflow: hidden;
  background: var(--scan-overlay-bg);
  backdrop-filter: blur(4px) saturate(1.2);
  pointer-events: none;
  animation: fadeUp 0.3s var(--ease-out) both;
}
.scan-grid {
  position: absolute; inset: 0; opacity: .18;
  background-image: linear-gradient(rgba(79, 109, 245, 0.2) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(79, 109, 245, 0.2) 1px, transparent 1px);
  background-size: 40px 40px;
}
.scan-line {
  position: absolute; left: 0; right: 0; height: 2px; top: 0;
  background: linear-gradient(90deg, transparent, #4f6df5 20%, #818cf8 50%, #4f6df5 80%, transparent);
  box-shadow: 0 0 20px 4px rgba(79, 109, 245, 0.35);
  animation: scanSweep 2s ease-in-out infinite;
}
.scan-line::after {
  content: ""; position: absolute; left: 0; right: 0; top: 2px; height: 80px;
  background: linear-gradient(180deg, rgba(79, 109, 245, 0.15), transparent);
}
.scan-status {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; align-items: center; gap: .6rem; padding: .65rem 1.1rem; border-radius: 24px;
  background: var(--glass); border: 1px solid var(--border); color: var(--text);
  font-size: .85rem; box-shadow: var(--shadow-md);
  animation: fadeUp 0.4s var(--ease-out) 0.1s both;
  min-width: min(420px, 88vw);
}
.scan-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 200px;
}
.scan-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--subtle);
  overflow: hidden;
}
.scan-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  transition: width 0.45s var(--ease-out);
}
.loading .scan-progress-wrap { flex: 1; min-width: 0; }
.viewer-toolbar {
  display: flex; align-items: center; gap: .45rem; padding: .55rem .75rem;
  border-bottom: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(12px) saturate(1.3);
}
.tbtn {
  padding: .36rem .6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--glass-soft);
  color: var(--text-soft);
  font-size: .78rem;
  font-weight: 500;
  transition: border-color 0.2s var(--ease-out), background 0.2s, color 0.2s, transform 0.2s var(--ease-spring), box-shadow 0.2s;
}
.tbtn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--solid);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.tbtn.on {
  background: var(--accent-soft);
  border-color: rgba(79, 109, 245, 0.35);
  color: var(--accent-dim);
  font-weight: 600;
}
.tbtn:disabled { opacity: .35; cursor: not-allowed; }
.viewer-name { font-size: .8rem; color: var(--muted); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex: 1; }
.divider { width: 1px; height: 18px; background: var(--border); margin: 0 .2rem; }
.scan-spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; }
.page-label { font-size: .78rem; color: var(--muted); min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }
.toggle { display: flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--muted); }

.viewer-canvas-wrap { flex: 1; overflow: auto; display: grid; place-items: center; padding: 1.2rem; min-height: 0; position: relative; }
.viewer-canvas-wrap.summary-mode {
  display: flex;
  flex-direction: column;
  place-items: stretch;
  align-items: stretch;
  padding: 0.75rem;
  gap: 0.75rem;
  overflow: auto;
}
.viewer-canvas-wrap.summary-mode .stage {
  flex-shrink: 0;
  align-self: center;
  margin: 0 auto;
}

/* Findings map overview */
.findings-map {
  flex: 1;
  min-height: 200px;
  max-height: 44vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px) saturate(1.2);
  overflow: hidden;
  animation: fadeUp 0.45s var(--ease-out) both;
}
.fm-ribbon {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--fm-ribbon-bg);
}
.fm-ribbon-title { flex: 1; min-width: 180px; }
.fm-ribbon-title h2 { margin: 0; font-size: 1rem; font-weight: 700; letter-spacing: -0.02em; }
.fm-ribbon-title p { margin: 0.15rem 0 0; }
.fm-ribbon-stats { display: flex; gap: 0.55rem; flex-wrap: wrap; }
.fm-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--glass);
  transition: transform 0.2s var(--ease-spring);
}
.fm-stat:hover { transform: translateY(-2px); }
.fm-stat.critical { border-color: rgba(220, 59, 67, 0.3); background: rgba(254, 226, 226, 0.5); }
.fm-stat.warning { border-color: rgba(217, 119, 6, 0.3); background: rgba(254, 243, 199, 0.5); }
.fm-stat.info { border-color: rgba(79, 109, 245, 0.3); background: rgba(219, 234, 254, 0.5); }
.fm-num { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.fm-stat.critical .fm-num { color: var(--critical); }
.fm-stat.warning .fm-num { color: var(--warning); }
.fm-stat.info .fm-num { color: var(--info); }
.fm-lbl { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; margin-top: 0.1rem; }
.fm-ribbon-meta { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.76rem; color: var(--muted); text-align: right; }
.fm-page-hint { font-size: 0.7rem; opacity: 0.85; }
.fm-close { margin-left: auto; flex-shrink: 0; }
.fm-sections {
  flex: 1;
  overflow: auto;
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.fm-empty { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: 0.85rem; }
.fm-group { animation: fadeUp 0.4s var(--ease-out) both; }
.fm-group:nth-child(1) { animation-delay: 0.05s; }
.fm-group:nth-child(2) { animation-delay: 0.1s; }
.fm-group:nth-child(3) { animation-delay: 0.15s; }
.fm-group-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--border);
}
.fm-group.sev-critical .fm-group-head { border-bottom-color: rgba(220, 59, 67, 0.35); }
.fm-group.sev-warning .fm-group-head { border-bottom-color: rgba(217, 119, 6, 0.35); }
.fm-group.sev-info .fm-group-head { border-bottom-color: rgba(79, 109, 245, 0.35); }
.fm-group-head h3 { margin: 0; font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.fm-count {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--muted);
}
.fm-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.55rem;
}
.fm-card {
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.72rem;
  cursor: pointer;
  background: var(--glass-soft);
  transition: border-color 0.22s, background 0.22s, transform 0.22s var(--ease-spring), box-shadow 0.22s;
}
.fm-card:hover {
  border-color: rgba(79, 109, 245, 0.35);
  background: var(--solid);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.fm-card.active {
  border-color: rgba(79, 109, 245, 0.5);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.fm-card.hover:not(.active) {
  border-color: rgba(79, 109, 245, 0.35);
  background: var(--glass-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.fm-card.other-page { opacity: 0.88; }
.fm-card.other-page::after {
  content: "↗ other sheet";
  display: block;
  font-size: 0.62rem;
  color: var(--accent-dim);
  margin-top: 0.25rem;
  font-weight: 600;
}
.fm-card.sev-critical { border-left-color: var(--critical); }
.fm-card.sev-warning { border-left-color: var(--warning); }
.fm-card.sev-info { border-left-color: var(--info); }
.fm-card-top { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.2rem; flex-wrap: wrap; }
.fm-id { font-family: 'IBM Plex Mono', monospace; font-size: 0.68rem; color: var(--muted); font-weight: 600; }
.fm-page {
  font-size: 0.62rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--subtle);
  color: var(--muted);
  font-weight: 600;
}
.fm-card h4 { margin: 0; font-size: 0.84rem; line-height: 1.35; }
.fm-card p {
  margin: 0.3rem 0 0;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fm-card-foot { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.4rem; }
.fm-hint { font-size: 0.62rem; color: var(--success); font-weight: 600; }

.fm-sheet-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 12;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
  background: var(--glass);
  border: 1px solid rgba(79, 109, 245, 0.35);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(8px);
  animation: fadeUp 0.35s var(--ease-out) both;
}
.fm-sheet-badge span { color: var(--accent-dim); font-weight: 700; }

.stage.summary-markers .marker-item.summary-on .marker-ring {
  animation: markerPulse 2s ease-out infinite;
  transform: translate(-50%, -50%) scale(1.05);
}
.stage.summary-markers .marker-item.summary-on .marker-tag {
  font-size: 11px;
  padding: 3px 8px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

.viewer-empty { color: var(--muted); text-align: center; padding: 3rem 1rem; }
.stage {
  position: relative;
  line-height: 0;
  box-shadow: var(--shadow-lg);
  background: var(--stage-bg);
  border-radius: 6px;
  transition: box-shadow 0.35s var(--ease-out);
}
.stage:hover { box-shadow: var(--shadow-lg); }
.stage img { display: block; max-width: none; }
.markers { position: absolute; inset: 0; pointer-events: none; }
.marker-item { position: absolute; inset: 0; pointer-events: none; }
.marker-item.active { z-index: 8; }
.marker-item.hover { z-index: 7; }
.markers.hover-mode .marker-item.dimmed .marker-ring,
.markers.hover-mode .marker-item.dimmed .marker-spot,
.markers.hover-mode .marker-item.dimmed .marker-tag,
.markers.hover-mode .marker-item.dimmed .marker-box {
  opacity: 0.22;
  transform: translate(-50%, -50%) scale(0.92);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.markers.hover-mode .marker-item.dimmed .marker-tag { transform: none; opacity: 0.2; }
.marker-item.hover .marker-ring {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 14px rgba(79, 109, 245, 0.25);
}
.marker-ring {
  position: absolute; left: var(--px); top: var(--py);
  width: 34px; height: 34px; transform: translate(-50%, -50%);
  border: 2px solid var(--warning); border-radius: 50%;
  background: rgba(217, 119, 6, 0.08); pointer-events: auto; cursor: pointer;
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s, border-color 0.2s;
  animation: ringPulse 2.4s ease-in-out infinite;
}
.marker-item.active .marker-ring {
  animation: markerPulse 1.6s ease-out infinite;
  transform: translate(-50%, -50%) scale(1.12);
  box-shadow: 0 0 0 3px rgba(79, 109, 245, 0.35), 0 0 16px rgba(217, 119, 6, 0.25);
}
.marker-item.sev-critical .marker-ring { border-color: var(--critical); background: rgba(220, 59, 67, 0.08); animation: none; }
.marker-item.sev-info .marker-ring { border-color: var(--info); background: rgba(79, 109, 245, 0.08); }
.marker-item.sev-critical.active .marker-ring { box-shadow: 0 0 0 3px rgba(220, 59, 67, 0.35), 0 0 16px rgba(220, 59, 67, 0.2); animation: markerPulse 1.6s ease-out infinite; }
.marker-spot {
  position: absolute; left: var(--px); top: var(--py);
  width: 7px; height: 7px; transform: translate(-50%, -50%);
  border-radius: 50%; background: var(--warning);
  box-shadow: 0 0 0 2px var(--marker-spot-ring);
  pointer-events: auto; cursor: pointer;
}
.marker-item.sev-critical .marker-spot { background: var(--critical); }
.marker-item.sev-info .marker-spot { background: var(--info); }
.marker-tag {
  position: absolute; left: calc(var(--px) + 18px); top: calc(var(--py) - 30px);
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px; color: var(--on-accent); background: var(--warning);
  white-space: nowrap; line-height: 1.4; pointer-events: auto; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.marker-item.sev-critical .marker-tag { background: var(--critical); }
.marker-item.sev-info .marker-tag { background: var(--info); }
.marker-tag::before {
  content: ""; position: absolute; left: -10px; bottom: 4px;
  width: 10px; height: 2px; background: currentColor; opacity: .85;
  transform: rotate(-28deg); transform-origin: right center;
}
.marker-box {
  position: absolute; border: 1.5px dashed rgba(249,115,22,.75);
  border-radius: 2px; background: rgba(249,115,22,.05);
  pointer-events: auto; cursor: pointer;
}
.marker-item.sev-critical .marker-box { border-color: rgba(239,68,68,.8); background: rgba(239,68,68,.06); }
.marker-item.sev-info .marker-box { border-color: rgba(59,130,246,.75); background: rgba(59,130,246,.05); }

/* legacy marker class (exported PDF preview compat) */
.marker { position: absolute; border: 2px solid var(--warning); border-radius: 3px; background: rgba(249,115,22,.08); cursor: pointer; transition: .12s; }
.marker.sev-critical { border-color: var(--critical); background: rgba(239,68,68,.08); }
.marker.sev-info { border-color: var(--info); background: rgba(59,130,246,.08); }
.marker.active { box-shadow: 0 0 0 3px rgba(59,130,246,.6); z-index: 5; }
.marker .tag { position: absolute; top: -16px; left: -2px; font-family: 'IBM Plex Mono', monospace; font-size: 10px;
  padding: 1px 5px; border-radius: 4px; color: var(--on-accent); background: var(--warning); white-space: nowrap; line-height: 1.4; }
.marker.sev-critical .tag { background: var(--critical); }
.marker.sev-info .tag { background: var(--info); }

/* tabs */
.tabs {
  display: flex;
  gap: .35rem;
  padding: .5rem;
  border-bottom: 1px solid var(--border);
  background: var(--tabs-bar-bg);
}
.tab {
  flex: 1;
  padding: .5rem .35rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 500;
  transition: background 0.22s var(--ease-out), color 0.22s, transform 0.2s var(--ease-spring);
}
.tab:hover { color: var(--text-soft); background: var(--glass-soft); }
.tab.active {
  background: var(--solid);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
  transform: translateY(-1px);
}

.filters { display: flex; gap: .35rem; margin-bottom: .75rem; flex-wrap: wrap; }
.chip {
  font-size: .74rem;
  font-weight: 600;
  padding: .36rem .68rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass-soft);
  color: var(--muted);
  transition: background 0.2s var(--ease-out), border-color 0.2s, color 0.2s, transform 0.2s var(--ease-spring);
}
.chip:hover { border-color: var(--border-strong); color: var(--text-soft); transform: translateY(-1px); }
.chip-on {
  background: var(--accent-soft);
  border-color: rgba(79, 109, 245, 0.35);
  color: var(--accent-dim);
  box-shadow: 0 2px 8px rgba(79, 109, 245, 0.12);
}

.finding-list { display: flex; flex-direction: column; gap: .5rem; }
.finding-card {
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  padding: .72rem .75rem;
  cursor: pointer;
  transition: border-color 0.22s var(--ease-out), background 0.22s, transform 0.22s var(--ease-spring), box-shadow 0.22s;
  background: var(--glass-soft);
  animation: fadeUp 0.4s var(--ease-out) both;
}
.finding-card:hover {
  border-color: rgba(79, 109, 245, 0.3);
  background: var(--solid);
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}
.finding-card.active {
  border-color: rgba(79, 109, 245, 0.45);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-glow);
  transform: translateX(4px);
}
.finding-card.hover:not(.active) {
  border-color: rgba(79, 109, 245, 0.28);
  background: var(--glass-soft);
  transform: translateX(2px);
}
.finding-list .finding-card:nth-child(1) { animation-delay: 0.03s; }
.finding-list .finding-card:nth-child(2) { animation-delay: 0.06s; }
.finding-list .finding-card:nth-child(3) { animation-delay: 0.09s; }
.finding-list .finding-card:nth-child(4) { animation-delay: 0.12s; }
.finding-list .finding-card:nth-child(5) { animation-delay: 0.15s; }
.finding-list .finding-card:nth-child(n+6) { animation-delay: 0.18s; }
.finding-card.sev-critical { border-left-color: var(--critical); }
.finding-card.sev-warning { border-left-color: var(--warning); }
.finding-card.sev-info { border-left-color: var(--info); }
.fc-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.severity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.severity-dot.critical { background: var(--critical); }
.severity-dot.warning { background: var(--warning); }
.severity-dot.info { background: var(--info); }
.fc-id { font-family: 'IBM Plex Mono', monospace; font-size: .68rem; color: var(--muted); }
.fc-tags { margin-left: auto; display: flex; gap: .3rem; }
.fc-tag { font-size: .62rem; text-transform: uppercase; letter-spacing: .04em; padding: .12rem .4rem; border-radius: 4px; background: var(--subtle); color: var(--muted); }
.fc-tag.ai { background: #ede9fe; color: #6d28d9; }
.finding-card h4 { margin: .1rem 0 0; font-size: .88rem; }
.finding-card p { margin: .3rem 0 0; font-size: .8rem; color: var(--muted); line-height: 1.45; }
.empty { color: var(--muted); text-align: center; padding: 2.5rem 1rem; font-size: .85rem; }

.fc-status { font-size: .6rem; text-transform: uppercase; letter-spacing: .04em; padding: .12rem .4rem; border-radius: 4px; font-weight: 700; }
.fc-status.open { background: #fef3c7; color: #b45309; }
.fc-status.fixed { background: #dcfce7; color: #15803d; }
.fc-status.waived { background: var(--subtle); color: var(--muted); }
.finding-card.is-waived { opacity: .6; }
.finding-card.is-fixed { border-left-color: var(--success) !important; }

.signoff { margin-top: .85rem; }
.signoff h5 { margin: 0 0 .35rem; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.signoff-btns { display: flex; gap: .4rem; margin-bottom: .5rem; }
.sobtn { flex: 1; padding: .4rem; border-radius: 6px; border: 1px solid var(--border); background: var(--solid); color: var(--text); font-size: .76rem; font-weight: 600; transition: transform 0.2s var(--ease-spring); }
.sobtn:hover { transform: translateY(-1px); }
.sobtn.active.open { background: #d97706; border-color: transparent; color: var(--on-accent); }
.sobtn.active.fixed { background: var(--success); border-color: transparent; color: var(--on-accent); }
.sobtn.active.waived { background: #94a3b8; border-color: transparent; color: var(--on-accent); }
.signoff textarea { width: 100%; min-height: 54px; resize: vertical; padding: .5rem; border-radius: 6px; border: 1px solid var(--border); background: var(--solid); color: var(--text); font: inherit; font-size: .82rem; }
.signoff .save-note { margin-top: .4rem; width: 100%; }

.measure-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.stage.measuring { cursor: crosshair; }
.measure-banner {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 25;
  background: var(--glass); border: 1px solid rgba(79, 109, 245, 0.35);
  color: var(--text); padding: .5rem .95rem; border-radius: 20px; font-size: .82rem;
  box-shadow: var(--shadow-md); animation: fadeUp 0.35s var(--ease-out) both;
}
.b-crit { background: #fee2e2; color: #dc3b43; }
.b-warn { background: #fef3c7; color: #b45309; }
.b-info { background: #dbeafe; color: #2563eb; }

.revdiff-box {
  margin-top: 1rem;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: .45rem;
  background: var(--glass-soft);
}

.modal { position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, 0.35); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 2rem;
  animation: fadeUp 0.25s var(--ease-out) both;
}
.modal-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px;
  width: min(1100px, 96vw); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-lg); animation: panelIn 0.4s var(--ease-out) 0.05s both;
}
.revdiff-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.revfile { display: flex; flex-direction: column; gap: .2rem; font-size: .76rem; color: var(--muted); }
.revfile input { font-size: .76rem; color: var(--text); }

.std-library { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.std-lib-list { display: flex; flex-direction: column; gap: .35rem; margin-top: .5rem; }
.std-lib-item { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .8rem; padding: .35rem .5rem; background: var(--solid); border: 1px solid var(--border); border-radius: 8px; }
.std-lib-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-item { cursor: pointer; transition: border-color 0.2s, transform 0.2s var(--ease-spring); }
.batch-item:hover { border-color: var(--accent); transform: translateX(2px); }
.batch-badges { display: inline-flex; gap: .4rem; flex: none; }
.batch-badges b { font-size: .72rem; padding: 0 .3rem; border-radius: 3px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.2rem; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; padding: 1.2rem; overflow: auto; }
.paywall-card { width: min(480px, 94vw); }
.paywall-card-wide { width: min(560px, 94vw); }
.billing-quota { margin: 0; font-weight: 600; color: var(--accent); }
.pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.pricing-tier {
  display: flex; flex-direction: column; align-items: flex-start; gap: .15rem;
  padding: .65rem .75rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer; text-align: left; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.pricing-tier:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.pricing-tier.featured { border-color: var(--accent); background: linear-gradient(135deg, rgba(79,109,245,.08), var(--surface-2)); }
.tier-name { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.tier-price { font-size: 1.05rem; font-weight: 700; }
.tier-desc { font-size: .72rem; color: var(--text-soft); }
.paywall-auth-row { display: flex; gap: .45rem; flex-wrap: wrap; }
.paywall-auth-row input {
  flex: 1; min-width: 120px; padding: .45rem .6rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--solid); color: var(--text); font-size: .82rem;
}
body.report-locked #findingList,
body.report-locked #preflightTips,
body.report-locked .exports,
body.report-locked #exportPdfTop { filter: blur(4px); pointer-events: none; user-select: none; }
body.report-locked .report-lock-banner { display: block; }
.report-lock-banner {
  display: none; margin: .75rem 0; padding: .75rem 1rem; border-radius: 10px;
  background: linear-gradient(135deg, rgba(79,109,245,.12), rgba(220,38,38,.08));
  border: 1px solid var(--border); font-size: .85rem;
}
.report-lock-banner button { margin-top: .5rem; }
.paywall-body { padding: 1.1rem 1.25rem 1.35rem; display: flex; flex-direction: column; gap: .85rem; }
.paywall-lead { margin: 0; font-size: .92rem; line-height: 1.5; color: var(--text-soft); }
.paywall-features { margin: 0; padding-left: 1.1rem; font-size: .82rem; line-height: 1.55; color: var(--text); }
.paywall-price-note { margin: 0; }
.paywall-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.paywall-actions .btn-primary { width: auto; margin: 0; }
.paywall-activate label { display: block; font-size: .78rem; font-weight: 600; margin-bottom: .35rem; color: var(--muted); }
.paywall-key-row { display: flex; gap: .45rem; }
.paywall-key-row input {
  flex: 1;
  min-width: 0;
  padding: .5rem .65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--solid);
  color: var(--text);
  font-size: .85rem;
}
#paywallMsg.error-msg { color: #b91c1c; }
#paywallMsg.ok-msg { color: #15803d; }
.rev-image-wrap img { width: 100%; border: 1px solid var(--border); border-radius: 6px; background: #0a0e14; }
.rev-summary { font-size: .85rem; line-height: 1.55; overflow: auto; }
.rev-summary h2 { font-size: 1rem; } .rev-summary h3 { font-size: .85rem; margin: .8rem 0 .3rem; }
@media (max-width: 820px) { .modal-body { grid-template-columns: 1fr; } }

.fc-conf { font-size: .6rem; font-weight: 700; padding: .12rem .35rem; border-radius: 4px; }
.fc-conf.hi { background: #dcfce7; color: #15803d; }
.fc-conf.mid { background: #fef3c7; color: #b45309; }
.fc-conf.lo { background: #fee2e2; color: #dc3b43; }

/* Ask AI chat */
#tab-ask { display: flex; flex-direction: column; height: 100%; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .6rem; padding-bottom: .6rem; }
.chat-msg { max-width: 92%; padding: .55rem .75rem; border-radius: 10px; font-size: .85rem; line-height: 1.5; }
.chat-msg.chat-user { align-self: flex-end; background: linear-gradient(135deg, #5b7cfa, #4f6df5); color: var(--on-accent); border-bottom-right-radius: 3px; box-shadow: 0 2px 10px rgba(79, 109, 245, 0.25); }
.chat-msg.chat-ai { align-self: flex-start; background: var(--solid); border: 1px solid var(--border); border-bottom-left-radius: 3px; box-shadow: var(--shadow-sm); }
.chat-msg.chat-ai p { margin: .3rem 0; }
.chat-msg.chat-ai h1, .chat-msg.chat-ai h2, .chat-msg.chat-ai h3 { font-size: .9rem; margin: .4rem 0 .2rem; }
.chat-msg.pending { opacity: .6; font-style: italic; }
.chat-input { display: flex; gap: .5rem; align-items: flex-end; padding-top: .6rem; border-top: 1px solid var(--border); }
.chat-input textarea { flex: 1; resize: vertical; padding: .5rem; border-radius: 8px; border: 1px solid var(--border); background: var(--solid); color: var(--text); font: inherit; font-size: .85rem; }
.chat-input .btn { width: auto; margin: 0; padding: .55rem 1rem; }

.detail-panel { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: .86rem; line-height: 1.55; }
.detail-panel h3 { margin: 0 0 .5rem; font-size: 1rem; }
.detail-panel section { margin-bottom: .85rem; }
.detail-panel section h5 { margin: 0 0 .3rem; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.detail-panel section p { margin: 0; }

.guidance { font-size: .85rem; line-height: 1.6; }
.guidance h1, .guidance h2, .guidance h3 { font-size: .98rem; margin: .8rem 0 .35rem; }
.guidance h3 { font-size: .9rem; }
.guidance ul { padding-left: 1.2rem; margin: .3rem 0; }
.guidance blockquote { margin: .5rem 0; padding: .5rem .75rem; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 6px; color: var(--muted); }
.guidance code { background: var(--surface-2); padding: .1rem .3rem; border-radius: 4px; font-family: 'IBM Plex Mono', monospace; font-size: .85em; }

.standards-search { display: flex; gap: .5rem; margin-bottom: .75rem; }
.standards-search input { flex: 1; padding: .55rem .65rem; border-radius: 8px; border: 1px solid var(--border); background: var(--solid); color: var(--text); }
.source-link { display: block; font-size: .8rem; color: var(--accent); margin-bottom: .4rem; word-break: break-all; text-decoration: none; }
.source-link:hover { text-decoration: underline; }
.source-link .st { font-size: .66rem; color: var(--muted); }
.std-summary { font-size: .82rem; margin-bottom: .6rem; }

.exports { display: flex; gap: .5rem; margin-top: 1rem; }
.exports .tbtn { flex: 1; text-align: center; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--glass-strong);
  backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .75rem 1.1rem;
  border-radius: 14px;
  z-index: 60;
  font-size: .84rem;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.35s var(--ease-out) both;
}
.toast.error { border-color: rgba(220, 59, 67, 0.35); color: var(--critical); background: var(--toast-error-bg); }

.camera-only { display: none; margin-top: .6rem; }

@media (max-width: 1200px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .viewer { min-height: 60vh; }
}
@media (max-width: 820px) {
  .app-shell { padding: .7rem .8rem 1.2rem; }
  .header { flex-wrap: wrap; gap: .6rem; padding: .65rem .75rem; }
  .layout { gap: .7rem; }
  .viewer { min-height: 52vh; }
  .panel-body { padding: .8rem; }
  .camera-only { display: block; }
  .viewer-toolbar { flex-wrap: wrap; gap: .35rem; }
  .modal { padding: .6rem; }
  .modal-body { padding: .8rem; }
}
@media (max-width: 520px) {
  .brand p { display: none; }
  .brand-mark { width: 36px; height: 36px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .chat-msg { max-width: 100%; }
  .header-status { width: 100%; justify-content: flex-start; }
}
