:root { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #0f1f3d; background: #f7f9fc; }
* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; cursor: pointer; border-radius: 7px; border: 1px solid #dbe3ea; background: white; color: #334155; padding: 8px 10px; }
button.danger { color: #b91c1c; border-color: #fecaca; background: #fff7f7; }
button.danger:hover { background: #fee2e2; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 276px minmax(0, 1fr); }
.sidebar { background: rgba(255,255,255,.92); border-right: 1px solid #dbe3ea; padding: 22px 16px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; box-shadow: 10px 0 35px rgba(15, 31, 61, .04); }
.brand { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid #e5ebf0; }
.mark { width: 42px; height: 42px; border-radius: 8px; background: #0f766e; color: white; display: grid; place-items: center; font-weight: 800; }
.brand strong { display: block; font-size: 15px; }
.brand span, .secure, header p, small, .steps span { color: #64748b; font-size: 12px; }
nav { display: grid; gap: 5px; }
nav button { text-align: left; border: 0; padding: 11px 10px; background: transparent; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
nav button.active, nav button:hover { background: #e7f5f3; color: #0f766e; }
.nav-badge { min-width: 24px; border-radius: 999px; padding: 2px 7px; background: #e7f5f3; color: #0f766e; font-size: 11px; font-weight: 800; text-align: center; }
.sidebar-status { display: grid; gap: 6px; border: 1px solid #e5ebf0; border-radius: 8px; padding: 8px; background: #fbfdff; }
.sidebar-status div { display: grid; grid-template-columns: auto 1fr 30px; align-items: center; gap: 8px; min-height: 32px; }
.sidebar-status strong { font-size: 12px; font-weight: 750; color: #334155; }
.sidebar-status button { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; border-radius: 7px; color: #0f766e; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; box-shadow: 0 0 0 3px #f1f5f9; }
.dot.ready { background: #0f766e; box-shadow: 0 0 0 3px #dff5f2; }
.dot.pending { background: #d97706; box-shadow: 0 0 0 3px #fff0d9; }
.dot.error { background: #dc2626; box-shadow: 0 0 0 3px #fee2e2; }
.secure { margin-top: auto; border: 1px solid #dbe3ea; border-radius: 8px; padding: 12px; color: #0f766e; }
main { padding: 22px 24px; min-width: 0; }
header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; border-bottom: 1px solid #e6edf5; padding-bottom: 16px; }
h1, h2, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.15; }
h2 { font-size: 17px; }
.top-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.connection { border: 1px solid #f2c46d; color: #b45309; background: white; border-radius: 8px; padding: 10px 12px; font-size: 13px; white-space: nowrap; }
.connection.ready { color: #0f766e; border-color: #99d5cc; }
.updated-at { color: #64748b; font-size: 11px; text-align: right; }
.updated-at span, .updated-at strong { display: block; }
.toast { background: #0f766e; color: white; border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; font-size: 13px; }
.hidden { display: none; }
.steps, .stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.steps article, .stats article, .panel { background: rgba(255,255,255,.96); border: 1px solid #dbe3ea; border-radius: 8px; padding: 16px; box-shadow: 0 8px 24px rgba(15, 31, 61, .035); }
.steps article { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.steps span { grid-column: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps button { grid-column: 2; grid-row: 1 / 3; font-size: 12px; }
.stats article { min-height: 118px; position: relative; padding-left: 82px; }
.stats article strong { display: block; margin: 7px 0; font-size: 24px; color: #0f172a; }
.stats article span { color: #0f172a; font-size: 13px; font-weight: 750; }
.stat-icon { position: absolute; left: 16px; top: 20px; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: #dff5f2; color: #0f766e; font-weight: 900; font-size: 18px; }
.stat-icon.green { background: #def7ec; color: #047857; }
.stat-icon.blue { background: #e0edff; color: #0f3f83; }
.stat-icon.orange { background: #fff0d9; color: #b45309; }
.grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(310px, .8fr); gap: 16px; margin-bottom: 16px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(370px, .75fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.dashboard-grid #transactionsPreviewPanel { grid-row: span 2; }
.panel { min-width: 0; margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.filter-bar { display: grid; grid-template-columns: minmax(180px, 280px) auto 1fr; align-items: end; gap: 10px; margin: 0 0 12px; }
.filter-bar label { display: grid; gap: 5px; color: #64748b; font-size: 12px; font-weight: 700; }
.filter-bar button { min-height: 41px; }
.filter-bar span { color: #64748b; font-weight: 700; padding-bottom: 10px; }
.subhead { margin: 18px 0 10px; font-size: 15px; }
.bars { min-height: 220px; display: flex; align-items: end; gap: 8px; border: 1px solid #eef2f5; border-radius: 8px; padding: 28px 14px 30px; }
.bars.compact { min-height: 170px; }
.bars { flex-direction: column; align-items: stretch; justify-content: end; }
.bar-chart { min-height: 190px; display: flex; align-items: end; gap: 8px; padding-top: 20px; }
.bars.compact .bar-chart { min-height: 140px; }
.bar-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: #64748b; }
.bar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.bar-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.stacked-bar { flex: 1; min-width: 10px; position: relative; display: flex; align-items: end; }
.bar-stack { width: 100%; height: 100%; display: flex; flex-direction: column-reverse; border-radius: 5px 5px 0 0; overflow: hidden; background: #eef2f5; }
.bar-segment { width: 100%; min-height: 3px; }
.stacked-bar span { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); color: #64748b; font-size: 10px; }
.stacked-bar b { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); color: #334155; font-size: 10px; font-weight: 700; white-space: nowrap; }
.ribbon-wrap { width: 100%; overflow-x: auto; }
.ribbon-wrap svg { width: 100%; min-width: 620px; height: 220px; display: block; }
.bars.compact .ribbon-wrap svg { height: 170px; }
.ribbon-grid { stroke: #e5ebf0; stroke-width: 1; }
.ribbon-label { fill: #64748b; font-size: 11px; }
.ribbon-type { fill: #334155; font-size: 10px; font-weight: 700; }
.ribbon-value { fill: white; font-size: 9px; font-weight: 800; pointer-events: none; }
.ribbon-total { fill: #334155; font-size: 11px; font-weight: 700; }
.bar { flex: 1; min-width: 10px; background: #0f766e; border-radius: 5px 5px 0 0; position: relative; }
.bar.forecast { background: #d97706; }
.bar span { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); color: #64748b; font-size: 10px; }
.bar b { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); color: #334155; font-size: 10px; font-weight: 700; white-space: nowrap; }
.rank, .audit { display: grid; gap: 10px; }
.rank div, .audit div { border-bottom: 1px solid #eef2f5; padding-bottom: 10px; font-size: 13px; }
.rank div { display: flex; justify-content: space-between; gap: 12px; }
.rank strong { color: #b45309; }
#forecastRows div { display: grid; grid-template-columns: 1fr auto; }
#forecastRows small { grid-column: 1 / -1; color: #64748b; font-size: 11px; }
.audit b { display: block; color: #0f766e; font-size: 12px; }
.installment-list { display: grid; gap: 10px; max-height: 390px; overflow: auto; padding-right: 4px; }
.installment-list div { border-bottom: 1px solid #eef2f5; padding-bottom: 10px; }
.installment-list strong { display: block; font-size: 13px; }
.installment-list span, .installment-list small { display: block; color: #64748b; font-size: 12px; margin-top: 2px; }
.settings-list { display: grid; gap: 8px; }
.settings-list div { display: grid; grid-template-columns: minmax(190px, .35fr) 1fr; gap: 14px; border-bottom: 1px solid #eef2f5; padding: 9px 0; font-size: 13px; }
.settings-list span { color: #64748b; }
.settings-list strong { overflow-wrap: anywhere; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
input, select { width: 100%; border: 1px solid #dbe3ea; border-radius: 7px; padding: 9px 10px; font: inherit; color: #172033; background: white; }
select:disabled { color: #94a3b8; background: #f8fafc; }
.form-status { color: #64748b; font-size: 12px; margin: -6px 0 12px; }
.form-status.busy { color: #0f766e; font-weight: 700; }
.form-status.error { color: #dc2626; font-weight: 700; }
.compact-table table { min-width: 760px; }
.proposal-table { min-width: 1180px; }
.proposal-table input, .proposal-table select { min-width: 120px; }
.table-wrap { overflow-x: auto; border: 1px solid #e5ebf0; border-radius: 8px; }
table { width: 100%; min-width: 980px; border-collapse: collapse; }
.dashboard-table table { min-width: 720px; }
th, td { text-align: left; padding: 12px 13px; border-bottom: 1px solid #e5ebf0; font-size: 13px; vertical-align: middle; }
th { background: #f8fafc; color: #64748b; font-size: 12px; }
.filter-row th { background: white; padding: 7px 8px; }
.filter-row input { min-width: 98px; padding: 7px 8px; font-size: 12px; }
.group-row td { background: #eefaf8; color: #0f766e; font-weight: 800; font-size: 12px; letter-spacing: 0; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover, th.sorted { color: #0f766e; background: #eefaf8; }
.sort-indicator { display: inline-block; width: 12px; color: #0f766e; font-weight: 800; }
td strong { display: block; }
td span { display: block; color: #64748b; font-size: 12px; margin-top: 2px; }
.action-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.credit { color: #0f766e; font-weight: 700; }
.debit { color: #dc2626; font-weight: 700; }
.tag { display: inline-flex; border-radius: 999px; padding: 4px 8px; background: #e7f5f3; color: #0f766e; font-weight: 700; }
.status-pill { display: inline-flex; align-items: center; border: 1px solid #dbe3ea; border-radius: 999px; padding: 4px 8px; color: #475569; font-size: 12px; }
.status-pill.candidate { color: #0f766e; border-color: #99d5cc; background: #e7f5f3; font-weight: 700; }
[data-view] { display: none !important; }
[data-view].view-visible { display: block !important; }
.steps.view-visible, .stats.view-visible, .grid.view-visible, .dashboard-grid.view-visible { display: grid !important; }
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .38); display: grid; place-items: center; padding: 20px; z-index: 20; }
.modal.hidden { display: none !important; }
.modal-card { width: min(560px, 100%); display: grid; gap: 12px; background: white; border: 1px solid #dbe3ea; border-radius: 8px; padding: 18px; box-shadow: 0 30px 80px rgba(15, 23, 42, .18); }
.modal-card label { display: grid; gap: 5px; font-size: 12px; color: #64748b; font-weight: 700; }
.check-row { display: flex !important; align-items: center; gap: 8px; color: #172033 !important; }
.check-row input { width: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 1120px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: static; border-right: 0; border-bottom: 1px solid #dbe3ea; }
  nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .secure { display: none; }
  .steps, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar { grid-template-columns: 1fr; align-items: stretch; }
  .filter-bar span { padding-bottom: 0; }
  .grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  main { padding: 16px; }
  header { flex-direction: column; }
  .stats article { padding-left: 16px; padding-top: 78px; }
  .steps, .stats, nav, .form-grid, .settings-list { grid-template-columns: 1fr; }
}
