/* Loan Pricing and Syndication Workbench — main stylesheet v1.0.0
 * Design language: Subly light dashboard (white cards, black left icon rail,
 * pill top nav, big KPIs) + Finor dark-navy shell (ticker strip, big figures,
 * donut / distribution bars) — blended, NOT 1:1, in the Erthiox palette.
 * Erthiox: navy #111622 / #0B2239, gold #C5A880 / #B89047, cream #FCFBF9,
 * slate #5A606C. Tool accents: syndicate teal #0F766E, placed green #1E7A46,
 * alert red #B3261E, amber #8A6D3B. */
:root{
  --navy:#0B2239; --navy-900:#111622; --teal:#0F766E; --teal-900:#0F4F4A;
  --gold:#C5A880; --gold-dark:#B89047; --cream:#FCFBF9; --slate:#5A606C;
  --ink:#1A2332; --muted:#44536A; --surface:#F2F4F7; --border:#B9C2CF;
  --line:#E8E5DF; --green:#1E7A46; --red:#B3261E; --amber:#8A6D3B;
  --card:#FFFFFF; --radius:16px; --radius-sm:10px;
  --shadow:0 1px 2px rgba(17,22,34,.06),0 8px 24px rgba(17,22,34,.07);
  --font-body:'Inter',system-ui,-apple-system,'Segoe UI',sans-serif;
  --font-head:'Outfit','Inter',system-ui,sans-serif;
}
*{box-sizing:border-box}
html{scrollbar-color:#B89047 #F1EFEA;scrollbar-width:thin}
body{margin:0;font-family:var(--font-body);background:var(--cream);color:var(--ink);font-size:15px;line-height:1.5;-webkit-font-smoothing:antialiased}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:#F1EFEA}
::-webkit-scrollbar-thumb{background:#C5A880;border-radius:8px;border:2px solid #F1EFEA}
::-webkit-scrollbar-thumb:hover{background:#B89047}
h1,h2,h3,h4{font-family:var(--font-head);color:var(--navy);margin:0 0 8px}
h1{font-size:26px;line-height:1.2} h2{font-size:20px} h3{font-size:16px}
p{margin:0 0 10px} a{color:var(--teal-900);text-decoration:none}
a:hover{text-decoration:underline}
button{font-family:inherit;cursor:pointer}
input,textarea{font-family:inherit;font-size:15px}
:focus-visible{outline:2px solid var(--teal);outline-offset:2px}
.num{font-variant-numeric:tabular-nums}
.muted{color:var(--slate)} .small{font-size:13px} .tiny{font-size:12px}
.gold{color:var(--gold-dark)} .teal{color:var(--teal)} .red{color:var(--red)} .green{color:var(--green)} .amber{color:var(--amber)}
.hidden{display:none!important}

/* ---------- Auth screen ---------- */
.auth-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;background:linear-gradient(160deg,#0B2239 0%,#111622 55%,#0F4F4A 100%)}
.auth-card{background:#fff;border-radius:20px;box-shadow:0 24px 64px rgba(0,0,0,.35);max-width:960px;width:100%;display:grid;grid-template-columns:1.05fr 1fr;overflow:hidden}
.auth-hero{background:var(--navy);color:#fff;padding:36px 32px;display:flex;flex-direction:column;gap:14px}
.auth-hero h1{color:#fff;font-size:28px}
.auth-hero p{color:#C9D2DE}
.auth-hero .stat-row{display:flex;gap:12px;margin-top:8px}
.auth-hero .stat{background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.14);border-radius:12px;padding:12px 14px;flex:1}
.auth-hero .stat b{display:block;font-size:20px;color:var(--gold)}
.auth-hero .stat span{font-size:12px;color:#C9D2DE}
.auth-form{padding:36px 32px}
.tabs{display:flex;background:var(--surface);border-radius:999px;padding:4px;margin-bottom:20px}
.tabs button{flex:1;border:0;background:transparent;padding:9px 12px;border-radius:999px;font-weight:600;color:var(--muted)}
.tabs button.active{background:var(--navy);color:#fff}
.field{margin-bottom:14px}
.field label{display:block;font-size:13px;font-weight:600;color:var(--muted);margin-bottom:5px}
.field input{width:100%;padding:11px 12px;border:1px solid var(--border);border-radius:10px;background:#fff;color:var(--ink)}
.field input:focus{border-color:var(--teal);outline:2px solid rgba(15,118,110,.25)}
.field .hint{font-size:12px;color:var(--slate);margin-top:4px}
.field .err{font-size:12px;color:var(--red);margin-top:4px;display:none}
.field.invalid input{border-color:var(--red)}
.field.invalid .err{display:block}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:0;border-radius:10px;padding:11px 18px;font-weight:600;font-size:15px}
.btn-primary{background:var(--navy);color:#fff}
.btn-primary:hover{background:#16324f}
.btn-gold{background:var(--gold-dark);color:#fff}
.btn-gold:hover{background:#a37c3a}
.btn-teal{background:var(--teal);color:#fff}
.btn-outline{background:#fff;border:1px solid var(--border);color:var(--ink)}
.btn-outline:hover{border-color:var(--navy)}
.btn-ghost{background:transparent;border:0;color:var(--teal-900);font-weight:600}
.btn-block{width:100%}
.btn-sm{padding:7px 12px;font-size:13px;border-radius:8px}
.btn:disabled{opacity:.5;cursor:not-allowed}
.divider{display:flex;align-items:center;gap:12px;color:var(--slate);font-size:13px;margin:18px 0}
.divider::before,.divider::after{content:"";flex:1;height:1px;background:var(--line)}
.kofi{display:flex;align-items:center;gap:10px;background:#FFF7E8;border:1px solid #EAD9B0;border-radius:12px;padding:12px 14px;margin-top:18px;font-size:14px}
.kofi .btn{flex-shrink:0}

/* ---------- App shell: dark rail + cream content ---------- */
.app{display:flex;min-height:100vh}
.rail{width:68px;background:var(--navy-900);display:flex;flex-direction:column;align-items:center;padding:14px 0;gap:6px;position:fixed;top:0;bottom:0;left:0;z-index:40}
.rail .logo{width:44px;height:44px;border-radius:12px;background:#fff;display:flex;align-items:center;justify-content:center;margin-bottom:10px;overflow:hidden}
.rail .logo img{width:40px;height:40px}
.rail button{width:48px;height:48px;border:0;border-radius:12px;background:transparent;color:#9AA7B8;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:18px;position:relative}
.rail button span{font-size:9px;margin-top:2px;font-weight:600}
.rail button:hover{background:rgba(255,255,255,.08);color:#fff}
.rail button.active{background:var(--gold-dark);color:#fff}
.rail .spacer{flex:1}
.main{flex:1;margin-left:68px;min-width:0;display:flex;flex-direction:column}
.topbar{position:sticky;top:0;z-index:30;background:rgba(252,251,249,.96);backdrop-filter:blur(6px);border-bottom:1px solid var(--line);padding:12px 28px;display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.topbar .brand{display:flex;align-items:center;gap:10px;font-family:var(--font-head);font-weight:700;color:var(--navy);font-size:17px}
.topbar .brand img{width:30px;height:30px}
.topbar .brand small{display:block;font-size:11px;color:var(--slate);font-weight:500;font-family:var(--font-body)}
.pillnav{display:flex;background:var(--surface);border-radius:999px;padding:4px;gap:2px;flex-wrap:wrap}
.pillnav button{border:0;background:transparent;padding:7px 14px;border-radius:999px;font-weight:600;font-size:13.5px;color:var(--muted);white-space:nowrap}
.pillnav button.active{background:var(--navy);color:#fff}
.pillnav button:hover:not(.active){color:var(--ink)}
.topbar .right{margin-left:auto;display:flex;align-items:center;gap:10px}
.chip{display:inline-flex;align-items:center;gap:6px;background:#fff;border:1px solid var(--line);border-radius:999px;padding:6px 12px;font-size:12.5px;font-weight:600;color:var(--muted)}
.chip.demo{background:#FFF3D6;border-color:#EAD9B0;color:#7A5A17}
.chip.stale{background:#FDECEA;border-color:#F5C6C2;color:var(--red)}
.avatar{width:36px;height:36px;border-radius:50%;background:var(--teal);color:#fff;border:0;font-weight:700;display:flex;align-items:center;justify-content:center}
.content{padding:24px 28px 64px;max-width:1440px;width:100%;margin:0 auto}

/* Ticker strip (Finor-style) */
.ticker{display:flex;gap:10px;overflow-x:auto;padding:4px 2px 14px;scrollbar-width:none}
.ticker::-webkit-scrollbar{display:none}
.tick{flex:0 0 auto;background:#fff;border:1px solid var(--line);border-radius:12px;padding:10px 14px;min-width:150px}
.tick .t-label{font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--slate)}
.tick .t-val{font-size:18px;font-weight:700;color:var(--navy)}
.tick .t-sub{font-size:12px;color:var(--slate)}
.tick .up{color:var(--green)} .tick .down{color:var(--red)}

/* KPI cards (Subly-style big figures) */
.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:20px}
.kpi{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:18px 20px;box-shadow:var(--shadow)}
.kpi .k-label{font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--slate)}
.kpi .k-val{font-size:30px;font-weight:700;color:var(--navy);font-family:var(--font-head);line-height:1.15;margin-top:4px}
.kpi .k-sub{font-size:13px;color:var(--slate);margin-top:2px}
.kpi .k-bar{height:6px;border-radius:3px;background:var(--surface);margin-top:12px;overflow:hidden}
.kpi .k-bar i{display:block;height:100%;background:linear-gradient(90deg,var(--teal),var(--gold));border-radius:3px}
.kpi.accent{border-top:4px solid var(--gold-dark)}
.kpi.teal{border-top:4px solid var(--teal)}

/* Cards / grids */
.card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:20px 22px;margin-bottom:20px}
.card h2{margin-bottom:4px}
.card .card-sub{color:var(--slate);font-size:13.5px;margin-bottom:14px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:20px}
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}
.grid-2-1{display:grid;grid-template-columns:2fr 1fr;gap:20px}
.grid-1-2{display:grid;grid-template-columns:1fr 2fr;gap:20px}
.row{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.row.between{justify-content:space-between}
.mt{margin-top:16px} .mb{margin-bottom:16px}

/* Tables */
.tbl-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:12px}
table.tbl{width:100%;border-collapse:collapse;font-size:14px;min-width:640px}
.tbl th{background:var(--navy);color:#fff;text-align:left;padding:11px 14px;font-size:12px;letter-spacing:.05em;text-transform:uppercase;position:sticky;top:0}
.tbl th:first-child{border-radius:0}
.tbl td{padding:11px 14px;border-top:1px solid var(--line);vertical-align:middle}
.tbl tr:nth-child(even) td{background:#FAFAF8}
.tbl tr:hover td{background:#F4EFE4}
.tbl tfoot td{background:var(--surface);font-weight:700;border-top:2px solid var(--border)}
.tbl .r{text-align:right}
.badge{display:inline-block;padding:3px 9px;border-radius:999px;font-size:12px;font-weight:700}
.badge.green{background:#E3F2E8;color:var(--green)}
.badge.red{background:#FDECEA;color:var(--red)}
.badge.amber{background:#FBF3DF;color:var(--amber)}
.badge.teal{background:#E0F2F0;color:var(--teal-900)}
.badge.grey{background:var(--surface);color:var(--muted)}
.badge.gold{background:#F4EAD3;color:#7A5A17}

/* Forms */
.form-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:14px}
.fld label{display:block;font-size:12.5px;font-weight:600;color:var(--muted);margin-bottom:5px}
.fld input,.fld textarea{width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:#fff}
.fld input:focus,.fld textarea:focus{border-color:var(--teal);outline:2px solid rgba(15,118,110,.25)}
.fld .unit{font-size:12px;color:var(--slate);margin-top:3px}
.fld.invalid input{border-color:var(--red)}
.fld .err{font-size:12px;color:var(--red);margin-top:3px;display:none}
.fld.invalid .err{display:block}

/* Custom dropdown (no native <select>) */
.dd{position:relative}
.dd-btn{width:100%;display:flex;justify-content:space-between;align-items:center;gap:8px;padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:#fff;font-size:15px;text-align:left}
.dd-btn .caret{color:var(--slate);font-size:12px}
.dd-list{position:absolute;left:0;right:0;top:calc(100% + 4px);background:#fff;border:1px solid var(--border);border-radius:12px;box-shadow:0 12px 32px rgba(17,22,34,.18);z-index:60;max-height:240px;overflow-y:auto;display:none}
.dd.open .dd-list{display:block}
.dd-list button{display:block;width:100%;text-align:left;border:0;background:transparent;padding:10px 14px;font-size:14.5px}
.dd-list button:hover{background:var(--surface)}
.dd-list button.sel{background:#F4EFE4;font-weight:700;color:var(--navy)}

/* Bars / charts (CSS, no chart lib) */
.bar-row{display:grid;grid-template-columns:130px 1fr 64px;gap:10px;align-items:center;margin-bottom:9px;font-size:13px}
.bar-track{height:12px;background:var(--surface);border-radius:6px;overflow:hidden}
.bar-fill{height:100%;border-radius:6px;background:linear-gradient(90deg,var(--teal),#2AA198)}
.bar-fill.gold{background:linear-gradient(90deg,var(--gold-dark),var(--gold))}
.bar-fill.navy{background:linear-gradient(90deg,var(--navy),#2C4A6B)}
.bar-fill.red{background:linear-gradient(90deg,#8E1F18,var(--red))}
.chart{display:flex;align-items:flex-end;gap:5px;height:170px;padding:8px 4px 0;border-bottom:2px solid var(--border)}
.chart .col{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%;min-width:0}
.chart .col i{display:block;width:100%;max-width:34px;border-radius:5px 5px 0 0;background:linear-gradient(180deg,var(--teal),#7FC4BE)}
.chart .col i.gold{background:linear-gradient(180deg,var(--gold-dark),var(--gold))}
.chart .col i.navy{background:linear-gradient(180deg,var(--navy),#4A6B8A)}
.chart .col span{font-size:10.5px;color:var(--slate);margin-top:5px;white-space:nowrap}
.donut-wrap{display:flex;gap:18px;align-items:center;flex-wrap:wrap}
.donut{width:150px;height:150px;border-radius:50%;flex:0 0 auto;position:relative}
.donut::after{content:"";position:absolute;inset:26px;background:#fff;border-radius:50%}
.donut-c{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:2;text-align:center}
.legend{font-size:13.5px}
.legend div{display:flex;align-items:center;gap:8px;margin-bottom:6px}
.legend i{width:12px;height:12px;border-radius:3px;display:inline-block}

/* Wizard */
.steps{display:flex;gap:8px;margin-bottom:20px;flex-wrap:wrap}
.steps .step{flex:1;min-width:110px;background:#fff;border:1px solid var(--line);border-radius:12px;padding:10px 12px;font-size:13px;color:var(--muted)}
.steps .step b{display:block;color:var(--navy);font-size:13.5px}
.steps .step.on{border-color:var(--teal);box-shadow:0 0 0 2px rgba(15,118,110,.2)}
.steps .step.done{border-color:var(--green);background:#F2F9F4}

/* Deal list */
.deal-row{display:flex;align-items:center;gap:16px;padding:16px 18px;background:#fff;border:1px solid var(--line);border-radius:14px;margin-bottom:12px;box-shadow:var(--shadow);cursor:pointer;flex-wrap:wrap}
.deal-row:hover{border-color:var(--gold-dark)}
.deal-row .d-name{font-weight:700;color:var(--navy);font-size:16px}
.deal-row .d-meta{font-size:13px;color:var(--slate)}
.deal-row .d-right{margin-left:auto;text-align:right}
.deal-row .d-yield{font-size:22px;font-weight:700;color:var(--teal-900);font-family:var(--font-head)}

/* Toast + modal */
.toast-stack{position:fixed;bottom:24px;right:24px;z-index:200;display:flex;flex-direction:column;gap:10px;max-width:min(420px,calc(100vw - 48px))}
.toast{background:var(--navy);color:#fff;border-radius:12px;padding:13px 16px;box-shadow:0 12px 32px rgba(0,0,0,.3);font-size:14px;display:flex;gap:10px;align-items:flex-start}
.toast.err{background:#7A1F1A}
.toast.ok{background:#14532D}
.toast button{margin-left:auto;background:transparent;border:0;color:#fff;font-size:16px;line-height:1}
.modal-back{position:fixed;inset:0;background:rgba(11,34,57,.55);z-index:150;display:flex;align-items:center;justify-content:center;padding:20px}
.modal{background:#fff;border-radius:18px;max-width:560px;width:100%;max-height:88vh;overflow-y:auto;padding:26px 28px;box-shadow:0 24px 64px rgba(0,0,0,.35)}
.modal h2{margin-bottom:6px}
.modal .actions{display:flex;gap:10px;justify-content:flex-end;margin-top:20px;flex-wrap:wrap}

/* Term sheet */
.termsheet{background:#fff;border:1px solid var(--line);border-radius:6px;padding:36px 40px;max-width:900px;margin:0 auto}
.termsheet .ts-head{display:flex;justify-content:space-between;gap:16px;border-bottom:3px solid var(--navy);padding-bottom:16px;margin-bottom:20px;flex-wrap:wrap}
.termsheet .ts-head img{width:54px;height:54px}
.termsheet h1{font-size:22px}
.termsheet .ts-sec{margin-bottom:22px}
.termsheet .ts-sec h3{border-bottom:1px solid var(--line);padding-bottom:6px;margin-bottom:10px}
.termsheet .disclaimer{font-size:12px;color:var(--muted);border-top:1px solid var(--line);padding-top:12px;margin-top:24px}
.termsheet table{width:100%;border-collapse:collapse;font-size:13.5px}
.termsheet th,.termsheet td{border-bottom:1px solid var(--line);padding:7px 8px;text-align:left}
.termsheet th{background:var(--surface)}
.termsheet .r{text-align:right}

/* Glossary tooltip */
.gloss{border-bottom:1px dotted var(--teal);cursor:help}
.gloss-tip{position:fixed;z-index:300;background:var(--navy);color:#fff;font-size:13px;border-radius:10px;padding:10px 12px;max-width:280px;box-shadow:0 12px 32px rgba(0,0,0,.3);display:none}

/* Footer */
.appfoot{border-top:1px solid var(--line);padding:22px 28px;font-size:13px;color:var(--slate);display:flex;gap:18px;flex-wrap:wrap;justify-content:space-between}
.empty{border:2px dashed var(--border);border-radius:14px;padding:34px 22px;text-align:center;color:var(--slate)}
.empty h3{color:var(--navy)}
.callout{border-left:4px solid var(--amber);background:#FBF6E9;border-radius:0 12px 12px 0;padding:12px 16px;margin-bottom:16px;font-size:14px}
.callout.red{border-color:var(--red);background:#FDECEA}
.callout.green{border-color:var(--green);background:#EAF6EE}
.callout.teal{border-color:var(--teal);background:#EAF5F3}
.delta-up{color:var(--red);font-weight:700}.delta-down{color:var(--green);font-weight:700}

/* Print: term sheet only */
@media print{
  .rail,.topbar,.appfoot,.no-print,.toast-stack{display:none!important}
  .main{margin-left:0}
  .content{padding:0;max-width:none}
  .card,.termsheet{box-shadow:none;border:0}
  body{background:#fff}
}

/* ---------- Responsive ---------- */
@media (max-width:1100px){
  .kpis{grid-template-columns:repeat(2,1fr)}
  .grid3,.grid-2-1,.grid-1-2,.grid2{grid-template-columns:1fr}
}
@media (max-width:768px){
  .rail{width:56px}
  .rail button span{display:none}
  .main{margin-left:56px}
  .content{padding:16px 14px 48px}
  .topbar{padding:10px 14px}
  .auth-card{grid-template-columns:1fr}
  .auth-hero{padding:24px 22px}
  .kpis{grid-template-columns:1fr 1fr;gap:10px}
  .kpi .k-val{font-size:24px}
  .termsheet{padding:20px 16px}
  .pillnav{order:3;width:100%;overflow-x:auto;flex-wrap:nowrap}
}
@media (max-width:420px){
  .kpis{grid-template-columns:1fr}
  .deal-row .d-right{margin-left:0;text-align:left}
  .bar-row{grid-template-columns:96px 1fr 54px}
  h1{font-size:22px}
}
