/* YieldCurve Pro — styles. Subly/Finor layout language, Erthiox palette.
 * Page: dark navy #0B1F3A shell (Finor) + cream content #FCFBF9, white cards,
 * navy icon rail (Subly), gold #C5A880/#B89047 accents, teal #0F766E curves.
 * No native <select>, no native alert/confirm, custom scrollbars everywhere. */
:root{
  --navy:#0B1F3A; --navy-2:#111622; --steel:#143A6B; --gold:#C5A880; --gold-d:#B89047;
  --cream:#FCFBF9; --ink:#1A2332; --muted:#44536A; --slate:#5A606C;
  --surface:#F2F4F7; --border:#B9C2CF; --line:#E8E5DF; --blue:#1a73e8;
  --teal:#0F766E; --green:#15803D; --red:#B3261E; --amber:#8A6D3B;
  --card:#FFFFFF; --radius:16px; --shadow:0 1px 2px rgba(11,31,58,.06),0 8px 24px rgba(11,31,58,.07);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:Inter,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  background:var(--navy); color:var(--ink); font-size:15px; line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4{font-family:Outfit,Inter,Arial,sans-serif;color:var(--navy);margin:0}
a{color:var(--steel);text-decoration:none}
a:hover{text-decoration:underline}
button{font-family:inherit;cursor:pointer}
input,textarea{font-family:inherit}
.num{font-variant-numeric:tabular-nums;font-feature-settings:"tnum"}
.muted{color:var(--muted)} .small{font-size:12.5px} .gold{color:var(--gold-d)}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:#E9ECF1;border-radius:8px}
::-webkit-scrollbar-thumb{background:#9AA7BB;border-radius:8px;border:2px solid #E9ECF1}
::-webkit-scrollbar-thumb:hover{background:var(--gold-d)}
*{scrollbar-width:thin;scrollbar-color:#9AA7BB #E9ECF1}

/* ---------- app shell: icon rail + main ---------- */
#app{display:none;min-height:100vh}
#app.on{display:flex}
.rail{
  width:76px;flex:0 0 76px;background:var(--navy-2);display:flex;flex-direction:column;
  align-items:center;padding:14px 0;gap:6px;position:sticky;top:0;height:100vh;z-index:30;
}
.rail .mark{width:46px;height:46px;border-radius:12px;background:#fff;padding:4px;display:flex;align-items:center;justify-content:center;margin-bottom:10px}
.rail .mark img{width:38px;height:38px}
.rail button{
  width:48px;height:48px;border-radius:12px;border:0;background:transparent;color:#9AA7BB;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:9.5px;
}
.rail button svg{width:21px;height:21px}
.rail button:hover{color:#fff;background:rgba(255,255,255,.08)}
.rail button.active{background:var(--gold-d);color:#111622}
.rail .spacer{flex:1}
.main{flex:1;min-width:0;background:var(--cream);border-radius:22px 0 0 0;margin:10px 0 0 0;padding:0 0 40px;min-height:calc(100vh - 10px)}
.topbar{
  position:sticky;top:0;z-index:20;background:rgba(252,251,249,.94);backdrop-filter:blur(6px);
  display:flex;align-items:center;gap:14px;padding:14px 28px;border-bottom:1px solid var(--line);
}
.topbar .brand{display:flex;align-items:center;gap:10px}
.topbar .brand img{width:34px;height:34px}
.topbar .brand b{font-family:Outfit;font-size:18px;color:var(--navy)}
.topbar .brand span{display:block;font-size:11px;color:var(--muted);letter-spacing:.04em}
.pillnav{display:flex;background:var(--surface);border:1px solid var(--line);border-radius:999px;padding:3px;gap:2px;margin-left:8px}
.pillnav button{border:0;background:transparent;padding:7px 14px;border-radius:999px;font-size:13.5px;color:var(--muted);font-weight:600}
.pillnav button.active{background:var(--navy);color:#fff}
.pillnav button:hover:not(.active){color:var(--navy)}
.topbar .right{margin-left:auto;display:flex;align-items:center;gap:10px}
.curvebadge{font-size:12.5px;font-weight:600;border:1px solid var(--line);background:#fff;border-radius:999px;padding:6px 12px;color:var(--navy);white-space:nowrap}
.statuspill{font-size:12px;font-weight:700;border-radius:999px;padding:6px 11px;white-space:nowrap}
.statuspill.sample{background:#FBF3DF;color:var(--amber);border:1px solid #E8D9AE}
.statuspill.fresh{background:#E5F4E9;color:var(--green);border:1px solid #BFE3C8}
.statuspill.stale{background:#FBE9E7;color:var(--red);border:1px solid #F0C4C0}
.btn{
  border:1px solid var(--navy);background:var(--navy);color:#fff;border-radius:10px;
  padding:10px 16px;font-size:14px;font-weight:600;display:inline-flex;align-items:center;gap:7px;
}
.btn:hover{background:var(--steel)}
.btn.gold{background:var(--gold-d);border-color:var(--gold-d);color:#111622}
.btn.gold:hover{background:#C9A25B}
.btn.ghost{background:#fff;color:var(--navy);border-color:var(--border)}
.btn.ghost:hover{border-color:var(--navy)}
.btn.sm{padding:7px 12px;font-size:13px;border-radius:8px}
.btn:disabled{opacity:.5;cursor:not-allowed}
.page{padding:22px 28px;max-width:1440px;margin:0 auto}
.pagehead{display:flex;align-items:flex-end;gap:16px;flex-wrap:wrap;margin-bottom:18px}
.pagehead h1{font-size:28px}
.pagehead p{margin:2px 0 0;color:var(--muted);max-width:720px}
.pagehead .actions{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap}

/* ticker strip (Finor) */
.ticker{display:flex;gap:10px;overflow-x:auto;padding:2px 2px 12px;margin-bottom:16px}
.tick{
  flex:0 0 auto;background:#fff;border:1px solid var(--line);border-radius:12px;padding:10px 14px;
  display:flex;align-items:center;gap:10px;min-width:172px;box-shadow:var(--shadow);
}
.tick .dot{width:9px;height:9px;border-radius:50%;flex:0 0 9px}
.tick b{font-size:13px;color:var(--navy);display:block}
.tick span{font-size:12px;color:var(--muted)}
.tick .v{margin-left:auto;text-align:right}
.tick .v b{font-size:14.5px}
.tick .v span{display:block;font-size:11.5px;font-weight:700}
.up{color:var(--green)} .down{color:var(--red)}

/* KPI cards (Subly big numbers) */
.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:16px}
.kpi{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:18px 20px;box-shadow:var(--shadow)}
.kpi .lbl{font-size:12.5px;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:var(--muted)}
.kpi .big{font-size:34px;font-weight:800;color:var(--navy);font-family:Outfit;margin:6px 0 2px}
.kpi .sub{font-size:13px;color:var(--muted)}
.kpi .delta{font-weight:700;font-size:12.5px}
.grid{display:grid;gap:14px}
.g2{grid-template-columns:1.9fr 1fr}
.g3{grid-template-columns:repeat(3,1fr)}
.g2r{grid-template-columns:1fr 1.9fr}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:20px;box-shadow:var(--shadow)}
.card h2{font-size:17px;margin-bottom:4px}
.card h3{font-size:15px;margin-bottom:8px}
.card .cardsub{font-size:13px;color:var(--muted);margin-bottom:12px}
.cardhead{display:flex;align-items:flex-start;gap:10px;margin-bottom:10px}
.cardhead .tools{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap}
.banner{
  border-radius:12px;padding:12px 16px;font-size:13.5px;margin-bottom:16px;display:flex;gap:10px;align-items:flex-start;
}
.banner.warn{background:#FBF3DF;border:1px solid #E8D9AE;color:#5C4A1F}
.banner.info{background:#E8F0FE;border:1px solid #C2D7F8;color:#12365E}
.banner.err{background:#FBE9E7;border:1px solid #F0C4C0;color:#6E1610}
.banner b{color:inherit}
.banner .grow{flex:1}

/* tables */
table{width:100%;border-collapse:collapse;font-size:14px}
th{font-size:12px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);text-align:right;padding:9px 10px;border-bottom:2px solid var(--navy);white-space:nowrap}
th:first-child,td:first-child{text-align:left}
td{padding:9px 10px;border-bottom:1px solid var(--line);text-align:right;white-space:nowrap}
tr:hover td{background:#FAF8F3}
td.hl{font-weight:700;color:var(--navy)}
.tblwrap{overflow-x:auto;margin:0 -4px;padding:0 4px}
.tblwrap table{min-width:560px}
.sticky th{position:sticky;top:0;background:#fff}

/* forms */
.field{margin-bottom:14px}
.field label{display:block;font-size:12.5px;font-weight:700;color:var(--muted);margin-bottom:6px;letter-spacing:.02em}
.field input[type=text],.field input[type=number],.field input[type=date],.field input[type=email],.field input[type=password],.field textarea{
  width:100%;border:1.5px solid var(--border);border-radius:10px;padding:11px 12px;font-size:14.5px;background:#fff;color:var(--ink);
}
.field input:focus,.field textarea:focus{outline:2px solid var(--blue);outline-offset:1px;border-color:var(--blue)}
.field .hint{font-size:12px;color:var(--muted);margin-top:5px}
.field .err{font-size:12.5px;color:var(--red);margin-top:5px;font-weight:600;display:none}
.field.invalid input{border-color:var(--red)}
.field.invalid .err{display:block}
.field.warn .warnmsg{display:block}
.warnmsg{font-size:12.5px;color:var(--amber);margin-top:5px;font-weight:600;display:none}
.formgrid{display:grid;grid-template-columns:1fr 1fr;gap:0 14px}
.seg{display:inline-flex;background:var(--surface);border:1px solid var(--line);border-radius:999px;padding:3px;gap:2px}
.seg button{border:0;background:transparent;padding:7px 13px;border-radius:999px;font-size:13px;font-weight:600;color:var(--muted)}
.seg button.active{background:var(--navy);color:#fff}
input[type=range]{width:100%;accent-color:var(--gold-d);height:28px}
.rangeval{display:flex;justify-content:space-between;font-size:12px;color:var(--muted)}

/* custom dropdown (no native <select>) */
.dd{position:relative}
.dd>button{
  width:100%;border:1.5px solid var(--border);border-radius:10px;padding:11px 12px;font-size:14.5px;
  background:#fff;color:var(--ink);display:flex;justify-content:space-between;align-items:center;gap:8px;text-align:left;
}
.dd>button:after{content:"▾";color:var(--muted);font-size:12px}
.dd .menu{
  position:absolute;left:0;right:0;top:calc(100% + 5px);background:#fff;border:1px solid var(--border);
  border-radius:12px;box-shadow:0 12px 32px rgba(11,31,58,.18);z-index:50;display:none;max-height:260px;overflow-y:auto;padding:5px;
}
.dd.open .menu{display:block}
.dd .menu button{display:block;width:100%;text-align:left;border:0;background:transparent;padding:9px 11px;border-radius:8px;font-size:14px;color:var(--ink)}
.dd .menu button:hover,.dd .menu button.sel{background:var(--surface)}
.dd .menu button small{display:block;color:var(--muted);font-size:11.5px}

/* results */
.resgrid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:12px 0}
.res{background:var(--surface);border-radius:12px;padding:12px 14px}
.res .l{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}
.res .v{font-size:23px;font-weight:800;color:var(--navy);font-family:Outfit}
.res .b{font-size:11.5px;color:var(--muted)}
.res.big .v{font-size:30px}
.res.gain .v{color:var(--green)} .res.loss .v{color:var(--red)}
.tabs{display:flex;gap:4px;border-bottom:2px solid var(--line);margin-bottom:16px;overflow-x:auto}
.tabs button{border:0;background:transparent;padding:10px 16px;font-size:14px;font-weight:600;color:var(--muted);border-bottom:3px solid transparent;margin-bottom:-2px;white-space:nowrap}
.tabs button.active{color:var(--navy);border-bottom-color:var(--gold-d)}
.chip{display:inline-block;font-size:11.5px;font-weight:700;border-radius:999px;padding:3px 9px;background:var(--surface);color:var(--muted);border:1px solid var(--line)}
.chip.teal{background:#E0F2F0;color:var(--teal);border-color:#BFE3DF}
.chip.gold{background:#FBF3DF;color:var(--amber);border-color:#E8D9AE}
.chip.navy{background:var(--navy);color:#fff;border-color:var(--navy)}
.legend{display:flex;gap:16px;font-size:12.5px;color:var(--muted);flex-wrap:wrap;margin-top:8px}
.legend i{display:inline-block;width:22px;height:4px;border-radius:2px;vertical-align:middle;margin-right:6px}
.legend i.dash{background:repeating-linear-gradient(90deg,var(--gold-d) 0 5px,transparent 5px 9px);height:3px}
.kv{display:flex;justify-content:space-between;gap:12px;padding:8px 0;border-bottom:1px solid var(--line);font-size:14px}
.kv:last-child{border-bottom:0}
.kv b{color:var(--navy)}
.distbar{display:flex;height:12px;border-radius:999px;overflow:hidden;margin:8px 0 4px}
.distbar div{height:100%}
.listrow{display:flex;align-items:center;gap:12px;padding:11px 2px;border-bottom:1px solid var(--line);font-size:14px;flex-wrap:wrap}
.listrow:last-child{border-bottom:0}
.listrow .grow{flex:1;min-width:120px;overflow:hidden}
.listrow b{color:var(--navy)}
.listrow .sub{font-size:12.5px;color:var(--muted);overflow:hidden;text-overflow:ellipsis}
.avatar{
  width:36px;height:36px;border-radius:10px;flex:0 0 36px;display:flex;align-items:center;justify-content:center;
  font-weight:800;font-size:13px;color:#fff;
}
.empty{border:1.5px dashed var(--border);border-radius:14px;padding:34px 20px;text-align:center;color:var(--muted)}
.empty b{display:block;color:var(--navy);font-size:16px;margin-bottom:6px}
footer.appfoot{margin:36px 28px 0;padding:18px 4px 0;border-top:1px solid var(--line);color:var(--muted);font-size:12.5px;display:flex;gap:18px;flex-wrap:wrap}
footer.appfoot a{color:var(--steel)}

/* ---------- auth gate ---------- */
#auth{position:fixed;inset:0;z-index:100;display:flex;align-items:center;justify-content:center;background:var(--navy);padding:20px}
#auth .panel{background:var(--cream);border-radius:22px;max-width:960px;width:100%;display:grid;grid-template-columns:1.05fr 1fr;overflow:hidden;box-shadow:0 30px 80px rgba(0,0,0,.5)}
#auth .hero{background:var(--navy);color:#fff;padding:36px 32px;display:flex;flex-direction:column;gap:14px}
#auth .hero img{width:74px;height:74px;background:#fff;border-radius:18px;padding:8px}
#auth .hero h1{color:#fff;font-size:30px;line-height:1.15}
#auth .hero p{color:#C7CFDD;font-size:14.5px;margin:0}
#auth .hero .tag{color:var(--gold);font-weight:700;font-size:13px;letter-spacing:.06em;text-transform:uppercase}
#auth .form{padding:32px 30px}
#auth .form h2{font-size:21px;margin-bottom:4px}
#auth .form .sub{color:var(--muted);font-size:13.5px;margin-bottom:18px}
#auth .form .row{display:flex;gap:8px;margin-top:14px}
#auth .form .row .btn{flex:1;justify-content:center}
#auth .fine{font-size:12px;color:var(--muted);margin-top:16px}

/* modal + toast (custom, never alert()) */
.modalbk{position:fixed;inset:0;background:rgba(11,31,58,.55);z-index:200;display:none;align-items:center;justify-content:center;padding:20px}
.modalbk.on{display:flex}
.modal{background:#fff;border-radius:18px;max-width:560px;width:100%;padding:26px;box-shadow:0 24px 70px rgba(0,0,0,.35);max-height:86vh;overflow-y:auto}
.modal h2{font-size:20px;margin-bottom:8px}
.modal .actions{display:flex;gap:8px;justify-content:flex-end;margin-top:20px}
#toasts{position:fixed;right:18px;bottom:18px;z-index:300;display:flex;flex-direction:column;gap:8px;max-width:360px}
.toast{background:var(--navy);color:#fff;border-radius:12px;padding:13px 16px;font-size:14px;box-shadow:0 10px 30px rgba(0,0,0,.3);display:flex;gap:10px;align-items:flex-start}
.toast.err{background:#7A1B14}
.toast.ok{background:#0E4D2A}
.toast button{background:none;border:0;color:#fff;font-size:16px;line-height:1;padding:0}
.kofi{
  display:inline-flex;align-items:center;gap:8px;background:var(--gold-d);color:#090d16;border-radius:10px;
  padding:10px 16px;font-weight:700;font-size:14px;border:0;
}
.kofi:hover{background:#C9A25B}
.marketing{
  display:none;background:linear-gradient(90deg,var(--navy),var(--steel) 55%,var(--teal));
  color:#fff;border-radius:16px;padding:26px 28px;margin-bottom:16px;
}
.marketing.on{display:block}
.marketing h2{color:#fff;font-size:32px;line-height:1.1}
.marketing p{color:#D7DEE9;margin:8px 0 0;font-size:16px}
.marketing .pill{display:inline-block;background:var(--gold-d);color:#111622;font-weight:800;font-size:12px;border-radius:999px;padding:5px 12px;letter-spacing:.05em;text-transform:uppercase;margin-bottom:10px}
.gloss{border-bottom:1px dotted var(--steel);cursor:help}

/* ---------- responsive ---------- */
@media (max-width:1180px){
  .kpis{grid-template-columns:repeat(2,1fr)}
  .g2,.g2r{grid-template-columns:1fr}
  .g3{grid-template-columns:1fr 1fr}
}
@media (max-width:860px){
  .rail{width:60px;flex-basis:60px}
  .rail button{width:44px;height:44px;font-size:0}
  .rail button svg{width:22px;height:22px}
  .topbar{padding:12px 16px;flex-wrap:wrap}
  .pillnav{order:3;width:100%;overflow-x:auto}
  .page{padding:16px}
  #auth .panel{grid-template-columns:1fr}
  #auth .hero{padding:26px 22px}
}
@media (max-width:560px){
  .kpis{grid-template-columns:1fr 1fr}
  .kpi .big{font-size:26px}
  .g3{grid-template-columns:1fr}
  .formgrid{grid-template-columns:1fr}
  .resgrid{grid-template-columns:1fr 1fr}
  .pagehead h1{font-size:23px}
  .rail{position:fixed;bottom:0;top:auto;left:0;right:0;width:100%;height:60px;flex-direction:row;justify-content:space-around;padding:0 6px;z-index:60}
  .rail .mark,.rail .spacer{display:none}
  .rail button{flex:1;height:52px}
  .main{margin:0 0 60px;border-radius:0}
  .topbar .brand span{display:none}
}
@media print{
  .rail,.topbar,.pagehead .actions,#toasts,.no-print{display:none!important}
  body{background:#fff}
  .main{margin:0}
  .card,.kpi{box-shadow:none;break-inside:avoid}
}
