/* NetWorth — light "WealthOS" theme */
:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --line: #e8eaf2;
  --text: #1a1d2e;
  --muted: #8a90a6;
  --brand: #5b4ee6;
  --brand-2: #7c6ef2;
  --brand-soft: #eef0ff;
  --green: #16a34a;
  --green-soft: #e7f7ee;
  --red: #e5484d;
  --red-soft: #fdecec;
  --amber: #e8930c;
  --amber-soft: #fdf2e1;
  --sky: #2f6df6;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(40, 44, 80, .06);
  --shadow-lg: 0 12px 40px rgba(40, 44, 80, .12);
  --sidebar: 248px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
.muted { color: var(--muted); }
.green { color: var(--green); }
.red { color: var(--red); }
.amber { color: var(--amber); }
h1, h2, h3, h4 { margin: 0; }

/* ---------- Login (split screen) ---------- */
.login-wrap { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.login-hero {
  background:
    linear-gradient(160deg, rgba(20,22,48,.92), rgba(30,28,80,.86)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M0 39h40M39 0v40' stroke='%23ffffff10' stroke-width='1'/%3E%3C/svg%3E"),
    radial-gradient(900px 500px at 70% 20%, #2a2c6e, #11132e);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center;
}
.login-hero .logo { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 800; margin-bottom: 48px; }
.login-hero h1 { font-size: 40px; line-height: 1.15; margin-bottom: 16px; }
.login-hero h1 .accent { color: var(--brand-2); }
.login-hero .lede { color: #c7cae0; font-size: 15px; max-width: 420px; margin-bottom: 36px; line-height: 1.6; }
.feat { display: flex; gap: 14px; margin-bottom: 22px; max-width: 440px; }
.feat .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: none; }
.feat h4 { font-size: 15px; margin-bottom: 2px; }
.feat p { margin: 0; color: #aab0cc; font-size: 13px; }
.login-form-side { display: grid; place-items: center; padding: 40px; background: var(--surface); }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 28px; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); margin-bottom: 28px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 22px 16px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 800; padding: 0 8px 22px; }
.brand .mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; color: #fff; font-size: 18px; }
.brand span { color: var(--brand); }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: transparent; border: none; color: #6b7188; padding: 11px 13px; border-radius: 11px;
  cursor: pointer; font-size: 14px; font-weight: 600; font-family: inherit; }
.nav button .ic { font-size: 17px; width: 20px; text-align: center; }
.nav button:hover { background: var(--surface-2); color: var(--text); }
.nav button.active { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(91,78,230,.35); }
.side-profile { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg,#6b7280,#374151);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; }
.side-profile .nm { font-size: 14px; font-weight: 700; }
.side-profile .rl { font-size: 12px; color: var(--muted); }

.main { padding: 24px 30px 60px; overflow-x: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.topbar .greet h2 { font-size: 24px; }
.topbar .greet p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.search { background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px; width: 320px; max-width: 36vw; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.search input { border: none; background: transparent; width: 100%; font-size: 14px; color: var(--text); }
.search input:focus { outline: none; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; position: relative; font-size: 17px; }
.icon-btn .dot { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }

/* ---------- Cards / panels ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.cards.k5 { grid-template-columns: repeat(5, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card .label { color: var(--muted); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.card .value { font-size: 25px; font-weight: 800; margin-top: 8px; letter-spacing: -.5px; }
.card .sub { font-size: 12.5px; margin-top: 6px; font-weight: 600; }
.card .ic-badge { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; margin-bottom: 12px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.panel h3 { font-size: 16px; }
.panel .link { font-size: 13px; font-weight: 600; cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 22px; }
.grid-3 { display: grid; grid-template-columns: 1.1fr 1.6fr 1.1fr; gap: 18px; margin-bottom: 22px; }
.grid-main { display: grid; grid-template-columns: 1fr 320px; gap: 18px; margin-bottom: 22px; align-items: start; }
canvas { max-width: 100%; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: var(--surface-2); }
.row-actions button { padding: 5px 9px; font-size: 12px; }

/* ---------- Buttons / inputs ---------- */
button.btn, .btn { background: var(--brand); color: #fff; border: none; padding: 11px 18px; border-radius: 11px;
  cursor: pointer; font-weight: 700; font-size: 14px; font-family: inherit; box-shadow: 0 6px 16px rgba(91,78,230,.25); }
button.btn:hover { filter: brightness(1.06); }
.btn.grad { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.danger { background: var(--red); box-shadow: none; }
.btn.sm { padding: 7px 12px; font-size: 12.5px; }
.btn.block { width: 100%; }

input, select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); color: var(--text);
  padding: 12px 14px; border-radius: 11px; font-size: 14px; font-family: inherit; }
input::placeholder, textarea::placeholder { color: #aab0c4; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; color: var(--text); font-size: 13px; margin-bottom: 6px; font-weight: 600; }

/* ---------- Pills / badges ---------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }

/* ---------- Goals / progress ---------- */
.goal { margin-bottom: 18px; }
.goal .top { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 7px; font-weight: 600; }
.bar { height: 9px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 99px; }

/* ---------- Tasks / lists ---------- */
.tasklist .item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.tasklist .item:last-child { border-bottom: none; }
.tasklist .check { width: 19px; height: 19px; border-radius: 6px; border: 2px solid var(--line); flex: none; }
.tasklist .time { margin-left: auto; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.tabs { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 4px; gap: 2px; }
.tabs button { border: none; background: transparent; padding: 7px 14px; border-radius: 8px; font-size: 13px;
  font-weight: 600; cursor: pointer; color: var(--muted); font-family: inherit; }
.tabs button.active { background: var(--brand); color: #fff; }

/* ---------- AI insight ---------- */
.ai-card { background: linear-gradient(135deg, var(--brand), #4a3fd0); color: #fff; border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-lg); }
.ai-card h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ai-card p { font-size: 13.5px; line-height: 1.55; color: #e7e6ff; margin: 0 0 10px; }
.ai-card .btn { background: rgba(255,255,255,.16); box-shadow: none; backdrop-filter: blur(4px); }

/* ---------- Quick actions ---------- */
.qa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.qa { background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; padding: 18px 10px;
  text-align: center; cursor: pointer; transition: .15s; }
.qa:hover { background: var(--brand-soft); border-color: var(--brand); transform: translateY(-2px); }
.qa .ic { font-size: 22px; margin-bottom: 8px; }
.qa .lbl { font-size: 12.5px; font-weight: 600; }

/* ---------- Notifications ---------- */
.notif { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.notif:last-child { border-bottom: none; }
.notif .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 17px; }
.notif .t { font-size: 13.5px; font-weight: 600; }
.notif .ago { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- AI tips (advisor) ---------- */
.tip { border-left: 3px solid var(--brand); background: var(--surface-2); padding: 14px 16px; border-radius: 0 11px 11px 0; margin-bottom: 12px; }
.tip.high { border-color: var(--red); } .tip.medium { border-color: var(--amber); } .tip.low { border-color: var(--green); }
.tip h4 { font-size: 14px; margin-bottom: 4px; } .tip p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(26,29,46,.45); display: none; place-items: center;
  padding: 20px; z-index: 50; backdrop-filter: blur(3px); }
.modal-bg.open { display: grid; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 26px; width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto; }
.modal h3 { margin-bottom: 18px; }
.modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.modal .form-grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }

.section { display: none; }
.section.active { display: block; }
.err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 6px; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--text); color: #fff; padding: 13px 20px;
  border-radius: 12px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(10px); transition: .25s; z-index: 99; font-size: 14px; font-weight: 600; }
.toast.show { opacity: 1; transform: translateY(0); }
pre.brief { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px;
  padding: 16px; font-size: 13px; min-height: 120px; margin: 0; font-family: "SF Mono", Menlo, monospace; }
.spark { width: 64px; height: 26px; }

@media (max-width: 1100px) { .cards, .cards.k5 { grid-template-columns: repeat(2, 1fr); } .grid-3, .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; }
  .nav { flex-direction: row; flex-wrap: wrap; } .grid-2 { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; } .login-hero { display: none; } .search { display: none; }
}
