:root {
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  font-synthesis: none;
  color: #203344;
  background: #f3f7fb;
  --muted: #5e7081;
  --line: #dce6ee;
  --accent: #1d2c50;
  --accent-hover: #15203c;
  --teal: #1c7b8d;
  --shadow: 0 6px 24px #1e4b6d07;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, .button-link {
  cursor: pointer; min-height: 44px; border: 1px solid #cad9e5; border-radius: 10px;
  padding: 10px 16px; background: white; color: #27455e; font-size: 14px; font-weight: 600;
  transition: background .16s, border-color .16s, box-shadow .16s;
}
button:hover, .button-link:hover { background: #edf5fc; border-color: #9bbcd6; }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: white; box-shadow: 0 4px 10px #0878bc19; }
.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.danger { color: #b33237; border-color: #eccacc; }
a { color: var(--accent); }
svg { flex: none; width: 20px; height: 20px; }
label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; min-width: 0; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid #bdcedc; border-radius: 10px; background: #fff; padding: 12px; color: #203344; }
input::placeholder, textarea::placeholder { color: #718191; }
input:hover, select:hover, textarea:hover { border-color: #86acc7; }
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #44a4d5; outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 30px; letter-spacing: -.9px; line-height: 1.18; }
h2 { font-size: 22px; letter-spacing: -.5px; line-height: 1.3; }
h3 { font-size: 17px; line-height: 1.4; }
p { line-height: 1.65; }
.muted { color: var(--muted); font-size: 14px; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 1.7px; color: var(--muted); margin-bottom: 10px; }
.skip-link { position: fixed; top: -100px; left: 15px; padding: 12px 18px; border-radius: 8px; background: white; z-index: 100; }
.skip-link:focus { top: 10px; }
/* The original JPG is preserved. This viewport presents only its official logo. */
.logo-window { position: relative; width: 176px; aspect-ratio: 1.8; overflow: hidden; background: transparent; border-radius: 8px; flex: none; }
.logo-window img { position: absolute; width: 160%; height: auto; max-width: none; left: -30%; top: -90%; }
.access { min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; }
.intro { padding: 46px clamp(30px, 6vw, 96px); background: radial-gradient(ellipse at 90% 80%, #174b60 0, #1d2c50 48%, #15213b 100%); color: white; display: flex; flex-direction: column; justify-content: center; }
.logo-access { width: min(280px, 100%); margin-bottom: 35px; }
.intro .eyebrow { color: #83bec9; }
.intro h1 { font-size: clamp(36px, 4.2vw, 62px); line-height: 1.1; letter-spacing: -2px; margin-bottom: 24px; }
.intro h1 span { color: #69d3de; }
.intro-copy { color: #bed1db; font-size: 16px; }
.intro-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 20px; }
.intro-tags span { padding: 8px 12px; border: 1px solid #254854; border-radius: 8px; color: #bfe4e8; font-size: 12px; }
.intro-foot { color: #91afbf; font-size: 12px; margin: 28px 0 0; }
.access-side { display: flex; flex-direction: column; justify-content: center; padding: 42px 24px; background: #f6f9fc; }
.access-card { max-width: 450px; width: 100%; margin: auto; padding: 38px; background: white; border: 1px solid #e2ebf2; border-radius: 22px; box-shadow: 0 18px 65px #1a456410; }
.access-badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 1.2px; padding: 8px 10px; color: #086ca4; background: #eaf5fc; border-radius: 7px; margin-bottom: 24px; }
.access-card h2 { font-size: 30px; margin-bottom: 10px; }
.access-card form { margin-top: 28px; }
.access-card .primary { min-height: 48px; margin-top: 5px; }
.access-help { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 20px; margin: 24px 0 0; }
.access-version { font-size: 11px; color: var(--muted); text-align: center; margin: 24px 0 0; }
form { display: grid; gap: 20px; }
.error { color: #b33237; font-size: 14px; white-space: pre-wrap; margin: 15px 0 0; }
.error:empty { margin: 0; }
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100dvh; }
aside { position: sticky; top: 0; height: 100dvh; overflow-y: auto; background: #1d2c50; color: #d0e0eb; padding: 24px 16px 20px; display: flex; flex-direction: column; }
.sidebar-brand { display: flex; align-items: center; justify-content: center; margin: 0 0 28px; }
.nav-heading { color: #8da8bc; font-size: 9px; letter-spacing: 1.8px; padding: 0 14px; margin: 0 0 12px; font-weight: 700; }
nav { display: grid; gap: 5px; }
nav button { display: flex; gap: 12px; align-items: center; background: transparent; border: 1px solid transparent; text-align: left; color: #b9cede; font-size: 13px; line-height: 1.35; padding: 12px; min-height: 46px; }
nav button svg { width: 19px; height: 19px; opacity: .9; }
nav button.active { background: #0e3855; border-color: #1b5476; color: white; box-shadow: inset 3px 0 #3ab8be; }
nav button:hover { background: #112b3e; border-color: #26465a; color: white; }
nav button.active:hover { background: #124565; }
.aside-bottom { margin-top: auto; padding: 24px 8px 0; display: grid; gap: 15px; }
.identity-card { display: flex; align-items: center; gap: 10px; padding-top: 18px; border-top: 1px solid #203547; }
.identity-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: #123b4c; color: #9cddd9; font-size: 10px; font-weight: 700; flex: none; }
#identity { font-size: 12px; color: #bdd1df; line-height: 1.6; overflow-wrap: anywhere; }
.aside-bottom button { color: #c5d5e0; background: #0b1c2b; border-color: #294357; font-size: 12px; }
.aside-bottom button:hover { background: #163248; }
.workspace { padding: 30px clamp(22px, 3vw, 46px) 0; min-width: 0; }
.workspace-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-bottom: 28px; }
.heading-group { display: flex; align-items: center; gap: 12px; min-width: 0; }
.workspace-header h1 { margin: 0; }
.workspace-header .eyebrow { color: #467690; margin-bottom: 7px; font-size: 9px; }
.page-subtitle { margin: 7px 0 0; font-size: 13px; color: var(--muted); }
.header-tools { display: flex; align-items: center; gap: 16px; flex: none; }
.today { font-size: 12px; color: var(--muted); text-transform: capitalize; }
#refresh { display: inline-flex; gap: 8px; align-items: center; }
main { min-height: 70vh; outline: none; }
footer { padding: 28px 0 24px; font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; }
.welcome { background: linear-gradient(112deg, #1d2c50, #23546d 65%, #217d8d); padding: 26px 30px; border-radius: 16px; display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; color: white; }
.welcome h2 { margin-bottom: 8px; font-size: 27px; }
.welcome p { margin: 0; color: #e5f7ff; font-size: 14px; }
.welcome .eyebrow { color: #d2f2f5; font-size: 9px; margin-bottom: 12px; }
.welcome .primary { background: white; color: #075c88; border-color: white; box-shadow: none; flex: none; }
.welcome .primary:hover { background: #e5f5fc; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; box-shadow: var(--shadow); position: relative; min-width: 0; }
.stat span { color: var(--muted); font-size: 12px; line-height: 1.5; display: block; padding-right: 34px; }
.stat strong { display: block; font-size: 34px; font-weight: 650; margin-top: 12px; letter-spacing: -1px; color: #1c3a52; }
.stat-icon { position: absolute; right: 18px; top: 16px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #edf6fd; color: var(--accent); }
.stat:nth-child(2) .stat-icon { background: #e9f7f4; color: #167d78; }
.stat:nth-child(3) .stat-icon { background: #f1f1fd; color: #6057aa; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dashboard-grid .panel { margin: 0; }
.dashboard-grid > .panel:last-child { grid-column: 1 / -1; }
.panel { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow); min-width: 0; }
.panel h2 { font-size: 18px; margin-bottom: 18px; }
.panel-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.panel-heading h2 { margin: 0; }
.section-tag { font-size: 11px; color: var(--muted); white-space: nowrap; }
.quote-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.metric-item { background: #f5f9fc; border-radius: 10px; padding: 14px; }
.metric-item strong { font-size: 23px; display: block; color: #214962; }
.metric-item span { font-size: 12px; color: var(--muted); display: block; margin-top: 4px; }
.metric-item.attention { background: #fff6e8; }
.metric-item.attention strong { color: #8d5a0c; }
.metric-item.good { background: #eaf7f3; }
.metric-item.good strong { color: #16705d; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; padding: 16px; background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.toolbar input { max-width: 420px; flex: 1; min-width: 190px; background: #f8fbfe; }
.toolbar select { width: 175px; }
.toolbar p { margin: 0; }
.toolbar .push { margin-left: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.record { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 22px; min-width: 0; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.record:hover { border-color: #b7cfdf; }
.record h3 { margin-bottom: 8px; overflow-wrap: anywhere; }
.record p { margin-bottom: 12px; font-size: 13px; overflow-wrap: anywhere; }
.record .meta { font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.record .actions { margin-top: auto; padding-top: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.record strong.price { display: block; font-size: 25px; margin: 12px 0; color: #174969; letter-spacing: -.6px; }
.chip { align-self: flex-start; display: inline-block; font-size: 11px; font-weight: 600; color: #175c82; background: #edf6fc; border: 1px solid #d6eaf6; border-radius: 7px; padding: 5px 9px; margin-bottom: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; border-top: 1px solid var(--line); }
.row > div { min-width: 0; overflow-wrap: anywhere; }
.row p { margin: 0; font-size: 13px; }
.row strong { font-size: 14px; }
.row button { flex: none; }
.overdue { color: #b33237; }
.empty { padding: 36px 24px; text-align: center; color: var(--muted); background: white; border: 1px dashed #b6ccdc; border-radius: 14px; line-height: 1.65; }
.pagination { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin: 24px 0; font-size: 12px; flex-wrap: wrap; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); padding-top: 20px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.detail-grid p { overflow-wrap: anywhere; white-space: pre-wrap; }
.history { font-size: 13px; border-left: 2px solid #a5d4e4; padding: 0 0 20px 18px; margin-left: 5px; overflow-wrap: anywhere; }
.history p { margin: 5px 0; }
.history summary { cursor: pointer; color: var(--accent); }
pre { white-space: pre-wrap; font-size: 11px; overflow-wrap: anywhere; max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
dialog { width: min(840px, 94vw); max-height: 92dvh; border: 1px solid var(--line); border-radius: 18px; padding: 28px; color: #203344; box-shadow: 0 30px 100px #07273f35; }
dialog::backdrop { background: #07182799; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 26px; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.dialog-head h2 { margin: 0; }
.dialog-head button { font-size: 24px; padding: 5px 12px; border-color: transparent; flex: none; }
.toast { position: fixed; bottom: 24px; right: 24px; background: #0d334b; color: white; padding: 16px 22px; border-radius: 12px; max-width: 90vw; z-index: 100; box-shadow: 0 8px 25px #102e4226; }
#connection { position: sticky; top: 0; background: #fff0d5; color: #714b0f; padding: 12px; text-align: center; z-index: 110; font-size: 14px; }
.quote-summary { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.quote-lines article, .quote-edit-line { border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin: 14px 0; background: #fafcfe; }
.quote-lines p { white-space: pre-wrap; overflow-wrap: anywhere; }
.internal { background: #f2f6fa; border: 1px solid #e2eaf1; border-radius: 12px; padding: 18px; }
.preserve { white-space: pre-wrap; overflow-wrap: anywhere; }
.notice { background: #edf7fb; border-left: 3px solid #1688b5; border-radius: 0 8px 8px 0; padding: 14px 16px; white-space: pre-wrap; color: #295168; font-size: 13px; line-height: 1.65; }
.quote-total { font-size: 22px; font-weight: 700; align-self: center; padding: 12px 0; color: #174969; }
.item-picker { border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.item-picker button { margin: 8px 0; }
.check { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; line-height: 1.5; }
.check input[type=checkbox] { width: 22px; height: 22px; min-height: 0; flex: none; margin: 0; accent-color: var(--accent); }
.message-copy { font-family: inherit; font-size: 14px; background: #f5f9fc; padding: 18px; max-height: 50vh; overflow: auto; border-radius: 10px; }
.button-link { display: inline-flex; align-items: center; text-decoration: none; }
.finance-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.finance-totals p { margin: 0; background: #f5f9fc; border-radius: 10px; padding: 14px; font-size: 12px; min-width: 0; overflow-wrap: anywhere; }
.finance-totals strong { display: block; font-size: clamp(17px, 1.65vw, 24px); margin-top: 6px; letter-spacing: -.4px; }
.finance-totals .overdue { background: #fff2f1; }
.debt-row { border-bottom: 1px solid var(--line); padding: 18px 0; display: flex; gap: 16px; justify-content: space-between; align-items: center; }
.debt-row > div { min-width: 0; overflow-wrap: anywhere; }
.installment-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 10px; align-items: end; margin: 14px 0; }
.installment-row button { margin-bottom: 0; }
.menu-toggle, .sidebar-close, .menu-overlay { display: none; }
[hidden] { display: none !important; }
@media (min-width: 1700px) { #main { max-width: 1500px; } }
@media (max-width: 1100px) {
  .shell { grid-template-columns: 224px minmax(0, 1fr); }
  .workspace { padding: 26px 24px 0; }
  .today { display: none; }
  .stat { padding: 18px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid > .panel:last-child { grid-column: auto; }
  .detail-grid { grid-template-columns: 1fr; }
  .intro { padding: 40px; }
}
@media (max-width: 800px) {
  .shell { display: block; }
  aside { position: fixed; width: min(290px, 86vw); top: 0; left: 0; z-index: 90; transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility .2s; }
  .menu-open aside { transform: translateX(0); visibility: visible; }
  .menu-open { overflow: hidden; }
  .menu-overlay { display: block; position: fixed; inset: 0; width: 100%; height: 100dvh; border: 0; border-radius: 0; background: #07182799; z-index: 80; }
  .menu-overlay:hover { background: #07182799; }
  .sidebar-brand { justify-content: space-between; gap: 8px; }
  .sidebar-close { display: block; padding: 4px 12px; font-size: 27px; color: white; background: #102c3d; border-color: #2c4c5e; }
  .menu-toggle { display: grid; place-items: center; width: 44px; padding: 10px; flex: none; }
  .workspace { padding: 22px 22px 0; }
  .workspace-header { gap: 10px; }
  .workspace-header h1 { font-size: 26px; }
  .workspace-header .eyebrow { display: none; }
  .stats { gap: 12px; }
  .stat span { padding-right: 0; }
  .stat-icon { position: static; margin-bottom: 12px; }
  .finance-totals strong { font-size: 23px; }
}
@media (max-width: 650px) {
  .access { grid-template-columns: 1fr; }
  .intro { padding: 22px 24px; }
  .logo-access { width: 180px; margin-bottom: 18px; }
  .intro h1 { font-size: 30px; letter-spacing: -1px; margin-bottom: 12px; }
  .intro .eyebrow { font-size: 9px; }
  .intro-copy, .intro-tags, .intro-foot { display: none; }
  .access-side { padding: 22px 16px; }
  .access-card { padding: 26px 24px; border-radius: 16px; }
  .access-card h2 { font-size: 26px; }
  .access-badge { margin-bottom: 18px; }
  .workspace { padding: 20px 16px 0; }
  .workspace-header { padding-bottom: 22px; align-items: flex-start; }
  .workspace-header h1 { font-size: 24px; overflow-wrap: anywhere; }
  .page-subtitle { font-size: 12px; }
  #refresh { width: 44px; padding: 10px; justify-content: center; }
  #refresh span { display: none; }
  .welcome { display: block; padding: 24px; }
  .welcome h2 { font-size: 24px; }
  .welcome button { margin-top: 20px; }
  .stats { grid-template-columns: 1fr; gap: 10px; }
  .stat { padding: 16px 18px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
  .stat-icon { margin: 0; }
  .stat strong { margin: 0; font-size: 28px; }
  .stat span { font-size: 12px; }
  .toolbar { padding: 14px; gap: 10px; }
  .toolbar input { max-width: none; width: 100%; flex-basis: 100%; min-width: 0; }
  .toolbar select { flex: 1; min-width: 0; }
  .toolbar .push { margin-left: 0; }
  .toolbar .primary.push { width: 100%; }
  .cards, .field-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .record { padding: 20px; }
  .row { align-items: flex-start; gap: 12px; }
  .row button { padding: 10px 12px; }
  .panel { padding: 20px; }
  dialog { padding: 20px; width: calc(100vw - 20px); max-height: 94dvh; border-radius: 14px; }
  .dialog-head { padding-bottom: 16px; margin-bottom: 20px; }
  .dialog-head h2 { font-size: 20px; }
  .pagination { justify-content: center; }
  .pagination span { flex-basis: 100%; text-align: center; }
  .quote-summary { align-items: flex-start; }
  .quote-edit-line { padding: 14px; }
  .actions > * { flex: 1; text-align: center; min-width: 110px; }
  .check input[type=checkbox] { width: 24px; height: 24px; }
  .installment-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: #f4f8fc; padding: 12px; border-radius: 10px; }
  .debt-row { display: block; }
  .debt-row .actions { margin-top: 12px; }
  .finance-totals { gap: 10px; }
  .finance-totals p { padding: 12px; }
  .finance-totals strong { font-size: 20px; }
  footer { flex-direction: column; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }

.pilot-banner { display:flex; align-items:center; gap:10px; flex-wrap:wrap; border:1px solid #c9dce8; background:#eaf3f9; color:#285370; padding:11px 15px; margin-bottom:22px; border-radius:10px; font-size:12px; line-height:1.5; }
.pilot-dot { width:7px; height:7px; border-radius:50%; background:#1c7b8d; flex:none; }
.pilot-layout { display:grid; gap:20px; }
.feedback-description { white-space:pre-wrap; overflow-wrap:anywhere; }
.feedback-note { background:#edf7f6; color:#285b57; border-radius:8px; padding:12px; margin-top:8px; }
.health-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin:18px 0; }
.health-check { padding:12px 14px; border:1px solid var(--line); border-radius:10px; font-size:13px; display:flex; align-items:center; justify-content:space-between; gap:10px; }
.health-check strong { font-size:11px; color:#17654f; flex:none; }
.health-check.pending strong { color:#8d5a0c; }
@media(max-width:650px) { .health-grid {grid-template-columns:1fr;} .pilot-banner {font-size:11px;} .pilot-banner span:last-child {flex-basis:100%;} }

/* Operación 0.8: revisión de archivos y filtros en pantallas pequeñas. */
.import-preview{max-height:38vh;overflow:auto;border:1px solid #dce5ee;border-radius:12px;padding:12px}.toolbar label{min-width:140px;flex:1}.toolbar input[type=date]{width:100%}.stats strong{overflow-wrap:anywhere}.debt-row{gap:12px}.debt-row>div{min-width:0;overflow-wrap:anywhere}@media(max-width:600px){.toolbar{align-items:stretch}.toolbar label{width:100%}.debt-row{flex-direction:column;align-items:stretch}.debt-row .actions{width:100%}.debt-row button{min-height:44px}.import-preview{max-height:35vh}}
