/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

/* ===== THEMES ===== */
[data-theme="dark"] {
  --bg:        #0b0c11;
  --bg2:       #13141b;
  --bg3:       #1a1c26;
  --bg4:       #22253a;
  --border:    #272a3d;
  --text:      #e4e6f0;
  --muted:     #636880;
  --dim:       #3d4060;
  --accent:    #6c63ff;
  --accent-lt: rgba(108,99,255,.14);
  --green:     #00d4a0;
  --green-lt:  rgba(0,212,160,.12);
  --red:       #ff5f7e;
  --red-lt:    rgba(255,95,126,.12);
  --shadow:    0 4px 24px rgba(0,0,0,.5);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.35);
}

[data-theme="light"] {
  --bg:        #f2f4fb;
  --bg2:       #ffffff;
  --bg3:       #f7f8fd;
  --bg4:       #eceef8;
  --border:    #dce0f0;
  --text:      #1a1d2e;
  --muted:     #7179a0;
  --dim:       #b0b8d8;
  --accent:    #5b52f0;
  --accent-lt: rgba(91,82,240,.1);
  --green:     #00aa80;
  --green-lt:  rgba(0,170,128,.1);
  --red:       #e0405f;
  --red-lt:    rgba(224,64,95,.1);
  --shadow:    0 4px 24px rgba(0,0,0,.07);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.05);
}

body { background: var(--bg); color: var(--text); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ===== TYPOGRAPHY ===== */
.font-display { font-family: 'Syne', sans-serif; }

/* ===== AUTH ===== */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 15% 50%, rgba(108,99,255,.18) 0%, transparent 100%),
    radial-gradient(ellipse 40% 40% at 85% 15%, rgba(0,212,160,.1) 0%, transparent 100%),
    var(--bg);
}

[data-theme="light"] .auth-bg {
  background:
    radial-gradient(ellipse 60% 50% at 15% 50%, rgba(91,82,240,.12) 0%, transparent 100%),
    radial-gradient(ellipse 40% 40% at 85% 15%, rgba(0,170,128,.07) 0%, transparent 100%),
    var(--bg);
}

.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  padding: 24px;
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
}

.brand-mark svg { width: 100%; height: 100%; }
.brand-mark.sm { width: 30px; height: 30px; margin: 0; }

.auth-brand h1 {
  font-family: 'Syne', sans-serif;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.5px;
  background: linear-gradient(to right, var(--text) 40%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-brand p { color: var(--muted); font-size: 14px; margin-top: 4px; }

.auth-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
  animation: slideUp .35s ease;
}

.auth-card h2 {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 2px;
}

.auth-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.auth-switch { text-align: center; font-size: 13px; color: var(--muted); margin-top: 16px; }
.auth-switch a { color: var(--accent); text-decoration: none; font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 13px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-lt);
}

.form-group select option { background: var(--bg2); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.form-error {
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 10px;
}

.lbl-opt {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--dim);
  text-transform: none;
  letter-spacing: 0;
}

.code-input {
  text-transform: uppercase !important;
  letter-spacing: .18em !important;
  font-size: 20px !important;
  text-align: center !important;
  font-family: 'Syne', sans-serif !important;
}

.modal-desc {
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 18px;
  line-height: 1.55;
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, var(--accent), #8b7cff);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .18s, transform .18s, box-shadow .18s;
  box-shadow: 0 4px 14px rgba(108,99,255,.3);
  white-space: nowrap;
}
.btn-primary:hover { opacity: .88; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(108,99,255,.4); }
.btn-primary svg { width: 17px; height: 17px; fill: currentColor; flex-shrink: 0; }
.btn-primary.full-width { width: 100%; justify-content: center; margin-top: 6px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .18s, border-color .18s;
}
.btn-secondary:hover { background: var(--bg4); border-color: var(--accent); }
.btn-secondary svg { width: 15px; height: 15px; fill: currentColor; }
.btn-secondary.small { padding: 7px 12px; font-size: 13px; }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red-lt);
  color: var(--red);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .18s;
}
.btn-danger:hover { background: rgba(255,95,126,.22); }
.btn-danger.small { padding: 7px 12px; font-size: 13px; }

.icon-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  transition: all .18s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg4); color: var(--text); }
.icon-btn.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-lt); }
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; }

.btn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  transition: all .18s;
}
.btn-icon:hover { background: var(--bg4); color: var(--text); }
.btn-icon.del:hover { border-color: var(--red); color: var(--red); background: var(--red-lt); }

/* ===== APP LAYOUT ===== */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--dim);
  padding: 10px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  margin-bottom: 1px;
}
.nav-item svg { width: 17px; height: 17px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accent-lt); color: var(--accent); font-weight: 600; }

.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--bg3);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--green));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-details { min-width: 0; flex: 1; }

.sidebar-actions { display: flex; gap: 8px; }

/* ===== MAIN ===== */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px;
  background: var(--bg);
}

/* ===== PAGES ===== */
.page { display: none; animation: fadeIn .25s ease; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-title {
  font-family: 'Syne', sans-serif;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.4px;
  line-height: 1.2;
}

.page-sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon-wrap svg { width: 20px; height: 20px; }
.stat-icon-wrap.income { background: var(--green-lt); color: var(--green); }
.stat-icon-wrap.income svg { fill: var(--green); }
.stat-icon-wrap.expense { background: var(--red-lt); color: var(--red); }
.stat-icon-wrap.expense svg { fill: var(--red); }
.stat-icon-wrap.neutral { background: var(--accent-lt); color: var(--accent); }
.stat-icon-wrap.neutral svg { fill: var(--accent); }

.stat-content { min-width: 0; }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.stat-value { font-family: 'Syne', sans-serif; font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }

/* ===== NET BAR ===== */
.net-bar {
  background: linear-gradient(135deg, var(--accent), #8b7cff);
  border-radius: 14px;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  box-shadow: 0 6px 20px rgba(108,99,255,.22);
}
.net-label { color: rgba(255,255,255,.75); font-size: 13.5px; }
.net-value { font-family: 'Syne', sans-serif; font-size: 24px; font-weight: 800; color: #fff; letter-spacing: -.4px; }

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
}
.section-link { font-size: 13px; color: var(--accent); text-decoration: none; }
.section-link:hover { text-decoration: underline; }

/* ===== LIST ITEMS ===== */
.list-wrap { display: flex; flex-direction: column; gap: 7px; }

.t-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 13px;
  transition: border-color .15s, transform .15s;
  animation: slideUp .25s ease;
}
.t-item:hover { border-color: var(--accent); transform: translateX(2px); }

.t-dot {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.t-dot svg { width: 18px; height: 18px; }
.t-dot.income { background: var(--green-lt); color: var(--green); }
.t-dot.income svg { fill: var(--green); }
.t-dot.expense { background: var(--red-lt); color: var(--red); }
.t-dot.expense svg { fill: var(--red); }
.t-dot.profit { background: var(--green-lt); }
.t-dot.profit svg { fill: var(--green); }
.t-dot.loss { background: var(--red-lt); }
.t-dot.loss svg { fill: var(--red); }

.t-info { flex: 1; min-width: 0; }
.t-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

.t-right { text-align: right; flex-shrink: 0; }
.t-amount { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 15px; white-space: nowrap; }
.t-amount.income, .t-amount.profit { color: var(--green); }
.t-amount.expense, .t-amount.loss { color: var(--red); }

.t-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.t-badge.profit { background: var(--green-lt); color: var(--green); }
.t-badge.loss { background: var(--red-lt); color: var(--red); }

.t-actions {
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity .15s;
}
.t-item:hover .t-actions { opacity: 1; }

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  gap: 9px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filter-bar select,
.filter-bar input {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.filter-bar input { flex: 1; min-width: 200px; }
.filter-bar select:focus,
.filter-bar input:focus { border-color: var(--accent); }
.filter-bar select option { background: var(--bg2); }

.select-inline {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  outline: none;
}

/* ===== RECAP ===== */
.recap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.recap-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  transition: transform .18s, box-shadow .18s;
}
.recap-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.recap-month-label {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.recap-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 13.5px;
}
.recap-row .rlabel { color: var(--muted); }
.recap-row .rval { font-weight: 600; }
.recap-row .rval.pos { color: var(--green); }
.recap-row .rval.neg { color: var(--red); }
.recap-row.net { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.recap-row.net .rlabel { font-weight: 700; color: var(--text); font-size: 14px; }
.recap-row.net .rval { font-size: 14px; }

/* ===== FAMILY ===== */
.onboard-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 48px 40px;
  text-align: center;
  max-width: 520px;
  margin: 40px auto;
}

.onboard-icon {
  width: 64px;
  height: 64px;
  background: var(--accent-lt);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.onboard-icon svg { width: 32px; height: 32px; fill: var(--accent); }

.onboard-card h2 {
  font-family: 'Syne', sans-serif;
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 10px;
}
.onboard-card p { color: var(--muted); font-size: 14px; line-height: 1.6; margin-bottom: 28px; }
.onboard-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.family-header-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.family-group-name {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 5px;
}

.family-group-meta { font-size: 13px; color: var(--muted); }
.dot-sep { margin: 0 6px; color: var(--dim); }

.invite-code {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--accent);
  background: var(--accent-lt);
  padding: 2px 8px;
  border-radius: 6px;
}

.family-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.badge-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 20px;
}

.members-list { display: flex; flex-direction: column; gap: 7px; }

.member-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--green));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}

.member-name { font-size: 14px; font-weight: 600; }
.member-email { font-size: 12px; color: var(--muted); }
.member-role {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
}
.member-role.admin { background: var(--accent-lt); color: var(--accent); }
.member-role.member { background: var(--bg4); color: var(--muted); }

.family-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.summary-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}

.summary-member { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.summary-income { font-size: 13.5px; color: var(--green); font-weight: 500; }
.summary-expense { font-size: 13.5px; color: var(--red); font-weight: 500; margin-top: 3px; }
.summary-net { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; margin-top: 10px; }
.summary-net.pos { color: var(--green); }
.summary-net.neg { color: var(--red); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn .2s ease;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp .28s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 0;
}

.modal-header h3 {
  font-family: 'Syne', sans-serif;
  font-size: 17px;
  font-weight: 700;
}

.modal-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.modal-close:hover { background: var(--red-lt); color: var(--red); border-color: var(--red); }
.modal-close svg { width: 15px; height: 15px; fill: currentColor; }

.modal-body { padding: 18px 22px 22px; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted);
  font-size: 14px;
  background: var(--bg2);
  border: 1px dashed var(--border);
  border-radius: 14px;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 9999;
  animation: slideUp .25s ease;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error { border-color: var(--red); color: var(--red); }

/* ===== UTILS ===== */
.hidden { display: none !important; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 720px) {
  .sidebar { display: none; }
  .main-content { padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { flex-direction: column; }
  .net-bar { flex-direction: column; gap: 6px; text-align: center; }
}
/* ===== TAGIHAN (BILLS) ===== */
.bills-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.bill-stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
}
.bill-stat-card.overdue { border-color: var(--red); }
.bsc-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.bsc-value { font-size: 22px; font-weight: 700; color: var(--text); }
.bsc-value.red { color: var(--red); }

.bills-list { display: flex; flex-direction: column; gap: 16px; }

.bill-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.bill-card:hover { border-color: var(--accent); }

.bill-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 12px;
  gap: 12px;
}

.bill-name { font-weight: 700; font-size: 16px; margin-bottom: 2px; }
.bill-notes { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.bill-amount { font-size: 13px; color: var(--accent); font-weight: 600; }

.bill-card-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.btn-pay {
  display: flex; align-items: center; gap: 5px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  padding: 7px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: opacity 0.2s;
}
.btn-pay svg { width: 14px; height: 14px; fill: #fff; }
.btn-pay:hover { opacity: 0.85; }

.bill-due-dates { padding: 0 20px 14px; }

.due-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px; margin-bottom: 6px;
  font-size: 13px;
}
.due-row.paid { background: var(--green-lt); }
.due-row.overdue { background: var(--red-lt); }
.due-row.upcoming { background: var(--accent-lt); }

.due-label { flex: 1; font-weight: 500; }
.due-date  { color: var(--muted); white-space: nowrap; }
.due-badge {
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700;
}
.due-badge.paid     { background: var(--green); color: #fff; }
.due-badge.overdue  { background: var(--red); color: #fff; }
.due-badge.upcoming { background: var(--accent); color: #fff; }
.due-paid-amt { font-size: 12px; color: var(--green); font-weight: 600; }
.due-empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

/* Due dates in modal */
.due-dates-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.due-date-row {
  display: flex; align-items: center; gap: 8px;
}
.due-date-row .ddr-label { flex: 1; }
.due-date-row .ddr-date  { flex: 1; }

.btn-outline-sm {
  display: flex; align-items: center; gap: 5px;
  background: transparent; color: var(--accent);
  border: 1.5px dashed var(--accent); border-radius: 8px;
  padding: 7px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.2s;
  width: 100%; justify-content: center;
}
.btn-outline-sm svg { width: 14px; height: 14px; fill: currentColor; }
.btn-outline-sm:hover { background: var(--accent-lt); }

/* ===== RECAP CLICKABLE ===== */
.recap-card.clickable { cursor: pointer; transition: border-color 0.2s, transform 0.15s; }
.recap-card.clickable:hover { border-color: var(--accent); transform: translateY(-2px); }
.recap-hint { font-size: 11px; color: var(--muted); margin-top: 8px; text-align: center; }

/* ===== RECAP DETAIL MODAL ===== */
.detail-summary {
  background: var(--bg3); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px;
}
.ds-item { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.ds-item.bold { font-weight: 700; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }
.detail-cat-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.detail-cats { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.detail-cat-row {
  display: grid; grid-template-columns: 1fr 100px 100px;
  gap: 8px; align-items: center; padding: 6px 10px;
  background: var(--bg3); border-radius: 8px; font-size: 13px;
}
.dcat-name { font-weight: 500; }
.dcat-in, .dcat-out { text-align: right; font-weight: 600; }

.detail-tx-list { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto; }
.detail-tx-row {
  display: grid; grid-template-columns: 100px 100px 1fr 110px;
  gap: 8px; align-items: center; padding: 6px 10px;
  background: var(--bg3); border-radius: 8px; font-size: 12px;
}
.dtx-date { color: var(--muted); white-space: nowrap; }
.dtx-cat  { font-weight: 500; }
.dtx-desc { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dtx-amt  { text-align: right; font-weight: 700; }
.dtx-amt.income  { color: var(--green); }
.dtx-amt.expense { color: var(--red); }

.recap-export-row {
  display: flex; gap: 10px; margin-top: 18px; justify-content: flex-end;
}
.btn-outline {
  display: flex; align-items: center; gap: 6px;
  background: transparent; color: var(--text);
  border: 1.5px solid var(--border); border-radius: 9px;
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: border-color 0.2s, color 0.2s;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.pos { color: var(--green); }
.neg { color: var(--red); }
/* ===== PROFILE DRAWER ===== */
.user-info-clickable {
  cursor: pointer;
  transition: background .15s;
}
.user-info-clickable:hover { background: var(--bg4); }

.profile-chevron {
  width: 16px; height: 16px;
  fill: var(--muted);
  flex-shrink: 0;
  margin-left: auto;
}

.profile-drawer {
  position: fixed;
  inset: 0;
  z-index: 999;
}
.profile-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
}
.profile-drawer-panel {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 360px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  animation: slideInLeft .22s ease;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

.profile-drawer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.profile-avatar-lg {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--green));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 18px; color: #fff;
  flex-shrink: 0;
}
.profile-header-info { flex: 1; min-width: 0; }
.profile-drawer-name  { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-drawer-email { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Profile Tabs */
.profile-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg3);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}
.profile-tab {
  flex: 1;
  padding: 7px 4px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  transition: all .15s;
}
.profile-tab.active {
  background: var(--bg2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.profile-tab-content { display: block; }
.profile-tab-content.hidden { display: none; }

.input-disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* ===== 2FA STYLES ===== */
.twofa-info-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--accent-lt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}
.twofa-info-box svg { width: 22px; height: 22px; fill: var(--accent); flex-shrink: 0; margin-top: 2px; }
.twofa-info-box.success { background: var(--green-lt); border-color: var(--green); }
.twofa-info-box.success svg { fill: var(--green); }
.twofa-info-title { font-weight: 700; font-size: 13.5px; margin-bottom: 3px; }
.twofa-info-desc  { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.twofa-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12.5px; font-weight: 600;
  margin-bottom: 6px;
}
.twofa-badge.disabled { background: var(--red-lt); color: var(--red); }
.twofa-badge.disabled svg { fill: var(--red); width: 14px; height: 14px; }
.twofa-badge.enabled  { background: var(--green-lt); color: var(--green); }
.twofa-badge.enabled svg  { fill: var(--green); width: 14px; height: 14px; }

.twofa-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.twofa-step  { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; }
.twofa-step-num {
  width: 22px; height: 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}

.twofa-qr-wrap {
  display: flex; justify-content: center; align-items: center;
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  margin: 12px 0;
  min-height: 160px;
  position: relative;
}
.twofa-qr-img { width: 150px; height: 150px; display: block; }
.twofa-qr-loading { position: absolute; color: #666; font-size: 13px; }

.twofa-secret-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.twofa-secret-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.twofa-secret {
  flex: 1;
  font-family: monospace;
  font-size: 12px;
  letter-spacing: 2px;
  word-break: break-all;
  color: var(--accent);
}

.danger-outline { border-color: var(--red) !important; color: var(--red) !important; }
.danger-outline:hover { background: var(--red-lt) !important; }

/* ===== 2FA LOGIN MODAL ===== */
.twofa-login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.twofa-login-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: var(--shadow);
}
.twofa-login-title { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.twofa-login-desc  { color: var(--muted); font-size: 13.5px; line-height: 1.5; }