/* ═══════════════════════════════════════════════════════════════
   BLESSINGS — Family Cashflow
   Design System — Powder Blue × Sage Green
   Based on Finance/branding.html
═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Blue palette (Powder Blue) */
  --blue-50:  #f0f7ff;
  --blue-100: #ddeeff;
  --blue-200: #b8daf7;
  --blue-300: #8ec4ef;   /* PRIMARY */
  --blue-400: #6bb0e8;
  --blue-500: #4a9ad8;
  --blue-600: #3381bf;
  --blue-700: #2166a0;
  --blue-800: #144e7e;
  --blue-900: #0b3459;

  /* Green palette (Sage Green) */
  --green-50:  #f2faf5;
  --green-100: #ddf3e6;
  --green-200: #b4e4c6;
  --green-300: #7ecfa4;  /* ACCENT */
  --green-400: #55bb84;
  --green-500: #35a567;
  --green-600: #268a52;
  --green-700: #1b6e3f;

  /* Neutral palette */
  --neutral-0:   #fff;
  --neutral-50:  #f6f9fc;
  --neutral-100: #edf2f7;
  --neutral-200: #dce6f0;
  --neutral-300: #c5d5e5;
  --neutral-400: #9bb4cc;
  --neutral-500: #6e94b0;
  --neutral-600: #4d7491;
  --neutral-700: #345670;
  --neutral-800: #1e3b52;
  --neutral-900: #0e2130;

  /* Financial status */
  --status-paid:      #268a52;
  --status-paid-bg:   #ddf3e6;
  --status-paid-bd:   #b4e4c6;
  --status-overdue:   #b91c1c;
  --status-overdue-bg:#fee2e2;
  --status-overdue-bd:#fca5a5;
  --status-soon:      #92400e;
  --status-soon-bg:   #fef3c7;
  --status-soon-bd:   #fde68a;
  --status-upcoming:  #1e40af;
  --status-upcoming-bg:#dbeafe;
  --status-upcoming-bd:#93c5fd;
  --status-pending:   #854d0e;
  --status-pending-bg:#fef9c3;
  --status-pending-bd:#fde047;

  /* Amount colors */
  --amount-income:  #268a52;
  --amount-expense: #b91c1c;

  /* Typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Radii */
  --r-sm:   6px;
  --r-md:   12px;
  --r-lg:   20px;
  --r-xl:   32px;
  --r-pill: 9999px;

  /* Shadows */
  --shadow-sm:    0 2px 6px rgba(14,33,48,.07);
  --shadow-md:    0 4px 16px rgba(14,33,48,.1), 0 2px 6px rgba(14,33,48,.05);
  --shadow-lg:    0 8px 32px rgba(14,33,48,.12);
  --shadow-blue:  0 4px 20px rgba(142,196,239,.45);
  --shadow-green: 0 4px 20px rgba(126,207,164,.4);

  /* Easing */
  --ease:   cubic-bezier(.25,.1,.25,1);
  --spring: cubic-bezier(.34,1.56,.64,1);

  /* Layout */
  --sidebar-w: 248px;
  --header-h:  60px;
  --mobnav-h:  64px;
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--neutral-50);
  color: var(--neutral-900);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ── APP SHELL ───────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--neutral-900);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(142,196,239,.2) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(142,196,239,.2); border-radius: 2px; }

.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-cross { font-size: 1rem; color: var(--blue-300); opacity: .7; margin-bottom: 4px; }
.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--blue-300);
  letter-spacing: .04em;
  line-height: 1.1;
}
.sidebar-logo-sub {
  font-size: .65rem;
  font-weight: 600;
  color: var(--neutral-500);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-top: 3px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--neutral-600);
  padding: 14px 10px 6px;
  user-select: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  color: var(--neutral-400);
  font-size: .825rem;
  font-weight: 500;
  transition: all .14s var(--ease);
  cursor: pointer;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: var(--neutral-100); }
.nav-item.active { background: rgba(142,196,239,.12); color: var(--blue-300); }
.nav-icon { font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center; line-height: 1; }

.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.period-card {
  background: rgba(142,196,239,.06);
  border: 1px solid rgba(142,196,239,.12);
  border-radius: var(--r-md);
  padding: 10px 12px;
}
.period-card-label {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--neutral-600);
  margin-bottom: 6px;
}
.period-nav { display: flex; align-items: center; gap: 6px; }
.period-btn {
  color: var(--neutral-500);
  padding: 3px 7px;
  border-radius: var(--r-sm);
  font-size: .85rem;
  transition: all .12s;
}
.period-btn:hover { background: rgba(255,255,255,.08); color: var(--blue-300); }
.period-text {
  flex: 1;
  text-align: center;
  font-size: .8rem;
  font-weight: 600;
  color: var(--neutral-200);
}

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  height: var(--header-h);
  background: var(--neutral-0);
  border-bottom: 1px solid var(--neutral-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
  gap: 12px;
}
.top-bar-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.top-bar-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--neutral-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-bar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

#view-container {
  flex: 1;
  padding: 28px;
  padding-bottom: 48px;
}

/* ── MOBILE NAV ──────────────────────────────────────────────── */
.mob-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--mobnav-h);
  background: var(--neutral-0);
  border-top: 1px solid var(--neutral-200);
  box-shadow: 0 -4px 20px rgba(14,33,48,.08);
  z-index: 200;
  padding: 0 4px;
  justify-content: space-around;
  align-items: center;
}
.mob-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: var(--neutral-400);
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  transition: color .14s;
}
.mob-nav-item .mob-icon { font-size: 1.25rem; line-height: 1; }
.mob-nav-item.active { color: var(--blue-500); }

.fab {
  position: fixed;
  bottom: calc(var(--mobnav-h) + 14px);
  right: 18px;
  width: 54px; height: 54px;
  background: linear-gradient(135deg, var(--blue-300), var(--green-300));
  color: #fff;
  border-radius: 50%;
  font-size: 1.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 201;
  display: none;
  align-items: center;
  justify-content: center;
  transition: transform .15s var(--spring);
}
.fab:hover { transform: scale(1.08); }
.fab:active { transform: scale(.95); }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-pill);
  font-size: .84rem;
  font-weight: 600;
  letter-spacing: .01em;
  transition: transform .12s var(--spring), box-shadow .2s, background .15s;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }

.btn-primary { background: var(--blue-300); color: #fff; box-shadow: 0 2px 8px rgba(142,196,239,.4); }
.btn-primary:hover { background: var(--blue-400); box-shadow: var(--shadow-blue); }
.btn-accent  { background: var(--green-300); color: #fff; box-shadow: 0 2px 8px rgba(126,207,164,.4); }
.btn-accent:hover  { background: var(--green-400); box-shadow: var(--shadow-green); }
.btn-outline { background: transparent; color: var(--blue-600); border: 1.5px solid var(--blue-300); }
.btn-outline:hover { background: var(--blue-50); }
.btn-ghost   { background: transparent; color: var(--neutral-600); }
.btn-ghost:hover   { background: var(--neutral-100); color: var(--neutral-900); }
.btn-danger  { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover  { background: #fca5a5; }
.btn-warning { background: #fef3c7; color: #92400e; }
.btn-warning:hover { background: #fde68a; }
.btn-sm  { padding: 6px 12px; font-size: .78rem; }
.btn-lg  { padding: 12px 24px; font-size: .95rem; }
.btn-xs  { padding: 4px 9px; font-size: .72rem; }
.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  background: var(--neutral-100);
  color: var(--neutral-600);
}
.btn-icon:hover { background: var(--neutral-200); color: var(--neutral-900); transform: none; }
.btn-icon.danger:hover { background: #fee2e2; color: #b91c1c; }

/* ── FORMS ───────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: .77rem; font-weight: 600; color: var(--neutral-600); letter-spacing: .02em; }
.form-required { color: #dc2626; margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  display: block;
  width: 100%;
  padding: 9px 13px;
  background: var(--neutral-0);
  border: 1.5px solid var(--neutral-200);
  border-radius: var(--r-md);
  font-size: .875rem;
  color: var(--neutral-900);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--neutral-400); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--blue-300);
  box-shadow: 0 0 0 3px rgba(142,196,239,.18);
}
.form-input.is-error { border-color: #dc2626; }
.form-input.is-error:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.15); }
.form-help { font-size: .72rem; color: var(--neutral-500); }
.form-error { font-size: .72rem; color: #b91c1c; }
.form-textarea { resize: vertical; min-height: 72px; }

.amount-wrapper { position: relative; }
.amount-prefix {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--neutral-500);
  font-family: var(--font-mono);
  font-size: 1rem;
  pointer-events: none;
}
.form-input.amount-input {
  padding-left: 30px;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
}
.form-grid   { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Payee autocomplete */
.payee-wrap { position: relative; }
.payee-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--neutral-0);
  border: 1.5px solid var(--blue-300);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: 200;
  max-height: 220px;
  overflow-y: auto;
}
.payee-option {
  padding: 9px 13px;
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--neutral-100);
  transition: background .1s;
}
.payee-option:last-child { border-bottom: none; }
.payee-option:hover, .payee-option.highlighted { background: var(--blue-50); }
.payee-option-name { flex: 1; font-weight: 500; color: var(--neutral-800); }
.payee-option-cat  { font-size: .72rem; color: var(--neutral-500); }
.payee-add-new {
  padding: 9px 13px;
  font-size: .82rem;
  color: var(--blue-600);
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--blue-50);
}
.payee-add-new:hover { background: var(--blue-100); }

/* Type toggle */
.type-toggle {
  display: flex;
  background: var(--neutral-100);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}
.type-toggle-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--r-pill);
  font-size: .8rem;
  font-weight: 600;
  color: var(--neutral-500);
  transition: all .14s var(--ease);
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
}
.type-toggle-btn.active-income   { background: var(--green-100); color: var(--green-700); box-shadow: var(--shadow-sm); }
.type-toggle-btn.active-expense  { background: #fee2e2; color: #b91c1c; box-shadow: var(--shadow-sm); }
.type-toggle-btn.active-transfer { background: var(--blue-100); color: var(--blue-700); box-shadow: var(--shadow-sm); }

/* Toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.toggle-switch {
  position: relative;
  width: 40px; height: 22px;
  background: var(--neutral-300);
  border-radius: 11px;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform .2s var(--spring);
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.toggle-switch.on { background: var(--green-400); }
.toggle-switch.on::after { transform: translateX(18px); }
.toggle-label { font-size: .85rem; color: var(--neutral-700); font-weight: 500; }

/* Emoji picker */
.emoji-btn {
  width: 48px; height: 38px;
  border: 1.5px solid var(--neutral-200);
  border-radius: var(--r-md);
  background: var(--neutral-0);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s;
  flex-shrink: 0;
}
.emoji-btn:hover { border-color: var(--blue-300); }
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 10px;
  max-height: 180px;
  overflow-y: auto;
}
.emoji-opt {
  font-size: 1.25rem;
  padding: 5px;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: center;
  transition: background .1s;
}
.emoji-opt:hover { background: var(--blue-50); }

/* Color picker */
.color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0;
}
.color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .15s var(--spring), border-color .15s;
}
.color-swatch:hover { transform: scale(1.2); }
.color-swatch.selected { border-color: var(--neutral-900); transform: scale(1.15); }

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--neutral-0);
  border: 1px solid var(--neutral-200);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--neutral-100);
  gap: 10px;
}
.card-title { font-size: .88rem; font-weight: 700; color: var(--neutral-800); }
.card-body  { padding: 18px 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--neutral-100);
  background: var(--neutral-50);
}

/* KPI Cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi-card {
  background: var(--neutral-0);
  border: 1px solid var(--neutral-200);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-card.blue-tint  { border-color: var(--blue-200);  background: linear-gradient(135deg, var(--blue-50) 0%, #fff 100%); }
.kpi-card.green-tint { border-color: var(--green-200); background: linear-gradient(135deg, var(--green-50) 0%, #fff 100%); }
.kpi-card.red-tint   { border-color: #fca5a5;          background: linear-gradient(135deg, #fff5f5 0%, #fff 100%); }
.kpi-card.amber-tint { border-color: #fde68a;          background: linear-gradient(135deg, #fffbeb 0%, #fff 100%); }

.kpi-icon {
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-bottom: 10px;
}
.kpi-icon.blue  { background: var(--blue-100); }
.kpi-icon.green { background: var(--green-100); }
.kpi-icon.red   { background: #fee2e2; }
.kpi-icon.amber { background: #fef3c7; }

.kpi-value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1.1;
  color: var(--neutral-900);
  margin-bottom: 2px;
}
.kpi-label { font-size: .76rem; color: var(--neutral-500); font-weight: 500; }
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .7rem;
  font-weight: 700;
  margin-top: 6px;
}
.kpi-delta.positive { color: var(--green-500); }
.kpi-delta.negative { color: #dc2626; }
.kpi-delta.neutral  { color: var(--neutral-500); }

/* Progress bar */
.progress-track {
  height: 5px;
  background: var(--neutral-100);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin: 7px 0 3px;
}
.progress-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--blue-300), var(--green-300));
  transition: width .8s var(--ease);
}
.progress-fill.green { background: var(--green-400); }
.progress-fill.amber { background: #f59e0b; }
.progress-fill.red   { background: #dc2626; }
.progress-label { display: flex; justify-content: space-between; font-size: .7rem; color: var(--neutral-500); }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-paid      { background: var(--status-paid-bg);     color: var(--status-paid);    border-color: var(--status-paid-bd); }
.badge-overdue   { background: var(--status-overdue-bg);  color: var(--status-overdue); border-color: var(--status-overdue-bd); }
.badge-due-soon  { background: var(--status-soon-bg);     color: var(--status-soon);    border-color: var(--status-soon-bd); }
.badge-upcoming  { background: var(--status-upcoming-bg); color: var(--status-upcoming);border-color: var(--status-upcoming-bd); }
.badge-pending   { background: var(--status-pending-bg);  color: var(--status-pending); border-color: var(--status-pending-bd); }
.badge-income    { background: var(--green-100); color: var(--green-700); }
.badge-expense   { background: #fee2e2; color: #b91c1c; }
.badge-transfer  { background: var(--blue-100); color: var(--blue-700); }
.badge-blue      { background: var(--blue-100); color: var(--blue-700); }
.badge-green     { background: var(--green-100); color: var(--green-700); }
.badge-neutral   { background: var(--neutral-100); color: var(--neutral-600); }
.badge-amber     { background: #fef3c7; color: #92400e; }
.badge-active    { background: var(--green-100); color: var(--green-700); }
.badge-inactive  { background: var(--neutral-100); color: var(--neutral-500); }

/* ── TABLES ──────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}
.data-table th {
  text-align: left;
  padding: 9px 13px;
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--neutral-500);
  background: var(--neutral-50);
  border-bottom: 1px solid var(--neutral-200);
  white-space: nowrap;
  user-select: none;
}
.data-table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--neutral-100);
  color: var(--neutral-700);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--neutral-50); }
.data-table tr.income-row   td { border-left: 3px solid var(--green-400); }
.data-table tr.expense-row  td { border-left: 3px solid #ef4444; }
.data-table tr.transfer-row td { border-left: 3px solid var(--blue-400); }
.data-table tr.reversal-row td { opacity: .45; text-decoration: line-through; }
.data-table tr.inactive-row td { opacity: .5; }

.td-amount { font-family: var(--font-mono); font-weight: 500; text-align: right; white-space: nowrap; }
.td-amount.income   { color: var(--amount-income); }
.td-amount.expense  { color: var(--amount-expense); }
.td-date   { font-size: .78rem; color: var(--neutral-500); white-space: nowrap; }
.td-actions { display: flex; gap: 5px; justify-content: flex-end; }
.td-center { text-align: center; }

/* ── MAINTENANCE SCREENS ─────────────────────────────────────── */
.maint-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.maint-search-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.maint-search-bar .form-input { max-width: 280px; }

.maint-stat-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.maint-stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--neutral-0);
  border: 1px solid var(--neutral-200);
  border-radius: var(--r-pill);
  font-size: .78rem;
  box-shadow: var(--shadow-sm);
}
.maint-stat-chip strong { color: var(--neutral-900); }
.maint-stat-chip span  { color: var(--neutral-500); }

/* Icon + name cells */
.cell-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cell-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
  background: var(--neutral-100);
}
.cell-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cell-name { font-weight: 600; color: var(--neutral-800); }
.cell-sub  { font-size: .72rem; color: var(--neutral-500); margin-top: 1px; }

/* ── ACCOUNTS ────────────────────────────────────────────────── */
.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.account-card {
  background: var(--neutral-0);
  border: 1px solid var(--neutral-200);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.account-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.account-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, linear-gradient(90deg, var(--blue-300), var(--green-300)));
}
.account-card.inactive { opacity: .55; }
.account-type-badge { font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--neutral-500); margin-bottom: 6px; }
.account-name  { font-size: .95rem; font-weight: 700; color: var(--neutral-800); margin-bottom: 10px; }
.account-balance { font-family: var(--font-display); font-size: 1.5rem; color: var(--neutral-900); line-height: 1.2; }
.account-balance.negative { color: #b91c1c; }
.account-meta { font-size: .7rem; color: var(--neutral-400); margin-top: 6px; }

/* ── DTI GAUGE ───────────────────────────────────────────────── */
.dti-gauge-wrap { position: relative; width: 180px; height: 90px; overflow: hidden; margin: 0 auto; }
.dti-gauge-bg {
  width: 180px; height: 180px;
  border-radius: 50%;
  border: 18px solid var(--neutral-100);
  clip-path: inset(0 0 50% 0);
  position: absolute; top: 0; left: 0;
}
.dti-gauge-fill {
  width: 180px; height: 180px;
  border-radius: 50%;
  border: 18px solid var(--green-400);
  clip-path: inset(0 0 50% 0);
  position: absolute; top: 0; left: 0;
  transform-origin: 90px 90px;
  transition: transform 1s var(--ease), border-color .5s;
}
.dti-gauge-center { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); text-align: center; }
.dti-pct { font-family: var(--font-display); font-size: 1.5rem; line-height: 1; }
.dti-label { font-size: .65rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--neutral-500); }

/* ── BILLS ───────────────────────────────────────────────────── */
.bill-list { display: flex; flex-direction: column; gap: 8px; }
.bill-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--neutral-0);
  border: 1px solid var(--neutral-200);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}
.bill-item:hover { box-shadow: var(--shadow-md); }
.bill-status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.bill-status-dot.paid     { background: var(--green-400); }
.bill-status-dot.overdue  { background: #dc2626; }
.bill-status-dot.due_soon { background: #f59e0b; }
.bill-status-dot.upcoming { background: var(--blue-400); }
.bill-status-dot.pending  { background: #a78bfa; }
.bill-info { flex: 1; min-width: 0; }
.bill-name { font-weight: 600; color: var(--neutral-800); font-size: .88rem; }
.bill-due  { font-size: .72rem; color: var(--neutral-500); margin-top: 2px; }
.bill-amount { font-family: var(--font-mono); font-weight: 500; font-size: .88rem; color: var(--neutral-700); margin-right: 6px; white-space: nowrap; }

/* ── MODALS ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14,33,48,.55);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--neutral-0);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  overflow-y: auto;
  animation: modal-in .22s var(--spring);
}
.modal.wide { max-width: 700px; }
@keyframes modal-in {
  from { opacity: 0; transform: scale(.93) translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  padding: 22px 22px 14px;
  border-bottom: 1px solid var(--neutral-100);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  background: var(--neutral-0);
  z-index: 1;
}
.modal-title { font-family: var(--font-display); font-size: 1.15rem; color: var(--neutral-900); line-height: 1.2; }
.modal-subtitle { font-size: .75rem; color: var(--neutral-500); margin-top: 2px; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neutral-400);
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: all .14s;
}
.modal-close:hover { background: var(--neutral-100); color: var(--neutral-700); }
.modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--neutral-100);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  background: var(--neutral-0);
  position: sticky;
  bottom: 0;
}
.modal-footer-left { margin-right: auto; }

/* ── FILTERS ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
}
.filter-bar .form-select,
.filter-bar .form-input { width: auto; padding: 7px 11px; font-size: .82rem; }

/* ── REPORT TABLE ────────────────────────────────────────────── */
.report-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.report-table th {
  text-align: right;
  padding: 8px 13px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--neutral-500);
  border-bottom: 2px solid var(--neutral-200);
}
.report-table th:first-child { text-align: left; }
.report-table td {
  padding: 9px 13px;
  border-bottom: 1px solid var(--neutral-100);
  text-align: right;
  font-family: var(--font-mono);
  font-size: .84rem;
}
.report-table td:first-child { text-align: left; font-family: var(--font-body); color: var(--neutral-700); padding-left: 22px; }
.report-table tr.section-header td {
  font-weight: 700;
  color: var(--neutral-500);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--neutral-50);
  font-family: var(--font-body);
  padding-top: 12px;
  border-bottom: 1px solid var(--neutral-200);
  padding-left: 13px;
}
.report-table tr.total-row td  { font-weight: 700; border-top: 2px solid var(--neutral-300); border-bottom: 2px solid var(--neutral-300); color: var(--neutral-900); }
.report-table tr.net-row td    { font-size: 1rem; font-weight: 700; background: var(--blue-50); color: var(--blue-800); }
.variance-pos { color: var(--green-600); }
.variance-neg { color: #b91c1c; }

/* ── PAGE LAYOUT ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title    { font-family: var(--font-display); font-size: 1.55rem; color: var(--neutral-900); line-height: 1.15; }
.page-subtitle { font-size: .82rem; color: var(--neutral-500); margin-top: 4px; }
.page-actions  { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.section-title {
  font-size: .86rem;
  font-weight: 700;
  color: var(--neutral-700);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.section-title::before {
  content: '';
  width: 3px; height: 14px;
  background: linear-gradient(180deg, var(--blue-300), var(--green-300));
  border-radius: 2px;
}

.dash-grid   { display: grid; gap: 18px; }
.grid-col-2  { grid-template-columns: 1fr 1fr; }
.grid-col-3  { grid-template-columns: 1fr 1fr 1fr; }

.totals-bar {
  display: flex;
  gap: 18px;
  padding: 12px 18px;
  background: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-radius: var(--r-md);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.totals-item { display: flex; flex-direction: column; gap: 2px; }
.totals-label { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--neutral-400); }
.totals-value { font-family: var(--font-mono); font-size: .92rem; font-weight: 600; }

.empty-state { text-align: center; padding: 48px 24px; color: var(--neutral-400); }
.empty-icon  { font-size: 2.8rem; margin-bottom: 10px; }
.empty-text  { font-size: .88rem; }
.empty-sub   { font-size: .78rem; margin-top: 5px; }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 15px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: .85rem;
}
.alert-info    { background: var(--blue-50);   border-color: var(--blue-200);   color: var(--blue-800);  }
.alert-success { background: var(--green-50);  border-color: var(--green-200);  color: var(--green-700); }
.alert-warning { background: #fef3c7;          border-color: #fde68a;           color: #92400e; }
.alert-danger  { background: #fee2e2;          border-color: #fca5a5;           color: #b91c1c; }

/* ── TOAST ───────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 500; display: flex; flex-direction: column; gap: 7px; pointer-events: none; }
.toast {
  padding: 11px 16px;
  background: var(--neutral-900);
  color: #fff;
  border-radius: var(--r-md);
  font-size: .84rem;
  box-shadow: var(--shadow-lg);
  animation: toast-in .22s var(--spring);
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 300px;
  pointer-events: all;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.toast.success { background: var(--green-700); }
.toast.error   { background: #b91c1c; }
.toast.warning { background: #92400e; }

/* ── TOPBAR DROPDOWN ─────────────────────────────────────────── */
.topbar-user-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--neutral-0);
  border: 1px solid var(--neutral-200);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  min-width: 210px;
  z-index: 400;
  overflow: hidden;
  animation: fade-in .18s var(--ease);
}
.user-dropdown.hidden { display: none; }
.ud-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--neutral-100);
  background: linear-gradient(135deg, var(--neutral-50), var(--blue-50));
}
.ud-name { font-weight: 700; font-size: .88rem; color: var(--neutral-800); }
.ud-username { font-size: .72rem; color: var(--neutral-500); font-family: var(--font-mono); margin-top: 1px; }
.ud-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: .84rem;
  color: var(--neutral-700);
  cursor: pointer;
  transition: background .12s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.ud-item:hover { background: var(--neutral-50); color: var(--neutral-900); }
.ud-item.danger:hover { background: #fff5f5; color: #b91c1c; }
.ud-divider { height: 1px; background: var(--neutral-100); margin: 3px 0; }

/* ── NOTIFICATION PANEL ──────────────────────────────────────── */
.notif-section { margin-bottom: 20px; }
.notif-section-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--neutral-500);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.notif-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--neutral-100);
}
.notif-row:last-child { border-bottom: none; }
.notif-info { flex: 1; }
.notif-name { font-size: .87rem; font-weight: 600; color: var(--neutral-800); }
.notif-desc { font-size: .73rem; color: var(--neutral-500); margin-top: 2px; }
.notif-email-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.notif-email-input {
  flex: 1;
  padding: 5px 10px;
  border: 1.5px solid var(--neutral-200);
  border-radius: var(--r-md);
  font-size: .78rem;
  font-family: var(--font-body);
  color: var(--neutral-800);
  outline: none;
  transition: border-color .15s;
}
.notif-email-input:focus { border-color: var(--blue-300); }
.notif-alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: .83rem;
  margin-bottom: 8px;
  border: 1px solid transparent;
  animation: fade-in .25s var(--ease);
}
.notif-alert-banner.overdue  { background: #fff5f5; border-color: #fca5a5; color: #b91c1c; }
.notif-alert-banner.due-soon { background: var(--amber-bg); border-color: #fde68a; color: var(--amber); }
.notif-alert-banner.low-bal  { background: var(--blue-50); border-color: var(--blue-200); color: var(--blue-700); }
.notif-alert-banner.dti-crit { background: #fff5f5; border-color: #fca5a5; color: #b91c1c; }

/* ── LOGIN SCREEN ────────────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--neutral-900);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 20px;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(142,196,239,.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(126,207,164,.04) 0%, transparent 50%);
}

.login-card {
  background: rgba(30,59,82,.85);
  border: 1px solid rgba(142,196,239,.12);
  border-radius: var(--r-xl);
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
  width: 100%;
  max-width: 400px;
  padding: 40px 36px;
  backdrop-filter: blur(12px);
  animation: login-in .4s var(--spring);
}
@keyframes login-in {
  from { opacity: 0; transform: translateY(24px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo {
  width: 100%;
  max-width: 280px;
  height: auto;
  border-radius: var(--r-md);
  margin-bottom: 12px;
  display: block;
  margin-left: auto;
  margin-right: auto;
  animation: pulse-in .5s var(--spring);
}
.login-cross {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
  animation: pulse-in .5s var(--spring);
}
.login-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--blue-300);
  letter-spacing: .04em;
  line-height: 1.1;
}
.login-sub {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--neutral-600);
  margin-top: 4px;
}

.login-form { display: flex; flex-direction: column; gap: 14px; }

.login-field { display: flex; flex-direction: column; gap: 5px; }
.login-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--neutral-500);
  text-transform: uppercase;
}
.login-input {
  display: block;
  width: 100%;
  padding: 11px 14px;
  background: rgba(255,255,255,.05);
  border: 1.5px solid rgba(142,196,239,.15);
  border-radius: var(--r-md);
  font-size: .9rem;
  color: var(--neutral-100);
  font-family: var(--font-body);
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.login-input::placeholder { color: var(--neutral-600); }
.login-input:focus {
  border-color: var(--blue-300);
  background: rgba(142,196,239,.07);
  box-shadow: 0 0 0 3px rgba(142,196,239,.12);
}
.login-input.is-error { border-color: #ef4444; }

.login-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--blue-300), var(--green-300));
  color: #fff;
  border: none;
  border-radius: var(--r-pill);
  font-size: .95rem;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  margin-top: 6px;
  transition: opacity .15s, transform .12s var(--spring), box-shadow .2s;
  box-shadow: 0 4px 20px rgba(142,196,239,.3);
  letter-spacing: .02em;
}
.login-btn:hover { opacity: .92; transform: translateY(-1px); box-shadow: var(--shadow-blue); }
.login-btn:active { transform: scale(.98); }
.login-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.login-error {
  background: rgba(185,28,28,.15);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
  border-radius: var(--r-md);
  padding: 10px 13px;
  font-size: .82rem;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fade-in .2s var(--ease);
}
.login-error.hidden { display: none; }

.login-hint {
  text-align: center;
  font-size: .72rem;
  color: var(--neutral-600);
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.06);
  line-height: 1.6;
}
.login-hint code {
  background: rgba(142,196,239,.12);
  color: var(--blue-300);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: .78rem;
}

/* ── SIDEBAR BRANDING IMAGE ──────────────────────────────────── */
.sidebar-brand-img {
  width: 100%;
  max-width: 180px;
  height: auto;
  border-radius: var(--r-sm);
  display: block;
  margin-bottom: 8px;
  opacity: .88;
  filter: brightness(1.05);
}

/* ── USER BADGE (top bar) ─────────────────────────────────────── */
.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--neutral-100);
  border-radius: var(--r-pill);
  font-size: .8rem;
  font-weight: 600;
  color: var(--neutral-700);
  cursor: default;
}
.user-badge-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-300), var(--green-300));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  color: #fff;
  font-weight: 800;
  flex-shrink: 0;
}
.logout-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: .78rem;
  font-weight: 600;
  color: var(--neutral-500);
  background: transparent;
  transition: all .14s;
}
.logout-btn:hover { background: var(--neutral-100); color: #b91c1c; }

/* ── CHANGE PASSWORD MODAL ────────────────────────────────────── */
.password-strength {
  height: 3px;
  background: var(--neutral-200);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}
.password-strength-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .3s, background .3s;
}

/* ── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--neutral-100); }
::-webkit-scrollbar-thumb { background: var(--blue-300); border-radius: 3px; }

/* ── ANIMATIONS ──────────────────────────────────────────────── */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.fade-in { animation: fade-in .28s var(--ease) both; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding-bottom: var(--mobnav-h); }
  .mob-nav { display: flex; }
  .fab { display: flex; }
  #view-container { padding: 14px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-col-2, .grid-col-3 { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr; }
  .top-bar { padding: 0 14px; }
  .modal { border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 94vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .page-header { flex-direction: column; }
  .totals-bar { flex-direction: column; gap: 10px; }
  .maint-search-bar .form-input { max-width: 100%; width: 100%; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-select, .filter-bar .form-input { width: 100%; max-width: 100%; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
}