:root {
  color-scheme: light;
  --bg-1: #eef2fa;
  --bg-2: #f8f9fd;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --line: rgba(17, 32, 66, 0.08);
  --line-2: rgba(17, 32, 66, 0.14);
  --text-primary: #0f1a33;
  --text-secondary: #55607a;
  --text-muted: #8a93a8;
  --accent: #2a63e8;
  --accent-soft: #e8efff;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;
  --good: #1a9e5c;
  --warning: #d98a00;
  --critical: #d93d3d;
  --shadow: 0 10px 30px rgba(30, 50, 100, 0.1), 0 2px 6px rgba(30, 50, 100, 0.06);
  --r: 16px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --display: 'Space Grotesk', 'Inter', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font: 14px/1.45 var(--font);
  color: var(--text-primary);
  background: radial-gradient(1200px 800px at 70% 30%, #ffffff 0%, var(--bg-2) 40%, var(--bg-1) 100%);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
.ic { flex: none; }

#world { position: fixed; inset: 0; }
#world canvas { display: block; }
.labels-layer { position: absolute; inset: 0; pointer-events: none; }

.glass {
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  border-radius: var(--r);
}

/* ── Barra superior ─────────────────────────────────────────── */
.topbar {
  position: fixed; top: 14px; left: 14px; right: 14px; height: 58px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 14px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { font: 900 17px/1 'Montserrat', var(--display); letter-spacing: 0.04em; color: #0a1f2e; }
.brand { cursor: pointer; }
.brand-mark { width: 34px; height: 36px; display: block; }
.loader-mark { width: 72px; animation: float 1.6s ease-in-out infinite; }
.brand .sub { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.top-actions { display: flex; gap: 8px; }
.top-right { display: flex; align-items: center; gap: 8px; }
.sync { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-secondary); padding: 6px 11px; border-radius: 999px; background: rgba(17, 32, 66, 0.05); cursor: default; white-space: nowrap; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: #9aa3b5; }
.sync[data-state='saved'] i { background: var(--good); box-shadow: 0 0 0 3px rgba(26, 158, 92, 0.18); }
.sync[data-state='saving'] i, .sync[data-state='dirty'] i { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.sync[data-state='locked'] i { background: var(--warning); }
.sync[data-state='locked'] { color: #8a5a00; background: #fff4dc; }
.sync[data-state='error'] i { background: var(--critical); }
.sync[data-state='error'] { color: var(--critical); background: #fdeaea; }
@keyframes pulse { 50% { opacity: 0.35; } }
.file-box { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #f3f7ff; border: 1px solid #cfe0fb; margin-bottom: 14px; color: var(--accent); }
.file-box div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-box b { color: var(--text-primary); font-size: 13px; }
.file-box small { color: var(--text-secondary); font-size: 11.5px; overflow-wrap: anywhere; }
.file-box.off { background: rgba(17, 32, 66, 0.04); border-color: var(--line); color: var(--text-muted); }
.file-box code { font-size: 11px; background: rgba(17, 32, 66, 0.06); padding: 1px 4px; border-radius: 4px; }
.saved-item.current { border-color: var(--accent); }
.sens-note { margin: -2px 0 10px; }

/* ── Botones y controles ───────────────────────────────────── */
.btn { white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-2); background: var(--surface-solid); border-radius: 11px; padding: 9px 14px; font-weight: 600; font-size: 13px; transition: transform 0.15s, box-shadow 0.2s, background 0.2s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(30, 50, 100, 0.1); }
.btn.unsaved { position: relative; }
.btn.unsaved::after { content: ''; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 2px #fff; }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(42, 99, 232, 0.3); }
.btn.ghost { background: rgba(255, 255, 255, 0.6); }
.btn.block { width: 100%; justify-content: center; margin-top: 12px; }
.btn.glow { animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 6px 26px rgba(42, 99, 232, 0.55), 0 0 0 6px rgba(42, 99, 232, 0.12); } }
.icon-btn { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--text-secondary); }
.icon-btn:hover { background: rgba(17, 32, 66, 0.06); color: var(--text-primary); }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; text-align: left; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px dashed var(--line-2); background: rgba(255, 255, 255, 0.7); border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.chip:hover { border-style: solid; color: var(--text-primary); }
.chip i { width: 8px; height: 8px; border-radius: 50%; }
.chip.accent { border: 1px solid transparent; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chip.static { border-style: solid; cursor: default; font-weight: 600; }

.seg { display: inline-flex; background: rgba(17, 32, 66, 0.05); border-radius: 11px; padding: 3px; gap: 2px; }
.seg.wrap { flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--text-secondary); transition: background 0.2s, color 0.2s, box-shadow 0.2s; }
.seg button.on { background: var(--surface-solid); color: var(--text-primary); box-shadow: 0 2px 6px rgba(30, 50, 100, 0.12); font-weight: 600; }
.seg.mini button { padding: 4px 9px; font-size: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.field.sm { margin: 0; min-width: 0; }
.field.sm > span { font-size: 11px; font-weight: 500; }
.field input[type='text'], .inp { width: 100%; border: 1px solid var(--line-2); background: var(--surface-solid); border-radius: 11px; padding: 10px 12px; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.inp { display: flex; align-items: center; gap: 6px; padding: 0 10px; }
.inp input { border: 0; outline: none; background: transparent; padding: 10px 0; width: 100%; min-width: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.field.sm .inp input { padding: 7px 0; font-size: 13px; }
.inp em { font-style: normal; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.field input[type='text']:focus, .inp:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(42, 99, 232, 0.12); }
.hint { color: var(--text-muted); font-size: 11.5px; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.neg { color: var(--critical) !important; }
.warn { color: var(--warning) !important; }
.ok { color: var(--good) !important; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid3 .field { margin-bottom: 10px; }
.sub-h { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin: 16px 0 8px; }

/* ── Asistente ─────────────────────────────────────────────── */
.wizard {
  position: fixed; top: 86px; left: 14px; bottom: 14px; width: min(470px, calc(100vw - 28px)); z-index: 10;
  display: flex; flex-direction: column; padding: 18px 20px 16px; transition: transform 0.7s cubic-bezier(0.7, 0, 0.2, 1), opacity 0.5s;
}
body[data-mode='dashboard'] .wizard { transform: translateX(-110%); opacity: 0; pointer-events: none; }
.wz-progress { display: flex; gap: 4px; margin-bottom: 18px; }
.wz-progress .dot { flex: 1; height: 5px; border: 0; padding: 0; border-radius: 3px; background: rgba(17, 32, 66, 0.08); position: relative; transition: background 0.3s; }
.wz-progress .dot.done { background: #9dbcf5; }
.wz-progress .dot.on { background: var(--accent); }
.wz-progress .dot span { position: absolute; top: 9px; left: 0; font-size: 10.5px; color: var(--text-muted); white-space: nowrap; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.wz-progress .dot.on span, .wz-progress .dot:hover span { opacity: 1; }
.wz-progress .dot.on span { color: var(--accent); font-weight: 600; }
.wz-step { flex: 1; overflow-y: auto; padding: 14px 2px 8px; margin: 0 -4px; padding-inline: 4px; scrollbar-width: thin; }
.wz-step h2 { font: 600 26px/1.15 var(--display); margin: 2px 0 8px; letter-spacing: -0.01em; }
.lead { color: var(--text-secondary); margin: 0 0 18px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }

.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-card { text-align: left; border: 1.5px solid var(--line); background: var(--surface-solid); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 4px; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; }
.type-card:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(30, 50, 100, 0.1); }
.type-card.on { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(42, 99, 232, 0.12); }
.type-card .ti { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.type-card.on .ti { background: var(--accent); color: #fff; }
.type-card small { color: var(--text-secondary); font-size: 12px; line-height: 1.35; }
.type-card:last-child:nth-child(odd) { grid-column: span 2; }

.rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.row-card { border: 1px solid var(--line); background: var(--surface-solid); border-radius: 13px; padding: 10px 12px; }
.row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.row-name { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-weight: 600; padding: 3px 4px; border-radius: 6px; }
.row-name:focus { background: rgba(17, 32, 66, 0.05); }
.row-title { flex: 1; }
.dot-c { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.row-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: end; }
.mini-stat { display: flex; flex-direction: column; gap: 2px; padding-bottom: 6px; }
.mini-stat span { font-size: 11px; color: var(--text-muted); }
.mini-stat b { font-variant-numeric: tabular-nums; font-size: 13px; }
.mini-stat.big b { font: 600 18px/1.2 var(--display); color: var(--accent); }
.kind-tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.kind-tag.k-sotano, .kind-tag.k-plataforma { background: #eef0f4; color: #5c667c; }
.kind-tag.k-comun { background: #f1eefc; color: #4a3aa7; }
.kind-tag.k-amenidad { background: #e7f7f0; color: #127a54; }
.add-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.totals { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 12px; border-radius: 12px; background: rgba(42, 99, 232, 0.06); font-size: 12.5px; color: var(--text-secondary); }
.totals b { color: var(--text-primary); font-variant-numeric: tabular-nums; margin-left: 4px; }
.vis-helper { border: 1px solid #cfe0fb; background: #f3f7ff; border-radius: 14px; padding: 12px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.vis-helper .grid3 { width: 100%; align-items: end; }
.mini-curve { margin: -2px 0 12px; }
.mk { font-size: 10px; fill: var(--text-secondary); font-weight: 600; }

.wz-live { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px 0 12px; border-top: 1px solid var(--line); margin-top: 6px; }
.wz-live div { display: flex; flex-direction: column; }
.wz-live span { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.wz-live b { font: 600 15px/1.3 var(--display); font-variant-numeric: tabular-nums; }
.wz-nav { display: flex; justify-content: space-between; }
.saved { margin-top: 10px; }
.saved-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; background: var(--surface-solid); }
.saved-item .link { display: flex; align-items: center; gap: 8px; color: var(--text-primary); }
.saved-item small { color: var(--text-muted); font-weight: 400; margin-left: 4px; }

/* ── Pines 3D ───────────────────────────────────────────────── */
.pin { display: flex; align-items: center; gap: 7px; background: rgba(255, 255, 255, 0.94); border-radius: 10px; padding: 6px 10px 6px 8px; box-shadow: 0 6px 16px rgba(30, 50, 100, 0.16); font-size: 12px; color: var(--text-secondary); white-space: nowrap; transform: translate(8px, 0); animation: pinIn 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3); font-variant-numeric: tabular-nums; }
.pin i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.pin span { display: flex; flex-direction: column; line-height: 1.25; }
.pin b { color: var(--text-primary); font-size: 12.5px; }
@keyframes pinIn { from { opacity: 0; transform: translate(8px, 8px) scale(0.9); } }

.legend-3d { position: fixed; z-index: 9; display: none; gap: 14px; padding: 7px 12px; font-size: 11.5px; color: var(--text-secondary); border-radius: 11px; }
.legend-3d span { display: flex; align-items: center; gap: 6px; }
.legend-3d i { width: 12px; height: 9px; border-radius: 2px; display: inline-block; }
.legend-3d i.ghost { border: 1.5px dashed var(--series-1); background: rgba(42, 120, 214, 0.08); }
body[data-mode='dashboard'] .legend-3d { display: flex; left: 50%; transform: translateX(-50%); bottom: 270px; }

/* ── Dashboard ─────────────────────────────────────────────── */
.dashboard { position: fixed; inset: 0; pointer-events: none; z-index: 8; opacity: 0; transition: opacity 0.4s; }
.dashboard.open { opacity: 1; }
.dashboard.open > * { pointer-events: auto; }
.card { padding: 14px 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-h b { display: flex; align-items: center; gap: 7px; font: 600 15px/1.2 var(--display); }

.kpis { position: absolute; top: 86px; left: 14px; right: 14px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.kpi { padding: 12px 14px; border-radius: 14px; position: relative; overflow: hidden; }
.kpi::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: 0.85; }
.kpi.good::after { background: var(--good); }
.kpi.warn::after { background: var(--warning); }
.kpi.bad::after { background: var(--critical); }
.kpi-h { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-secondary); font-weight: 600; }
.kpi-ic { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi-v { font: 600 25px/1.15 var(--display); margin: 6px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.kpi-s { font-size: 11.5px; color: var(--text-muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.delta { font-weight: 700; font-size: 11px; padding: 1px 6px; border-radius: 6px; }
.delta.up { color: var(--good); background: #e6f6ed; }
.delta.down { color: var(--critical); background: #fdeaea; }

.struct { position: absolute; top: 196px; left: 14px; width: 300px; bottom: 270px; overflow-y: auto; scrollbar-width: thin; }
.sens { position: absolute; top: 196px; right: 14px; width: 310px; bottom: 270px; overflow-y: auto; scrollbar-width: thin; }
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: #fff; }
.stack span { min-width: 2px; }
.cost-list { margin-top: 10px; }
.cl-row { display: grid; grid-template-columns: 12px 1fr auto 52px; gap: 8px; align-items: center; padding: 4px 0; font-size: 12.5px; border-bottom: 1px dashed var(--line); }
.cl-row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.cl-row em { font-style: normal; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; font-size: 11.5px; }
.cl-row.total { border-bottom: 0; border-top: 1.5px solid var(--line-2); margin-top: 4px; padding-top: 7px; font-weight: 700; }
.cl-row.total b { font: 700 14px var(--display); }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.ratios { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.ratios.four { grid-template-columns: repeat(4, 1fr); }
.ratios div { background: rgba(17, 32, 66, 0.04); border-radius: 10px; padding: 7px 9px; display: flex; flex-direction: column; }
.ratios span { font-size: 10.5px; color: var(--text-muted); font-weight: 600; }
.ratios b { font-variant-numeric: tabular-nums; font-size: 13.5px; }

.sliders { display: flex; flex-direction: column; gap: 10px; }
.slider { display: block; }
.slider small { color: var(--text-muted); font-size: 10.5px; }
.sl-h { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 4px; }
.sl-h b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.slider.changed .sl-h b { color: var(--accent); }
input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; --k: 50%; --b: 50%; }
input[type='range']::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background:
    linear-gradient(to right, transparent calc(var(--b) - 1px), rgba(17, 32, 66, 0.35) calc(var(--b) - 1px), rgba(17, 32, 66, 0.35) calc(var(--b) + 1px), transparent calc(var(--b) + 1px)),
    linear-gradient(to right, var(--accent) var(--k), rgba(17, 32, 66, 0.1) var(--k));
}
input[type='range']::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--k), rgba(17, 32, 66, 0.1) var(--k)); }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); margin-top: -6px; box-shadow: 0 2px 8px rgba(42, 99, 232, 0.35); transition: transform 0.15s; }
input[type='range']::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type='range']::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.toggle { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-secondary); cursor: pointer; }
.toggle input { display: none; }
.toggle span { width: 34px; height: 20px; border-radius: 10px; background: rgba(17, 32, 66, 0.15); position: relative; transition: background 0.2s; flex: none; }
.toggle span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(14px); }
.scen { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.scen-t { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.scen-t th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: 10.5px; padding: 3px 2px; }
.scen-t td { padding: 4px 2px; border-top: 1px solid var(--line); }

.dock { position: absolute; left: 14px; right: 14px; bottom: 14px; height: 244px; padding: 10px 16px 8px; display: flex; flex-direction: column; }
.dock-top { display: flex; align-items: center; gap: 14px; }
.play { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(42, 99, 232, 0.35); flex: none; }
.dock-month { display: flex; flex-direction: column; min-width: 150px; }
.dock-month b { font: 600 17px/1.1 var(--display); }
.dock-month small { color: var(--text-muted); font-size: 11.5px; }
.dock-stats { display: flex; gap: 20px; flex: 1; }
.dock-stats div { display: flex; flex-direction: column; }
.dock-stats span { font-size: 10.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.dock-stats b { font-variant-numeric: tabular-nums; font-size: 14px; }
.dock-chart { flex: 1; min-height: 0; margin-top: 4px; }
.dock-legend { margin: 2px 0 0; }
.scrub { margin-top: 4px; flex: none; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .ln { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }

/* ── Gráficos ──────────────────────────────────────────────── */
.chart { display: block; overflow: visible; }
.chart .grid { stroke: rgba(17, 32, 66, 0.07); stroke-width: 1; }
.chart .zero { stroke: rgba(17, 32, 66, 0.3); stroke-width: 1; }
.chart .tick { font-size: 10px; fill: var(--text-muted); font-variant-numeric: tabular-nums; }
.chart .lbl { font-size: 12px; fill: var(--text-secondary); }
.chart .val { font-size: 10.5px; fill: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .cellv { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none; }
.chart .marker { stroke: rgba(17, 32, 66, 0.28); stroke-dasharray: 3 3; }
.chart .mk { font-size: 9.5px; fill: var(--text-secondary); font-weight: 700; }
.chart .cursor { stroke: var(--text-primary); stroke-width: 1.5; }
.chart .hit { cursor: crosshair; }
.chart rect[data-i] { cursor: default; }
.chart-tip { position: fixed; z-index: 100; display: none; pointer-events: none; background: rgba(15, 26, 51, 0.94); color: #fff; border-radius: 10px; padding: 8px 10px; font-size: 12px; min-width: 150px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2); font-variant-numeric: tabular-nums; }
.chart-tip div { display: flex; align-items: center; gap: 6px; }
.chart-tip div b { margin-left: auto; padding-left: 12px; }
.chart-tip .tt-h { font-weight: 700; margin-bottom: 4px; color: #cfe0ff; }
.chart-tip .tt-s { color: #9fb0cf; font-size: 11px; }

/* ── Hoja de análisis ──────────────────────────────────────── */
.sheet { position: fixed; inset: 86px 14px 14px; z-index: 30; pointer-events: none; opacity: 0; transform: translateY(20px) scale(0.99); transition: opacity 0.35s, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet.open { opacity: 1; transform: none; pointer-events: auto; }
.sheet-in { height: 100%; display: flex; flex-direction: column; background: rgba(255, 255, 255, 0.95); }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sheet-h h2 { font: 600 22px/1.2 var(--display); margin: 2px 0 0; }
.sheet-actions { display: flex; gap: 6px; align-items: center; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.panel { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: #fff; min-width: 0; }
.panel h3 { font: 600 14.5px/1.3 var(--display); margin: 0 0 8px; }
.panel h3 + .legend { margin-bottom: 6px; }
.panel h3:not(:first-child) { margin-top: 16px; }
.pyg { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pyg th { text-align: right; font-size: 11px; color: var(--text-muted); font-weight: 600; padding: 5px 6px; border-bottom: 1px solid var(--line-2); }
.pyg th:first-child, .pyg td:first-child { text-align: left; }
.pyg td { text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--line); }
.pyg td .sw { margin-right: 6px; }
.pyg tr.strong td { font-weight: 700; }
.pyg tr.sub td { color: var(--text-muted); font-size: 11.5px; }
.pyg tr.sub td:first-child { padding-left: 18px; }
.pyg tr.total td { font-weight: 700; border-top: 1.5px solid var(--text-primary); border-bottom: 0; font-size: 13.5px; }
.table-wrap { overflow-x: auto; }
.cash { border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cash th { position: sticky; top: 0; background: #fff; font-weight: 600; color: var(--text-muted); padding: 4px 8px; text-align: right; border-bottom: 1px solid var(--line-2); }
.cash th small { display: block; font-weight: 400; font-size: 9.5px; }
.cash td { padding: 4px 8px; text-align: right; border-bottom: 1px solid var(--line); }
.cash td:first-child, .cash th:first-child { position: sticky; left: 0; background: #fff; text-align: left; font-weight: 600; z-index: 1; }
.cash tr.strong td { font-weight: 700; background: #f6f8fc; }
.cash tr.strong td:first-child { background: #f6f8fc; }

/* ── Varios ────────────────────────────────────────────────── */
#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--text-primary); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13px; opacity: 0; transition: opacity 0.3s, transform 0.3s; z-index: 200; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#loader { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: var(--bg-2); transition: opacity 0.6s, visibility 0.6s; }
#loader.done { opacity: 0; visibility: hidden; }
.loader-in { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-secondary); }

@keyframes float { 50% { transform: translateY(-8px) rotate(6deg); } }

@media (max-width: 1280px) {
  .top-actions .btn, #btn-excel { font-size: 0; gap: 0; padding: 9px; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .struct, .sens { top: 268px; }
}
@media (max-width: 900px) {
  .top-actions .btn, #btn-excel { font-size: 0; gap: 0; padding: 9px; }
  .sync span { display: none; }
  .topbar { left: 10px; right: 10px; top: 10px; }
  .wizard { top: auto; height: 58vh; bottom: 10px; left: 10px; right: 10px; width: auto; }
  .dashboard { padding: 80px 10px 10px; overflow-y: auto; }
  .dashboard.open { pointer-events: auto; }
  .dashboard .kpis, .dashboard .struct, .dashboard .sens, .dashboard .dock {
    position: relative; inset: auto; width: auto; height: auto; margin-bottom: 10px;
  }
  .dashboard .kpis { grid-template-columns: repeat(2, 1fr); margin-bottom: 46vh; }
  .dashboard .dock { display: block; }
  .dashboard .dock-top { flex-wrap: wrap; }
  .dashboard .dock-chart { height: 150px; }
  .kpi-v { font-size: 21px; }
  body[data-mode='dashboard'] .legend-3d { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .dock-stats { order: 3; flex-basis: 100%; }
  .row-fields, .grid3 { grid-template-columns: 1fr 1fr; }
  .wz-live { grid-template-columns: 1fr 1fr; }
  .sheet { inset: 70px 6px 6px; }
}

/* ── Inicio ─────────────────────────────────────────────────── */
body[data-mode='home'] .topbar, body[data-mode='home'] .wizard { opacity: 0; pointer-events: none; transform: translateY(-8px); }
.topbar { transition: opacity 0.4s, transform 0.4s; }
.home { position: fixed; inset: 0; z-index: 12; display: none; padding: 14px; gap: 14px; }
.home.open { display: grid; grid-template-columns: minmax(360px, 430px) 1fr; animation: homeIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes homeIn { from { opacity: 0; transform: translateY(12px); } }
.home-left { padding: 28px 28px 20px; display: flex; flex-direction: column; overflow-y: auto; }
.home-logo { display: flex; flex-direction: column; align-items: center; padding: 6px 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.home-mark { width: 118px; height: auto; filter: drop-shadow(0 12px 22px rgba(10, 31, 46, 0.18)); animation: markIn 1.1s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
@keyframes markIn { from { opacity: 0; transform: translateY(-14px) scale(0.92); } }
.home-word { font: 900 34px/1 'Montserrat', sans-serif; letter-spacing: 0.02em; color: #262626; margin-top: 16px; }
.home-word.sm { font-size: 20px; margin-top: 4px; }
.home-tag { font: 300 13.5px/1 'Josefin Sans', sans-serif; letter-spacing: 0.16em; color: #262626; margin-top: 7px; }
.home-copy h1 { font: 600 26px/1.15 var(--display); margin: 8px 0 8px; letter-spacing: -0.01em; }
.home-copy p { color: var(--text-secondary); margin: 0 0 18px; }
.btn.big { padding: 13px 18px; font-size: 14.5px; justify-content: center; border-radius: 13px; }
.btn.primary.big { background: #0a1f2e; box-shadow: 0 10px 24px rgba(10, 31, 46, 0.28); }
.home-types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type-pill { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface-solid); border-radius: 12px; padding: 10px 12px; font-weight: 600; font-size: 13px; text-align: left; transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s; }
.type-pill:hover { transform: translateY(-1px); border-color: var(--line-2); box-shadow: 0 6px 14px rgba(30, 50, 100, 0.08); }
.type-pill:last-child:nth-child(odd) { grid-column: span 2; }
.home-foot { margin-top: auto; padding-top: 18px; font-size: 12px; color: var(--text-muted); display: flex; gap: 6px; align-items: flex-start; }
.home-foot b { color: var(--text-secondary); }
.home-right { padding: 20px 22px; display: flex; flex-direction: column; min-width: 0; background: rgba(255, 255, 255, 0.72); }
.home-rh { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.home-rh h2 { font: 600 22px/1.1 var(--display); margin: 0; }
.home-search { flex: 1; display: flex; justify-content: flex-end; }
.home-search input { width: min(340px, 100%); border: 1px solid var(--line-2); background: var(--surface-solid); border-radius: 11px; padding: 9px 12px; outline: none; }
.home-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(42, 99, 232, 0.12); }
.home-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; align-content: start; padding: 2px; scrollbar-width: thin; }
.pcard { text-align: left; border: 1px solid var(--line); background: var(--surface-solid); border-radius: 16px; padding: 14px 15px 12px; display: flex; flex-direction: column; gap: 3px; transition: transform 0.18s, box-shadow 0.2s, border-color 0.2s; animation: cardIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: var(--d); }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } }
.pcard:hover { transform: translateY(-3px); box-shadow: 0 14px 28px rgba(30, 50, 100, 0.12); border-color: var(--line-2); }
.pc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pc-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.pc-type { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.pc-lock { margin-left: auto; font-size: 10.5px; font-weight: 700; color: #8a5a00; background: #fff4dc; padding: 3px 7px; border-radius: 6px; }
.pc-name { font: 600 16.5px/1.25 var(--display); }
.pc-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.pc-kpis div { display: flex; flex-direction: column; }
.pc-kpis span { font-size: 10.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.pc-kpis b { font-variant-numeric: tabular-nums; font-size: 13.5px; }
.pc-kpis b.good { color: var(--good); } .pc-kpis b.warn { color: var(--warning); } .pc-kpis b.bad { color: var(--critical); }
.pc-bar { height: 4px; border-radius: 2px; background: rgba(17, 32, 66, 0.07); margin-top: 10px; overflow: hidden; }
.pc-bar i { display: block; height: 100%; border-radius: 2px; background: var(--good); }
.pc-bar i.warn { background: var(--warning); } .pc-bar i.bad { background: var(--critical); }
.pc-units { margin-top: 6px; font-size: 11px; }
.home-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 60px 20px; text-align: center; }
.home-empty img { width: 64px; opacity: 0.5; margin-bottom: 8px; }

/* ── Detalle de costos ─────────────────────────────────────── */
.sheet.costs { z-index: 40; inset: 14px; }
.ce-in { height: 100%; display: flex; flex-direction: column; background: rgba(255, 255, 255, 0.97); }
.ce-in .sheet-h h2 { margin-bottom: 4px; }
.ce-in .sheet-h p { margin: 0; max-width: 560px; }
.ce-sum { display: flex; gap: 18px; }
.ce-sum div { display: flex; flex-direction: column; }
.ce-sum span { font-size: 10.5px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.ce-sum b { font: 600 19px/1.2 var(--display); font-variant-numeric: tabular-nums; }
.ce-sum small { color: var(--text-muted); font-size: 11.5px; }
.ce-body { padding-top: 8px; }
.ce-group { margin-bottom: 18px; }
.ce-gh { display: flex; align-items: center; gap: 9px; position: sticky; top: -16px; background: rgba(255, 255, 255, 0.97); padding: 10px 0 8px; z-index: 3; }
.ce-gh h3 { font: 600 15px/1.2 var(--display); margin: 0; }
.ce-gt { color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; flex: 1; }
.ce-table { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.ce-row { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(150px, 1fr) minmax(200px, 1.3fr) minmax(220px, 1.3fr) minmax(190px, 1.2fr) 32px; gap: 8px; align-items: center; padding: 6px 10px; border-top: 1px solid var(--line); }
.ce-row:first-child { border-top: 0; }
.ce-row:hover:not(.ce-head) { background: #fafbfe; }
.ce-head { font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; background: #f6f8fc; padding-top: 8px; padding-bottom: 8px; }
.ce-name { border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 6px 8px; font-weight: 500; outline: none; min-width: 0; }
.ce-name:hover { border-color: var(--line); }
.ce-name:focus { border-color: var(--accent); background: #fff; }
.ce-row select { width: 100%; min-width: 0; border: 1px solid var(--line-2); background: #fff; border-radius: 9px; padding: 6px 6px; font-size: 12.5px; outline: none; }
.ce-row select:focus { border-color: var(--accent); }
.inp.sm { padding: 0 8px; border-radius: 9px; }
.inp.sm input { padding: 6px 0; font-size: 12.5px; text-align: right; }
.ce-when { display: flex; gap: 5px; min-width: 0; }
.ce-when select { flex: 1; }
.ce-when .off { width: 66px; flex: none; }
.ce-auto { font-size: 11.5px; color: var(--text-muted); font-style: italic; }
.ce-tl { position: relative; height: 22px; background: repeating-linear-gradient(90deg, transparent 0 calc(100% / 12 - 1px), rgba(17, 32, 66, 0.04) calc(100% / 12 - 1px) calc(100% / 12)); border-radius: 6px; }
.ce-tl i { position: absolute; top: 6px; height: 10px; border-radius: 5px; transition: left 0.3s, width 0.3s; }
.ce-tl i.rec { opacity: 0.35; background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.6) 0 3px, transparent 3px 6px) !important; }
.ce-tl small { position: absolute; right: 2px; top: -9px; font-size: 9.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ce-tl-h { position: relative; height: 26px; }
.ce-scale { position: absolute; inset: 0; }
.ce-scale span { position: absolute; top: 0; font-size: 9.5px; color: var(--text-secondary); text-transform: none; letter-spacing: 0; border-left: 1px dashed var(--line-2); padding-left: 3px; height: 26px; line-height: 1.1; white-space: nowrap; }
.ce-scale span small { color: var(--text-muted); font-weight: 500; }
.ce-obra { position: absolute; bottom: 0; height: 3px; border-radius: 2px; background: var(--series-4); opacity: 0.6; }
.ce-tot { display: flex; flex-direction: column; text-align: right; }
.ce-tot b { font-variant-numeric: tabular-nums; font-size: 13px; }
.ce-tot small { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.btn-row .btn { justify-content: center; }
.cost-cta { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin-top: 14px; border: 1px solid #cfe0fb; background: #f3f7ff; border-radius: 14px; padding: 12px 14px; color: var(--accent); transition: transform 0.15s, box-shadow 0.2s; }
.cost-cta:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(42, 99, 232, 0.12); }
.cost-cta .ti { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; }
.cost-cta > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.cost-cta b { color: var(--text-primary); }
.cost-cta small { color: var(--text-secondary); font-size: 11.5px; }

@media (max-width: 900px) {
  .home.open { grid-template-columns: 1fr; overflow-y: auto; padding: 10px; }
  .home-left, .home-right { overflow: visible; }
  .home-grid { overflow: visible; }
  .ce-row { grid-template-columns: 1fr 1fr; }
  .ce-row .ce-name { grid-column: 1 / -1; }
  .ce-head { display: none; }
  .ce-sum { display: none; }
}

.year-step { display: flex; align-items: center; gap: 4px; }
.year-step b { min-width: 74px; text-align: center; font-variant-numeric: tabular-nums; }
.year-step .icon-btn { width: 24px; height: 24px; font-weight: 700; background: rgba(17, 32, 66, 0.05); }
.toggle.small-t { margin-top: 8px; font-size: 12px; }
.mini-stat.big small { font-size: 11px; }

/* ── Etapas ─────────────────────────────────────────────────── */
.stage-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -4px 0 12px; padding: 4px; background: rgba(17, 32, 66, 0.04); border-radius: 12px; }
.stage-tab { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 4px; }
.stage-tab.on { background: #0a1f2e; color: #fff; box-shadow: 0 3px 8px rgba(10, 31, 46, 0.25); }
.stage-tab.add { color: var(--accent); }
.stage-bar .icon-btn { margin-left: auto; }
.stage-plan { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; margin-bottom: 10px; }
.sp-row { display: grid; grid-template-columns: 1.2fr 1fr 0.8fr 0.8fr 0.8fr; gap: 6px; align-items: center; padding: 6px 8px; border-top: 1px solid var(--line); }
.sp-row:first-child { border-top: 0; }
.sp-row > small { grid-column: 1 / -1; font-size: 11px; }
.sp-head { font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; background: #f6f8fc; }
.sp-head span:last-child { display: none; }
.sp-row input[type='text']:not(.inp input) { border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 8px; font-weight: 600; min-width: 0; width: 100%; outline: none; }
.stage-gantt { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.sg-row { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: center; font-size: 11.5px; font-weight: 600; }
.sg-track { position: relative; height: 14px; background: rgba(17, 32, 66, 0.05); border-radius: 7px; }
.sg-track i { position: absolute; top: 2px; height: 10px; border-radius: 5px; }
.sg-sales { background: var(--series-1); opacity: 0.85; }
.sg-obra { background: var(--series-4); top: 4px !important; height: 6px !important; }
.sg-deliv { background: var(--series-3); }
.sg-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--text-secondary); padding-left: 78px; }
.sg-legend i { display: inline-block; width: 10px; height: 6px; border-radius: 3px; margin-right: 4px; vertical-align: middle; position: static; }
.pin.stage-pin { background: #0a1f2e; color: #fff; }
.pin.stage-pin b { color: #fff; }

/* ── Imagen del proyecto ────────────────────────────────────── */
.img-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 120px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: rgba(255, 255, 255, 0.7); cursor: pointer; color: var(--accent); text-align: center; padding: 12px; transition: border-color 0.2s, background 0.2s; overflow: hidden; }
.img-drop b { color: var(--text-primary); font-size: 13px; }
.img-drop small { font-size: 11.5px; }
.img-drop:hover, .img-drop.over { border-color: var(--accent); background: #f3f7ff; }
.img-drop.has { padding: 0; border-style: solid; min-height: 0; }
.img-drop.has img { width: 100%; height: 170px; object-fit: cover; display: block; }
.img-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.struct-img { display: block; margin: -14px -16px 12px; height: 130px; overflow: hidden; border-radius: var(--r) var(--r) 0 0; cursor: pointer; }
.struct-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s; }
.struct-img:hover img { transform: scale(1.03); }
.img-mini { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; padding: 8px; border: 1px dashed var(--line-2); border-radius: 10px; font-size: 12px; font-weight: 600; color: var(--accent); cursor: pointer; }
.pcard.with-img { padding-top: 0; overflow: hidden; }
.pc-img { height: 120px; margin: 0 -15px 12px; background-size: cover; background-position: center; }

.floors-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; font-size: 12.5px; color: var(--text-secondary); }
.floors-ctl.big { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.floors-ctl.big > div:first-child { flex: 1; display: flex; flex-direction: column; min-width: 160px; }
.floors-ctl.big b { color: var(--text-primary); }
.floors-ctl .year-step b { min-width: 64px; color: var(--text-primary); }
.cd-detail { margin: -2px 0 4px; font-size: 12px; }
.cd-detail summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 2px 0; }
.cd-t { width: 100%; border-collapse: collapse; margin: 6px 0 4px; font-variant-numeric: tabular-nums; font-size: 11.5px; }
.cd-t th { text-align: right; font-size: 10px; color: var(--text-muted); font-weight: 700; padding: 3px 2px; }
.cd-t th:first-child, .cd-t td:first-child { text-align: left; }
.cd-t td { text-align: right; padding: 3px 2px; border-top: 1px solid var(--line); }
.cd-t td small { color: var(--text-muted); }
.cd-t tr.sub td { color: var(--text-muted); }
.cd-t tr.tot td { font-weight: 700; border-top: 1.5px solid var(--text-primary); }
.mini-stat small { font-size: 10.5px; }
.cd-t td:not(:first-child), .cd-t th { white-space: nowrap; }

.ce-val { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ce-eq { font-size: 10.5px; color: var(--text-secondary); line-height: 1.3; font-variant-numeric: tabular-nums; }
.ce-eq b { color: var(--accent); font-weight: 700; }
.ce-eq span { color: var(--text-muted); }

.market-rate { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; margin-bottom: 12px; }
.market-rate > div { flex: 1; display: flex; flex-direction: column; }
.market-rate b { font-size: 13px; }
.market-rate small { color: var(--text-muted); font-size: 11px; }
.market-rate.on { border-color: #bfe3cf; background: #f2fbf6; }

.iva-row { display: grid; grid-template-columns: minmax(200px, 1fr) 1fr; gap: 12px; align-items: end; width: 100%; }
.iva-row .field { margin: 0; }
.vis-helper .grid3 .field > span { min-height: 32px; display: flex; align-items: flex-end; }
/* El input dentro de .inp no lleva borde propio (evita el doble borde y el recorte). */
.field .inp input[type='text'], .inp input[type='text'] { border: 0; box-shadow: none; background: transparent; padding: 10px 0; border-radius: 0; width: 100%; min-width: 0; }
.field.sm .inp input[type='text'], .inp.sm input[type='text'] { padding: 6px 0; }
.field .inp input[type='text']:focus { box-shadow: none; }

/* ── Acceso (versión web) ───────────────────────────────────── */
.auth { position: fixed; inset: 0; z-index: 250; display: none; place-items: center; padding: 16px; background: rgba(238, 242, 250, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.auth.open { display: grid; }
.auth-card { width: min(440px, 100%); padding: 30px 28px 22px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.auth-card h1 { font: 600 22px/1.2 var(--display); margin: 14px 0 4px; }
.auth-card p { margin: 0 0 8px; }
.auth-mark { width: 92px; filter: drop-shadow(0 10px 18px rgba(10, 31, 46, 0.18)); }
.auth-card .btn.big { width: 100%; justify-content: center; margin-top: 6px; }
.gbtn svg { background: #fff; border-radius: 50%; padding: 2px; }
.auth-err { color: var(--critical); font-size: 12.5px; min-height: 16px; margin: 4px 0 0; }
.auth-msg { display: flex; gap: 10px; text-align: left; padding: 12px; border-radius: 12px; margin: 6px 0; }
.auth-msg.warn { background: #fff4dc; color: #8a5a00; }
.auth-msg div { display: flex; flex-direction: column; gap: 2px; }
.auth-msg span { color: var(--text-secondary); font-size: 12.5px; }
.auth-card.members { width: min(560px, 100%); align-items: stretch; text-align: left; max-height: 86vh; }
.member-add { display: flex; gap: 8px; }
.member-add input { flex: 1; border: 1px solid var(--line-2); border-radius: 11px; padding: 10px 12px; outline: none; }
.member-add input:focus { border-color: var(--accent); }
.m-list { overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.m-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); }
.m-row:first-child { border-top: 0; }
.m-row img, .m-ph { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); flex: none; }
.m-row div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.m-row small { color: var(--text-muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.link.danger { color: var(--critical); }
.home-user { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); width: 100%; }
.home-user img { width: 22px; height: 22px; border-radius: 50%; }
.home-user span { flex: 1; color: var(--text-secondary); }
.home-foot { flex-direction: column; }
.home-rh .btn { padding: 7px 11px; font-size: 12.5px; }
