*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --bg2: #1a1d26;
  --bg3: #22263a;
  --border: #2d3148;
  --text: #e2e4f0;
  --muted: #7b82a0;
  --pos: #4ade80;
  --neg: #f87171;
  --accent: #6366f1;
  --accent2: #818cf8;
  --radius: 10px;
}

body { background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; font-size: 14px; min-height: 100vh; }

/* NAV */
.topnav { display: flex; align-items: center; gap: 1rem; padding: .75rem 1.5rem; background: var(--bg2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.nav-brand { font-weight: 700; font-size: 1rem; color: var(--text); text-decoration: none; margin-right: auto; }
.nav-links { display: flex; gap: .25rem; }
.nav-links a { color: var(--muted); text-decoration: none; padding: .4rem .8rem; border-radius: 6px; transition: all .15s; }
.nav-links a:hover, .nav-links a.active { background: var(--bg3); color: var(--text); }
.nav-logout { color: var(--muted); text-decoration: none; font-size: .85rem; margin-left: .5rem; }
.nav-logout:hover { color: var(--neg); }

/* CONTAINER */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.page-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.page-header h2 { font-size: 1.25rem; font-weight: 600; }
.sync-badge { font-size: .75rem; color: var(--pos); background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.2); padding: .2rem .6rem; border-radius: 99px; }
.count-badge { font-size: .8rem; background: var(--bg3); color: var(--muted); padding: .2rem .6rem; border-radius: 99px; }

/* SUMMARY */
.summary-bar { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.summary-item { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.5rem; flex: 1; min-width: 160px; }
.summary-label { font-size: .75rem; color: var(--muted); display: block; margin-bottom: .35rem; text-transform: uppercase; letter-spacing: .04em; }
.summary-value { font-size: 1.4rem; font-weight: 700; }

/* ACCOUNTS GRID */
.accounts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.account-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; border-top: 3px solid var(--acc-color, var(--accent)); transition: transform .15s; }
.account-card:hover { transform: translateY(-2px); }
.account-card.archived { opacity: .5; border-top-color: var(--border); }
.acc-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.acc-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.acc-name { font-weight: 600; }
.acc-type { font-size: .75rem; color: var(--muted); margin-top: .1rem; }
.acc-balance { font-size: 1.6rem; font-weight: 700; margin: .5rem 0; }
.acc-stats { display: flex; gap: .75rem; font-size: .78rem; flex-wrap: wrap; color: var(--muted); margin-bottom: .75rem; }
.acc-link { font-size: .8rem; color: var(--accent2); text-decoration: none; }
.acc-link:hover { text-decoration: underline; }

/* ARCHIVED */
.archived-section { margin-top: 1.5rem; }
.archived-section summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: .5rem 0; }
.mt { margin-top: 1rem; }

/* FILTER BAR */
.filter-bar { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filter-bar select, .filter-bar input[type=text] { background: var(--bg2); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: .45rem .75rem; font-size: .875rem; }
.filter-bar select:focus, .filter-bar input:focus { outline: 1px solid var(--accent); }
.btn-filter { background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: .45rem 1rem; cursor: pointer; font-size: .875rem; }
.btn-reset { color: var(--muted); text-decoration: none; font-size: .875rem; align-self: center; }
.btn-reset:hover { color: var(--neg); }

/* TABLE */
.table-wrap { overflow-x: auto; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); }
.tx-table { width: 100%; border-collapse: collapse; }
.tx-table th { text-align: left; padding: .7rem 1rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--border); }
.tx-table td { padding: .65rem 1rem; border-bottom: 1px solid rgba(45,49,72,.5); vertical-align: middle; }
.tx-table tr:last-child td { border-bottom: none; }
.tx-table tr:hover td { background: rgba(99,102,241,.04); }
.td-date { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: .8rem; color: var(--muted); }
.td-account { white-space: nowrap; display: flex; align-items: center; gap: .5rem; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.td-note { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-cat { font-size: .8rem; }
.td-amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.right { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 2rem !important; }

/* BADGE */
.badge { font-size: .72rem; padding: .2rem .55rem; border-radius: 99px; font-weight: 500; }
.badge.pos  { background: rgba(74,222,128,.12); color: var(--pos); }
.badge.neg  { background: rgba(248,113,113,.12); color: var(--neg); }
.badge.muted{ background: var(--bg3); color: var(--muted); }

/* COLORS */
.pos  { color: var(--pos); }
.neg  { color: var(--neg); }
.muted{ color: var(--muted); }

/* PAGINATION */
.pagination { display: flex; align-items: center; gap: 1rem; margin-top: 1.25rem; justify-content: center; }
.btn-page { color: var(--accent2); text-decoration: none; padding: .4rem .9rem; border: 1px solid var(--border); border-radius: 6px; font-size: .875rem; }
.btn-page:hover { background: var(--bg3); }
.page-info { color: var(--muted); font-size: .875rem; }

/* LOGIN */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 380px; text-align: center; }
.login-logo { font-size: 2.5rem; margin-bottom: .5rem; }
.login-box h1 { font-size: 1.5rem; margin-bottom: .25rem; }
.login-sub { color: var(--muted); margin-bottom: 1.5rem; }
.field { text-align: left; margin-bottom: 1rem; }
.field label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .35rem; }
.field input { width: 100%; background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: .6rem .9rem; font-size: .95rem; }
.field input:focus { outline: 1px solid var(--accent); }
.btn-primary { width: 100%; background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: .7rem; font-size: 1rem; font-weight: 600; cursor: pointer; margin-top: .25rem; }
.btn-primary:hover { background: var(--accent2); }
.alert-error { background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.3); color: var(--neg); border-radius: 6px; padding: .6rem .9rem; margin-bottom: 1rem; font-size: .875rem; }
