/* ===== Tokens ===== */
:root {
  --bg: #F4F4F4;
  --surface: #FAFAFA;
  --surface-2: #EBEBEB;
  --line: #E0E0E0;
  --line-strong: #C6C6C6;
  --grid: #EAEAEA;
  --grid-major: #DDDDDD;
  --text: #222222;
  --text-2: #555555;
  --text-3: #6E6E6E;
  --accent: #222222;
  --accent-ink: #F4F4F4;
  --tint-1: #E2E7EB;
  --tint-2: #E9E4EF;
  --tint-3: #E0EAE2;
  --tooth: #FFFFFF;
  --shade: #1A1A1A;
  --s1: #222222;
  --s2: #555555;
  --s3: #7A7A7A;
  --s4: #3A3A3A;
  --toast-bg: #222222;
  --toast-text: #F4F4F4;
  --toast-shadow: 0 6px 24px rgba(0, 0, 0, .18);
  --f-body: "Hanken Grotesk", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 10px;
  --r-lg: 14px;
  --r-pill: 999px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1C1C1C;
    --surface: #232323;
    --surface-2: #2C2C2C;
    --line: #333333;
    --line-strong: #4C4C4C;
    --grid: #272727;
    --grid-major: #303030;
    --text: #EDEDED;
    --text-2: #B5B5B5;
    --text-3: #909090;
    --accent: #F2F2F2;
    --accent-ink: #1C1C1C;
    --tint-1: #2B333A;
    --tint-2: #322D3B;
    --tint-3: #29352C;
    --tooth: #3C3C3C;
    --shade: #000000;
    --s1: #F2F2F2;
    --s2: #BDBDBD;
    --s3: #8E8E8E;
    --s4: #D6D6D6;
    --toast-bg: #F2F2F2;
    --toast-text: #1C1C1C;
    --toast-shadow: 0 6px 24px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1C1C1C;
  --surface: #232323;
  --surface-2: #2C2C2C;
  --line: #333333;
  --line-strong: #4C4C4C;
  --grid: #272727;
  --grid-major: #303030;
  --text: #EDEDED;
  --text-2: #B5B5B5;
  --text-3: #909090;
  --accent: #F2F2F2;
  --accent-ink: #1C1C1C;
  --tint-1: #2B333A;
  --tint-2: #322D3B;
  --tint-3: #29352C;
  --tooth: #3C3C3C;
  --shade: #000000;
  --s1: #F2F2F2;
  --s2: #BDBDBD;
  --s3: #8E8E8E;
  --s4: #D6D6D6;
  --toast-bg: #F2F2F2;
  --toast-text: #1C1C1C;
  --toast-shadow: 0 6px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--f-body); text-transform: lowercase; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; text-transform: inherit; }
input, textarea, .mono, .fn, .fl, kbd, .num, .fdi, .dim-t, .axis-t { text-transform: none; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.mono, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { font-weight: 700; letter-spacing: -.025em; }
h1 { font-size: 40px; line-height: 1.08; letter-spacing: -.035em; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -.015em; }
.label { font: 500 12px/1.3 var(--f-body); color: var(--text-3); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* ===== Layout ===== */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); padding-block: 24px; display: flex; flex-direction: column; gap: 28px; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding-block: 14px; }
.wrap { max-width: 1240px; margin-inline: auto; padding-block: 24px 72px; }
.logo { display: inline-flex; align-items: baseline; gap: 3px; font: 700 22px/1 var(--f-body); letter-spacing: -.05em; text-decoration: none; }
.logo i { width: 6px; height: 6px; background: var(--text); border-radius: 50%; display: inline-block; }
.side .logo { padding-inline: 20px; }
.topbar .logo { display: none; }
.crumb { flex: 1; min-width: 0; font: 400 12px var(--f-mono); text-transform: none; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.crumb a { text-decoration: none; }
.crumb a:hover { color: var(--text); text-decoration: underline; }
.crumb [aria-current] { color: var(--text); }
.crumb .sep { margin-inline: 8px; color: var(--line-strong); }
.mnav, .strip { display: none; }
.top-r { display: flex; gap: 4px; margin-left: auto; }

/* Switch modo oscuro */
.switch { display: inline-flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 4px 0; font-size: 13px; color: var(--text-2); }
.switch .tr { width: 36px; height: 20px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); position: relative; background: var(--surface); transition: background .15s; }
.switch .tr::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-3); transition: transform .15s, background .15s; }
.switch[aria-checked="true"] .tr { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"] .tr::after { transform: translateX(16px); background: var(--accent-ink); }
.icon-btn { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 50%; color: var(--text); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); box-sizing: content-box; }

/* Sidebar nav */
.side-sec .label { padding-inline: 20px; margin-bottom: 8px; display: block; }
.navlink { display: flex; align-items: center; justify-content: space-between; padding: 9px 20px; text-decoration: none; color: var(--text-2); font-size: 14px; }
.navlink:hover { color: var(--text); background: var(--surface-2); }
.navlink[aria-current="page"] { color: var(--text); background: var(--surface-2); font-weight: 600; }
.case-id { padding: 0 20px 10px; }
.case-id strong { display: block; font: 700 16px var(--f-body); letter-spacing: -.02em; }
.case-id span { font: 400 11px var(--f-mono); color: var(--text-3); }
.side-foot { margin-top: auto; padding-inline: 20px; font: 400 11px var(--f-mono); color: var(--text-3); }

/* Process steps (sidebar + strip) */
.step a { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; align-items: center; padding: 9px 20px; text-decoration: none; color: var(--text-2); }
.step a:hover { background: var(--surface-2); color: var(--text); }
.step[aria-current="page"] a { background: var(--surface-2); color: var(--text); }
.step .n { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font: 500 11px var(--f-mono); color: var(--text-2); background: transparent; }
.step.done .n { background: var(--tint-3); border-color: transparent; color: var(--text); }
.step.current .n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.step .n svg { width: 12px; height: 12px; }
.step .t { display: flex; flex-direction: column; min-width: 0; }
.step .nm { font-size: 14px; line-height: 1.25; }
.step[aria-current="page"] .nm { font-weight: 600; }
.step .st { font-size: 12px; line-height: 1.4; color: var(--text-3); }

/* ===== Components ===== */
.head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 12px 0 32px; }
.head .label { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.head .sub { color: var(--text-2); font-size: 16px; max-width: 56ch; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.tag { font: 500 11px/1 var(--f-body); color: var(--text-3); border: 1px dashed var(--line-strong); padding: 4px 8px; border-radius: var(--r-pill); white-space: nowrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 18px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: transparent; color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { opacity: .88; }
.btn.sm { min-height: 30px; padding: 0 14px; font-size: 13px; }
.btn svg { width: 14px; height: 14px; }

.panel { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); min-width: 0; overflow: hidden; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-b { padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 28px; }
.metrics.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.metric b { display: block; font: 700 36px/1 var(--f-body); letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin-bottom: 8px; }
.metric span { color: var(--text-2); font-size: 14px; }

.pill { display: inline-flex; align-items: center; gap: 8px; font: 500 12px/1 var(--f-body); border: 1px solid var(--line-strong); padding: 6px 12px; border-radius: var(--r-pill); white-space: nowrap; color: var(--text-2); background: transparent; }
.pill.ok { background: var(--tint-3); border-color: transparent; color: var(--text); }
.pill.cur { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill.warn { background: var(--tint-2); border-style: dashed; color: var(--text); }
.pill.info { background: var(--tint-1); border-color: transparent; color: var(--text); }
.pill.soft { background: var(--surface-2); border-color: transparent; }
.cnt { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font: 600 11px/1 var(--f-mono); }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: transparent; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 4px 12px; font-size: 13px; color: var(--text-2); min-height: 28px; border-radius: var(--r-pill); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font: 500 12px var(--f-body); color: var(--text-3); }
.input { height: 38px; width: 100%; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); padding: 0 12px; font-size: 14px; }
.input::placeholder { color: var(--text-3); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 76px; line-height: 1.45; }
.input.mono { font-family: var(--f-mono); font-size: 13px; }
.input-u { position: relative; }
.input-u span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 400 12px var(--f-mono); color: var(--text-3); pointer-events: none; }
.input-u .input { padding-right: 38px; }
.opt { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 28px; }
.opt input { margin: 0; width: 16px; height: 16px; accent-color: var(--accent); }
.opts { display: flex; flex-wrap: wrap; gap: 4px 18px; }

.rows > li { display: grid; gap: 4px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; padding-top: 0; }
.rows > li:last-child { padding-bottom: 0; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 16px; }
.kv dt { font-size: 13px; color: var(--text-3); }
.kv dd { font-size: 14px; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font: 500 12px var(--f-body); color: var(--text-3); padding: 12px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl-scroll { overflow-x: auto; }

.note { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 12px 14px; border: 1px solid transparent; border-radius: var(--r); }
.note svg { width: 15px; height: 15px; flex: none; margin-top: 3px; }
.note.warn { background: var(--tint-2); border-color: var(--line-strong); border-style: dashed; }
.note.info { background: var(--tint-1); }

.ico-ok { width: 14px; height: 14px; flex: none; }
.chev { width: 14px; height: 14px; color: var(--text-3); }

/* ===== Visor ===== */
.viewer { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); min-width: 0; overflow: hidden; }
.viewer-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: center; }
.viewer-bar .grow { flex: 1; }
.zoom { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r-pill); }
.zoom button { width: 30px; height: 28px; border: 0; background: transparent; font: 400 15px var(--f-mono); color: var(--text-2); border-radius: var(--r-pill); }
.zoom button:hover { background: var(--surface-2); }
.zoom output { padding: 0 6px; font: 400 11px var(--f-mono); text-transform: none; color: var(--text-2); line-height: 28px; }
.stage { position: relative; background-color: var(--surface);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 16px 16px, 16px 16px; background-position: -1px -1px; }
.stage svg { display: block; width: 100%; height: auto; max-height: 560px; }
.coords { position: absolute; right: 12px; bottom: 10px; font: 400 10px/1.5 var(--f-mono); text-transform: none; color: var(--text-3); background: var(--surface); padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--r-pill); }
.stage-tag { position: absolute; left: 14px; top: 12px; }
.viewer-note { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); flex-wrap: wrap; }

/* Isométrico */
.ft, .fl, .fr { stroke: var(--line-strong); stroke-width: .8; stroke-linejoin: round; }
.ft { fill: var(--c); }
.fl { fill: color-mix(in srgb, var(--c) 90%, var(--shade)); }
.fr { fill: color-mix(in srgb, var(--c) 78%, var(--shade)); }
.c0 { --c: var(--tooth); } .c1 { --c: var(--tint-1); } .c2 { --c: var(--tint-2); } .c3 { --c: var(--tint-3); }
.csel { --c: var(--text-2); }
.slab { --c: var(--tint-1); }
.warn .ft, .warn .fl, .warn .fr { stroke: var(--text); stroke-width: 1.6; stroke-dasharray: 4 2; }
.gh { fill: none; stroke: var(--text); stroke-width: 1.3; stroke-dasharray: 3 3; stroke-linejoin: round; }
.gl { stroke: var(--line-strong); stroke-width: .6; fill: none; opacity: .8; }
.fdi { font: 500 12px var(--f-mono); fill: var(--text); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.tight .fdi { font-size: 19px; }
.fdi.sel { fill: var(--bg); font-weight: 500; }
.dim { stroke: var(--text-3); stroke-width: 1; fill: none; }
.dim-t { font: 400 13px var(--f-mono); fill: var(--text-2); text-anchor: middle; }
.dim-t.l { text-anchor: start; }
.axis-t { font: 400 11px var(--f-mono); fill: var(--text-3); }
.plus-c { fill: var(--surface); stroke: var(--text); stroke-width: 1.3; }
.plus-l { stroke: var(--text); stroke-width: 1.6; }
.svg-lbl { font: 500 13px var(--f-body); fill: var(--text-2); }

/* ===== Pacientes ===== */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.toolbar .search { flex: 1 1 260px; max-width: 340px; position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); }
.search .input { padding-left: 36px; border-radius: var(--r-pill); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); background: transparent; border-radius: var(--r-pill); padding: 0 12px 0 14px; min-height: 34px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.chips button:hover { color: var(--text); border-color: var(--text); }
.chips button .cnt { background: var(--surface-2); color: var(--text-2); }
.chips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chips button[aria-pressed="true"] .cnt { background: var(--accent-ink); color: var(--accent); }
#pt-table tbody tr { cursor: pointer; }
#pt-table tbody tr:hover td { background: var(--surface-2); }
.pt-name { font-weight: 600; color: var(--text); text-decoration: none; }
.pt-name:hover { text-decoration: underline; }
.pt-case { display: block; font: 400 12px var(--f-mono); color: var(--text-3); }
.empty { padding: 32px 16px; text-align: center; color: var(--text-3); }

/* ===== Paciente ===== */
.proc li { grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; }
.proc .n { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font: 500 11px var(--f-mono); }
.proc .n svg { width: 12px; height: 12px; }
.proc .done .n { background: var(--tint-3); border-color: transparent; }
.proc .cur .n { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.proc .d { font: 400 12px var(--f-mono); color: var(--text-3); text-align: right; }
.file { grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; }
.file .fn { font: 400 13px var(--f-mono); overflow-wrap: anywhere; }
.file .sz { font: 400 12px var(--f-mono); color: var(--text-3); }
.act li { grid-template-columns: 96px minmax(0, 1fr); }
.act time { font: 400 12px var(--f-mono); text-transform: none; color: var(--text-3); }
.nt li { gap: 6px; }
.nt .meta { font-size: 12px; color: var(--text-3); }

/* ===== Importar ===== */
.drop { border: 1px dashed var(--line-strong); border-radius: var(--r-lg); padding: 44px 28px; display: grid; gap: 14px; justify-items: center; text-align: center;
  background-color: var(--tint-1); }
.drop svg { width: 38px; height: 38px; }
.drop h2 { font-size: 24px; letter-spacing: -.03em; font-weight: 700; }
.fmts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.fmts span { font: 500 12px var(--f-mono); text-transform: none; border: 1px solid var(--line-strong); padding: 4px 10px; border-radius: var(--r-pill); color: var(--text-2); }
.val { display: grid; gap: 6px; }
.val li { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line); margin-top: 14px; }
.stats > div { padding: 12px 12px 0 0; }
.stats .label { display: block; margin-bottom: 2px; }
.stats b { font: 500 14px var(--f-mono); text-transform: none; font-variant-numeric: tabular-nums; }
.imp-file { padding: 18px; border-top: 1px solid var(--line); }
.imp-file:first-child { border-top: 0; }
.imp-file .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.imp-file .fn { font: 500 14px var(--f-mono); }

/* ===== Segmentación ===== */
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool { display: flex; justify-content: space-between; align-items: center; padding: 0 14px; min-height: 38px; border: 1px solid var(--line-strong); background: transparent; border-radius: var(--r-pill); font-size: 14px; font-weight: 500; }
.tool kbd { font: 400 10px var(--f-mono); color: var(--text-3); border: 1px solid var(--line-strong); padding: 1px 6px; border-radius: var(--r-pill); }
.tool[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tool[aria-pressed="true"] kbd { color: var(--accent-ink); border-color: var(--accent-ink); }
.teeth { max-height: 420px; overflow-y: auto; }
.teeth li { display: grid; grid-template-columns: 32px minmax(0, 1fr) 44px; gap: 10px; align-items: center; padding: 8px 18px; border-top: 1px solid var(--line); }
.teeth li:first-child { border-top: 0; }
.teeth .bar { height: 4px; background: var(--surface-2); border-radius: var(--r-pill); position: relative; overflow: hidden; }
.teeth .bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: var(--r-pill); }
.teeth .warnrow .bar i { background: var(--text-3); }
.teeth .pc { font: 400 12px var(--f-mono); text-align: right; }
.teeth .warnrow { background: var(--tint-2); }
.teeth .sub { grid-column: 2 / 4; font-size: 13px; color: var(--text-2); }
.sumline { padding: 14px 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); }

/* ===== Planificación ===== */
.sl { padding: 12px 0; border-top: 1px solid var(--line); }
.sl:first-of-type { border-top: 0; padding-top: 0; }
.sl-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 14px; }
.sl-h output { font: 500 13px var(--f-mono); text-transform: none; }
.sl-e { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 4px; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: var(--line-strong); border-radius: 2px; }
input[type=range]::-moz-range-track { height: 2px; background: var(--line-strong); border-radius: 2px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; background: var(--accent); border: 0; border-radius: 50%; margin-top: -7px; }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; background: var(--accent); border: 0; border-radius: 50%; }
.group-t { margin: 18px 0 8px; }
.group-t:first-child { margin-top: 0; }
.tbl tr.sel-row td { background: var(--tint-1); }

/* ===== Secuencia ===== */
.opt-card { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; height: 100%; }
.opt-wrap { display: block; position: relative; }
.opt-wrap input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.opt-wrap input:checked + .opt-card { border-color: var(--text); background: var(--tint-1); }
.opt-wrap input:focus-visible + .opt-card { outline: 2px solid var(--text); outline-offset: 2px; }
.opt-card .big { font: 700 44px/1 var(--f-body); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.opt-card .big small { font: 400 14px var(--f-body); letter-spacing: 0; color: var(--text-2); margin-left: 8px; }
.opt-card dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14px; border-top: 1px solid var(--line-strong); padding-top: 12px; }
.opt-card dt { color: var(--text-2); }
.opt-card dd { font: 400 13px var(--f-mono); text-transform: none; text-align: right; }
.opt-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 26px; }
.opt-top b { font: 500 13px var(--f-body); color: var(--text-3); }
.floors { display: flex; flex-direction: column-reverse; padding-top: 62px; }
.fl-row { display: flex; align-items: center; gap: 8px; height: 22px; --c: var(--tint-1); }
.fl-row.m-ipr { --c: var(--tint-2); }
.fl-row.m-att { --c: var(--tint-3); }
.fl-row.m-rev { --c: var(--surface-2); }
.fl-row svg { flex: none; width: 150px; height: 24px; overflow: visible; align-self: flex-start; }
.fl-row .pill { padding: 4px 10px; font-size: 12px; }
.fl-row .pill.mono { font: 400 11px var(--f-mono); text-transform: none; }
.fl-add { display: flex; align-items: center; gap: 8px; height: 22px; }
.fl-add .btn.sm { min-height: 24px; height: 24px; padding: 0 12px; font-size: 12px; }
.fl-add svg { flex: none; width: 150px; height: 24px; overflow: visible; align-self: flex-start; }
.fl-wrap { overflow-x: auto; padding-bottom: 4px; }
.fl-inner { min-width: 360px; }
#chart { width: 100%; }
#chart svg { display: block; width: 100%; height: auto; }
.sg li { grid-template-columns: 56px minmax(0, 1fr); align-items: baseline; }
.sg .e { font: 500 11px var(--f-mono); text-transform: none; color: var(--text-2); background: var(--surface-2); padding: 4px 6px; text-align: center; border-radius: var(--r-pill); }
.sg p { font-size: 14px; font-weight: 600; }
.sg p span { display: block; font-weight: 400; color: var(--text-2); font-size: 13px; }

/* ===== Exportar ===== */
.exp-list { max-height: 560px; overflow-y: auto; }
.exp-list td, .exp-list th { padding-block: 10px; }
.exp-list th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.exp-list .fl { display: block; font: 400 12px var(--f-mono); }
.exp-list input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.sumbox { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 18px; border-top: 1px solid var(--line); background: var(--tint-3); }
.sumbox b { font: 700 24px var(--f-body); letter-spacing: -.03em; font-variant-numeric: tabular-nums; text-transform: none; }
.form { display: grid; gap: 18px; }

/* ===== Calendario ===== */
.shp { display: inline-block; flex: none; width: 9px; height: 9px; background: var(--text-2); }
.shp.cambio { border-radius: 50%; }
.shp.consulta { transform: rotate(45deg) scale(.82); }
.shp.entrega { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav h2 { min-width: 9em; text-align: center; font-size: 18px; letter-spacing: -.02em; }
.cal-nav .icon-btn { width: 34px; height: 34px; border: 1px solid var(--line-strong); }
.cal-nav .icon-btn[disabled] { opacity: .35; cursor: default; background: transparent; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head span { padding: 8px 8px 6px; font: 500 12px var(--f-body); color: var(--text-3); border-bottom: 1px solid var(--line); }
.cal-day { position: relative; min-height: 108px; padding: 5px 4px; display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 0; text-align: left; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:nth-last-child(-n+7) { border-bottom: 0; }
.cal-day:hover { background: var(--surface-2); }
.cal-day[aria-pressed="true"] { background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--text); }
.cal-day.out { color: var(--text-3); }
.cal-day.out .evs, .cal-day.out .dots { opacity: .45; }
.dn { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font: 500 12px var(--f-mono); }
.cal-day.today .dn { background: var(--accent); color: var(--accent-ink); }
.evs { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ev { display: flex; align-items: center; gap: 5px; min-width: 0; padding: 2px 5px; border: 1px solid transparent; border-radius: 6px; font-size: 11px; line-height: 1.35; color: var(--text); background: var(--tint-1); }
.ev.cambio { background: var(--tint-3); }
.ev.entrega { background: var(--tint-2); border-color: var(--line-strong); border-style: dashed; }
.ev span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .shp { width: 7px; height: 7px; background: var(--text); }
.more { font: 500 11px var(--f-mono); color: var(--text-3); padding: 0 6px; }
.dots { display: none; gap: 3px; justify-content: center; flex-wrap: wrap; }
.dots .shp { width: 7px; height: 7px; background: var(--text); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.cal-legend span { display: inline-flex; align-items: center; gap: 7px; }
.wk-day { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px 14px; padding: 12px 14px; border-top: 1px solid var(--line); width: 100%; text-align: left; border-left: 0; border-right: 0; border-bottom: 0; border-radius: 0; background: transparent; }
.wk-day:first-child { border-top: 0; }
.wk-day:hover { background: var(--surface-2); }
.wk-day.sel { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--text); }
.wk-d { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-size: 12px; color: var(--text-3); }
.wk-d .dn { font-size: 13px; }
.wk-day.today .dn { background: var(--accent); color: var(--accent-ink); }
.wk-ev { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wk-ev .ev { font-size: 12px; padding: 5px 8px; }
.wk-ev .ev span:last-child { white-space: normal; }
.wk-none { font-size: 13px; color: var(--text-3); }
.evl > li { grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; }
.evl > li.nodate { grid-template-columns: minmax(0, 1fr) auto; }
.nxd { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 48px; height: 48px; border: 1px solid var(--line-strong); border-radius: var(--r); font: 400 10px/1 var(--f-mono); color: var(--text-3); }
.nxd b { font: 500 17px/1.1 var(--f-mono); color: var(--text); }
.nxd.today { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.nxd.today b { color: var(--accent-ink); }
.evl .who { font-weight: 600; display: block; }
.evl .det { font-size: 13px; color: var(--text-2); display: block; }
.pill .shp { width: 8px; height: 8px; background: currentColor; }

/* ===== Ingresos ===== */
.metrics.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metrics.five .metric b { font-size: 30px; }
.metric span .cnt { margin-left: 6px; vertical-align: 1px; }
.chart-host { position: relative; }
.chart-host svg { display: block; width: 100%; height: auto; overflow: visible; }
.tip { position: absolute; z-index: 5; pointer-events: none; opacity: 0; transform: translate(-50%, -100%); background: var(--toast-bg); color: var(--toast-text); font: 400 12px/1.4 var(--f-mono); text-transform: none; padding: 6px 10px; border-radius: var(--r); white-space: nowrap; transition: opacity .12s; box-shadow: var(--toast-shadow); }
.tip.show { opacity: 1; }
.bar-m { fill: var(--line-strong); }
.bar-m.cur { fill: var(--accent); }
.hit { fill: var(--accent); opacity: 0; cursor: pointer; }
.hit:hover, .hit:focus-visible { opacity: .06; }
.val-t { font: 500 11px var(--f-mono); fill: var(--text-2); text-anchor: middle; }
.val-t.cur { fill: var(--text); }
.nm-t { font: 500 13px var(--f-body); fill: var(--text); }
.seg-paid { fill: var(--s1); }
.seg-rest { fill: var(--line-strong); }
.lgd { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--text-2); margin-bottom: 10px; }
.lgd span { display: inline-flex; align-items: center; gap: 7px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.sw.paid { background: var(--s1); } .sw.rest { background: var(--line-strong); }
.sw.m-t { background: var(--s1); } .sw.m-c { background: var(--s3); } .sw.m-e { background: var(--line-strong); }
.donut-w { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 28px; justify-content: center; }
.donut-w svg { width: 168px; height: 168px; flex: none; }
.dn-v { font: 700 20px var(--f-body); fill: var(--text); text-anchor: middle; letter-spacing: -.03em; }
.dn-l { font: 400 11px var(--f-body); fill: var(--text-3); text-anchor: middle; }
.dn-seg { fill: none; stroke-width: 18; }
.dn-seg.m-t { stroke: var(--s1); } .dn-seg.m-c { stroke: var(--s3); } .dn-seg.m-e { stroke: var(--line-strong); }
.mlist { display: grid; gap: 10px; flex: 1 1 180px; min-width: 0; }
.mlist li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.mlist .pc { font: 400 12px var(--f-mono); color: var(--text-3); }
.pbar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.pbar i { flex: 1; height: 4px; border-radius: var(--r-pill); background: var(--surface-2); position: relative; overflow: hidden; }
.pbar i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent); border-radius: var(--r-pill); }
.pbar span { font: 400 12px var(--f-mono); width: 34px; text-align: right; color: var(--text-2); }
#fin-table { min-width: 780px; }
#fin-table td.num, #fin-table th.r { font-variant-numeric: tabular-nums; }
.pay > li { grid-template-columns: 62px minmax(0, 1fr) auto; align-items: center; }
.pay .dt { font: 400 12px var(--f-mono); color: var(--text-3); text-transform: none; }
.pay .am { font: 500 14px var(--f-mono); text-transform: none; text-align: right; }
.pay .mt { display: block; font-size: 12px; color: var(--text-3); }
.view-tools { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; margin-bottom: 20px; }

/* ===== Más (hoja móvil) ===== */
.sheet { position: fixed; right: max(12px, env(safe-area-inset-right, 0px)); bottom: calc(74px + env(safe-area-inset-bottom, 0px)); z-index: 40; min-width: 200px; padding: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--toast-shadow); }
.sheet a, .sheet button { display: flex; align-items: center; width: 100%; min-height: 42px; padding: 0 14px; border: 0; background: transparent; border-radius: var(--r); text-decoration: none; color: var(--text); font-size: 14px; text-align: left; }
.sheet a:hover, .sheet button:hover { background: var(--surface-2); }
@media (min-width: 900px) { .sheet { display: none !important; } }

/* ===== Toast ===== */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; background: var(--toast-bg); color: var(--toast-text); padding: 12px 20px; border-radius: var(--r-pill); font-size: 14px; box-shadow: var(--toast-shadow); transition: opacity .18s, transform .18s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== Responsive ===== */
@media (min-width: 900px) {
  .gutter { padding-left: max(40px, env(safe-area-inset-left, 0px)); padding-right: max(40px, env(safe-area-inset-right, 0px)); }
}
@media (max-width: 1099px) {
  .split, .cols2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 899px) {
  .app { display: block; }
  .side { display: none; }
  .main { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding-block: 8px; }
  .topbar .logo { display: inline-flex; }
  .topbar .switch { order: 1; }
  .topbar .top-r { order: 2; }
  .topbar .logo { display: none; }
  .crumb { order: 3; flex: 1 1 100%; font-size: 11px; text-align: left; }
  .wrap { padding-block: 12px 40px; }
  h1 { font-size: 32px; }
  .head { padding: 8px 0 24px; }
  .head .sub { font-size: 15px; }
  .mnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--bg); border-top: 1px solid var(--line);
    padding: 6px max(8px, env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-right, 0px)); }
  .mnav a, .mnav button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; text-decoration: none; color: var(--text-3); font-size: 11px; font-weight: 500; border-radius: var(--r); min-height: 50px; background: transparent; border: 0; }
  .mnav a svg, .mnav button svg { width: 22px; height: 22px; }
  .mnav a[aria-current="page"], .mnav button[aria-current="page"] { color: var(--text); font-weight: 600; }
  .mnav .bd { position: absolute; top: 2px; left: calc(50% + 6px); }
  .strip { display: block; overflow-x: auto; margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--r-pill); -webkit-overflow-scrolling: touch; }
  .strip .steps { display: flex; width: max-content; min-width: 100%; }
  .strip .step { flex: 1 0 auto; }
  .strip .step a { padding: 8px 18px 8px 10px; gap: 10px; }
  .strip .step[aria-current="page"] a { background: var(--surface-2); border-radius: var(--r-pill); }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
  .cols3 { grid-template-columns: minmax(0, 1fr); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metrics.three .metric { padding: 14px; }
  .metrics.three .metric b { font-size: 26px; }
  .metrics.three .metric span { font-size: 12px; }
  .btn { min-height: 42px; }
  .btn.sm { min-height: 34px; }
  .seg button, .zoom button { min-height: 32px; }
  .zoom output { line-height: 32px; }
  .kv { grid-template-columns: 96px minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > div { padding-bottom: 8px; }
  .drop { padding: 30px 18px; }
  .toolbar .search { max-width: none; }

  #pt-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  #pt-table, #pt-table tbody { display: block; }
  #pt-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
  #pt-table tr:last-child { border-bottom: 0; }
  #pt-table td { padding: 0; border: 0; }
  #pt-table td.c-name { grid-column: 1; grid-row: 1; }
  #pt-table td.c-stage { grid-column: 2; grid-row: 1; }
  #pt-table td.c-scan, #pt-table td.c-al, #pt-table td.c-last { grid-column: 1 / 3; font: 400 12px var(--f-mono); text-transform: none; color: var(--text-3); text-align: left; }
  #pt-table td.c-scan { grid-row: 2; }
  #pt-table td.c-al { grid-row: 3; }
  #pt-table td.c-last { grid-row: 4; }
  #pt-table td.c-scan::before { content: "escaneo · "; }
  #pt-table td.c-al::before { content: "alineadores · "; }
  #pt-table td.c-last::before { content: "actividad · "; }
  #pt-table td.c-go { display: none; }
  .exp-list { max-height: 440px; }
  .file { grid-template-columns: minmax(0, 1fr) auto; }
  .file .sz { grid-column: 1; grid-row: 2; }
  .file .btn { grid-column: 2; grid-row: 1 / 3; }
  .act li { grid-template-columns: 1fr; }
}
@media (max-width: 899px) {
  .metrics.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics.five .metric:last-child { grid-column: 1 / -1; }
  .metrics.five .metric b { font-size: 26px; }
  .metrics.five .metric { padding: 14px 16px; }
}
@media (max-width: 639px) {
  .cal-day { min-height: 54px; align-items: center; padding: 4px 2px; gap: 4px; }
  .cal-day .evs { display: none; }
  .cal-day .dots { display: flex; }
  .dn { width: 26px; height: 26px; font-size: 13px; }
  .cal-head span { padding: 8px 2px 6px; text-align: center; }
  .cal-nav h2 { min-width: 7.5em; font-size: 16px; }
  .cal-bar { justify-content: center; }
  .wk-day { grid-template-columns: 52px minmax(0, 1fr); }
  .stage svg { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ===================================================================
   denti · añadidos de la aplicación real
   =================================================================== */
.small { font-size: 12px; }
.linkbtn { border: 0; background: transparent; padding: 0; color: var(--text-2); text-decoration: underline; font: inherit; font-size: 11px; }
.linkbtn:hover { color: var(--text); }
code { font: 400 12px var(--f-mono); text-transform: none; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.btn[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.danger { border-color: var(--text-3); color: var(--text-2); }
.btn.danger:hover { border-color: var(--text); color: var(--text); }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: transparent; }
.right { margin-left: auto; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23888' stroke-width='1.5'%3E%3Cpath d='m2.5 4.5 3.5 3.5 3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 12px; }
.input:disabled { opacity: .55; }
.err-text { font-size: 12px; color: var(--text); }
.view-loading { padding: 80px 0; text-align: center; color: var(--text-3); }
.pt-name[href] { cursor: pointer; }

/* Login / instalación */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px; }
.auth-card h1 { font-size: 32px; margin-top: 6px; }
.auth-card .form { margin-top: 6px; }
.auth-card .logo { align-self: flex-start; }

/* Modal */
dialog#modal { border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface); color: var(--text); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: var(--toast-shadow); text-transform: lowercase; overflow: hidden; }
dialog#modal[open] { display: flex; flex-direction: column; }
dialog#modal::backdrop { background: rgba(0, 0, 0, .35); }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h h2 { font-size: 18px; letter-spacing: -.02em; }
.modal-b { padding: 20px; overflow-y: auto; display: grid; gap: 16px; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal-f .left { margin-right: auto; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

/* Estados vacíos */
.empty-state { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 44px 20px; color: var(--text-2); }
.empty-state svg { width: 40px; height: 40px; color: var(--text-3); }
.empty-state h2 { font-size: 20px; letter-spacing: -.02em; font-weight: 700; color: var(--text); }
.empty-state p { max-width: 44ch; font-size: 14px; }
.empty-state.dashed { border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--tint-1); }

/* Visor 3D real */
.stage3d { position: relative; height: 460px; background-color: var(--surface);
  background-image: linear-gradient(var(--grid-major) 1px, transparent 1px), linear-gradient(90deg, var(--grid-major) 1px, transparent 1px), linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 16px 16px, 16px 16px; background-position: -1px -1px; }
.stage3d canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.stage3d .stage-tag { z-index: 2; }
.v3-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--text-2); font-size: 14px; pointer-events: none; }
.v3-msg.err { color: var(--text); }
@media (max-width: 639px) { .stage3d { height: 340px; } }

/* Odontograma */
.odo { padding: 8px 0 4px; }
.odo-grid { display: grid; gap: 14px; justify-items: stretch; }
.odo-row { display: flex; gap: 0; align-items: center; justify-content: center; width: 100%; }
.odo-half { display: flex; gap: 4px; flex: 1 1 0; min-width: 0; }
.odo-mid { width: 1px; align-self: stretch; background: var(--line-strong); margin: 0 6px; flex: none; }
.odo-tooth { position: relative; flex: 1 1 0; min-width: 0; max-width: 40px; height: 48px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 10px 10px 14px 14px; background: transparent; color: var(--text-3); font: 500 11px var(--f-mono); text-transform: none; padding: 0; }
.odo-tooth:hover { border-color: var(--text); color: var(--text); }
.odo-tooth.on { background: var(--tint-3); border-color: var(--line-strong); color: var(--text); }
.odo-tooth.rev { background: var(--tint-2); border: 1.6px dashed var(--text); color: var(--text); }
.odo-tooth.off { border-style: dashed; opacity: .7; }
.odo-tooth.sel { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.odo-lbl { font: 500 11px var(--f-body); color: var(--text-3); text-align: center; }
.odo-half:first-child { justify-content: flex-end; }
@media (max-width: 639px) { .odo-tooth { height: 38px; font-size: 9px; border-radius: 6px 6px 9px 9px; } .odo-half { gap: 2px; } .odo-mid { margin: 0 3px; } }

/* Planificación */
.sl-in { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: 12px; align-items: center; }
.tbl tr.sel-row td { background: var(--tint-1); }
#mov-body tr { cursor: pointer; }
#mov-body tr:hover td { background: var(--surface-2); }
.plan-tooth-list { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-tooth-list button { min-width: 42px; }
.stage .iso-wrap { cursor: default; }
.stage svg g[data-f] { cursor: pointer; }
.stage svg g[data-f]:hover .ft { stroke: var(--text); }

/* Secuencia */
.opt-card h2 { font-size: 20px; letter-spacing: -.02em; }
.fl-row .pill.past { opacity: .7; }

/* Exportación */
.exp-list td, .exp-list th { padding-block: 10px; }

/* Archivos */
.file-actions { display: flex; gap: 6px; }

/* Calendario */
.ev { cursor: pointer; }
.ev.cancelada { text-decoration: line-through; opacity: .6; }
.cal-day { cursor: pointer; }

/* Ingresos */
.metrics.five .metric b { font-size: 28px; }
.pay > li { grid-template-columns: 62px minmax(0, 1fr) auto auto; }
.pay .am-wrap { display: flex; align-items: center; gap: 4px; }
#fin-table tbody tr { cursor: pointer; }
#fin-table tbody tr:hover td { background: var(--surface-2); }
.icon-sm { width: 30px; height: 30px; }
.icon-sm svg { width: 15px; height: 15px; }

/* Paciente: lista de casos */
.case-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; background: transparent; width: 100%; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.case-row:first-child { border-top: 0; padding-top: 0; }
.case-row:hover .case-t { text-decoration: underline; }
.case-row[aria-current="true"] .case-t::after { content: " · seleccionado"; font-weight: 400; color: var(--text-3); }
.case-t { font-weight: 600; }
.case-s { font: 400 12px var(--f-mono); text-transform: none; color: var(--text-3); }
.proc .d { text-transform: none; }
.act time { text-transform: none; }

/* Toast de error */
.toast.err { background: var(--accent); }

@media print { .side, .topbar, .mnav, .toast { display: none !important; } }
