/* ==========================================================================
   BillTrack — shared stylesheet
   Order: 1 Tokens · 2 Base · 3 App shell (sidebar, header) · 4 Cards & metrics
          5 Status & badges · 6 Lists · 7 Buttons · 8 Forms · 9 Notifications
          10 Modals · 11 Calculator · 12 Toasts · 13 Auth screens · 14 Budget
          15 Money background · 16 Responsive · then feature sections
   Only presentation lives here. Class names are shared with script.js, so
   existing names are kept even where the look has changed.
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  /* Greens */
  --primary-dark: #174B38;
  --primary: #237653;
  --brand-accent: #35A875;
  --primary-light: #EAF5EE;
  --primary-border: #CBE3D6;
  --secondary: #8FBFA5;           /* forecast / secondary chart series */

  /* Warm neutrals */
  --background: #F6F8F5;
  --surface: #FFFFFF;
  --surface-alt: #F1F5F0;
  --text: #1F2937;
  --text-muted: #6B7280;
  --border: #E5EAE5;
  --border-strong: #D3DBD3;

  /* Chart/“still due” colour and warm highlight */
  --accent: #D6A244;
  --accent-light: #FBF0D9;

  /* Status */
  --success: #237653;
  --success-bg: #EAF5EE;
  --warning: #96600A;
  --warning-bg: #FBF0D9;
  --danger: #A8432F;
  --danger-bg: #F9E9E5;
  --danger-border: #EBC9C2;
  --info: #3F6F66;
  --info-bg: #E6F0EE;

  /* Layout */
  --sidebar-width: 244px;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(23, 75, 56, .05), 0 2px 6px rgba(23, 75, 56, .04);
  --shadow-md: 0 8px 24px rgba(23, 75, 56, .09);
  --shadow-lg: 0 20px 48px rgba(17, 45, 34, .20);
  --ring: 0 0 0 .22rem rgba(35, 118, 83, .16);

  --font: "Manrope", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 160ms ease;
}

/* 2. Base ------------------------------------------------------------------ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

a { text-decoration: none; color: inherit; }
button, input, select, textarea { font: inherit; }
hr { border-color: var(--border); opacity: 1; }
.text-muted { color: var(--text-muted) !important; }
.flex-wrap { flex-wrap: wrap; }

.ti { line-height: 1; flex: 0 0 auto; }
.ui-icon { width: 18px; height: 18px; display: inline-block; flex: 0 0 auto; vertical-align: middle; }
.nav-item-link .ui-icon { width: 19px; height: 19px; }
.sidebar-logout-btn .ui-icon,
.password-toggle-btn .ui-icon { width: 18px; height: 18px; }

.brand-mark { width: 34px; height: 34px; object-fit: contain; flex: 0 0 auto; border-radius: 50%; background: #000; }
.brand-mark-lg { width: 40px; height: 40px; }
.brand-mark-xl { width: 120px; height: 120px; }
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; }

/* Keyboard focus: one consistent, visible ring */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, .nav-item-link:focus-visible, .btn-ghost-icon:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

/* 3. App shell: sidebar + header -------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--primary-dark);
  padding: 1.35rem .9rem .9rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1040;
  transition: transform .25s ease, box-shadow .25s ease;
}

.sidebar-brand {
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 1.4rem;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item-link {
  position: relative;
  color: rgba(255, 255, 255, .72);
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 550;
  display: flex;
  align-items: center;
  gap: 11px;
  transition: background var(--transition), color var(--transition);
}
.nav-item-link i { font-size: 18px; width: 20px; text-align: center; }
.nav-item-link:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.nav-item-link.active {
  background: rgba(255, 255, 255, .13);
  color: #fff;
  font-weight: 700;
}
.nav-item-link.active::before {
  content: "";
  position: absolute;
  left: -.9rem; top: 9px; bottom: 9px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--brand-accent);
}
.nav-item-link.active i { color: #8EE0B8; }

.sidebar-footer {
  margin-top: auto;
  padding: 10px 12px 8px;
  font-size: 11.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, .5);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 12px 10px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .12);
}
.sidebar-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand-accent);
  color: #0F3326;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
.sidebar-user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logout-btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, .6);
  font-size: 17px;
  padding: 6px;
  margin-left: auto;
  flex-shrink: 0;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
}
.sidebar-logout-btn:hover { color: #fff; background: rgba(255, 255, 255, .1); }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: var(--sidebar-width);
  transition: margin-left .25s ease;
  background: rgba(5, 27, 21, .94);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  padding: calc(.6rem + env(safe-area-inset-top, 0px)) calc(1.25rem + env(safe-area-inset-right, 0px)) .6rem calc(1.25rem + env(safe-area-inset-left, 0px));
  position: sticky;
  top: 0;
  z-index: 1030;
}
.topbar-brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  display: none;
  align-items: center;
  gap: 8px;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.topbar-icon-btn,
.sidebar-toggle-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  font-size: 21px;
  color: var(--text);
  line-height: 1;
  padding: 6px 8px;
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}
.topbar-icon-btn:hover, .topbar-icon-btn[aria-pressed="true"],
.sidebar-toggle-btn:hover { background: var(--primary-light); border-color: var(--primary-border); }
.topbar-icon-btn .ui-icon, .sidebar-toggle-btn .ui-icon { width: 22px; height: 22px; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 40, 30, .45);
  z-index: 1035;
  backdrop-filter: blur(2px);
}

.main-content {
  margin-left: var(--sidebar-width);
  transition: margin-left .25s ease;
  flex: 1;
  padding: 2rem 2.25rem calc(3.25rem + env(safe-area-inset-bottom, 0px));
  min-width: 0;
  max-width: 1600px;
}

.page-heading {
  font-size: clamp(23px, 2.2vw, 30px);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 1.15rem;
}
.page-subtext {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: -.72rem;
  margin-bottom: 1.65rem;
}

/* 4. Cards & metrics -------------------------------------------------------- */
.card-surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm);
}
.card-heading { font-size: 15px; font-weight: 750; letter-spacing: -0.01em; color: var(--text); }
.card-subheading { font-size: 13px; font-weight: 700; color: var(--text); }
.profile-name { font-size: 17px; font-weight: 750; letter-spacing: -0.01em; }
.provider-name { font-size: 14px; font-weight: 700; }

.metric-card { position: relative; overflow: hidden; }
.metric-card .metric-label { color: var(--text-muted); font-size: 12.5px; margin-bottom: 6px; font-weight: 600; }
.metric-card .metric-value { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.metric-card .metric-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  position: relative;
  z-index: 1;
}

.icon-bg-navy, .icon-bg-teal { background: var(--primary-light); color: var(--brand-accent); }
.icon-bg-amber { background: var(--accent-light); color: var(--warning); }
.icon-bg-red { background: var(--danger-bg); color: var(--danger); }

/* The one hero card on the dashboard: total expenses */
.metric-card-featured {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}
.metric-card-featured::after {
  content: "";
  position: absolute;
  width: 170px; height: 170px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .10);
  right: -60px; bottom: -80px;
  pointer-events: none;
}
.metric-card-featured .metric-label { color: rgba(255, 255, 255, .74); }
.metric-card-featured .metric-value { color: #fff; }
.metric-card-featured .metric-icon { background: rgba(255, 255, 255, .13); color: #8EE0B8; }

.category-icon {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--brand-accent);
  flex: 0 0 22px;
}
.category-icon .ui-icon { width: 20px; height: 20px; stroke-width: 1.85; }
.bill-category { display: inline-flex; align-items: center; gap: 8px; }
.category-label { min-width: 0; }

.empty-state {
  color: var(--text-muted);
  font-size: 13.5px;
  text-align: center;
  padding: 34px 16px;
  line-height: 1.65;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}
.empty-state .ti { font-size: 26px; color: var(--brand-accent); opacity: .65; margin-bottom: 8px; }
.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* 5. Status & badges --------------------------------------------------------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}
.status-pill .ui-icon { width: 14px; height: 14px; }
.status-paid { background: var(--success-bg); color: var(--success); border-color: rgba(35, 118, 83, .18); }
.status-upcoming { background: var(--info-bg); color: var(--info); border-color: rgba(63, 111, 102, .16); }
.status-overdue, .status-anomaly { background: var(--danger-bg); color: var(--danger); border-color: rgba(168, 67, 47, .18); }
.status-due-soon { background: var(--warning-bg); color: var(--warning); border-color: rgba(150, 96, 10, .2); }
.status-neutral { background: var(--surface-alt); color: var(--text-muted); border-color: var(--border); }

/* 6. Lists & rows ------------------------------------------------------------ */
.bill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  border-radius: 8px;
  transition: background var(--transition);
}
.bill-row:last-child { border-bottom: none; }
.bill-row:hover { background: var(--primary-light); }
.bill-provider { font-weight: 700; color: var(--text); }
.bill-meta { color: var(--text-muted); font-size: 12.5px; }

.bill-list-header {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) minmax(90px, .7fr) minmax(100px, .8fr) minmax(105px, .8fr) auto;
  gap: 12px;
  padding: 0 6px 10px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 700;
}

.bill-actions { display: inline-flex; align-items: center; gap: 6px; min-width: max-content; }

.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border); }
.table > thead > tr > th { color: var(--text-muted); font-size: 12.5px; font-weight: 700; border-bottom-color: var(--border-strong); }

/* 7. Buttons ----------------------------------------------------------------- */
.btn { border-radius: 10px; font-weight: 650; transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition); }
.btn-navy {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  padding: .55rem 1rem;
  box-shadow: 0 1px 2px rgba(23, 75, 56, .18);
}
.btn-navy:hover, .btn-navy:focus, .btn-navy:active {
  background: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
  color: #fff;
}
.btn-navy:focus-visible, .btn-outline-navy:focus-visible { box-shadow: var(--ring); outline: none; }
.btn-navy:disabled, .btn-navy.disabled { opacity: .6; }
.btn-outline-navy {
  border-color: var(--primary);
  color: var(--brand-accent);
  background: var(--surface);
}
.btn-outline-navy:hover, .btn-outline-navy:active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff;
}

.btn-ghost-icon {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn-ghost-icon .ui-icon { width: 18px; height: 18px; stroke-width: 1.85; }
.btn-ghost-icon:hover { background: var(--primary-light); border-color: var(--primary-border); color: var(--brand-accent); }
.btn-ghost-icon[data-delete]:hover { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }

.range-toggle {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 3px;
}
.range-toggle button {
  border: none;
  background: transparent;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.range-toggle button:hover:not(.active) { color: var(--brand-accent); }
.range-toggle button.active {
  background: var(--surface);
  color: var(--brand-accent);
  font-weight: 750;
  box-shadow: var(--shadow-sm);
}

.btn-link-inline {
  border: none; background: transparent; padding: 0; margin-left: 4px;
  color: var(--brand-accent); font-weight: 700; text-decoration: underline; cursor: pointer;
}

/* 8. Forms ------------------------------------------------------------------- */
.form-label { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: .35rem; }
.form-control, .form-select {
  border-color: var(--border-strong);
  background-color: #0a241b;
  color: var(--text);
  font-size: 14px;
  border-radius: 10px;
  padding: .6rem .8rem;
  min-height: 42px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control::placeholder { color: #8ca79a; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: var(--ring); background-color: #0d2d22; }
.form-control[readonly] { background: var(--surface-alt); color: var(--text-muted); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 .22rem rgba(168, 67, 47, .16); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { border-color: var(--primary); box-shadow: var(--ring); }
.input-group-text { border-color: var(--border-strong); background: var(--surface-alt); color: var(--text-muted); border-radius: 10px; }

.form-alert {
  font-size: 13px;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 1rem;
  line-height: 1.5;
  border: 1px solid transparent;
}
.form-alert-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.form-alert-info { background: var(--info-bg); color: var(--info); border-color: rgba(63, 111, 102, .16); }

.optional-tag {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 1px 7px; margin-left: 4px; vertical-align: middle;
}

.input-with-toggle { position: relative; }
.input-with-toggle input { padding-right: 44px; }
.password-toggle-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; color: var(--text-muted);
  font-size: 18px; padding: 6px; border-radius: 8px;
}
.password-toggle-btn { cursor: pointer; line-height: 1; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; }
.password-toggle-btn:hover { color: var(--brand-accent); background: var(--primary-light); }
.password-toggle-btn:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 1px; color: var(--brand-accent); }

.strength-meter-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; margin-bottom: .75rem; }
.strength-meter { height: 5px; border-radius: var(--radius-pill); background: var(--border); flex: 1; position: relative; overflow: hidden; }
.strength-meter::before {
  content: ""; position: absolute; inset: 0;
  width: var(--strength-pct, 0%);
  border-radius: var(--radius-pill);
  transition: width .2s ease, background .2s ease;
}
.strength-meter.strength-weak::before { background: var(--danger); }
.strength-meter.strength-medium::before { background: var(--accent); }
.strength-meter.strength-strong::before { background: var(--success); }
.strength-label { font-size: 12px; color: var(--text-muted); min-width: 46px; text-align: right; }

/* 9. Notifications & dropdowns ------------------------------------------------ */
.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 10px;
  transition: border-color var(--transition), background var(--transition);
}
.notif-item:hover { border-color: var(--primary-border); }
.notif-item.unread { background: var(--primary-light); border-left: 3px solid var(--primary); }
.notif-icon { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.notif-title { font-weight: 700; font-size: 14px; }
.notif-desc { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.notif-time { color: var(--text-muted); font-size: 12px; white-space: nowrap; }

.dropdown-menu { border-color: var(--border); background: var(--surface); box-shadow: var(--shadow-md); border-radius: 12px; }

/* 10. Modals ------------------------------------------------------------------ */
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header, .modal-footer { border-color: var(--border); padding: 1rem 1.35rem; }
.modal-body { padding: 1.25rem 1.35rem; }
.modal-title { font-size: 16px; font-weight: 750; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.modal-title .ti { color: var(--brand-accent); font-size: 19px; }
.modal-backdrop.show { opacity: .42; }
.btn-close:focus { box-shadow: var(--ring); }

/* 11. Calculator --------------------------------------------------------------- */
.calc-trigger { border: none; background: transparent; width: 100%; text-align: left; cursor: pointer; }
.calc-result-box { background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-align: center; }
.calc-result-label { font-size: 12.5px; color: var(--text-muted); margin-bottom: 4px; }
.calc-result-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.calc-display {
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .9rem; text-align: right; font-size: 24px; font-weight: 700; color: var(--text);
  min-height: 56px; overflow-x: auto; white-space: nowrap; margin-bottom: .75rem;
}
.calc-keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc-key {
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 12px 0; font-size: 15px; font-weight: 600; color: var(--text);
  transition: background var(--transition);
}
.calc-key:hover { background: var(--primary-light); }
.calc-key.calc-key-op { color: var(--brand-accent); font-weight: 800; }
.calc-key.calc-key-equals { background: var(--primary); color: #fff; border-color: var(--primary); }
.calc-key.calc-key-equals:hover { background: var(--primary-dark); }
.calc-key.calc-key-clear { color: var(--danger); }

/* 12. Toasts -------------------------------------------------------------------- */
.toast-host { position: fixed; right: 16px; bottom: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; max-width: 340px; }
.app-toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 550;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}
.app-toast.show { opacity: 1; transform: translateY(0); }
.app-toast-success { border-left-color: var(--success); }
.app-toast-success i { color: var(--success); font-size: 17px; }
.app-toast-error { border-left-color: var(--danger); }
.app-toast-error i { color: var(--danger); font-size: 17px; }

/* 13. Auth screens (login, sign-up, verification) --------------------------------- */
.auth-shell { min-height: 100vh; display: flex; }
.auth-visual {
  flex: 1;
  background: var(--primary-dark);
  color: #fff;
  padding: 3.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.auth-visual::before, .auth-visual::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .09);
  pointer-events: none;
}
.auth-visual::before { width: 520px; height: 520px; right: -230px; top: -190px; box-shadow: 0 0 0 54px rgba(255, 255, 255, .02), 0 0 0 108px rgba(255, 255, 255, .015); }
.auth-visual::after { width: 320px; height: 320px; left: -150px; bottom: -150px; }
.auth-visual-brand {
  display: flex; align-items: center; gap: 12px;
  font-size: 26px; font-weight: 800; letter-spacing: -0.03em;
  margin-bottom: .8rem; position: relative; z-index: 1;
}
.auth-visual-brand .brand-mark { width: 132px; height: 132px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.auth-visual-subtitle {
  color: rgba(255, 255, 255, .78);
  font-size: 15px; line-height: 1.7; max-width: 440px;
  margin-bottom: 2.5rem; position: relative; z-index: 1;
}
.auth-visual-feature { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 1.15rem; max-width: 440px; position: relative; z-index: 1; }
.auth-visual-feature i {
  width: 38px; height: 38px; border-radius: 11px;
  background: rgba(255, 255, 255, .11);
  display: flex; align-items: center; justify-content: center;
  color: #8EE0B8; flex-shrink: 0; font-size: 18px;
}
.auth-visual-feature div div:first-child { font-weight: 700; font-size: 14.5px; }
.auth-visual-feature div div:last-child { color: rgba(255, 255, 255, .68); font-size: 13px; }

/* Transparent so the money background shows around the form card */
.auth-form-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; background: transparent; }
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 2.15rem 2.1rem 1.85rem;
  box-shadow: var(--shadow-md);
}
.auth-card-brand { display: none; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); font-size: 20px; margin-bottom: 1.25rem; }
.auth-card-brand { justify-content: center; }
.auth-card-brand .brand-mark { width: 84px; height: 84px; box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.auth-title { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 1.5rem; }
.auth-footer-link { text-align: center; font-size: 14px; color: var(--text-muted); margin-top: 1.15rem; }
.auth-footer-link a { color: var(--brand-accent); font-weight: 700; }
.auth-footer-link a:hover { text-decoration: underline; }

/* 14. Budget, profile avatar ------------------------------------------------------ */
.profile-avatar-lg {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; flex-shrink: 0;
  box-shadow: 0 0 0 4px var(--primary-light);
}
.budget-progress-track { height: 12px; border-radius: var(--radius-pill); background: var(--surface-alt); border: 1px solid var(--border); overflow: hidden; }
.budget-progress-fill { height: 100%; border-radius: var(--radius-pill); transition: width .3s ease; }
.bar-success { background: var(--brand-accent); }
.bar-warning { background: var(--accent); }
.bar-danger { background: var(--danger); }
.budget-warning { display: flex; align-items: center; gap: 8px; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-top: .75rem; }
.warning-amber { background: var(--warning-bg); color: var(--warning); }
.warning-danger { background: var(--danger-bg); color: var(--danger); }

/* 15. Money background ------------------------------------------------------------
   Built by js/money-bg.js. It lives at z-index -1 behind everything, ignores the
   pointer, and only animates transform/opacity so it stays off the main thread.   */
.money-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  contain: layout paint style;
  isolation: isolate;
  --base-o: .24;
}
.money-bg[data-mode="rich"] { --base-o: .62; }
.money-bg[data-mode="calm"] { --base-o: .34; }
.money-bg[data-mode="faint"] { --base-o: .20; }

.mb-piece {
  position: absolute;
  left: var(--x);
  top: 0;
  opacity: 0;
  will-change: transform, opacity;
  animation:
    mb-fall var(--dur) linear var(--delay) infinite,
    mb-sway var(--sway) ease-in-out var(--delay) infinite alternate;
}
.money-bg.is-paused .mb-piece { animation-play-state: paused; }

/* Banknote: soft green slip with a seal and a peso mark */
.mb-note {
  width: var(--s);
  height: calc(var(--s) * .52);
  border-radius: 5px;
  border: 1.5px solid rgba(25, 112, 75, .9);
  background: linear-gradient(135deg, rgba(128, 220, 164, .72), rgba(35, 118, 83, .48));
  box-shadow: 0 5px 16px rgba(17, 80, 52, .14), inset 0 0 0 2px rgba(255,255,255,.20);
  backdrop-filter: blur(1px);
}
.mb-note::before {
  content: "";
  position: absolute;
  inset: 17%;
  border-radius: 50%;
  border: 1.5px solid rgba(23, 75, 56, .55);
}
.mb-note::after {
  content: "\20B1";
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--s) * .26);
  font-weight: 800;
  color: rgba(23, 75, 56, .85);
}

/* Coin: warm disc that turns as it falls */
.mb-coin {
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--s) * .52);
  font-weight: 800;
  line-height: 1;
  color: rgba(120, 80, 10, .85);
  background: radial-gradient(circle at 35% 30%, #F3D58E, #D6A244);
  border: 1.5px solid rgba(150, 96, 10, .75);
  box-shadow: 0 4px 12px rgba(113, 77, 17, .18), inset 0 0 0 2px rgba(255,255,255,.28);
  animation-name: mb-fall, mb-spin;
}

/* Symbol: faint currency sign */
.mb-sym {
  font-size: var(--s);
  font-weight: 800;
  line-height: 1;
  color: rgba(25, 112, 75, .92);
  text-shadow: 0 2px 8px rgba(35, 118, 83, .12);
}

@keyframes mb-fall {
  0%   { translate: 0 -12vh; opacity: 0; }
  8%   { opacity: calc(var(--o) * var(--base-o)); }
  90%  { opacity: calc(var(--o) * var(--base-o)); }
  100% { translate: var(--drift) 112vh; opacity: 0; }
}
@keyframes mb-sway {
  from { transform: translateX(-14px) rotate(calc(var(--tilt) * -1)); }
  to   { transform: translateX(14px) rotate(var(--tilt)); }
}
@keyframes mb-spin {
  from { transform: translateX(-14px) rotateY(0deg); }
  to   { transform: translateX(14px) rotateY(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .money-bg { display: none; }
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
@media print { .money-bg { display: none; } }

/* 16. Responsive ---------------------------------------------------------------------- */
@media (pointer: coarse) {
  .btn-ghost-icon { min-width: 40px; min-height: 40px; }
  .nav-item-link { padding-top: 12px; padding-bottom: 12px; }
}

@media (max-width: 1100px) {
  :root { --sidebar-width: 224px; }
  .main-content { padding-left: 1.5rem; padding-right: 1.5rem; }
}

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; overflow-y: auto; }
  .sidebar.open { transform: translateX(0); box-shadow: 18px 0 40px rgba(15, 40, 30, .22); }
  .sidebar-backdrop.open { display: block; }
  .topbar { margin-left: 0; }
  .topbar-brand { display: flex; }
  .main-content { margin-left: 0; padding: 1.35rem 1rem 2.5rem; }
  .auth-visual { display: none; }
  .auth-card-brand { display: flex; }
  .bill-list-header { display: none; }
  .nav-item-link.active::before { left: -.9rem; }
}

@media (max-width: 767.98px) {
  .bill-row { align-items: flex-start; }
  .bill-row .bill-actions { margin-left: auto; }
  .metric-card .metric-value { font-size: 22px; }
  .page-heading { font-size: 23px; }
  .form-control, .form-select { font-size: 16px; } /* stops iOS Safari zooming into inputs */
  .range-toggle { max-width: 100%; overflow-x: auto; }
  .card-surface { overflow-wrap: anywhere; }
}

@media (max-width: 575.98px) {
  .main-content { padding: 1rem .85rem 2.5rem; }
  .card-surface { padding: 1rem; border-radius: 14px; }
  .auth-card { padding: 1.6rem 1.25rem; border-radius: 18px; }
  .toast-host { left: 12px; right: 12px; max-width: none; }
  .metric-card .metric-icon { width: 38px; height: 38px; }
  .bill-row > div[style*="min-width:110px"],
  .bill-row > div[style*="min-width:120px"] { min-width: auto !important; }
}

@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
}

/* ===== Sidebar hide / show (desktop) ===== */
html.sidebar-collapsed .sidebar { transform: translateX(-100%); box-shadow: none; }
html.sidebar-collapsed .topbar,
html.sidebar-collapsed .main-content { margin-left: 0; }
html.sidebar-collapsed .topbar-brand { display: flex; }
.sidebar { padding-bottom: calc(.9rem + env(safe-area-inset-bottom, 0px)); padding-top: calc(1.35rem + env(safe-area-inset-top, 0px)); }

/* ===== Optional-field hint ===== */
.optional-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ===== Live notifications (dashboard) ===== */
.notif-scroll { max-height: 300px; overflow-y: auto; padding-right: 2px; -webkit-overflow-scrolling: touch; }
.notif-scroll .notif-item { padding: 11px 12px; margin-bottom: 8px; }
.notif-scroll .notif-icon { width: 34px; height: 34px; font-size: 16px; }
.notif-markall-btn { width: auto; height: auto; padding: 2px 8px; font-size: 11.5px; }
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
  background: var(--success-bg);
  border-radius: 999px;
  padding: 2px 8px;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: livePulse 1.8s ease-in-out infinite;
}
@keyframes livePulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.notif-count-badge {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ===== Floating calculator window ===== */
.calc-widget {
  position: fixed;
  left: 0;
  top: 0;
  width: 300px;
  max-width: calc(100vw - 16px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 44px rgba(17, 45, 34, .24);
  z-index: 1045;
  overflow: hidden;
}
.calc-widget.dragging { box-shadow: 0 22px 54px rgba(17, 45, 34, .32); user-select: none; }
.calc-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  padding: 8px 10px 8px 14px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.calc-widget.dragging .calc-widget-header { cursor: grabbing; }
.calc-widget-title { font-size: 13.5px; font-weight: 650; display: flex; align-items: center; gap: 7px; }
.calc-widget-actions { display: flex; gap: 4px; }
.calc-widget-btn {
  border: none;
  background: rgba(255,255,255,0.14);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.calc-widget-btn:hover { background: rgba(255,255,255,0.26); }
.calc-widget-body { padding: 12px; max-height: calc(100vh - 90px); overflow-y: auto; }
.calc-widget.minimized .calc-widget-body { display: none; }
.calc-widget .calc-key { padding: 13px 0; min-height: 46px; }
.calc-widget .calc-display { font-size: 22px; }
.calc-widget .range-toggle { width: 100%; }
.calc-widget .range-toggle button { flex: 1; }

/* ===== Small-screen sizing for floating widgets ===== */
@media (max-width: 575.98px) {
  .calc-widget { width: 280px; }
  .notif-scroll { max-height: 260px; }
}


/* ===== Top-bar notification bell ===== */
.notif-bell-wrap { position: relative; }
.notif-bell-btn { position: relative; }
.notif-bell-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: #2a0f0b;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.notif-bell-badge.d-none { display: none !important; }
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 380px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(17, 45, 34, .22);
  padding: 14px;
  z-index: 1040;
}
.notif-panel .notif-scroll { max-height: min(60vh, 420px); }
@media (max-width: 575.98px) {
  .notif-panel { position: fixed; left: 12px; right: 12px; top: calc(64px + env(safe-area-inset-top, 0px)); width: auto; max-width: none; }
}


/* ===== Bills page: Add Item / Add Bill / Update Bill ===== */
.bill-mode-tabs { display: flex; width: 100%; }
.bill-mode-tabs button { flex: 1; white-space: nowrap; padding-left: 8px; padding-right: 8px; }


.type-chip-box { margin-bottom: 1rem; }
.type-chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 4px 2px 10px;
  font-size: 12.5px;
  color: var(--text);
}
.type-chip button {
  border: none;
  background: transparent;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
}
.type-chip button .ui-icon { width: 12px; height: 12px; }
.type-chip button:hover { background: var(--danger-bg); color: var(--danger); }

/* Sync status in the top bar (added with the sync layer) */
.sync-status {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  border-radius: 9px; font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background var(--transition);
}
.sync-status:hover { background: var(--surface-alt); }
.sync-status .ti { font-size: 17px; }
.sync-synced { color: var(--success); }
.sync-syncing { color: var(--info); }
.sync-syncing .ti { animation: syncSpin 1s linear infinite; }
.sync-pending { color: var(--warning); }
.sync-offline { color: var(--text-muted); }
.sync-failed { color: var(--danger); }
@keyframes syncSpin { to { transform: rotate(360deg); } }
@media (max-width: 640px) { .sync-status .sync-status-text { display: none; } .sync-status { padding: 0 9px; } }

/* Gmail card on the Profile page (added with the Gmail integration) */
#gmailPendingList .btn-sm { padding: 5px 12px; font-size: 13px; }
#gmailReviewCard .empty-state { padding: 14px 0 4px; }

/* ===== 3-stage sign-in: progress indicator, ID type cards, camera ===== */
html.auth-checking body { visibility: hidden; }   /* removed by auth.js once the server confirms the sign-in */

.auth-stepper { display: flex; gap: 6px; margin-bottom: 1.1rem; }
.auth-step {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  padding: 6px 4px; border-radius: 999px; background: var(--surface-alt); border: 1px solid var(--border);
}
.auth-step span {
  width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--border); color: var(--text); font-size: 11px;
}
.auth-step.is-active { background: var(--primary-light); border-color: var(--primary); color: var(--brand-accent); }
.auth-step.is-active span { background: var(--primary); color: #fff; }
.auth-step.is-done { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.auth-step.is-done span { background: var(--success); color: #fff; }

.auth-card.auth-card-wide { max-width: 520px; }

.idv-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: .9rem; }
.idv-type {
  text-align: left; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; cursor: pointer; transition: border-color var(--transition), background var(--transition); font: inherit; color: var(--text);
}
.idv-type i { font-size: 22px; color: var(--brand-accent); display: block; margin-bottom: 4px; }
.idv-type strong { display: block; font-size: 13.5px; }
.idv-type small { color: var(--text-muted); font-size: 11.5px; line-height: 1.35; display: block; }
.idv-type:hover { border-color: var(--secondary); }
.idv-type.is-selected { border-color: var(--primary); background: var(--primary-light); }
.idv-type:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }

.idv-stage-tabs { display: flex; gap: 6px; margin-bottom: .75rem; }
.idv-stage-tabs button {
  flex: 1; border: 1px solid var(--border); background: var(--surface-alt); border-radius: 999px;
  padding: 6px 10px; font-size: 12.5px; font-weight: 600; color: var(--text-muted);
}
.idv-stage-tabs button.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }

.idv-camera {
  position: relative; width: 100%; aspect-ratio: 4 / 3; background: #1b211e; border-radius: var(--radius-sm);
  overflow: hidden; margin-bottom: .75rem; display: flex; align-items: center; justify-content: center;
}
.idv-camera.is-face { aspect-ratio: 3 / 4; max-width: 340px; margin-left: auto; margin-right: auto; }
.idv-camera video, .idv-camera img { width: 100%; height: 100%; object-fit: cover; display: block; }
.idv-camera video.is-mirror { transform: scaleX(-1); }
.idv-camera .idv-frame {
  position: absolute; inset: 10% 6%; border: 2px dashed rgba(255,255,255,.75); border-radius: 12px; pointer-events: none;
}
.idv-camera.is-face .idv-frame { inset: 12% 14%; border-radius: 50%; }
.idv-camera-msg { color: #fff; font-size: 13px; text-align: center; padding: 1rem; }
.idv-hint { font-size: 12.5px; color: var(--text-muted); margin-bottom: .75rem; line-height: 1.5; }
.idv-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.idv-actions .btn { flex: 1; min-width: 120px; }

.idv-busy { text-align: center; padding: 2rem 0; color: var(--text-muted); font-size: 14px; }
.idv-spinner {
  width: 34px; height: 34px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--primary-light); border-top-color: var(--primary); animation: idvspin .8s linear infinite;
}
@keyframes idvspin { to { transform: rotate(360deg); } }
.idv-success { text-align: center; padding: 1.25rem 0; }
.idv-success i { font-size: 46px; color: var(--success); }
@media (prefers-reduced-motion: reduce) { .idv-spinner { animation-duration: 3s; } }
@media (max-width: 575.98px) { .idv-type-grid { grid-template-columns: 1fr; } }


/* ===== Dashboard filters, calendar, payment history source badge ===== */
.dash-filters { position: relative; z-index: 2; padding: .85rem 1.1rem; }
.dash-month-nav { display: inline-flex; align-items: center; gap: 4px; }
.dash-month-nav .form-control { width: 160px; }
.dash-nav-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); border-radius: 8px; width: 32px; height: 32px; line-height: 1; font-size: 18px; cursor: pointer; }
.dash-nav-btn:hover { color: var(--brand-accent); border-color: var(--primary); }
.dash-cat-wrap { position: relative; }
.dash-cat-btn { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.dash-cat-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 250px; max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); padding: 8px; z-index: 30; }
.dash-cat-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 8px; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.dash-cat-head button { border: none; background: none; color: var(--brand-accent); font-weight: 600; font-size: 12px; text-transform: none; letter-spacing: 0; cursor: pointer; }
.dash-cat-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.dash-cat-item:hover { background: var(--primary-light); }
.dash-cat-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dash-cat-empty { padding: 10px; color: var(--text-muted); font-size: 13px; }
.dash-active-label { margin-left: auto; background: var(--info-bg); color: var(--info); border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 650; }
.dash-custom { margin-top: .85rem; padding-top: .85rem; border-top: 1px solid var(--border); }
.dash-custom .form-control { width: 170px; }
.dash-arrow { padding-bottom: 8px; color: var(--text-muted); }
.dash-range-error { margin-top: 8px; color: var(--danger); font-size: 13px; }
.dash-custom .form-control.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.dash-note { margin-top: 10px; font-size: 12px; color: var(--text-muted); display: flex; gap: 6px; align-items: flex-start; }
.dash-cal { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; }
.dash-cal th { font-size: 11px; font-weight: 600; color: var(--text-muted); text-align: center; padding: 3px 0; }
.dash-cal td { padding: 0; }
.dash-cal button { width: 100%; min-height: 50px; border: 1px solid transparent; background: transparent; border-radius: 9px; font-size: 12.5px; padding: 4px 3px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 1px; color: var(--text); cursor: pointer; }
.dash-cal button em { font-style: normal; font-size: 10px; font-weight: 650; color: var(--brand-accent); }
.dash-cal button.in-range { background: var(--surface-alt); }
.dash-cal button.has { background: var(--primary-light); }
.dash-cal button.today { border-color: var(--brand-accent); }
.dash-cal button.sel { background: var(--primary); color: #fff; }
.dash-cal button.sel em { color: #fff; }
.dash-cal button:hover { border-color: var(--primary); }
.payment-deleted { background: var(--danger-bg); background: rgba(169,87,75,.05); }
.payment-deleted .bill-provider { color: var(--text-muted); }
.source-badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--danger-bg); color: var(--danger); font-size: 11px; font-weight: 650; vertical-align: middle; }
.payment-compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 6px; }

/* ======================================================================
   BILLTRACK SIGNATURE REDESIGN — premium fintech / emerald + champagne
   Presentation-only overrides. Existing IDs and interaction hooks remain.
   ====================================================================== */
:root {
  --primary-dark: #103d2e;
  --primary: #1d7653;
  --brand-accent: #69d5a1;
  --primary-light: #e7f5ec;
  --primary-border: #c7e5d4;
  --secondary: #83bfa0;
  --background: #f3f5f0;
  --surface: #fffefa;
  --surface-alt: #edf1e9;
  --text: #202a24;
  --text-muted: #6c786f;
  --border: #e1e7df;
  --border-strong: #cbd5ca;
  --accent: #d6aa55;
  --accent-light: #fbf2df;
  --success: #1d7653;
  --success-bg: #e7f5ec;
  --warning: #91620d;
  --warning-bg: #fbf2df;
  --danger: #a84337;
  --danger-bg: #faeae6;
  --info: #3d7161;
  --info-bg: #e7f0eb;
  --radius: 19px;
  --radius-sm: 12px;
  --shadow-sm: 0 3px 12px rgba(22, 55, 39, .045), 0 1px 2px rgba(22,55,39,.035);
  --shadow-md: 0 14px 38px rgba(22, 55, 39, .085), 0 3px 8px rgba(22,55,39,.035);
  --shadow-lg: 0 28px 70px rgba(10, 36, 25, .24);
  --ring: 0 0 0 .22rem rgba(29, 118, 83, .17);
}

body { background: radial-gradient(ellipse at 82% 0%, rgba(214,170,85,.075), transparent 32%), var(--background); }
.topbar { background: rgba(255,254,250,.91); border-bottom-color: rgba(203,213,202,.8); box-shadow: 0 4px 20px rgba(23,55,39,.025); }
.sidebar { background: linear-gradient(165deg, #123f2f 0%, #0d3024 72%, #09251b 100%); box-shadow: 10px 0 36px rgba(13,48,36,.06); }
.sidebar-brand { letter-spacing: -.045em; }
.sidebar-brand .brand-mark { width: 40px; height: 40px; box-shadow: 0 3px 10px rgba(0,0,0,.35); }
.nav-item-link { border-radius: 12px; padding-top: 11px; padding-bottom: 11px; margin: 2px 0; }
.nav-item-link.active { background: linear-gradient(100deg, rgba(105,213,161,.2), rgba(105,213,161,.075)); box-shadow: inset 0 0 0 1px rgba(105,213,161,.13); }
.nav-item-link.active::before { left: -.9rem; width: 4px; background: linear-gradient(#d9b66d,#69d5a1); box-shadow: 0 0 12px rgba(105,213,161,.35); }
.nav-item-link i { font-size: 19px; }
.sidebar-user-avatar { background: linear-gradient(145deg,#e7c77f,#b98b3b); color: #193e2e; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.main-content { padding-top: 2.1rem; }
.page-heading { letter-spacing: -.045em; font-size: clamp(25px, 2.35vw, 33px); margin-bottom: 1.05rem; animation: bt-rise .55s both; }
.page-subtext { line-height: 1.65; }
.card-surface { background: rgba(255,254,250,.96); border-color: rgba(220,228,218,.95); box-shadow: var(--shadow-sm); transition: transform .24s ease, box-shadow .24s ease, border-color .24s ease; }
.card-surface:hover { border-color: rgba(167,197,174,.85); box-shadow: var(--shadow-md); }
.metric-card { animation: bt-rise .5s both; }
.metric-card:nth-child(2) { animation-delay: .05s; }
.metric-card:nth-child(3) { animation-delay: .1s; }
.metric-card:nth-child(4) { animation-delay: .15s; }
.metric-card:nth-child(5) { animation-delay: .2s; }
.metric-card-featured { background: radial-gradient(circle at 88% 12%, rgba(105,213,161,.18), transparent 35%), linear-gradient(135deg,#174e38,#0c3024); box-shadow: 0 14px 28px rgba(16,61,46,.15); }
.metric-card-featured::after { width: 210px; height: 210px; right: -68px; bottom: -126px; border: 1px solid rgba(220,190,118,.3); box-shadow: 0 0 0 20px rgba(220,190,118,.035), 0 0 0 42px rgba(220,190,118,.025); }
.metric-icon { box-shadow: inset 0 1px 0 rgba(255,255,255,.65); }
.btn-navy, .btn-primary { background: linear-gradient(135deg,#207b56,#15583e); border-color: #1d7653; box-shadow: 0 4px 10px rgba(29,118,83,.13); }
.btn-navy:hover, .btn-primary:hover { background: linear-gradient(135deg,#176b49,#0e4832); transform: translateY(-1px); box-shadow: 0 7px 16px rgba(29,118,83,.2); }
.btn-outline-navy { border-color: #b9cdbd; color: #1b6548; }
.btn-outline-navy:hover { background: #e7f5ec; border-color: #1d7653; color: #12452f; }
.form-control, .form-select { border-color: #dce4da; border-radius: 11px; background-color: #fffefa; min-height: 42px; }
.form-control:focus, .form-select:focus { border-color: #65b58c; box-shadow: var(--ring); }
.range-toggle { background: #edf1e9; border-radius: 12px; padding: 4px; }
.range-toggle button { border-radius: 9px; }
.range-toggle button.active { background: #fffefa; box-shadow: 0 2px 6px rgba(19,55,37,.1); color: #145338; }
.modal-content { border: 1px solid rgba(220,228,218,.9); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header, .modal-footer { border-color: var(--border); }
.empty-state { background: linear-gradient(145deg,var(--surface),var(--surface-alt)); }

/* Custom 3D money hero on the dashboard */
.finance-hero { min-height: 270px; position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: minmax(0,1.1fr) minmax(280px,.9fr); align-items: center; gap: 12px; padding: 28px 34px; margin: 0 0 24px; border-radius: 24px; color: #fff; background: radial-gradient(ellipse at 80% 45%, rgba(87,169,117,.23), transparent 34%), radial-gradient(ellipse at 8% 100%, rgba(214,170,85,.12), transparent 36%), linear-gradient(115deg,#123e2e 0%,#0c3024 58%,#174c36 100%); box-shadow: 0 22px 48px rgba(14,54,38,.16), inset 0 1px 0 rgba(255,255,255,.08); }
.finance-hero::before { content:""; position:absolute; inset:0; z-index:-1; opacity:.13; background-image:linear-gradient(rgba(255,255,255,.1) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.1) 1px,transparent 1px); background-size:34px 34px; mask-image:linear-gradient(90deg,black,transparent 88%); }
.finance-hero-copy { position:relative; z-index:3; max-width:490px; }
.finance-eyebrow { display:inline-flex; align-items:center; gap:9px; font-size:10px; letter-spacing:.19em; font-weight:800; color:#d9c38d; margin-bottom:14px; }
.live-dot { width:7px; height:7px; border-radius:50%; background:#7be0a9; box-shadow:0 0 0 4px rgba(123,224,169,.12),0 0 13px rgba(123,224,169,.65); }
.finance-hero h2 { font-size:clamp(29px,3.3vw,43px); font-weight:800; line-height:1.08; letter-spacing:-.055em; margin:0 0 12px; color:#fff; }
.finance-hero h2 em { font-style:normal; color:#a7e4bd; }
.finance-hero-copy p { color:rgba(255,255,255,.7); font-size:13px; max-width:390px; line-height:1.7; margin:0 0 21px; }
.finance-hero-foot { display:flex; align-items:center; gap:9px; color:rgba(255,255,255,.82); font-size:11px; font-weight:600; }
.hero-shield { display:inline-grid; place-items:center; width:25px; height:25px; border-radius:8px; color:#b5e8c8; background:rgba(255,255,255,.09); border:1px solid rgba(255,255,255,.1); }
.money-stage { min-height:220px; position:relative; perspective:900px; transform-style:preserve-3d; }
.money-glow { position:absolute; width:230px; height:170px; left:50%; top:48%; transform:translate(-50%,-50%); border-radius:50%; background:rgba(94,194,130,.16); filter:blur(27px); }
.money-orbit { position:absolute; left:50%; top:49%; border:1px solid rgba(213,190,126,.25); border-radius:50%; transform:translate(-50%,-50%) rotate(-22deg); }
.orbit-one { width:300px; height:115px; }
.orbit-two { width:250px; height:155px; transform:translate(-50%,-50%) rotate(35deg); border-color:rgba(143,212,169,.19); }
.hero-banknote { position:absolute; width:218px; height:118px; border-radius:10px; border:1px solid rgba(227,211,150,.8); background:linear-gradient(135deg,#9bc9a1 0%,#3f9467 26%,#176444 63%,#0b422e 100%); box-shadow:inset 0 0 0 4px rgba(239,224,167,.18), inset 0 0 0 7px rgba(9,56,38,.18), 0 19px 22px rgba(0,0,0,.28); transform-style:preserve-3d; }
.hero-banknote::before { content:""; position:absolute; inset:13px; border:1px solid rgba(242,225,169,.45); border-radius:5px; background:repeating-linear-gradient(135deg,transparent 0 8px,rgba(241,225,168,.07) 9px 10px); }
.note-back { left:50%; top:27px; transform:translateX(-42%) rotate(11deg) rotateY(-18deg); opacity:.74; filter:brightness(.8); animation:bt-float-back 6s ease-in-out infinite; }
.note-front { left:50%; top:55px; transform:translateX(-62%) rotate(-10deg) rotateY(14deg); animation:bt-float-front 5.3s ease-in-out infinite; }
.note-corner { position:absolute; top:10px; left:13px; color:#f3df9c; font-weight:900; font-size:20px; text-shadow:0 1px 2px rgba(0,0,0,.3); }
.note-seal { position:absolute; width:53px; height:53px; border:2px solid rgba(235,218,153,.65); border-radius:50%; left:calc(50% - 26px); top:31px; display:grid; place-items:center; font-size:26px; color:rgba(245,224,158,.85); box-shadow:inset 0 0 0 4px rgba(241,223,168,.12); }
.note-lines { position:absolute; right:13px; top:17px; bottom:17px; width:33px; border-left:1px solid rgba(241,222,156,.45); border-right:1px solid rgba(241,222,156,.45); background:repeating-linear-gradient(to bottom,rgba(241,222,156,.4) 0 2px,transparent 2px 7px); }
.note-value { position:absolute; left:14px; bottom:9px; color:rgba(244,227,173,.85); font-size:7px; letter-spacing:.19em; font-weight:800; }
.hero-coin { position:absolute; z-index:4; display:grid; place-items:center; width:53px; height:53px; border-radius:50%; color:#7b5416; font-size:25px; font-weight:900; border:2px solid #f2d99b; background:radial-gradient(circle at 31% 24%,#fff0b7 0%,#e8c66f 28%,#b7812b 66%,#8e5c1d 100%); box-shadow:inset 0 0 0 4px rgba(255,242,195,.38),inset -5px -6px 9px rgba(98,59,10,.25),0 9px 13px rgba(0,0,0,.3); text-shadow:0 1px 0 rgba(255,238,177,.6); }
.coin-one { right:8%; top:22px; animation:bt-coin-float 4.5s ease-in-out infinite; }
.coin-two { left:6%; top:105px; width:39px; height:39px; font-size:19px; animation:bt-coin-float 5.2s ease-in-out -1.3s infinite; }
.coin-three { right:17%; bottom:2px; width:31px; height:31px; font-size:15px; animation:bt-coin-float 4.8s ease-in-out -2s infinite; }
.hero-mini-card { position:absolute; right:0; bottom:0; z-index:5; display:flex; align-items:center; gap:9px; padding:10px 12px; border:1px solid rgba(255,255,255,.2); border-radius:13px; background:linear-gradient(135deg,rgba(255,255,255,.17),rgba(255,255,255,.07)); box-shadow:0 12px 26px rgba(0,0,0,.14); backdrop-filter:blur(14px); animation:bt-rise .8s .2s both; }
.mini-card-icon { width:30px; height:30px; display:grid; place-items:center; border-radius:9px; background:rgba(127,224,166,.17); color:#a7e4bd; font-size:17px; }
.hero-mini-card small { display:block; font-size:7px; letter-spacing:.12em; color:rgba(255,255,255,.62); font-weight:800; }
.hero-mini-card strong { display:block; font-size:10px; color:#fff; font-weight:750; }
.mini-sparkline { color:#a7e4bd; font-size:27px; line-height:1; margin-left:7px; }
.hero-grain { position:absolute; inset:0; z-index:1; pointer-events:none; opacity:.08; background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.28'/%3E%3C/svg%3E"); }
@keyframes bt-rise { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes bt-float-front { 0%,100% { translate:0 0; } 50% { translate:0 -8px; } }
@keyframes bt-float-back { 0%,100% { translate:0 0; } 50% { translate:0 7px; } }
@keyframes bt-coin-float { 0%,100% { translate:0 0; rotate:-8deg; } 50% { translate:0 -12px; rotate:8deg; } }

/* Authentication pages use the same premium brand language */
.auth-visual { background:radial-gradient(ellipse at 78% 72%,rgba(105,213,161,.17),transparent 32%),linear-gradient(145deg,#123f2f,#0a2b20 78%); }
.auth-visual::before { border-color:rgba(214,170,85,.16); box-shadow:0 0 0 54px rgba(214,170,85,.025),0 0 0 108px rgba(214,170,85,.018); }
.auth-visual-feature i { background:rgba(105,213,161,.12); border:1px solid rgba(105,213,161,.15); color:#a7e4bd; }
.auth-card { border-color:rgba(220,228,218,.9); box-shadow:0 24px 70px rgba(19,53,37,.12); }
.auth-title { letter-spacing:-.045em; }
.auth-step.is-active { background:var(--primary-light); border-color:var(--primary-border); color:var(--brand-accent); }
.auth-step.is-active span { background:var(--primary); }

/* Shared motion, without interfering with controls or reduced-motion settings */
@keyframes bt-soft-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.main-content > .card-surface, .main-content > .row, .main-content > form, .main-content > .finance-hero { animation:bt-soft-in .45s both; }
.main-content > .card-surface:nth-of-type(2), .main-content > .row:nth-of-type(2) { animation-delay:.06s; }
.nav-item-link, .sidebar-toggle-btn, .dash-nav-btn, .btn { transition:transform .18s ease,box-shadow .18s ease,background-color .18s ease,border-color .18s ease,color .18s ease; }
.nav-item-link:active, .btn:active { transform:scale(.985); }
::selection { background:rgba(105,213,161,.3); color:#123f2f; }

@media (max-width: 991.98px) {
  .finance-hero { grid-template-columns:1fr minmax(230px,.8fr); padding:24px; }
  .hero-banknote { width:190px; height:104px; }
  .note-seal { top:26px; }
  .money-stage { min-height:205px; }
}
@media (max-width: 767.98px) {
  .finance-hero { grid-template-columns:1fr; padding:25px 23px 16px; gap:0; }
  .finance-hero-copy { max-width:100%; }
  .finance-hero h2 { font-size:34px; }
  .finance-hero-copy p { max-width:440px; }
  .money-stage { min-height:215px; margin-top:5px; }
  .hero-banknote { width:200px; height:108px; }
  .note-seal { top:28px; }
  .hero-mini-card { right:2px; bottom:0; }
  .coin-one { right:10%; }
  .orbit-one { width:270px; }
  .orbit-two { width:225px; }
  .card-surface { padding:1rem; }
}
@media (max-width: 420px) {
  .finance-hero { border-radius:18px; padding:22px 17px 12px; }
  .finance-hero h2 { font-size:30px; }
  .money-stage { transform:scale(.9); transform-origin:top center; margin-bottom:-18px; }
  .hero-mini-card { transform:scale(.9); transform-origin:bottom right; }
}
@media (prefers-reduced-motion: reduce) {
  .finance-hero *, .metric-card, .page-heading, .main-content > *, .hero-mini-card { animation:none !important; }
  .card-surface, .nav-item-link, .btn { transition:none !important; }
}


/* BillTrack appearance switch: complete dark palette for all application pages. */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary-dark: #0b2d22;
  --primary: #25835d;
  --brand-accent: #71dfad;
  --primary-light: #153d2e;
  --primary-border: #285a44;
  --secondary: #86c6a5;
  --background: #061b15;
  --surface: #0b261e;
  --surface-alt: #103328;
  --text: #f4f4e9;
  --text-muted: #a6bcb0;
  --border: #214638;
  --border-strong: #315b49;
  --accent: #e2b967;
  --accent-light: #3a301d;
  --success: #75d5a6;
  --success-bg: #143c2b;
  --warning: #f0c46b;
  --warning-bg: #40331c;
  --danger: #ff9a8b;
  --danger-bg: #44251f;
  --danger-border: #744036;
  --info: #9ccfc2;
  --info-bg: #163832;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.16);
  --shadow-md: 0 12px 28px rgba(0,0,0,.24);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.38);
  --ring: 0 0 0 .22rem rgba(113,223,173,.2);
}
:root[data-theme="dark"] body { background: radial-gradient(ellipse at 80% 0%, rgba(214,170,85,.07), transparent 32%), var(--background); color: var(--text); }
:root[data-theme="dark"] .topbar { background: rgba(5,27,21,.94); border-bottom-color: var(--border); }
:root[data-theme="dark"] .sidebar { background: linear-gradient(165deg,#0c3024 0%,#08251b 72%,#051a13 100%); border-right-color: var(--border); }
:root[data-theme="dark"] .card-surface,
:root[data-theme="dark"] .modal-content,
:root[data-theme="dark"] .dropdown-menu,
:root[data-theme="dark"] .notif-panel,
:root[data-theme="dark"] .table-wrap,
:root[data-theme="dark"] .list-group-item { background: var(--surface); color: var(--text); border-color: var(--border); }
:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .form-select,
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea { color-scheme: dark; background-color: #0a241b; color: var(--text); border-color: var(--border-strong); }
:root[data-theme="dark"] .form-control::placeholder,
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder { color: #8ca79a; }
:root[data-theme="dark"] .range-toggle { background: #071e17; border: 1px solid var(--border); }
:root[data-theme="dark"] .range-toggle button.active { background: #194633; color: #f4d28c; }
:root[data-theme="dark"] .btn-outline-navy,
:root[data-theme="dark"] .btn-outline-secondary { color: #bdebd0; border-color: var(--border-strong); }
:root[data-theme="dark"] .btn-outline-navy:hover,
:root[data-theme="dark"] .btn-outline-secondary:hover { background: #153d2e; color: #fff; }
:root[data-theme="dark"] table { color: var(--text); --bs-table-color: var(--text); --bs-table-bg: transparent; --bs-table-border-color: var(--border); }
:root[data-theme="dark"] .table > :not(caption) > * > * { background-color: transparent; color: var(--text); border-bottom-color: var(--border); }
:root[data-theme="dark"] .text-muted,
:root[data-theme="dark"] .page-subtext,
:root[data-theme="dark"] .bill-meta { color: var(--text-muted) !important; }
@media (prefers-reduced-motion: reduce) {
  :root[data-theme] *, :root[data-theme] *::before, :root[data-theme] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}




/* Visual refinement: keep the decorative money layer visible without intercepting UI. */
.app-shell, .auth-shell { position: relative; z-index: 1; background: transparent; }
.money-bg { mix-blend-mode: screen; }
:root[data-theme="dark"] .money-bg { mix-blend-mode: screen; }
:root[data-theme="dark"] .mb-note {
  border-color: rgba(112, 226, 164, .85);
  background: linear-gradient(135deg, rgba(74, 190, 128, .48), rgba(24, 104, 72, .36));
  box-shadow: 0 5px 16px rgba(0,0,0,.13), inset 0 0 0 2px rgba(255,255,255,.10);
}
:root[data-theme="dark"] .mb-note::before { border-color: rgba(164, 241, 196, .7); }
:root[data-theme="dark"] .mb-note::after,
:root[data-theme="dark"] .mb-sym { color: rgba(141, 237, 180, .92); }
@media (max-width: 767.98px) {
  .money-bg[data-mode="faint"] { --base-o: .16; }
  .mb-piece { filter: saturate(.92); }
}

/* Consistent premium finish across existing BillTrack screens. */
.page-heading { letter-spacing: -.035em; }
.card-surface {
  border: 1px solid color-mix(in srgb, var(--border) 88%, var(--primary) 12%);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
.card-surface:hover { box-shadow: var(--shadow-md); border-color: var(--primary-border); }
.table-wrap { border-radius: 14px; overflow: hidden; }
.table thead th { font-size: 11px; font-weight: 800; letter-spacing: .065em; text-transform: uppercase; color: var(--text-muted); background: var(--surface-alt); }
.form-control, .form-select { border-radius: 10px; min-height: 43px; border-color: var(--border-strong); transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease; }
.form-control:focus, .form-select:focus, input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--brand-accent); box-shadow: var(--ring); }
.btn { font-weight: 700; letter-spacing: -.01em; }
.btn:not(:disabled):hover { filter: brightness(1.025); }
.auth-card { border-radius: 24px; }
.auth-title { line-height: 1.2; }
@media (prefers-reduced-motion: reduce) {
  .card-surface { transition: none; }
}

/* ---- Gmail Auto backend features not present in the frontend-only edition (ported unchanged from the Gmail Auto style.css) ---- */
/* On-screen liveness challenge (verify.html, stage 3) */
.idv-challenge { max-width: 340px; margin: 0 auto .75rem; }
.idv-challenge-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 .5rem; }
.idv-challenge-steps li {
  flex: 1; text-align: center; font-size: 12px; padding: 6px 4px; border-radius: 10px;
  border: 1px solid var(--border); color: var(--text-muted); background: var(--surface, #fff);
}
.idv-challenge-steps li.is-active { border-color: var(--primary); color: var(--brand-accent); background: var(--primary-light); font-weight: 600; }
.idv-challenge-steps li.is-done { border-color: var(--success); color: var(--success); }
.idv-challenge-now { font-size: 16px; font-weight: 600; text-align: center; min-height: 1.6em; }
.idv-challenge-now.is-warn { color: var(--danger); }
.idv-challenge-timer { height: 4px; border-radius: 4px; background: var(--primary-light); margin-top: .5rem; overflow: hidden; }
.idv-challenge-timer span { display: block; height: 100%; width: 100%; background: var(--primary); transform-origin: left; }

/* In-page provider scan (iframe in a panel) */
.idv-scan-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(15, 23, 20, .72); display: flex; align-items: center; justify-content: center; padding: 12px; }
.idv-scan-box { background: var(--surface, #fff); border-radius: 14px; width: 100%; max-width: 520px; height: min(760px, 96vh); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.idv-scan-bar { display: flex; align-items: center; justify-content: space-between; padding: .6rem .9rem; border-bottom: 1px solid rgba(128,128,128,.25); }
.idv-scan-frame { flex: 1; width: 100%; border: 0; background: #fff; }
.idv-scan-foot { padding: .45rem .9rem; font-size: .8rem; text-align: center; border-top: 1px solid rgba(128,128,128,.25); }

/* Items: custom date range under the All items header */
.item-range-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 14px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt); }
.item-range-row.d-none { display: none !important; }
.item-range-field { flex: 1 1 140px; min-width: 130px; }
.item-range-field .form-label { margin-bottom: 4px; }
@media (max-width: 575.98px) { .item-range-row .btn { width: 100%; } }


/* ==========================================================================
   Compact spacing (Update 5). Less empty space inside boxes, across the whole system.
   Everything here is padding / margin / gap only, so it is easy to tune or remove.
   ========================================================================== */
.main-content { padding: 1.25rem 1.5rem calc(2.5rem + env(safe-area-inset-bottom, 0px)); }
.page-heading { margin-bottom: .7rem; font-size: clamp(22px, 2vw, 28px); }
.page-subtext { margin-top: -.4rem; margin-bottom: 1rem; line-height: 1.5; }

.card-surface { padding: .8rem 1rem; }
.card-surface.mb-3 { margin-bottom: .75rem !important; }
.card-surface.mt-3 { margin-top: .75rem !important; }
.main-content .row { --bs-gutter-x: .75rem; --bs-gutter-y: .75rem; }
.main-content .row.g-3, .main-content .row.g-4 { --bs-gutter-x: .75rem; --bs-gutter-y: .75rem; }
.card-heading { margin-bottom: .5rem; }
.dash-filters {
    padding: .6rem .85rem;
    position: relative;
    z-index: 50;
}

.dash-cat-wrap {
    position: relative;
    z-index: 51;
}

.dash-cat-menu {
    position: absolute;
    z-index: 52;
    background: #0d1a33;
    opacity: 1;
    isolation: isolate;
}

/* Summary (metric) cards: smaller icon, no overlap with the label, no dead space at the bottom */
.metric-card { padding: .75rem .9rem; }
.metric-card > .d-flex > div:first-child { min-width: 0; flex: 1 1 auto; }
.metric-card .metric-label { font-size: 12px; margin-bottom: 3px; line-height: 1.25; }
.metric-card .metric-value { font-size: 22px; line-height: 1.1; }
.metric-card .metric-icon { width: 32px; height: 32px; flex: 0 0 32px; margin-left: 8px; font-size: 16px; border-radius: 10px; }
.metric-card .metric-icon .ui-icon { width: 17px; height: 17px; }
.metric-card .metric-sub, .metric-card small { line-height: 1.3; }

.finance-hero { min-height: 0; padding: 18px 26px; margin-bottom: 14px; border-radius: 20px; }
.finance-hero h2 { margin-bottom: 8px; }
.finance-hero-copy p { margin-bottom: 12px; line-height: 1.55; }

/* Lists */
.bill-row { padding: 8px 6px; gap: 10px; }
.bill-subline { display: flex; flex-wrap: wrap; align-items: center; gap: 1px 14px; }
.bill-subline .bill-category { gap: 6px; }
.bill-subline .category-icon { width: 18px; height: 18px; flex-basis: 18px; }
.bill-subline .category-icon .ui-icon { width: 16px; height: 16px; }
.empty-state { padding: 20px 14px; line-height: 1.5; }

/* Forms and dialogs */
.form-label { margin-bottom: .25rem; }
.form-control, .form-select { min-height: 38px; }
.modal-header, .modal-footer { padding: .65rem 1rem; }
.modal-body { padding: .85rem 1rem; }
.modal-title { font-size: 16px; }

/* ===== File 1 branding: logo-only, larger (wordmark is part of the logo artwork) ===== */
.sidebar-brand { justify-content: center; padding: 0; margin-bottom: 1.15rem; }
.sidebar-brand .brand-mark { width: 112px; height: 112px; }
.sidebar-brand > span, .topbar-brand > span { display: none !important; }

/* Required-field star next to a label (Category on bills and subscriptions) */
.required-tag { color: #ff8a7a; font-weight: 800; margin-left: 2px; }


/* ===== Search + filter bars (Items and Bills): one grid, equal heights, no overlap on any screen size ===== */
.filter-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 1rem; align-items: stretch; }
.filter-bar > * { min-width: 0; width: 100%; max-width: none; margin: 0; }
.filter-bar .form-control, .filter-bar .form-select { height: 44px; min-height: 44px; }
.filter-bar input[type="search"] { -webkit-appearance: none; appearance: none; }
.filter-bar .filter-full, .filter-bar .filter-full-sm { grid-column: 1 / -1; }
@media (min-width: 576px) {
  .filter-bar-items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-bar-bills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar .filter-full-sm { grid-column: auto; }
}
/* status tabs under the bills search: full width, wrap instead of overflowing */
.range-toggle.filter-tabs { display: flex; flex-wrap: wrap; width: 100%; gap: 4px; }
.range-toggle.filter-tabs button { flex: 1 1 auto; white-space: nowrap; }

/* "See more / See less" row under the items list */

.see-more-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
    padding: 12px 0;
    margin-top: 8px;
    border-top: 1px solid var(--border);
}

.see-more-row .bill-meta {
    text-align: left;
    line-height: 1.5;
    margin: 0;
}

.see-more-row button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    min-height: 36px;
    padding: 8px 16px;
    line-height: 1.2;
}

/* Mobile alignment */
@media (max-width: 576px) {
    .see-more-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .see-more-row .bill-meta {
        text-align: left;
    }

    .see-more-row button {
        width: 100%;
    }
}

/* ===== Two alternative logins (password OR ID + face): method tabs, helper text ===== */
.auth-method-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 1rem 0 1.15rem;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 14px;
}
.auth-method-tab {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 10px;
  border: 0; border-radius: 10px; background: transparent; color: var(--text-muted);
  font: inherit; font-size: 13.5px; font-weight: 700; line-height: 1.2; cursor: pointer;
  transition: background var(--transition, .15s), color var(--transition, .15s), box-shadow var(--transition, .15s);
}
.auth-method-tab i { font-size: 18px; flex: none; }
.auth-method-tab:hover { color: var(--text); }
.auth-method-tab.is-active { background: var(--primary); color: var(--on-primary, #fff); box-shadow: 0 4px 14px rgba(0, 0, 0, .22); }
.auth-method-tab:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }
.auth-help { margin-top: 6px; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
.auth-camera-note {
  display: flex; gap: 10px; align-items: flex-start; margin-bottom: 1rem; padding: 10px 12px; border-radius: 12px;
  background: var(--info-bg); color: var(--info); font-size: 12.5px; line-height: 1.45;
}
.auth-camera-note i { font-size: 18px; flex: none; margin-top: 1px; }
.auth-camera-note.is-warn { background: var(--danger-bg); color: var(--danger); }
.auth-alt-link { margin-top: 1rem; text-align: center; font-size: 13px; color: var(--text-muted); }
.auth-alt-link a { color: var(--brand-accent); font-weight: 700; }
@media (max-width: 420px) {
  .auth-method-tab { flex-direction: column; gap: 2px; font-size: 12.5px; min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) { .auth-method-tab { transition: none; } }


/* User-supplied BillTrack icon set */
.nav-item-link .nav-image-icon {
  width: 23px; height: 23px; min-width: 23px; flex: 0 0 23px;
  display: inline-block; object-fit: contain; vertical-align: middle;
}
.metric-icon .dashboard-image-icon {
  width: 24px; height: 24px; display: block; object-fit: contain;
}
.auth-visual-feature.auth-feature-image { align-items: center; }
.auth-visual-feature .auth-feature-icon {
  width: 40px; height: 40px; min-width: 40px; flex: 0 0 40px;
  display: block; object-fit: contain; border-radius: 11px;
  background: rgba(255,255,255,.08); padding: 3px; box-sizing: border-box;
}

/* Payment History: stable desktop columns; no content-driven shifting. */
.payment-history-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1.65fr) minmax(115px, .8fr) minmax(125px, .9fr) minmax(135px, .95fr);
  align-items: center;
  column-gap: 18px;
  width: 100%;
}
.payment-history-row > * { min-width: 0; overflow-wrap: anywhere; }
.payment-history-item { min-width: 0; }
.payment-history-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.payment-history-paid, .payment-history-due { white-space: nowrap; }
