/* FinanceHub — single stylesheet */
:root {
  /* JacobsInc signature: deep navy + gold */
  --bg: #081020;
  --bg2: #0c1830;
  --card: #122040;
  --card2: #16294e;
  --border: #23385f;
  --text: #e9eef8;
  --muted: #8fa3c4;
  --primary: #3b76e8;
  --primary-hover: #5b90f5;
  --gold: #e8b64c;
  --teal: #3fd6b3;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.4);
  --grad: linear-gradient(135deg, #4a86f0, #2456b8);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(1200px 800px at 80% -10%, #14264d 0%, var(--bg) 55%),
              radial-gradient(900px 600px at -10% 110%, #0d1b38 0%, var(--bg) 60%);
  color: var(--text);
  font-size: 14px;
}
h1,h2,h3 { margin: 0; font-weight: 700; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
.hidden { display: none !important; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  width: 380px; max-width: 100%; text-align: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 40px 34px; box-shadow: var(--shadow);
}
.auth-logo-img { width: 92px; height: 92px; margin-bottom: 4px; }
.auth-card .brand-eyebrow { font-size: 11px; letter-spacing: 4px; margin-top: 6px; }
.auth-card h1 { font-size: 34px; margin: 2px 0 6px; font-weight: 800; }
.wm-fin { color: #f2f5fb; }
.wm-hub {
  background: linear-gradient(120deg, #4a86f0, #2b9fe8);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-tagline { font-size: 10px; letter-spacing: 3px; color: #cdd6ea; font-weight: 600; margin-bottom: 18px; }
.auth-tagline i { color: var(--teal); font-style: normal; }
.auth-sub { color: var(--muted); margin: 0 0 22px; }
.auth-note { color: var(--amber); font-size: 13px; }
.auth-card input {
  width: 100%; margin-bottom: 12px; padding: 12px 14px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 15px; outline: none;
}
.auth-card input:focus { border-color: var(--primary); }
.auth-card button {
  width: 100%; padding: 12px; border: 0; border-radius: 10px;
  background: var(--grad); color: #fff; font-size: 15px; font-weight: 600;
  box-shadow: 0 4px 18px rgba(59,118,232,.35);
}
.auth-card button:hover { filter: brightness(1.12); }
.auth-error { color: var(--red); min-height: 18px; font-size: 13px; }

/* ---------- shell ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 230px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--bg2); border-right: 1px solid var(--border); padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 800; padding: 4px 10px 18px; letter-spacing: .2px; }
.brand b { color: var(--primary-hover); }
.brand-logo { width: 34px; height: 34px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-eyebrow {
  font-size: 9.5px; font-weight: 700; letter-spacing: 3px;
  color: var(--teal); text-transform: uppercase;
}
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  color: var(--muted); text-decoration: none; border-radius: 10px; font-weight: 500;
}
#nav a:hover { color: var(--text); background: rgba(255,255,255,.04); }
#nav a.active { color: #fff; background: var(--primary); }
#nav a { position: relative; }
.nav-badge { display: none; }
.nav-badge.on {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px; margin-left: auto;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px;
}
@media (max-width: 760px) {
  .nav-badge.on { position: absolute; top: 2px; right: 2px; margin: 0; }
}
.sidebar-entities { margin-top: 22px; padding: 0 10px; flex: 1; overflow-y: auto; }
.sidebar-entities h4 { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin: 0 0 10px; }
.side-ent { display: flex; align-items: center; gap: 8px; padding: 5px 0; color: var(--muted); font-size: 13px; }
.side-ent .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.side-ent .amt { margin-left: auto; font-variant-numeric: tabular-nums; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px 10px 4px; font-size: 13px; line-height: 1.25; }
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.logout-btn {
  margin-top: 10px; padding: 9px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-weight: 500;
}
.logout-btn:hover { color: var(--text); border-color: var(--muted); }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 26px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.topbar h2 { font-size: 20px; }
.topbar-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.topbar-controls select, .topbar-controls input {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 12px; outline: none; font-size: 13px;
}
/* account menu (top-right, always visible) */
.acct { position: relative; }
.acct-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--grad); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.acct-btn:hover { filter: brightness(1.1); }
.acct-pop {
  position: absolute; top: 46px; right: 0; z-index: 40; min-width: 210px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 12px; display: none; flex-direction: column; gap: 8px;
}
.acct-pop.open { display: flex; }
.acct-who { font-size: 13px; color: var(--muted); padding: 2px 2px 8px; border-bottom: 1px solid var(--border); }
.acct-who b { color: var(--text); display: block; font-size: 14px; }
.acct-pop .btn { width: 100%; justify-content: center; text-align: center; }

.view { flex: 1; overflow-y: auto; padding: 24px 26px 60px; }

/* ---------- welcome / first-run ---------- */
.welcome-card {
  max-width: 480px; margin: 40px auto; text-align: center;
  background: linear-gradient(160deg, var(--card) 0%, var(--bg2) 130%);
  border: 1px solid var(--border); border-radius: 18px; padding: 34px 30px; box-shadow: var(--shadow);
}
.welcome-icon { font-size: 44px; margin-bottom: 6px; }
.welcome-card h2 { font-size: 22px; margin-bottom: 10px; }
.welcome-card p { color: var(--muted); line-height: 1.6; margin: 0 0 18px; }
.welcome-card .btn { font-size: 15px; padding: 12px 22px; }
.welcome-hint { font-size: 12.5px; margin-top: 18px !important; }

/* ---------- daily quote ---------- */
.quote-bar {
  padding: 9px 26px 0; font-size: 12.5px; font-style: italic; color: var(--muted);
  line-height: 1.5;
}
.quote-bar .q-mark { color: var(--teal); font-size: 16px; font-style: normal; margin-right: 2px; }
.quote-bar .q-author { color: var(--teal); font-style: normal; font-size: 11.5px; font-weight: 600; }
.shared-badge { font-size: 11px; opacity: .85; cursor: default; }
.fam-badge {
  font-size: 11px; padding: 1px 7px; border-radius: 20px; white-space: nowrap;
  background: rgba(232,182,76,.14); color: var(--gold); border: 1px solid rgba(232,182,76,.3);
}
.fam-chip {
  display: inline-flex; align-items: center; gap: 6px; margin: 0 6px 6px 0; padding: 5px 6px 5px 11px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 20px; font-size: 13px;
}
.fam-chip button { background: none; border: 0; color: var(--muted); font-size: 13px; cursor: pointer; padding: 0 3px; }
.fam-chip button:hover { color: var(--red); }

/* ---------- buttons ---------- */
.btn {
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-weight: 600; font-size: 13px;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: 0 3px 12px rgba(59,118,232,.28); }
.btn-primary:hover { filter: brightness(1.12); border-color: transparent; }
.btn-danger { color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---------- cards / grids ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 20px; }
.card {
  background: linear-gradient(160deg, var(--card) 0%, var(--bg2) 130%);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: #33507f; }
.card .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; }
.card .value { font-size: 24px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.pos { color: var(--green); } .neg { color: var(--red); }

.panel-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-bottom: 20px; }
@media (max-width: 1000px) { .panel-grid { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.panel h3 { font-size: 14px; margin-bottom: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .8px; }
.chart-box { position: relative; height: 260px; }

/* entity overview cards */
.ent-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; margin-bottom: 20px; }
.ent-card {
  border: 1px solid var(--border); border-left: 4px solid var(--primary);
  background: var(--card); border-radius: 12px; padding: 14px 16px; cursor: pointer;
}
.ent-card:hover { background: var(--card2); }
.ent-card .name { font-weight: 700; }
.ent-card .type { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.ent-card .nums { margin-top: 8px; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.ent-card .nums b { font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .8px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid rgba(38,47,87,.5); font-size: 13.5px; vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,.02); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 20px; font-size: 12px; background: var(--bg2); border: 1px solid var(--border); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.row-actions button { background: none; border: 0; color: var(--muted); font-size: 14px; padding: 3px 5px; border-radius: 6px; }
.row-actions button:hover { color: var(--text); background: var(--bg2); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* filter bar */
.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filters input, .filters select {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; outline: none;
}
.filters input[type=text] { min-width: 220px; }

/* ---------- budgets ---------- */
.budget-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.budget-item { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.budget-item .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.budget-item .cat { font-weight: 600; }
.budget-item .ent { font-size: 11.5px; color: var(--muted); }
.bar { height: 8px; border-radius: 6px; background: var(--bg2); overflow: hidden; }
.bar > div { height: 100%; border-radius: 6px; background: var(--green); transition: width .4s; }
.bar > div.warn { background: var(--amber); }
.bar > div.over { background: var(--red); }
.budget-item .nums { display: flex; justify-content: space-between; margin-top: 7px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5,8,20,.7); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 440px; max-width: 100%; max-height: 90vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 24px; box-shadow: var(--shadow);
}
.modal h3 { margin-bottom: 16px; }
.modal label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.modal input:not([type=checkbox]), .modal select {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 14px; outline: none;
}
.modal input:focus, .modal select:focus { border-color: var(--primary); }
.modal .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .check { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.kind-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.kind-tabs button {
  flex: 1; padding: 8px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--muted); font-weight: 600;
}
.kind-tabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- receipt upload ---------- */
.drop {
  border: 2px dashed var(--border); border-radius: 12px; padding: 26px 16px;
  text-align: center; color: var(--muted); cursor: pointer; margin-bottom: 14px;
}
.drop:hover, .drop.over { border-color: var(--primary); color: var(--text); background: rgba(99,102,241,.06); }
.drop-icon { font-size: 30px; margin-bottom: 6px; }
.drop-sub { font-size: 12px; margin-top: 4px; }
.rc-filebar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.rc-preview { max-width: 100%; max-height: 220px; border-radius: 10px; border: 1px solid var(--border); display: block; margin: 0 auto 10px; }
.rc-status { font-size: 12.5px; color: var(--amber); min-height: 18px; margin-bottom: 10px; }
.rc-status.done { color: var(--green); }
.att-link { text-decoration: none; }
.tx-slip-preview { margin: -4px 0 12px; }
.tx-slip-preview img { max-height: 160px; max-width: 100%; border-radius: 10px; border: 1px solid var(--border); display: block; }
.tx-slip-preview .file-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.tx-slip-preview a { color: var(--primary-hover); text-decoration: none; }
.slip-thumb {
  width: 28px; height: 28px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border);
  vertical-align: middle; cursor: pointer; margin-left: 4px;
}
.slip-thumb:hover { border-color: var(--primary); }

/* ---------- invoices ---------- */
.modal-lg { width: 640px; }
.status-chip { padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; text-transform: capitalize; }
.st-draft     { background: rgba(139,147,184,.15); color: var(--muted); }
.st-sent      { background: rgba(99,102,241,.18);  color: #a5a8f8; }
.st-paid, .st-accepted { background: rgba(34,197,94,.15); color: var(--green); }
.st-declined, .st-cancelled { background: rgba(239,68,68,.15); color: var(--red); }
.items-table td { padding: 4px 4px; border-bottom: 0; }
.items-table input { margin-top: 0 !important; }
.items-table .it-del { background: none; border: 0; color: var(--muted); font-size: 15px; }
.items-table .it-del:hover { color: var(--red); }
.inv-totals { text-align: right; margin-top: 10px; font-size: 13.5px; color: var(--muted); }
.inv-totals b { color: var(--text); font-size: 16px; }

/* ---------- debt planner ---------- */
.plan-controls { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 8px; }
.plan-controls label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.plan-controls input, .plan-controls select {
  display: block; margin-top: 5px; padding: 9px 12px; min-width: 200px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 14px; outline: none;
}
.plan-controls input:focus, .plan-controls select:focus { border-color: var(--primary); }

/* ---------- tasks ---------- */
.task-add { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.task-add input[type=text] { flex: 1; min-width: 220px; }
.task-add input, .task-add select {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 9px 12px; font-size: 13.5px; outline: none;
}
.task-group h4 { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin: 18px 0 8px; }
.task-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px;
}
.task-row.done { opacity: .5; }
.task-row.done .t-title { text-decoration: line-through; }
.task-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--green); cursor: pointer; }
.task-row .t-title { flex: 1; font-weight: 500; }
.task-row .t-due { font-size: 12px; color: var(--muted); white-space: nowrap; }
.task-row .t-due.overdue { color: var(--red); font-weight: 600; }
.prio { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.prio.high { background: var(--red); } .prio.med { background: var(--amber); } .prio.low { background: var(--muted); }

/* ---------- ideas ---------- */
.idea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.idea-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; cursor: pointer; }
.idea-card:hover { background: var(--card2); }
.idea-card .i-title { font-weight: 700; margin-bottom: 6px; }
.idea-card .i-body { color: var(--muted); font-size: 12.5px; line-height: 1.5; max-height: 68px; overflow: hidden; white-space: pre-line; }
.idea-card .i-foot { display: flex; justify-content: space-between; margin-top: 10px; font-size: 11px; color: var(--muted); }
.st-spark { background: rgba(245,158,11,.15); color: var(--amber); }
.st-exploring { background: rgba(6,182,212,.15); color: #67e8f9; }
.st-building { background: rgba(99,102,241,.18); color: #a5a8f8; }
.st-parked { background: rgba(139,147,184,.15); color: var(--muted); }
.st-done { background: rgba(34,197,94,.15); color: var(--green); }

/* ---------- calendar ---------- */
.cal-day { margin-bottom: 14px; }
.cal-day h4 { color: var(--muted); font-size: 12px; margin: 0 0 6px; }
.cal-day h4.today { color: var(--primary-hover); }
.cal-ev {
  display: flex; gap: 12px; align-items: baseline; padding: 8px 12px; margin-bottom: 5px;
  background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: 10px;
}
.cal-ev.google { border-left-color: var(--green); }
.cal-ev .ev-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; white-space: nowrap; min-width: 78px; }
.cal-ev .ev-title { font-weight: 500; flex: 1; }
.cal-ev .ev-meta { color: var(--muted); font-size: 11.5px; }

/* ---------- documents ---------- */
.doc-preview {
  min-height: 200px; max-height: 420px; overflow-y: auto;
  background: #f7f9fd; color: #1a2033; border-radius: 10px; padding: 18px 22px;
  font-size: 13.5px; line-height: 1.6;
}
.doc-preview h1 { font-size: 20px; color: #12203c; border-bottom: 2px solid #2456b8; padding-bottom: 6px; margin: 0 0 10px; }
.doc-preview h2 { font-size: 14px; color: #2456b8; text-transform: uppercase; letter-spacing: 1px; margin: 16px 0 6px; }
.doc-preview h3 { font-size: 13.5px; margin: 10px 0 4px; }
.doc-preview ul { margin: 4px 0; padding-left: 20px; }
.doc-preview p { margin: 5px 0; }
.doc-preview hr { border: 0; border-top: 1px solid #d5ddec; }

/* ---------- assistant chat ---------- */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 54px; height: 54px; border-radius: 50%; border: 0; font-size: 25px;
  background: var(--grad); color: #fff;
  box-shadow: 0 6px 22px rgba(59,118,232,.45); cursor: pointer;
}
.chat-fab:hover { filter: brightness(1.12); transform: scale(1.06); }
.chat-drawer {
  position: fixed; right: 22px; bottom: 88px; z-index: 60;
  width: 390px; max-width: calc(100vw - 24px); height: 540px; max-height: calc(100vh - 120px);
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); display: none; flex-direction: column; overflow: hidden;
}
.chat-drawer.open { display: flex; }
.chat-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.chat-model { color: var(--muted); font-size: 11px; margin-left: 4px; }
.chat-close, .chat-clear { background: none; border: 0; color: var(--muted); font-size: 15px; padding: 4px 6px; }
.chat-close:hover, .chat-clear:hover { color: var(--text); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 86%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.chat-msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-msg.thinking { color: var(--muted); font-style: italic; }
.chat-msg.error { border-color: var(--red); color: #fca5a5; }
.chat-hello { color: var(--muted); font-size: 12.5px; text-align: center; padding: 20px 10px; line-height: 1.6; }
.chat-inputbar { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.chat-inputbar input {
  flex: 1; padding: 10px 12px; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 13.5px; outline: none;
}
.chat-inputbar input:focus { border-color: var(--primary); }
.chat-inputbar .btn { padding: 9px 14px; }
.chat-mic, .chat-lang {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 10px; padding: 0 10px; font-size: 15px; cursor: pointer; flex-shrink: 0;
}
.chat-lang { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; color: var(--teal); padding: 0 8px; }
.chat-mic:hover, .chat-lang:hover { border-color: var(--muted); }
.chat-mic.listening {
  background: var(--red); border-color: var(--red); color: #fff;
  animation: mic-pulse 1.2s infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); }
  50% { box-shadow: 0 0 0 7px rgba(239,68,68,0); }
}
@media (max-width: 760px) {
  .chat-drawer { right: 8px; bottom: 78px; height: 70vh; }
  .chat-fab { right: 14px; bottom: 14px; }
}

/* ---------- statement import ---------- */
.imp-summary { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.imp-summary b { color: var(--text); }
.imp-table-wrap { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; }
.imp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.imp-table th { position: sticky; top: 0; background: var(--bg2); z-index: 1; padding: 7px 8px; text-align: left; }
.imp-table td { padding: 5px 8px; border-bottom: 1px solid rgba(38,47,87,.5); vertical-align: middle; }
.imp-table tr.dup td { opacity: .5; }
.imp-table .imp-amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.imp-table input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); }
.imp-table select { background: var(--bg2); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 3px 5px; font-size: 12px; max-width: 150px; }
.imp-table .dup-tag { font-size: 10px; color: var(--amber); border: 1px solid rgba(245,158,11,.4); border-radius: 10px; padding: 0 5px; margin-left: 4px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 20px; border-radius: 12px; box-shadow: var(--shadow);
  opacity: 0; transition: all .25s; z-index: 100; font-weight: 500;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--red); color: #fca5a5; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1000px) { .settings-grid { grid-template-columns: 1fr; } }
.panel .panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel .panel-head h3 { margin: 0; }

/* section headers inside views */
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 14px; }
.section-head h3 { font-size: 15px; }

/* mobile */
@media (max-width: 760px) {
  .app { flex-direction: column; height: 100dvh; }
  .sidebar {
    width: 100%; flex-direction: row; align-items: center; gap: 2px;
    padding: 8px 10px; overflow-x: auto; flex-shrink: 0;
  }
  .brand { padding: 0 8px 0 2px; white-space: nowrap; font-size: 17px; }
  #nav { flex-direction: row; gap: 0; }
  #nav a { padding: 8px 9px; font-size: 17px; }
  #nav a .nav-lbl { display: none; }        /* icons only in the top bar */
  .sidebar-entities, .user-chip { display: none; }
  .logout-btn { display: block; margin: 0 0 0 4px; padding: 7px 10px; font-size: 12px; white-space: nowrap; }
  .topbar { padding: 12px 14px; gap: 10px; }
  .topbar h2 { font-size: 17px; width: 100%; }
  .topbar-controls { width: 100%; }
  .topbar-controls select, .topbar-controls input { flex: 1; min-width: 0; }
  .topbar-controls .btn { flex: 1; white-space: nowrap; }
  .view { padding: 14px 12px 60px; }
  .quote-bar { padding: 8px 14px 0; font-size: 11.5px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 13px 14px; }
  .card .value { font-size: 19px; }
  .panel { padding: 14px; overflow-x: auto; }   /* wide tables scroll inside their panel */
  .panel table { min-width: 560px; }
  .panel .chart-box canvas { min-width: 0; }
  #contactsWrap table, #txTableWrap table, #invTableWrap table { min-width: 640px; }
  .section-head { flex-wrap: wrap; gap: 10px; }
  .filters input[type=text] { min-width: 0; flex: 1; }
  .modal { padding: 18px 16px; }
  .modal .grid2 { grid-template-columns: 1fr; gap: 0; }
  .plan-controls input, .plan-controls select { min-width: 0; width: 100%; }
  .plan-controls label { flex: 1 1 100%; }
  .ent-cards { grid-template-columns: 1fr 1fr; }
  .budget-list { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .today-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 430px) {
  .cards { grid-template-columns: 1fr; }
  .ent-cards { grid-template-columns: 1fr; }
}
