/* =============================================================================
 * Selfin demo application — stylesheet. No framework, no CDN, no build step.
 * ========================================================================== */
:root {
  --bg: #070a14;
  --bg-2: #0b0f1c;
  --panel: #111731;
  --panel-2: #151c3a;
  --line: #232c52;
  --text: #e8ecf8;
  --muted: #9aa4c0;
  --accent: #7c6cf6;
  --accent-2: #4fd1c5;
  --ok: #35d07f;
  --warn: #f0b429;
  --bad: #f2555a;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 12% -10%, #1a1f4a 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.55 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}
h1, h2, h3, h4 { margin: 0 0 .4rem; line-height: 1.25; }
h2 { font-size: 15px; letter-spacing: .01em; }
h3 { font-size: 18px; }
h4 { font-size: 14px; }
p { margin: 0 0 .55rem; }
a { color: var(--accent-2); text-decoration: none; }
small { font-size: 12px; }
code { background: #0d1330; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 11.5px; color: #b9c2e0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.neg { color: var(--bad); }
.pos { color: var(--ok); }
.fineprint { color: var(--muted); font-size: 12px; margin-top: .75rem; }

/* ------------------------------------------------------------- app shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0a0f22 0%, #070a14 100%);
  padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #4a3fd0); font-weight: 800; color: #fff;
}
.brand-name { font-weight: 700; letter-spacing: .02em; font-size: 16px; }
.side-sub { color: var(--muted); font-size: 11.5px; margin: 0 0 16px 40px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 10px;
  color: #c3cbe6; font-size: 13.5px; border: 1px solid transparent;
}
.nav a:hover { background: #141a34; }
.nav a.active { background: #1a2145; color: #fff; border-color: #2c3568; }
.nav a .nm { flex: 1; }
.nav .badge {
  background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700;
  border-radius: 999px; padding: 1px 7px;
}
.side-foot { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; color: var(--muted); font-size: 11.5px; }
.tier-legend { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.tier-legend div { display: flex; gap: 6px; align-items: baseline; }

.main { padding: 18px 22px 60px; max-width: 1220px; }
.topbar {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 18px;
}
.topbar h1 { font-size: 20px; margin: 0; }
.topbar .crumb { color: var(--muted); font-size: 12.5px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 6px; font-size: 12.5px; }
.avatar { width: 24px; height: 24px; border-radius: 999px; background: linear-gradient(135deg, #4fd1c5, #7c6cf6); display: grid; place-items: center; font-weight: 700; color: #06121a; font-size: 11px; }
select, input, button { font: inherit; }
select, input[type="text"], input[type="email"], input[type="number"], input:not([type]) {
  background: #0d1330; color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 10px; min-width: 0;
}
input[type="range"] { accent-color: var(--accent); width: 190px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* ------------------------------------------------------------- buttons */
.btn {
  border: 1px solid var(--line); background: #161d3c; color: var(--text);
  padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 13px;
}
.btn:hover { background: #1c2450; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #5b4de0); border-color: #6a5cf0; color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-xs { padding: 4px 9px; font-size: 11.5px; }

/* ------------------------------------------------------------- layout bits */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.cols-2-1 { grid-template-columns: 1.4fr 1fr; }
.hero-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; }
.stat-label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 4px; }
.stat-value { font-size: 21px; font-weight: 700; margin: 0; }
.stat-sub { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.stat.pos .stat-value { color: var(--ok); }
.stat.neg .stat-value { color: var(--bad); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); background: #131935; }
.panel-body { padding: 14px 16px; }
.grid { display: grid; gap: 10px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

/* ------------------------------------------------------------- tier + pills */
.tier { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 6px; border: 1px solid; white-space: nowrap; }
.tier-ok { color: #8ff0c2; border-color: #2b6b4d; background: #11301f; }
.tier-warn { color: #ffd27a; border-color: #7a5a1c; background: #33260c; }
.tier-muted { color: var(--muted); border-color: var(--line); background: #131935; }
.pill { font-size: 11px; border-radius: 999px; padding: 2px 9px; border: 1px solid var(--line); background: #131935; color: var(--muted); white-space: nowrap; }
.pill.ok { color: #8ff0c2; border-color: #2b6b4d; background: #11301f; }
.pill.warn { color: #ffd27a; border-color: #7a5a1c; background: #33260c; }
.pill.muted-pill { color: var(--muted); }
.tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--accent-2); border: 1px solid #24504d; background: #0e2726; border-radius: 6px; padding: 2px 7px; margin-right: 8px; }

/* ------------------------------------------------------------- lists / rows */
.rows, .list { list-style: none; margin: 0; padding: 0; }
.rows .row, .list .row {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  padding: 10px 2px; border-bottom: 1px dashed #1d2547;
}
.list .row:last-child, .rows .row:last-child { border-bottom: none; }
.row-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.row-main small { color: var(--muted); }
.row-side { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.rows .row.total { border-top: 1px solid var(--line); border-bottom: none; font-weight: 700; }
.rows .row.neg .row-side { color: var(--bad); }
.row-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.perm { color: #7f8ab0; }

/* ------------------------------------------------------------- bars */
.track { display: block; height: 6px; background: #0d1330; border-radius: 999px; overflow: hidden; grid-column: 1 / -1; }
.fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.fill.warn { background: linear-gradient(90deg, var(--warn), #ff8a3d); }
.fill.ok { background: linear-gradient(90deg, #35d07f, #4fd1c5); }
.alloc { display: flex; height: 14px; border-radius: 999px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 10px; }
.alloc .seg { height: 100%; }
.seg-cash { background: #4fd1c5; }
.seg-stocks { background: #7c6cf6; }
.seg-crypto { background: #f0b429; }
.seg-retirement { background: #66a6ff; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; font-size: 12.5px; color: #c3cbe6; }
.legend b { font-variant-numeric: tabular-nums; }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.sw-cash { background: #4fd1c5; } .sw-stocks { background: #7c6cf6; }
.sw-crypto { background: #f0b429; } .sw-retirement { background: #66a6ff; }

/* ------------------------------------------------------------- insights */
.insight { border: 1px solid var(--line); border-left-width: 4px; border-radius: 11px; padding: 12px 14px; background: var(--panel-2); }
.insight.high { border-left-color: var(--bad); }
.insight.medium { border-left-color: var(--warn); }
.insight.low { border-left-color: var(--accent); }
.insight h4 { display: flex; align-items: center; gap: 8px; }
.insight footer { display: flex; gap: 8px; align-items: baseline; margin-top: 6px; }
.mini-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; }
.mini-label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.ticks { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.ticks li { padding: 3px 0 3px 18px; position: relative; }
.ticks li:before { content: "•"; position: absolute; left: 4px; }
.ticks li.on:before { content: "✔"; color: var(--ok); }
.ticks li.off:before { content: "○"; color: var(--warn); }
ul.mini { margin: 6px 0; padding-left: 18px; }
ul.mini li { margin: 2px 0; }

/* ------------------------------------------------------------- onboarding */
.onboard { max-width: 860px; margin: 0 auto; padding: 26px 22px 60px; }
.onboard-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.onboard-head .brand { display: flex; align-items: center; gap: 10px; }
.steps { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 20px; }
.steps li { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; background: #0f1430; }
.steps li span { width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center; background: #222b55; font-size: 11px; font-weight: 700; }
.steps li.current { color: #fff; border-color: var(--accent); background: #1c2150; }
.steps li.done { color: #8ff0c2; border-color: #2b6b4d; }
.steps li.done span { background: #11301f; }
.onboard-body { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.inst { display: flex; align-items: center; gap: 10px; text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; cursor: pointer; color: var(--text); }
.inst:hover { border-color: var(--accent); }
.inst-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; }
.inst small { display: block; color: var(--muted); }

/* ------------------------------------------------------------- forms */
.form { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #c3cbe6; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; }
.form label small { color: var(--muted); }
.form-inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 10px; max-width: none; }
.form-inline label { font-size: 12px; }
.inline { display: inline-flex; align-items: center; gap: 10px; }
fieldset { border: 1px solid var(--line); border-radius: 11px; padding: 10px 13px; margin: 0; }
legend { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding: 0 6px; }
.link-box { background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }

/* ------------------------------------------------------------- chat */
.chat { display: flex; flex-direction: column; gap: 12px; max-height: 460px; overflow-y: auto; padding-right: 4px; }
.msg { border-radius: 12px; padding: 12px 14px; border: 1px solid var(--line); }
.msg.user { background: #1c2450; align-self: flex-end; max-width: 78%; }
.msg.bot { background: var(--panel-2); }
.msg.bot.empty { border-style: dashed; }
.why { margin-top: 8px; border-top: 1px dashed #26305c; padding-top: 8px; }
.why p { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
.why .plain { margin-top: 8px; background: #0f1a2e; border-left: 3px solid var(--accent-2); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.chat-input { display: flex; gap: 8px; margin-top: 12px; }
.chat-input input { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.chip-btn { background: #131935; border: 1px solid var(--line); color: #c3cbe6; border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer; }
.chip-btn:hover { border-color: var(--accent); color: #fff; }

/* ------------------------------------------------------------- agents */
.approval { border: 1px solid #5b4a12; background: #241d0d; border-radius: 11px; padding: 12px 14px; margin-bottom: 10px; }
.approval-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.approval .gate { color: #ffd27a; font-size: 12px; margin: 4px 0; }
.approval-actions { display: flex; gap: 8px; margin-top: 8px; }
.undo-bar { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #11301f; border: 1px solid #2b6b4d; border-radius: 11px; padding: 10px 13px; font-size: 13px; }
.log-row .why-small { color: #7f8ab0; font-style: italic; }
.log-row .impact { color: var(--accent-2); }
.status { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; border-radius: 6px; padding: 2px 7px; border: 1px solid var(--line); }
.status-executed { color: #8ff0c2; border-color: #2b6b4d; background: #11301f; }
.status-awaiting-approval { color: #ffd27a; border-color: #7a5a1c; background: #33260c; }
.status-denied { color: #ffbfc1; border-color: #7a2a2d; background: #331215; }
.status-undone { color: var(--muted); }
.status-logged { color: #a9c8ff; border-color: #2a4a7a; background: #0f1c33; }
.scan-result { margin-top: 12px; }
.scan-result .insight { border-left-color: var(--accent-2); }

/* ------------------------------------------------------------- tables */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #1d2547; }
.table th { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- misc blocks */
.sev { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.sev-high { background: var(--bad); } .sev-medium { background: var(--warn); } .sev-low { background: #6f7ba6; }
.alert-row { grid-template-columns: 14px 1fr auto !important; }
.alert-row.read { opacity: .62; }
.banner { border-radius: 11px; padding: 11px 14px; border: 1px solid var(--line); margin-bottom: 12px; }
.banner.ok { background: #11301f; border-color: #2b6b4d; color: #d6ffe9; }
.banner.warn { background: #33260c; border-color: #7a5a1c; color: #ffeec4; }
.banner.muted { background: #131935; color: #c3cbe6; }
.spark svg { width: 100%; height: auto; max-height: 140px; }
.calc-result { margin-top: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; }
.calc-result b { color: var(--accent-2); }
.roadmap { opacity: .85; }
.score-ok { color: var(--ok); } .score-warn { color: var(--warn); } .score-bad { color: var(--bad); }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: 460px;
  background: #16203f; border: 1px solid var(--accent); border-radius: 12px;
  padding: 12px 15px; box-shadow: var(--shadow); font-size: 13px;
}
.toast h4 { color: #fff; }
.toast p { margin: 4px 0 0; color: #c3cbe6; }

.demo-note { border: 1px dashed var(--line); border-radius: 11px; padding: 10px 13px; color: var(--muted); font-size: 12px; margin-bottom: 14px; }

@media (max-width: 1080px) {
  .hero-strip { grid-template-columns: repeat(2, 1fr); }
  .cols, .cols-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .hero-strip { grid-template-columns: 1fr; }
}
