:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #0f172a;
  --ink-2: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #064e3b;
  --primary-dark: #022c22;
  --accent: #059669;
  --accent-light: #10b981;
  --accent-tint: #ecfdf5;
  --danger: #be123c;
  --danger-tint: #fff1f2;
  --warn: #b45309;
  --warn-tint: #fffbeb;
  --info: #0369a1;
  --info-tint: #f0f9ff;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 13.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
a { color: inherit; text-decoration: none; }

.boot { min-height: 100dvh; display: grid; place-items: center; font-weight: 700; color: var(--muted); }

/* Login Layout */
.login-layout { min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-story { background: linear-gradient(155deg, #022c22 0%, #064e3b 60%, #0f172a 100%); color: #fff; padding: clamp(32px, 5vw, 72px); display: flex; flex-direction: column; justify-content: space-between; gap: 36px; }
.wordmark { font-size: 24px; font-weight: 900; letter-spacing: -1px; color: #fff; }
.wordmark span { color: #34d399; }
.wordmark small { display: block; font-size: 9px; letter-spacing: 2px; font-weight: 600; color: #a7f3d0; margin-top: 4px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 1.6px; color: #6ee7b7; text-transform: uppercase; margin-bottom: 12px; }
.login-story h1 { font-size: clamp(28px, 3.2vw, 44px); line-height: 1.1; letter-spacing: -1.2px; margin-bottom: 14px; max-width: 520px; }
.login-story p { color: #d1fae5; max-width: 460px; font-size: 14.5px; }
.subtle-link { color: #a7f3d0; font-size: 12.5px; font-weight: 600; }
.login-panel { background: #fff; display: grid; place-items: center; padding: 32px 24px; }
.login-box { width: 100%; max-width: 410px; display: grid; gap: 18px; }
.demo-fast-box { background: linear-gradient(145deg, #ecfdf5, #f0fdf4); border: 1.5px solid #6ee7b7; border-radius: 14px; padding: 18px; display: grid; gap: 8px; box-shadow: 0 14px 28px -18px rgba(5, 150, 105, .45); }
.demo-fast-box strong { font-size: 15px; color: #064e3b; }
.demo-fast-box p { font-size: 12.5px; color: #334155; }
.demo-fast-btn { background: linear-gradient(135deg, #059669, #047857); color: #fff; border: 0; border-radius: 10px; padding: 13px 16px; font-weight: 800; font-size: 13.5px; box-shadow: 0 10px 20px -10px rgba(5, 150, 105, .7); }
.login-sep { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.login-sep::before, .login-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#login-form { display: grid; gap: 12px; }
label { display: grid; gap: 5px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
input, select, textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 9px; padding: 9px 12px; background: #fff; color: var(--ink); min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
#login-error { color: var(--danger); font-weight: 600; font-size: 12.5px; }

/* Shell */
.fin-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100dvh; }
.fin-sidebar { background: linear-gradient(180deg, #022c22 0%, #064e3b 100%); color: #fff; position: sticky; top: 0; height: 100dvh; padding: 22px 16px; display: flex; flex-direction: column; gap: 20px; border-right: 1px solid rgba(255,255,255,.1); }
.fin-brand { display: grid; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid rgba(255,255,255,.14); }
.fin-suite-tag { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.08); padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.14); }
.fin-suite-ico { font-size: 20px; width: 36px; height: 36px; border-radius: 9px; background: rgba(16, 185, 129, .25); display: grid; place-items: center; }
.fin-suite-tag strong { display: block; font-size: 14px; line-height: 1.2; }
.fin-suite-tag small { font-size: 11px; color: #a7f3d0; }

.fin-nav { display: grid; gap: 5px; overflow-y: auto; }
.fin-nav button { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 11px; border: 1px solid transparent; background: transparent; color: #d1fae5; transition: all .15s; }
.fin-nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.fin-nav button[aria-current="page"] { background: #fff; color: #022c22; box-shadow: 0 10px 20px -10px rgba(0,0,0,.45); }
.fin-nav button > span { font-size: 17px; width: 24px; text-align: center; flex-shrink: 0; }
.fin-nav button div { flex: 1; min-width: 0; position: relative; }
.fin-nav button strong { display: block; font-size: 13px; font-weight: 750; }
.fin-nav button small { display: block; font-size: 10.5px; opacity: .78; }
.nav-badge { position: absolute; right: 0; top: 2px; font-style: normal; font-size: 10px; font-weight: 800; background: #e11d48; color: #fff; padding: 1px 7px; border-radius: 999px; }

.fin-sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.14); display: grid; gap: 10px; font-size: 11.5px; }
.fin-sidebar-foot label { color: #a7f3d0; font-size: 11px; }
.fin-sidebar-foot select { background: rgba(0,0,0,.25); color: #fff; border-color: rgba(255,255,255,.22); min-height: 36px; font-size: 12px; }
.fin-sidebar-foot select option { color: var(--ink); background: #fff; }
.fin-foot-links { display: flex; justify-content: space-between; align-items: center; }
.fin-foot-links a, .fin-foot-links button { color: #d1fae5; background: none; border: 0; font-size: 12px; font-weight: 600; padding: 4px 0; }
.fin-foot-links button:hover, .fin-foot-links a:hover { color: #fff; text-decoration: underline; }

/* Main & Topbar */
.fin-main { min-width: 0; display: flex; flex-direction: column; }
.fin-topbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 13px 28px; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; position: sticky; top: 0; z-index: 20; }
.fin-topbar-left, .fin-topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.today-text { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: capitalize; }
.demo-pill { background: #dcfce7; color: #065f46; border: 1px solid #86efac; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.rate-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-soft); border: 1px solid var(--line); padding: 4px 10px; border-radius: 9px; font-size: 11.5px; font-weight: 700; }
.rate-pill input { width: 72px; min-height: 28px; padding: 2px 6px; font-weight: 800; text-align: right; border-radius: 6px; }
.user-text { font-size: 12px; font-weight: 600; color: var(--muted); }

/* Buttons */
.btn-primary, .btn-accent, .btn-danger, .btn-outline, .btn-warn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 9px; padding: 9px 15px; font-weight: 700; font-size: 12.5px; border: 1px solid transparent; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.06); }
.btn-danger { background: var(--danger-tint); color: var(--danger); border-color: #fecdd3; }
.btn-danger:hover { background: #ffe4e6; }
.btn-warn { background: var(--warn-tint); color: var(--warn); border-color: #fde68a; }
.btn-outline { background: #fff; color: var(--ink-2); border-color: #cbd5e1; }
.btn-outline:hover { background: var(--surface-soft); border-color: #94a3b8; }
.btn-sm { padding: 6px 11px; font-size: 11.5px; border-radius: 8px; }
.btn-xs { padding: 4px 9px; font-size: 11px; border-radius: 7px; }

.notice { margin: 16px 28px 0; padding: 12px 16px; border-radius: 10px; background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46; font-weight: 600; }
.notice.error { background: var(--danger-tint); border-color: #fda4af; color: var(--danger); }

.fin-content { padding: 24px 28px 40px; display: grid; gap: 22px; max-width: 1480px; }

/* Section Header Banner */
.view-header { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.view-header .kicker { font-size: 10.5px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.view-header h1 { font-size: 22px; font-weight: 850; letter-spacing: -.5px; }
.view-header p { color: var(--muted); font-size: 13px; margin-top: 4px; max-width: 680px; }
.view-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* KPI Grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.kpi-card { background: var(--surface); border: 1px solid var(--line); border-top: 3.5px solid var(--accent); border-radius: 14px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(15,23,42,.04); display: grid; gap: 4px; }
.kpi-card.kpi-danger { border-top-color: var(--danger); }
.kpi-card.kpi-warn { border-top-color: #f59e0b; }
.kpi-card.kpi-info { border-top-color: #0284c7; }
.kpi-card.kpi-dark { background: linear-gradient(145deg, #064e3b, #022c22); color: #fff; border-color: #064e3b; }
.kpi-card span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.kpi-card.kpi-dark span, .kpi-card.kpi-dark small { color: #a7f3d0; }
.kpi-card strong { font-size: 24px; font-weight: 850; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.kpi-card small { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Split Cards & Panels */
.grid-2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; align-items: start; }
.grid-equal { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.card-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 15.5px; font-weight: 800; }
.panel-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.panel-filters { padding: 12px 20px; background: var(--surface-soft); border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.panel-filters label { flex: 1; min-width: 150px; }
.panel-filters input, .panel-filters select { min-height: 36px; padding: 6px 10px; font-size: 12.5px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12.5px; }
th { background: #f8fafc; color: #475569; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr:hover { background: #f8fafc; }
td small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* Badges */
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.status-badge.pagada, .status-badge.al_dia, .status-badge.liquidado, .status-badge.disponible, .status-badge.ingreso, .status-badge.activo, .status-badge.activa { background: #dcfce7; color: #065f46; }
.status-badge.vencida, .status-badge.mora, .status-badge.agotado, .status-badge.egreso, .status-badge.anulado { background: #ffe4e6; color: #9f1239; }
.status-badge.pendiente, .status-badge.aprobado { background: #e0f2fe; color: #075985; }
.status-badge.parcial, .status-badge.bajo { background: #fef3c7; color: #92400e; }

/* Progress Bar */
.prog-bar { width: 100%; max-width: 140px; height: 7px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin: 4px 0; }
.prog-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* Category & Plan Cards */
.cat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; padding: 18px 20px; }
.cat-card { border: 1px solid var(--line); border-radius: 13px; padding: 16px; background: var(--surface-soft); display: grid; gap: 8px; }
.cat-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cat-card strong { font-size: 14.5px; }
.cat-card p { font-size: 12px; color: var(--muted); }
.cat-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; font-weight: 700; color: var(--primary); }
.cat-meta span { background: #ecfdf5; border: 1px solid #a7f3d0; padding: 2px 8px; border-radius: 6px; }

/* Dialog / Modal */
.fin-dialog { border: 1px solid var(--line); border-radius: 18px; width: min(820px, 95vw); max-height: 92dvh; padding: 0; box-shadow: 0 30px 90px -20px rgba(15, 23, 42, .45); color: var(--ink); }
.fin-dialog::backdrop { background: rgba(15, 23, 42, .5); backdrop-filter: blur(4px); }
.dialog-head { padding: 18px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 5; }
.dialog-head h2 { font-size: 17px; font-weight: 850; }
.icon-close { border: 1px solid var(--line); background: #fff; width: 34px; height: 34px; border-radius: 8px; font-size: 20px; }
.dialog-body { padding: 22px 24px; display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.form-err { color: var(--danger); background: var(--danger-tint); padding: 10px 12px; border-radius: 8px; font-weight: 600; font-size: 12px; }
.form-err:empty { display: none; }
.calc-summary-box { background: #ecfdf5; border: 1.5px solid #6ee7b7; border-radius: 12px; padding: 14px 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.calc-summary-box small { display: block; font-size: 11px; color: #065f46; font-weight: 600; }
.calc-summary-box strong { display: block; font-size: 17px; color: #022c22; font-weight: 850; }
.calc-summary-box span { font-size: 11px; color: #047857; }
.check-inline { display: flex !important; align-items: center; gap: 10px; background: var(--surface-soft); border: 1px solid var(--line); padding: 10px 14px; border-radius: 10px; cursor: pointer; }
.check-inline input { width: 18px; height: 18px; min-height: 0; margin: 0; }

/* Receipt Box */
.receipt-box { border: 2px dashed #94a3b8; border-radius: 14px; padding: 22px; background: #fff; display: grid; gap: 14px; }
.receipt-top { display: flex; justify-content: space-between; align-items: start; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.receipt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 12.5px; }
.receipt-grid div { background: var(--surface-soft); padding: 10px 12px; border-radius: 8px; }
.receipt-grid small { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; font-weight: 700; }

@media (max-width: 980px) {
  .fin-shell { grid-template-columns: 1fr; }
  .fin-sidebar { position: relative; height: auto; }
  .fin-nav { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .fin-nav button { width: auto; flex-shrink: 0; }
  .grid-2, .grid-equal, .form-grid, .form-grid-3, .calc-summary-box { grid-template-columns: 1fr; }
  .login-layout { grid-template-columns: 1fr; }
  .fin-content { padding: 16px; }
}

@media print {
  body * { visibility: hidden; }
  #dialog, #dialog * { visibility: visible; }
  #dialog { position: absolute; inset: 0; width: 100%; max-height: none; border: 0; box-shadow: none; }
  .dialog-head button, .form-actions, .no-print { display: none !important; }
}

/* ===== VNZLAPP Financiamiento 360: Visual Analytics, Scoring, Closing & Jelly Spring ===== */
:root {
  --jelly-spring: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%, 1.003 76.9%, 1.004 83.8%, 1);
}
@supports not (animation-timing-function: linear(0, 1)) {
  :root { --jelly-spring: cubic-bezier(0.34, 1.56, 0.64, 1); }
}

.kpi-card, .card-panel, .fin-nav button, .btn-primary, .btn-accent, .btn-outline, .method-card {
  transition: transform 0.55s var(--jelly-spring), box-shadow 0.25s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.kpi-card:hover { transform: translateY(-4px) scale(1.015); box-shadow: 0 22px 38px -18px rgba(6, 78, 59, 0.28); }
.btn-primary:hover, .btn-accent:hover { transform: translateY(-2px) scale(1.03); }
.btn-primary:active, .btn-accent:active, .btn-outline:active { transform: scale(0.95, 1.04); }

.analytics-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.analytics-card { padding: 20px 22px; }
.analytics-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.analytics-head h3 { margin: 2px 0 0; font-size: 16px; color: #0f172a; }
.donut-layout { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-svg { width: 112px; height: 112px; flex-shrink: 0; }
.donut-val { font-size: 20px; font-weight: 800; fill: #064e3b; }
.donut-lbl { font-size: 10px; font-weight: 700; fill: #64748b; text-transform: uppercase; }
.donut-legend { flex: 1; min-width: 160px; display: grid; gap: 10px; }
.donut-legend > div { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #334155; }
.donut-legend i { width: 10px; height: 10px; border-radius: 999px; flex-shrink: 0; }
.donut-legend strong { margin-left: auto; color: #0f172a; font-variant-numeric: tabular-nums; }

.flow-bars { display: grid; gap: 14px; }
.flow-row { display: grid; gap: 6px; }
.flow-lbl { display: flex; justify-content: space-between; font-size: 13px; color: #334155; }
.flow-lbl strong { color: #0f172a; font-variant-numeric: tabular-nums; }
.bar-track { width: 100%; height: 10px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 999px; transition: width 0.6s var(--jelly-spring); }
.bar-in { background: linear-gradient(90deg, #10b981, #059669); }
.bar-out { background: linear-gradient(90deg, #f59e0b, #ea580c); }
.flow-summary {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding-top: 10px; border-top: 1px solid #e2e8f0; font-size: 12.5px; color: #475569;
}
.pos { color: #059669; font-weight: 700; }
.neg { color: #e11d48; font-weight: 700; }

.score-pill {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.02em;
}
.score-a { background: #dcfce7; color: #065f46; border: 1px solid #86efac; }
.score-b { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.score-c { background: #ffe4e6; color: #9f1239; border: 1px solid #fda4af; }

.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 18px 22px 22px;
}
.method-card {
  background: linear-gradient(150deg, #ffffff, #f8fafc);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  display: grid;
  gap: 8px;
}
.method-card:hover { transform: translateY(-3px) scale(1.02); border-color: #10b981; box-shadow: 0 16px 30px -16px rgba(5, 150, 105, 0.3); }
.method-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #0f172a; }
.method-top span { font-size: 11px; color: #64748b; background: #f1f5f9; padding: 2px 8px; border-radius: 999px; font-weight: 700; }
.method-net { font-size: 22px; font-weight: 850; color: #064e3b; font-variant-numeric: tabular-nums; }
.method-net small { display: block; font-size: 11.5px; font-weight: 600; color: #64748b; margin-top: 2px; }
.method-split { display: flex; justify-content: space-between; font-size: 12px; padding-top: 8px; border-top: 1px dashed #e2e8f0; }

@media (max-width: 900px) { .analytics-strip { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  .kpi-card, .card-panel, .fin-nav button, .btn-primary, .btn-accent, .btn-outline, .method-card { transition: none; }
}


/* ===== VNZLAPP Financiamiento 3.0: True Mobile-First App Shell, Global Search & Balanced Grids ===== */
html, body { max-width: 100%; overflow-x: clip; }
.fin-shell, .fin-main, .fin-content, .card-panel, .analytics-card, .view-header { min-width: 0; max-width: 100%; }

/* Balanced 3x2 KPI Grid on Desktop, 2-col on Tablet/Mobile */
.kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1080px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 440px)  { .kpi-grid { grid-template-columns: 1fr; } }

/* Topbar Global Search & Live BCV Sync */
.fin-topbar { padding: 11px 22px; gap: 12px; }
.fin-topbar-search { position: relative; flex: 1 1 220px; max-width: 340px; min-width: 160px; }
.fin-topbar-search input { min-height: 36px; padding: 6px 12px; font-size: 12.5px; border-radius: 999px; background: var(--surface-soft); }
.gsearch-pop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 90;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 24px 48px -18px rgba(15, 23, 42, 0.35); overflow: hidden; max-height: 360px; overflow-y: auto;
}
.gsearch-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; text-align: left; padding: 10px 14px; border: 0; border-bottom: 1px solid #f1f5f9; background: #fff;
}
.gsearch-item:hover { background: var(--accent-tint); }
.gsearch-item strong { display: block; font-size: 12.5px; color: var(--ink); }
.gsearch-item small { display: block; font-size: 11px; color: var(--muted); }
.gsearch-empty { padding: 14px; font-size: 12px; color: var(--muted); text-align: center; }

.rate-group { display: inline-flex; align-items: center; gap: 6px; }
.mobile-menu-btn {
  display: none; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 18px; align-items: center; justify-content: center; flex-shrink: 0;
}
.mobile-title { display: none; font-size: 15px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 165px; }
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 75; background: rgba(10, 15, 12, 0.52);
  backdrop-filter: blur(4px);
}
.fin-bottom-nav { display: none; }
.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.empty-cell { text-align: center; padding: 28px 16px; color: var(--muted); font-size: 13px; }
.period-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.period-pill { padding: 5px 11px; border-radius: 999px; border: 1px solid #cbd5e1; background: #fff; font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.period-pill.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

@media (max-width: 980px) {
  .fin-shell { display: block !important; width: 100%; }
  .fin-sidebar {
    position: fixed !important; inset: 0 auto 0 0; width: min(290px, 84vw); height: 100dvh !important;
    z-index: 80; transform: translateX(-105%); transition: transform 0.28s ease;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.45); overflow-y: auto;
  }
  .fin-shell.drawer-open .fin-sidebar { transform: translateX(0); }
  .fin-nav { display: grid !important; overflow-x: visible !important; }
  .fin-nav button { width: 100% !important; }
  .mobile-menu-btn { display: inline-flex; }
  .mobile-title { display: inline-block; }
  .today-text, .hide-sm { display: none !important; }
  .fin-topbar { padding: 10px 14px; gap: 8px; }
  .fin-topbar-search { order: 3; flex: 1 1 100%; max-width: none; }
  .fin-content { padding: 14px 14px calc(86px + env(safe-area-inset-bottom)); gap: 14px; }
  .view-header { padding: 16px; border-radius: 14px; }
  .view-header h1 { font-size: 18.5px; }
  .kpi-card { padding: 14px; }
  .kpi-card strong { font-size: 20px; }
  .notice { margin: 10px 14px 0; }
  .panel-head { padding: 14px 16px; }
  .panel-filters { padding: 12px 14px; }
  th, td { padding: 10px 12px; font-size: 12px; }
  .fin-dialog { width: 96vw; max-height: 92dvh; border-radius: 16px; }
  .dialog-head { padding: 14px 16px; }
  .dialog-body { padding: 16px; }
  .receipt-grid { grid-template-columns: 1fr; }

  /* Sticky Native Bottom Nav Bar */
  .fin-bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 65;
    background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 28px -14px rgba(15, 23, 42, 0.25);
  }
  .fin-bottom-nav button {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: transparent; border: 0; color: var(--muted); padding: 4px 2px; font-weight: 700;
  }
  .fin-bottom-nav button span { font-size: 18px; line-height: 1.1; }
  .fin-bottom-nav button small { font-size: 10px; line-height: 1.1; }
  .fin-bottom-nav button[aria-current="page"] { color: var(--primary); }
  .fin-bottom-nav button[aria-current="page"] small { font-weight: 800; }
  .bnav-badge {
    position: absolute; top: 0; right: 16%; font-style: normal;
    background: #e11d48; color: #fff; font-size: 9.5px; font-weight: 800;
    min-width: 17px; height: 17px; border-radius: 999px; display: grid; place-items: center; padding: 0 4px;
  }
}
@media (max-width: 520px) {
  .hide-xs { display: none !important; }
  .rate-pill span { display: none; }
  .rate-pill input { width: 64px; font-size: 11.5px; }
}
