/* =====================================================
   Inversora · Cuentas por Pagar — Hoja de estilos
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Tokens ── */
:root {
  --bg:        #F0EFEB;
  --surface:   #FFFFFF;
  --surface2:  #E9E8E3;
  --sidebar:   #13294B;
  --accent:    #C8870A;
  --accent-lt: #FDF5E0;
  --accent-dk: #9A6608;
  --text:      #181C2A;
  --text2:     #4A5570;
  --text3:     #8A96B0;
  --border:    #DCDAD4;
  --border2:   #C2BFB8;
  --green:     #1A7248;
  --green-lt:  #E2F4EC;
  --red:       #B02828;
  --red-lt:    #FDEAEA;
  --orange:    #B85820;
  --orange-lt: #FEF1E6;
  --blue:      #1758A0;
  --blue-lt:   #E4EEFA;
  --purple:    #5E3EA0;
  --purple-lt: #EEE8FC;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0C1520; --surface:#152235; --surface2:#1C3050;
    --sidebar:#091228; --accent:#E09A18; --accent-lt:#2C2008; --accent-dk:#F0B030;
    --text:#E6EAF4; --text2:#8CA4C8; --text3:#526080;
    --border:#223050; --border2:#2C4068;
    --green:#22A860; --green-lt:#0A2018;
    --red:#C83838;   --red-lt:#280808;
    --orange:#D07030;--orange-lt:#281408;
    --blue:#3A7AD0;  --blue-lt:#0A1C38; --purple-lt:#1A1030;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.55;
  display: flex; overflow: hidden;
}

/* Lectura cómoda: tamaños base más generosos y controles táctiles. */
.nav-item { font-size: 13.5px; padding-top: 9px; padding-bottom: 9px; }
.sb-uname { font-size: 13px; }
.sb-urole, .sb-brand-sub { font-size: 10.5px; }
.nav-lbl { font-size: 10px; }
.tb-title { font-size: 15px; }
.tb-crumb { font-size: 13px; }
.page-title { font-size: 18px; }
.page-sub { font-size: 13px; }
.btn { font-size: 14px; min-height: 38px; padding: 8px 15px; }
.btn-sm { font-size: 13px; min-height: 35px; }
.btn-xs { font-size: 12px; min-height: 31px; }
.form-label, .field-lbl, .kpi-lbl, .t-lbl, .sec-head { font-size: 11px; }
.form-input, .form-select, .form-textarea { font-size: 14px; min-height: 40px; padding: 9px 11px; }
.form-textarea { min-height: 96px; }
table { font-size: 14px; }
thead th { font-size: 11px; padding: 10px 12px; }
tbody td { padding: 11px 12px; }
.tercero-name { font-size: 14px; }
.desc-text, .field-val { font-size: 13.5px; }
.badge { font-size: 12px; padding: 4px 9px; }
.kpi-lbl { margin-bottom: 7px; }
.kpi-sub { font-size: 12px; }
.search-box input, .fsel, .drange { font-size: 13.5px; }
.alert { font-size: 14px; }
.doc-name { font-size: 13.5px; }
.doc-meta, .tl-meta, .form-help { font-size: 12px; }
.tl-action { font-size: 13.5px; }

/* ── Sidebar ── */
.sidebar {
  width: 210px; min-width: 210px;
  background: var(--sidebar);
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}
.sb-brand { padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.07); }
.sb-brand-name { font-size: 15px; font-weight: 700; color: #fff; }
.sb-brand-sub  { font-size: 9.5px; color: rgba(255,255,255,.35); letter-spacing: .12em; text-transform: uppercase; margin-top: 2px; }
.sb-user { padding: 12px 18px; display: flex; align-items: center; gap: 9px; border-bottom: 1px solid rgba(255,255,255,.05); }
.sb-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; color: #fff; flex-shrink: 0; }
.sb-uname { font-size: 11.5px; font-weight: 600; color: rgba(255,255,255,.88); }
.sb-urole { font-size: 9.5px; color: rgba(255,255,255,.38); }
.nav-sec  { padding: 8px 0 2px; }
.nav-lbl  { font-size: 8.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.25); padding: 0 18px 5px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 7px 18px; color: rgba(255,255,255,.55); font-size: 12px; font-weight: 500; text-decoration: none; border-left: 2px solid transparent; transition: background .14s, color .14s; }
.nav-item:hover { background: rgba(255,255,255,.05); color: rgba(255,255,255,.88); }
.nav-item.active { background: rgba(200,135,10,.12); color: #fff; border-left-color: var(--accent); }
.nav-icon { font-size: 13px; width: 14px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 8.5px; font-weight: 700; padding: 1px 5px; border-radius: 8px; }
.sb-footer { margin-top: auto; padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.05); font-size: 10px; color: rgba(255,255,255,.25); }

/* ── Layout principal ── */
.main { flex: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 20px; height: 48px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.tb-title { font-size: 13.5px; font-weight: 700; }
.tb-crumb { font-size: 11.5px; color: var(--text3); }
.tb-sep   { color: var(--border2); }
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.content-main { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 20px 24px; min-width: 0; }

/* ── Botones ── */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border-radius: 6px; font-size: 12.5px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: background .14s; font-family: inherit; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent-dk); }
.btn-primary:hover { background: var(--accent-dk); }
.btn-ghost   { background: transparent; color: var(--text2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface2); }
.btn-danger  { background: var(--red-lt); color: var(--red); border-color: var(--red); }
.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-xs  { padding: 3px 8px;  font-size: 11px; border-radius: 4px; }
.btn-icon { padding: 6px; width: 30px; height: 30px; justify-content: center; }

/* ── Formulario ── */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px 24px; margin-bottom: 16px; }
.form-title { font-size: 14px; font-weight: 700; margin-bottom: 16px; }
.form-grid  { display: grid; gap: 14px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text3); }
.form-input, .form-select, .form-textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; font-family: inherit; font-size: 12.5px; color: var(--text); outline: none;
  transition: border-color .14s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-input.mono { font-family: 'IBM Plex Mono', monospace; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 10px; border-top: 1px solid var(--border); margin-top: 4px; }
.required::after { content: ' *'; color: var(--red); }
.form-help { font-size: 10.5px; color: var(--text3); margin-top: 2px; }
.form-error { font-size: 11px; color: var(--red); margin-top: 2px; }

/* ── Tabla ── */
.table-toolbar { background: var(--surface); border: 1px solid var(--border); border-radius: 8px 8px 0 0; padding: 10px 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-top: none; border-radius: 0 0 8px 8px; overflow-x: auto; margin-bottom: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th { background: var(--surface2); padding: 8px 12px; text-align: left; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text3); border-bottom: 1px solid var(--border); white-space: nowrap; }
thead th a { color: inherit; text-decoration: none; }
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--accent-lt); }
tbody tr.row-overdue { border-left: 3px solid var(--red); background: var(--red-lt); }
tbody tr.row-pending { border-left: 3px solid var(--orange); }
tbody tr.row-paid    { opacity: .82; }
tbody td { padding: 9px 12px; vertical-align: middle; }
.col-check { width: 32px; }
.col-no    { width: 38px; text-align: center; color: var(--text3); font-size: 11px; }
.col-date  { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; white-space: nowrap; }
.col-num   { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; }
.col-ref   { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--text3); }
.col-money { text-align: right; font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.col-money.paid-val { color: var(--green); }
.col-docs  { text-align: center; }
.col-actions { text-align: right; white-space: nowrap; }
.tercero-name { font-weight: 600; font-size: 12px; }
.desc-text    { font-size: 11.5px; color: var(--text2); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 10px; font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.badge::before { content: '●'; font-size: 6px; }
.badge-orange { background: var(--orange-lt); color: var(--orange); }
.badge-blue   { background: var(--blue-lt);   color: var(--blue); }
.badge-green  { background: var(--green-lt);  color: var(--green); }
.badge-red    { background: var(--red-lt);    color: var(--red); }

/* ── KPIs ── */
.kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 11px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; position: relative; overflow: hidden; }
.kpi::before { content:''; position:absolute; left:0;top:0;bottom:0;width:3px; }
.kpi.k-navy::before   { background: var(--sidebar); }
.kpi.k-red::before    { background: var(--red); }
.kpi.k-green::before  { background: var(--green); }
.kpi.k-purple::before { background: var(--purple); }
.kpi-lbl { font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text3); margin-bottom: 5px; }
.kpi-val { font-family: 'IBM Plex Mono', monospace; font-size: clamp(12px,1.2vw,18px); font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: 11px; color: var(--text3); margin-top: 3px; }
.kpi-bar { margin-top: 10px; height: 3px; background: var(--surface2); border-radius: 2px; overflow: hidden; }
.kpi-bar-fill { height: 100%; border-radius: 2px; }

/* ── Search / filtros ── */
.search-box { display: flex; align-items: center; gap: 7px; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 5px 10px; flex: 1; max-width: 260px; }
.search-box input { background: none; border: none; outline: none; font-family: inherit; font-size: 12.5px; color: var(--text); width: 100%; }
.search-box input::placeholder { color: var(--text3); }
.fsel { background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 5px 9px; font-family: inherit; font-size: 12px; color: var(--text2); outline: none; cursor: pointer; }
.drange { display: flex; align-items: center; gap: 5px; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 5px 10px; font-size: 12px; color: var(--text2); }
.drange input[type="date"] { background: none; border: none; outline: none; font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--text2); width: 100px; }
.row-count { margin-left: auto; font-size: 11.5px; color: var(--text3); }

/* ── Totals bar ── */
.totals-bar { background: var(--sidebar); border-radius: 8px; padding: 10px 16px; display: flex; gap: 24px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.t-item { display: flex; flex-direction: column; gap: 1px; }
.t-lbl  { font-size: 8.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.35); }
.t-val  { font-family: 'IBM Plex Mono', monospace; font-size: 14px; font-weight: 500; color: #fff; font-variant-numeric: tabular-nums; }
.t-val.accent { color: #E8A420; }
.t-val.green  { color: #5DE0A0; }
.t-val.danger { color: #F07878; }
.t-sep { width: 1px; background: rgba(255,255,255,.1); align-self: stretch; }
.t-actions { margin-left: auto; display: flex; gap: 7px; flex-shrink: 0; }

/* ── Alertas ── */
.alert { padding: 10px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 500; margin-bottom: 14px; display: flex; align-items: flex-start; gap: 8px; }
.alert-success { background: var(--green-lt); color: var(--green); border: 1px solid var(--green); }
.alert-error   { background: var(--red-lt);   color: var(--red);   border: 1px solid var(--red); }
.alert-warning { background: var(--orange-lt);color: var(--orange);border: 1px solid var(--orange); }

/* ── Upload zone ── */
.upload-zone { border: 2px dashed var(--border); border-radius: 8px; padding: 20px; text-align: center; color: var(--text3); font-size: 12.5px; cursor: pointer; transition: border-color .14s, background .14s; }
.upload-zone:hover { border-color: var(--blue); background: var(--blue-lt); color: var(--blue); }
.doc-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.doc-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; }
.doc-icon { font-size: 18px; }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { font-size: 10.5px; color: var(--text3); }
.folder-path { margin-top: 8px; padding: 7px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; font-size: 11px; color: var(--text3); }
.folder-path code { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--blue); }

/* ── Timeline ── */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 10px; padding-bottom: 14px; position: relative; }
.tl-item::before { content: ''; position: absolute; left: 10px; top: 22px; bottom: 0; width: 1px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; }
.tl-action { font-size: 12px; font-weight: 500; }
.tl-meta   { font-size: 10.5px; color: var(--text3); margin-top: 1px; }
.tl-note   { font-size: 11px; color: var(--text2); font-style: italic; margin-top: 2px; }

/* ── Panel lateral ── */
.detail-panel { width: 340px; min-width: 340px; background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.p-header { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 8px; }
.p-title  { font-size: 13px; font-weight: 700; flex: 1; }
.p-meta   { font-size: 10px; color: var(--text3); margin-top: 2px; }
.p-close  { background: none; border: none; color: var(--text3); font-size: 15px; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.p-close:hover { background: var(--surface2); }
.p-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 16px; }
.p-tab  { padding: 8px 11px 7px; font-size: 11.5px; font-weight: 600; color: var(--text3); cursor: pointer; border-bottom: 2px solid transparent; transition: color .14s; margin-bottom: -1px; text-decoration: none; }
.p-tab:hover  { color: var(--text2); }
.p-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.p-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.p-footer { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; gap: 7px; }
.field { margin-bottom: 12px; }
.field-lbl { font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text3); margin-bottom: 3px; }
.field-val { font-size: 12.5px; }
.field-val.mono { font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-variant-numeric: tabular-nums; }
.field-val.big  { font-family: 'IBM Plex Mono', monospace; font-size: 19px; font-weight: 600; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.sec-head { font-size: 9.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text3); margin: 14px 0 8px; display: flex; align-items: center; gap: 7px; }
.sec-head::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Login ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--sidebar); }
.login-card { background: var(--surface); border-radius: 14px; padding: 36px 40px; width: 360px; box-shadow: 0 8px 40px rgba(0,0,0,.25); }
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand-name { font-size: 22px; font-weight: 700; color: var(--text); }
.login-brand-sub  { font-size: 11px; color: var(--text3); letter-spacing: .1em; text-transform: uppercase; margin-top: 3px; }

/* ── Misc ── */
input[type="checkbox"] { accent-color: var(--accent); width: 13px; height: 13px; cursor: pointer; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
.content-area { flex: 1; display: flex; overflow: hidden; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.page-title { font-size: 15px; font-weight: 700; }
.page-sub   { font-size: 12px; color: var(--text3); margin-top: 2px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.monthly-chart { display: block; width: 100%; height: 260px; overflow: hidden; }
.dashboard-view > div[style*="grid-template-columns:1fr minmax"] { min-width: 0; }
.dashboard-view > div[style*="grid-template-columns:minmax(0,200px)"] { min-width: 0; }
.dashboard-view .card { min-width: 0; }
.dashboard-view [style*="font-size:13px"],
.dashboard-view [style*="font-size:12.5px"] { font-size: 15px !important; }
.dashboard-view [style*="font-size:11.5px"] { font-size: 13px !important; }
.dashboard-view [style*="font-size:11px"],
.dashboard-view [style*="font-size:10.5px"],
.dashboard-view [style*="font-size:10px"] { font-size: 12px !important; }
.dashboard-view .kpi-val[style*="font-size"] { font-size: 21px !important; }

/* Tema visual moderno inspirado en consolas CRM: más aire, contraste y color. */
:root {
  --bg:        #F3F7FB;
  --surface:   #FFFFFF;
  --surface2:  #EEF4F9;
  --sidebar:   #032D60;
  --accent:    #0B8FD3;
  --accent-lt: #E5F5FC;
  --accent-dk: #0176D3;
  --text:      #16325C;
  --text2:     #3E5878;
  --text3:     #6B7F99;
  --border:    #D8E3ED;
  --border2:   #B7C9D8;
  --green:     #2E844A;
  --green-lt:  #E8F5EC;
  --red:       #BA0517;
  --red-lt:    #FDEBEC;
  --orange:    #DD7A01;
  --orange-lt: #FFF3E6;
  --blue:      #0176D3;
  --blue-lt:   #E8F3FC;
  --purple:    #7526A8;
  --purple-lt: #F4EAFE;
  --shadow:    0 2px 5px rgba(3,45,96,.08), 0 10px 24px rgba(3,45,96,.06);
}

body { font-family: 'Inter', 'IBM Plex Sans', system-ui, sans-serif; font-size: 15.5px; background: var(--bg); }
.sidebar { width: 238px; min-width: 238px; background: linear-gradient(180deg, #032D60 0%, #082B52 100%); }
.sb-brand { padding: 24px 22px 19px; }
.sb-brand-name { font-size: 20px; letter-spacing: -.02em; }
.sb-brand-sub { color: #8CC9EA; font-size: 10px; }
.sb-user { padding: 17px 22px; }
.sb-avatar { width: 36px; height: 36px; font-size: 13px; background: #0B8FD3; box-shadow: 0 0 0 4px rgba(255,255,255,.1); }
.sb-uname { font-size: 14px; }
.sb-urole { font-size: 11px; color: #A8C6DE; }
.nav-sec { padding: 14px 0 4px; }
.nav-lbl { color: #7FA6C5; padding-left: 22px; font-size: 10px; }
.nav-item { margin: 3px 10px; border-left: 0; border-radius: 8px; padding: 12px 13px; font-size: 14px; color: #D3E5F3; }
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: #0B8FD3; color: #fff; box-shadow: 0 5px 12px rgba(0,0,0,.18); }
.nav-icon { font-size: 16px; width: 19px; }
.topbar { height: 64px; padding: 0 30px; box-shadow: 0 1px 0 rgba(3,45,96,.04); }
.tb-title { font-size: 18px; color: var(--text); }
.tb-crumb { font-size: 14px; }
.content-main { padding: 26px 30px 36px; }
.page-title { font-size: 22px; letter-spacing: -.02em; }
.page-sub { font-size: 14px; }
.card, .form-card, .kpi { border-radius: 14px; box-shadow: var(--shadow); border-color: var(--border); }
.card { padding: 24px; }
.form-card { padding: 26px 28px; }
.kpi { padding: 21px 23px; }
.kpi::before { width: 5px; }
.kpi-val { font-size: 24px; }
.kpi-lbl { font-size: 11px; letter-spacing: .08em; }
.kpi-sub { font-size: 13px; }
.btn { border-radius: 8px; font-size: 14px; min-height: 42px; padding: 10px 17px; box-shadow: 0 2px 4px rgba(3,45,96,.08); }
.btn-primary { background: var(--accent-dk); border-color: var(--accent-dk); }
.btn-primary:hover { background: #014486; }
.btn-ghost { background: var(--surface); color: var(--blue); border-color: #A9C7DD; }
.btn-ghost:hover { background: var(--blue-lt); }
.form-input, .form-select, .form-textarea { border-radius: 8px; background: #FBFDFF; border-color: #B7C9D8; min-height: 44px; font-size: 15px; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(1,118,211,.14); }
.form-label { color: var(--text2); font-size: 12px; }
.table-toolbar, .table-wrap { border-color: var(--border); }
.table-toolbar { padding: 14px 17px; border-radius: 12px 12px 0 0; }
.table-wrap { border-radius: 0 0 12px 12px; box-shadow: var(--shadow); }
thead th { padding: 12px 14px; color: var(--text2); background: #EAF3F9; font-size: 11px; }
tbody td { padding: 13px 14px; }
tbody tr:hover { background: #F0F9FD; }
.badge { padding: 5px 10px; border-radius: 999px; font-size: 12px; }
.alert { border-radius: 10px; padding: 13px 16px; }
.monthly-chart { height: 250px; }
.dashboard-intro { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin: 4px 0 22px; }
.dashboard-view { max-width: 1780px; margin: 0 auto; }
.dashboard-eyebrow { color:#0176D3; font-size:12px; font-weight:800; letter-spacing:.14em; margin-bottom:7px; }
.dashboard-intro h1 { color:#032D60; font-size:32px; line-height:1.1; letter-spacing:-.035em; margin:0; }
.dashboard-intro p { color:#58718D; font-size:16px; margin-top:8px; }
.dashboard-date { color:#58718D; background:#E8F3FC; border:1px solid #B7D7EC; border-radius:999px; padding:9px 14px; font-size:13px; white-space:nowrap; }
.dashboard-view > .kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:16px; }
.dashboard-view > .kpi-grid .kpi { min-height:155px; }
.dashboard-view > div[style*="grid-template-columns:1fr minmax"] { grid-template-columns:minmax(0,2fr) minmax(320px,1fr) !important; gap:16px !important; }
.dashboard-view > div[style*="grid-template-columns:minmax(0,200px)"] { grid-template-columns:minmax(250px,.8fr) minmax(0,1.7fr) minmax(300px,1fr) !important; gap:16px !important; }
.dashboard-view > .kpi-grid .kpi.k-navy { background:#032D60 !important; color:#fff; }
.dashboard-view > .kpi-grid .kpi[style*="red-lt"] { background:#FDEBEC !important; }
.dashboard-view > .kpi-grid .kpi[style*="green-lt"] { background:#E8F5EC !important; }
.dashboard-view > .kpi-grid .kpi[style*="purple-lt"] { background:#F4EAFE !important; }
.dashboard-view .kpi-val { font-size:30px !important; }
.dashboard-view .kpi-sub { font-size:14px !important; }
.dashboard-view .card > div[style*="font-size:13px"],
.dashboard-view .card > div[style*="font-size:12.5px"] { font-size:17px !important; color:#16325C !important; }
.dashboard-view .card .tl-action { font-size:15px; }
.dashboard-view .card .tl-meta { font-size:13px; }
.dashboard-view .card { font-size:15px; }
.dashboard-view .monthly-chart { height:300px; }
.dashboard-view > div[style*="grid-template-columns:1fr minmax"] .card { min-height:390px; }
.dashboard-view > div[style*="grid-template-columns:minmax(0,200px)"] .card { min-height:300px; }
.totals-bar { border-radius: 12px; padding: 15px 20px; box-shadow: var(--shadow); }

@media (max-width: 900px) {
  .sidebar { width: 210px; min-width: 210px; }
  .content-main { padding: 20px; }
}

@media (max-width: 700px) {
  .sidebar { width: 100%; min-width: 0; }
  .sb-brand { padding: 16px; }
  .nav-item { margin: 2px; padding: 10px; }
  .topbar { padding: 0 16px; }
  .content-main { padding: 16px 12px 26px; }
  .card, .form-card { padding: 18px; }
  .kpi { padding: 16px; }
  .kpi-val { font-size: 20px; }
  .dashboard-intro { align-items:flex-start; flex-direction:column; margin-bottom:16px; }
  .dashboard-intro h1 { font-size:26px; }
  .dashboard-intro p { font-size:14px; }
  .dashboard-date { align-self:flex-start; }
  .dashboard-view > .kpi-grid { grid-template-columns:1fr !important; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .sidebar { width: 190px; min-width: 190px; position: sticky; top: 0; height: 100vh; }
  .content-main { padding: 14px 16px 22px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-panel { width: 300px; min-width: 300px; }
}

@media (max-width: 700px) {
  body { display: block; }
  .sidebar { width: 100%; min-width: 0; height: auto; position: relative; }
  .sb-user, .sb-footer { display: none; }
  .sb-brand { padding: 13px 16px; }
  .nav-sec { display: flex; align-items: center; gap: 2px; padding: 4px 8px; overflow-x: auto; }
  .nav-lbl { display: none; }
  .nav-item { padding: 9px 11px; border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
  .nav-item.active { border-bottom-color: var(--accent); }
  .main { height: auto; min-height: calc(100vh - 55px); }
  .topbar { height: 52px; padding: 0 14px; }
  .tb-crumb, .tb-sep { display: none; }
  .content-main { padding: 14px 12px 22px; overflow: visible; }
  .page-head { align-items: flex-start; gap: 10px; flex-wrap: wrap; }
  .form-grid-2, .form-grid-3, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-card, .card { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 12px; }
  .kpi-val { font-size: 16px; }
  .table-toolbar { align-items: stretch; }
  .search-box { max-width: none; min-width: 100%; }
  .row-count { width: 100%; margin-left: 0; }
  .totals-bar { gap: 14px; padding: 12px; }
  .t-actions { width: 100%; margin-left: 0; }
  .t-actions .btn { flex: 1; justify-content: center; }
  .login-card { width: min(92vw, 400px); padding: 28px 24px; }
  .monthly-chart { height: 220px; }
  .dashboard-view { max-width:none; }
  .dashboard-view .monthly-chart { height:240px; }
}
