:root {
  --bg: #f5f5f7;
  --bg-elevated: rgba(255,255,255,.72);
  --surface: rgba(255,255,255,.78);
  --surface-solid: #ffffff;
  --surface-subtle: rgba(248,248,250,.86);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --line: rgba(0,0,0,.08);
  --line-strong: rgba(0,0,0,.12);
  --accent: #0071e3;
  --accent-2: #5ac8fa;
  --accent-soft: rgba(0,113,227,.10);
  --green: #34c759;
  --shadow: 0 18px 60px rgba(0,0,0,.08);
  --shadow-soft: 0 8px 28px rgba(0,0,0,.06);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --viewer-top: #f7f9fc;
  --viewer-bottom: #eef2f7;
}

body[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: rgba(28,28,30,.76);
  --surface: rgba(28,28,30,.80);
  --surface-solid: #1c1c1e;
  --surface-subtle: rgba(44,44,46,.82);
  --text: #f5f5f7;
  --text-2: #aeaeb2;
  --text-3: #8e8e93;
  --line: rgba(255,255,255,.09);
  --line-strong: rgba(255,255,255,.14);
  --accent: #0a84ff;
  --accent-2: #64d2ff;
  --accent-soft: rgba(10,132,255,.15);
  --shadow: 0 20px 70px rgba(0,0,0,.34);
  --shadow-soft: 0 10px 32px rgba(0,0,0,.24);
  --viewer-top: #17191d;
  --viewer-bottom: #0c0d0f;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .25s ease, color .25s ease;
}
button, input { font: inherit; }
button { color: inherit; }
button:disabled { opacity: .42; cursor: not-allowed; transform: none !important; }
.hidden { display: none !important; }

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 10%, rgba(90,200,250,.10), transparent 28%),
    radial-gradient(circle at 82% 14%, rgba(0,113,227,.08), transparent 26%),
    linear-gradient(180deg, rgba(255,255,255,.35), transparent 34%);
}
body[data-theme="dark"] .app-bg {
  background:
    radial-gradient(circle at 15% 8%, rgba(10,132,255,.16), transparent 25%),
    radial-gradient(circle at 80% 5%, rgba(100,210,255,.08), transparent 22%),
    #000;
}

.topbar {
  height: 72px;
  padding: 0 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(26px);
  -webkit-backdrop-filter: saturate(180%) blur(26px);
  border-bottom: 1px solid var(--line);
}
.topbar-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; overflow: hidden;
  color: #fff; font-size: 12px; font-weight: 800; letter-spacing: -.01em;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent-2) 60%, var(--accent)));
  box-shadow: 0 7px 18px rgba(0,113,227,.20);
}
.brand-logo-image { width: 100%; height: 100%; object-fit: cover; }
.topbar-brand-copy { min-width: 0; display: flex; flex-direction: column; }
.topbar-brand-copy strong { font-size: 14px; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-brand-copy span { color: var(--text-2); font-size: 11px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-center {
  min-height: 34px; padding: 0 13px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-soft);
  color: var(--text-2); font-size: 12px; font-weight: 600;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(52,199,89,.10); }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.icon-button, .theme-toggle {
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-soft);
  cursor: pointer; transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.icon-button:hover, .theme-toggle:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.icon-button { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; padding: 0; }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle { min-height: 38px; padding: 5px 10px 5px 8px; border-radius: 12px; display: flex; align-items: center; gap: 8px; }
.theme-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-subtle); color: var(--accent); }
.theme-toggle-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.theme-toggle-text strong { font-size: 11px; }
.theme-toggle-text small { margin-top: 3px; color: var(--text-3); font-size: 9px; }

.app-shell {
  width: min(1880px, 100%);
  margin: 0 auto;
  padding: 22px;
  display: grid;
  grid-template-columns: 330px minmax(0,1fr);
  gap: 22px;
}
.inspector { display: flex; flex-direction: column; gap: 14px; align-self: start; position: sticky; top: 94px; max-height: calc(100vh - 112px); overflow: auto; padding-right: 2px; scrollbar-width: thin; }
.inspector-header { padding: 8px 4px 4px; }
.section-overline, .panel-kicker { color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: .11em; }
.inspector-header h1 { margin: 6px 0 8px; font-size: 27px; line-height: 1.04; letter-spacing: -.035em; font-weight: 700; }
.inspector-header p { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.5; }

.panel, .content-card, .hero-workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}
.panel { border-radius: var(--radius-lg); padding: 15px; }
.panel-heading, .content-card-heading, .workspace-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-heading { margin-bottom: 12px; }
.panel h2, .content-card h3 { margin: 4px 0 0; font-size: 16px; letter-spacing: -.02em; }
.mini-status { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; background: var(--surface-subtle); color: var(--text-2); font-size: 10px; font-weight: 650; white-space: nowrap; }

.upload-tile {
  border: 1px dashed color-mix(in srgb, var(--accent) 33%, var(--line));
  background: color-mix(in srgb, var(--accent) 5%, var(--surface-solid));
  min-height: 154px; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 18px; text-align: center; cursor: pointer; transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.upload-tile:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 58%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--surface-solid)); }
.upload-tile input, .model-upload-row input, .logo-upload input { display: none; }
.upload-icon { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 10px; background: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(0,113,227,.22); }
.upload-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.upload-tile strong { font-size: 13px; }
.upload-tile small { margin-top: 5px; color: var(--text-3); font-size: 10px; }
.helper-text { margin: 9px 1px 0; color: var(--text-3); font-size: 10.5px; line-height: 1.45; }
.divider { display: flex; align-items: center; gap: 8px; margin: 12px 0; color: var(--text-3); font-size: 10px; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.model-upload-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 8px; margin: 0 -4px; border-radius: 14px; cursor: pointer; transition: background .18s ease; }
.model-upload-row:hover { background: var(--surface-subtle); }
.model-upload-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-subtle); border: 1px solid var(--line); display: grid; place-items: center; color: var(--accent); font-size: 11px; font-weight: 800; }
.model-upload-row strong, .model-upload-row small { display: block; }
.model-upload-row strong { font-size: 12px; }
.model-upload-row small { margin-top: 3px; color: var(--text-3); font-size: 9.5px; }
.chevron { color: var(--text-3); font-size: 22px; line-height: 1; }

.segmented-control { display: grid; grid-template-columns: repeat(3,1fr); gap: 3px; padding: 3px; border-radius: 12px; background: var(--surface-subtle); border: 1px solid var(--line); }
.tool-btn { min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); display: flex; align-items: center; justify-content: center; gap: 5px; cursor: pointer; font-size: 10.5px; font-weight: 650; transition: .17s ease; }
.tool-btn span { font-size: 11px; }
.tool-btn.active { background: var(--surface-solid); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.07); }
body[data-theme="dark"] .tool-btn.active { box-shadow: 0 2px 10px rgba(0,0,0,.22); }
.control-row { margin-top: 16px; }
.control-row.no-margin { margin-top: 0; }
.control-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.control-label label { color: var(--text-2); font-size: 11px; font-weight: 600; }
.control-label output { color: var(--text); font-size: 11px; font-weight: 700; }
input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
.compact-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 14px; }
.text-button { min-height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-subtle); color: var(--accent); font-size: 10px; font-weight: 650; cursor: pointer; }
.timeline-labels { margin-top: 5px; display: flex; justify-content: space-between; color: var(--text-3); font-size: 9px; }
.stage-card { margin-top: 12px; border-radius: 14px; background: var(--surface-subtle); padding: 11px; border: 1px solid var(--line); }
.stage-card strong { font-size: 11px; }
.stage-card p { margin: 4px 0 0; color: var(--text-2); font-size: 10px; line-height: 1.4; }

.brand-details { padding: 0; overflow: hidden; }
.brand-details summary { list-style: none; cursor: pointer; padding: 14px 15px; display: flex; justify-content: space-between; align-items: center; }
.brand-details summary::-webkit-details-marker { display: none; }
.brand-details summary > span:first-child { display: flex; flex-direction: column; gap: 4px; }
.brand-details summary strong { font-size: 12px; }
.brand-details[open] summary .chevron { transform: rotate(90deg); }
.brand-settings { padding: 0 15px 15px; border-top: 1px solid var(--line); }
.brand-preview-panel { margin-top: 12px; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface-subtle); }
.brand-preview-mark { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; display: grid; place-items: center; overflow: hidden; background: linear-gradient(145deg,var(--accent),var(--accent-2)); color:#fff; font-size: 11px; font-weight:800; }
.brand-preview-panel strong { font-size: 11px; }
.brand-preview-panel p { margin: 3px 0 0; font-size: 9px; color: var(--text-3); }
.field-label { display: block; margin-top: 10px; color: var(--text-2); font-size: 10px; font-weight: 600; }
.field-label input[type="text"] { width: 100%; margin-top: 5px; min-height: 36px; border-radius: 10px; border: 1px solid var(--line); padding: 0 10px; background: var(--surface-solid); color: var(--text); outline: none; }
.field-label input[type="text"]:focus { border-color: color-mix(in srgb,var(--accent) 55%,var(--line)); box-shadow: 0 0 0 3px var(--accent-soft); }
.brand-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.color-row { margin-top: 5px; min-height: 36px; display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-solid); }
.color-row input { width: 24px; height: 24px; border: 0; padding: 0; background: transparent; }
.color-row span { color: var(--text-3); font-size: 9px; }
.logo-upload { margin-top: 15px; min-height: 36px; border-radius: 10px; border: 1px solid var(--line); display: grid; place-items: center; background: var(--surface-solid); color: var(--accent); font-size: 10px; cursor: pointer; }

.workspace { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.hero-workspace { padding: 16px; border-radius: var(--radius-xl); }
.workspace-heading { align-items: center; margin-bottom: 12px; padding: 2px 2px 0; }
.workspace-heading h2 { margin: 5px 0 0; font-size: 22px; letter-spacing: -.03em; }
.workspace-actions { display: flex; align-items: center; gap: 8px; }
.viewer-pill { min-height: 30px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 999px; background: var(--surface-subtle); color: var(--text-2); font-size: 10px; font-weight: 650; border: 1px solid var(--line); }
.primary-button, .secondary-button { min-height: 38px; border-radius: 12px; padding: 0 14px; cursor: pointer; font-size: 11px; font-weight: 680; transition: transform .18s ease, filter .18s ease, background .18s ease; }
.primary-button { border: 0; color: #fff; background: var(--accent); box-shadow: 0 8px 20px rgba(0,113,227,.18); }
.primary-button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.03); }
.secondary-button { border: 1px solid var(--line); background: var(--surface-solid); color: var(--text); }
.secondary-button:hover:not(:disabled) { transform: translateY(-1px); background: var(--surface-subtle); }
.full-width { width: 100%; }

.viewer3d { position: relative; min-height: 660px; border-radius: 24px; overflow: hidden; border: 1px solid var(--line); background: linear-gradient(180deg,var(--viewer-top),var(--viewer-bottom)); }
.viewer3d canvas { display: block; }
.viewer-overlay { position: absolute; z-index: 3; top: 14px; min-height: 38px; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid rgba(255,255,255,.32); background: rgba(255,255,255,.50); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%); border-radius: 13px; box-shadow: 0 8px 30px rgba(0,0,0,.07); }
body[data-theme="dark"] .viewer-overlay { background: rgba(24,24,26,.58); border-color: rgba(255,255,255,.10); }
.viewer-overlay-left { left: 14px; }
.viewer-overlay-right { right: 14px; }
.viewer-overlay strong { display: block; font-size: 10px; }
.viewer-overlay small { display: block; color: var(--text-3); font-size: 8.5px; margin-top: 2px; }
.live-indicator { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(52,199,89,.12); }
.overlay-badge { color: var(--text-2); font-size: 9.5px; font-weight: 700; }
.viewer-bottom-bar { position: absolute; z-index: 3; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: stretch; border-radius: 15px; overflow: hidden; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.54); backdrop-filter: blur(22px) saturate(170%); -webkit-backdrop-filter: blur(22px) saturate(170%); box-shadow: 0 10px 30px rgba(0,0,0,.08); }
body[data-theme="dark"] .viewer-bottom-bar { background: rgba(28,28,30,.62); border-color: rgba(255,255,255,.10); }
.viewer-bottom-bar > div { min-width: 116px; padding: 8px 12px; text-align: center; }
.viewer-bottom-bar > div + div { border-left: 1px solid var(--line); }
.viewer-bottom-bar span { display: block; color: var(--text-3); font-size: 8px; }
.viewer-bottom-bar strong { display: block; margin-top: 2px; font-size: 13px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(290px,.75fr); gap: 16px; }
.content-card { border-radius: var(--radius-lg); padding: 16px; }
.content-card-heading { align-items: center; margin-bottom: 12px; }
.scan-stage { min-height: 390px; border-radius: 18px; overflow: hidden; position: relative; display: grid; place-items: center; background: var(--surface-subtle); border: 1px solid var(--line); }
.scan-placeholder { max-width: 320px; text-align: center; padding: 30px; color: var(--text-3); }
.empty-state-icon { width: 42px; height: 42px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 13px; background: var(--surface-solid); border: 1px solid var(--line); color: var(--accent); font-size: 21px; }
.scan-placeholder strong { display: block; color: var(--text); font-size: 13px; margin-bottom: 4px; }
.scan-placeholder span:last-child { font-size: 10.5px; line-height: 1.45; }
.scan-canvas, .scan-video { width: 100%; max-height: 620px; object-fit: contain; display: block; background: #0a0a0b; }
.scan-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.scan-actions button { flex: 1 1 130px; }
.metrics-stack { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-subtle); }
.metric-row { min-height: 51px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metric-row + .metric-row { border-top: 1px solid var(--line); }
.metric-row span { color: var(--text-2); font-size: 10.5px; }
.metric-row strong { text-align: right; font-size: 11px; max-width: 56%; }
.frame-strip { display: grid; grid-template-columns: repeat(2,1fr); gap: 7px; margin-top: 11px; max-height: 320px; overflow: auto; }
.frame-thumb { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-subtle); }
.frame-thumb img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; }
.frame-thumb span { display: block; padding: 6px 7px; color: var(--text-3); font-size: 8.5px; }

.simulation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.simulation-grid figure { margin: 0; min-width: 0; }
.simulation-grid figcaption { margin-bottom: 7px; color: var(--text-2); font-size: 10px; font-weight: 650; }
.comparison-canvas { width: 100%; height: auto; max-height: 620px; object-fit: contain; display: block; border-radius: 16px; border: 1px solid var(--line); background: #0a0a0b; }
.clinical-note { margin: 11px 0 0; padding: 10px 12px; border-radius: 12px; background: rgba(255,149,0,.08); color: var(--text-2); font-size: 10px; line-height: 1.45; }

.compare-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare-side { padding: 12px; border-radius: 16px; background: var(--surface-subtle); border: 1px solid var(--line); }
.compare-side > span { font-size: 10px; font-weight: 700; }
.compare-side p { margin: 7px 0 0; color: var(--text-3); font-size: 9.5px; }
.compare-visual { min-height: 260px; border-radius: 14px; margin-top: 8px; border: 1px solid var(--line); }
.compare-before { background: radial-gradient(circle at 50% 22%, #eac7ad 0 22%, transparent 23%), radial-gradient(circle at 50% 18%, rgba(91,58,38,.38) 0 18%, transparent 19%), linear-gradient(180deg,#fafafa,#f0f2f5); }
.compare-after { background: radial-gradient(circle at 50% 22%, #eac7ad 0 22%, transparent 23%), repeating-radial-gradient(circle at 50% 18%, rgba(54,36,24,.82) 0 1px, transparent 1px 4px), linear-gradient(180deg,#fafafa,#f0f2f5); }

@media (max-width: 1280px) {
  .app-shell { grid-template-columns: 300px minmax(0,1fr); padding: 16px; gap: 16px; }
  .viewer3d { min-height: 560px; }
}
@media (max-width: 1050px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar-center { display: none; }
  .app-shell { grid-template-columns: 1fr; }
  .inspector { position: static; max-height: none; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); overflow: visible; }
  .inspector-header { grid-column: 1 / -1; }
  .brand-details { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .dashboard-grid, .simulation-grid, .compare-split { grid-template-columns: 1fr; }
  .viewer3d { min-height: 500px; }
}
@media (max-width: 640px) {
  .topbar { height: 64px; padding: 0 12px; }
  .topbar-brand-copy span, .theme-toggle-text { display: none; }
  .theme-toggle { width: 38px; padding: 5px; justify-content: center; }
  .app-shell { padding: 10px; gap: 12px; }
  .inspector { grid-template-columns: 1fr; }
  .inspector-header, .brand-details { grid-column: auto; }
  .inspector-header h1 { font-size: 24px; }
  .hero-workspace, .panel, .content-card { border-radius: 20px; }
  .workspace-heading { align-items: flex-start; flex-direction: column; }
  .workspace-actions { width: 100%; justify-content: space-between; }
  .viewer3d { min-height: 430px; border-radius: 18px; }
  .viewer-overlay-right { top: auto; bottom: 72px; }
  .viewer-bottom-bar { width: calc(100% - 24px); }
  .viewer-bottom-bar > div { flex: 1; min-width: 0; }
  .scan-stage { min-height: 280px; }
  .brand-inline { grid-template-columns: 1fr; }
}

/* Reconstrucción automática V5 */
.auto-reconstruction-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel-strong) 88%, var(--accent) 12%);
}

.auto-reconstruction-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.auto-reconstruction-heading strong,
.auto-reconstruction-heading small { display: block; }
.auto-reconstruction-heading small { color: var(--muted); margin-top: 4px; line-height: 1.3; }

.server-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(120,120,128,0.12);
  color: var(--muted);
}
.server-status[data-state="online"] { background: rgba(52,199,89,0.14); color: #248a3d; }
.server-status[data-state="offline"] { background: rgba(255,59,48,0.12); color: #d70015; }

.reconstruction-progress-wrap { margin-top: 10px; }
.reconstruction-progress-track {
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(120,120,128,0.14);
}
.reconstruction-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 280ms ease;
}
.reconstruction-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  font-size: 0.72rem;
  color: var(--muted);
}
.reconstruction-progress-meta strong { color: var(--text); }

/* V6 · Interfaz simplificada con menú emergente e inspector bajo demanda */
.app-shell {
  grid-template-columns: minmax(0, 1fr) !important;
  max-width: 1680px;
  margin: 0 auto;
}

.inspector {
  position: fixed !important;
  z-index: 45;
  left: 18px;
  top: 82px;
  bottom: 18px;
  width: min(390px, calc(100vw - 36px));
  max-height: none !important;
  overflow-y: auto !important;
  transform: translateX(calc(-100% - 34px));
  opacity: 0;
  pointer-events: none;
  transition: transform .32s cubic-bezier(.2,.8,.2,1), opacity .24s ease;
  box-shadow: 0 24px 80px rgba(0,0,0,.18);
  background: color-mix(in srgb, var(--surface-solid) 86%, transparent);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
}
body.inspector-open .inspector {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.inspector-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.inspector-close {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px;
  font-size: 20px;
  line-height: 1;
}

.drawer-backdrop {
  position: fixed;
  inset: 64px 0 0;
  z-index: 40;
  background: rgba(0,0,0,.15);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.menu-button {
  min-height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}
.menu-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.menu-popover {
  position: fixed;
  z-index: 60;
  top: 66px;
  right: 16px;
  width: min(330px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-solid) 84%, transparent);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 20px 70px rgba(0,0,0,.18), 0 2px 10px rgba(0,0,0,.06);
  transform-origin: top right;
  animation: menuIn .18s ease-out;
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.menu-popover-title {
  padding: 8px 10px 7px;
  color: var(--text-3);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.menu-popover > button {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.menu-popover > button:hover { background: var(--surface-subtle); }
.menu-popover > button > span:last-child { min-width: 0; }
.menu-popover strong { display: block; font-size: 11px; }
.menu-popover small { display: block; margin-top: 2px; color: var(--text-3); font-size: 9px; }
.menu-glyph {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-solid));
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.simple-start {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-solid);
  box-shadow: 0 8px 28px rgba(0,0,0,.04);
}
.simple-start strong { display: block; margin-top: 4px; font-size: 14px; letter-spacing: -.015em; }
.simple-start p { margin: 4px 0 0; color: var(--text-3); font-size: 10px; }
.simple-start .primary-button { flex: 0 0 auto; }

.collapsible-card > .content-card-heading { cursor: pointer; margin-bottom: 0; }
.collapsible-card > .content-card-heading::after { content: none; }
.collapse-toggle {
  width: 31px;
  height: 31px;
  margin-left: auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-solid);
  color: var(--text-2);
  cursor: pointer;
}
.collapse-toggle span { display: block; transition: transform .2s ease; }
.collapsible-card:not(.is-collapsed) .collapse-toggle span { transform: rotate(180deg); }
.collapsible-card.is-collapsed > :not(.content-card-heading) { display: none !important; }
.collapsible-card.is-collapsed { padding-bottom: 12px; }
.collapsible-card.is-collapsed .content-card-heading { margin-bottom: 0; }
.panel-focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent), var(--shadow-soft) !important; }

.dashboard-grid {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

/* Keep the primary screen focused on the patient model. */
.hero-workspace { min-height: calc(100vh - 150px); }
.viewer3d { min-height: calc(100vh - 240px); }

@media (max-width: 1050px) {
  .inspector {
    display: flex !important;
    grid-template-columns: none !important;
    position: fixed !important;
    top: 74px;
    left: 12px;
    bottom: 12px;
    width: min(390px, calc(100vw - 24px));
  }
}
@media (max-width: 760px) {
  .menu-button span { display: none; }
  .menu-button { width: 38px; padding: 0; justify-content: center; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .simple-start { align-items: flex-start; flex-direction: column; }
  .simple-start .primary-button { width: 100%; }
  .hero-workspace { min-height: auto; }
  .viewer3d { min-height: 480px; }
}

.inspector-collapsible > .panel-heading { cursor: pointer; margin-bottom: 0; }
.inspector-collapsible.is-collapsed > :not(.panel-heading) { display: none !important; }
.inspector-collapsible:not(.is-collapsed) > .panel-heading { margin-bottom: 12px; }
.panel-collapse-toggle {
  width: 29px;
  height: 29px;
  margin-left: auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle);
  color: var(--text-2);
  cursor: pointer;
}
.panel-collapse-toggle span { transition: transform .2s ease; }
.inspector-collapsible:not(.is-collapsed) .panel-collapse-toggle span { transform: rotate(180deg); }
