/* Personal Finance — mobile-first dark theme.
   Cribbed from WCH Admin but stripped to essentials. Light-touch styling so
   the experience feels distinct from the business app. */

:root {
  --bg: #0b0f14;
  --bg-2: #111720;
  --bg-3: #1a2230;
  --fg: #e6ecf3;
  --fg-soft: #b8c0cd;
  --muted: #7a8595;
  --border: #1f2937;
  --accent: #4b9bff;
  --accent-soft: #2c5b9c;
  --danger: #ff6060;
  --warn: #ffb43c;
  --ok: #00dc8c;
  --header-h: 56px;
  --nav-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100vh; background: var(--bg); color: var(--fg); font-family: -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  height: var(--header-h); background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--accent-soft); color: #fff; font-weight: 800; font-size: 16px;
}
.brand-name { font-weight: 600; letter-spacing: 0.02em; }

.status-pill {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600;
}
.status-pill.connected { color: var(--ok); border-color: var(--ok); }
.status-pill.error     { color: var(--danger); border-color: var(--danger); }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg-2); border-top: 1px solid var(--border);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: transparent; border: none; color: var(--muted); font-size: 11px;
  padding: 8px 4px;
}
.nav-btn.primary { color: var(--accent); }
.nav-icon { font-size: 18px; line-height: 1; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }

main {
  padding: 16px;
  padding-bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  min-height: calc(100vh - var(--header-h) - var(--nav-h));
}

/* Cards / sections shared by panels */
.card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 8px 0; font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.card-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }

.btn {
  background: var(--bg-3); color: var(--fg); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 500;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-danger  { background: rgba(255,90,90,0.15); color: var(--danger); border-color: rgba(255,90,90,0.4); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.field input, .field select {
  background: var(--bg); color: var(--fg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; font-size: 14px; font-family: inherit;
}

.empty { padding: 24px 18px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.5; }
.empty h3 { margin: 0 0 8px 0; font-size: 15px; color: var(--fg); }

.error { padding: 12px; background: rgba(255,90,90,0.1); color: var(--danger); border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.loading { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* Accounts list (Banks panel) */
.acct-list { display: flex; flex-direction: column; gap: 10px; }
.acct {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px;
}
.acct-head { display: flex; justify-content: space-between; align-items: center; }
.acct-name { font-weight: 600; font-size: 14px; }
.acct-sub  { font-size: 11px; color: var(--muted); margin-top: 2px; }
.acct-balance { font-family: 'GeistMono', monospace; font-weight: 700; font-size: 16px; }
.acct-balance.neg { color: var(--danger); }

/* Activity list */
.txn-list { display: flex; flex-direction: column; gap: 6px; }
.txn {
  display: grid; grid-template-columns: 60px 1fr auto; gap: 10px; align-items: center;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 13px;
}
.txn-date { font-family: 'GeistMono', monospace; color: var(--muted); font-size: 11px; }
.txn-desc { color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn-amt  { font-family: 'GeistMono', monospace; font-weight: 600; text-align: right; }
.txn-amt.pos { color: var(--ok); }
.txn-amt.neg { color: var(--fg-soft); }

/* Settings */
.setting-block { padding: 14px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); margin-bottom: 12px; }
.setting-block h3 { margin: 0 0 6px 0; font-size: 14px; }
.setting-help { font-size: 12px; color: var(--muted); margin: 0 0 10px 0; }

/* Modal (used for entity tagging etc.) */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--bg-2); border-top-left-radius: 16px; border-top-right-radius: 16px;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom)) 16px;
  width: 100%; max-width: 480px; max-height: 80vh; overflow-y: auto;
}
.modal h3 { margin: 0 0 12px 0; font-size: 16px; }
