:root {
  --brand: #074dcc;
  --brand-600: #0640aa;
  --brand-50: #ebf2fe;
  --brand-100: #d2e1fb;
  --ink: #1b2233;
  --ink-2: #4a5468;
  --ink-3: #7a8397;
  --line: #e3e7ef;
  --line-2: #cfd6e4;
  --bg: #f5f7fb;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 2px 8px rgba(20, 30, 60, .04);

  --st-radicada: #3563c9;   --st-radicada-bg: #e8effc;
  --st-estudio: #9a6a00;    --st-estudio-bg: #fdf3d8;
  --st-docs: #b8520f;       --st-docs-bg: #fdeadd;
  --st-aprobada: #1d7a47;   --st-aprobada-bg: #e1f4e9;
  --st-rechazada: #b42335;  --st-rechazada-bg: #fbe4e7;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.boot { padding: 40px; text-align: center; color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  background: #16254f; color: #cdd6ee; padding: 18px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 10px; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 12px; letter-spacing: .02em; flex: none; }
.brand b { color: #fff; display: block; font-size: 13px; line-height: 1.2; }
.brand small { font-size: 11px; color: #8e9bc0; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #cdd6ee; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.nav a.on { background: var(--brand); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding: 12px 8px 0; font-size: 12px; }
.side-foot b { color: #fff; display: block; font-size: 13px; }
.side-foot .role { display: inline-block; margin: 2px 0 10px; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: rgba(255,255,255,.1); color: #dfe6f8; }
.side-foot button { width: 100%; }
.main { padding: 26px 30px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.mobile-bar { display: none; }

/* ---------- Cards / grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); gap: 12px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi { padding: 16px 18px; }
.kpi .lbl { font-size: 12px; color: var(--ink-3); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.kpi .ksub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.two { grid-template-columns: 1.6fr 1fr; align-items: start; }

/* ---------- Status */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-Radicada { color: var(--st-radicada); background: var(--st-radicada-bg); }
.st-En-estudio { color: var(--st-estudio); background: var(--st-estudio-bg); }
.st-Requiere-documentos { color: var(--st-docs); background: var(--st-docs-bg); }
.st-Aprobada { color: var(--st-aprobada); background: var(--st-aprobada-bg); }
.st-Rechazada { color: var(--st-rechazada); background: var(--st-rechazada-bg); }
.stackbar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--line); gap: 2px; }
.stackbar span { display: block; height: 100%; }
.legend { display: grid; gap: 8px; margin-top: 14px; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend .n { margin-left: auto; font-weight: 600; }

/* ---------- Tables */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfd; }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr.click { cursor: pointer; }
table.list tbody tr.click:hover td { background: var(--brand-50); }
td.r, th.r { text-align: right; }
.empty { padding: 36px 20px; text-align: center; color: var(--ink-3); }

/* ---------- Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f3f5fa; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); }
.btn.danger { color: var(--st-rechazada); border-color: #efc2c8; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.18); color: #dfe6f8; }
.btn.ghost:hover { background: rgba(255,255,255,.08); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .grow { flex: 1 1 220px; }

input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: 7px; padding: 8px 10px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-100); border-color: var(--brand); }
input[readonly] { background: #f4f6fa; color: var(--ink-2); font-weight: 600; }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; flex: none; }
label.fld { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
div.fld { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
label.fld .req, div.fld .req { color: var(--st-rechazada); }
.chk { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; font-weight: 500; color: var(--ink); padding: 8px 0; cursor: pointer; }
.radios { display: flex; gap: 16px; align-items: center; height: 37px; }
.radios label { display: flex; gap: 6px; align-items: center; font-weight: 500; color: var(--ink); cursor: pointer; }

/* ---------- Form */
.form-layout { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.form-nav { position: sticky; top: 20px; display: grid; gap: 2px; }
.form-nav a { padding: 7px 10px; border-radius: 7px; color: var(--ink-2); font-size: 13px; font-weight: 500; border-left: 3px solid transparent; }
.form-nav a:hover { background: #fff; text-decoration: none; }
.form-nav a.opt::after { content: " · opcional"; color: var(--ink-3); font-weight: 400; font-size: 11px; }
details.sec { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; scroll-margin-top: 16px; }
details.sec > summary { list-style: none; cursor: pointer; padding: 14px 20px; display: flex; align-items: center; gap: 10px; background: linear-gradient(#f6f8fd, #eef2fb); border-radius: var(--radius); font-weight: 650; color: var(--brand-600); text-transform: uppercase; font-size: 13px; letter-spacing: .04em; }
details.sec[open] > summary { border-bottom: 1px solid var(--brand-100); border-radius: var(--radius) var(--radius) 0 0; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: "▾"; margin-left: auto; transition: transform .15s; color: var(--ink-3); }
details.sec:not([open]) > summary::after { transform: rotate(-90deg); }
details.sec .tag { font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-3); background: #fff; border: 1px solid var(--line); padding: 1px 8px; border-radius: 99px; }
.sec-body { padding: 18px 20px 20px; }
.fgrid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px 14px; }
.sub { grid-column: 1 / -1; font-size: 12px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .05em; padding-top: 8px; border-top: 1px dashed var(--line-2); margin-top: 4px; }
.sub:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.legal { grid-column: 1 / -1; font-size: 11.5px; color: var(--ink-2); background: #fafbfd; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; max-height: 170px; overflow: auto; white-space: pre-line; }
.rtable { margin-bottom: 16px; }
.rtable:last-child { margin-bottom: 0; }
.rtable h4 { margin: 0 0 8px; font-size: 12px; color: var(--brand); text-transform: uppercase; letter-spacing: .05em; }
.rgrid { display: grid; gap: 6px; }
.rgrid .rhead { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; }
.rgrid input { padding: 7px 8px; }
.rgrid input::placeholder { color: transparent; }
.row-x { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px; }
.form-actions { position: sticky; bottom: 0; background: rgba(245,247,251,.92); backdrop-filter: blur(6px); padding: 14px 0; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 6px; z-index: 5; }
.totbox { display: flex; gap: 22px; margin-right: auto; align-items: center; flex-wrap: wrap; }
.totbox div { font-size: 12px; color: var(--ink-3); }
.totbox b { display: block; font-size: 16px; color: var(--ink); }

/* ---------- Detail */
.detail { grid-template-columns: 1fr 340px; align-items: start; }
.dl { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px 16px; }
.dl div { grid-column: span 4; min-width: 0; }
.dl dt { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }
.dl dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.dsec { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dsec:last-child { border-bottom: 0; }
.dsec h3 { margin-bottom: 12px; color: var(--brand); }
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; margin: 4px 0 12px; }
table.mini th { text-align: left; font-size: 11px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; border-bottom: 1px solid var(--line); padding: 6px 8px; }
table.mini td { border-bottom: 1px solid var(--line); padding: 7px 8px; }
.side-panel { position: sticky; top: 20px; display: grid; gap: 16px; }
.timeline { list-style: none; margin: 0; padding: 0 20px 16px; }
.timeline li { position: relative; padding: 12px 0 0 20px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 30px; bottom: -14px; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .when { font-size: 12px; color: var(--ink-3); }
.timeline .note { margin-top: 4px; font-size: 13px; background: #fafbfd; border: 1px solid var(--line); padding: 6px 10px; border-radius: 7px; white-space: pre-line; }
.alert { padding: 12px 14px; border-radius: 8px; font-size: 13px; }
.alert.warn { background: var(--st-docs-bg); color: #7a3608; border: 1px solid #f4c9a8; }
.alert.bad { background: var(--st-rechazada-bg); color: #7d1422; border: 1px solid #f0bcc3; }
.alert.ok { background: var(--st-aprobada-bg); color: #0f5230; border: 1px solid #b6e1c8; }

/* ---------- Login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: #16254f; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; border: 60px solid rgba(255,255,255,.04); }
.login-art h2 { font-size: 30px; font-weight: 700; max-width: 420px; line-height: 1.15; }
.login-art p { color: #aebbe0; max-width: 420px; }
.login-form { display: grid; place-items: center; padding: 32px; }
.login-form form { width: 100%; max-width: 360px; display: grid; gap: 16px; }
.err { color: var(--st-rechazada); font-size: 13px; min-height: 18px; }

/* ---------- Modal / toast */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(10,20,50,.3); }
dialog::backdrop { background: rgba(15,25,55,.45); }
dialog form { display: grid; gap: 14px; padding: 22px; }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: #16254f; color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; font-weight: 500; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--st-rechazada); }


/* ---------- Formulario estudio de crédito */
.sform { max-width: 760px; }
.fsec { margin-bottom: 16px; }
.fsec .card-head { background: #fafbfd; border-radius: var(--radius) var(--radius) 0 0; }
.fsec h2 { display: flex; align-items: center; gap: 12px; font-size: 17px; }
.snum { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; flex: none; }
.fstack { display: grid; gap: 18px; padding: 22px 20px; }
.fstack .fld > span:first-child, .fstack .fld { font-size: 13px; color: var(--ink); }
.fstack { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.fstack > * { grid-column: 1 / -1; }
.fstack > .half { grid-column: auto; }
.fstack > .fsub { margin-top: 6px; }
.fld .hint { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.money { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 7px; background: #fff; padding-left: 12px; }
.money:focus-within { outline: 2px solid var(--brand-100); border-color: var(--brand); }
.money span { color: var(--ink-3); font-weight: 500; }
.money input { border: 0; outline: 0 !important; padding-left: 6px; }
.toggle-q { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 8px; cursor: pointer; font-size: 13px; line-height: 1.5; }
.toggle-q input { margin-top: 3px; width: 18px; height: 18px; }
.drop { display: grid; gap: 8px; }
.drop-zone { display: grid; place-items: center; gap: 2px; text-align: center; padding: 18px 12px; border: 1.5px dashed var(--line-2); border-radius: 8px; background: #fafbfd; cursor: pointer; font-weight: 400; color: var(--ink-2); }
.drop-zone:hover, .drop-zone.over { border-color: var(--brand); background: var(--brand-50); }
.drop-zone b { color: var(--brand); }
.drop-zone small { color: var(--ink-3); font-size: 12px; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone:focus-within { outline: 2px solid var(--brand-100); }
ul.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
ul.files li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 13px; font-weight: 500; min-width: 0; }
ul.files li a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ul.files li small { color: var(--ink-3); font-weight: 400; }
ul.files li.uploading { opacity: .6; }
ul.files img, ul.files .pdf { width: 36px; height: 36px; object-fit: cover; border-radius: 5px; flex: none; }
ul.files .pdf { display: grid; place-items: center; background: var(--st-rechazada-bg); color: var(--st-rechazada); font-size: 10px; font-weight: 700; }
ul.files.ro { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-top: 4px; }
ul.files.ro img { width: 56px; height: 56px; }
[hidden] { display: none !important; }

/* ---------- Logo */
.brand { text-decoration: none !important; flex-direction: column; align-items: stretch; gap: 8px; }
.brand-logo { background: #fff; border-radius: 10px; padding: 12px 12px; display: block; }
.brand-logo img { display: block; width: 100%; height: auto; }
.brand small { padding-left: 2px; }
.mb-logo { height: 24px; width: auto; }
.login-logo { width: min(380px, 100%); height: auto; display: block; }
.login-art .nit { color: #8e9bc0; font-size: 12px; margin-top: 10px; letter-spacing: .04em; }
.form-logo { width: 240px; height: auto; margin-bottom: 8px; }
.pdf-btn { color: var(--st-rechazada); }
.pdf-btn svg { width: 14px; height: 14px; }

/* ---------- Documento PDF */
.doc-toolbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 20px; background: #16254f; color: #fff; }
.doc-hint { text-align: center; font-size: 13px; color: var(--ink-2); padding: 12px 16px 0; }
.sheet { width: 216mm; max-width: calc(100vw - 24px); margin: 16px auto 40px; background: #fff; padding: 14mm 14mm 12mm; box-shadow: 0 4px 24px rgba(15,25,55,.12); color: #111827; font-size: 11.5px; line-height: 1.4; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 10px; border-bottom: 3px solid var(--brand); }
.doc-logo { width: 260px; height: auto; display: block; }
.doc-nit { font-size: 10px; color: #4a5468; margin-top: 6px; letter-spacing: .03em; }
.doc-folio { text-align: right; display: grid; gap: 2px; justify-items: end; }
.doc-folio small { text-transform: uppercase; letter-spacing: .08em; color: #4a5468; font-size: 9.5px; font-weight: 600; }
.doc-folio b { font-size: 20px; color: var(--brand); letter-spacing: .02em; }
.doc-folio span { font-size: 10px; color: #4a5468; }
.doc-folio .badge { margin-top: 4px; font-size: 10px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-title { font-size: 15px; text-transform: uppercase; letter-spacing: .05em; color: #16254f; margin: 14px 0 10px; text-align: center; }
.doc-sec { margin-bottom: 12px; break-inside: avoid; }
.doc-sec h2 { display: flex; align-items: center; gap: 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: #fff; background: var(--brand); padding: 5px 10px; border-radius: 4px; margin-bottom: 6px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-sec h2 span { background: #fff; color: var(--brand); width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; }
.doc-kv, .doc-refs { width: 100%; border-collapse: collapse; }
.doc-kv th, .doc-kv td, .doc-refs th, .doc-refs td { border: 1px solid #cfd6e4; padding: 4px 8px; text-align: left; vertical-align: top; }
.doc-kv th { width: 42%; background: #f3f6fc; font-weight: 600; color: #374151; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-kv td.num { font-variant-numeric: tabular-nums; }
.doc-refs { margin-top: 6px; }
.doc-refs thead th { background: #f3f6fc; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: #374151; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-note { margin: 0; padding: 6px 10px; border: 1px dashed #cfd6e4; border-radius: 4px; color: #4a5468; }
.doc-sigs { display: flex; gap: 24px; margin-top: 34px; break-inside: avoid; }
.sig { flex: 1; display: grid; gap: 2px; font-size: 10.5px; }
.sig-line { border-top: 1px solid #111827; margin-bottom: 4px; height: 44px; border-top: 0; border-bottom: 1px solid #111827; }
.sig span { color: #4a5468; }
.doc-foot { margin-top: 18px; padding-top: 6px; border-top: 1px solid #e3e7ef; font-size: 9px; color: #7a8397; text-align: center; }
.doc-annex { break-before: page; page-break-before: always; padding-top: 4mm; }
.doc-annex figure { margin: 0 0 12px; break-inside: avoid; text-align: center; }
.doc-annex img { max-width: 100%; max-height: 110mm; object-fit: contain; border: 1px solid #e3e7ef; }
.doc-annex figcaption { font-size: 10px; color: #4a5468; margin-top: 4px; }

/* ---------- Garantías */
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #7f8db5; font-weight: 700; padding: 14px 10px 4px; }
.nav-group:first-child { padding-top: 2px; }
.st-Recibida { color: #475467; background: #eef0f4; }
.st-En-revisión { color: var(--st-radicada); background: var(--st-radicada-bg); }
.st-Enviada-a-servicio-técnico { color: var(--st-docs); background: var(--st-docs-bg); }
.st-Agendada { color: #6d3fc0; background: #efe8fb; }
.st-Realizada { color: #0f7a82; background: #dff3f4; }
.st-Solucionada { color: var(--st-aprobada); background: var(--st-aprobada-bg); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; box-shadow: var(--shadow); }
.chip:hover { border-color: var(--line-2); }
.chip.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-100); }
.gfilters select { width: auto; }
.dfilter { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.dfilter input { width: auto; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.fld.invalid input, .fld.invalid select, .fld.invalid textarea, .fld.invalid .drop-zone { border-color: var(--st-rechazada); }
.ferr { color: var(--st-rechazada); font-size: 12px; font-weight: 500; }
.ferr:empty { display: none; }
.doc-group-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.doc-group-head h3 { margin: 0 !important; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.thumb.video { display: grid; gap: 4px; font-size: 12px; max-width: 260px; }
.thumb.video video { width: 260px; max-width: 100%; border-radius: 8px; background: #000; }
.doc-link { display: inline-flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.doc-link svg { width: 15px; height: 15px; }
.doc-link small { color: var(--ink-3); }
ul.files .pdf.doc { background: #e3ecfb; color: #1f4fa8; font-size: 8px; }
ul.files .pdf.xls { background: #e1f4e9; color: #1d7a47; font-size: 8px; }
ul.files .pdf.vid { background: var(--brand-50); color: var(--brand); font-size: 8.5px; }
.doc-kv4 th { width: 20%; }
.detail > .grid { align-content: start; }
#gdlg { width: min(560px, calc(100vw - 32px)); }

/* ---------- Permisos por módulo */
.mods { border: 1px solid var(--line); border-radius: 8px; padding: 6px 14px 10px; margin: 0; display: grid; gap: 0; }
.mods legend { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0 6px; }
.mods .chk small { font-weight: 400; }
.mods-note { display: none; font-size: 12px; margin: 4px 0 0; }
.mods.off .chk { opacity: .45; }
.mods.off .mods-note { display: block; }
.mod-tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--brand-50); color: var(--brand); margin: 1px 0; }
.mod-tag.all { background: #eef0f4; color: #475467; }
.mod-tag.none { background: var(--st-rechazada-bg); color: var(--st-rechazada); }

/* ---------- Cartera */
.kpis4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.meter { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; border-radius: 99px; }
.meter.big { height: 12px; margin: 0 0 14px; }
.cuotas-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; text-align: center; }
.cuotas-grid .n { display: block; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cuotas-grid .l { font-size: 12px; color: var(--ink-3); }
.days { display: grid; grid-template-columns: repeat(31, minmax(0, 1fr)); gap: 4px; padding: 16px 20px; overflow-x: auto; }
.day { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--ink-2); text-decoration: none !important; min-width: 18px; }
.day .bar { width: 100%; height: 90px; background: var(--bg); border-radius: 4px; display: flex; align-items: flex-end; overflow: hidden; }
.day .bar i { display: block; width: 100%; background: var(--brand-100); border-radius: 4px 4px 0 0; }
.day:hover .bar i { background: var(--brand); }
.day .n { font-size: 11px; font-weight: 600; min-height: 14px; }
.day .d { font-size: 11px; color: var(--ink-3); }
.day.today .d { color: #fff; background: var(--brand); border-radius: 99px; padding: 0 5px; font-weight: 700; }
.day.today .bar i { background: var(--brand); }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 10px 20px; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tel { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btn.wa { padding: 1px 8px; font-size: 11px; color: #128c4a; border-color: #b7e3c8; }
.contacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 16px 20px; }
.contact { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; gap: 2px; }
.cob-box { margin: 0 0 8px 26px; }
.print-title { display: none; font-weight: 700; font-size: 16px; margin-bottom: 10px; }
@media print {
  .print-title { display: block; }
  .kpis3 { grid-template-columns: repeat(3, 1fr); }
  .cartera-table { font-size: 11px; }
  .btn.wa { display: none; }
}
@media (max-width: 1150px) { .kpis4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) { .kpis3 { grid-template-columns: 1fr; } .cuotas-grid .n { font-size: 20px; } }

/* ---------- Ajustes de diseño */
.shell > div { min-width: 0; }
table.list td.num { white-space: nowrap; }
.kpi .val.money-val { font-size: clamp(17px, 1.7vw, 22px); white-space: nowrap; }
.drop-zone svg { width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; }
.half2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 820px) {
  .half2 { grid-template-columns: 1fr; }
  .days { grid-template-columns: repeat(31, 24px); }
  .kpi .val.money-val { font-size: 18px; }
}

/* ---------- Responsive */
@media (max-width: 1150px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two, .detail { grid-template-columns: 1fr; }
  .side-panel { position: static; }
  .form-layout { grid-template-columns: 1fr; }
  .form-nav { display: none; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; position: fixed; inset: 0 30% 0 0; z-index: 50; height: auto; }
  .shell.menu .side { display: flex; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; background: #16254f; color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 40; }
  .main { padding: 18px 16px 60px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fgrid > *, .dl div { grid-column: 1 / -1 !important; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .rgrid { grid-template-columns: 1fr !important; padding-bottom: 10px; border-bottom: 1px dashed var(--line-2); }
  .rgrid .rhead { display: none; }
  .rgrid input::placeholder { color: var(--ink-3); }
  .fstack > .half { grid-column: 1 / -1; }
  .form-actions { flex-wrap: wrap; padding: 10px 0; }
  .form-actions .totbox { flex: 1 1 100%; justify-content: space-between; }
  .form-actions .btn { flex: 1; }
}

/* ---------- Print */
@page { size: letter; margin: 10mm; }
@media print {
  body { background: #fff; }
  .doc-toolbar, .doc-hint, #toast { display: none !important; }
  .sheet { width: auto; max-width: none; margin: 0; padding: 0; box-shadow: none; }
  .side, .mobile-bar, .no-print, .form-actions, .side-panel form { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .detail { grid-template-columns: 1fr; }
  .card { box-shadow: none; }
  .dsec { break-inside: avoid; }
}
