/* ============================================================
   FINANCE TRACKER PRO — style.css v3.9.0
   Design: "Modern Fintech" — emerald + deep navy, mobile-first
   Fonts: Plus Jakarta Sans (body) · Outfit (display) · JetBrains Mono
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ── */
:root {
  color-scheme: dark;
  /* Surfaces */
  --ftp-bg:        #080c10;
  --ftp-surface:   #0d1117;
  --ftp-surface2:  #141c24;
  --ftp-surface3:  #1c2633;
  --ftp-border:    #1e2d3d;
  --ftp-border2:   #263545;

  /* Accent — emerald green */
  --ftp-accent:    #10b981;
  --ftp-accent2:   #34d399;
  --ftp-accent-bg: rgba(16,185,129,0.10);
  --ftp-accent-glow: 0 0 0 3px rgba(16,185,129,0.20);

  /* Semantic colours */
  --ftp-green:     #10b981;
  --ftp-green-bg:  rgba(16,185,129,0.10);
  --ftp-red:       #f87171;
  --ftp-red-bg:    rgba(248,113,113,0.10);
  --ftp-yellow:    #fbbf24;
  --ftp-blue:      #60a5fa;
  --ftp-cyan:      #22d3ee;
  --ftp-purple:    #a78bfa;

  /* Text */
  --ftp-text:      #e2e8f0;
  --ftp-text2:     #7d92a8;
  --ftp-muted:     #445566;

  /* Typography */
  --ftp-font:      'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --ftp-mono:      'JetBrains Mono', 'Fira Mono', monospace;
  --ftp-disp:      'Outfit', 'Plus Jakarta Sans', sans-serif;

  /* Radii */
  --ftp-r:         12px;
  --ftp-r-sm:      8px;
  --ftp-r-lg:      16px;
  --ftp-r-xl:      22px;

  /* Shadows */
  --ftp-shadow:    0 2px 16px rgba(0,0,0,0.45);
  --ftp-shadow-lg: 0 8px 48px rgba(0,0,0,0.60);
  --ftp-shadow-xl: 0 20px 72px rgba(0,0,0,0.70);

  /* Layout */
  --ftp-sidebar-w: 244px;
  --ftp-topbar-h:  56px;
}

/* ── Reset ── */
.ftp-app *, .ftp-auth-wrap * { box-sizing: border-box; margin: 0; padding: 0; }
.ftp-app {
  color-scheme: dark;
  font-family: var(--ftp-font);
  background: var(--ftp-bg);
  color: var(--ftp-text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  isolation: isolate; /* own stacking context so nothing from the host theme can render on top */
}
.ftp-auth-wrap { font-family: var(--ftp-font); }

/* ════════════════════════════════
   INVESTMENTS  (v4.0.0)
════════════════════════════════ */
.inv-card {
  background: var(--ftp-surface);
  border: 1px solid var(--ftp-border);
  border-top: 3px solid var(--ftp-accent);
  border-radius: var(--ftp-r);
  padding: 16px;
  transition: box-shadow .2s, transform .15s;
  min-width: 0;
}
.inv-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.25); transform: translateY(-1px); }

.inv-tab-btn {
  padding: 8px 14px;
  border: 1px solid var(--ftp-border);
  border-radius: var(--ftp-r-sm);
  background: transparent;
  color: var(--ftp-text2);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--ftp-font);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.inv-tab-btn:hover { background: var(--ftp-surface2); color: var(--ftp-text); }
.inv-tab-btn.active {
  background: var(--ftp-accent);
  border-color: var(--ftp-accent);
  color: #021a12;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(16,185,129,.25);
}

.inv-type-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* P&L bar rows in portfolio chart */
.inv-pl-row { display:flex; align-items:center; gap:8px; padding:5px 0; border-bottom:1px solid rgba(255,255,255,.04); }
.inv-pl-row:last-child { border-bottom:none; }
.inv-pl-label { font-size:11px; color:var(--ftp-text2); min-width:80px; max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex-shrink:0; }
.inv-pl-track { flex:1; height:6px; background:var(--ftp-surface3); border-radius:3px; overflow:hidden; min-width:0; }
.inv-pl-fill  { height:100%; border-radius:3px; transition:width .5s; }
.inv-pl-val   { font-size:11px; font-weight:600; white-space:nowrap; min-width:75px; text-align:right; font-family:var(--ftp-mono); }

/* Transaction history rows */
.inv-hist-row { display:flex; align-items:flex-start; gap:8px; padding:8px 0; border-bottom:1px solid var(--ftp-border); }
.inv-hist-row:last-child { border-bottom:none; }

/* Mobile: make investment grid single column */
@media (max-width:600px) {
  .inv-tab-btn { font-size:11px; padding:6px 10px; }
  .inv-card    { padding:12px; }
}

   ------------------------------------------------------------
   Previous versions pushed the page content over by hard-coding
   selectors for specific theme wrappers (#page, .site, .ast-*…).
   That only worked on the handful of themes that happened to
   match, and overlapped/clipped content on every other theme —
   the "page overlaying" bug. Fixed elements (sidebar/topbar/
   bottom-nav) are now pulled out to be direct children of <body>
   by JS on load (see nav.php), so position:fixed always resolves
   against the viewport — never against a theme/page-builder
   wrapper that uses transform/filter/contain (which silently
   breaks position:fixed). The content itself is "broken out" of
   whatever container the theme nested it in using the standard
   full-bleed technique, then reserves its own space for the
   sidebar/topbar via padding — no guessing theme markup needed.
   ============================================================ */
body.ftp-page:not(.ftp-login-page) .ftp-app {
  width: 100vw;
  max-width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  box-sizing: border-box;
}
html.ftp-page, body.ftp-page { overflow-x: hidden !important; }

/* ── Scrollbars ── */
.ftp-app ::-webkit-scrollbar { width: 4px; height: 4px; }
.ftp-app ::-webkit-scrollbar-track { background: transparent; }
.ftp-app ::-webkit-scrollbar-thumb { background: var(--ftp-border2); border-radius: 4px; }
.ftp-app ::-webkit-scrollbar-thumb:hover { background: var(--ftp-muted); }

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
/* Mobile-first: small padding, expand on desktop */
.ftp-page-wrap {
  padding: 16px 14px 80px;      /* mobile: more bottom for nav */
  max-width: 100%;
  box-sizing: border-box;
  animation: ftp-fade-in 0.20s ease-out;
}
@keyframes ftp-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ftp-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.ftp-page-header > div:first-child { flex: 1; min-width: 140px; }
.ftp-page-title {
  font-family: var(--ftp-disp);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ftp-text);
  margin: 0 0 2px;
  line-height: 1.25;
}
.ftp-page-sub  { font-size: 12px; color: var(--ftp-muted); margin: 0; }
.ftp-page-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ============================================================
   GRIDS & SPACING
   ============================================================ */
/* Mobile-first: single column, then expand */
.ftp-grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
.ftp-grid-3 { display: grid; grid-template-columns: 1fr; gap: 12px; }
.ftp-grid-4 { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.ftp-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 cols on mobile */
  gap: 10px;
  margin-bottom: 16px;
}
.ftp-mb-4  { margin-bottom: 4px !important; }
.ftp-mb-8  { margin-bottom: 8px !important; }
.ftp-mb-12 { margin-bottom: 12px; }
.ftp-mb-16 { margin-bottom: 16px; }
.ftp-mb-20 { margin-bottom: 20px; }

/* ============================================================
   CARDS
   ============================================================ */
.ftp-card {
  background: var(--ftp-surface);
  border: 1px solid var(--ftp-border);
  border-radius: var(--ftp-r);
  padding: 16px;
  box-shadow: var(--ftp-shadow);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.ftp-card:hover { border-color: var(--ftp-border2); }
.ftp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.ftp-card-title {
  font-family: var(--ftp-disp);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1px;
  color: var(--ftp-text);
}

/* ── Stat cards ── */
.ftp-stat-card {
  background: var(--ftp-surface);
  border: 1px solid var(--ftp-border);
  border-radius: var(--ftp-r);
  padding: 14px;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  cursor: default;
}
.ftp-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(0,0,0,0.50);
  border-color: var(--ftp-border2);
}
/* Bottom-edge accent stripe (more modern than top border) */
.ftp-stat-card-income  { border-bottom: 2px solid var(--ftp-green); }
.ftp-stat-card-expense { border-bottom: 2px solid var(--ftp-red); }
.ftp-stat-card-balance { border-bottom: 2px solid var(--ftp-accent); }
.ftp-stat-card-savings { border-bottom: 2px solid var(--ftp-yellow); }

.ftp-stat-icon  { position: absolute; top: 12px; right: 12px; font-size: 22px; opacity: 0.06; }
.ftp-stat-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--ftp-muted);
  margin-bottom: 6px;
  font-family: var(--ftp-mono);
}
.ftp-stat-value {
  font-family: var(--ftp-disp);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.2;
}
.ftp-stat-sub { font-size: 11px; color: var(--ftp-text2); margin-top: 4px; }

/* shimmer skeleton */
.ftp-skeleton {
  min-height: 82px;
  background: linear-gradient(90deg, var(--ftp-surface) 25%, var(--ftp-surface2) 50%, var(--ftp-surface) 75%);
  background-size: 200% 100%;
  animation: ftp-shimmer 1.5s infinite;
  border-radius: var(--ftp-r);
}
@keyframes ftp-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   BUTTONS — mobile-first: min 44px tap targets
   ============================================================ */
.ftp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  min-height: 42px;
  border-radius: var(--ftp-r-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--ftp-font);
  cursor: pointer;
  transition: all 0.15s ease, transform 0.08s;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1.4;
  letter-spacing: 0.1px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.ftp-btn:hover  { transform: translateY(-1px); text-decoration: none; }
.ftp-btn:active { transform: scale(0.97) !important; }
.ftp-btn:disabled { opacity: 0.40; cursor: not-allowed; transform: none !important; }

.ftp-btn-primary {
  background: var(--ftp-accent);
  border-color: var(--ftp-accent);
  color: #021a12;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(16,185,129,0.30);
}
.ftp-btn-primary:hover {
  background: var(--ftp-accent2);
  border-color: var(--ftp-accent2);
  box-shadow: 0 4px 20px rgba(16,185,129,0.40);
  color: #021a12;
}

.ftp-btn-success {
  background: var(--ftp-green);
  border-color: var(--ftp-green);
  color: #021a12;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(16,185,129,0.25);
}
.ftp-btn-success:hover {
  background: #059669;
  border-color: #059669;
  box-shadow: 0 4px 18px rgba(16,185,129,0.35);
  color: #021a12;
}

.ftp-btn-danger {
  background: var(--ftp-red);
  border-color: var(--ftp-red);
  color: #fff;
  box-shadow: 0 2px 10px rgba(248,113,113,0.25);
}
.ftp-btn-danger:hover {
  background: #f87171;
  border-color: #f87171;
  box-shadow: 0 4px 18px rgba(248,113,113,0.35);
  color: #fff;
}

.ftp-btn-warning {
  background: var(--ftp-yellow);
  border-color: var(--ftp-yellow);
  color: #1a1200;
}
.ftp-btn-warning:hover { background: #d97706; border-color: #d97706; }

.ftp-btn-outline {
  background: transparent;
  border-color: var(--ftp-border2);
  color: var(--ftp-text2);
}
.ftp-btn-outline:hover {
  background: var(--ftp-surface2);
  border-color: var(--ftp-accent);
  color: var(--ftp-accent);
}

.ftp-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ftp-muted);
}
.ftp-btn-ghost:hover { background: var(--ftp-surface2); color: var(--ftp-text2); }

.ftp-btn-full { width: 100%; justify-content: center; padding: 13px; font-size: 14px; }
.ftp-btn-sm   { padding: 7px 13px; font-size: 12px; min-height: 34px; }
.ftp-btn-icon { padding: 9px; border-radius: 9px; min-height: unset; }

/* ============================================================
   FORMS — mobile-first: 44px+ inputs, 16px font (no iOS zoom)
   ============================================================ */
.ftp-form-group { margin-bottom: 16px; }
.ftp-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ftp-text2);
  margin-bottom: 7px;
  font-family: var(--ftp-mono);
}
.ftp-input, .ftp-select {
  width: 100%;
  padding: 12px 14px;
  min-height: 46px;
  background: var(--ftp-bg, #080c10);
  border: 1.5px solid var(--ftp-border, #1e2d3d);
  color: var(--ftp-text, #e2e8f0);
  border-radius: var(--ftp-r-sm, 8px);
  font-size: 16px;           /* 16px prevents iOS zoom */
  font-family: var(--ftp-font);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
/* Mobile: force dark background on ALL form controls inside .ftp-app */
.ftp-app input, .ftp-app select, .ftp-app textarea {
  background-color: var(--ftp-bg, #080c10) !important;
  color: var(--ftp-text, #e2e8f0) !important;
  border-color: var(--ftp-border, #1e2d3d);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  color-scheme: dark;
}
/* Modal overlays are fixed/outside flow — need explicit dark overrides too */
.ftp-modal-overlay input, .ftp-modal-overlay select, .ftp-modal-overlay textarea,
[id$="-modal"] input, [id$="-modal"] select, [id$="-modal"] textarea {
  background-color: var(--ftp-bg, #080c10) !important;
  color: var(--ftp-text, #e2e8f0) !important;
  border-color: var(--ftp-border, #1e2d3d) !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  color-scheme: dark;
}
.ftp-input:focus, .ftp-select:focus {
  border-color: var(--ftp-accent);
  box-shadow: var(--ftp-accent-glow);
}
.ftp-input::placeholder { color: var(--ftp-muted); font-size: 14px; }
.ftp-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23445566' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}
.ftp-select option { background: var(--ftp-surface2); color: var(--ftp-text); }
.ftp-textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--ftp-bg);
  border: 1.5px solid var(--ftp-border);
  color: var(--ftp-text);
  border-radius: var(--ftp-r-sm);
  font-size: 16px;
  font-family: var(--ftp-font);
  outline: none;
  resize: vertical;
  min-height: 90px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ftp-textarea:focus { border-color: var(--ftp-accent); box-shadow: var(--ftp-accent-glow); }
.ftp-form-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--ftp-border);
}
/* ── ftp-filter-row — CSS Grid (v3.10.4) ──────────────────────────
   Previous flex approach: with flex-wrap items need a min-width to
   know when to wrap, but that min-width (120px × 6 items = 720px)
   was wider than the available content area on the viewport used,
   so the row overflowed horizontally on Income/Expenses/Reports/
   Journals — ALL 6-filter-group pages.

   Fix: CSS grid with auto-fill + minmax. Grid tracks are BOUNDED
   to the grid container — they cannot overflow. The browser
   automatically calculates how many columns fit at any given width.

   Income/Expenses/Reports (6 groups), Journals (4 groups),
   FinReports (3 groups) all benefit from this single rule.
   ─────────────────────────────────────────────────────────────── */
.ftp-filter-row {
  display: grid;
  grid-template-columns: 1fr;           /* mobile: single column */
  gap: 8px;
  align-items: end;
  width: 100%;
  box-sizing: border-box;
}
/* 2-column at ≥480px (covers narrow tablets, landscape phones) */
@media (min-width: 480px) {
  .ftp-filter-row { grid-template-columns: repeat(2, 1fr); }
}
/* Auto-fill at ≥600px: as many 150px columns as fit — no overflow possible */
@media (min-width: 600px) {
  .ftp-filter-row { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
.ftp-filter-group {
  min-width: 0;         /* grid children MUST have min-width:0 to honour track width */
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-sizing: border-box;
}
.ftp-filter-group .ftp-input,
.ftp-filter-group .ftp-select {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  font-size: 14px;
  min-height: 42px;
  box-sizing: border-box;
}
/* SEARCH group: spans all columns so it gets full width on wide screens */
.ftp-filter-group:last-child:not(:only-child) {
  grid-column: 1 / -1;
}
.ftp-add-cat-row { display: flex; gap: 8px; }

/* ============================================================
   TABLE
   ============================================================ */
.ftp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
.ftp-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 500px; }
.ftp-table th {
  text-align: left;
  padding: 11px 14px;
  background: var(--ftp-surface2);
  border-bottom: 1px solid var(--ftp-border);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--ftp-muted);
  font-family: var(--ftp-mono);
  white-space: nowrap;
}
.ftp-table th:first-child { border-radius: var(--ftp-r-sm) 0 0 0; }
.ftp-table th:last-child  { border-radius: 0 var(--ftp-r-sm) 0 0; }
.ftp-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
  font-size: 13px;
}
.ftp-table tr:last-child td { border-bottom: none; }
.ftp-table tbody tr { transition: background 0.1s; }
.ftp-table tbody tr:hover td { background: var(--ftp-surface2); }
.ftp-amount-income  { color: var(--ftp-green); font-weight: 700; font-family: var(--ftp-mono); }
.ftp-amount-expense { color: var(--ftp-red);   font-weight: 700; font-family: var(--ftp-mono); }
.ftp-loading-row {
  text-align: center;
  padding: 32px 12px !important;
  color: var(--ftp-muted);
  font-size: 13px;
  animation: ftp-pulse 1.5s ease-in-out infinite;
}
@keyframes ftp-pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }

/* Pagination */
.ftp-pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  padding: 14px 0 4px;
  flex-wrap: wrap;
}
.ftp-pg-btn {
  padding: 7px 13px;
  min-height: 36px;
  border-radius: var(--ftp-r-sm);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--ftp-border);
  background: transparent;
  color: var(--ftp-muted);
  cursor: pointer;
  font-family: var(--ftp-font);
  transition: all 0.14s;
}
.ftp-pg-btn.active {
  border-color: var(--ftp-accent);
  color: var(--ftp-accent);
  background: var(--ftp-accent-bg);
}
.ftp-pg-btn:hover:not(.active) {
  color: var(--ftp-text);
  background: var(--ftp-surface2);
  border-color: var(--ftp-border2);
}

/* ============================================================
   TAGS & BADGES
   ============================================================ */
.ftp-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.5;
}
.ftp-tag-ledger {
  background: var(--ftp-accent-bg);
  color: var(--ftp-accent2);
  border: 1px solid rgba(16,185,129,0.22);
}
.ftp-tag-cat {
  background: var(--ftp-surface2);
  color: var(--ftp-text2);
  border: 1px solid var(--ftp-border);
}
.ftp-tags-wrap { display: flex; flex-wrap: wrap; gap: 4px; }
.ftp-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.ftp-type-income  { background: var(--ftp-green-bg); color: var(--ftp-green); }
.ftp-type-expense { background: var(--ftp-red-bg);   color: var(--ftp-red); }
.ftp-removable-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.ftp-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--ftp-surface2);
  border: 1px solid var(--ftp-border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ftp-text2);
  white-space: nowrap;
}

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.ftp-progress-bar {
  background: var(--ftp-surface3);
  border-radius: 6px;
  height: 7px;
  overflow: hidden;
  margin: 7px 0;
}
.ftp-progress-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.65s cubic-bezier(0.4,0,0.2,1);
}

/* ============================================================
   GOAL & LOAN CARDS
   ============================================================ */
.ftp-goals-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.ftp-goal-card {
  background: var(--ftp-surface);
  border: 1px solid var(--ftp-border);
  border-radius: var(--ftp-r);
  padding: 18px;
  border-left: 3px solid var(--ftp-accent);
  transition: transform .18s, box-shadow .18s;
  box-shadow: var(--ftp-shadow);
}
.ftp-goal-card:hover { transform: translateY(-2px); box-shadow: var(--ftp-shadow-lg); }
.ftp-goal-bar {
  height: 7px;
  background: var(--ftp-surface3);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 6px;
}

/* ============================================================
   RECURRING RULES
   ============================================================ */
.ftp-rule-row {
  background: var(--ftp-surface);
  border: 1px solid var(--ftp-border);
  border-radius: var(--ftp-r-sm);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.15s;
  flex-wrap: wrap;
}
.ftp-rule-row:hover { border-color: var(--ftp-border2); }
.ftp-rule-row.paused { opacity: 0.45; }

/* ============================================================
   TYPE TOGGLE
   ============================================================ */
.ftp-type-toggle {
  display: flex;
  background: var(--ftp-bg);
  border-radius: var(--ftp-r-sm);
  padding: 3px;
  border: 1px solid var(--ftp-border);
}
.ftp-type-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 7px;
  font-family: var(--ftp-font);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.18s;
  cursor: pointer;
  background: none;
  color: var(--ftp-muted);
  min-height: 42px;
}
.ftp-type-btn.active-expense { background: var(--ftp-red-bg);   color: var(--ftp-red); }
.ftp-type-btn.active-income  { background: var(--ftp-green-bg); color: var(--ftp-green); }

/* ============================================================
   ICON & COLOUR PICKERS
   ============================================================ */
.ftp-icon-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ftp-icon-btn {
  width: 42px;
  height: 42px;
  border: 1.5px solid var(--ftp-border);
  border-radius: 10px;
  background: var(--ftp-bg);
  cursor: pointer;
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s;
}
.ftp-icon-btn.selected { border-color: var(--ftp-accent); background: var(--ftp-accent-bg); }
.ftp-icon-btn:hover:not(.selected) { border-color: var(--ftp-text2); }
.ftp-color-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ftp-color-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.14s;
}
.ftp-color-btn.selected { border-color: #fff; transform: scale(1.15); }

/* ============================================================
   MODALS — bottom-sheet on mobile, centred on desktop
   ============================================================ */
.ftp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  display: none;
  align-items: flex-end;       /* bottom on mobile */
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ftp-modal-overlay.ftp-open {
  display: flex;
  animation: ftp-fade-overlay 0.18s ease;
}
@keyframes ftp-fade-overlay { from{opacity:0} to{opacity:1} }

.ftp-modal-box {
  background: var(--ftp-surface);
  border: 1px solid var(--ftp-border2);
  border-radius: var(--ftp-r-xl) var(--ftp-r-xl) 0 0;
  padding: 0 18px 32px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  animation: ftp-slide-up-mobile 0.28s cubic-bezier(0.34,1.2,0.64,1);
  box-shadow: var(--ftp-shadow-xl);
}
@keyframes ftp-slide-up-mobile {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
/* Drag handle */
.ftp-modal-box::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: var(--ftp-border2);
  border-radius: 2px;
  margin: 12px auto 16px;
}
.ftp-modal-lg { max-width: 100%; }
.ftp-modal-sm { max-width: 100%; }

.ftp-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ftp-border);
}
.ftp-modal-header h3 {
  font-family: var(--ftp-disp);
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.2px;
}
.ftp-modal-close {
  background: var(--ftp-surface2);
  border: 1px solid var(--ftp-border);
  color: var(--ftp-text2);
  font-size: 14px;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s;
  flex-shrink: 0;
  touch-action: manipulation;
}
.ftp-modal-close:hover {
  background: var(--ftp-surface3);
  color: var(--ftp-text);
  border-color: var(--ftp-border2);
}

/* ============================================================
   ALERTS
   ============================================================ */
.ftp-alert {
  padding: 12px 16px;
  border-radius: var(--ftp-r-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}
.ftp-alert-error   { background: var(--ftp-red-bg);   border: 1px solid rgba(248,113,113,0.30); color: var(--ftp-red); }
.ftp-alert-success { background: var(--ftp-green-bg);  border: 1px solid rgba(16,185,129,0.30);  color: var(--ftp-green); }
.ftp-alert-warning { background: rgba(251,191,36,0.10); border: 1px solid rgba(251,191,36,0.30); color: var(--ftp-yellow); }
.ftp-alert-info    { background: var(--ftp-accent-bg); border: 1px solid rgba(16,185,129,0.30);  color: var(--ftp-accent2); }

/* ============================================================
   TOASTS
   ============================================================ */
#ftp-toasts {
  position: fixed;
  bottom: 72px;             /* above mobile bottom nav */
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 28px);
  max-width: 360px;
}
.ftp-toast {
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  text-align: center;
  animation: ftp-toast-in 0.28s cubic-bezier(0.34,1.2,0.64,1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  pointer-events: all;
  font-family: var(--ftp-font);
}
@keyframes ftp-toast-in {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.ftp-toast-success { background: rgba(5,20,12,0.97);  border: 1px solid rgba(16,185,129,0.55); color: var(--ftp-green); }
.ftp-toast-error   { background: rgba(24,8,8,0.97);   border: 1px solid rgba(248,113,113,0.55); color: var(--ftp-red); }
.ftp-toast-info    { background: rgba(5,20,12,0.97);  border: 1px solid rgba(16,185,129,0.40);  color: var(--ftp-accent2); }
.ftp-toast-warning { background: rgba(24,18,4,0.97);  border: 1px solid rgba(251,191,36,0.55);  color: var(--ftp-yellow); }

/* ============================================================
   AUTH PAGE
   ============================================================ */
.ftp-auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--ftp-bg);
  position: relative;
  overflow: hidden;
}
.ftp-auth-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.ftp-auth-bg::before, .ftp-auth-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.08;
}
.ftp-auth-bg::before {
  width: 480px; height: 480px;
  background: var(--ftp-accent);
  top: -160px; left: -160px;
}
.ftp-auth-bg::after {
  width: 380px; height: 380px;
  background: var(--ftp-cyan);
  bottom: -100px; right: -100px;
}
.ftp-auth-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
  background: var(--ftp-surface);
  border: 1px solid var(--ftp-border);
  border-radius: var(--ftp-r-xl);
  padding: 36px 28px;
  animation: ftp-slide-up 0.40s cubic-bezier(0.34,1.2,0.64,1);
  box-shadow: var(--ftp-shadow-xl);
}
@keyframes ftp-slide-up {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.ftp-auth-logo { text-align: center; margin-bottom: 30px; }
.ftp-auth-logo-icon {
  width: 68px; height: 68px;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--ftp-accent), var(--ftp-cyan));
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: #021a12;
  box-shadow: 0 8px 32px rgba(16,185,129,0.35);
}
.ftp-auth-logo-text {
  font-family: var(--ftp-disp);
  font-size: 22px; font-weight: 800; letter-spacing: -0.4px;
}
.ftp-auth-logo-sub {
  font-size: 10px; font-weight: 600; letter-spacing: 2px;
  color: var(--ftp-muted); margin-top: 4px;
  text-transform: uppercase; font-family: var(--ftp-mono);
}
.ftp-auth-tabs {
  display: flex;
  background: var(--ftp-bg);
  border-radius: var(--ftp-r-sm);
  padding: 3px;
  margin-bottom: 22px;
  border: 1px solid var(--ftp-border);
}
.ftp-auth-tab {
  flex: 1; padding: 10px;
  min-height: 42px;
  border: none; background: none;
  color: var(--ftp-muted); font-size: 13px; font-weight: 600;
  border-radius: 7px; cursor: pointer;
  font-family: var(--ftp-font); transition: all 0.18s;
}
.ftp-auth-tab.active {
  background: var(--ftp-accent);
  color: #021a12;
  box-shadow: 0 2px 12px rgba(16,185,129,0.35);
}
.ftp-btn-google {
  background: #fff !important; border-color: #e2e2e8 !important;
  color: #1a1a2e !important; justify-content: center; margin-top: 10px;
}
.ftp-btn-google:hover { background: #f5f5f8 !important; color: #1a1a2e !important; }
.ftp-divider { text-align: center; margin: 18px 0; position: relative; }
.ftp-divider::before, .ftp-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 44%; height: 1px; background: var(--ftp-border);
}
.ftp-divider::before { left: 0; }
.ftp-divider::after  { right: 0; }
.ftp-divider span {
  font-size: 11px; color: var(--ftp-muted); padding: 0 10px;
  background: var(--ftp-surface); font-weight: 500;
}
.ftp-demo-box {
  margin-top: 18px; padding: 14px;
  background: var(--ftp-bg); border-radius: var(--ftp-r-sm);
  border: 1px solid var(--ftp-border);
}
.ftp-demo-title {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--ftp-text2);
  margin-bottom: 8px; font-family: var(--ftp-mono);
}
.ftp-demo-box p { font-size: 12px; color: var(--ftp-muted); margin: 3px 0; }

/* ============================================================
   MISC COMPONENTS
   ============================================================ */
.ftp-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 1.8px;
  color: var(--ftp-muted); text-transform: uppercase;
  font-family: var(--ftp-mono); padding: 4px 0;
  display: flex; align-items: center; gap: 10px;
}
.ftp-section-title::after { content: ''; flex: 1; height: 1px; background: var(--ftp-border); }
.ftp-empty { text-align: center; padding: 48px 20px; color: var(--ftp-muted); }
.ftp-empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.45; }
.ftp-empty-text { font-size: 14px; line-height: 1.7; }
.ftp-chart-wrap { position: relative; height: 200px; }
.ftp-chart-wrap canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.ftp-backup-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--ftp-border);
  flex-wrap: wrap;
}
.ftp-backup-row:last-child { border-bottom: none; }
.ftp-backup-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--ftp-accent-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.ftp-backup-info { flex: 1; min-width: 120px; }
.ftp-backup-name { font-size: 13px; font-weight: 600; word-break: break-all; }
.ftp-backup-meta { font-size: 11px; color: var(--ftp-muted); margin-top: 2px; }
.ftp-financial-review {
  background: var(--ftp-surface2);
  border-radius: var(--ftp-r);
  padding: 18px;
  margin-top: 16px;
}
.ftp-security-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ftp-muted);
  margin-top: 16px; justify-content: center;
}
.ftp-pw-strength {
  height: 4px; border-radius: 2px;
  margin-top: 6px; background: var(--ftp-border); overflow: hidden;
}
.ftp-pw-strength-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.3s, background 0.3s;
}
.ftp-pw-hint { font-size: 11px; color: var(--ftp-muted); margin-top: 4px; }
.ftp-page-sub { font-size: 12px; color: var(--ftp-muted); margin: 2px 0 0; }
.loan-overdue { border-color: var(--ftp-red) !important; box-shadow: 0 0 0 1px rgba(248,113,113,0.2); }
#rpt-pane-overview,#rpt-pane-monthly,#rpt-pane-expense,#rpt-pane-income,#rpt-pane-savings,#rpt-pane-transactions { margin-top: 16px; }
#rpt-monthly-table td:first-child, #rpt-savings-table td:first-child { white-space: nowrap; min-width: 80px; }
#acc-detail .ftp-table td:last-child { font-family: var(--ftp-mono); font-weight: 600; }
#ftp-logout-warn { z-index: 99998; }
#contrib-modal-content { min-width: 300px; }
#rm-cat-search { margin-bottom: 4px; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.ftp-recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ftp-border);
  transition: background 0.1s;
}
.ftp-recent-row:last-child { border-bottom: none; }
.ftp-recent-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.ftp-recent-info { flex: 1; min-width: 0; }
.ftp-recent-cat  { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 2px; }
.ftp-recent-meta { font-size: 11px; color: var(--ftp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ftp-recent-amount { font-weight: 700; font-size: 14px; font-family: var(--ftp-mono); white-space: nowrap; flex-shrink: 0; }
.ftp-recent-actions { display: flex; gap: 4px; flex-shrink: 0; }
.dash-section-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
/* ── Dashboard filter bar — CSS grid (v3.10.2) ───────────────────
   Previous versions used flex on dash-filter-row. The period group
   had an inline style "flex:0 0 auto" that cannot be overridden by
   class rules, and #dash-period-label had white-space:nowrap, so the
   group always expanded to its content width and overflowed the row.

   Fix: CSS grid with auto-fill columns (minmax). Each column is
   always exactly its grid track — it can never overflow its parent.
   The inline flex override on the period group is gone (PHP changed).
   ─────────────────────────────────────────────────────────────── */
.dash-filter-row {
  display: grid;
  /* mobile: single column stack */
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: end;
  width: 100%;
  box-sizing: border-box;
}
/* tablet+: auto-fill equal columns, min 140px each */
@media (min-width: 600px) {
  .dash-filter-row {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}
.dash-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;     /* grid child must have min-width:0 to honour track width */
  width: 100%;
  box-sizing: border-box;
}
.dash-filter-group .ftp-select,
.dash-filter-group .ftp-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
/* Custom date pair: hidden/shown by JS (display:none / display:flex).
   DO NOT set display here — JS owns it. We only set:
   · grid-column: span 2  so it spans full width in the parent grid
   · flex-direction: row so FROM and TO sit side-by-side when shown */
#dash-custom-dates {
  /* display intentionally omitted — controlled by JS */
  flex-direction: row;        /* override column from .dash-filter-group when shown as flex */
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  grid-column: 1 / -1;       /* always span all columns in the parent grid */
}
@media (min-width: 600px) {
  #dash-custom-dates { grid-column: 1 / -1; }  /* keep full-width on tablet+ too */
}
#dash-custom-dates > div { flex: 1 1 120px; min-width: 0; }
/* Period label: fills its grid cell, allows text to wrap */
#dash-period-group {
  min-width: 0;
}
#dash-period-label {
  font-size: 12px;
  color: var(--ftp-text2);
  padding: 8px 12px;
  background: var(--ftp-surface2);
  border: 1px solid var(--ftp-border);
  border-radius: var(--ftp-r-sm);
  white-space: normal;      /* allow wrap — no fixed width can overflow */
  overflow-wrap: break-word;
  min-width: 0;
  width: 100%;
  text-align: center;
  font-family: var(--ftp-mono);
  letter-spacing: 0.3px;
  box-sizing: border-box;
  line-height: 1.5;
}
.ftp-dash-filter { padding: 12px 14px !important; }
.ftp-dash-filter-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  width: 100%;
  box-sizing: border-box;
}
.ftp-dash-filter-inner .ftp-filter-group { min-width: 0; width: 100%; }
/* Mobile-first stat grid: 2 cols */
.ftp-dash-stat-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }

/* ============================================================
   BULK BAR
   ============================================================ */
#income-bulk-bar, #expenses-bulk-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--ftp-surface2);
  border: 1px solid var(--ftp-border);
  border-radius: var(--ftp-r-sm);
  margin-bottom: 8px;
}
.ftp-row-selected td { background: rgba(16,185,129,0.06) !important; }

/* ============================================================
   SIDEBAR NAV (desktop) — hidden on mobile via media queries
   ============================================================ */
.ftp-nav,.ftp-nav-drawer,.ftp-nav-toggle,.ftp-nav-brand,.ftp-nav-links,.ftp-nav-user,.ftp-nav-link,.ftp-bottom-nav-item { display: none !important; }
.ftp-back-btn { display: none !important; }

.ftp-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--ftp-sidebar-w);
  background: var(--ftp-surface);
  border-right: 1px solid var(--ftp-border);
  display: flex; flex-direction: column;
  z-index: 200;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--ftp-border) transparent;
}
.ftp-sidebar::-webkit-scrollbar { width: 3px; }
.ftp-sidebar::-webkit-scrollbar-thumb { background: var(--ftp-border2); border-radius: 4px; }

.ftp-sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--ftp-border);
  flex-shrink: 0;
}
.ftp-sidebar-logo {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ftp-accent), var(--ftp-cyan));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
  box-shadow: 0 2px 14px rgba(16,185,129,0.30);
}
.ftp-sidebar-brand-text { display: flex; flex-direction: column; min-width: 0; }
.ftp-sidebar-name {
  font-family: var(--ftp-disp);
  font-size: 13px; font-weight: 700; color: var(--ftp-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ftp-sidebar-version { font-size: 9px; color: var(--ftp-muted); font-family: var(--ftp-mono); }

.ftp-sidebar-dashboard {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  margin: 10px 10px 4px;
  border-radius: var(--ftp-r-sm);
  text-decoration: none; color: var(--ftp-text2);
  font-size: 13px; font-weight: 500;
  transition: all .15s;
}
.ftp-sidebar-dashboard:hover { background: var(--ftp-surface2); color: var(--ftp-text); }
.ftp-sidebar-dashboard.active {
  background: var(--ftp-accent);
  color: #021a12;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(16,185,129,0.28);
}
.ftp-si-icon  { font-size: 15px; flex-shrink: 0; }
.ftp-si-label { flex: 1; }

.ftp-sidebar-group { flex-shrink: 0; }
.ftp-sidebar-group + .ftp-sidebar-group {
  border-top: 1px solid rgba(30,45,61,0.90);
  margin-top: 2px; padding-top: 2px;
}
.ftp-sidebar-dashboard + .ftp-sidebar-group {
  border-top: 1px solid rgba(30,45,61,0.90);
  margin-top: 4px; padding-top: 2px;
}

.ftp-sg-header {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px 4px;
  background: none; border: none; cursor: pointer;
  color: var(--ftp-muted); font-size: 9px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  font-family: var(--ftp-mono); transition: color .14s;
}
.ftp-sg-header:hover { color: var(--ftp-text2); }
.ftp-sg-icon  { font-size: 12px; }
.ftp-sg-label { flex: 1; text-align: left; }
.ftp-sg-arrow {
  font-size: 12px; transition: transform .20s;
  display: inline-block; color: var(--ftp-muted);
}
.ftp-sidebar-group.ftp-sg-open .ftp-sg-arrow { transform: rotate(90deg); }
.ftp-sg-items {
  display: none; flex-direction: column;
  padding: 2px 8px 6px; gap: 1px;
}
.ftp-sidebar-group.ftp-sg-open .ftp-sg-items { display: flex; }
.ftp-sg-link {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  text-decoration: none; color: var(--ftp-muted);
  font-size: 12.5px; font-weight: 400;
  transition: all .14s; position: relative;
}
.ftp-sg-link:hover { background: var(--ftp-surface2); color: var(--ftp-text); }
.ftp-sg-link.active {
  background: var(--ftp-accent-bg);
  color: var(--ftp-accent);
  font-weight: 600;
}
.ftp-sg-link.active::before {
  content: '';
  position: absolute; left: 0; top: 22%; bottom: 22%;
  width: 3px; background: var(--ftp-accent);
  border-radius: 0 3px 3px 0;
}
.ftp-sg-link-icon  { font-size: 13px; flex-shrink: 0; width: 18px; text-align: center; }
.ftp-sg-link-label { flex: 1; }

.ftp-sidebar-footer {
  margin-top: auto; padding: 14px 16px;
  border-top: 1px solid var(--ftp-border);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.ftp-sidebar-user   { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.ftp-sidebar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ftp-accent), var(--ftp-cyan));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #021a12; flex-shrink: 0;
}
.ftp-sidebar-user-info { min-width: 0; flex: 1; }
.ftp-sidebar-username {
  font-size: 12px; font-weight: 600; color: var(--ftp-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ftp-sidebar-email {
  font-size: 10px; color: var(--ftp-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ftp-sidebar-logout {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ftp-muted); text-decoration: none;
  transition: all .14s; flex-shrink: 0;
}
.ftp-sidebar-logout:hover { background: var(--ftp-red-bg); color: var(--ftp-red); }

/* ============================================================
   MOBILE TOPBAR
   ============================================================ */
/* Hidden by default; shown on mobile via media query */
.ftp-topbar { display: none; }

/* ============================================================
   MOBILE DRAWER
   ============================================================ */
.ftp-drawer-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.70); z-index: 390;
  backdrop-filter: blur(4px);
}
.ftp-drawer-overlay.open { display: block; }
.ftp-drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: min(280px, 86vw);
  background: var(--ftp-surface);
  border-right: 1px solid var(--ftp-border);
  z-index: 400;
  transform: translateX(-100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column; overflow-y: auto;
}
.ftp-drawer.open { transform: translateX(0); }
.ftp-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--ftp-border);
  flex-shrink: 0;
}
.ftp-drawer-brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--ftp-disp);
  font-weight: 700; font-size: 16px; color: var(--ftp-text);
}
.ftp-drawer-logo  { font-size: 22px; }
.ftp-drawer-close {
  width: 34px; height: 34px;
  background: var(--ftp-surface2); border: 1px solid var(--ftp-border);
  border-radius: 9px; cursor: pointer; color: var(--ftp-text);
  font-size: 14px; display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
.ftp-drawer-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ftp-border);
  flex-shrink: 0;
}
.ftp-drawer-links { flex: 1; padding: 8px 0 24px; overflow-y: auto; }
.ftp-drawer-dashboard {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; text-decoration: none;
  font-size: 14px; font-weight: 500; color: var(--ftp-muted);
  transition: all .14s;
  min-height: 48px;
}
.ftp-drawer-dashboard:hover, .ftp-drawer-dashboard.active {
  background: var(--ftp-accent-bg); color: var(--ftp-accent);
}
.ftp-drawer-group-label {
  padding: 14px 16px 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--ftp-muted);
  font-family: var(--ftp-mono);
}
.ftp-drawer-link {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ftp-muted);
  font-size: 14px; font-weight: 400; transition: all .14s;
}
.ftp-drawer-sublink {
  padding: 13px 16px 13px 30px;
  min-height: 48px;
}
.ftp-drawer-sublink:hover, .ftp-drawer-sublink.active {
  background: var(--ftp-surface2); color: var(--ftp-accent); font-weight: 600;
}
.ftp-drawer-sublink-icon { width: 20px; text-align: center; font-size: 15px; }

/* ============================================================
   MOBILE BOTTOM NAV — primary mobile navigation
   ============================================================ */
.ftp-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 62px;
  background: var(--ftp-surface);
  border-top: 1px solid var(--ftp-border);
  z-index: 300;
  box-shadow: 0 -4px 28px rgba(0,0,0,.35);
}
.ftp-bn-tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  text-decoration: none; color: var(--ftp-muted);
  font-size: 9px; font-weight: 700; letter-spacing: .3px;
  text-transform: uppercase; font-family: var(--ftp-mono);
  padding: 6px 2px;
  background: none; border: none; cursor: pointer;
  transition: color .14s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  min-height: 62px;
}
.ftp-bn-tab.active, .ftp-bn-tab:hover { color: var(--ftp-accent); }
.ftp-bn-tab.active::before {
  content: '';
  position: absolute; top: 0; left: 20%; right: 20%;
  height: 2px; background: var(--ftp-accent);
  border-radius: 0 0 3px 3px;
}
.ftp-bn-icon  { font-size: 21px; line-height: 1; }
.ftp-bn-label { font-size: 9px; }

/* ============================================================
   BOTTOM SHEETS (mobile nav panels)
   ============================================================ */
.ftp-sheet-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.60); z-index: 380;
}
.ftp-sheet-backdrop.open { display: block; }
.ftp-bottom-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--ftp-surface);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--ftp-border);
  z-index: 390; padding: 0 0 44px;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -8px 40px rgba(0,0,0,.45);
}
.ftp-bottom-sheet.open { transform: translateY(0); }
.ftp-sheet-handle {
  width: 36px; height: 4px;
  background: var(--ftp-border2);
  border-radius: 2px; margin: 12px auto 4px;
}
.ftp-sheet-title {
  font-size: 11px; font-weight: 700; color: var(--ftp-muted);
  letter-spacing: 1px; text-transform: uppercase;
  font-family: var(--ftp-mono);
  padding: 10px 20px 12px;
  border-bottom: 1px solid var(--ftp-border);
}
.ftp-sheet-link {
  display: flex; align-items: center; gap: 14px;
  padding: 17px 20px;
  text-decoration: none; color: var(--ftp-text);
  font-size: 15px; font-weight: 500;
  border-bottom: 1px solid rgba(30,45,61,0.50);
  transition: background .14s;
  -webkit-tap-highlight-color: transparent;
  min-height: 54px;
}
.ftp-sheet-link:last-child { border-bottom: none; }
.ftp-sheet-link:hover, .ftp-sheet-link.active { background: var(--ftp-surface2); }
.ftp-sheet-link.active { color: var(--ftp-accent); font-weight: 700; }
.ftp-sheet-link-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--ftp-surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.ftp-sheet-link.active .ftp-sheet-link-icon { background: var(--ftp-accent-bg); }

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.ftp-admin-panel { min-height: 100vh; font-family: var(--ftp-font); background: var(--ftp-bg); color: var(--ftp-text); }
.ftp-admin-sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 240px; background: var(--ftp-surface); border-right: 1px solid var(--ftp-border); display: flex; flex-direction: column; z-index: 100; }
.ftp-admin-header { padding: 20px; border-bottom: 1px solid var(--ftp-border); display: flex; align-items: center; gap: 10px; }
.ftp-admin-header-icon { width: 36px; height: 36px; background: linear-gradient(135deg,var(--ftp-accent),var(--ftp-cyan)); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.ftp-admin-header h2 { font-family: var(--ftp-disp); font-size: 14px; font-weight: 700; margin: 0; line-height: 1.2; }
.ftp-admin-header span { font-size: 10px; color: var(--ftp-accent); font-weight: 600; font-family: var(--ftp-mono); letter-spacing: 1px; text-transform: uppercase; }
.ftp-admin-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.ftp-admin-nav-section { font-size: 9px; font-weight: 700; letter-spacing: 2.5px; color: var(--ftp-muted); padding: 12px 8px 6px; text-transform: uppercase; font-family: var(--ftp-mono); }
.ftp-admin-nav-link { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--ftp-r-sm); color: var(--ftp-text2); text-decoration: none; font-size: 13px; font-weight: 500; transition: all .14s; cursor: pointer; border: none; background: none; width: 100%; text-align: left; min-height: 42px; }
.ftp-admin-nav-link:hover { background: var(--ftp-surface2); color: var(--ftp-text); }
.ftp-admin-nav-link.active { background: var(--ftp-accent-bg); color: var(--ftp-accent); }
.ftp-admin-nav-link .icon { font-size: 16px; flex-shrink: 0; }
.ftp-admin-footer { padding: 12px 10px; border-top: 1px solid var(--ftp-border); }
.ftp-admin-content { margin-left: 240px; padding: 24px; min-height: 100vh; }
.ftp-admin-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.ftp-admin-topbar h1 { font-family: var(--ftp-disp); font-size: 20px; font-weight: 700; margin: 0; }
.ftp-admin-topbar-actions { display: flex; gap: 8px; }
.ftp-admin-tabs { display: flex; gap: 2px; background: var(--ftp-surface); border: 1px solid var(--ftp-border); border-radius: var(--ftp-r-sm); padding: 3px; margin-bottom: 20px; overflow-x: auto; }
.ftp-admin-tab-btn { padding: 8px 14px; min-height: 38px; border: none; background: none; color: var(--ftp-muted); font-size: 12.5px; font-weight: 500; border-radius: 7px; cursor: pointer; font-family: var(--ftp-font); transition: all .14s; white-space: nowrap; }
.ftp-admin-tab-btn.active { background: var(--ftp-accent); color: #021a12; font-weight: 700; }
.ftp-admin-login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--ftp-bg); font-family: var(--ftp-font); }
.ftp-admin-login-card { background: var(--ftp-surface); border: 1px solid var(--ftp-border); border-radius: var(--ftp-r-xl); padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: var(--ftp-shadow-xl); animation: ftp-slide-up .4s cubic-bezier(.34,1.2,.64,1); }
.ftp-user-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg,var(--ftp-accent),var(--ftp-cyan)); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #021a12; flex-shrink: 0; }
.ftp-admin-notice { padding: 10px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.ftp-admin-notice.success { background: var(--ftp-green-bg); border: 1px solid rgba(16,185,129,0.40); color: var(--ftp-green); }
.ftp-admin-notice.warn    { background: rgba(251,191,36,0.10); border: 1px solid rgba(251,191,36,0.40); color: var(--ftp-yellow); }
.ftp-admin-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 99; backdrop-filter: blur(3px); }
.ftp-admin-overlay.ftp-open { display: block; }

/* ============================================================
   THEME VARIANTS — updated for new accent
   ============================================================ */
.ftp-theme-light  {
  --ftp-bg:#f0f4f8; --ftp-surface:#ffffff; --ftp-surface2:#e8eef5; --ftp-surface3:#dde5ef;
  --ftp-border:#cdd5e0; --ftp-border2:#bcc8d8; --ftp-text:#0d1b2a; --ftp-text2:#4a6280; --ftp-muted:#8099b0;
  --ftp-accent-bg:rgba(16,185,129,0.08);
}
.ftp-theme-forest {
  --ftp-bg:#0a160a; --ftp-surface:#0f1e0f; --ftp-surface2:#162816; --ftp-surface3:#1e3420;
  --ftp-border:#243e24; --ftp-border2:#2e4a30; --ftp-accent:#10b981; --ftp-accent2:#4ade80;
  --ftp-accent-bg:rgba(16,185,129,0.10); --ftp-text:#c8e8c8; --ftp-text2:#86a886; --ftp-muted:#5e7860;
}
.ftp-theme-slate  {
  --ftp-bg:#0f172a; --ftp-surface:#1e293b; --ftp-surface2:#2d3f55; --ftp-surface3:#3d5068;
  --ftp-border:#3d5068; --ftp-border2:#4d6078; --ftp-accent:#38bdf8; --ftp-accent2:#7dd3fc;
  --ftp-accent-bg:rgba(56,189,248,0.10); --ftp-text:#f0f6ff; --ftp-text2:#94a3b8; --ftp-muted:#64748b;
}
.ftp-theme-rose   {
  --ftp-bg:#100909; --ftp-surface:#1a1010; --ftp-surface2:#281818; --ftp-surface3:#362020;
  --ftp-border:#3c2828; --ftp-border2:#4a3030; --ftp-accent:#f472b6; --ftp-accent2:#f9a8d4;
  --ftp-accent-bg:rgba(244,114,182,0.10); --ftp-text:#f0e0e8; --ftp-text2:#c090a8; --ftp-muted:#805868;
}

/* ============================================================
   LAYOUT OFFSET FOR SIDEBAR (WordPress integration)
   ============================================================ */
body.ftp-page {
  display:block !important; margin:0 !important; padding:0 !important;
  overflow-x:hidden !important; min-height:100vh !important;
  background:var(--ftp-bg,#080c10) !important;
  box-sizing:border-box !important;
}
.ftp-page .entry-header,.ftp-page .entry-title,.ftp-page h1.entry-title,.ftp-page h2.entry-title,
.ftp-page .page-title,.ftp-page .page-header,.ftp-page .post-title,.ftp-page .wp-block-post-title,
.ftp-page .article-header,.ftp-page .singular-header,.ftp-page .ast-page-builder-template .entry-header {
  display:none !important;
}

/* ── Mobile layout (max 767px) ── */
@media (max-width:767px) {
  body.ftp-page:not(.ftp-login-page) .ftp-app { padding-top:var(--ftp-topbar-h) !important; }
  body.ftp-page .ftp-sidebar         { display:none !important; }
  body.ftp-page .ftp-topbar          { display:block !important; }
  body.ftp-page .ftp-bottom-nav      { display:flex !important; }
  /* Legacy fallback for themes whose wrapper happens to match these selectors */
  body.ftp-page > #page, body.ftp-page > .site,
  body.ftp-page #content, body.ftp-page .site-content, body.ftp-page .site-main,
  body.ftp-page .ast-container, body.ftp-page article, body.ftp-page .entry-content {
    margin-left:0 !important; margin-right:0 !important;
    width:100% !important; max-width:100% !important;
    padding-left:0 !important; padding-right:0 !important;
    box-sizing:border-box !important; display:block !important;
  }
  body.ftp-page .ftp-page-wrap {
    padding:14px 12px 82px !important;
    max-width:100% !important;
    box-sizing:border-box !important;
  }
}

/* ── Desktop layout (min 768px) ── */
@media (min-width:768px) {
  /* Override mobile-first defaults for desktop */
  .ftp-page-wrap { padding:24px 28px 48px; }
  .ftp-page-title { font-size: 22px; }
  .ftp-stat-grid { grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 14px; }
  .ftp-card { padding: 20px; }
  .ftp-stat-card { padding: 18px; }
  .ftp-grid-2 { grid-template-columns:repeat(2,1fr); gap:16px; }
  .ftp-grid-3 { grid-template-columns:repeat(3,1fr); gap:16px; }
  .ftp-goals-grid { grid-template-columns:repeat(2,1fr); }

  body.ftp-page:not(.ftp-login-page) .ftp-sidebar { display:flex !important; }
  body.ftp-page .ftp-topbar      { display:none !important; }
  body.ftp-page .ftp-bottom-nav  { display:none !important; }
  body.ftp-page:not(.ftp-login-page) .ftp-app {
    padding-left:var(--ftp-sidebar-w) !important;
  }
  /* Legacy fallback for themes whose wrapper happens to match these selectors */
  body.ftp-page:not(.ftp-login-page) > #page,
  body.ftp-page:not(.ftp-login-page) > .site {
    margin-left:0 !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important; box-sizing:border-box !important;
  }
  body.ftp-page:not(.ftp-login-page) #content,
  body.ftp-page:not(.ftp-login-page) .site-content,
  body.ftp-page:not(.ftp-login-page) .site-main,
  body.ftp-page:not(.ftp-login-page) .ast-container,
  body.ftp-page:not(.ftp-login-page) article,
  body.ftp-page:not(.ftp-login-page) .entry-content {
    width:100% !important; max-width:100% !important; min-width:0 !important;
    margin-left:0 !important; margin-right:0 !important;
    padding-left:0 !important; padding-right:0 !important;
    box-sizing:border-box !important; display:block !important;
  }
  body.ftp-page:not(.ftp-login-page) .ftp-page-wrap {
    padding:24px 28px 48px !important;
    width:100% !important; max-width:100% !important;
    box-sizing:border-box !important;
  }

  /* Modals: centred on desktop */
  .ftp-modal-overlay { align-items:center; }
  .ftp-modal-box {
    border-radius:var(--ftp-r-xl); max-width:520px;
    animation:ftp-modal-in 0.25s cubic-bezier(.34,1.2,.64,1);
  }
  .ftp-modal-lg  { max-width:720px; }
  .ftp-modal-sm  { max-width:380px; }
  @keyframes ftp-modal-in {
    from{opacity:0;transform:scale(0.96) translateY(-8px)}
    to{opacity:1;transform:scale(1) translateY(0)}
  }
  .ftp-modal-box::before { display:none; }

  /* Toast: above page, no bottom-nav offset */
  #ftp-toasts { bottom: 24px; }

  /* Input font size can be smaller on desktop (no iOS zoom issue) */
  .ftp-input, .ftp-select, .ftp-textarea { font-size: 14px; min-height: 42px; }
  .ftp-filter-group .ftp-input, .ftp-filter-group .ftp-select { font-size: 13px; min-height: 38px; }
  .ftp-btn { min-height: 38px; }
  .ftp-btn-full { min-height: 44px; }
  .ftp-type-btn { min-height: 38px; }
}

/* ── Tablet (768–1023px) ── */
@media (min-width:768px) and (max-width:1023px) {
  :root { --ftp-sidebar-w:200px; }
  body.ftp-page:not(.ftp-login-page) .ftp-sidebar { width:200px !important; }
  body.ftp-page:not(.ftp-login-page) .ftp-app { padding-left:200px !important; }
  /* Legacy fallback */
  body.ftp-page:not(.ftp-login-page) > #page,
  body.ftp-page:not(.ftp-login-page) > .site {
    margin-left:0 !important; width:100% !important; max-width:100% !important;
  }
  body.ftp-page:not(.ftp-login-page) .ftp-page-wrap { padding:18px 18px 40px !important; }
}

/* ── Large desktop (≥1280px) ── */
@media (min-width:1280px) {
  :root { --ftp-sidebar-w:252px; }
  .ftp-stat-grid { grid-template-columns:repeat(4,1fr); }
  .ftp-goals-grid { grid-template-columns:repeat(3,1fr); }
}

/* ── Login page ── */
body.ftp-page.ftp-login-page {
  display:flex !important; align-items:center !important;
  justify-content:center !important; min-height:100vh !important; padding:20px !important;
}
body.ftp-page.ftp-login-page .ftp-sidebar,
body.ftp-page.ftp-login-page .ftp-topbar,
body.ftp-page.ftp-login-page .ftp-bottom-nav { display:none !important; }
body.ftp-page.ftp-login-page #page,
body.ftp-page.ftp-login-page .site,
body.ftp-page.ftp-login-page .ftp-app {
  margin-left:0 !important; width:100% !important; max-width:100% !important;
  display:flex !important; align-items:center !important;
  justify-content:center !important; min-height:100vh !important;
}
body.ftp-page .ast-container, body.ftp-page .container,
body.ftp-page .entry-content > *, body.ftp-page .site-main {
  max-width:100% !important; padding-left:0 !important; padding-right:0 !important;
}

/* ============================================================
   MOBILE TOPBAR (inside @media so it only renders on small)
   ============================================================ */
@media (max-width:767px) {
  .ftp-topbar {
    display: block;
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--ftp-topbar-h);
    background: var(--ftp-surface);
    border-bottom: 1px solid var(--ftp-border);
    z-index: 300;
    box-shadow: 0 2px 20px rgba(0,0,0,.30);
  }
  .ftp-topbar-inner {
    display: flex; align-items: center;
    height: 100%; padding: 0 16px; gap: 12px;
  }
  .ftp-topbar-toggle {
    width: 40px; height: 40px; border-radius: 9px;
    background: var(--ftp-surface2); border: 1px solid var(--ftp-border);
    cursor: pointer; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 5px;
    flex-shrink: 0; touch-action: manipulation;
  }
  .ftp-topbar-toggle span {
    display: block; width: 18px; height: 2px;
    background: var(--ftp-text); border-radius: 2px; transition: all .2s;
  }
  .ftp-topbar-brand {
    flex: 1; display: flex; align-items: center; gap: 8px;
    text-decoration: none;
    font-family: var(--ftp-disp);
    font-size: 16px; font-weight: 700; color: var(--ftp-text);
  }
  .ftp-topbar-logout { color: var(--ftp-muted); display: flex; align-items: center; }

  /* Mobile grid overrides */
  .ftp-stat-grid { grid-template-columns: repeat(2,1fr); gap: 8px; }
  .ftp-dash-stat-grid { grid-template-columns: repeat(2,1fr); gap: 8px; }
  .ftp-page-header { flex-direction:column; align-items:flex-start; gap:8px; margin-bottom:14px; }
  .ftp-page-actions { width:100%; display:flex; flex-wrap:wrap; gap:6px; }
  .ftp-page-actions .ftp-btn { font-size:13px !important; padding:8px 12px !important; min-height:40px !important; }
  /* ftp-filter-row is CSS grid — no flex overrides needed; grid-template-columns:1fr (base) handles mobile */
  .ftp-form-footer { flex-direction:column-reverse; }
  .ftp-form-footer .ftp-btn { width:100%; justify-content:center; min-height:50px; }
  .ftp-grid-4 { grid-template-columns:1fr 1fr; }
  .ftp-rule-row { flex-wrap:wrap; gap:8px; padding:10px; }
  .ftp-goals-grid { grid-template-columns:1fr !important; }
  .ftp-modal-overlay { padding:0; align-items:flex-end; }
  .ftp-modal-box { max-height:93vh; border-radius:20px 20px 0 0; width:100% !important; margin:0; }
  .ftp-card { padding:14px; }
  .ftp-stat-card { padding:13px 12px; }
  .ftp-stat-value { font-size:18px !important; }
  .ftp-stat-label { font-size:9px; }
  #income-bulk-bar,#expenses-bulk-bar { flex-wrap:wrap; }
  #rpt-sum { grid-template-columns:repeat(2,1fr) !important; }
  /* ftp-dash-filter-inner is CSS grid — 1-col at narrow widths */
  .ftp-dash-filter-inner { grid-template-columns: 1fr; }
}

/* ── 600px breakpoint ── */
@media (max-width:600px) {
  .ftp-grid-2,.ftp-grid-3 { grid-template-columns:1fr !important; }
  .ftp-table-wrap { overflow-x:unset; }
  .ftp-table.ftp-responsive { display:block; min-width:unset; }
  .ftp-table.ftp-responsive thead { display:none; }
  .ftp-table.ftp-responsive tbody { display:block; }
  .ftp-table.ftp-responsive tr {
    display:block; background:var(--ftp-surface);
    border:1px solid var(--ftp-border); border-radius:var(--ftp-r);
    margin-bottom:10px; padding:12px 14px; transition:border-color 0.14s;
  }
  .ftp-table.ftp-responsive tr:hover { border-color:var(--ftp-border2); background:var(--ftp-surface); }
  .ftp-table.ftp-responsive td {
    display:flex; justify-content:space-between; align-items:center;
    padding:6px 0; border-bottom:1px solid rgba(255,255,255,0.03); font-size:13px;
  }
  .ftp-table.ftp-responsive td:last-child { border-bottom:none; padding-top:10px; }
  .ftp-table.ftp-responsive td::before {
    content:attr(data-label); font-size:10px; font-weight:700;
    letter-spacing:1.2px; color:var(--ftp-muted); text-transform:uppercase;
    font-family:var(--ftp-mono); flex-shrink:0; margin-right:10px;
  }
  .ftp-table.ftp-responsive td.ftp-td-actions { justify-content:flex-end; gap:8px; flex-wrap:wrap; }
  .ftp-table.ftp-responsive td.ftp-td-actions::before { display:none; }
  .ftp-table.ftp-responsive .ftp-loading-row td { justify-content:center; }
  .ftp-table.ftp-responsive .ftp-loading-row td::before { display:none; }
  .ftp-empty { padding:32px 16px; }
  .ftp-empty-icon { font-size:36px; }
}

/* ── 480px ── */
@media (max-width:480px) {
  .ftp-grid-4 { grid-template-columns:1fr 1fr; gap:8px; }
  .ftp-stat-card { padding:12px 10px; }
  .ftp-stat-value { font-size:16px !important; }
  .ftp-card { padding:12px 10px; border-radius:10px; }
  .ftp-tag { font-size:10px; padding:2px 6px; }
  .ftp-recent-icon { width:32px; height:32px; font-size:13px; border-radius:8px; }
}

/* ── Admin mobile ── */
@media (max-width:767px) {
  .ftp-admin-sidebar {
    transform:translateX(-100%); transition:transform 0.3s; width:260px;
  }
  .ftp-admin-sidebar.ftp-open { transform:translateX(0); display:flex; }
  .ftp-admin-content { margin-left:0 !important; padding:12px; }
  .ftp-admin-mobile-toggle {
    display:flex !important; align-items:center; justify-content:center;
    width:40px; height:40px; border-radius:10px;
    background:var(--ftp-surface2); border:1px solid var(--ftp-border);
    color:var(--ftp-text); cursor:pointer; font-size:18px;
    margin-right:10px; flex-shrink:0;
  }
}
@media (min-width:768px) { .ftp-admin-mobile-toggle { display:none !important; } }

/* ============================================================
   ACCESSIBILITY & PRINT
   ============================================================ */
:focus-visible { outline:2px solid var(--ftp-accent); outline-offset:2px; }

@media print {
  .ftp-sidebar,.ftp-topbar,.ftp-bottom-nav,.ftp-bottom-sheet,
  .ftp-drawer,.ftp-drawer-overlay,
  .ftp-page-header .ftp-page-actions,.ftp-sheet-backdrop { display:none !important; }
  .ftp-app { margin-left:0 !important; }
  .ftp-page-wrap { padding:0 !important; }
  .ftp-card { box-shadow:none !important; border:1px solid #ddd !important; }
}

/* Global scrollbar */
::-webkit-scrollbar { width:5px; height:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--ftp-border2); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:var(--ftp-muted); }

/* ============================================================
   v3.8.0 QA FIXES — classes used in templates, added here
   ============================================================ */

/* ftp-mb-10: spacing utility used in dashboard */
.ftp-mb-10 { margin-bottom: 10px; }

/* ftp-drawer-title: drawer brand title span in mobile nav */
.ftp-drawer-title {
  font-family: var(--ftp-disp);
  font-weight: 700;
  font-size: 16px;
  color: var(--ftp-text);
}

/* ftp-dashboard: used as a dynamic class on body / sidebar links */
/* (Already handled via .ftp-sidebar-dashboard — this ensures any
   standalone usage is also safe) */
.ftp-dashboard { display: block; }
