/* LifeOS — dark personal-command-center theme */
:root {
  --bg: #0b0f1a;
  --bg-soft: #101626;
  --panel: #151d31;
  --panel-2: #1b2440;
  --line: #232e4d;
  --ink: #e8ecf8;
  --ink-dim: #9aa5c4;
  --ink-faint: #6b7699;
  --accent: #7c6cf6;
  --accent-2: #a78bfa;
  --pos: #34d399;
  --neg: #f87171;
  --warn: #fbbf24;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45;
}
a { color: var(--accent-2); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; }
button { font: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { display: block; font-size: 12px; color: var(--ink-dim); margin-bottom: 5px; }

.btn {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 14px; font-weight: 600;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(135deg, #7c6cf6, #5b4bd8); border: none; color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--neg); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }

/* ---- layout ---- */
.app { display: grid; grid-template-columns: 218px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-soft); border-right: 1px solid var(--line);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #7c6cf6, #4338ca); color: #fff; font-weight: 800; font-size: 17px;
}
.brand .t { font-weight: 800; font-size: 16px; letter-spacing: .3px; }
.brand .s { font-size: 11px; color: var(--ink-faint); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  color: var(--ink-dim); font-weight: 600; border: none; background: none; text-align: left; width: 100%;
}
.nav-item:hover { background: var(--panel); color: var(--ink); }
.nav-item.active { background: var(--panel-2); color: #fff; }
.nav-item .ico { width: 20px; text-align: center; }
.nav-item.soon { opacity: .38; cursor: default; }
.nav-item.soon:hover { background: none; color: var(--ink-dim); }
.nav-item .phase { margin-left: auto; font-size: 9.5px; font-weight: 700; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; color: var(--ink-faint); padding: 14px 10px 4px; text-transform: uppercase; }
.nav-spacer { flex: 1; }
.nav-foot { font-size: 11px; color: var(--ink-faint); padding: 8px 10px 0; }

.main { padding: 22px 28px 60px; max-width: 1180px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.topbar h1 { font-size: 21px; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.updated { font-size: 12px; color: var(--ink-faint); }

/* ---- cards & KPIs ---- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi .lbl { font-size: 12px; color: var(--ink-dim); font-weight: 600; }
.kpi .val { font-size: 24px; font-weight: 800; margin-top: 4px; letter-spacing: -.5px; }
.kpi .sub { font-size: 11.5px; color: var(--ink-faint); margin-top: 3px; }
.kpi.hero { background: linear-gradient(135deg, #1c1836, #151d31); border-color: #33306b; }
.kpi.hero .val { font-size: 28px; background: linear-gradient(90deg, #c4b5fd, #818cf8); -webkit-background-clip: text; background-clip: text; color: transparent; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .hint { font-size: 11.5px; color: var(--ink-faint); font-weight: 400; margin-left: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

.pos { color: var(--pos); } .neg { color: var(--neg); }

/* ---- account rows ---- */
.acct { display: flex; align-items: center; gap: 12px; padding: 11px 6px; border-bottom: 1px solid var(--line); }
.acct:last-child { border-bottom: none; }
.acct .badge {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #fff; flex: none;
}
.acct .nm { font-weight: 600; }
.acct .org { font-size: 11.5px; color: var(--ink-faint); }
.acct .bal { margin-left: auto; text-align: right; }
.acct .bal .b { font-weight: 700; font-size: 15px; }
.acct .bal .d { font-size: 11px; color: var(--ink-faint); }
.tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px; letter-spacing: .4px; text-transform: uppercase; }
.tag.cash { background: #0c3a2e; color: #6ee7b7; }
.tag.credit { background: #42172a; color: #fda4af; }
.tag.investment { background: #1e2a56; color: #93c5fd; }
.tag.manual { background: #3a2e0c; color: #fcd34d; }

/* ---- transactions ---- */
.txn { display: flex; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 13px; align-items: baseline; }
.txn:last-child { border-bottom: none; }
.txn .d { color: var(--ink-faint); font-size: 11.5px; width: 74px; flex: none; }
.txn .acc { color: var(--ink-faint); font-size: 11.5px; width: 150px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn .desc { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn .amt { font-weight: 700; }
.txn .pend { font-size: 9.5px; color: var(--warn); border: 1px solid #4d3d12; padding: 1px 5px; border-radius: 5px; }

/* ---- sources strip ---- */
.sources { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.source { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 6px 13px; font-size: 12px; color: var(--ink-dim); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.dot.ok { background: var(--pos); } .dot.err { background: var(--neg); }

/* ---- holdings ---- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; color: var(--ink-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; padding: 6px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: none; }
.tbl .r { text-align: right; }

/* ---- history ---- */
.hist { display: flex; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.hist:last-child { border-bottom: none; }
.hist .when { width: 130px; flex: none; font-size: 11.5px; color: var(--ink-faint); padding-top: 2px; }
.hist .k { width: 66px; flex: none; }
.hist .body { flex: 1; }
.hist .title { font-weight: 600; }
.hist .detail { font-size: 12.5px; color: var(--ink-dim); margin-top: 2px; white-space: pre-wrap; }
.hist .acts { flex: none; opacity: 0; display: flex; gap: 4px; }
.hist:hover .acts { opacity: 1; }
.hist.pinned { background: #171330; border-radius: 10px; border-bottom-color: transparent; }
.kind { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px; text-transform: uppercase; }
.kind.note { background: #1e2a56; color: #93c5fd; }
.kind.event { background: #2b2151; color: #c4b5fd; }
.kind.connect { background: #0c3a2e; color: #6ee7b7; }
.kind.error { background: #42172a; color: #fda4af; }
.kind.sync { background: #263042; color: #9aa5c4; }

/* ---- assistant chat ---- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 380px; }
.chat .msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 6px 2px 14px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, #5b4bd8, #4338ca); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.thinking { color: var(--ink-faint); font-style: italic; }
.chat .composer { display: flex; gap: 8px; }
.chat .composer input { flex: 1; padding: 11px 14px; border-radius: 11px; }

/* ---- settings ---- */
.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.muted { color: var(--ink-faint); font-size: 12.5px; }
.notice { background: #171330; border: 1px solid #33306b; border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--ink-dim); margin-bottom: 14px; }
.notice b { color: var(--ink); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.demo-banner { background: #3a2e0c; color: #fcd34d; border-radius: 9px; padding: 7px 13px; font-size: 12.5px; font-weight: 600; margin-bottom: 16px; display: inline-block; }

.empty { text-align: center; padding: 44px 20px; color: var(--ink-faint); }
.empty .big { font-size: 34px; margin-bottom: 10px; }
.empty h3 { color: var(--ink-dim); margin-bottom: 6px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
}
