@font-face { font-family:Inter; src:url('assets/Inter-Regular.ttf') format('truetype'); font-weight:400; font-display:swap; }
@font-face { font-family:Inter; src:url('assets/Inter-SemiBold.ttf') format('truetype'); font-weight:600 800; font-display:swap; }

:root {
  --nav:#14253e;
  --nav-top:#112038;
  --nav-hover:#233c5f;
  --accent:#174ca7; --brand:#174ca7;
  --accent-hover:#113b84;
  --background:#f1f4fa;
  --white:#fff;
  --surface:#ffffff;
  --surface-soft:#f1f5f9;
  --ok-ink:#047857;
  --ink:#142039;
  --muted:#435775;
  --line:#d8e1ee;
  --soft:#edf3fd;
  --sidebar:216px;
}

* { box-sizing:border-box; }
body { display:grid; grid-template-columns:var(--sidebar) minmax(0,1fr); grid-template-rows:58px 1fr; min-height:100vh; margin:0; color:var(--ink); background:var(--background); font:14px/1.5 Inter, system-ui, sans-serif; }
a { color:inherit; text-decoration:none; }
button,input,select,textarea { font:inherit; }
button { cursor:pointer; }
:focus-visible { outline:2px solid #2563eb; outline-offset:2px; }
h1,h2,h3,p,dl,dd { margin:0; }
h1,h2,h3 { font-weight:700; line-height:1.25; letter-spacing:-.025em; }
h1 { font-size:29px; }
h2 { font-size:20px; }
h3 { font-size:17px; }
.skip { position:fixed; left:10px; top:-100%; background:var(--white); color:var(--ink); padding:10px; z-index:120; }
.skip:focus { top:8px; }
.sidebar { grid-row:1/3; padding:17px 10px; background:var(--nav); color:#edf3fd; }
.brand { display:flex; align-items:center; gap:10px; width:max-content; padding:6px 12px 22px; font-size:32px; line-height:1; font-weight:700; letter-spacing:-.085em; }
.brand-mark { flex:0 0 auto; width:28px; height:28px; display:block; filter:drop-shadow(0 2px 6px rgba(140,179,255,.22)); }
.brand-word { display:inline-flex; align-items:baseline; color:#edf3fd; }
.brand-dot { color:#8cb3ff; }
.sidebar nav { display:grid; gap:4px; }
.sidebar nav a { display:flex; gap:11px; align-items:center; border-radius:8px; min-height:46px; padding:6px 10px; color:#e4ebf8; transition:background 140ms ease; }
.sidebar nav a:hover { background:#1d3454; }
.sidebar nav a[aria-current] { color:white; background:var(--nav-hover); box-shadow:inset 3px 0 #74b4ff; font-weight:600; }
.nav-icon { display:inline-grid; width:32px; height:32px; flex:0 0 32px; place-items:center; border-radius:8px; background:rgba(255,255,255,.06); border:1px solid rgba(140,179,255,.1); transition:background 140ms ease, border-color 140ms ease; }
.sidebar nav a[aria-current] .nav-icon { background:rgba(124,176,255,.16); border-color:rgba(140,179,255,.28); }
.nav-icon svg { width:20px; height:20px; display:block; filter:drop-shadow(0 1px 2px rgba(5,12,24,.45)); }
.topbar { grid-column:2; display:flex; gap:10px; align-items:center; padding:0 25px; background:var(--nav-top); color:#ebf2ff; white-space:nowrap; overflow:auto; }
.topbar a:hover { text-decoration:underline; }
main { grid-column:2; width:100%; min-width:0; max-width:1660px; padding:25px 27px 38px; margin-inline:auto; }
.page-head,.section-head,.project-heading { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; }
.page-head { margin-bottom:20px; }
.page-head p,.section-head p { margin-top:4px; color:var(--muted); }
.section-head { margin-bottom:14px; }
.actions,.row-tools { display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
[data-unit-unlink][hidden] { display:none; }
.button,.row-tools>button { display:inline-flex; align-items:center; justify-content:center; min-height:38px; padding:6px 12px; border:1px solid var(--line); border-radius:5px; background:var(--white); color:var(--ink); font-weight:600; white-space:nowrap; }
.button:hover,.row-tools>button:hover { background:var(--soft); border-color:#8ea9cf; }
.button.primary { background:var(--accent); color:white; border-color:var(--accent); }
.button.primary:hover { background:var(--accent-hover); }
.card { background:var(--white); border:1px solid var(--line); border-radius:8px; min-width:0; }
.card-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(300px,100%),1fr)); gap:14px; align-items:start; }
.home-section+.home-section { margin-top:26px; }
.card-body,.pad { padding:17px; }
.card-body h3 { margin:4px 0 8px; }
.template { overflow:hidden; }
.template-image { background:#1d3964; color:white; height:136px; position:relative; display:grid; place-items:center; }
.template-image img { width:100%; height:136px; object-fit:cover; object-position:center 52%; }
.template-image .tag { position:absolute; top:11px; left:11px; color:#163f7d; background:white; }
.tag { display:inline-flex; align-items:center; width:max-content; max-width:100%; color:var(--accent); border-radius:5px; padding:3px 8px; font-size:11px; font-weight:600; }
.tag.light { color:#425979; background:#edf1f9; }
.tag.active { color:#235639; background:#e4f1e9; }
.muted,small { color:var(--muted); }
.small,small { font-size:12px; }
.text-link,.cell-button { color:var(--accent); font-weight:600; }
.text-link { display:inline-block; margin-top:11px; }
.text-link:hover,.cell-button:hover { text-decoration:underline; }
.project-name { display:block; font-weight:700; font-size:19px; margin:6px 0 4px; }
.project dl,.project-meta { display:grid; gap:12px; grid-template-columns:repeat(2,minmax(0,1fr)); margin-top:11px; }
.project-meta { grid-template-columns:repeat(auto-fit,minmax(min(160px,100%),1fr)); margin-bottom:16px; }
dt { color:var(--muted); font-size:12px; }
dd { font-weight:600; }
.search { display:block; width:min(325px,100%); margin:0 0 11px; }
.search span { display:block; margin-bottom:4px; font-size:12px; color:var(--muted); }
input,select,textarea { color:var(--ink); background:var(--white); border:1px solid #b9c8dd; border-radius:5px; min-width:0; width:100%; min-height:39px; padding:7px 9px; }
input[readonly] { background:var(--soft); }
textarea { resize:vertical; }
input[type=checkbox] { min-height:0; width:17px; height:17px; accent-color:var(--accent); }
.table-wrap { overflow-x:auto; }
table { border-collapse:collapse; width:100%; }
th,td { padding:10px 12px; border-bottom:1px solid var(--line); text-align:left; }
th { font-weight:600; }
thead th { background:#f4f7fc; color:#314866; font-size:12px; white-space:nowrap; }
tbody tr:last-child td,tbody tr:last-child th { border-bottom:0; }
tfoot th,tfoot td { border-top:1px solid var(--line); border-bottom:0; font-weight:600; background:#e4edfb; }
th small { display:block; margin-top:3px; font-weight:400; }
.number { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
.empty { color:var(--muted); padding:24px; }
.empty-budget { min-height:300px; text-align:center; display:grid; place-content:center; justify-items:center; gap:10px; padding:20px; }
.empty-budget p { color:var(--muted); }
.budget { overflow:hidden; }
.budget table { min-width:760px; }
.budget .group th,.budget .group td { background:#e5edf9; }
.budget .group.depth-1 th,.budget .group.depth-1 td { background:#eef3fa; }
.budget .group .indent { box-shadow:inset 3px 0 #4676c1; }
.item-key { display:inline-block; margin-right:10px; color:#536481; font-size:12px; font-variant-numeric:tabular-nums; white-space:nowrap; }
.indent { min-width:250px; }
.indent.depth-1 { padding-left:28px; }
.indent.depth-2 { padding-left:47px; }
.cell-button,.collapse { padding:1px 0; border:0; background:transparent; text-align:left; }
.collapse { color:var(--accent); margin-right:7px; min-width:20px; font-size:17px; }
.add-row td { padding-block:7px; }
.row-tools .button,.row-tools>button,.group .button { min-height:31px; font-size:12px; }
.stack { display:grid; gap:15px; }
.summary { max-width:940px; overflow:hidden; }
.summary tfoot th,.summary tfoot td { background:var(--accent); color:white; }
.toast { z-index:100; position:fixed; right:17px; bottom:17px; max-width:min(400px,90vw); padding:10px 15px; color:white; background:var(--nav); border-radius:6px; box-shadow:0 5px 20px #233e5f4d; }

dialog { width:min(500px,calc(100% - 24px)); max-height:calc(100dvh - 24px); background:white; color:var(--ink); padding:0; border:1px solid #b8c7de; border-radius:8px; box-shadow:0 16px 75px #0f203e60; }
dialog.wide { width:min(850px,calc(100% - 24px)); }
dialog.editor { width:min(1120px,calc(100% - 24px)); }
dialog::backdrop { background:#0f1c32a0; }
.dialog-head,.dialog-foot { display:flex; gap:9px; align-items:center; padding:14px 16px; background:white; }
.dialog-head { justify-content:space-between; border-bottom:1px solid var(--line); }
.dialog-foot { justify-content:flex-end; border-top:1px solid var(--line); }
.dialog-body { display:grid; gap:11px; padding:16px; }
.dialog-body label { display:grid; gap:4px; min-width:0; color:#2c405d; font-weight:600; font-size:13px; }
.dialog-body .check { display:flex; align-items:center; gap:8px; }
.close { border:0; color:var(--ink); background:transparent; width:34px; height:34px; font-size:25px; line-height:1; }
.fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.client-picker,.resource-add { display:flex; align-items:end; gap:7px; }
.client-picker label,.resource-add label { flex:1; }
.form-error { margin:0 16px 10px; color:#a82526; }
.editor-grid { display:grid; grid-template-columns:minmax(210px,1fr) minmax(0,2.25fr); gap:19px; align-items:start; }
.editor-grid > section { display:grid; gap:10px; min-width:0; }
.tabs { display:flex; gap:6px; border-bottom:1px solid var(--line); }
.tabs button { padding:9px; background:white; border:0; border-bottom:2px solid transparent; color:var(--muted); }
.tabs button[aria-pressed=true] { color:var(--accent); border-color:var(--accent); font-weight:700; }
.matrix td,.matrix th { padding:6px; }
.matrix input { min-width:66px; }
.matrix label { font-size:10px; }
.computed,.cost-box { background:var(--soft); padding:10px; border-radius:5px; }
.computed strong { display:block; }
.cost-box dl div { display:flex; justify-content:space-between; gap:9px; padding-top:5px; }

@media(max-width:780px) {
  body { --sidebar:140px; }
  main { padding:18px 14px; }
  .topbar { padding-inline:14px; }
  .sidebar { padding-inline:6px; }
  .sidebar nav a { gap:6px; padding-inline:8px; }
  .editor-grid { grid-template-columns:1fr; }
}
@media(max-width:560px) {
  body { display:block; }
  .sidebar { padding:8px; }
  .brand { font-size:26px; padding:4px 7px 8px; }
  .sidebar nav { display:flex; gap:4px; overflow:auto; }
  .sidebar nav a { min-width:max-content; }
  .nav-icon { display:none; }
  .topbar { min-height:40px; }
  h1 { font-size:23px; }
  .tabs button { padding-inline:5px; font-size:12px; }
}
@media print {
  body { display:block; background:white; color:black; font-family:Arial,sans-serif; }
  .sidebar,.topbar,.actions,.toast,.skip,dialog,.row-tools,.collapse,.add-row,.report-filters,.budget tr > :last-child:has(.row-tools),.budget thead th:last-child { display:none!important; }
  main { padding:0; }
  .card { border:0; }
  .budget table { min-width:0; }
  .table-wrap { overflow:visible; }
  .number,.item-key { font-variant-numeric:normal; }
  tr { break-inside:avoid; }
  .summary tfoot th,.summary tfoot td { color:black; background:white; }
}
.drag-handle { cursor:grab; color:var(--muted); padding-inline:5px; }
.drag-handle:active { cursor:grabbing; }
.report-filters { max-width:560px; margin-bottom:14px; }
.generator-table { min-width:630px; }
.generator-table td:first-child { min-width:170px; }
.generator-table td input[type=number] { min-width:82px; }
.generator-table td select { min-width:106px; }
.generator-actions { justify-content:space-between; align-items:center; margin-top:12px; }
.generator-actions output { font-weight:600; }
.measured-quantity { margin-block:8px 12px; align-items:center; }
.review-table td small { display:block; margin-top:3px; }
.project-options { margin-top:14px; padding-top:10px; border-top:1px solid var(--line); }
.project-options summary { cursor:pointer; font-weight:600; }
.project-options[open] summary { margin-bottom:12px; }
.catalog2023-filters {
  grid-template-columns: minmax(12rem, 2fr) repeat(3, minmax(8rem, 1fr));
  margin-block: 1rem;
}
.catalog2023 .table-wrap td:nth-last-child(2) { white-space: nowrap; }
.catalog2023 .table-wrap small { white-space: normal; }
.catalog2023-pagination {
  align-items: center;
  justify-content: flex-end;
  margin-top: .8rem;
}
.catalog2023-pagination output { margin-right: auto; }
.catalog2023-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: .6rem;
  margin-block: 1rem;
}
.catalog2023-warning {
  padding: .8rem 1rem;
  margin-block: .8rem;
  border-left: 3px solid #ac6c21;
  background: #fdf3e4;
}
.master-selector,.master-card { --catalog-gap:12px; }
dialog.wide.master-selector,dialog.wide.master-card { width:min(1050px,calc(100% - 24px)); }
.master-destination { padding:9px 12px; border-left:3px solid #3260a0; background:#f1f5fb; margin:0; overflow-wrap:anywhere; }
.master-destination strong { margin-inline-start:5px; }
.master-filters { display:grid; grid-template-columns:minmax(190px,1.35fr) minmax(165px,1fr) minmax(165px,1fr) auto; align-items:end; gap:12px; }
.master-filters [data-master-categories],.master-filters [data-master-subcategory] { display:contents; }
.master-filters [hidden] { display:none; }
.master-filters label { display:grid; gap:5px; min-width:0; }
.master-filters input,.master-filters select,.master-filters .button { min-height:40px; margin:0; }
.master-count { margin:12px 0 9px; color:var(--muted); font-size:13px; }
.master-results { table-layout:fixed; min-width:0; }
.master-results th:first-child { width:auto; overflow-wrap:anywhere; }
.master-results thead th:nth-child(2) { width:80px; }
.master-results thead th:nth-child(3) { width:135px; }
.master-results td { overflow-wrap:anywhere; }
.master-results small { display:block; margin-top:3px; color:var(--muted); font-weight:400; }
.master-related th { background:#eaf0f8; }
.master-card-detail p { margin:0 0 7px; overflow-wrap:anywhere; }
.master-card-actions { gap:10px; }
.master-card .table-wrap { min-width:0; }
@media (max-width:940px) {
  .master-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .master-filters > label:first-child { grid-row:1;grid-column:1; }
  .master-filters > .button,.master-filters-full > label:last-child { grid-row:1;grid-column:2;justify-self:start; }
  .master-filters-full > label:last-child { width:100%; }
}
.source-rows { max-height: 52vh; }
.source-rows td { min-width: 4.5rem; max-width: 36rem; }
.source-rows .source-row-selected { background: #e7f1eb; }
.doc-toolbar { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.9rem 1.2rem; border-bottom:1px solid var(--line); }
.doc-toolbar h2 { margin:0; font-size:1.1rem; }
#presupuesto-documento { width:min(960px,96vw); max-width:96vw; height:94vh; padding:0; overflow:hidden; }
.doc-scroll { height:calc(100% - 65px); overflow:auto; background:#e9edea; padding:1.1rem; }
.doc-sheet { position:relative; width:816px; height:1056px; box-sizing:border-box; background:white; color:#171b19;
  padding:38px 44px 70px; margin:0 auto 14px; box-shadow:0 2px 12px #0002; overflow:hidden;
  font:12px/1.32 Arial,Helvetica,sans-serif; font-feature-settings:normal; font-variant-ligatures:none; font-variant-numeric:normal; }
.doc-heading { margin:0 0 14px; }
.doc-heading h2 { margin:3px 0 8px; font-size:23px; line-height:1.2; color:#0f2447; }
.doc-heading p { margin:3px 0; overflow-wrap:anywhere; }
.doc-cont-head { margin:0 0 12px; padding-bottom:8px; border-bottom:1.5px solid #cbd5e1; display:flex; justify-content:space-between; align-items:baseline; gap:12px; }
.doc-cont-head .doc-cont-title { font-size:12.5px; font-weight:700; color:#0f2447; margin:0; }
.doc-cont-head .doc-cont-meta { font-size:10.5px; color:#475569; margin:0; text-align:right; }
.doc-exec-head { display:flex; justify-content:space-between; align-items:flex-start; gap:14px; border-bottom:2px solid #174ca7; padding-bottom:10px; margin-bottom:12px; }
.doc-exec-head h2 { margin:3px 0 2px; font-size:19px; line-height:1.2; color:#0f2447; }
.doc-exec-kicker { font-size:10px; font-weight:700; letter-spacing:.08em; color:#174ca7; text-transform:uppercase; }
.doc-exec-right { text-align:right; font-size:11px; line-height:1.4; color:#1e293b; flex-shrink:0; }
.doc-section-h3 { font-size:11.5px; font-weight:700; color:#14253e; text-transform:uppercase; letter-spacing:.03em; margin:11px 0 5px; border-bottom:1px solid #cbd5e1; padding-bottom:3px; }
.doc-project { font-size:16px; font-weight:700; }
.doc-brand { font-size:20px; font-weight:700; letter-spacing:-.05em; }
.doc-brand span { color:#237653; }
.doc-table { width:100%; min-width:0; table-layout:fixed; border-collapse:collapse; }
.doc-sheet thead th, .doc-table thead th { position:static !important; top:auto !important; z-index:auto !important; }
.doc-table th,.doc-table td { padding:6px 5px; text-align:right; font-size:11.5px; vertical-align:top; overflow-wrap:break-word; word-break:normal; border-bottom:1px solid #e2e8f0; }
.doc-table th:first-child, .doc-table td:first-child { text-align:left; }
.doc-table th.text-left, .doc-table td.text-left { text-align:left; }
.doc-table th.text-center, .doc-table td.text-center { text-align:center; }
.doc-table th.number, .doc-table td.number { text-align:right; white-space:nowrap; }
.budget th[scope="row"], .budget td:first-child { overflow-wrap:anywhere; word-break:normal; }
.budget .concept-name, .budget .name-cell { overflow-wrap:anywhere; white-space:normal; }
.doc-table th small { display:block; font-weight:400; margin-top:2px; color:#424943; }
.doc-table thead { background:#edf2f7; }
.doc-table thead th { border-bottom:1.5px solid #cbd5e1; color:#0f2447; }
.doc-grupo { background:#edf2f7; }
.doc-grupo th { color:#0f2447; font-weight:700; }
.doc-subtotal { background:#f5f8fb; font-weight:600; }
.doc-total { border-block:2px solid #235e45; font-weight:700; background:#f2f8f5; }
.doc-grand-total th, .doc-grand-total td { border-block:2px solid #174ca7; background:#eff6ff; font-weight:700; color:#0f2447; }
.doc-footer { position:absolute; bottom:32px; inset-inline:44px; padding-top:6px; min-height:22px; box-sizing:border-box; border-top:1px solid #cbd5e1; color:#475569; font-size:10.5px; line-height:1.3; }
@page { size:letter; margin:0; }
@media print {
  html, body, body.documento-abierto, #presupuesto-documento, .doc-scroll, .doc-pages,
  :root[data-theme="dark"] html, :root[data-theme="dark"] body, :root[data-theme="dark"] body.documento-abierto,
  :root[data-theme="dark"] #presupuesto-documento, :root[data-theme="dark"] .doc-scroll, :root[data-theme="dark"] .doc-pages {
    background:#ffffff !important;
    color:#171b19 !important;
  }
  body.documento-abierto { display:block; margin:0; padding:0; }
  body.documento-abierto > :not(#presupuesto-documento) { display:none!important; }
  body.documento-abierto #presupuesto-documento { display:block!important; position:static; margin:0; padding:0; border:0; width:100%!important; height:auto!important; max-width:none!important; max-height:none!important; box-shadow:none; overflow:visible!important; }
  #presupuesto-documento::backdrop,.doc-toolbar,.doc-crit-banner { display:none!important; }
  .doc-scroll { height:auto; padding:0; overflow:visible; }
  .doc-sheet { margin:0; box-shadow:none; break-after:page; page-break-after:always; print-color-adjust:exact; -webkit-print-color-adjust:exact; }
  .doc-sheet:last-child { break-after:auto; page-break-after:auto; }
  .doc-total, .doc-subtotal, .doc-sign, .doc-notes, .doc-notes-sign, .doc-amount-words, .doc-company-head, .doc-project, .doc-footer,
  .caratula-total-box, .caratula-firmas, .hon-pdf-summary, .param-band-grid, .apu-card, .doc-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .doc-grupo, .hon-pdf-h3, .doc-section-h3 { break-after: avoid; page-break-after: avoid; }
  .param-band-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
@media (max-width: 1100px) {
  .catalog2023-filters { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* Cota 1.5 additions: 1-click add row actions, inline qty, highlight, pending badge */
.row-inline-actions { display:flex; gap:6px; flex-wrap:nowrap; align-items:center; }
.inline-qty { width:92px; text-align:right; padding:4px 7px; border:1px solid var(--line); border-radius:6px; background:var(--white); color:var(--ink); }
.inline-qty:focus { border-color:var(--accent); }
tr.just-added td { background:#e7f3ec !important; transition:background 0.4s ease; }
.tag.warn { background:#fef3c7; color:#92410e; margin-left:6px; }
.warn-text { color:#92410e; font-weight:600; display:block; }
.material-picker { max-width:920px; width:94vw; }

/* Predictive search suggestion chips */
[data-master-predict] { min-height:36px; display:flex; align-items:center; margin:6px 0 2px; }
.predict-bar { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:0; }
.predict-label { font-size:12px; color:var(--muted); margin-right:2px; }
.predict-chip { padding:3px 10px; font-size:12.5px; border:1px solid var(--line); border-radius:999px; background:var(--soft); color:var(--accent); font-weight:600; }
.predict-chip:hover { background:var(--accent); color:var(--white); border-color:var(--accent); }


/* Pantalla de carga inicial (Cota + símbolo Patio) */
body.splash-active { overflow:hidden; }
.cota-splash {
  position:fixed;
  inset:0;
  z-index:9999;
  display:grid;
  place-items:center;
  padding:28px;
  background:radial-gradient(circle at 50% 42%, #193154 0%, #112038 56%, #0b1628 100%);
  color:#edf3fd;
  opacity:1;
  transform:scale(1);
  transition:opacity 580ms cubic-bezier(.22,.61,.36,1), transform 580ms cubic-bezier(.22,.61,.36,1);
}
.cota-splash.is-done {
  opacity:0;
  transform:scale(1.018);
  pointer-events:none;
}
.splash-grid {
  position:absolute;
  inset:0;
  pointer-events:none;
  background-image:
    linear-gradient(to right, rgba(140,179,255,.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(140,179,255,.045) 1px, transparent 1px);
  background-size:36px 36px;
  mask-image:radial-gradient(circle at 50% 45%, rgba(0,0,0,.85) 0%, rgba(0,0,0,.15) 68%, transparent 100%);
}
.splash-stage {
  position:relative;
  display:grid;
  justify-items:center;
  gap:30px;
  width:min(480px, 100%);
  animation:splashEnter 650ms cubic-bezier(.22,.61,.36,1) both;
}
.splash-emblem {
  position:relative;
  width:236px;
  height:236px;
  display:grid;
  place-items:center;
}
.splash-patio {
  width:100%;
  height:100%;
  overflow:visible;
}
.patio-piece {
  fill:#233c5f;
  transition:fill 420ms ease, filter 420ms ease;
  animation:patioCycle 2.4s cubic-bezier(.4,0,.2,1) infinite;
}
.patio-piece.p1 { animation-delay:0s; }
.patio-piece.p2 { animation-delay:.6s; }
.patio-piece.p3 { animation-delay:1.2s; }
.patio-piece.p4 { animation-delay:1.8s; }
.cota-splash.is-ready .patio-piece {
  animation:none;
  fill:#8cb3ff;
  filter:drop-shadow(0 0 12px rgba(140,179,255,.38));
}
.splash-ring-track {
  fill:none;
  stroke:rgba(140,179,255,.14);
  stroke-width:1.25;
}
.splash-ring-fill {
  fill:none;
  stroke:#8cb3ff;
  stroke-width:1.65;
  stroke-linecap:round;
  transform:rotate(-90deg);
  transform-origin:68px 68px;
  filter:drop-shadow(0 0 6px rgba(140,179,255,.45));
}
.splash-center-brand {
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  white-space:nowrap;
  font-size:28px;
  line-height:1;
  font-weight:700;
  letter-spacing:-.075em;
  color:#f4f7fc;
  user-select:none;
  transform:translateY(-1px);
}
.splash-center-brand span {
  color:#8cb3ff;
}
.splash-status {
  width:100%;
  max-width:440px;
  display:grid;
  gap:11px;
  text-align:center;
}
.splash-message {
  min-height:21px;
  font-size:13.5px;
  font-weight:500;
  letter-spacing:-.005em;
  color:#dce8fc;
  opacity:1;
  transform:translateY(0);
  transition:opacity 180ms ease, transform 180ms ease;
}
.splash-message.is-swapping {
  opacity:0;
  transform:translateY(3px);
}
.splash-bar {
  width:100%;
  height:3px;
  border-radius:999px;
  background:rgba(140,179,255,.16);
  overflow:hidden;
}
.splash-bar-fill {
  width:0%;
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg, #174ca7 0%, #6396f2 55%, #b9d4ff 100%);
  box-shadow:0 0 12px rgba(140,179,255,.55);
}
.splash-meta {
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:5px;
  font-size:10.5px;
  letter-spacing:.11em;
  color:rgba(191,206,241,.72);
  font-variant-numeric:tabular-nums;
}
.splash-mini-brand {
  font-size:12.5px;
  font-weight:700;
  letter-spacing:-.05em;
  color:#edf3fd;
  margin-right:4px;
}
.splash-mini-brand span {
  color:#8cb3ff;
}
.splash-percent {
  color:#9ec0ff;
  font-size:11.5px;
  font-weight:600;
  letter-spacing:.06em;
}

@keyframes patioCycle {
  0%   { fill:#233c5f; filter:none; }
  14%  { fill:#8cb3ff; filter:drop-shadow(0 0 12px rgba(140,179,255,.48)); }
  34%  { fill:#2c62bf; filter:drop-shadow(0 0 6px rgba(23,76,167,.35)); }
  58%  { fill:#233c5f; filter:none; }
  100% { fill:#233c5f; filter:none; }
}
@keyframes splashEnter {
  from { opacity:0; transform:translateY(10px) scale(.985); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .patio-piece { animation:none; fill:#4d7fd1; }
  .splash-stage { animation:none; }
  .cota-splash { transition:opacity 250ms ease; }
}

/* Cota 2026 — Selector de vista (Costo directo / Precio de venta / Comparativo) y doble PDF */
.budget-viewbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.view-switcher, .doc-mode-bar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
}
.view-pill {
  border: 0;
  background: transparent;
  color: #475569;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.view-pill:hover:not(.active) { background: rgba(255, 255, 255, .72); color: #0f172a; }
.view-pill.active {
  background: #1d4ed8;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(29, 78, 216, .28);
}
.fsc-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  background: #f5f8fd;
  border: 1px solid #d7e3f7;
  border-radius: 999px;
  padding: 5px 12px;
}
.fsc-badge strong { color: var(--accent); font-weight: 700; }
.fsc-sep { opacity: .45; }
.budget .col-venta {
  background: rgba(23, 76, 167, .04);
  color: #10377a;
}
.budget thead th.col-venta {
  background: rgba(23, 76, 167, .08);
  color: #10377a;
}
.budget .col-pct {
  color: var(--muted);
  font-size: 12.5px;
}
.budget tfoot tr.foot-sub th,
.budget tfoot tr.foot-sub td {
  font-weight: 600;
  background: #f8fafd;
  border-top: 1px solid var(--line);
}
.budget tfoot tr.foot-total th,
.budget tfoot tr.foot-total td {
  font-weight: 700;
  font-size: 14px;
  background: #edf3fc;
  color: var(--ink);
  border-top: 2px solid #c5d6f2;
}
.budget-comparativo table {
  font-size: 13px;
}
.doc-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.doc-sheet-wide {
  width: min(1040px, 100%);
}
.doc-table.doc-comparativo {
  font-size: 9.5px;
}
.doc-table.doc-comparativo th,
.doc-table.doc-comparativo td {
  font-size: 9.5px;
  padding: 5px 4px;
  overflow-wrap: break-word;
  word-break: normal;
}
.doc-table.doc-comparativo th:nth-child(n+2),
.doc-table.doc-comparativo td:nth-child(n+2) {
  white-space: nowrap;
}
.doc-table.doc-estimacion th,
.doc-table.doc-estimacion td {
  font-size: 10px;
  padding: 5px 4px;
  overflow-wrap: break-word;
  word-break: normal;
}
.doc-table.doc-estimacion th:nth-child(1),
.doc-table.doc-estimacion td:nth-child(1),
.doc-table.doc-estimacion th:nth-child(2),
.doc-table.doc-estimacion td:nth-child(2) {
  text-align: left;
}
.doc-table.doc-estimacion th:nth-child(n+3),
.doc-table.doc-estimacion td:nth-child(n+3) {
  white-space: nowrap;
}
.doc-table.doc-comparativo th.doc-venta,
.doc-table.doc-comparativo td.doc-venta {
  background: rgba(23, 76, 167, .05);
  color: #10377a;
}

/* Cota 2026 — Mi empresa, FASAR, Financiamiento, Costo/m2 y Programa de obra (Gantt) */
.empresa-logo-row { display:flex; flex-wrap:wrap; align-items:center; gap:16px; margin-bottom:18px; padding-bottom:16px; border-bottom:1px solid var(--line); }
.empresa-logo-box { width:112px; height:82px; border:1.5px dashed #cbd5e1; border-radius:10px; background:#f8fafc; display:flex; align-items:center; justify-content:center; color:var(--muted); font-size:12.5px; overflow:hidden; }
.empresa-logo-box img { max-width:100%; max-height:100%; object-fit:contain; }
.empresa-logo-actions { display:flex; flex-wrap:wrap; align-items:center; gap:10px; }
.empresa-logo-actions small { color:var(--muted); font-size:12px; }
.file-btn { display:inline-flex; align-items:center; gap:6px; padding:7px 14px; border-radius:8px; border:1px solid #bfdbfe; background:#eff6ff; color:var(--accent); font-weight:600; font-size:13px; cursor:pointer; }
.file-btn:hover { background:#dbeafe; }
.fasar-card, .fin-card { margin-bottom:16px; }
.fasar-sub { margin:4px 0 0; font-size:13px; color:var(--muted); }
.fasar-body { display:grid; gap:18px; margin-top:14px; padding-top:14px; border-top:1px solid var(--line); }
.fasar-params h3 { margin:0 0 10px; font-size:14px; }
.fasar-grid-6 { display:grid; grid-template-columns:repeat(auto-fit, minmax(120px, 1fr)); gap:10px; margin-bottom:10px; }
.fasar-checks { display:flex; flex-wrap:wrap; gap:10px 18px; margin:10px 0 14px; }
.fasar-checks .check { display:inline-flex; align-items:center; gap:6px; font-size:13px; cursor:pointer; }
.fasar-result-box { display:grid; grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)); gap:10px; padding:12px 14px; border-radius:10px; background:#f5f8fd; border:1px solid #d7e3f7; margin-bottom:12px; }
.fasar-result-box > div { display:flex; flex-direction:column; gap:2px; }
.fasar-result-box span { font-size:11.5px; color:var(--muted); }
.fasar-result-box strong { font-size:14.5px; color:var(--ink); }
.fasar-total-cell strong { color:var(--accent); font-size:16px; }
.programa-kpis { display:grid; grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)); gap:10px; margin-bottom:14px; }
.kpi-chip { background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:10px 14px; display:flex; flex-direction:column; gap:3px; }
.kpi-chip span { font-size:12px; color:var(--muted); }
.kpi-chip strong { font-size:15px; color:var(--ink); }
.gantt-empty { padding:24px; text-align:center; background:#f8fafd; border:1px dashed #cbd5e1; border-radius:10px; color:var(--muted); }
.gantt-legend { display:flex; flex-wrap:wrap; align-items:center; gap:14px; font-size:12.5px; color:var(--muted); margin-bottom:10px; }
.gantt-legend .dot { display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:4px; vertical-align:-1px; }
.dot-completado { background:#16a34a; }
.dot-en-curso { background:#f59e0b; }
.dot-por-iniciar { background:#ef4444; }
.gantt-span-note { margin-left:auto; font-size:12px; }
.gantt-month { position:absolute; top:7px; font-size:10.5px; font-weight:700; color:#334155; white-space:nowrap; padding-left:4px; border-left:1px solid #cbd5e1; }
.gantt-today-line span { position:absolute; top:2px; left:-16px; background:#1e293b; color:#fff; font-size:10px; font-weight:700; padding:1px 5px; border-radius:4px; }
.gantt-row.gantt-group.depth-0 { background:#142c54; color:#fff; font-weight:700; font-size:12.5px; }
.gantt-row.gantt-group.depth-1 { background:#ede9fe; color:#4c1d95; font-weight:700; font-size:12px; }
.gantt-bar { position:absolute; top:6px; height:14px; border-radius:999px; border:0; padding:0; cursor:pointer; overflow:hidden; }
.gantt-bar.bar-group { background:#f59e0b; cursor:default; }
.gantt-bar-done { display:block; height:100%; background:#16a34a; }
.gantt-bar.bar-completado { background:#16a34a; }
.gantt-bar.bar-en-curso { background:#f59e0b; }
.gantt-bar.bar-por-iniciar { background:#ef4444; }
.gantt-bar:hover { filter:brightness(1.08); }
.prog-pill { border:1px solid #cbd5e1; background:#f8fafc; color:var(--ink); border-radius:999px; padding:4px 10px; font-size:12px; font-weight:600; cursor:pointer; white-space:nowrap; }
.prog-pill.st-empty { border-style:dashed; color:var(--accent); border-color:#93c5fd; background:#eff6ff; }
.prog-pill.st-completado { background:#dcfce7; border-color:#86efac; color:#166534; }
.prog-pill.st-en-curso { background:#fef3c7; border-color:#fcd34d; color:#92410e; }
.prog-pill.st-por-iniciar { background:#fee2e2; border-color:#fca5a5; color:#991b1b; }
.doc-company-head { display:flex; align-items:center; gap:14px; margin-bottom:10px; }
.doc-company-logo { max-height:54px; max-width:140px; object-fit:contain; }
.doc-company-info { display:flex; flex-direction:column; gap:2px; }
.doc-company-info strong { font-size:16px; color:var(--ink); }
.doc-company-info small { font-size:11px; color:var(--muted); }
.doc-notes-sign { margin-top:18px; padding-top:12px; border-top:1px solid #cbd5e1; display:flex; flex-wrap:wrap; justify-content:space-around; align-items:flex-start; gap:14px 36px; }
.doc-notes { flex:1 0 100%; font-size:10.5px; line-height:1.4; color:#475569; margin-bottom:2px; }
.doc-notes strong { display:block; color:#0f2447; margin-bottom:3px; }
.doc-notes p { margin:0; white-space:pre-wrap; }
.doc-sign { width:235px; padding-top:46px; text-align:center; font-size:11px; flex-shrink:0; }
.doc-sign-line { border-top:1px solid #334155; margin:0 0 6px; }
.doc-sign strong, .doc-sign small { display:block; }
.doc-sign small { color:#475569; margin-top:1px; }

/* Cota 2026 — Celda compacta de conceptos en Materiales y Mano de obra */
.usos-cell { max-width: 440px; vertical-align: top; }
.uso-single { font-size: 12.5px; color: var(--ink); line-height: 1.4; }
.usos-drop { font-size: 12.5px; }
.usos-drop summary {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}
.usos-drop summary::-webkit-details-marker { display: none; }
.usos-count {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e0ecff;
  color: #174ca7;
  font-weight: 700;
  font-size: 11.5px;
}
.usos-count::after { content: ' ▾'; font-size: 10px; margin-left: 3px; }
.usos-drop[open] .usos-count::after { content: ' ▴'; }
.uso-chip {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #dbe2ec;
  color: #334155;
  font-size: 11px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.uso-more { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.usos-list {
  margin: 8px 0 2px;
  padding: 8px 10px 8px 22px;
  max-height: 210px;
  overflow-y: auto;
  background: #f8fafd;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: #334155;
}
.usos-list li { margin-bottom: 4px; }

/* === Indicador luminoso Activo (bolita verde + ondas de luz + partículas) === */
.tag.tag-activo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 9px;
  color: #166534;
  background: #e7f8ee;
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: 999px;
}
.activo-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: radial-gradient(circle at 32% 32%, #bbf7d0 0%, #22c55e 52%, #15803d 100%);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.95), 0 0 12px rgba(34, 197, 94, 0.5);
  animation: activoCorePulse 2.2s ease-in-out infinite;
}
.activo-dot::before,
.activo-dot::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1.5px solid rgba(34, 197, 94, 0.72);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.55);
  pointer-events: none;
  animation: activoWave 2.2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
.activo-dot::after {
  animation-delay: 1.1s;
}
.activo-sparks {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  animation: activoSparksOrbit 3.4s linear infinite;
}
.activo-sparks::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  margin: -1px 0 0 -1px;
  border-radius: 50%;
  background: transparent;
  box-shadow:
    -7px -5px 0 0 rgba(74, 222, 128, 0.9),
     7px -4px 0 0 rgba(34, 197, 94, 0.85),
    -6px  6px 0 0 rgba(134, 239, 172, 0.9),
     6px  6px 0 0 rgba(34, 197, 94, 0.8);
  animation: activoSparksTwinkle 2.2s ease-in-out infinite;
}
@keyframes activoCorePulse {
  0%, 100% { box-shadow: 0 0 5px rgba(34, 197, 94, 0.9), 0 0 10px rgba(34, 197, 94, 0.45); transform: scale(1); }
  50% { box-shadow: 0 0 9px rgba(74, 222, 128, 1), 0 0 16px rgba(34, 197, 94, 0.65); transform: scale(1.08); }
}
@keyframes activoWave {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(2.65); opacity: 0; }
}
@keyframes activoSparksOrbit {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes activoSparksTwinkle {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* === Portadas visuales en proyectos y plantillas === */
.project.card { overflow: hidden; }
.project-cover {
  position: relative;
  height: 160px;
  background: linear-gradient(135deg, #1b345c 0%, #26487a 100%);
  overflow: hidden;
}
.project-cover-link {
  display: block;
  width: 100%;
  height: 100%;
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
}
.project-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.project.card:hover .project-cover img {
  transform: scale(1.03);
}
.project-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(15, 28, 48, 0.34) 0%, rgba(15, 28, 48, 0) 48%);
  pointer-events: none;
}
.project-cover-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.82);
}
.project-cover .cover-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.94);
  color: #163f7d;
  backdrop-filter: blur(4px);
}
.project-cover .cover-edit-btn {
  position: absolute;
  top: 9px;
  right: 10px;
  z-index: 2;
  padding: 5px 11px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(4px);
}
.project-cover .cover-edit-btn:hover {
  background: #ffffff;
}
.template-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(15, 28, 48, 0.28) 0%, rgba(15, 28, 48, 0) 45%);
  pointer-events: none;
}
.template-image .tag {
  z-index: 2;
  box-shadow: 0 2px 6px rgba(15, 28, 48, 0.18);
}

/* === Selector de render/imagen en formulario de proyecto === */
.project-img-picker {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.project-img-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}
.project-img-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.project-img-preview {
  width: 144px;
  height: 81px;
  border-radius: 6px;
  border: 1px dashed #cbd5e1;
  background: #eef2f7;
  overflow: hidden;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 11px;
  color: #64748b;
  text-align: center;
  padding: 4px;
}
.project-img-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.project-img-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.project-img-controls .file-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 12px;
  font-weight: 600;
  color: #1d4ed8;
  cursor: pointer;
}
.project-img-controls .file-btn:hover {
  background: #eff6ff;
}

/* === Variante naranja luminosa para Activo en Materiales === */
.tag.tag-activo-orange {
  color: #9a3412;
  background: #fff3e6;
  border-color: rgba(249, 115, 22, 0.32);
}
.tag.tag-activo-orange .activo-dot {
  background: radial-gradient(circle at 32% 32%, #fed7aa 0%, #f97316 52%, #c2410c 100%);
  box-shadow: 0 0 6px rgba(249, 115, 22, 0.95), 0 0 12px rgba(249, 115, 22, 0.5);
  animation: activoOrangeCorePulse 2.2s ease-in-out infinite;
}
.tag.tag-activo-orange .activo-dot::before,
.tag.tag-activo-orange .activo-dot::after {
  border-color: rgba(249, 115, 22, 0.78);
  box-shadow: 0 0 6px rgba(249, 115, 22, 0.55);
}
.tag.tag-activo-orange .activo-sparks::before {
  box-shadow:
    -7px -5px 0 0 rgba(251, 146, 60, 0.95),
     7px -4px 0 0 rgba(249, 115, 22, 0.9),
    -6px  6px 0 0 rgba(253, 186, 116, 0.95),
     6px  6px 0 0 rgba(234, 88, 12, 0.85);
}
@keyframes activoOrangeCorePulse {
  0%, 100% { box-shadow: 0 0 5px rgba(249, 115, 22, 0.9), 0 0 10px rgba(249, 115, 22, 0.45); transform: scale(1); }
  50% { box-shadow: 0 0 9px rgba(251, 146, 60, 1), 0 0 16px rgba(249, 115, 22, 0.7); transform: scale(1.08); }
}

/* === Estado Inactivo en rojo sutil === */
.tag.tag-inactivo {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 9px;
  border-radius: 999px;
  color: #b91c1c;
  background: #fee2e2;
  border: 1px solid rgba(239, 68, 68, 0.28);
}
.inactivo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: #ef4444;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.45);
}

/* === Botón de eliminar (botecito de basura) y modal destructivo === */
.button.icon-danger {
  min-width: 38px;
  width: 38px;
  padding: 0;
  color: #64748b;
  border-color: var(--line);
  background: var(--white);
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}
.button.icon-danger:hover {
  color: #dc2626;
  background: #fef2f2;
  border-color: #fca5a5;
}
.button.danger {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}
.button.danger:hover {
  color: #ffffff;
  background: #dc2626;
  border-color: #dc2626;
}
:root[data-theme="dark"] .button.danger {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(220, 38, 38, 0.14);
}
:root[data-theme="dark"] .button.danger:hover {
  color: #ffffff;
  background: #dc2626;
  border-color: #dc2626;
}
dialog.confirm-danger .button.primary {
  background: #dc2626;
  border-color: #dc2626;
}
dialog.confirm-danger .button.primary:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* === Paneles fijos estilo Excel (sidebar cota., barra superior y encabezados fijos) === */
@media (min-width: 820px) {
  html, body {
    height: 100%;
    overflow: hidden;
  }
  body {
    grid-template-rows: 58px minmax(0, 1fr);
  }
  .sidebar {
    grid-column: 1;
    grid-row: 1 / 3;
    height: 100vh;
    overflow-y: auto;
    position: sticky;
    top: 0;
    z-index: 35;
  }
  .topbar {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
  }
  main {
    grid-column: 2;
    grid-row: 2;
    height: 100%;
    max-width: none;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    padding: 0 27px 56px;
    margin-inline: 0;
  }
  main > * {
    max-width: 1606px;
    margin-inline: auto;
  }
  .page-head {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--background);
    padding: 20px 0 14px;
    margin: 0 auto 16px;
    border-bottom: 1px solid rgba(216, 225, 238, 0.85);
  }
  .card > .table-wrap,
  [data-materiales-catalogo] .table-wrap,
  [data-maestro] .table-wrap {
    max-height: calc(100vh - 305px);
    overflow: auto;
  }
  dialog [data-maestro] .table-wrap {
    max-height: 46vh;
  }
  thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f4f7fc;
    box-shadow: inset 0 -1px 0 var(--line);
  }
}

@media print {
  html, body, .sidebar, main, .card > .table-wrap, [data-materiales-catalogo] .table-wrap, [data-maestro] .table-wrap {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .page-head, .topbar, thead th {
    position: static !important;
  }
}

/* === Gantt 2 niveles (Año + Meses) sin empalmes + impresión Doble Carta horizontal === */
.gantt-wrap {
  --gantt-label-w: 320px;
}
.gantt-wrap.gantt-printable {
  --gantt-label-w: 29%;
}
.gantt-board {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--white);
}
.gantt-inner {
  width: 100%;
}
.gantt-header {
  display: grid;
  grid-template-columns: var(--gantt-label-w) minmax(0, 1fr);
  background: #f1f5f9;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.gantt-header .gantt-label {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  position: sticky;
  left: 0;
  z-index: 5;
  background: #f1f5f9;
  border-right: 1px solid var(--line);
}
.gantt-axis {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 46px;
  overflow: hidden;
}
.gantt-years {
  position: relative;
  height: 22px;
  border-bottom: 1px solid #cbd5e1;
  background: #e8eef7;
}
.gantt-year-cell {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #142c54;
  border-left: 1px solid #cbd5e1;
  overflow: hidden;
  white-space: nowrap;
}
.gantt-year-cell:first-child { border-left: 0; }
.gantt-months {
  position: relative;
  height: 24px;
  background: #f8fafc;
}
.gantt-month-cell {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  border-left: 1px solid #e2e8f0;
  overflow: hidden;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.gantt-month-cell:first-child { border-left: 0; }
.gantt-today-flag {
  position: absolute;
  bottom: 1px;
  transform: translateX(-50%);
  z-index: 6;
  pointer-events: none;
}
.gantt-today-flag span {
  display: inline-block;
  background: #0f172a;
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 3px;
}
.gantt-rows {
  position: relative;
  max-height: 480px;
  overflow-y: auto;
  overflow-x: visible;
}
.gantt-row {
  display: grid;
  grid-template-columns: var(--gantt-label-w) minmax(0, 1fr);
  align-items: center;
  border-bottom: 1px solid #edf1f7;
  min-height: 30px;
  break-inside: avoid;
  page-break-inside: avoid;
}
.gantt-row .gantt-label {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  padding: 5px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11.5px;
}
.gantt-row.gantt-group.depth-0 .gantt-label {
  background: #142c54;
  color: #ffffff;
  border-right-color: rgba(255, 255, 255, 0.16);
}
.gantt-row.gantt-group.depth-1 .gantt-label {
  background: #ede9fe;
  color: #4c1d95;
  border-right-color: rgba(76, 29, 149, 0.15);
}
.gantt-track {
  position: relative;
  height: 26px;
}
.gantt-grid-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px solid rgba(203, 213, 225, 0.45);
  pointer-events: none;
}
.gantt-row.gantt-group.depth-0 .gantt-grid-line {
  border-left-color: rgba(255, 255, 255, 0.12);
}
.gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1.5px dashed #0f172a;
  z-index: 4;
  pointer-events: none;
}

/* Vista previa e impresión Doble Carta horizontal (17in x 11in) para Programa de obra */
dialog#presupuesto-documento.doc-programa-doble-carta {
  width: min(96vw, 1580px);
  max-width: 96vw;
}
dialog#presupuesto-documento.doc-programa-doble-carta .doc-sheet-wide {
  width: 100%;
  max-width: 1520px;
  min-height: auto;
  padding: 14mm 12mm;
}
.doc-sheet-wide .gantt-board {
  overflow: visible;
}
.doc-sheet-wide .gantt-rows {
  max-height: none;
  overflow: visible;
}
.doc-sheet-wide .gantt-row {
  min-height: 24px;
}
.doc-sheet-wide .gantt-row .gantt-label {
  position: static;
  font-size: 10px;
  padding: 3px 8px;
}
.doc-sheet-wide .gantt-track {
  height: 20px;
}
.doc-sheet-wide .gantt-bar {
  top: 4px;
  height: 11px;
}
.doc-sheet-wide .gantt-month-cell {
  font-size: 8.5px;
}

/* Pulido general de tablas y badges en herramientas */
.prog-pill {
  white-space: nowrap;
}
.usos-drop {
  max-width: 360px;
}
@media print {
  dialog#presupuesto-documento.doc-programa-doble-carta {
    width: 100% !important;
    max-width: none !important;
  }
  dialog#presupuesto-documento.doc-programa-doble-carta .doc-sheet-wide {
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    box-shadow: none !important;
  }
  .gantt-board, .gantt-rows {
    overflow: visible !important;
    max-height: none !important;
  }
  .gantt-header .gantt-label, .gantt-row .gantt-label {
    position: static !important;
  }
  .gantt-print-table > thead {
    display: table-header-group !important;
  }
  .gantt-print-table > tbody > tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}
.gantt-print-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.gantt-print-table > thead {
  display: table-header-group;
}
.gantt-print-table > thead > tr > th,
.gantt-print-table > tbody > tr > td {
  padding: 0;
  border: 0;
  text-align: left;
  font-weight: normal;
  vertical-align: top;
}
.gantt-print-table > tbody > tr {
  break-inside: avoid;
  page-break-inside: avoid;
}

/* === Barra de toggles de desglose al pie del presupuesto === */
.budget-footbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -4px auto 14px;
  padding: 8px 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.footbar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-right: 4px;
}
.foot-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  transition: all 140ms ease;
}
.foot-toggle-pill:hover {
  border-color: #93b4e8;
  background: #eff6ff;
}
.foot-toggle-pill.active {
  background: #e8f0fe;
  border-color: #174ca7;
  color: #14253e;
}
.foot-toggle-box {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1.5px solid #94a3b8;
  background: #ffffff;
  color: #ffffff;
  font-size: 10px;
  line-height: 1;
}
.foot-toggle-pill.active .foot-toggle-box {
  background: #174ca7;
  border-color: #174ca7;
}
tfoot tr.foot-breakdown th,
tfoot tr.foot-breakdown td {
  background: #f4f7fc;
  color: #334155;
  font-weight: 500;
  border-top: 1px dashed #cbd5e1;
}
tfoot tr.foot-total-venta th,
tfoot tr.foot-total-venta td {
  background: #dbeafe;
  color: #14253e;
  border-top: 1px solid #93c5fd;
}

/* === Pie de tarjeta de proyecto y botón eliminar en plantillas personales === */
.project-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #edf1f7;
}
.project-card-foot .text-link {
  margin-top: 0;
}
.project-card-foot .button {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
}
.project-card-foot .button.icon-danger {
  min-width: 32px;
  width: 32px;
  min-height: 32px;
  padding: 0;
}
.template-image .cover-del-btn {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 3;
  min-width: 32px;
  width: 32px;
  min-height: 32px;
  padding: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
}

/* === Optimización geométrica Full HD (1920x1080) sin doble scroll ni saltos de botones === */
@media (min-width: 1360px) {
  /* Evitar doble scroll en Materiales y Catálogo maestro dejando visible la paginación */
  [data-materiales-catalogo] .table-wrap,
  [data-maestro] .table-wrap {
    max-height: calc(100vh - 385px);
  }
  /* Presupuesto: tabla ajustada al viewport 1080p y herramientas en 1 sola línea */
  .budget > .table-wrap {
    max-height: calc(100vh - 340px);
  }
  .budget-viewbar {
    padding: 8px 12px;
    margin-bottom: 8px;
  }
  .budget-footbar {
    margin: 0 0 10px;
    padding: 6px 12px;
  }
  .budget .row-tools {
    flex-wrap: nowrap;
    gap: 5px;
  }
  .budget .row-tools > button,
  .budget .actions > .button {
    min-height: 30px;
    padding: 4px 9px;
    font-size: 12px;
  }
  .budget .actions > .button.icon-danger {
    min-width: 30px;
    width: 30px;
    min-height: 30px;
    padding: 0;
  }
  /* Pantalla principal Proyectos: Mis proyectos + 5 Plantillas visibles completas en 1080p */
  .project-cover {
    height: 148px;
  }
  .home-section + .home-section {
    margin-top: 18px;
  }
  /* Gantt: columna de concepto más legible en monitores 1080p */
  .gantt-wrap:not(.gantt-printable) {
    --gantt-label-w: 360px;
  }
}

/* === Fondo 100% opaco en encabezados fijos de columnas Venta / Directo / % Inc. === */
thead th {
  z-index: 12;
  background-color: #f4f7fc;
}
thead th.col-venta {
  background: #e6effd !important;
  color: #143673;
}
thead th.col-directo {
  background: #eef3fa !important;
  color: #2b4263;
}
thead th.col-pct {
  background: #f1f5f9 !important;
  color: #334155;
}

/* === Efecto zoom suave en portadas de Plantillas al pasar el cursor === */
.template-image {
  overflow: hidden;
}
.template-image img {
  transition: transform 0.35s ease;
}
.template.card:hover .template-image img {
  transform: scale(1.04);
}

/* === Animación de arrastre con fantasmita translúcido y desplazamiento en vivo === */
.drag-handle {
  cursor: grab;
  touch-action: none;
  user-select: none;
  padding: 2px 5px;
  border-radius: 4px;
  color: #64748b;
  transition: background 120ms ease, color 120ms ease;
}
.drag-handle:hover {
  background: #e8f0fe;
  color: #174ca7;
}
body.is-dragging-rows,
body.is-dragging-rows .drag-handle {
  cursor: grabbing !important;
  user-select: none !important;
}
tr.is-drag-placeholder td {
  background: rgba(232, 240, 254, 0.72) !important;
  opacity: 0.35;
  border-top: 2px dashed #3b82f6 !important;
  border-bottom: 2px dashed #3b82f6 !important;
}
.drag-ghost {
  position: fixed;
  z-index: 250;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(23, 76, 167, 0.45);
  box-shadow: 0 16px 36px rgba(17, 32, 56, 0.22), 0 4px 12px rgba(23, 76, 167, 0.14);
  color: #142039;
  font-size: 13px;
  font-weight: 600;
  transform: scale(1.015);
  transition: box-shadow 150ms ease;
}
.drag-ghost-grip {
  color: #174ca7;
  font-size: 15px;
  flex: none;
}
.drag-ghost-key {
  font-size: 11px;
  font-weight: 700;
  color: #174ca7;
  background: #e8f0fe;
  padding: 2px 6px;
  border-radius: 4px;
  flex: none;
}
.drag-ghost-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drag-ghost-imp {
  flex: none;
  font-variant-numeric: tabular-nums;
  color: #174ca7;
  font-weight: 700;
}

/* === Buscador rápido en Presupuesto, Hero de Inicio y Total con letra en PDF === */
.budget-footbar {
  justify-content: space-between;
}
.footbar-toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.budget-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(310px, 100%);
  flex: 0 1 330px;
}
.budget-inline-search {
  min-height: 32px !important;
  padding: 4px 10px !important;
  font-size: 12.5px !important;
  border-radius: 6px !important;
}
.budget-search-count {
  font-size: 11.5px;
  font-weight: 600;
  color: #174ca7;
  background: #e8f0fe;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.project-home-hero {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.project-home-thumb {
  width: 260px;
  height: 150px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  flex: none;
}
.project-home-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.project-home-info {
  flex: 1 1 360px;
  min-width: 0;
}
.doc-amount-words td {
  text-align: right;
  font-size: 10.5px;
  color: #334155;
  padding: 6px 8px 10px;
  border: 0;
  background: #f8fafc;
}

/* === Enlaces clicables de edición en el pie del presupuesto === */
.foot-edit-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: #174ca7;
  text-align: left;
  cursor: pointer;
}
.foot-edit-link:hover {
  text-decoration: underline;
  color: #0f367a;
}
.foot-edit-cue {
  font-size: 11px;
  opacity: 0.55;
  transition: opacity 140ms ease;
}
.foot-edit-link:hover .foot-edit-cue {
  opacity: 1;
}

/* === Diseño limpio para Actualizar precios, desplegables y listas en modales/avisos === */
.price-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.price-kpis .kpi-diff-up strong { color: #b91c1c; }
.price-kpis .kpi-diff-down strong { color: #15803d; }
.price-ok-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #14532d;
  margin-bottom: 12px;
}
.price-ok-banner small {
  display: block;
  color: #166534;
  margin-top: 2px;
}
.price-ok-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #16a34a;
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  flex: none;
}
.price-diff-table {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
}
.clean-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
  margin-top: 8px;
}
.clean-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  list-style: none;
}
.clean-details > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  color: #174ca7;
  transition: transform 150ms ease;
}
.clean-details[open] > summary::before {
  transform: rotate(90deg);
}
.clean-details > summary small {
  margin-left: auto;
  font-weight: 400;
  color: var(--muted);
}
.clean-details .skipped-table {
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
}
/* Limpieza estética global de listas dentro de avisos y modales (evitar chorritos) */
.catalog2023-warning ul,
.draft-notice ul,
dialog .dialog-body > ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid rgba(203, 213, 225, 0.7);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.85);
}
.catalog2023-warning li,
.draft-notice li,
dialog .dialog-body > ul li {
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.4;
  border-bottom: 1px solid #edf1f7;
  color: #334155;
}
.catalog2023-warning li:last-child,
.draft-notice li:last-child,
dialog .dialog-body > ul li:last-child {
  border-bottom: 0;
}

/* === Modal Prorratear / Ajustar presupuesto === */
.prorrateo-modal { display: grid; gap: 12px; }
.prorrateo-orig-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 8px; background: #fffbeb; border: 1px solid #fde68a; color: #92410e; font-size: 12.5px;
}
.prorrateo-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 8px;
}
.prorrateo-kpis .kpi-chip small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.prorrateo-kpis .kpi-diff-down { background: #ecfdf5; border-color: #a7f3d0; }
.prorrateo-kpis .kpi-diff-down strong, .prorrateo-kpis .kpi-diff-down small { color: #15803d; }
.prorrateo-kpis .kpi-diff-up { background: #fef2f2; border-color: #fecaca; }
.prorrateo-kpis .kpi-diff-up strong, .prorrateo-kpis .kpi-diff-up small { color: #b91c1c; }
.prorrateo-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 12px;
}
.prorrateo-panel {
  border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: #ffffff;
}
.prorrateo-panel h3 {
  display: flex; align-items: center; gap: 7px; font-size: 13px; margin: 0 0 10px; color: var(--ink);
}
.step-badge {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; flex: none;
}
.prorrateo-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.preset-chip {
  border: 1px solid var(--line); background: #f8fafd; color: var(--accent);
  border-radius: 999px; padding: 4px 10px; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.preset-chip:hover { background: #e8f0fe; border-color: #93b4e8; }
.prorrateo-notice {
  margin-top: 8px; padding: 8px 10px; border-radius: 6px; font-size: 12px;
  background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a;
}
.prorrateo-notice.warn { background: #fffbeb; border-color: #fde68a; color: #92410e; }
.prorrateo-table-card { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.prorrateo-table-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; background: #f8fafd; border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.prorrateo-table-card tr.dimmed { opacity: 0.45; }
.prorrateo-table-card .delta-neg { color: #15803d; font-weight: 600; }
.prorrateo-table-card .delta-pos { color: #b91c1c; font-weight: 600; }

/* === COTA 2026 · SUITE DE 7 HERRAMIENTAS PRO === */
.topbar { justify-content: flex-start; gap: 12px; }
.topbar-crumbs { flex: 1 1 auto; display: flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cmdk-trigger { display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 999px; border: 1px solid rgba(140, 179, 255, .28); background: rgba(255, 255, 255, .08); color: #e9f1ff; font: inherit; font-size: 12.5px; cursor: pointer; flex-shrink: 0; transition: background 140ms ease, border-color 140ms ease; }
.cmdk-trigger:hover { background: rgba(255, 255, 255, .15); border-color: rgba(140, 179, 255, .52); }
.cmdk-trigger kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; padding: 1px 6px; border-radius: 5px; background: rgba(7, 17, 34, .45); border: 1px solid rgba(255, 255, 255, .2); color: #cfe0ff; }

.doc-caratula-toggle { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; font-size: 13px; color: var(--ink); cursor: pointer; user-select: none; }
.doc-caratula-toggle input { width: 15px; height: 15px; accent-color: var(--brand); }

/* Carátula ejecutiva PDF */
.caratula-sheet { display: flex; flex-direction: column; gap: 14px; page-break-after: always; break-after: page; }
.caratula-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--brand); padding-bottom: 10px; }
.caratula-brand { display: flex; align-items: center; gap: 12px; }
.caratula-brand img { max-height: 46px; max-width: 150px; object-fit: contain; }
.caratula-brand strong { display: block; font-size: 15px; color: #0f2447; }
.caratula-brand small { display: block; font-size: 11px; color: #526077; }
.caratula-tag-col { text-align: right; }
.caratula-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #e8f0fe; color: #16479c; font-weight: 700; font-size: 10.5px; letter-spacing: .04em; }
.caratula-tag-col small { display: block; margin-top: 4px; color: #526077; font-size: 11px; }
.caratula-hero { display: grid; grid-template-columns: 1.25fr .95fr; gap: 16px; align-items: stretch; }
.caratula-title-block h1 { font-size: 21px; line-height: 1.2; color: #0e2245; margin: 0 0 6px; }
.caratula-desc { font-size: 11.5px; color: #475569; margin: 0 0 10px; }
.caratula-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; margin: 0; padding: 10px 12px; border-radius: 8px; background: #f8fafd; border: 1px solid #e2e8f0; }
.caratula-meta dt { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: #64748b; }
.caratula-meta dd { margin: 2px 0 0; font-size: 11.5px; font-weight: 600; color: #0f172a; }
.caratula-render { border-radius: 10px; overflow: hidden; border: 1px solid #d7e2f2; background: #eef3fa; min-height: 150px; max-height: 195px; }
.caratula-render img { width: 100%; height: 100%; object-fit: cover; display: block; }
.caratula-etapas h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #174ca7; margin: 0 0 6px; }
.caratula-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.caratula-table th { background: #14366e; color: #fff; text-align: left; padding: 4px 7px; font-weight: 600; }
.caratula-table td { padding: 3.5px 7px; border-bottom: 1px solid #e5ebf5; }
.caratula-table .num-col, .caratula-table .number { text-align: right; font-variant-numeric: tabular-nums; }
.caratula-total-box { background: #f0f5ff; border: 1px solid #c7d9fb; border-radius: 10px; padding: 10px 14px; }
.caratula-tot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: center; }
.caratula-tot-grid span { display: block; font-size: 10.5px; color: #475569; }
.caratula-tot-grid strong { font-size: 14px; color: #0f172a; font-variant-numeric: tabular-nums; }
.caratula-tot-main strong { font-size: 17px; color: #16479c; }
.caratula-letra { margin: 7px 0 0; padding-top: 6px; border-top: 1px dashed #b9cef7; font-size: 10.5px; font-style: italic; color: #1e3a6e; }
.caratula-notas { font-size: 10.5px; color: #334155; background: #f8fafc; border-left: 3px solid #174ca7; padding: 7px 10px; border-radius: 4px; }
.caratula-notas p { margin: 3px 0 0; white-space: pre-line; }
.caratula-firmas { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 36px; padding-top: 18px; }
.firma-col { text-align: center; }
.firma-line { border-top: 1px solid #334155; margin-bottom: 5px; }
.firma-col strong { display: block; font-size: 11px; color: #0f172a; }
.firma-col small { display: block; font-size: 10px; color: #64748b; }

/* Pareto 80/20 */
.pareto-bar-wrap { display: flex; align-items: center; gap: 8px; }
.pareto-bar { height: 8px; border-radius: 999px; min-width: 4px; background: #174ca7; }
.pareto-bar.clase-A { background: linear-gradient(90deg, #dc2626, #f97316); }
.pareto-bar.clase-B { background: linear-gradient(90deg, #d97706, #eab308); }
.pareto-bar.clase-C { background: #94a3b8; }
.pareto-bar-wrap span { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 42px; }
.pareto-tag-A { background: #fef2f2; color: #b91c1c; border-color: #fecaca; font-weight: 700; }
.pareto-tag-B { background: #fffbeb; color: #b45309; border-color: #fde68a; font-weight: 600; }
.pareto-tag-C { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }

/* Simulador ¿Qué pasa si...? */
.sim-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); gap: 14px; margin: 12px 0 16px; }
.sim-controls label { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 10px; background: #f8fafd; border: 1px solid var(--line); }
.sim-controls label span { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink); }
.sim-controls input[type="range"] { width: 100%; accent-color: var(--brand); cursor: pointer; }
.kpi-chip.sim-up strong { color: #b91c1c; }
.kpi-chip.sim-down strong { color: #0f7a43; }

/* Modales Pro: Importador, Comparador, Ajuste masivo, Ctrl+K */
.import-dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 20px; border: 2px dashed #b9cef7; border-radius: 12px; background: #f7faff; text-align: center; cursor: pointer; }
.import-dropzone:hover { border-color: var(--brand); background: #eef5ff; }
.import-preview-wrap { margin-top: 12px; max-height: 250px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.cmp-delta-pos { color: #b91c1c; font-weight: 600; }
.cmp-delta-neg { color: #0f7a43; font-weight: 600; }

.cmdk-backdrop { position: fixed; inset: 0; z-index: 9500; background: rgba(11, 23, 45, .52); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding-top: 11vh; }
.cmdk-modal { width: 100%; background: var(--surface, #fff); color: var(--ink, #102038); }
.cmdk-input { width: 100%; padding: 10px 13px; border: 1.5px solid var(--line, #c5d6f3); border-radius: 10px; font: inherit; font-size: 15px; background: var(--surface, #fff); color: var(--ink, #102038); margin-bottom: 10px; }
.cmdk-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23, 76, 167, .14); }
.cmdk-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cmdk-head input { flex: 1; border: 0; outline: 0; font: inherit; font-size: 15px; background: transparent; color: var(--ink); }
.cmdk-list { list-style: none; margin: 0; padding: 6px; max-height: 380px; overflow: auto; }
.cmdk-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.cmdk-item:hover, .cmdk-item.active { background: var(--surface-alt, #edf4ff); }
.cmdk-item-main strong { display: block; font-size: 13.5px; color: var(--ink); }
.cmdk-item-main small { display: block; font-size: 12px; color: var(--muted); }
.cmdk-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-alt, #e8f0fe); color: var(--brand, #16479c); white-space: nowrap; }
.cmdk-foot { display: flex; justify-content: space-between; padding: 8px 14px; background: var(--surface-alt, #f8fafd); border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }

@media print {
  .cmdk-trigger, .cmdk-backdrop, .doc-caratula-toggle, .sim-section { display: none !important; }
  .caratula-sheet { page-break-after: always !important; break-after: page !important; }
}

/* === COTA 2026 · PULIDO VISUAL, MICRO-ANIMACIONES Y MODO OSCURO ARQUITECTÓNICO === */

/* 1. Transición suave entre vistas y modales */
@keyframes cotaViewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
main.view-enter { animation: cotaViewIn 200ms cubic-bezier(.22, 1, .36, 1); }

@keyframes cotaDialogIn {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
dialog[open] { animation: cotaDialogIn 180ms cubic-bezier(.22, 1, .36, 1); }
dialog::backdrop { background: rgba(11, 23, 45, .48); backdrop-filter: blur(4px); }

/* 2. Destello de confirmación en cifras recalculadas */
@keyframes cotaFlashNum {
  0% { background-color: rgba(23, 76, 167, .22); color: #0f44a3; border-radius: 4px; }
  45% { background-color: rgba(16, 163, 94, .18); }
  100% { background-color: transparent; }
}
.cota-flash-num { animation: cotaFlashNum 650ms cubic-bezier(.22, 1, .36, 1); }

/* 3. Acordeón fluido al expandir/contraer partidas */
.collapse { display: inline-flex; align-items: center; justify-content: center; transition: transform 180ms cubic-bezier(.22, 1, .36, 1), background 140ms ease; }
.collapse[aria-expanded="true"] { transform: rotate(90deg); }
/* per-row animation disabled for 60fps on 200+ row budgets */

/* 4. Indicador deslizante en menú lateral y selector de vistas */
.sidebar nav a { position: relative; transition: background 180ms ease, color 180ms ease, transform 160ms ease; }
.sidebar nav a::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #64b5ff; transform: scaleY(0); transition: transform 200ms cubic-bezier(.22, 1, .36, 1); }
.sidebar nav a[aria-current]::before { transform: scaleY(1); }
.sidebar nav a[aria-current] { box-shadow: none; }
.view-pill { transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 140ms ease; }
.view-pill.active { box-shadow: 0 2px 8px rgba(15, 36, 71, .14); }

/* 5. Barras animadas en Pareto y Gantt + tooltip visual */
@keyframes cotaBarGrow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.pareto-bar, .gantt-bar, .gantt-group-bar { transform-origin: left center; animation: cotaBarGrow 300ms cubic-bezier(.22, 1, .36, 1); }
.gantt-bar { transition: filter 150ms ease, transform 150ms ease, box-shadow 150ms ease; }
.gantt-bar:hover { filter: brightness(1.08); box-shadow: 0 3px 10px rgba(23, 76, 167, .28); }

/* 6. Jerarquía de superficies y tipografía tabular */
body { background: #f3f6fb; }
.card { border: 1px solid #e1e8f4; box-shadow: 0 1px 3px rgba(15, 36, 71, .04); transition: box-shadow 200ms ease, border-color 200ms ease, transform 200ms cubic-bezier(.22, 1, .36, 1); }
td.number, .budget td, .summary td, .kpi-chip strong, .caratula-table td, .doc-table td { font-variant-numeric: tabular-nums; }

/* 7. Paleta semántica más nítida en tablas */
.budget tbody tr.group.depth-0 > th { border-left: 3px solid var(--brand); }
.budget tbody tr:hover td, .budget tbody tr:hover th { background-color: rgba(23, 76, 167, .038); }
.budget tbody tr td .actions button:not(.primary) { opacity: .74; transition: opacity 150ms ease, background 150ms ease, border-color 150ms ease; }
.budget tbody tr:hover td .actions button:not(.primary),
.budget tbody tr td .actions button:focus-visible { opacity: 1; }

/* 8. Tarjetas de proyecto con efecto editorial */
.project.card:hover, .template.card:hover { transform: translateY(-3px); border-color: rgba(23, 76, 167, .36); box-shadow: 0 12px 28px rgba(15, 36, 71, .11); }
.project-cover { position: relative; }
.project-cover-kpi { position: absolute; left: 10px; bottom: 10px; padding: 4px 10px; border-radius: 999px; background: rgba(11, 23, 45, .78); backdrop-filter: blur(6px); color: #f4f8ff; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; border: 1px solid rgba(255, 255, 255, .18); pointer-events: none; letter-spacing: .01em; }

/* 9. Skeletons de carga animados (shimmer) */
@keyframes cotaShimmer {
  0% { background-position: -220% 0; }
  100% { background-position: 220% 0; }
}
.cota-skeleton-list { display: flex; flex-direction: column; gap: 12px; padding: 8px 4px; }
.cota-skel-row { display: flex; align-items: center; gap: 14px; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.cota-skel { display: inline-block; height: 13px; border-radius: 6px; background: linear-gradient(90deg, #e7edf7 25%, #f4f7fc 50%, #e7edf7 75%); background-size: 220% 100%; animation: cotaShimmer 1.35s infinite linear; }
.cota-skel.w10 { width: 10%; } .cota-skel.w12 { width: 12%; } .cota-skel.w15 { width: 15%; } .cota-skel.w18 { width: 18%; } .cota-skel.w20 { width: 20%; } .cota-skel.w50 { width: 50%; } .cota-skel.w55 { width: 55%; } .cota-skel.w60 { width: 60%; } .cota-skel.w68 { width: 68%; } .cota-skel.w75 { width: 75%; }

/* 10. Botón y tema Modo Oscuro Arquitectónico (CAD nocturno) */
.topbar-tools { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid rgba(140, 179, 255, .28); background: rgba(255, 255, 255, .07); color: #e9f1ff; font: inherit; font-size: 12.5px; cursor: pointer; transition: background 140ms ease, border-color 140ms ease; }
.theme-toggle:hover { background: rgba(255, 255, 255, .15); border-color: rgba(140, 179, 255, .52); }

:root[data-theme="dark"] {
  --bg: #0b1322;
  --surface: #111c30;
  --ink: #e8f0ff;
  --muted: #94a8c9;
  --line: #233657;
  --brand: #4f8cff;
  --nav: #080f1d;
  --nav-top: #0a1426;
  --nav-hover: #172a4a;
  color-scheme: dark;
}
:root[data-theme="dark"] body { background: #0b1322; color: #e8f0ff; }
:root[data-theme="dark"] .card,
:root[data-theme="dark"] dialog,
:root[data-theme="dark"] .cmdk-modal,
:root[data-theme="dark"] .kpi-chip,
:root[data-theme="dark"] .sim-controls label { background: #111c30; border-color: #233657; color: #e8f0ff; }
:root[data-theme="dark"] .page-head { background: rgba(11, 19, 34, .92) !important; border-bottom-color: #1e3050; }
:root[data-theme="dark"] table th,
:root[data-theme="dark"] table td { border-color: #1f3150; color: #e2ecff; }
:root[data-theme="dark"] thead th { background: #15233c !important; color: #cfe0ff !important; border-bottom-color: #284069 !important; }
:root[data-theme="dark"] thead th.col-venta { background: #182c4d !important; color: #8ec5ff !important; }
:root[data-theme="dark"] thead th.col-directo { background: #162842 !important; color: #9dd4ff !important; }
:root[data-theme="dark"] thead th.col-pct { background: #15233c !important; }
:root[data-theme="dark"] .budget tbody tr.group { background: #14223a; }
:root[data-theme="dark"] .budget tbody tr.group.depth-1 { background: #121f35; }
:root[data-theme="dark"] .budget tbody tr:hover td,
:root[data-theme="dark"] .budget tbody tr:hover th { background-color: rgba(79, 140, 255, .10); }
:root[data-theme="dark"] .budget tfoot tr,
:root[data-theme="dark"] .summary tfoot tr { background: #152440; color: #f2f7ff; }
:root[data-theme="dark"] .col-venta { background: rgba(79, 140, 255, .07); }
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea { background: #0d1729; color: #eaf2ff; border-color: #2a4066; }
:root[data-theme="dark"] .button { background: #16243d; color: #e4eeff; border-color: #2b4268; }
:root[data-theme="dark"] .button:hover { background: #1d3052; border-color: #4f8cff; }
:root[data-theme="dark"] .button.primary { background: #2d6ce5; color: #fff; border-color: #3d7cf5; }
:root[data-theme="dark"] .view-switcher,
:root[data-theme="dark"] .doc-mode-bar { background: #0d1729; border: 1px solid #233657; }
:root[data-theme="dark"] .view-pill { color: #9cb3d6; }
:root[data-theme="dark"] .view-pill:hover:not(.active) { background: rgba(59, 130, 246, .16); color: #f1f5f9; }
:root[data-theme="dark"] .view-pill.active { background: #2563eb; color: #ffffff; box-shadow: 0 2px 8px rgba(37, 99, 235, .38); }
:root[data-theme="dark"] .cmdk-item:hover,
:root[data-theme="dark"] .cmdk-item.active { background: #192d50; }
:root[data-theme="dark"] .cmdk-item-main strong { color: #eff5ff; }
:root[data-theme="dark"] .cmdk-badge { background: #1b3259; color: #8fc1ff; }
:root[data-theme="dark"] .import-dropzone { background: #132138; border-color: #2e4b78; }
:root[data-theme="dark"] .cota-skel { background: linear-gradient(90deg, #172640 25%, #213559 50%, #172640 75%); background-size: 220% 100%; }
:root[data-theme="dark"] .pareto-tag-A { background: rgba(220, 38, 38, .18); color: #fca5a5; border-color: rgba(248, 113, 113, .35); }
:root[data-theme="dark"] .pareto-tag-B { background: rgba(217, 119, 6, .18); color: #fcd34d; border-color: rgba(251, 191, 36, .35); }
:root[data-theme="dark"] .pareto-tag-C { background: #182742; color: #a7bcde; border-color: #2c436b; }

/* Garantizar papel blanco limpio en Vista Previa PDF y al imprimir, incluso en Modo Oscuro */
:root[data-theme="dark"] .doc-sheet,
:root[data-theme="dark"] .doc-sheet table,
:root[data-theme="dark"] .doc-sheet th,
:root[data-theme="dark"] .doc-sheet td,
:root[data-theme="dark"] .caratula-sheet { background: #ffffff !important; color: #0f172a !important; border-color: #e2e8f0 !important; }
:root[data-theme="dark"] .caratula-table th { background: #14366e !important; color: #ffffff !important; }
:root[data-theme="dark"] .caratula-total-box { background: #f0f5ff !important; color: #0f172a !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media print {
  .theme-toggle, .topbar-tools { display: none !important; }
}

/* === COTA 2026 · SELECTOR DE PLAZA / UBICACIÓN MÉXICO (32 ESTADOS + MANUAL) === */
.plaza-picker { display: flex; flex-direction: column; gap: 7px; padding: 10px 12px; border-radius: 10px; background: #f8fafd; border: 1px solid var(--line); }
.plaza-picker label { margin: 0; }
.plaza-selectors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.plaza-selectors select:disabled { opacity: .55; cursor: not-allowed; }
.plaza-picker small { font-size: 11.5px; line-height: 1.35; }
:root[data-theme="dark"] .plaza-picker { background: #0e182b; border-color: #233657; }
@media (max-width: 560px) { .plaza-selectors { grid-template-columns: 1fr; } }

/* === COTA 2026 · REVISIÓN GUIADA, FILTROS Y CORRECCIÓN EN LOTE === */
.review-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.review-chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #f8fafd; color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background 150ms ease, border-color 150ms ease, color 150ms ease; }
.review-chip:hover { border-color: var(--brand); background: #eef4ff; }
.review-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.review-issue-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-sev-critico { background: #fef2f2; color: #b91c1c; border-color: #fecaca; font-weight: 700; font-size: 11px; }
.review-sev-aviso { background: #fffbeb; color: #b45309; border-color: #fde68a; font-weight: 700; font-size: 11px; }
.review-tip { display: block; margin-top: 3px; color: #1d4ed8; font-weight: 500; }
.review-batch-card { margin-bottom: 16px; border-left: 4px solid #d97706; background: #fffdf7; }
.review-batch-list { display: flex; flex-direction: column; gap: 10px; }
.review-batch-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 9px; background: #fff; border: 1px solid #f1e3c6; }
.review-batch-item strong { display: block; font-size: 13.5px; }
.review-batch-item small { color: var(--muted); font-size: 12px; }
.review-banner { padding: 11px 13px; border-radius: 10px; margin-bottom: 12px; border: 1.5px solid #f59e0b; background: #fffbeb; color: #78350f; }
.review-banner-critico { border-color: #ef4444; background: #fef2f2; color: #7f1d1d; }
.review-banner strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.review-banner p { margin: 2px 0; font-size: 12.5px; }
.review-banner small { display: block; font-size: 12px; opacity: .9; }
.review-highlight-field { border-color: #d97706 !important; box-shadow: 0 0 0 3px rgba(245, 158, 11, .28) !important; background: #fffdf0 !important; }
.review-highlight-row td, .review-highlight-row th { background: rgba(245, 158, 11, .11) !important; }

:root[data-theme="dark"] .review-chip { background: #14223a; border-color: #284069; color: #d8e6ff; }
:root[data-theme="dark"] .review-chip.active { background: #2d6ce5; border-color: #3d7cf5; color: #fff; }
:root[data-theme="dark"] .review-tip { color: #8ec5ff; }
:root[data-theme="dark"] .review-batch-card { background: #151f33; border-left-color: #f59e0b; }
:root[data-theme="dark"] .review-batch-item { background: #0f1829; border-color: #2c3f63; }
:root[data-theme="dark"] .review-banner { background: rgba(245, 158, 11, .14); border-color: #f59e0b; color: #fde68a; }
:root[data-theme="dark"] .review-banner-critico { background: rgba(239, 68, 68, .15); border-color: #f87171; color: #fecaca; }
:root[data-theme="dark"] .review-highlight-field { border-color: #fbbf24 !important; box-shadow: 0 0 0 3px rgba(251, 191, 36, .28) !important; background: #1f283d !important; color: #fff !important; }
:root[data-theme="dark"] .review-highlight-row td, :root[data-theme="dark"] .review-highlight-row th { background: rgba(251, 191, 36, .12) !important; }

/* r26 opaque sticky head */
.page-head { background: #f3f6fb; }

/* === COTA 2026 · REDISEÑO MATRIZ APU + ALINEACIÓN DE BARRAS EN TODOS LOS DIÁLOGOS === */

/* Alineación estricta en 1 sola fila para barras de vista previa PDF y pies de diálogo */
#presupuesto-documento { width: min(1100px, 96vw); max-width: 96vw; }
.doc-toolbar { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 14px; padding: .8rem 1.15rem; }
.doc-toolbar-left { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; }
.doc-toolbar .actions { display: flex; flex-wrap: nowrap; align-items: center; gap: 7px; flex-shrink: 0; }
.doc-toolbar .actions .button { white-space: nowrap; flex-shrink: 0; }
.dialog-foot { flex-wrap: nowrap; }
.dialog-foot .button { white-space: nowrap; flex-shrink: 0; }
.project-card-foot .actions, .review-batch-item .actions { flex-wrap: nowrap; flex-shrink: 0; }

/* Workspace amplio para Matriz · Presupuesto */
dialog.editor { width: min(1180px, calc(100% - 28px)); }
.matrix-workspace { display: flex; flex-direction: column; gap: 14px; }
.matrix-top { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 10px; background: #f8fafd; border: 1px solid var(--line); }
.matrix-meta-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.matrix-id-row { display: grid; grid-template-columns: minmax(260px, 1fr) 115px 140px auto; gap: 10px; align-items: end; }
.matrix-gen-col .button { min-height: 40px; white-space: nowrap; }
.matrix-desc-row textarea { min-height: 58px; resize: vertical; }
.matrix-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 2px; }
.matrix-kpi { padding: 9px 12px; border-radius: 9px; background: #fff; border: 1px solid #dce6f5; }
.matrix-kpi span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.matrix-kpi strong { display: block; margin-top: 2px; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.matrix-kpi-venta { background: #eef5ff; border-color: #c5dafc; }
.matrix-kpi-venta strong { color: #154599; }
.matrix-comp { display: flex; flex-direction: column; gap: 5px; }
.matrix-comp-bar { display: flex; height: 7px; border-radius: 999px; overflow: hidden; background: #e2e8f0; }
.mc-mat { background: #2563eb; }
.mc-mo { background: #f59e0b; }
.mc-eq { background: #10b981; }
.matrix-comp-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--muted); }
.matrix-comp-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mc-dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }

.matrix-bottom { display: flex; flex-direction: column; gap: 10px; }
.matrix-tabs { margin-bottom: 2px; }
.matrix-quick-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.matrix-table-wrap { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.matrix-table-wrap .matrix { width: 100%; }
.matrix-table-wrap .matrix th[scope="row"] { min-width: 280px; line-height: 1.35; }
.matrix-cat-row th, .matrix-cat-row td { background: #edf3fc !important; color: #163d7a !important; font-weight: 700; font-size: 12.5px; padding: 7px 10px; border-top: 1px solid #d5e2f5; }
.matrix-del-col { text-align: center; }
.matrix-rend-details { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: #f8fafd; }
.matrix-rend-details summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.matrix-rend-inner { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.matrix-rend-box { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #f8fafd; display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 820px) {
  .matrix-id-row { grid-template-columns: 1fr 1fr; }
  .matrix-name-col { grid-column: 1 / -1; }
  .doc-toolbar { flex-wrap: wrap; }
}

:root[data-theme="dark"] .matrix-top,
:root[data-theme="dark"] .matrix-rend-details,
:root[data-theme="dark"] .matrix-rend-box { background: #0e182b; border-color: #233657; }
:root[data-theme="dark"] .matrix-kpi { background: #132138; border-color: #263b5e; }
:root[data-theme="dark"] .matrix-kpi-venta { background: #162b4d; border-color: #2f548f; }
:root[data-theme="dark"] .matrix-kpi-venta strong { color: #8ec5ff; }
:root[data-theme="dark"] .matrix-cat-row th,
:root[data-theme="dark"] .matrix-cat-row td { background: #162744 !important; color: #9cc6ff !important; border-color: #263f6b; }

/* === COTA 2026 · REDISEÑO PROYECTO, GENERADOR, MI EMPRESA, INDIRECTOS Y SELECTORES === */

/* 1. Crear / Editar proyecto en 2 columnas */
dialog.project-form-modal { width: min(900px, calc(100% - 28px)); }
.project-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.project-form-col { display: flex; flex-direction: column; gap: 11px; min-width: 0; }
@media (max-width: 780px) { .project-form-grid { grid-template-columns: 1fr; } }

/* 2. Generador de cantidades con KPI y filas Sumar/Restar */
.gen-kpi-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 15px; border-radius: 10px; background: #eef5ff; border: 1px solid #c5dafc; }
.gen-kpi-main span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #36558a; }
.gen-kpi-main output { display: block; font-size: 20px; font-weight: 700; color: #123e8c; font-variant-numeric: tabular-nums; margin-top: 2px; }
.gen-kpi-meta { display: flex; gap: 14px; font-size: 12.5px; color: #36558a; }
.gen-row-add td:first-child { border-left: 3px solid #10b981; }
.gen-row-sub td:first-child { border-left: 3px solid #ef4444; }
.gen-row-sub [data-neto] { color: #b91c1c; font-weight: 600; }

/* 3. Mi empresa en 2 columnas con vista previa PDF en vivo */
.empresa-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 18px; align-items: start; }
.empresa-preview-card { position: sticky; top: 18px; }
.emp-paper { background: #ffffff !important; color: #0f172a !important; border: 1px solid #d5e0f0; border-radius: 10px; padding: 16px; box-shadow: 0 6px 20px rgba(15, 36, 71, .08); display: flex; flex-direction: column; gap: 12px; }
.emp-paper-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-bottom: 10px; border-bottom: 2px solid #174ca7; }
.emp-paper-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.emp-paper-brand img { max-height: 38px; max-width: 110px; object-fit: contain; }
.emp-paper-logo-ph { padding: 6px 10px; border-radius: 6px; border: 1px dashed #94a3b8; font-size: 11px; color: #64748b; white-space: nowrap; }
.emp-paper-brand strong { display: block; font-size: 13px; color: #0f2447; }
.emp-paper-brand small { display: block; font-size: 10.5px; color: #526077; line-height: 1.3; }
.emp-paper-pill { padding: 2px 8px; border-radius: 999px; background: #e8f0fe; color: #16479c; font-size: 9.5px; font-weight: 700; white-space: nowrap; }
.emp-paper-body { display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
.emp-paper-skel { height: 8px; border-radius: 4px; background: #eef2f8; }
.emp-paper-skel.w60 { width: 60%; } .emp-paper-skel.w75 { width: 75%; } .emp-paper-skel.w90 { width: 92%; }
.emp-paper-notes { font-size: 10.5px; background: #f8fafd; border-left: 3px solid #174ca7; padding: 7px 9px; border-radius: 4px; color: #334155; }
.emp-paper-notes p { margin: 2px 0 0; white-space: pre-line; }
.emp-paper-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding-top: 10px; text-align: center; }
.emp-sign-line { border-top: 1px solid #475569; margin-bottom: 4px; }
.emp-paper-sign strong { display: block; font-size: 10.5px; color: #0f172a; }
.emp-paper-sign small { display: block; font-size: 9.5px; color: #64748b; }
@media (max-width: 1020px) { .empresa-layout { grid-template-columns: 1fr; } .empresa-preview-card { position: static; } }

/* 5. Selector de materiales en Matriz con chips de origen */
.mp-top-bar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 14px; }
.mp-search-lbl { flex: 1 1 260px; margin: 0; }
.mp-origin-chips { margin: 0; }

:root[data-theme="dark"] .gen-kpi-bar { background: #142542; border-color: #294678; }
:root[data-theme="dark"] .gen-kpi-main span, :root[data-theme="dark"] .gen-kpi-meta { color: #9cc2f5; }
:root[data-theme="dark"] .gen-kpi-main output { color: #ffffff; }
:root[data-theme="dark"] .gen-row-sub [data-neto] { color: #fca5a5; }

/* === COTA 2026 · SWITCH ANIMADO DÍA / NOCHE CON SOL Y LUNA BRILLANTES === */
:root.theme-transitioning body,
:root.theme-transitioning .sidebar,
:root.theme-transitioning .topbar {
  transition: background-color 180ms ease !important;
}

.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 999px;
}
.theme-switch:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }

.ts-sky {
  position: relative;
  display: block;
  width: 60px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, #38bdf8 0%, #60a5fa 60%, #93c5fd 100%);
  border: 1px solid rgba(255, 255, 255, .36);
  box-shadow: inset 0 2px 6px rgba(12, 74, 110, .25), 0 0 0 1px rgba(15, 23, 42, .12);
  overflow: hidden;
  transition: background 420ms cubic-bezier(.22, 1, .36, 1), border-color 360ms ease, box-shadow 360ms ease;
}
.theme-switch.is-dark .ts-sky {
  background: linear-gradient(135deg, #070d1f 0%, #132245 65%, #1e335c 100%);
  border-color: rgba(254, 240, 138, .35);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .6), 0 0 12px rgba(250, 204, 21, .18);
}

/* Nubes en modo día */
.ts-clouds {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 320ms ease, transform 380ms cubic-bezier(.22, 1, .36, 1);
}
.ts-clouds i {
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 1px 3px rgba(14, 116, 144, .18);
}
.ts-clouds i:nth-child(1) { width: 15px; height: 6px; right: 7px; top: 9px; }
.ts-clouds i:nth-child(2) { width: 10px; height: 4.5px; right: 14px; bottom: 7px; opacity: .75; }
.theme-switch.is-dark .ts-clouds { opacity: 0; transform: translateY(10px); }

/* Estrellas parpadeantes en modo noche */
@keyframes tsTwinkle {
  0%, 100% { opacity: .45; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1.2); }
}
.ts-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 340ms ease, transform 380ms cubic-bezier(.22, 1, .36, 1);
}
.ts-stars i {
  position: absolute;
  border-radius: 50%;
  background: #fef08a;
  box-shadow: 0 0 4px #fde047;
}
.ts-stars i:nth-child(1) { width: 2.5px; height: 2.5px; left: 9px; top: 8px; animation: tsTwinkle 2.2s ease-in-out infinite; }
.ts-stars i:nth-child(2) { width: 2px; height: 2px; left: 19px; top: 13px; animation: tsTwinkle 2.8s ease-in-out .6s infinite; }
.ts-stars i:nth-child(3) { width: 3px; height: 3px; left: 12px; bottom: 7px; animation: tsTwinkle 2.5s ease-in-out 1.1s infinite; }
.theme-switch.is-dark .ts-stars { opacity: 1; transform: translateY(0); }

/* Esfera deslizante con Sol / Luna emitiendo luz amarilla */
@keyframes tsSunGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(253, 224, 71, .95), 0 0 16px rgba(251, 191, 36, .62); }
  50% { box-shadow: 0 0 12px rgba(254, 240, 138, 1), 0 0 22px rgba(245, 158, 11, .8); }
}
@keyframes tsMoonGlow {
  0%, 100% { box-shadow: 0 0 9px rgba(254, 240, 138, .85), 0 0 18px rgba(250, 204, 21, .48); }
  50% { box-shadow: 0 0 13px rgba(254, 249, 195, .98), 0 0 24px rgba(250, 204, 21, .68); }
}
.ts-knob {
  will-change: transform;
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 35%, #fef9c3 0%, #fde047 55%, #f59e0b 100%);
  color: #92410e;
  animation: tsSunGlow 2.8s ease-in-out infinite;
  transform: translateX(0) rotate(0deg);
  transition: transform 420ms cubic-bezier(.34, 1.45, .64, 1), background 380ms ease, color 340ms ease;
}
.theme-switch.is-dark .ts-knob {
  transform: translateX(30px) rotate(360deg);
  background: radial-gradient(circle at 35% 35%, #1e293b 0%, #0f172a 100%);
  color: #fef08a;
  animation: tsMoonGlow 3.2s ease-in-out infinite;
}

.ts-sun, .ts-moon {
  position: absolute;
  transition: opacity 260ms ease, transform 380ms cubic-bezier(.22, 1, .36, 1);
}
.ts-sun { opacity: 1; transform: scale(1) rotate(0deg); color: #b45309; filter: drop-shadow(0 0 3px rgba(254, 240, 138, .9)); }
.ts-moon { opacity: 0; transform: scale(.4) rotate(-60deg); color: #fef08a; filter: drop-shadow(0 0 5px rgba(254, 240, 138, .95)); }
.theme-switch.is-dark .ts-sun { opacity: 0; transform: scale(.4) rotate(90deg); }
.theme-switch.is-dark .ts-moon { opacity: 1; transform: scale(1) rotate(0deg); }

@media print { .theme-switch { display: none !important; } }

/* === COTA 2026 · CAMBIO DE TEMA ATÓMICO (0ms LAG) + CONTRASTE MODO NOCHE PRESUPUESTO === */
:root.no-theme-lag *:not(.theme-switch):not(.theme-switch *) {
  transition: none !important;
}

:root[data-theme="dark"] .budget-viewbar,
:root[data-theme="dark"] .budget-footbar {
  background: #111c30 !important;
  border-color: #233657 !important;
  color: #dbe8ff !important;
}
:root[data-theme="dark"] .footbar-label,
:root[data-theme="dark"] .fsc-badge,
:root[data-theme="dark"] .fsc-badge span {
  color: #a8c0e6 !important;
}
:root[data-theme="dark"] .fsc-badge {
  background: #16243d !important;
  border-color: #2a4169 !important;
}
:root[data-theme="dark"] .foot-toggle-pill {
  background: #16243d !important;
  border-color: #2a4169 !important;
  color: #cfe0ff !important;
}
:root[data-theme="dark"] .foot-toggle-pill.active {
  background: #1d3560 !important;
  border-color: #4f8cff !important;
  color: #ffffff !important;
}
:root[data-theme="dark"] .budget .concept-link,
:root[data-theme="dark"] .budget .activity-link,
:root[data-theme="dark"] .budget button.link,
:root[data-theme="dark"] .budget th a,
:root[data-theme="dark"] .budget td a,
:root[data-theme="dark"] .budget tfoot button.link,
:root[data-theme="dark"] .text-link {
  color: #8ec5ff !important;
}
:root[data-theme="dark"] .budget .concept-link:hover,
:root[data-theme="dark"] .budget button.link:hover,
:root[data-theme="dark"] .text-link:hover {
  color: #c2e0ff !important;
}
:root[data-theme="dark"] .tag.light {
  background: #162540 !important;
  color: #cfe0ff !important;
  border-color: #2a4169 !important;
}
:root[data-theme="dark"] .budget tbody tr.add-row td {
  background: #0f192b !important;
}

/* r33 simetría de márgenes */
main > .budget-viewbar,
main > .budget-footbar,
main > .programa-kpis,
main > .card,
main > .page-head {
  margin-inline: auto;
  width: 100%;
  max-width: 1606px;
  box-sizing: border-box;
}

/* r37: Encuadre exacto del splash original SVG/CSS dentro de la tarjeta flotante 640x370 */
@media (max-width: 700px), (max-height: 450px) {
  .cota-splash { border: 1px solid rgba(140, 179, 255, .26); box-sizing: border-box; }
  .splash-stage { gap: 16px; width: min(440px, 86vw); }
  .splash-emblem { width: 176px; height: 176px; }
  .splash-center-brand { font-size: 21px; }
  .splash-message { font-size: 13.5px; }
}

/* === COTA 2026 · INDICADOR Y CONFIGURACIÓN DE AUTOGUARDADO === */
@keyframes autosavePulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); }
  100% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
}
.autosave-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(140, 179, 255, .22);
  background: rgba(255, 255, 255, .06);
  color: #dce8ff;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 140ms ease, border-color 140ms ease;
}
.autosave-pill:hover { background: rgba(255, 255, 255, .14); border-color: rgba(140, 179, 255, .48); }
.autosave-pill.is-saved-pulse { animation: autosavePulse 650ms ease; }
.autosave-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 6px rgba(52, 211, 153, .85); flex-shrink: 0; }
.autosave-dot.is-paused { background: #fbbf24; box-shadow: 0 0 5px rgba(251, 191, 36, .7); }
.autosave-presets { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.autosave-status-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 9px; background: #f5f8fd; border: 1px solid var(--line); font-size: 12.5px; }
:root[data-theme="dark"] .autosave-status-box { background: #0e182b; border-color: #233657; }
@media print { .autosave-pill { display: none !important; } }

/* === COTA 2026 · UNDO/REDO, TARJETAS APU PDF, PAGOS Y COTIZACIONES === */
.undo-group { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; }
.undo-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; border: 1px solid rgba(140, 179, 255, .24); background: rgba(255, 255, 255, .06); color: #e8f1ff; font-size: 15px; cursor: pointer; transition: background 140ms ease, opacity 140ms ease; }
.undo-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .16); border-color: rgba(140, 179, 255, .52); }
.undo-btn:disabled { opacity: .34; cursor: default; }

.apu-sheet { display: flex; flex-direction: column; gap: 10px; }
.apu-sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 2px solid #174ca7; padding-bottom: 6px; font-size: 11px; color: #334155; }
.apu-sheet-head > * { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.apu-sheet-head strong { font-size: 13px; color: #0f2447; }
.apu-sheet-body { display: flex; flex-direction: column; gap: 14px; }
.apu-card { border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; break-inside: avoid; background: #fff; }
.apu-card-head { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; background: #f4f7fc; border-bottom: 1px solid #dce6f5; }
.apu-card-head > div:first-child { min-width: 0; flex: 1 1 auto; }
.apu-badge { display: inline-block; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #16479c; overflow-wrap: anywhere; word-break: break-word; }
.apu-card-head h3 { margin: 2px 0 0; font-size: 11.5px; color: #0f172a; line-height: 1.25; overflow-wrap: anywhere; word-break: break-word; }
.apu-desc { margin: 2px 0 0; font-size: 10px; color: #475569; overflow-wrap: anywhere; word-break: break-word; }
.apu-head-meta { display: flex; gap: 8px; align-items: center; flex-shrink: 0; text-align: right; }
.apu-head-meta div span { display: block; font-size: 9px; color: #64748b; text-transform: uppercase; }
.apu-head-meta div strong { font-size: 11px; color: #0f172a; font-variant-numeric: tabular-nums; }
.apu-pu-box { padding: 4px 8px; border-radius: 6px; background: #e8f0fe; border: 1px solid #bfd6fc; }
.apu-pu-box strong { color: #154599 !important; font-size: 12px !important; }
.apu-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 10px; }
.apu-table th { background: #1e3a6e; color: #fff; padding: 3.5px 6px; text-align: left; overflow-wrap: anywhere; word-break: break-word; }
.apu-table td { padding: 3px 6px; border-bottom: 1px solid #edf2f7; overflow-wrap: anywhere; word-break: break-word; }
.apu-table th.number, .apu-table td.number { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
.apu-table .apu-cat th, .apu-table .apu-cat td { background: #eef3fb; color: #163d7a; font-weight: 700; }
.apu-totals { display: grid; grid-template-columns: repeat(4, 1fr) 1.6fr; gap: 6px; padding: 6px 10px; background: #f8fafd; border-top: 1px solid #dce6f5; font-size: 10px; }
.apu-totals span { display: block; font-size: 9px; color: #64748b; }
.apu-totals strong { color: #0f172a; font-variant-numeric: tabular-nums; }
.apu-tot-final { text-align: right; }
.apu-tot-final strong { color: #154599; font-size: 11.5px; }

.caratula-pagos h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: #174ca7; margin: 2px 0 5px; }
.quote-best-row td, .quote-best-row th { background: rgba(16, 185, 129, .08); }
@media print { .undo-group { display: none !important; } }

/* === COTA 2026 · FOCO LIMPIO SIN TAPAR ETIQUETAS + ESPACIADO DE FORMULARIOS === */
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #174ca7;
  box-shadow: 0 0 0 3px rgba(23, 76, 167, .16);
}
:root[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):focus,
:root[data-theme="dark"] select:focus,
:root[data-theme="dark"] textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, .24);
}
@media (forced-colors: active) {
  input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
    outline: 2px solid Highlight !important;
    outline-offset: 2px;
  }
}
.empresa-card, .fin-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.empresa-card label, .fin-card label {
  display: grid;
  gap: 6px;
}

/* === COTA 2026 · ALINEACIÓN GLOBAL DE FORMULARIOS + MENÚS ERGONÓMICOS === */
:root { --brand: #174ca7; }

/* Altura uniforme (40px) y alineación inferior en todos los campos lado a lado de todas las ventanas */
.fields { align-items: end; }
.fields > label { align-content: end; }
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), select) {
  min-height: 40px;
  height: 40px;
  box-sizing: border-box;
}
.budget td input[type="number"] {
  min-height: 34px;
  height: 34px;
}

/* Menú desplegable compacto para barra de herramientas de Presupuesto */
.cota-menu { position: relative; display: inline-block; }
.cota-menu > summary { list-style: none; user-select: none; }
.cota-menu > summary::-webkit-details-marker { display: none; }
.cota-menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #d5e0f0;
  box-shadow: 0 14px 36px rgba(15, 36, 71, .16);
}
.cota-menu-pop .button {
  width: 100%;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  min-height: 35px;
  padding: 6px 10px;
  font-weight: 500;
  border-radius: 7px;
}
.cota-menu-pop .button:hover { background: #edf4ff; color: #16479c; }

:root[data-theme="dark"] .cota-menu-pop {
  background: #132138;
  border-color: #294169;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .48);
}
:root[data-theme="dark"] .cota-menu-pop .button { background: transparent; color: #e2ecff; }
:root[data-theme="dark"] .cota-menu-pop .button:hover { background: #1c3257; color: #ffffff; }

/* === COTA 2026 · SPLASH LIMPIO EN AZUL (RETÍCULA + MARCO HAIRLINE + BARRA CON BRILLO) === */
.cota-splash.splash-fusion {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
  background: linear-gradient(148deg, #0f2140 0%, #09152b 58%, #060d1b 100%);
  border: 1px solid rgba(116, 180, 255, .28);
  box-shadow:
    inset 0 0 0 1px rgba(148, 197, 255, .18),
    inset 0 1px 0 rgba(219, 234, 254, .26);
  box-sizing: border-box;
  overflow: hidden;
}
.cota-splash.splash-fusion .splash-grid {
  background-image:
    linear-gradient(to right, rgba(140, 179, 255, .072) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(140, 179, 255, .072) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 1;
}
.splash-planes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.splash-fusion-body {
  position: relative;
  z-index: 2;
  flex: 1;
  width: 100%;
  max-width: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 30px;
  padding: 14px 46px 4px;
  animation: none;
}
@media (min-width: 900px) {
  .splash-fusion-body {
    justify-content: center;
    gap: 38px;
    padding: 24px 64px 12px;
  }
}
.splash-fusion-body .splash-emblem {
  position: relative;
  width: 162px;
  height: 162px;
  flex-shrink: 0;
  animation: splashItemIn 520ms cubic-bezier(.22,.61,.36,1) 60ms both;
}
.splash-fusion-body .splash-emblem::before {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, .20) 0%, rgba(37, 99, 235, .05) 48%, transparent 72%);
  pointer-events: none;
  z-index: -1;
}
.cota-splash.is-ready .splash-ring-fill {
  stroke: #93c5fd;
  filter: drop-shadow(0 0 8px rgba(147, 197, 253, .85));
}
.splash-fusion-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.splash-fusion-wordmark {
  font-size: 50px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.04em;
  color: #f4f8ff;
  animation: splashItemIn 480ms cubic-bezier(.22,.61,.36,1) 150ms both;
}
.splash-fusion-wordmark span { color: #74b4ff; }
.splash-fusion-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .17em;
  color: #a4bee6;
  animation: splashItemIn 460ms cubic-bezier(.22,.61,.36,1) 230ms both;
}
.splash-fusion-ver {
  margin-top: 10px;
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(116, 180, 255, .10);
  border: 1px solid rgba(116, 180, 255, .24);
  font-size: 11.5px;
  color: #cfe0ff;
  animation: splashItemIn 460ms cubic-bezier(.22,.61,.36,1) 310ms both;
}
.splash-tech-bottom {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 22px 10px;
  pointer-events: none;
  animation: splashItemIn 460ms cubic-bezier(.22,.61,.36,1) 340ms both;
}
.splash-legal {
  font-size: 10px;
  letter-spacing: .04em;
  color: rgba(164, 190, 230, .44);
}
.splash-fusion-foot {
  position: relative;
  z-index: 3;
  width: 100%;
  background: rgba(5, 11, 22, .94);
  border-top: 1px solid rgba(116, 180, 255, .18);
  display: flex;
  flex-direction: column;
}
.splash-fusion-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 22px 12px;
}
.splash-fusion-row .splash-message {
  margin: 0;
  text-align: left;
  font-size: 12.5px;
  color: #d2e0f5;
  transition: color 240ms ease;
}
.cota-splash.is-ready .splash-fusion-row .splash-message {
  color: #e8f2ff;
}
.splash-fusion-row .splash-percent {
  font-size: 12.5px;
  font-weight: 700;
  color: #8cb3ff;
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  transition: color 240ms ease;
}
.cota-splash.is-ready .splash-fusion-row .splash-percent {
  color: #bae6fd;
}
.splash-fusion-bar {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 0;
  background: #101e38;
  overflow: hidden;
}
.splash-fusion-bar .splash-bar-fill {
  position: relative;
  height: 100%;
  border-radius: 0;
  background: linear-gradient(90deg, #1d4ed8 0%, #3b82f6 48%, #7dd3fc 92%, #e0f2fe 100%);
  box-shadow: 0 0 12px rgba(96, 165, 250, .82);
  transition: background 240ms ease, box-shadow 240ms ease;
}
.splash-fusion-bar .splash-bar-fill::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, .36) 50%, transparent 100%);
  background-size: 180px 100%;
  animation: splashBarShimmer 1.6s linear infinite;
}
.splash-fusion-bar .splash-bar-fill::after {
  content: "";
  position: absolute;
  top: -1px;
  right: 0;
  width: 16px;
  height: 6px;
  background: radial-gradient(circle at right center, rgba(224, 242, 254, .95) 0%, rgba(96, 165, 250, .45) 55%, transparent 100%);
}
.cota-splash.is-ready .splash-fusion-bar .splash-bar-fill {
  background: linear-gradient(90deg, #2563eb 0%, #60a5fa 58%, #e0f2fe 100%);
  box-shadow: 0 0 15px rgba(125, 211, 252, .9);
}
@keyframes splashItemIn {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes splashBarShimmer {
  from { background-position: -180px 0; }
  to { background-position: 640px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .splash-fusion-body .splash-emblem,
  .splash-fusion-wordmark,
  .splash-fusion-sub,
  .splash-fusion-ver,
  .splash-tech-bottom,
  .splash-fusion-bar .splash-bar-fill::before {
    animation: none;
  }
}

/* === COTA 2026 · USUARIOS, LICENCIAS Y PERFIL === */
.cota-auth-gate {
  position: fixed;
  inset: 0;
  z-index: 9800;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(148deg, #0f2140 0%, #09152b 58%, #060d1b 100%);
  overflow-y: auto;
}
.cota-auth-card {
  width: min(460px, 100%);
  background: #ffffff;
  color: #102038;
  border-radius: 16px;
  padding: 28px 30px 24px;
  box-shadow: 0 24px 64px rgba(3, 10, 24, .5);
}
.cota-auth-brand { margin-bottom: 18px; }
.cota-auth-logo {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
  color: #0c1a32;
}
.cota-auth-logo span { color: #2563eb; }
.cota-auth-sub {
  margin-top: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  color: #5b708f;
}
.cota-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  background: #eef3fa;
  border-radius: 10px;
  margin-bottom: 16px;
}
.cota-atab {
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #4b617f;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.cota-atab.active {
  background: #ffffff;
  color: #174ca7;
  box-shadow: 0 2px 6px rgba(12, 26, 50, .09);
}
.cota-auth-form label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #243854;
  margin-bottom: 12px;
}
.cota-auth-form input[type="email"],
.cota-auth-form input[type="password"],
.cota-auth-form input[type="text"],
.cota-auth-form input[type="number"] {
  display: block;
  width: 100%;
  height: 40px;
  margin-top: 5px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 400;
  font-size: 13.5px;
  line-height: 1;
  color: #102038;
  background: #ffffff;
}
.cota-auth-form input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
}
.cota-auth-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.cota-legal-check {
  display: flex !important;
  align-items: flex-start;
  gap: 9px;
  font-weight: 500 !important;
  font-size: 12px !important;
  line-height: 1.45;
  color: #3e5370 !important;
  margin: 6px 0 14px !important;
}
.cota-legal-check input { margin-top: 2px; flex-shrink: 0; }
.cota-legal-check a { color: #174ca7; font-weight: 600; text-decoration: underline; }
.cota-auth-submit {
  width: 100%;
  height: 42px;
  border: none;
  border-radius: 9px;
  background: #174ca7;
  color: #ffffff;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  margin-top: 4px;
}
.cota-auth-submit:hover { background: #123e89; }
.cota-auth-submit:disabled { opacity: .65; cursor: wait; }
.cota-auth-alert,
.cota-auth-msg {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 12.5px;
  line-height: 1.4;
}
.cota-auth-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e6edf7;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.cota-link-btn {
  border: none;
  background: transparent;
  color: #5a6f8e;
  font-family: inherit;
  font-weight: 600;
  font-size: 11.5px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.cota-link-btn:hover { color: #174ca7; text-decoration: underline; }

/* Topbar User Pill */
.cota-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 10px 0 4px;
  border-radius: 999px;
  border: 1px solid rgba(148, 197, 255, .28);
  background: rgba(255, 255, 255, .08);
  color: #eaf2ff;
  font-family: inherit;
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease;
}
.cota-user-pill:hover { background: rgba(255, 255, 255, .16); }
.cota-up-av {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  object-fit: cover;
  overflow: hidden;
}
.cota-up-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Profile & Legal Dialogs */
.cota-auth-dialog {
  width: min(640px, 94vw);
  border: 1px solid var(--border, #dce4f0);
  border-radius: 14px;
  padding: 22px 24px;
  background: var(--surface, #ffffff);
  color: var(--ink, #102038);
  box-shadow: 0 24px 60px rgba(8, 18, 36, .35);
}
.cota-auth-dialog::backdrop {
  background: rgba(8, 18, 36, .58);
  backdrop-filter: blur(3px);
}
.cota-legal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.cota-legal-head h3 { margin: 0; font-size: 18px; }
.cota-legal-head p { margin: 3px 0 0; font-size: 12.5px; }
.cota-legal-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.cota-ltab {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border, #d5dfec);
  background: transparent;
  color: var(--muted, #5a6d87);
  font-family: inherit;
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1;
  cursor: pointer;
}
.cota-ltab.active {
  background: var(--brand, #174ca7);
  border-color: var(--brand, #174ca7);
  color: #ffffff;
}
.cota-legal-body {
  margin: 0;
  max-height: 340px;
  overflow-y: auto;
  white-space: pre-wrap;
  font: 400 12.5px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border, #dce4f0);
  background: var(--bg, #f6f9fd);
  color: var(--ink, #102038);
}
.cota-legal-foot {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.cota-prof-body label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 10px;
}
.cota-prof-body input[type="text"],
.cota-prof-body input[type="number"] {
  display: block;
  width: 100%;
  height: 40px;
  margin-top: 4px;
}
.cota-prof-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.cota-prof-avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #174ca7;
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  overflow: hidden;
  flex-shrink: 0;
}
.cota-prof-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.cota-lic-box {
  margin: 12px 0;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border, #dce4f0);
  background: var(--bg, #f5f8fd);
}
.cota-lic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cota-lic-pill {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.cota-lic-pill.ok { background: #e6f7f4; color: #0f766e; }
.cota-lic-pill.warn { background: #fef3c7; color: #b45309; }

.cota-auth-alert.is-ok { background: #e6f7f4; color: #0f766e; border: 1px solid #b5e7de; }

/* === COTA 2026 · SEMÁNTICA DE NOTIFICACIONES (VERDE=ÉXITO, ÁMBAR=AVISO, ROJO=ERROR) === */
.cota-auth-alert.is-ok,
.cota-auth-msg.is-ok {
  background: #e6f7f4;
  color: #0f766e;
  border: 1px solid #b5e7de;
}
.cota-auth-alert.is-warn,
.cota-auth-msg.is-warn {
  background: #fef3c7;
  color: #92410e;
  border: 1px solid #fde68a;
}
.cota-auth-alert.is-info,
.cota-auth-msg.is-info {
  background: #e8f0ff;
  color: #174ca7;
  border: 1px solid #c7dafc;
}
.cota-auth-alert.is-err,
.cota-auth-msg.is-err {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
:root[data-theme="dark"] .cota-auth-alert.is-ok,
:root[data-theme="dark"] .cota-auth-msg.is-ok {
  background: rgba(15, 118, 110, .22);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, .38);
}
:root[data-theme="dark"] .cota-auth-alert.is-warn,
:root[data-theme="dark"] .cota-auth-msg.is-warn {
  background: rgba(180, 83, 9, .24);
  color: #fcd34d;
  border-color: rgba(251, 191, 36, .38);
}
:root[data-theme="dark"] .cota-auth-alert.is-info,
:root[data-theme="dark"] .cota-auth-msg.is-info {
  background: rgba(37, 99, 235, .22);
  color: #93c5fd;
  border-color: rgba(147, 197, 253, .36);
}

.cota-update-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, .45);
  background: rgba(16, 185, 129, .18);
  color: #a7f3d0;
  font-family: inherit;
  font-weight: 600;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease;
}
.cota-update-pill:hover { background: rgba(16, 185, 129, .30); }
.cota-upd-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, .9);
}


/* === R61: SIDEBAR FOOTER, BIENVENIDA Y TUTORIAL GUIADO === */
.sidebar {
  display: flex;
  flex-direction: column;
  height: calc(100dvh / var(--cota-zoom, 1));
  max-height: calc(100dvh / var(--cota-zoom, 1));
  overflow-y: auto;
}
.sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(140, 179, 255, 0.14);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  gap: 4px;
}
.sidebar-foot-btn {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 46px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #e4ebf8;
  font-family: inherit;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: background var(--cota-dur-fast) var(--cota-ease-out), color var(--cota-dur-fast) var(--cota-ease-out);
}
.sidebar-foot-btn:hover {
  background: #1d3454;
  color: #ffffff;
}
.sidebar-foot-btn .nav-icon svg {
  width: 20px;
  height: 20px;
  color: #93c5fd;
}
.sidebar-foot-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-upd-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
  flex-shrink: 0;
}
@media (max-width: 720px) {
  .sidebar { min-height: auto; height: auto; max-height: none; }
  .sidebar-footer { margin-top: 8px; display: flex; flex-wrap: wrap; }
  .sidebar-foot-btn { width: auto; }
}

/* Modales de Bienvenida y Ayuda con fondo borroso */
dialog.cota-guide-dialog {
  width: min(580px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid rgba(148, 197, 255, 0.22);
  border-radius: 16px;
  background: var(--surface, #ffffff);
  color: var(--ink, #0f172a);
  box-shadow: 0 28px 80px rgba(4, 12, 28, 0.45);
  overflow: hidden;
  animation: cotaGuidePop .24s cubic-bezier(.22, .61, .36, 1) both;
}
dialog.cota-guide-dialog::backdrop {
  background: rgba(8, 15, 29, 0.56);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.cota-welcome-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #10213f 0%, #0b162c 100%);
  color: #f4f8ff;
  border-bottom: 1px solid rgba(148, 197, 255, 0.16);
}
.cota-welcome-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cota-welcome-word {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: #ffffff;
}
.cota-welcome-word span { color: #74b4ff; }
.cota-welcome-pill {
  font-size: 11.5px;
  color: #a9c4ea;
  margin-top: 2px;
}
.cota-guide-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(148, 197, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #dbe7fb;
  cursor: pointer;
  font-size: 14px;
  display: grid;
  place-items: center;
}
.cota-guide-close:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
.cota-welcome-body {
  padding: 22px 24px 18px;
}
.cota-welcome-body h2 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.cota-welcome-lead {
  margin: 0 0 18px;
  font-size: 13.8px;
  line-height: 1.55;
  color: var(--muted, #475569);
}
.cota-welcome-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 600px) {
  .cota-welcome-grid { grid-template-columns: 1fr; }
}
.cota-welcome-feat {
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-alt, #f4f7fc);
  border: 1px solid var(--line, rgba(15, 23, 42, 0.1));
}
.cota-welcome-feat strong {
  display: block;
  font-size: 12.8px;
  margin-bottom: 4px;
}
.cota-welcome-feat span {
  display: block;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted, #475569);
}
.cota-welcome-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.8px;
  color: var(--muted, #475569);
  cursor: pointer;
}
.cota-welcome-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--line, rgba(15, 23, 42, 0.08));
}
.cota-about-lic {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.28);
  font-size: 12.5px;
  margin-bottom: 14px;
}
.cota-about-lic code {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 600;
}
.cota-about-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
@media (max-width: 560px) {
  .cota-about-actions { grid-template-columns: 1fr; }
}
.cota-about-tile {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line, rgba(15, 23, 42, 0.12));
  background: var(--surface-alt, #f6f9fe);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}
.cota-about-tile:hover {
  border-color: #3b82f6;
  transform: translateY(-1px);
}
.cota-about-tile strong {
  display: block;
  font-size: 13px;
  margin-bottom: 3px;
}
.cota-about-tile span {
  display: block;
  font-size: 11.8px;
  line-height: 1.4;
  color: var(--muted, #475569);
}
.cota-about-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted, #475569);
}
.cota-about-keys kbd {
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line, rgba(15, 23, 42, 0.18));
  background: var(--surface-alt, #f1f5f9);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
}

/* Tutorial guiado interactivo (Spotlight) */
.cota-tour-layer {
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: auto;
}
.cota-tour-ring {
  position: fixed;
  border-radius: 12px;
  border: 2px solid #60a5fa;
  box-shadow: 0 0 0 9999px rgba(8, 15, 29, 0.62), 0 0 24px rgba(59, 130, 246, 0.55);
  pointer-events: none;
  transition: top 220ms ease, left 220ms ease, width 220ms ease, height 220ms ease;
}
.cota-tour-card {
  position: fixed;
  z-index: 9992;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--surface, #ffffff);
  color: var(--ink, #0f172a);
  border: 1px solid rgba(59, 130, 246, 0.35);
  box-shadow: 0 24px 60px rgba(4, 12, 28, 0.45);
  transition: top 220ms ease, left 220ms ease;
}
.cota-tour-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cota-tour-step {
  font-size: 11.5px;
  font-weight: 700;
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cota-tour-skip {
  border: 0;
  background: transparent;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.cota-tour-skip:hover { color: var(--ink, #0f172a); }
.cota-tour-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.16);
  overflow: hidden;
  margin-bottom: 12px;
}
.cota-tour-bar > div {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  transition: width 220ms ease;
}
.cota-tour-card h3 {
  margin: 0 0 6px;
  font-size: 16.5px;
  font-weight: 700;
}
.cota-tour-card p {
  margin: 0 0 16px;
  font-size: 13.2px;
  line-height: 1.55;
  color: var(--muted, #475569);
}
.cota-tour-card code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.12);
  font-size: 12px;
}
.cota-tour-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
@keyframes cotaGuidePop {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}


/* === R62: AUDITORIA DE DISENO, RETICULA, SIMETRIA Y ACCESIBILIDAD === */
:root {
  --cota-dur-fast: 140ms;
  --cota-dur-med: 240ms;
  --cota-dur-slow: 380ms;
  --cota-ease-out: cubic-bezier(.22, .61, .36, 1);
  --cota-focus-ring: 0 0 0 2px #74b4ff;
  --cota-bp-minor: rgba(140, 179, 255, 0.065);
  --cota-bp-major: rgba(140, 179, 255, 0.12);
}

/* D-004: Contraste WCAG AA (>15:1) para enlace Saltar al contenido en ambos temas */
.skip {
  background: #10203a !important;
  color: #f3f6fc !important;
  border: 1px solid #74b4ff;
}
.skip:focus-visible {
  outline: 2px solid #74b4ff;
  outline-offset: 2px;
}

/* D-001 y D-003: Simetría exacta al píxel (0px desbordamiento) en el pie del panel lateral */
.sidebar {
  overflow-x: hidden;
}
.sidebar-foot-btn:focus-visible,
.sidebar nav a:focus-visible,
.button:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #74b4ff;
  outline-offset: 2px;
}

/* D-002: Fondo con retícula arquitectónica y planos geométricos en Acceso Cota (.cota-auth-gate) */
.cota-auth-gate {
  background-color: #09152b !important;
  background-image:
    radial-gradient(circle at 50% 34%, rgba(59, 130, 246, 0.24) 0%, transparent 56%),
    linear-gradient(to right, var(--cota-bp-major) 1px, transparent 1px),
    linear-gradient(to bottom, var(--cota-bp-major) 1px, transparent 1px),
    linear-gradient(to right, var(--cota-bp-minor) 1px, transparent 1px),
    linear-gradient(to bottom, var(--cota-bp-minor) 1px, transparent 1px),
    linear-gradient(122deg, transparent 0%, transparent 66%, rgba(59, 107, 194, 0.12) 66%, rgba(59, 107, 194, 0.12) 78%, rgba(37, 99, 235, 0.16) 78%, rgba(37, 99, 235, 0.16) 100%),
    radial-gradient(circle at 50% 34%, #162e57 0%, #0c1931 58%, #070f1f 100%) !important;
  background-size:
    100% 100%,
    128px 128px,
    128px 128px,
    32px 32px,
    32px 32px,
    100% 100%,
    100% 100% !important;
}
.cota-auth-card {
  box-shadow: 0 28px 70px rgba(4, 11, 26, 0.56), 0 0 0 1px rgba(148, 197, 255, 0.26) !important;
  animation: cotaGuidePop var(--cota-dur-med) var(--cota-ease-out) both;
}

/* D-006: Ergonomía en barra superior (controles >= 34px altura sin perder compacidad) */
.undo-btn {
  min-width: 34px !important;
  min-height: 34px !important;
}
.autosave-pill,
.cmdk-trigger,
.theme-switch {
  min-height: 34px !important;
}

/* D-005: Respeto integral a prefers-reduced-motion en todas las animaciones y guía */
@media (prefers-reduced-motion: reduce) {
  dialog.cota-guide-dialog,
  .cota-auth-card,
  .cota-tour-ring,
  .cota-tour-card,
  .cota-tour-bar > div,
  .sidebar-foot-btn,
  .cota-about-tile {
    animation: none !important;
    transition: none !important;
  }
}

[hidden] { display: none !important; }


/* r75: Dark mode polish for budget links, dialog headers, chips, and add-rows */
:root[data-theme="dark"] .cell-button {
  color: #8ec5ff !important;
  background: transparent !important;
}
:root[data-theme="dark"] .cell-button:hover {
  color: #cce4ff !important;
}
:root[data-theme="dark"] .dialog-head,
:root[data-theme="dark"] dialog header.dialog-head,
:root[data-theme="dark"] .dialog-foot {
  background: #132138 !important;
  border-color: #233657 !important;
  color: #eaf2ff !important;
}
:root[data-theme="dark"] dialog .close {
  background: #1a2d4d !important;
  border-color: #2d4670 !important;
  color: #dbeafe !important;
}
:root[data-theme="dark"] dialog .close:hover {
  background: #233d68 !important;
  color: #ffffff !important;
}
:root[data-theme="dark"] .budget tbody tr.add-row td,
:root[data-theme="dark"] .budget tbody tr.add-row th,
:root[data-theme="dark"] .budget tfoot td,
:root[data-theme="dark"] .budget tfoot th {
  background: #101b2e !important;
  color: #dbeafe !important;
  border-color: #1f3150 !important;
}
:root[data-theme="dark"] .budget tbody tr.add-row .button,
:root[data-theme="dark"] .budget tbody tr.add-row button {
  background: #162642 !important;
  border-color: #2b436b !important;
  color: #dbeafe !important;
}
:root[data-theme="dark"] .budget tbody tr.add-row .button:hover {
  background: #1f355c !important;
  border-color: #4f8cff !important;
  color: #ffffff !important;
}
:root[data-theme="dark"] .tag,
:root[data-theme="dark"] .pill,
:root[data-theme="dark"] .badge,
:root[data-theme="dark"] .concept-chip,
:root[data-theme="dark"] .usage-chip,
:root[data-theme="dark"] .ref-chip,
:root[data-theme="dark"] .code-chip {
  background: #172742;
  border-color: #2b436b;
  color: #cfe2ff;
}
:root[data-theme="dark"] .tag.warn {
  background: rgba(245, 158, 11, .16) !important;
  border-color: rgba(245, 158, 11, .42) !important;
  color: #fde68a !important;
}
:root[data-theme="dark"] .tag.ok,
:root[data-theme="dark"] .status-active {
  background: rgba(16, 185, 129, .16) !important;
  border-color: rgba(16, 185, 129, .4) !important;
  color: #6ee7b7 !important;
}
:root[data-theme="dark"] .table-wrap,
:root[data-theme="dark"] .card table,
:root[data-theme="dark"] tbody tr {
  background-color: transparent;
}
:root[data-theme="dark"] .master-destination {
  background: #132138 !important;
  border-left-color: #4f8cff !important;
  color: #dbeafe !important;
}


/* r76: Complete Dark Mode coverage (inline-qty, Gantt, usos-drop, tfoot, FASAR, Revision badges) */
:root[data-theme="dark"] .inline-qty {
  background: #0d1729 !important;
  color: #eaf2ff !important;
  border-color: #2a4066 !important;
}
:root[data-theme="dark"] .inline-qty:focus {
  border-color: #60a5fa !important;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, .25) !important;
}
:root[data-theme="dark"] table tfoot th,
:root[data-theme="dark"] table tfoot td {
  background: #14223a !important;
  color: #f1f5f9 !important;
  border-color: #233657 !important;
}
:root[data-theme="dark"] .summary tfoot th,
:root[data-theme="dark"] .summary tfoot td {
  background: #1d4ed8 !important;
  color: #ffffff !important;
}
/* Gantt (Programa de obra) */
:root[data-theme="dark"] .gantt-board {
  background: #0f192b !important;
  border-color: #233657 !important;
}
:root[data-theme="dark"] .gantt-header,
:root[data-theme="dark"] .gantt-header .gantt-label,
:root[data-theme="dark"] .gantt-years,
:root[data-theme="dark"] .gantt-months {
  background: #14223a !important;
  color: #cfe0ff !important;
  border-color: #233657 !important;
}
:root[data-theme="dark"] .gantt-year-cell,
:root[data-theme="dark"] .gantt-month-cell,
:root[data-theme="dark"] .gantt-month {
  color: #b8cef0 !important;
  border-color: #233657 !important;
}
:root[data-theme="dark"] .gantt-rows {
  background: #0e182a !important;
}
:root[data-theme="dark"] .gantt-row {
  background: #0e182a !important;
  border-bottom-color: #1c2d4a !important;
  color: #e2ecff !important;
}
:root[data-theme="dark"] .gantt-row:hover {
  background: #152440 !important;
}
:root[data-theme="dark"] .gantt-row .gantt-label {
  background: inherit !important;
  color: #e2ecff !important;
  border-right-color: #1f3150 !important;
}
:root[data-theme="dark"] .gantt-row.gantt-group.depth-0,
:root[data-theme="dark"] .gantt-row.gantt-group.depth-0 .gantt-label {
  background: #18315c !important;
  color: #ffffff !important;
}
:root[data-theme="dark"] .gantt-row.gantt-group.depth-1,
:root[data-theme="dark"] .gantt-row.gantt-group.depth-1 .gantt-label {
  background: #1d284d !important;
  color: #c4b5fd !important;
}
:root[data-theme="dark"] .gantt-grid-line {
  background: rgba(148, 163, 184, .12) !important;
  border-color: rgba(148, 163, 184, .12) !important;
}
:root[data-theme="dark"] .gantt-today-line {
  border-left-color: #60a5fa !important;
}
:root[data-theme="dark"] .gantt-today-line span,
:root[data-theme="dark"] .gantt-today-flag span {
  background: #2563eb !important;
  color: #ffffff !important;
}
:root[data-theme="dark"] .gantt-empty {
  background: #111c30 !important;
  border-color: #2a4066 !important;
  color: #9cb3d6 !important;
}
/* Materiales / Mano de obra / Equipo: desplegable de conceptos */
:root[data-theme="dark"] .usos-count {
  background: #172742 !important;
  color: #93c5fd !important;
  border-color: #2b436b !important;
}
:root[data-theme="dark"] .usos-list {
  background: #111d33 !important;
  border-color: #284069 !important;
  color: #dbeafe !important;
  box-shadow: 0 12px 28px rgba(2, 6, 23, .55) !important;
}
:root[data-theme="dark"] .usos-list li {
  color: #dbeafe !important;
  border-color: #1f3150 !important;
}
/* FASAR y cuadrillas: barra de resumen */
:root[data-theme="dark"] .fasar-result-box {
  background: #132138 !important;
  border-color: #263d63 !important;
}
:root[data-theme="dark"] .fasar-result-box span {
  color: #9cb3d6 !important;
}
:root[data-theme="dark"] .fasar-result-box strong {
  color: #f1f5f9 !important;
}
:root[data-theme="dark"] .fasar-total-cell strong {
  color: #60a5fa !important;
}
/* Revisión del presupuesto: distinguir Crítico (rojo) vs Aviso (ámbar) */
:root[data-theme="dark"] .review-sev-critico {
  background: rgba(239, 68, 68, .18) !important;
  color: #fca5a5 !important;
  border-color: rgba(248, 113, 113, .45) !important;
}
:root[data-theme="dark"] .review-sev-aviso,
:root[data-theme="dark"] .review-sev-revisar {
  background: rgba(245, 158, 11, .18) !important;
  color: #fde68a !important;
  border-color: rgba(251, 191, 36, .45) !important;
}


/* =========================================================================
   r77: AUDITORÍA EXHAUSTIVA MODO NOCHE — 100% cobertura de componentes UI
   ========================================================================= */
:root[data-theme="dark"] {
  --surface: #111c30;
  --surface-alt: #16243d;
  --bg: #0b1322;
}
:root[data-theme="dark"] .skip { background: #16243d; color: #f8fafc; }
:root[data-theme="dark"] .row-tools > button,
:root[data-theme="dark"] .budget .row-tools > button,
:root[data-theme="dark"] .group .button {
  background: #16243d !important;
  color: #e4eeff !important;
  border-color: #2b4268 !important;
}
:root[data-theme="dark"] .row-tools > button:hover,
:root[data-theme="dark"] .budget .row-tools > button:hover {
  background: #1d3052 !important;
  border-color: #4f8cff !important;
  color: #ffffff !important;
}
/* Filas de partida / etapa en Tabla de presupuesto y Plantillas */
:root[data-theme="dark"] .budget .group th,
:root[data-theme="dark"] .budget .group td {
  background: #162847 !important;
  color: #f1f5f9 !important;
  border-color: #263f6b !important;
}
:root[data-theme="dark"] .budget .group.depth-1 th,
:root[data-theme="dark"] .budget .group.depth-1 td {
  background: #13223b !important;
  color: #dbeafe !important;
  border-color: #22385e !important;
}
:root[data-theme="dark"] .budget .group .collapse,
:root[data-theme="dark"] .budget .group button {
  color: #e2ecff !important;
}
:root[data-theme="dark"] .budget tfoot tr.foot-sub th,
:root[data-theme="dark"] .budget tfoot tr.foot-sub td,
:root[data-theme="dark"] tfoot tr.foot-breakdown th,
:root[data-theme="dark"] tfoot tr.foot-breakdown td {
  background: #111d33 !important;
  color: #dbeafe !important;
  border-color: #223556 !important;
}
:root[data-theme="dark"] tr.just-added td {
  background: rgba(16, 185, 129, .18) !important;
}
/* Modales de bienvenida, guía y Ayuda e información */
:root[data-theme="dark"] dialog.cota-guide-dialog {
  background: #111c30 !important;
  color: #eaf2ff !important;
  border: 1px solid #263d63 !important;
}
:root[data-theme="dark"] .cota-welcome-feat,
:root[data-theme="dark"] .cota-about-tile {
  background: #16243d !important;
  border-color: #2a4169 !important;
  color: #eaf2ff !important;
}
:root[data-theme="dark"] .cota-about-tile:hover {
  background: #1d3154 !important;
  border-color: #4f8cff !important;
}
:root[data-theme="dark"] .cota-about-tile strong,
:root[data-theme="dark"] .cota-welcome-feat strong {
  color: #f8fafc !important;
}
:root[data-theme="dark"] .cota-about-tile span,
:root[data-theme="dark"] .cota-welcome-feat span {
  color: #b6c8e4 !important;
}
:root[data-theme="dark"] .cota-about-keys kbd {
  background: #182946 !important;
  border-color: #324c78 !important;
  color: #e2ecff !important;
}
/* Perfil, licencia y marco legal */
:root[data-theme="dark"] .cota-atab.active {
  background: #1d3359 !important;
  color: #ffffff !important;
}
:root[data-theme="dark"] .cota-legal-body,
:root[data-theme="dark"] .cota-lic-box {
  background: #0e182b !important;
  border-color: #253b60 !important;
  color: #dce8fa !important;
}
:root[data-theme="dark"] .cota-lic-pill.ok {
  background: rgba(16, 185, 129, .18) !important;
  color: #6ee7b7 !important;
  border-color: rgba(16, 185, 129, .38) !important;
}
:root[data-theme="dark"] .cota-lic-pill.warn {
  background: rgba(245, 158, 11, .18) !important;
  color: #fde68a !important;
  border-color: rgba(245, 158, 11, .38) !important;
}
/* Chips de estado, uso, búsqueda predictiva y catálogos */
:root[data-theme="dark"] .template-image .tag {
  background: rgba(15, 23, 42, .85) !important;
  color: #e2ecff !important;
  border-color: rgba(148, 163, 184, .3) !important;
}
:root[data-theme="dark"] .tag.active,
:root[data-theme="dark"] .tag.tag-activo {
  background: rgba(16, 185, 129, .18) !important;
  color: #6ee7b7 !important;
  border-color: rgba(16, 185, 129, .38) !important;
}
:root[data-theme="dark"] .tag.tag-activo-orange {
  background: rgba(249, 115, 22, .18) !important;
  color: #fdba74 !important;
  border-color: rgba(249, 115, 22, .4) !important;
}
:root[data-theme="dark"] .tag.tag-inactivo {
  background: rgba(239, 68, 68, .18) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, .4) !important;
}
:root[data-theme="dark"] .uso-chip {
  background: #172742 !important;
  color: #cfe2ff !important;
  border-color: #2b436b !important;
}
:root[data-theme="dark"] .predict-chip {
  background: #162642 !important;
  color: #93c5fd !important;
  border-color: #2a436e !important;
}
:root[data-theme="dark"] .predict-chip:hover {
  background: #2563eb !important;
  color: #ffffff !important;
}
/* Programa de obra (píldoras de estado) */
:root[data-theme="dark"] .prog-pill {
  background: #15243e !important;
  color: #dbeafe !important;
  border-color: #294169 !important;
}
:root[data-theme="dark"] .prog-pill.st-empty {
  background: #142645 !important;
  color: #93c5fd !important;
}
:root[data-theme="dark"] .prog-pill.st-completado {
  background: rgba(16, 185, 129, .18) !important;
  color: #6ee7b7 !important;
}
:root[data-theme="dark"] .prog-pill.st-en-curso {
  background: rgba(245, 158, 11, .18) !important;
  color: #fde68a !important;
}
:root[data-theme="dark"] .prog-pill.st-por-iniciar {
  background: rgba(239, 68, 68, .18) !important;
  color: #fca5a5 !important;
}
/* Editor APU, campos solo lectura, Catálogo maestro y Prorrateo */
:root[data-theme="dark"] input[readonly],
:root[data-theme="dark"] .computed,
:root[data-theme="dark"] .cost-box {
  background: #132138 !important;
  color: #e2ecff !important;
  border-color: #263d63 !important;
}
:root[data-theme="dark"] .catalog2023-warning {
  background: rgba(245, 158, 11, .14) !important;
  color: #fde68a !important;
  border-color: rgba(245, 158, 11, .35) !important;
}
:root[data-theme="dark"] .master-related th {
  background: #162642 !important;
  color: #93c5fd !important;
}
:root[data-theme="dark"] .source-rows .source-row-selected {
  background: rgba(16, 185, 129, .16) !important;
}
:root[data-theme="dark"] .prorrateo-panel,
:root[data-theme="dark"] .clean-details .skipped-table {
  background: #111c30 !important;
  color: #e8f0ff !important;
  border-color: #233657 !important;
}
:root[data-theme="dark"] .prorrateo-table-head,
:root[data-theme="dark"] .clean-details,
:root[data-theme="dark"] .cmdk-foot {
  background: #14223a !important;
  color: #cbd5e1 !important;
  border-color: #233657 !important;
}
:root[data-theme="dark"] .prorrateo-orig-banner,
:root[data-theme="dark"] .prorrateo-notice.warn {
  background: rgba(245, 158, 11, .14) !important;
  color: #fde68a !important;
  border-color: rgba(245, 158, 11, .35) !important;
}
:root[data-theme="dark"] .prorrateo-notice {
  background: rgba(37, 99, 235, .16) !important;
  color: #bfdbfe !important;
  border-color: rgba(59, 130, 246, .35) !important;
}
:root[data-theme="dark"] .prorrateo-kpis .kpi-diff-down,
:root[data-theme="dark"] .price-ok-banner {
  background: rgba(16, 185, 129, .16) !important;
  color: #6ee7b7 !important;
  border-color: rgba(16, 185, 129, .35) !important;
}
:root[data-theme="dark"] .prorrateo-kpis .kpi-diff-up {
  background: rgba(239, 68, 68, .16) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, .35) !important;
}
:root[data-theme="dark"] .preset-chip {
  background: #15243e !important;
  color: #dbeafe !important;
  border-color: #2a4169 !important;
}
:root[data-theme="dark"] .preset-chip:hover,
:root[data-theme="dark"] .review-chip:hover,
:root[data-theme="dark"] .import-dropzone:hover,
:root[data-theme="dark"] .drag-handle:hover,
:root[data-theme="dark"] .drag-ghost-key,
:root[data-theme="dark"] .budget-search-count {
  background: #1c3257 !important;
  color: #ffffff !important;
  border-color: #4f8cff !important;
}
/* Mi empresa y portadas de proyecto */
:root[data-theme="dark"] .empresa-logo-box,
:root[data-theme="dark"] .project-img-picker,
:root[data-theme="dark"] .project-img-preview {
  background: #0e182b !important;
  border-color: #284069 !important;
  color: #b6c8e4 !important;
}
:root[data-theme="dark"] .file-btn,
:root[data-theme="dark"] .project-img-controls .file-btn {
  background: #162642 !important;
  border-color: #2b436b !important;
  color: #dbeafe !important;
}
:root[data-theme="dark"] .file-btn:hover,
:root[data-theme="dark"] .project-img-controls .file-btn:hover,
:root[data-theme="dark"] .project-cover .cover-edit-btn:hover {
  background: #1f355c !important;
  border-color: #4f8cff !important;
  color: #ffffff !important;
}
:root[data-theme="dark"] .matrix-comp-bar {
  background: #1e2f4d !important;
}


/* =========================================================================
   r78: SISTEMA DE DISEÑO PREMIUM & MICRO-ANIMACIONES (MODO DÍA Y MODO NOCHE)
   ========================================================================= */

/* 1. Tipografía nítida y alineación tabular financiera en todo el software */
html, body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
td.number, th.number, .inline-qty, .kpi-chip strong, .matrix-kpi strong,
.fasar-result-box strong, .summary td, .budget td:nth-child(3),
.budget td:nth-child(4), .budget td:nth-child(5), .budget td:nth-child(6),
.budget tfoot td, .doc-table td {
  font-variant-numeric: tabular-nums;
}

/* 2. Barras de desplazamiento estilizadas (WebView2 / Chromium) */
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(20, 37, 62, 0.20);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
  transition: background-color 160ms ease;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(20, 37, 62, 0.38);
  border: 2px solid transparent;
  background-clip: content-box;
}
:root[data-theme="dark"] *::-webkit-scrollbar-thumb {
  background: rgba(148, 184, 238, 0.22);
  border: 2px solid transparent;
  background-clip: content-box;
}
:root[data-theme="dark"] *::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 184, 238, 0.42);
  border: 2px solid transparent;
  background-clip: content-box;
}

/* 3. Elevación, radios refinados y profundidad en Modo Día y Modo Noche */
.card {
  border-radius: 11px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.035);
  transition: border-color 180ms ease, box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1), transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
:root[data-theme="dark"] .card {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 6px 20px rgba(2, 6, 23, 0.36);
}
.project.card:hover,
.template.card:hover {
  transform: translateY(-2px);
  border-color: #b4c8e6;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06), 0 12px 28px rgba(23, 76, 167, 0.09);
}
:root[data-theme="dark"] .project.card:hover,
:root[data-theme="dark"] .template.card:hover {
  border-color: #36568a;
  box-shadow: inset 0 1px 0 rgba(148, 197, 255, 0.12), 0 12px 30px rgba(2, 6, 23, 0.55);
}
.project-cover img,
.template-image img {
  transition: transform 340ms cubic-bezier(0.22, 1, 0.36, 1);
}
.project.card:hover .project-cover img,
.template.card:hover .template-image img {
  transform: scale(1.03);
}

/* 4. Encabezado pegajoso con cristal sutil en Modo Día */
.page-head {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.topbar {
  border-bottom: 1px solid rgba(148, 197, 255, 0.10);
  box-shadow: 0 2px 12px rgba(5, 12, 26, 0.18);
}
.sidebar {
  border-right: 1px solid rgba(148, 197, 255, 0.09);
}

/* 5. Navegación lateral: micro-interacción profesional */
.sidebar nav a {
  border-radius: 9px;
  transition: background 160ms ease, color 160ms ease, transform 160ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 160ms ease;
}
.sidebar nav a:hover {
  transform: translateX(2px);
}
.sidebar nav a:hover .nav-icon {
  transform: scale(1.05);
  border-color: rgba(140, 179, 255, 0.28);
}
.nav-icon {
  transition: background 160ms ease, border-color 160ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.sidebar nav a[aria-current] {
  box-shadow: inset 3px 0 0 #74b4ff, 0 2px 10px rgba(8, 20, 42, 0.25);
}

/* 6. Botones táctiles, botones primarios con brillo sutil e inputs limpios */
.button,
.row-tools > button {
  border-radius: 8px;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 160ms ease, transform 120ms cubic-bezier(0.22, 1, 0.36, 1);
}
.button:active,
.row-tools > button:active {
  transform: translateY(1px) scale(0.985);
}
.button.primary {
  background: linear-gradient(180deg, #1d5bc4 0%, #154599 100%);
  border-color: #14418f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 3px rgba(17, 59, 132, 0.24);
}
.button.primary:hover {
  background: linear-gradient(180deg, #2166d9 0%, #174ca7 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 12px rgba(23, 76, 167, 0.30);
}
:root[data-theme="dark"] .button.primary {
  background: linear-gradient(180deg, #1d56c4 0%, #16449e 100%);
  border-color: #3b76e8;
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 10px rgba(22, 68, 158, 0.42);
}
:root[data-theme="dark"] .button.primary:hover {
  background: linear-gradient(180deg, #2160d6 0%, #184db2 100%);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 6px 16px rgba(33, 96, 214, 0.48);
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  border-radius: 8px;
  transition: border-color 150ms ease, box-shadow 160ms ease, background-color 150ms ease;
}
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}
:root[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):focus,
:root[data-theme="dark"] select:focus,
:root[data-theme="dark"] textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
}

/* 7. Controles segmentados (.view-switcher) y tablas refinadas */
.view-switcher {
  border-radius: 10px;
  padding: 3px;
}
.view-pill {
  border-radius: 7px;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.view-pill.active {
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.10);
}
tbody tr {
  transition: background-color 120ms ease;
}

/* 8. Modales y diálogos con entrada cinematográfica y fondo desenfocado */
@keyframes cotaBackdropFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes cotaModalSpring {
  from { opacity: 0; transform: translateY(10px) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
dialog[open] {
  border-radius: 14px;
  animation: cotaModalSpring 210ms cubic-bezier(0.16, 1, 0.3, 1) both;
  box-shadow: 0 24px 64px rgba(10, 22, 46, 0.26), 0 4px 16px rgba(10, 22, 46, 0.10);
}
:root[data-theme="dark"] dialog[open] {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 28px 72px rgba(2, 6, 23, 0.72);
}
dialog::backdrop {
  background: rgba(9, 19, 38, 0.48);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: cotaBackdropFade 180ms ease-out both;
}

/* 9. Respeto estricto a usuarios con movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  .card, .project.card:hover, .template.card:hover, .project-cover img,
  .template-image img, .sidebar nav a, .nav-icon, .button, .row-tools > button,
  dialog[open], dialog::backdrop {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

/* r79 (#13): Seguridad de altura en laptops 1366x768 con escala 125%-150% */
@media (max-height: 820px), (max-width: 1400px) {
  dialog[open]:not(#presupuesto-documento) {
    max-height: 92vh;
    overflow-y: auto;
  }
  .topbar {
    gap: 8px;
    padding-inline: 16px;
  }
}

/* r86 (#39): Marca de agua BORRADOR en vista previa e impresión PDF */
.doc-sheet.is-draft { position: relative; overflow: hidden; }
.doc-watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 4;
  font-size: 86px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: rgba(220, 38, 38, 0.11);
  transform: rotate(-32deg);
  user-select: none;
}

/* r86 (#71): Modalidad Precio Alzado (oculta columna P. U. MXN en PDF Cliente) */
.doc-sheet.doc-hide-pu .doc-table th:nth-child(4),
.doc-sheet.doc-hide-pu .doc-table td:nth-child(4) { display: none; }

/* r86 (#96): Modo de densidad compacta en tabla de presupuesto */
body.cota-dense .budget th,
body.cota-dense .budget td { padding-top: 5px; padding-bottom: 5px; font-size: 12.5px; }
body.cota-dense .budget .inline-qty { padding: 3px 6px; min-height: 26px; }

/* r87 (#109): Chips rápidos de desperdicio e inverso de rendimiento en Editor APU */
.apu-quick-math { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.apu-quick-math button { font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border, #cbd5e1); background: var(--surface-2, #f8fafc); color: var(--text-muted, #475569); cursor: pointer; font-weight: 600; }
.apu-quick-math button:hover { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); }

/* r88 (B3): Estilos completos claro/oscuro para .cota-expiry-pill y .apu-quick-math */
.cota-expiry-pill { background: #fef3c7; color: #92410e; border: 1px solid #f59e0b; border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 600; cursor: pointer; margin-right: 6px; }
:root[data-theme="dark"] .cota-expiry-pill { background: rgba(245, 158, 11, 0.18); color: #fcd34d; border-color: rgba(245, 158, 11, 0.55); }
:root[data-theme="dark"] .apu-quick-math button { background: #16233b; border-color: #2b4166; color: #cbd5e1; }
:root[data-theme="dark"] .apu-quick-math button:hover { border-color: #60a5fa; color: #93c5fd; background: #1e3152; }

/* r92 (#128): Modales seguros en pantallas de baja altura (768px) con pie accesible */
dialog[open] { max-height: calc(100dvh / var(--cota-zoom, 1) - 24px); overflow-y: auto; }
dialog .dialog-actions, dialog menu.actions { position: sticky; bottom: 0; background: inherit; z-index: 4; padding-top: 10px; }

/* === COTA 2026 · ONBOARDING 3 PASOS EN PRESUPUESTO VACÍO === */
.empty-budget-steps {
  list-style: none;
  margin: 8px 0 10px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(760px, 100%);
  text-align: left;
}
.empty-budget-steps li {
  background: #f5f8fe;
  border: 1px solid #d5e0f0;
  border-radius: 10px;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
}
.empty-budget-steps li strong { color: #16479c; font-size: 0.94rem; }
.empty-budget-steps li span { color: var(--muted); font-size: 0.85rem; line-height: 1.38; }
@media (max-width: 780px) {
  .empty-budget-steps { grid-template-columns: 1fr; }
}
:root[data-theme="dark"] .empty-budget-steps li {
  background: #132138;
  border-color: #294169;
}
:root[data-theme="dark"] .empty-budget-steps li strong { color: #93c5fd; }
:root[data-theme="dark"] .empty-budget-steps li span { color: #9db0d1; }
/* === Multi-catálogo regional (SOBSE CDMX 2026 y fuentes oficiales) === */
.master-filters [data-master-sources] {
  display: contents;
}
.master-badge-tabulador {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.28);
}
[data-theme="dark"] .master-badge-tabulador {
  background: rgba(96, 165, 250, 0.16);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.35);
}
.master-redirect-banner {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.25);
  color: var(--ink, #0f172a);
}
[data-theme="dark"] .master-redirect-banner {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(96, 165, 250, 0.32);
  color: #e2e8f0;
}
/* === COTA 2026 · COSTOS PARAMÉTRICOS (MODO DÍA Y NOCHE) === */
.param-tabs-bar { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:14px; }
.param-band-grid { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:12px; margin:12px 0; }
.param-band-card { padding:14px 16px; border-radius:12px; border:1px solid var(--line, #dbe3ef); background:var(--surface-alt, #f8fafc); display:flex; flex-direction:column; gap:4px; }
.param-band-card small { font-size:11.5px; color:var(--muted, #64748b); font-weight:600; text-transform:uppercase; letter-spacing:.03em; }
.param-band-card strong { font-size:22px; font-weight:700; color:var(--ink, #0f172a); }
.param-band-card span { font-size:12px; color:var(--muted, #475569); }
.param-band-card.is-base { border-color:#1d4ed8; background:rgba(29,78,216,0.07); box-shadow:0 4px 14px rgba(29,78,216,0.10); }
.param-band-card.is-base strong { color:#1d4ed8; }
.param-kpis-mini { display:flex; flex-wrap:wrap; gap:14px; font-size:12.5px; padding:8px 12px; border-radius:8px; background:var(--surface-alt, #f1f5f9); margin-bottom:16px; color:var(--ink, #1e293b); }
.param-layout { display:grid; grid-template-columns:minmax(0,1.05fr) minmax(0,1fr); gap:20px; align-items:start; }
.param-controls h3, .param-results h3 { font-size:14px; margin:14px 0 8px; color:var(--ink, #0f172a); }
.param-controls h3:first-child, .param-results h3:first-child { margin-top:0; }
.param-total-row th { background:rgba(29,78,216,0.08); font-weight:700; }
.param-comp-list { display:flex; flex-direction:column; gap:6px; margin-bottom:14px; }
.param-comp-row { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:7px 10px; border-radius:8px; border:1px solid var(--line, #e2e8f0); font-size:12.5px; }
.param-comp-row.is-on { border-color:#1d4ed8; background:rgba(29,78,216,0.05); }
.param-comp-inputs { display:flex; align-items:center; gap:5px; flex-shrink:0; }
.param-comp-inputs input { width:76px; padding:4px 6px; font-size:12px; }
.param-summary-box { border:1px solid var(--line, #dbe3ef); border-radius:10px; padding:12px 14px; display:flex; flex-direction:column; gap:6px; background:var(--surface-alt, #f8fafc); font-size:13px; }
.param-summary-box > div { display:flex; justify-content:space-between; gap:12px; }
.param-summary-box > div.is-grand { border-top:1px solid var(--line, #cbd5e1); padding-top:8px; margin-top:4px; font-size:15px; color:#1d4ed8; }
:root[data-theme="dark"] .param-band-card { background:#162033; border-color:#2b3a55; }
:root[data-theme="dark"] .param-band-card strong { color:#f1f5f9; }
:root[data-theme="dark"] .param-band-card.is-base { background:rgba(59,130,246,0.16); border-color:#60a5fa; }
:root[data-theme="dark"] .param-band-card.is-base strong { color:#93c5fd; }
:root[data-theme="dark"] .param-kpis-mini, :root[data-theme="dark"] .param-summary-box { background:#162033; border-color:#2b3a55; color:#e2e8f0; }
:root[data-theme="dark"] .param-comp-row { border-color:#2b3a55; }
:root[data-theme="dark"] .param-comp-row.is-on { border-color:#60a5fa; background:rgba(59,130,246,0.14); }
:root[data-theme="dark"] .param-summary-box > div.is-grand { color:#93c5fd; border-top-color:#334155; }
@media (max-width: 1020px) { .param-layout, .param-band-grid { grid-template-columns:1fr; } }
.doc-sheet .param-band-grid { display:grid !important; grid-template-columns:repeat(3, minmax(0,1fr)) !important; gap:10px; margin:8px 0 10px; }
.doc-sheet .param-band-card { padding:9px 11px; border-radius:9px; gap:2px; background:#f8fafc !important; border-color:#cbd5e1 !important; color:#0f172a !important; }
.doc-sheet .param-band-card small { font-size:9.5px; color:#475569 !important; }
.doc-sheet .param-band-card strong { font-size:15.5px; color:#0f172a !important; }
.doc-sheet .param-band-card span { font-size:9.8px; color:#475569 !important; }
.doc-sheet .param-band-card.is-base { background:#eff6ff !important; border-color:#174ca7 !important; box-shadow:none; }
.doc-sheet .param-band-card.is-base strong { color:#174ca7 !important; }
/* === COTA 2026 · ESTIMACIONES DE OBRA === */
.est-table tr.est-row-over { background:rgba(220,38,38,0.08); }
.est-table tr.est-row-over th small { color:#b91c1c; font-weight:600; }
:root[data-theme="dark"] .est-table tr.est-row-over { background:rgba(248,113,113,0.14); }
:root[data-theme="dark"] .est-table tr.est-row-over th small { color:#fca5a5; }
/* === COTA 2026 · HOJAS DE GENERADORES DE OBRA === */
.gen-table tr.gen-row-deduct { background:rgba(217,119,6,0.09); }
.gen-table input, .gen-table select { padding:4px 6px; font-size:12.5px; }
:root[data-theme="dark"] .gen-table tr.gen-row-deduct { background:rgba(245,158,11,0.16); }

/* === COTA 2026 · Firmas PDF seguras, margen inferior y Visor interactivo de Tarjetas APU === */
.caratula-sheet { padding-bottom: 58px; overflow: hidden; }
.caratula-firmas { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 36px; padding-top: 26px; padding-bottom: 6px; break-inside: avoid; page-break-inside: avoid; }
.caratula-firmas .firma-col { text-align: center; font-size: 11px; line-height: 1.3; }
.caratula-firmas .firma-line { border-top: 1px solid #334155; margin: 0 14px 7px; }
.caratula-firmas .firma-col strong, .caratula-firmas .firma-col small { display: block; }
.caratula-firmas .firma-col small { color: #526077; font-size: 10.5px; margin-top: 2px; }
.caratula-sheet.caratula-compact { gap: 8px; padding-top: 28px; padding-bottom: 46px; }
.caratula-sheet.caratula-compact .caratula-top { padding-bottom: 7px; }
.caratula-sheet.caratula-compact .caratula-title-block h1 { font-size: 18.5px; margin-bottom: 4px; }
.caratula-sheet.caratula-compact .caratula-desc { font-size: 10.5px; margin-bottom: 6px; }
.caratula-sheet.caratula-compact .caratula-meta { padding: 7px 10px; gap: 4px 10px; }
.caratula-sheet.caratula-compact .caratula-render { min-height: 115px; max-height: 142px; }
.caratula-sheet.caratula-compact .caratula-table th,
.caratula-sheet.caratula-compact .caratula-table td { padding: 2.5px 6px; font-size: 9.8px; }
.caratula-sheet.caratula-compact .caratula-total-box { padding: 8px 12px; }
.caratula-sheet.caratula-compact .caratula-tot-main strong { font-size: 15.5px; }
.caratula-sheet.caratula-compact .caratula-notas { padding: 5px 8px; font-size: 9.8px; }
.caratula-sheet.caratula-compact .caratula-firmas { padding-top: 14px; padding-bottom: 4px; }
.caratula-sheet.caratula-ultra { gap: 5px; padding: 22px 38px 34px; }
.caratula-sheet.caratula-ultra .caratula-top { padding-bottom: 5px; }
.caratula-sheet.caratula-ultra .caratula-brand img { max-height: 36px; }
.caratula-sheet.caratula-ultra .caratula-brand strong { font-size: 13.5px; }
.caratula-sheet.caratula-ultra .caratula-brand small { font-size: 10px; }
.caratula-sheet.caratula-ultra .caratula-hero { gap: 10px; }
.caratula-sheet.caratula-ultra .caratula-title-block h1 { font-size: 16.5px; margin-bottom: 2px; }
.caratula-sheet.caratula-ultra .caratula-desc { font-size: 9.8px; margin-bottom: 4px; }
.caratula-sheet.caratula-ultra .caratula-meta { padding: 5px 8px; gap: 3px 8px; }
.caratula-sheet.caratula-ultra .caratula-meta dt { font-size: 8.8px; }
.caratula-sheet.caratula-ultra .caratula-meta dd { font-size: 10.3px; }
.caratula-sheet.caratula-ultra .caratula-render { min-height: 96px; max-height: 118px; }
.caratula-sheet.caratula-ultra .caratula-etapas h3,
.caratula-sheet.caratula-ultra .caratula-pagos h3 { font-size: 10.5px; margin: 0 0 3px; }
.caratula-sheet.caratula-ultra .caratula-table th,
.caratula-sheet.caratula-ultra .caratula-table td { padding: 1.8px 5px; font-size: 9.2px; line-height: 1.2; }
.caratula-sheet.caratula-ultra .caratula-total-box { padding: 6px 10px; }
.caratula-sheet.caratula-ultra .caratula-tot-grid span { font-size: 9.5px; }
.caratula-sheet.caratula-ultra .caratula-tot-grid strong { font-size: 12.5px; }
.caratula-sheet.caratula-ultra .caratula-tot-main strong { font-size: 14.5px; }
.caratula-sheet.caratula-ultra .caratula-letra { margin-top: 4px; padding-top: 4px; font-size: 9.3px; }
.caratula-sheet.caratula-ultra .caratula-notas { padding: 4px 8px; font-size: 9.2px; }
.caratula-sheet.caratula-ultra .caratula-firmas { padding-top: 14px; padding-bottom: 2px; gap: 32px; }
.caratula-continuacion .caratula-cont-body { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.doc-sign-sheet .doc-notes-sign { margin-top: 10px; border-top: 0; padding-top: 4px; }

.row-card-btn { padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface, #fff); color: var(--brand, #174ca7); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.row-card-btn:hover { background: var(--brand-soft, #e8f0fe); border-color: var(--brand, #174ca7); }

dialog.apu-viewer-dialog { width: min(1180px, 96vw); max-width: 96vw; height: 90vh; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--bg, #f6f8fb); color: var(--ink, #171b19); overflow: hidden; box-shadow: 0 24px 60px rgba(15, 23, 42, .28); }
dialog.apu-viewer-dialog::backdrop { background: rgba(15, 23, 42, .55); backdrop-filter: blur(2px); }
.apu-viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface, #fff); flex-wrap: wrap; }
.apu-viewer-title-wrap { display: flex; align-items: baseline; gap: 10px; }
.apu-viewer-title-wrap h2 { margin: 0; font-size: 1.05rem; }
.apu-viewer-count { font-size: 12px; color: var(--muted); font-weight: 600; }
.apu-viewer-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.apu-viewer-filters { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface, #fff); flex-wrap: wrap; }
.apu-viewer-search { flex: 1 1 240px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg, #f8fafc); color: var(--ink); font-size: 13px; }
.apu-viewer-select { flex: 0 1 240px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg, #f8fafc); color: var(--ink); font-size: 13px; }
.apu-viewer-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); cursor: pointer; user-select: none; }
.apu-viewer-layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); height: calc(100% - 114px); }
.apu-viewer-sidebar { overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface, #fff); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.apu-viewer-item { width: 100%; text-align: left; padding: 9px 10px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.apu-viewer-item:hover { background: var(--bg, #f1f5f9); border-color: var(--line); }
.apu-viewer-item.is-active { background: var(--brand-soft, #e8f0fe); border-color: var(--brand, #174ca7); }
.apu-item-top { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
.apu-item-top strong { color: var(--brand, #174ca7); }
.apu-item-name { font-size: 12.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.apu-item-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.apu-item-meta strong { color: var(--ink); }
.apu-viewer-stage { grid-column: 2; grid-row: 1; overflow-y: auto; padding: 18px 22px; background: var(--bg, #eef2f7); align-self: stretch; }
.apu-viewer-card-wrap { max-width: 820px; margin: 0 auto; background: #ffffff; color: #171b19; border-radius: 12px; padding: 18px 20px; box-shadow: 0 4px 18px rgba(15, 23, 42, .08); }
.apu-viewer-empty { padding: 48px 20px; text-align: center; color: var(--muted); }
:root[data-theme="dark"] .apu-viewer-card-wrap { background: #141b24; color: #e6edf3; border: 1px solid #283546; }
:root[data-theme="dark"] .apu-viewer-card-wrap .apu-card,
:root[data-theme="dark"] .apu-viewer-card-wrap .apu-table th,
:root[data-theme="dark"] .apu-viewer-card-wrap .apu-table td { border-color: #283546; color: #e6edf3; }
:root[data-theme="dark"] .apu-viewer-card-wrap .apu-cat th,
:root[data-theme="dark"] .apu-viewer-card-wrap .apu-cat td { background: #1c2735; color: #c7d9fb; }
:root[data-theme="dark"] .apu-viewer-card-wrap .apu-totals { background: #1a2431; border-color: #283546; }
:root[data-theme="dark"] .row-card-btn { background: #1a2431; color: #93c5fd; border-color: #2e3f55; }
@media (max-width: 820px) {
  .apu-viewer-layout { grid-template-columns: 1fr; grid-template-rows: 200px minmax(0, 1fr); }
  .apu-viewer-sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* === COTA 2026 · Importador visual Excel/CSV === */
.import-config { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg, #f8fafc); display: flex; flex-direction: column; gap: 10px; }
.imp-map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 8px 10px; }
.imp-field { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); }
.imp-field select { padding: 5px 8px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface, #fff); color: var(--ink); font-size: 12px; }
.imp-toggles { display: flex; flex-wrap: wrap; gap: 14px; padding-top: 4px; border-top: 1px dashed var(--line); }
.imp-row-partida td { background: var(--brand-soft, #e8f0fe); color: var(--brand, #16479c); font-size: 12px; }
.imp-row-skip td { opacity: .65; font-style: italic; }
:root[data-theme="dark"] .imp-row-partida td { background: #1c2c44; color: #93c5fd; }

/* === COTA 2026 · Órdenes de Cambio y PUE === */
.oc-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.oc-sidebar { padding: 12px; }
.oc-list { display: flex; flex-direction: column; gap: 7px; }
.oc-item { width: 100%; text-align: left; padding: 9px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface, #fff); color: var(--ink); cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.oc-item.is-active { border-color: var(--brand, #174ca7); background: var(--brand-soft, #e8f0fe); }
.oc-item-top, .oc-item-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--muted); }
.oc-item-top strong { color: var(--brand, #174ca7); }
.oc-item-title { font-size: 12.5px; font-weight: 600; }
.oc-badge { display: inline-block; padding: 2px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.oc-borrador { background: #eef2f7; color: #475569; }
.oc-autorizada { background: #e0f2fe; color: #0369a1; }
.oc-aplicada { background: #dcfce7; color: #166534; }
.oc-rechazada { background: #fee2e2; color: #991b1b; }
.oc-t-excedente { background: #fef3c7; color: #92410e; }
.oc-t-deductiva { background: #fee2e2; color: #991b1b; }
.oc-t-pue { background: #e0e7ff; color: #3730a3; }
.oc-meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.oc-meta-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); }
.oc-meta-grid input { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg, #f8fafc); color: var(--ink); font-size: 13px; }
.oc-add-form { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border-radius: 10px; border: 1px dashed var(--line); background: var(--bg, #f8fafc); align-items: center; }
.oc-add-form select, .oc-add-form input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface, #fff); color: var(--ink); font-size: 12.5px; flex: 1 1 130px; }
:root[data-theme="dark"] .oc-item.is-active { background: #1c2c44; border-color: #60a5fa; }
@media (max-width: 900px) {
  .oc-layout { grid-template-columns: 1fr; }
  .oc-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* === COTA 2026 · Control de Obra y Costo Real vs. Presupuestado === */
.co-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.co-bars { display: flex; flex-direction: column; gap: 10px; }
.co-bar-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; margin-bottom: 4px; }
.co-bar-track { height: 9px; border-radius: 999px; background: var(--line, #e2e8f0); overflow: hidden; }
.co-bar-fill { height: 100%; border-radius: 999px; transition: width .25s ease; }
.co-sem-verde { background: #16a34a; }
.co-sem-ambar { background: #d97706; }
.co-sem-rojo { background: #dc2626; }
.co-inline-form, .co-gasto-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.co-inline-form input, .co-gasto-form input, .co-gasto-form select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg, #f8fafc); color: var(--ink); font-size: 12.5px; flex: 1 1 130px; }
.co-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.co-filters input, .co-filters select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg, #f8fafc); color: var(--ink); font-size: 12px; }
@media (max-width: 960px) { .co-grid-2 { grid-template-columns: 1fr; } }

/* === COTA 2026 · R2-001 Hojas PDF de flujo multi-página (Estimaciones, Generadores, Cambios, Control) === */
.doc-sheet-flow { height: auto; min-height: 1056px; padding-bottom: 44px; overflow: visible; }
.doc-sheet-flow .doc-footer { position: static; margin-top: 24px; inset-inline: auto; }
@media print {
  .doc-sheet-flow { height: auto !important; min-height: 0 !important; overflow: visible !important; break-after: auto !important; }
  .doc-sheet-flow thead { display: table-header-group; }
  .doc-sheet-flow tr, .doc-sheet-flow .caratula-firmas, .doc-sheet-flow .doc-sign, .doc-sheet-flow .caratula-total-box { break-inside: avoid; page-break-inside: avoid; }
}

/* === Catálogo Maestro Cota 2026: Checkboxes zonales estéticos y badges por concepto (v2.5.2) === */
.master-zone-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.master-filters .master-zone-group {
  grid-column: 1 / -1;
  order: 10;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding-top: 2px;
}
.master-zone-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.master-zone-checks {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
@media (max-width: 780px) {
  .master-zone-checks { flex-wrap: wrap; white-space: normal; }
}
.master-filters label.zone-check,
.zone-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface, #fff);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.master-filters label.zone-check input[type="checkbox"],
.zone-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-height: 14px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.zone-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.zone-check-centro .zone-dot { background: #2563eb; }
.zone-check-norte .zone-dot { background: #d97706; }
.zone-check-sur .zone-dot { background: #059669; }
.zone-check-centro.is-on { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.zone-check-norte.is-on { background: #fffbeb; border-color: #fcd34d; color: #b45309; }
.zone-check-sur.is-on { background: #ecfdf5; border-color: #6ee7b7; color: #047857; }
.zone-all-btn {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.zone-all-btn:hover, .zone-all-btn.is-active {
  background: #f1f5f9;
  border-style: solid;
  border-color: #94a3b8;
  color: var(--ink);
}
.master-meta-line {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}
.zone-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.5;
  white-space: nowrap;
}
.zone-badge.zone-centro { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.zone-badge.zone-norte { background: #fef3c7; color: #92410e; border: 1px solid #fde68a; }
.zone-badge.zone-sur { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.zone-badge.zone-nacional { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }
.zone-badge.zone-propio { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }

:root[data-theme="dark"] .zone-check { background: #132238; border-color: #263b59; color: #94a3b8; }
:root[data-theme="dark"] .zone-check-centro.is-on { background: rgba(37, 99, 235, 0.22); border-color: #60a5fa; color: #bfdbfe; }
:root[data-theme="dark"] .zone-check-norte.is-on { background: rgba(217, 119, 6, 0.22); border-color: #fbbf24; color: #fde68a; }
:root[data-theme="dark"] .zone-check-sur.is-on { background: rgba(5, 150, 105, 0.22); border-color: #34d399; color: #a7f3d0; }
:root[data-theme="dark"] .zone-all-btn { border-color: #334155; color: #94a3b8; }
:root[data-theme="dark"] .zone-all-btn.is-active { background: #1e293b; border-color: #64748b; color: #f8fafc; }
:root[data-theme="dark"] .zone-badge.zone-centro { background: rgba(37, 99, 235, 0.25); color: #bfdbfe; border-color: #3b82f6; }
:root[data-theme="dark"] .zone-badge.zone-norte { background: rgba(217, 119, 6, 0.25); color: #fde68a; border-color: #f59e0b; }
:root[data-theme="dark"] .zone-badge.zone-sur { background: rgba(5, 150, 105, 0.25); color: #a7f3d0; border-color: #10b981; }
:root[data-theme="dark"] .zone-badge.zone-nacional { background: #1e293b; color: #cbd5e1; border-color: #475569; }
:root[data-theme="dark"] .zone-badge.zone-propio { background: rgba(139, 92, 246, 0.25); color: #ddd6fe; border-color: #8b5cf6; }

/* === Mini-selector zonal inline y en Revisar Ficha (Cota 2026: Norte -> Centro -> Sur) === */
.zone-mini-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface, #fff);
  margin-left: 2px;
}
.zone-mini-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  cursor: pointer;
  line-height: 1.4;
  transition: background 120ms ease, color 120ms ease;
}
.zone-mini-btn:hover { background: #f1f5f9; color: var(--ink); }
.zone-mini-btn.is-active { background: #1e3a8a; color: #ffffff; }
.master-card-zone-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
}
.master-card-zone-bar .zone-mini-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}
:root[data-theme="dark"] .zone-mini-switch { background: #132238; border-color: #263b59; }
:root[data-theme="dark"] .zone-mini-btn { color: #94a3b8; }
:root[data-theme="dark"] .zone-mini-btn:hover { background: #1e3250; color: #f8fafc; }
:root[data-theme="dark"] .zone-mini-btn.is-active { background: #2563eb; color: #ffffff; }
:root[data-theme="dark"] .master-card-zone-bar { background: #132238; border-color: #263b59; color: #e2e8f0; }
:root[data-theme="dark"] .master-card-zone-bar .zone-mini-btn { border-color: #334155; }

/* === Cota 2026 v2.5.2: Badge Editado y campo % Desperdicio en APU === */
.tag.edited {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
}
:root[data-theme="dark"] .tag.edited {
  background: rgba(99, 102, 241, 0.22);
  color: #c7d2fe;
  border-color: rgba(129, 140, 248, 0.4);
}
.apu-desp-row {
  margin-top: 4px;
}
.apu-desp-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}
.apu-desp-label input[type="number"] {
  width: 68px;
  padding: 3px 6px;
  font-size: 12px;
}

/* === Cota 2026 v2.5.2: Destajos (M.O.), Switch MXN/USD y copiado limpio de dígitos en PDF === */
.currency-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.currency-switcher .tc-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 4px;
}
.currency-switcher .tc-inline input {
  width: 64px;
  padding: 3px 6px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
}
.doc-currency-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
}
.destajos-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.dest-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.dest-kpi span { font-size: 11.5px; color: var(--muted); }
.dest-kpi strong { font-size: 14.5px; color: var(--ink); }
.dest-kpi-main { border-color: #93b4e8; background: #eff6ff; }
.dest-kpi-main strong { color: #174ca7; }
.dest-over, .dest-over strong { color: #b91c1c !important; }
.dest-save, .dest-save strong { color: #15803d !important; }
.dest-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.destajo-pu-input.is-neg {
  border-color: #174ca7;
  background: #eff6ff;
  font-weight: 700;
}
.doc-total td {
  white-space: nowrap;
}
:root[data-theme="dark"] .destajos-bar {
  background: #111c30 !important;
  border-color: #233657 !important;
  color: #e8f0ff !important;
}
:root[data-theme="dark"] .dest-kpi {
  background: #0f172a !important;
  border-color: #284069 !important;
  color: #e8f0ff !important;
}
:root[data-theme="dark"] .dest-kpi span {
  color: #cbd5e1 !important;
}
:root[data-theme="dark"] .dest-kpi strong {
  color: #f8fafc !important;
}
:root[data-theme="dark"] .dest-kpi-main {
  background: #172a4a !important;
  border-color: #3b82f6 !important;
}
:root[data-theme="dark"] .dest-kpi-main span {
  color: #dbeafe !important;
}
:root[data-theme="dark"] .dest-kpi-main strong {
  color: #ffffff !important;
}
:root[data-theme="dark"] .dest-actions label.check {
  color: #e8f0ff !important;
}
:root[data-theme="dark"] .dest-over,
:root[data-theme="dark"] .dest-over strong {
  color: #fca5a5 !important;
}
:root[data-theme="dark"] .dest-save,
:root[data-theme="dark"] .dest-save strong {
  color: #86efac !important;
}
:root[data-theme="dark"] .currency-switcher {
  background: #111c30 !important;
  border-color: #284069 !important;
}
:root[data-theme="dark"] .currency-switcher .tc-inline {
  color: #cbd5e1 !important;
}
:root[data-theme="dark"] .currency-switcher .tc-inline input {
  background: #0b1322 !important;
  color: #f8fafc !important;
  border-color: #3b5984 !important;
}
:root[data-theme="dark"] .destajo-pu-input.is-neg {
  background: #172a4a !important;
  border-color: #60a5fa !important;
  color: #f8fafc !important;
}
@media print {
  *, *::before, *::after {
    font-family: Arial, Helvetica, sans-serif !important;
    font-feature-settings: normal !important;
    font-variant-ligatures: none !important;
    font-variant-numeric: normal !important;
  }
}

/* === C04-D1 (v2.5.2): Pestañas APU modo noche, pie sticky real (.dialog-foot) y layout compacto 1366x768 === */
:root[data-theme="dark"] .tabs button {
  background: #132138;
  color: #dbe7ff;
  border-radius: 6px 6px 0 0;
}
:root[data-theme="dark"] .tabs button:hover {
  background: #1a2d4c;
  color: #ffffff;
}
:root[data-theme="dark"] .tabs button[aria-pressed="true"],
:root[data-theme="dark"] .tabs button[aria-pressed=true] {
  background: #1a2d4c;
  color: #93c5fd;
  border-color: #60a5fa;
}
dialog:not(#presupuesto-documento) .dialog-foot,
dialog:not(#presupuesto-documento) .dialog-foot > .actions {
  position: sticky;
  bottom: 0;
  z-index: 6;
  background: var(--white, #ffffff);
  padding-top: 10px;
  padding-bottom: 10px;
  border-top: 1px solid var(--line, #dce4f0);
}
dialog:not(#presupuesto-documento) .actions { position: static; }
:root[data-theme="dark"] dialog:not(#presupuesto-documento) .dialog-foot {
  background: #111c30;
  border-top-color: #243757;
}
/* F-029 / F-036 / F-047: Toast Top-Layer popover, contraste modo oscuro y responsive 721-819px */
.toast[popover] {
  position: fixed;
  inset: auto 20px 20px auto;
  margin: 0;
  border: 0;
}
:root[data-theme="dark"] {
  --surface-soft: #1a2a44;
  --ok-ink: #34d399;
}
:root[data-theme="dark"] .dialog-body label { color: #cbd8ee; }
:root[data-theme="dark"] .form-error { color: #fca5a5; }
:root[data-theme="dark"] .warn-text { color: #fbbf24; }
:root[data-theme="dark"] .item-key { color: #94a8c7; }
:root[data-theme="dark"] .catalog2023-warning ul,
:root[data-theme="dark"] .draft-notice ul { background: rgba(15, 23, 42, 0.72); color: #e2e8f0; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (min-width: 721px) and (max-width: 819px) {
  .sidebar { position: sticky; top: 0; }
}
@media (max-height: 700px) {
  body { grid-template-rows: 46px 1fr; }
  main { padding: 10px 14px 18px; }
  .page-head { margin-bottom: 6px; gap: 6px 10px; }
  .page-head h1 { font-size: 19px; line-height: 1.18; }
  .page-head p { margin-top: 1px; font-size: 12px; }
  .page-head .actions { gap: 5px; }
  .page-head .actions .button { min-height: 30px; padding: 3px 9px; font-size: 12px; }
  .budget-viewbar, .budget-footbar {
    padding: 6px 9px;
    gap: 5px 8px;
    margin-bottom: 6px;
  }
  .budget-viewbar .view-pill { padding: 3px 9px; font-size: 11.5px; }
  .budget-viewbar .currency-switcher { padding: 2px 5px; }
  .budget-viewbar .currency-switcher .tc-inline input {
    width: 52px;
    min-height: 26px;
    padding: 2px 5px;
    font-size: 11.5px;
  }
  .budget-viewbar .fsc-badge { padding: 3px 8px; font-size: 11px; }
  .destajos-bar {
    padding: 6px 10px;
    gap: 6px 8px;
    margin-bottom: 6px;
  }
  .dest-kpi {
    padding: 3px 7px;
  }
  .dest-kpi span { font-size: 10px; }
  .dest-kpi strong { font-size: 12px; }
  .dest-actions {
    gap: 5px;
  }
  .dest-actions .button {
    min-height: 30px;
    padding: 4px 9px;
    font-size: 11.5px;
  }
  dialog {
    max-height: 94vh;
  }
}


/* === COTA 2026 v2.5.2 · MÓDULO DE HONORARIOS DE DISEÑO === */
.hon-method-box { margin: 8px 0 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line, #dbe3ef); background: var(--surface-alt, #f8fafc); }
.hon-stages-list { display: flex; flex-direction: column; gap: 10px; }
.hon-stage-card { border: 1px solid var(--line, #dbe3ef); border-radius: 10px; padding: 10px 12px; background: var(--surface, #fff); transition: border-color .15s ease, background .15s ease; }
.hon-stage-card.is-on { border-color: #1d4ed8; background: rgba(29,78,216,0.03); }
.hon-stage-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hon-stage-amt { font-size: 14px; color: #1d4ed8; white-space: nowrap; }
.hon-stage-meta { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; font-size: 12px; color: var(--muted, #475569); }
.hon-stage-meta label { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.hon-stage-meta input { width: 84px; padding: 4px 6px; font-size: 12px; }
.hon-deliverables { display: grid; gap: 4px; padding-left: 22px; margin-top: 6px; border-top: 1px dashed var(--line, #e2e8f0); padding-top: 8px; }
.hon-deliverables .check { font-size: 12.2px; color: var(--ink, #334155); }
.hon-esp-group { margin-top: 10px; }
.hon-esp-group h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #64748b); margin: 0 0 6px; }
.hon-pay-list { display: flex; flex-direction: column; gap: 6px; }
.hon-pay-row { display: flex; align-items: center; gap: 6px; }
.hon-pay-row input[type="text"] { flex: 1; min-width: 140px; padding: 5px 8px; font-size: 12.5px; }
.hon-pay-row input[type="number"] { padding: 5px 6px; font-size: 12.5px; text-align: right; }

/* Estilos PDF Propuesta de Honorarios */
.hon-pdf-sheet { padding: 30px 40px 58px; }
.hon-pdf-sheet .doc-heading { margin: 0 0 8px; }
.hon-pdf-sheet .doc-company-head { margin-bottom: 6px; }
.hon-pdf-sheet .doc-company-logo { max-height: 40px; }
.hon-pdf-sheet .doc-heading h2 { font-size: 18.5px; margin: 2px 0 3px; color: #0f2447; }
.hon-pdf-sheet .doc-project { font-size: 13.5px; margin: 2px 0; }
.hon-pdf-sheet .doc-heading p { font-size: 10.6px; margin: 2px 0; color: #334155; }
.hon-pdf-sheet .doc-table th, .hon-pdf-sheet .doc-table td { padding: 4.5px 6px; font-size: 10.6px; line-height: 1.28; }
.hon-pdf-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin: 6px 0 8px; }
.hon-pdf-summary > div { border: 1px solid #cbd5e1; border-radius: 7px; padding: 6px 9px; background: #f8fafc; }
.hon-pdf-summary > div.is-main { border-color: #174ca7; background: #eff6ff; }
.hon-pdf-summary small { display: block; font-size: 8.8px; text-transform: uppercase; letter-spacing: .03em; color: #475569; margin-bottom: 1px; }
.hon-pdf-summary strong { font-size: 11.8px; color: #0f172a; }
.hon-pdf-summary > div.is-main strong { font-size: 13px; color: #174ca7; }
.hon-pdf-h3 { font-size: 11px; font-weight: 700; color: #14253e; text-transform: uppercase; letter-spacing: .03em; margin: 9px 0 4px; border-bottom: 1.5px solid #cbd5e1; padding-bottom: 2px; }
.hon-pdf-ul { margin: 2.5px 0 0; padding-left: 15px; font-size: 9.6px; line-height: 1.32; color: #334155; font-weight: 400; }
.hon-pdf-ul li { margin-bottom: 1px; }
.hon-pdf-clauses p { margin: 3px 0; font-size: 10.1px; line-height: 1.36; color: #1e293b; }
.hon-pdf-sheet .doc-notes-sign { margin-top: 14px; padding-top: 8px; border-top: 1px solid #cbd5e1; justify-content: space-around; gap: 36px; }
.hon-pdf-sheet .doc-sign { padding-top: 30px; width: 245px; font-size: 10.5px; }

/* Modo Noche Honorarios */
:root[data-theme="dark"] .hon-method-box { background: #162033; border-color: #2b3a55; }
:root[data-theme="dark"] .hon-stage-card { background: #131d2e; border-color: #2b3a55; }
:root[data-theme="dark"] .hon-stage-card.is-on { border-color: #60a5fa; background: rgba(59,130,246,0.11); }
:root[data-theme="dark"] .hon-stage-amt { color: #93c5fd; }
:root[data-theme="dark"] .hon-deliverables { border-top-color: #2b3a55; }
:root[data-theme="dark"] .hon-deliverables .check { color: #cbd5e1; }
:root[data-theme="dark"] .hon-esp-group h4 { color: #94a3b8; }
/* F-110: Hoja Letter Landscape (11in x 8.5in) para Comparativo PDF */
.doc-sheet.doc-sheet-landscape { width: 1056px; height: 816px; min-height: 816px; }
