/* ============ Two & Co — finance hub design tokens ============ */
@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700&family=Heebo:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap');

:root {
  /* tweakable knobs (overridden inline by app) */
  --accent-h: 42;
  --accent-c: 0.115;
  --accent-l: 0.66;

  --accent: oklch(var(--accent-l) var(--accent-c) var(--accent-h));
  --accent-strong: oklch(calc(var(--accent-l) - 0.08) var(--accent-c) var(--accent-h));
  --accent-soft: oklch(var(--accent-l) var(--accent-c) var(--accent-h) / 0.14);
  --accent-ghost: oklch(var(--accent-l) var(--accent-c) var(--accent-h) / 0.07);

  --positive: oklch(0.60 0.085 165);
  --positive-soft: oklch(0.60 0.085 165 / 0.14);
  --negative: oklch(0.57 0.15 27);
  --negative-soft: oklch(0.57 0.15 27 / 0.13);

  --font-ui: 'Hanken Grotesk', 'Heebo', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* density */
  --pad: 22px;
  --gap: 18px;
  --radius: 16px;
  --radius-sm: 10px;
  --row-h: 52px;

  color-scheme: light;
}

:root[data-density="compact"] { --pad: 16px; --gap: 13px; --row-h: 44px; }
:root[data-density="comfy"]   { --pad: 28px; --gap: 24px; --row-h: 60px; }

/* ---------- light ---------- */
:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #fffdfa;
  --surface-2: #f1ede6;
  --surface-3: #eae5db;
  --border: #e7e0d5;
  --border-strong: #d8cfc0;
  --text: #241f18;
  --text-2: #6d6557;
  --text-3: #9b9384;
  --shadow: 0 1px 2px rgba(58,46,28,.05), 0 8px 24px -12px rgba(58,46,28,.14);
  --shadow-lg: 0 4px 12px rgba(58,46,28,.08), 0 24px 60px -20px rgba(58,46,28,.28);
  color-scheme: light;
}

/* ---------- dark ---------- */
:root[data-theme="dark"] {
  --bg: #16130e;
  --surface: #211c15;
  --surface-2: #2a241b;
  --surface-3: #332c21;
  --border: #342d22;
  --border-strong: #463d2e;
  --text: #f4efe6;
  --text-2: #ada391;
  --text-3: #7d745f;
  --accent: oklch(calc(var(--accent-l) + 0.06) var(--accent-c) var(--accent-h));
  --accent-strong: oklch(calc(var(--accent-l) + 0.12) var(--accent-c) var(--accent-h));
  --positive: oklch(0.72 0.10 165);
  --positive-soft: oklch(0.72 0.10 165 / 0.16);
  --negative: oklch(0.68 0.16 27);
  --negative-soft: oklch(0.68 0.16 27 / 0.16);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.4), 0 24px 60px -20px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.45;
  transition: background .35s ease, color .35s ease;
}
#root { height: 100%; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num  { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

h1,h2,h3,h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; line-height: 1.15; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent-soft); }

/* scrollbars */
.scroll { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* ====================== layout shell ====================== */
.app { display: flex; height: 100%; overflow: hidden; }

.main {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  height: 100%; overflow: hidden;
}
.content { flex: 1; overflow-y: auto; }
.page { max-width: 1180px; margin: 0 auto; padding: 30px 40px 80px; }

@media (max-width: 720px) {
  .page { padding: 18px 16px 100px; }
}

/* ====================== sidebar ====================== */
.sidebar {
  width: 250px; flex-shrink: 0; background: var(--surface);
  border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100%;
  transition: width .25s ease;
}
.sidebar.collapsed { width: 76px; }

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 22px 20px 18px;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 16px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.brand-name { font-weight: 600; font-size: 16.5px; letter-spacing: -0.02em; white-space: nowrap; }
.brand-sub  { font-size: 11px; color: var(--text-3); white-space: nowrap; }

.nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 3px; }
.nav-section-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); padding: 16px 12px 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px; border: 0; background: transparent;
  color: var(--text-2); font-size: 14.5px; font-weight: 500; text-align: left;
  width: 100%; white-space: nowrap; position: relative;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.nav-item .nav-badge {
  margin-inline-start: auto; font-size: 11px; padding: 2px 7px; border-radius: 99px;
  background: var(--negative-soft); color: var(--negative); font-weight: 600;
}
.sidebar.collapsed .nav-item .label,
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .side-foot-text { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; }

.side-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--border); }
.couple {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px;
}
.avatars { display: flex; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; color: #fff; border: 2px solid var(--surface);
}
.avatar:nth-child(2) { margin-left: -10px; }

/* ====================== topbar ====================== */
.topbar {
  height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; border-bottom: 1px solid var(--border); background: var(--surface);
}
@media (max-width: 720px) { .topbar { padding: 0 16px; height: 58px; } }
.topbar h2 { font-size: 19px; white-space: nowrap; }
.topbar .crumb { color: var(--text-3); font-size: 13px; margin-top: 1px; }
.spacer { flex: 1; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); display: grid; place-items: center;
  transition: .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }

/* currency switch */
.cur-switch { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.cur-switch button {
  border: 0; background: transparent; color: var(--text-2); font-weight: 600;
  font-size: 13px; padding: 6px 11px; border-radius: 8px; transition: .15s; font-family: var(--font-mono);
}
.cur-switch button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ====================== primitives ====================== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: var(--pad); }
.grid { display: grid; gap: var(--gap); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid transparent; border-radius: 11px; padding: 10px 16px;
  font-size: 14px; font-weight: 600; transition: .15s; white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-quiet { background: transparent; color: var(--text-2); }
.btn-quiet:hover { background: var(--surface-2); color: var(--text); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--text-2);
}
.chip.accent { background: var(--accent-soft); color: var(--accent-strong); }
.chip.pos { background: var(--positive-soft); color: var(--positive); }
.chip.neg { background: var(--negative-soft); color: var(--negative); }

.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.pos { color: var(--positive); }
.neg { color: var(--negative); }

.sectionhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.sectionhead h3 { font-size: 17px; }

/* progress bars */
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; position: relative; }
.bar > i { display: block; height: 100%; border-radius: 99px; transition: width .5s cubic-bezier(.3,.8,.3,1); }

/* avatar small (person tags) */
.tag-av {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 10.5px; font-weight: 700; color: #fff; flex-shrink: 0;
}

/* table-ish rows */
.row {
  display: flex; align-items: center; gap: 14px; padding: 13px 4px;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; }

/* modal */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(20,15,8,.42); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 1000; padding: 20px;
  animation: fade .2s ease;
}
.modal {
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  border: 1px solid var(--border); animation: pop .22s cubic-bezier(.3,.9,.3,1);
}
.modal-lg { max-width: 560px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.input, .select {
  width: 100%; height: 42px; padding: 0 13px; border-radius: 11px;
  border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text); font-family: inherit; font-size: 14.5px; outline: none; transition: .15s;
}
.input:focus, .select:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.mono { font-family: var(--font-mono); }

.seg {
  display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px;
}
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--text-2); font-weight: 600;
  font-size: 13.5px; padding: 8px; border-radius: 9px; transition: .15s;
}
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* data table (holdings) */
.ntable { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.ntable th {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); text-align: end; padding: 4px 12px 12px; white-space: nowrap;
}
.ntable td { padding: 12px; border-top: 1px solid var(--border); vertical-align: middle; }
.ntable tbody tr { transition: background .12s; }
.ntable tbody tr:hover { background: var(--surface-2); }

/* entrance */
.rise { animation: rise .45s cubic-bezier(.2,.7,.3,1) backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* mobile bottom nav */
.bottomnav { display: none; }
@media (max-width: 720px) {
  .sidebar { display: none; }
  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 64px;
    background: var(--surface); border-top: 1px solid var(--border); z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav button {
    flex: 1; border: 0; background: transparent; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px; color: var(--text-3); font-size: 10.5px; font-weight: 600;
  }
  .bottomnav button svg { width: 21px; height: 21px; }
  .bottomnav button.active { color: var(--accent-strong); }
}
