/* ============================================================
   Beez Санхүү — Main Stylesheet
   Design: clean white by default (theme "light" = Цагаан), with soft
   pastel KPI tints and plum accents. Selectable themes: light (white,
   default), pastel (warm blush — the previous default), dark, calm,
   ocean. Colours live in the tokens below — components only reference
   tokens, so every theme stays in sync. (Dark = warm aubergine.)
   ============================================================ */

/* ── Tokens: dark (warm aubergine) ───────────────────────────── */
:root {
  --bf-bg:           #221a26;
  --bf-bg-grad:      #261c29;
  --bf-surface:      #302536;
  --bf-surface2:     #3a2d40;
  --bf-border:       #4d3c53;
  --bf-track:        #5a4760;
  --bf-text:         #f8ebe6;
  --bf-text-muted:   #bfa9b8;

  /* accent = lavender */
  --bf-accent:       #c9b8ec;
  --bf-accent-soft:  rgba(201,184,236,.18);
  --bf-accent-line:  rgba(201,184,236,.5);

  /* semantic: ink (text-safe) · soft (badge/icon fill) · fill (charts, dots) */
  --bf-income:       #8fd4b2;  --bf-income-soft:  rgba(143,212,178,.16);  --bf-income-fill:  #8fd4b2;
  --bf-expense:      #f2a1b3;  --bf-expense-soft: rgba(242,161,179,.16);  --bf-expense-fill: #f2a0b3;
  --bf-profit:       #9fcbe8;  --bf-profit-soft:  rgba(159,203,232,.16);  --bf-profit-fill:  #8fc3e3;
  --bf-cash:         #c4b4ec;  --bf-cash-soft:    rgba(196,180,236,.18);  --bf-cash-fill:    #b7a6e6;
  --bf-amber:        #f5c298;  --bf-amber-soft:   rgba(245,194,152,.16);  --bf-amber-fill:   #f6b28f;

  /* KPI tiles: pastel wash + a deeper bar on top (echoes the reference's section headers) */
  --bf-kpi-income:   rgba(143,212,178,0.17);  --bf-kpi-income-bar:  #8fd4b2;
  --bf-kpi-expense:  rgba(242,161,179,0.17);  --bf-kpi-expense-bar: #f2a0b3;
  --bf-kpi-profit:   rgba(159,203,232,0.17);  --bf-kpi-profit-bar:  #8fc3e3;
  --bf-kpi-cash:     rgba(196,180,236,0.18);  --bf-kpi-cash-bar:    #b7a6e6;

  /* header */
  --bf-hdr-bg:       #4e395c;
  --bf-hdr-fg:       #fff5f0;
  --bf-hdr-dim:      rgba(255,245,240,.72);
  --bf-hdr-hover:    rgba(255,255,255,.12);
  --bf-hdr-active:   rgba(255,255,255,.2);
  --bf-hdr-btn:      rgba(255,255,255,.14);
  --bf-hdr-btn-hover:rgba(255,255,255,.26);
  --bf-hdr-shadow:   0 2px 20px rgba(0,0,0,.4);

  /* misc */
  --bf-grid:         rgba(255,255,255,.07);
  --bf-overlay:      rgba(12,7,14,.62);
  --bf-shadow:       0 4px 24px rgba(0,0,0,.35);
  --bf-shadow-lg:    0 20px 60px rgba(0,0,0,.5);
  --bf-shadow-up:    0 -4px 20px rgba(0,0,0,.3);
  --bf-toast-bg:     #4d3c53;
  --bf-toast-fg:     #fff5f0;

  /* primary button — same soft lavender→pink in both modes, dark plum text */
  --bf-primary:      #d9b5dc;
  --bf-primary-fg:   #33253a;
  --bf-primary-glow: 0 6px 18px rgba(201,184,236,.35);
  --bf-danger-solid: #c24a66;

  --bf-radius:       14px;
  --bf-radius-sm:    10px;
  --bf-header-h:     68px;
  --bf-font:         'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Tokens: light (default) — clean white ───────────────────── */
.beez-fin-root.bf-light {
  --bf-bg:           #ffffff;
  --bf-bg-grad:      #ffffff;
  --bf-surface:      #ffffff;
  --bf-surface2:     #f8f8fb;
  --bf-border:       #e8e8f0;
  --bf-track:        #dcdce6;
  --bf-text:         #17171f;
  --bf-text-muted:   #6a6a78;

  --bf-accent:       #58439e;
  --bf-accent-soft:  #efebf9;
  --bf-accent-line:  #c9b8ec;

  --bf-income:       #22694a;  --bf-income-soft:  #dff3e8;
  --bf-expense:      #a63a54;  --bf-expense-soft: #fbe3e8;
  --bf-profit:       #256187;  --bf-profit-soft:  #ddedf7;
  --bf-cash:         #58439e;  --bf-cash-soft:    #ebe5f6;
  --bf-amber:        #8f4f18;  --bf-amber-soft:   #fce8d6;

  /* KPI tiles keep a light pastel wash so the four numbers still read at a glance */
  --bf-kpi-income:   #e6f5ed;  --bf-kpi-income-bar:  #9fd3b9;
  --bf-kpi-expense:  #fce8ec;  --bf-kpi-expense-bar: #e9a9b8;
  --bf-kpi-profit:   #e6f1f8;  --bf-kpi-profit-bar:  #a7cfe6;
  --bf-kpi-cash:     #eee9f7;  --bf-kpi-cash-bar:    #c0b3e0;

  --bf-hdr-bg:       #ffffff;
  --bf-hdr-fg:       #17171f;
  --bf-hdr-dim:      #6a6a78;
  --bf-hdr-hover:    rgba(23,23,31,.05);
  --bf-hdr-active:   #efebf9;
  --bf-hdr-btn:      #f3f3f7;
  --bf-hdr-btn-hover:#e8e8f0;
  --bf-hdr-shadow:   0 1px 0 #ececf3, 0 6px 22px rgba(20,20,40,.06);

  --bf-grid:         rgba(20,20,40,.08);
  --bf-overlay:      rgba(23,23,31,.40);
  --bf-shadow:       0 2px 14px rgba(20,20,40,.07);
  --bf-shadow-lg:    0 20px 60px rgba(20,20,40,.18);
  --bf-shadow-up:    0 -4px 20px rgba(20,20,40,.08);
  --bf-toast-bg:     #17171f;
  --bf-toast-fg:     #ffffff;
  --bf-primary-glow: 0 6px 18px rgba(88,67,158,.22);
}

/* ── Theme: Pastel (warm blush) — the previous default ───────── */
.beez-fin-root.bf-theme-pastel {
  --bf-bg:           #f7e5e0;
  --bf-bg-grad:      #f8e7e3;
  --bf-surface:      #ffffff;
  --bf-surface2:     #fdf7f4;
  --bf-border:       #f0dfd9;
  --bf-track:        #dccbd0;
  --bf-text:         #3b2f3a;
  --bf-text-muted:   #6c5c68;

  --bf-accent:       #58439e;
  --bf-accent-soft:  #e9e1f7;
  --bf-accent-line:  #c9b8ec;

  --bf-income:       #22694a;  --bf-income-soft:  #d6eee2;
  --bf-expense:      #a63a54;  --bf-expense-soft: #f9dbe1;
  --bf-profit:       #256187;  --bf-profit-soft:  #d6e9f4;
  --bf-cash:         #58439e;  --bf-cash-soft:    #e3dbf3;
  --bf-amber:        #8f4f18;  --bf-amber-soft:   #fbe3cf;

  --bf-kpi-income:   #dbf0e5;  --bf-kpi-income-bar:  #9fd3b9;
  --bf-kpi-expense:  #fadee4;  --bf-kpi-expense-bar: #e9a9b8;
  --bf-kpi-profit:   #dcecf6;  --bf-kpi-profit-bar:  #a7cfe6;
  --bf-kpi-cash:     #e5def2;  --bf-kpi-cash-bar:    #c0b3e0;

  --bf-hdr-bg:       #efd3d6;
  --bf-hdr-fg:       #3b2f3a;
  --bf-hdr-dim:      #5e4d5b;
  --bf-hdr-hover:    rgba(255,255,255,.45);
  --bf-hdr-active:   rgba(255,255,255,.78);
  --bf-hdr-btn:      rgba(255,255,255,.55);
  --bf-hdr-btn-hover:rgba(255,255,255,.88);
  --bf-hdr-shadow:   0 2px 18px rgba(214,150,150,.28);

  --bf-grid:         rgba(150,110,120,.14);
  --bf-overlay:      rgba(59,47,58,.35);
  --bf-shadow:       0 4px 20px rgba(205,140,140,.14);
  --bf-shadow-lg:    0 20px 60px rgba(120,70,90,.25);
  --bf-shadow-up:    0 -4px 20px rgba(205,140,140,.18);
  --bf-toast-bg:     #3b2f3a;
  --bf-toast-fg:     #fff5f0;
  --bf-primary-glow: 0 6px 18px rgba(201,184,236,.55);
}

/* ── Theme: Calm / Natural (sage green + warm sand) ─────────── */
.beez-fin-root.bf-theme-calm {
  --bf-bg:           #eef2eb;
  --bf-bg-grad:      #ecf0e8;
  --bf-surface:      #ffffff;
  --bf-surface2:     #f4f6f1;
  --bf-border:       #d8e0d0;
  --bf-track:        #c4cebc;
  --bf-text:         #2e3829;
  --bf-text-muted:   #5a6b52;

  --bf-accent:       #5a7a4a;
  --bf-accent-soft:  #ddebd4;
  --bf-accent-line:  #a8c490;

  --bf-income:       #2d6e3e;  --bf-income-soft:  #d2ebda;
  --bf-expense:      #8b3a2e;  --bf-expense-soft: #f5d8d4;
  --bf-profit:       #3a6080;  --bf-profit-soft:  #d0e4ef;
  --bf-cash:         #6a5a3e;  --bf-cash-soft:    #e6dece;
  --bf-amber:        #7a4f1a;  --bf-amber-soft:   #f5e0c4;

  --bf-kpi-income:   #cce8d4;  --bf-kpi-income-bar:  #8ec4a0;
  --bf-kpi-expense:  #f0d2ce;  --bf-kpi-expense-bar: #d4998e;
  --bf-kpi-profit:   #c8e0ee;  --bf-kpi-profit-bar:  #8dbdd8;
  --bf-kpi-cash:     #e0d6c4;  --bf-kpi-cash-bar:    #b8a888;

  --bf-hdr-bg:       #b8cba9;
  --bf-hdr-fg:       #2e3829;
  --bf-hdr-dim:      #4a5a42;
  --bf-hdr-hover:    rgba(255,255,255,.45);
  --bf-hdr-active:   rgba(255,255,255,.78);
  --bf-hdr-btn:      rgba(255,255,255,.50);
  --bf-hdr-btn-hover:rgba(255,255,255,.85);
  --bf-hdr-shadow:   0 2px 18px rgba(100,130,80,.25);

  --bf-grid:         rgba(80,110,60,.12);
  --bf-overlay:      rgba(46,56,41,.35);
  --bf-shadow:       0 4px 20px rgba(100,130,80,.14);
  --bf-shadow-lg:    0 20px 60px rgba(60,90,40,.20);
  --bf-shadow-up:    0 -4px 20px rgba(100,130,80,.16);
  --bf-toast-bg:     #2e3829;
  --bf-toast-fg:     #f0f4ee;
  --bf-primary:      #a3cca4;
  --bf-primary-fg:   #1e2e18;
  --bf-primary-glow: 0 6px 18px rgba(100,160,80,.30);
}

/* ── Theme: Ocean / Fresh (teal + sky + coral) ───────────────── */
.beez-fin-root.bf-theme-ocean {
  --bf-bg:           #e8f4f8;
  --bf-bg-grad:      #e4f2f8;
  --bf-surface:      #ffffff;
  --bf-surface2:     #f2f9fc;
  --bf-border:       #cce4ef;
  --bf-track:        #b0d4e4;
  --bf-text:         #1a3040;
  --bf-text-muted:   #4a6878;

  --bf-accent:       #1a7a9a;
  --bf-accent-soft:  #cce9f4;
  --bf-accent-line:  #7ac4dc;

  --bf-income:       #1a6e5a;  --bf-income-soft:  #c8e8e0;
  --bf-expense:      #c84060;  --bf-expense-soft: #fad4dc;
  --bf-profit:       #1a5a8a;  --bf-profit-soft:  #c8dff0;
  --bf-cash:         #6a3a8a;  --bf-cash-soft:    #e0d0f0;
  --bf-amber:        #b06020;  --bf-amber-soft:   #fce0c0;

  --bf-kpi-income:   #bbe2dd;  --bf-kpi-income-bar:  #7ec8bc;
  --bf-kpi-expense:  #f7c9d6;  --bf-kpi-expense-bar: #e890a8;
  --bf-kpi-profit:   #c2daf0;  --bf-kpi-profit-bar:  #88b8e0;
  --bf-kpi-cash:     #d4c7f0;  --bf-kpi-cash-bar:    #a898d8;

  --bf-hdr-bg:       #1c7ba3;
  --bf-hdr-fg:       #f0faff;
  --bf-hdr-dim:      rgba(220,245,255,.80);
  --bf-hdr-hover:    rgba(255,255,255,.18);
  --bf-hdr-active:   rgba(255,255,255,.32);
  --bf-hdr-btn:      rgba(255,255,255,.20);
  --bf-hdr-btn-hover:rgba(255,255,255,.38);
  --bf-hdr-shadow:   0 2px 18px rgba(20,80,120,.35);

  --bf-grid:         rgba(20,80,120,.10);
  --bf-overlay:      rgba(20,50,80,.35);
  --bf-shadow:       0 4px 20px rgba(20,80,120,.14);
  --bf-shadow-lg:    0 20px 60px rgba(20,80,120,.22);
  --bf-shadow-up:    0 -4px 20px rgba(20,80,120,.16);
  --bf-toast-bg:     #1a3040;
  --bf-toast-fg:     #f0faff;
  --bf-primary:      #62c8e6;
  --bf-primary-fg:   #0a2030;
  --bf-primary-glow: 0 6px 18px rgba(30,140,180,.35);
}

/* ── Theme: Hot Pink (vibrant magenta-rose — inspired by mobile bookkeeping apps) ── */
.beez-fin-root.bf-theme-hotpink {
  --bf-bg:           #fde8f0;
  --bf-bg-grad:      #fce4ed;
  --bf-surface:      #ffffff;
  --bf-surface2:     #fff0f5;
  --bf-border:       #f7c8d8;
  --bf-track:        #f0aac4;
  --bf-text:         #2d0c1a;
  --bf-text-muted:   #8a3a58;

  --bf-accent:       #e8215a;
  --bf-accent-soft:  #fde0e9;
  --bf-accent-line:  #f598b8;

  --bf-income:       #1a6e45;  --bf-income-soft:  #ccf0dc;  --bf-income-fill:  #2ecc71;
  --bf-expense:      #e8215a;  --bf-expense-soft: #fde0e9;  --bf-expense-fill: #e8215a;
  --bf-profit:       #9b59b6;  --bf-profit-soft:  #eddff5;  --bf-profit-fill:  #9b59b6;
  --bf-cash:         #e8215a;  --bf-cash-soft:    #fde0e9;  --bf-cash-fill:    #e8215a;
  --bf-amber:        #c0392b;  --bf-amber-soft:   #fce8e8;  --bf-amber-fill:   #e74c3c;

  --bf-kpi-income:   #ccf0dc;  --bf-kpi-income-bar:  #2ecc71;
  --bf-kpi-expense:  #fde0e9;  --bf-kpi-expense-bar: #e8215a;
  --bf-kpi-profit:   #eddff5;  --bf-kpi-profit-bar:  #9b59b6;
  --bf-kpi-cash:     #fde0e9;  --bf-kpi-cash-bar:    #e8215a;

  /* Header: vivid hot-pink gradient */
  --bf-hdr-bg:       #e8215a;
  --bf-hdr-fg:       #ffffff;
  --bf-hdr-dim:      rgba(255,255,255,.82);
  --bf-hdr-hover:    rgba(255,255,255,.18);
  --bf-hdr-active:   rgba(255,255,255,.32);
  --bf-hdr-btn:      rgba(255,255,255,.22);
  --bf-hdr-btn-hover:rgba(255,255,255,.40);
  --bf-hdr-shadow:   0 2px 20px rgba(232,33,90,.45);

  --bf-grid:         rgba(200,40,100,.10);
  --bf-overlay:      rgba(45,12,26,.38);
  --bf-shadow:       0 4px 20px rgba(232,33,90,.14);
  --bf-shadow-lg:    0 20px 60px rgba(232,33,90,.22);
  --bf-shadow-up:    0 -4px 20px rgba(232,33,90,.16);
  --bf-toast-bg:     #2d0c1a;
  --bf-toast-fg:     #ffe8f0;

  /* Primary button: hot pink with white text */
  --bf-primary:      #e8215a;
  --bf-primary-fg:   #ffffff;
  --bf-primary-glow: 0 6px 18px rgba(232,33,90,.40);
  --bf-danger-solid: #b01040;

  --bf-radius:       14px;
  --bf-radius-sm:    10px;
}

/* ── Reset ───────────────────────────────────────────────────── */
/* :where() keeps specificity at 0 — a plain `#beez-fin-root *` (1,0,0) was
   overriding every class rule's padding/margin (cards, header, nav, etc.) */
:where(#beez-fin-root, #beez-fin-root *, #beez-fin-root *::before, #beez-fin-root *::after) {
  box-sizing: border-box; margin: 0; padding: 0;
}

#beez-fin-root {
  font-family: var(--bf-font);
  background: var(--bf-bg);
  background-image: var(--bf-bg-grad);
  color: var(--bf-text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

#beez-fin-root :is(button, a, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--bf-accent); outline-offset: 2px;
}

/* ── Header ─────────────────────────────────────────────────── */
.bf-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bf-hdr-bg);
  color: var(--bf-hdr-fg);
  height: var(--bf-header-h);
  box-shadow: var(--bf-hdr-shadow);
}
.bf-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 24px;
}
.bf-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.bf-logo-icon {
  width: 40px; height: 40px;
  background: #fcd69c;
  box-shadow: 0 3px 10px rgba(226,160,90,.35);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
/* Uploaded company logo replaces the default bee tile */
.bf-logo-icon.has-logo { background: transparent; box-shadow: none; overflow: hidden; }
.bf-logo-icon img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: inherit; }
.bf-logo-text { display: flex; flex-direction: column; }
.bf-logo-name { font-size: 16px; font-weight: 700; color: var(--bf-hdr-fg); }
.bf-logo-sub  { font-size: 11px; color: var(--bf-hdr-dim); }

/* Nav */
.bf-nav { display: flex; gap: 4px; flex: 1; }
.bf-nav-item {
  background: none; border: none; cursor: pointer;
  color: var(--bf-hdr-dim);
  padding: 8px 16px;
  border-radius: var(--bf-radius-sm);
  font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.bf-nav-item:hover { background: var(--bf-hdr-hover); color: var(--bf-hdr-fg); }
.bf-nav-item.active { background: var(--bf-hdr-active); color: var(--bf-hdr-fg); font-weight: 600; }

.bf-header-actions { display: flex; align-items: center; gap: 10px; }
.bf-icon-btn {
  background: var(--bf-hdr-btn);
  border: none; cursor: pointer; color: var(--bf-hdr-fg);
  width: 36px; height: 36px; border-radius: 8px;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.bf-icon-btn:hover { background: var(--bf-hdr-btn-hover); }

/* Package expiry chip: right end of the dashboard filter row. Phones show the hero banner's pill instead. */
.bf-sub {
  margin-left: auto; display: flex; align-items: center; gap: 9px;
  padding: 6px 14px 6px 12px; border-radius: var(--bf-radius-sm);
  background: var(--bf-surface); border: 1px solid var(--bf-border); color: var(--bf-text);
  line-height: 1.25; white-space: nowrap; cursor: pointer;
  transition: opacity .15s;
}
.bf-sub:hover { opacity: .8; }

/* ── Upgrade modal ─────────────────────────────────────────── */
.bf-upgrade-box { max-width: 540px; }
.bf-upgrade-sub { margin: 0 0 16px; font-size: 13px; color: var(--bf-text-muted); }
.bf-upgrade-loading { text-align: center; padding: 32px 0; color: var(--bf-text-muted); font-size: 14px; }
.bf-upgrade-packages { display: flex; flex-direction: column; gap: 10px; }
.bf-pkg-card {
  border: 2px solid var(--bf-border); border-radius: var(--bf-radius-sm);
  padding: 14px 16px; cursor: pointer; position: relative;
  background: var(--bf-surface); transition: border-color .15s, background .15s;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.bf-pkg-card:hover { border-color: var(--bf-primary); background: var(--bf-primary-soft, #f5f0ff); }
.bf-pkg-card.selected { border-color: var(--bf-primary); background: var(--bf-primary-soft, #f5f0ff); }
.bf-pkg-card.selected::after {
  content: '✓'; position: absolute; top: 10px; right: 12px;
  color: var(--bf-primary); font-weight: 700; font-size: 15px;
}
.bf-pkg-left { display: flex; flex-direction: column; gap: 3px; }
.bf-pkg-name { font-size: 15px; font-weight: 700; color: var(--bf-text); }
.bf-pkg-duration { font-size: 12px; color: var(--bf-text-muted); }
.bf-pkg-badge {
  display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 20px; background: var(--bf-primary); color: #fff;
  margin-left: 8px; vertical-align: middle; text-transform: uppercase;
}
.bf-pkg-right { text-align: right; flex-shrink: 0; }
.bf-pkg-price { font-size: 20px; font-weight: 700; color: var(--bf-text); }
.bf-pkg-per { font-size: 11px; color: var(--bf-text-muted); }
.bf-pkg-compare { font-size: 12px; color: var(--bf-text-muted); text-decoration: line-through; }
.bf-sub-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--bf-text-muted); }
.bf-sub-active  .bf-sub-dot { background: var(--bf-income-fill); }
.bf-sub-soon    .bf-sub-dot { background: var(--bf-amber-fill); }
.bf-sub-expired .bf-sub-dot { background: var(--bf-expense-fill); }
.bf-sub-soon    { background: var(--bf-amber-soft);   border-color: var(--bf-amber-fill); }
.bf-sub-expired { background: var(--bf-expense-soft); border-color: var(--bf-expense-fill); }
.bf-sub-txt { display: flex; flex-direction: column; min-width: 0; }
.bf-sub-txt b { font-size: 13px; font-weight: 700; }
.bf-sub-txt small { font-size: 11px; color: var(--bf-text-muted); overflow: hidden; text-overflow: ellipsis; max-width: 240px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.bf-btn-primary {
  background: var(--bf-primary);
  color: var(--bf-primary-fg); border: none; cursor: pointer;
  padding: 9px 18px; border-radius: var(--bf-radius-sm);
  font-size: 13px; font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--bf-primary-glow);
  transition: filter .15s, transform .15s;
}
.bf-btn-primary:hover { filter: brightness(1.04) saturate(1.05); transform: translateY(-1px); }
.bf-btn-ghost {
  background: transparent;
  border: 1px solid var(--bf-border);
  color: var(--bf-text);
  cursor: pointer; padding: 9px 18px; border-radius: var(--bf-radius-sm);
  font-size: 13px; font-weight: 500;
  transition: background .15s;
}
.bf-btn-ghost:hover { background: var(--bf-surface2); }
.bf-btn-ghost:disabled { opacity: .45; cursor: not-allowed; }
.bf-btn-ghost:disabled:hover { background: transparent; }
.bf-btn-danger {
  background: var(--bf-danger-solid); color: #fff; border: none; cursor: pointer;
  padding: 9px 18px; border-radius: var(--bf-radius-sm);
  font-size: 13px; font-weight: 600; transition: filter .15s;
}
.bf-btn-danger:hover { filter: brightness(1.08); }
.bf-btn-sm {
  background: var(--bf-primary); color: var(--bf-primary-fg); border: none; cursor: pointer;
  padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 600;
}
.bf-link-btn {
  background: none; border: none; cursor: pointer;
  color: var(--bf-accent); font-size: 13px;
  padding: 0; text-decoration: none;
}
.bf-link-btn:hover { text-decoration: underline; }

/* ── Logo upload ─────────────────────────────────────────────── */
.bf-logo-upload { display: flex; align-items: center; gap: 16px; }
.bf-logo-preview {
  width: 64px; height: 64px; border-radius: var(--bf-radius-sm);
  background: var(--bf-surface2); border: 1px solid var(--bf-border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex: 0 0 auto; font-size: 26px;
}
.bf-logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.bf-logo-upload-actions { display: flex; flex-direction: column; align-items: flex-start; }

/* ── Forms ───────────────────────────────────────────────────── */
.bf-input, .bf-select {
  background: var(--bf-surface2);
  border: 1px solid var(--bf-border);
  color: var(--bf-text);
  border-radius: var(--bf-radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.bf-input:focus, .bf-select:focus { border-color: var(--bf-accent-line); box-shadow: 0 0 0 3px var(--bf-accent-soft); }
.bf-select { appearance: none; cursor: pointer; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a08b98' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.bf-form-group { display: flex; flex-direction: column; gap: 5px; }
.bf-form-group label { font-size: 12px; color: var(--bf-text-muted); font-weight: 500; }
.bf-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bf-req { color: var(--bf-expense); }
.bf-section-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }

/* ── Pages ───────────────────────────────────────────────────── */
.bf-page {
  display: none;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}
.bf-page.active { display: block; }

.bf-page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.bf-page-title { font-size: 20px; font-weight: 700; }
.bf-page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Filters ─────────────────────────────────────────────────── */
.bf-filters {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.bf-filter-group { display: flex; align-items: center; gap: 8px; }
.bf-period-label {
  font-size: 12px; color: var(--bf-text-muted);
  background: var(--bf-surface);
  border: 1px solid var(--bf-border);
  padding: 7px 12px; border-radius: var(--bf-radius-sm);
}

/* ── KPI Cards ───────────────────────────────────────────────── */
.bf-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}
.bf-kpi-card {
  padding: 20px 22px;
  border-radius: var(--bf-radius);
  color: var(--bf-text);
  box-shadow: var(--bf-shadow);
}
.bf-kpi-income  { background: var(--bf-kpi-income);  border-top: 4px solid var(--bf-kpi-income-bar); }
.bf-kpi-expense { background: var(--bf-kpi-expense); border-top: 4px solid var(--bf-kpi-expense-bar); }
.bf-kpi-profit  { background: var(--bf-kpi-profit);  border-top: 4px solid var(--bf-kpi-profit-bar); }
.bf-kpi-cash    { background: var(--bf-kpi-cash);    border-top: 4px solid var(--bf-kpi-cash-bar); }
.bf-kpi-label   { font-size: 13px; font-weight: 500; color: var(--bf-text-muted); margin-bottom: 6px; }
.bf-kpi-value   { font-size: 26px; font-weight: 800; margin-bottom: 6px; letter-spacing: -.5px; }
.bf-kpi-delta   { font-size: 12px; color: var(--bf-text-muted); font-weight: 600; }
.bf-kpi-delta.up   { color: var(--bf-income); }
.bf-kpi-delta.down { color: var(--bf-expense); }
.bf-footnote { font-size: 11px; color: var(--bf-text-muted); margin-bottom: 20px; }

/* ── Financial metrics grid ──────────────────────────────────── */
.bf-metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.bf-metric-card {
  background: var(--bf-surface);
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius);
  padding: 16px 18px;
  box-shadow: var(--bf-shadow);
}
.bf-metric-label { font-size: 12px; font-weight: 600; color: var(--bf-text-muted); margin-bottom: 8px; }
.bf-metric-value { font-size: 20px; font-weight: 800; letter-spacing: -.3px; margin-bottom: 4px; }
.bf-metric-value.good { color: var(--bf-income); }
.bf-metric-value.bad  { color: var(--bf-expense); }
.bf-metric-value.warn { color: var(--bf-amber); }
.bf-metric-sub { font-size: 11px; color: var(--bf-text-muted); }

/* ── Dashboard grid: main content + advisor side panel ──────────── */
.bf-dash-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}
.bf-dash-side { position: sticky; top: calc(var(--bf-header-h) + 16px); }

.bf-insights-list { display: flex; flex-direction: column; gap: 10px; }
.bf-insight-item {
  border-left: 3px solid var(--bf-border);
  background: var(--bf-surface2);
  border-radius: 0 var(--bf-radius-sm) var(--bf-radius-sm) 0;
  padding: 10px 12px;
}
.bf-insight-item.good { border-left-color: var(--bf-income-fill); }
.bf-insight-item.bad  { border-left-color: var(--bf-expense-fill); }
.bf-insight-item.warn { border-left-color: var(--bf-amber-fill); }
.bf-insight-item.info { border-left-color: var(--bf-profit-fill); }
.bf-insight-q {
  font-size: 12.5px; font-weight: 700; color: var(--bf-text-muted);
  margin-bottom: 4px; display: flex; align-items: center; gap: 6px;
}
.bf-insight-a { font-size: 13px; line-height: 1.5; }
.bf-insight-a strong { font-weight: 700; }

/* ── Cards ───────────────────────────────────────────────────── */
.bf-card {
  background: var(--bf-surface);
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius);
  padding: 20px;
  box-shadow: var(--bf-shadow);
}
.bf-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.bf-card-title { font-size: 14px; font-weight: 600; }
.bf-card-title small { font-weight: 400; color: var(--bf-text-muted); margin-left: 4px; }
.bf-divider { height: 1px; background: var(--bf-border); margin: 14px 0; }

/* ── Charts row ──────────────────────────────────────────────── */
.bf-charts-row {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  margin-bottom: 16px;
}
.bf-chart-main { }
.bf-chart-tabs { display: flex; gap: 4px; }
.bf-tab {
  background: none; border: 1px solid var(--bf-border); color: var(--bf-text-muted);
  cursor: pointer; padding: 5px 12px; border-radius: 6px; font-size: 12px;
  transition: all .15s;
}
.bf-tab.active { background: var(--bf-accent-soft); border-color: var(--bf-accent-line); color: var(--bf-accent); font-weight: 600; }
.bf-chart-wrap canvas { max-height: 220px; }

/* Analysis card */
.bf-analysis-card { }
.bf-analysis-body { display: flex; flex-direction: column; gap: 4px; }
.bf-margin-big { font-size: 36px; font-weight: 800; color: var(--bf-text); }
.bf-margin-label { font-size: 12px; color: var(--bf-text-muted); display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.bf-badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600;
  background: var(--bf-income-soft); color: var(--bf-income);
}
.bf-badge.ok   { background: var(--bf-income-soft);  color: var(--bf-income); }
.bf-badge.warn { background: var(--bf-amber-soft);   color: var(--bf-amber); }
.bf-badge.bad  { background: var(--bf-expense-soft); color: var(--bf-expense); }
.bf-analysis-label { font-size: 11px; color: var(--bf-text-muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; }
.bf-breakdown-bar { height: 8px; border-radius: 4px; overflow: hidden; display: flex; margin: 6px 0; }
.bf-breakdown-legend { display: flex; flex-wrap: wrap; gap: 8px; }
.bf-breakdown-legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--bf-text-muted); }
.bf-breakdown-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.bf-stat-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--bf-text-muted); padding: 3px 0; }
.bf-stat-row strong { color: var(--bf-text); }

/* Donut row */
.bf-donut-card { }
.bf-donut-wrap { display: flex; align-items: center; gap: 20px; }
.bf-donut-wrap canvas { max-width: 180px; max-height: 180px; flex-shrink: 0; }
.bf-donut-legend { display: flex; flex-direction: column; gap: 8px; }
.bf-donut-legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bf-donut-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.bf-donut-empty { font-size: 12px; color: var(--bf-text-muted); }

/* Recent list */
.bf-recent-card { }
.bf-recent-list { display: flex; flex-direction: column; gap: 10px; }
.bf-recent-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--bf-border);
}
.bf-recent-item:last-child { border-bottom: none; }
.bf-recent-left { display: flex; align-items: center; gap: 10px; }
.bf-recent-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.bf-recent-icon.income  { background: var(--bf-income-soft); }
.bf-recent-icon.expense { background: var(--bf-expense-soft); }
.bf-recent-icon.loan    { background: var(--bf-profit-soft); }
.bf-recent-icon.equity  { background: var(--bf-cash-soft); }
.bf-recent-icon.asset   { background: var(--bf-amber-soft); }
.bf-recent-desc { font-size: 13px; font-weight: 500; }
.bf-recent-meta { font-size: 11px; color: var(--bf-text-muted); }
.bf-recent-amount { font-size: 14px; font-weight: 700; }
.bf-recent-amount.income  { color: var(--bf-income); }
.bf-recent-amount.expense { color: var(--bf-expense); }
.bf-recent-amount.loan    { color: var(--bf-profit); }
.bf-recent-amount.equity  { color: var(--bf-cash); }
.bf-recent-amount.asset   { color: var(--bf-amber); }

/* ── Table ───────────────────────────────────────────────────── */
.bf-table-wrap { overflow-x: auto; }
.bf-table { width: 100%; border-collapse: collapse; }
.bf-table th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--bf-text-muted);
  padding: 10px 12px; border-bottom: 1px solid var(--bf-border);
  white-space: nowrap;
}
.bf-table td {
  padding: 11px 12px; border-bottom: 1px solid var(--bf-border);
  font-size: 13px; vertical-align: middle;
}
.bf-table tr:last-child td { border-bottom: none; }
.bf-table tr:hover td { background: var(--bf-surface2); }
.bf-num { text-align: right !important; }
.bf-type-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.bf-type-badge.income  { background: var(--bf-income-soft);  color: var(--bf-income); }
.bf-type-badge.expense { background: var(--bf-expense-soft); color: var(--bf-expense); }
.bf-type-badge.loan    { background: var(--bf-profit-soft);  color: var(--bf-profit); }
.bf-type-badge.equity  { background: var(--bf-cash-soft);    color: var(--bf-cash); }
.bf-type-badge.asset   { background: var(--bf-amber-soft);   color: var(--bf-amber); }

/* Member modal: emoji avatar picker */
.bf-emoji-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.bf-emoji-opt {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--bf-border);
  background: var(--bf-surface2); font-size: 18px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
  transition: border-color .15s, transform .1s;
}
.bf-emoji-opt:hover { transform: translateY(-1px); }
.bf-emoji-opt.active { border-color: var(--bf-accent, var(--bf-cash)); box-shadow: 0 0 0 2px rgba(143,212,178,.25); }
.bf-emoji-opt.bf-emoji-none { font-size: 14px; opacity: .8; }

/* Member cards / recent list / tables: emoji used instead of initials when set */
.bf-member-avatar.has-emoji { font-size: 20px; }

/* Employee income table: small inline percentage bar in the last column */
.bf-emp-income-pct { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.bf-emp-income-bar { flex: 1; height: 6px; border-radius: 4px; background: var(--bf-surface2); overflow: hidden; }
.bf-emp-income-bar i { display: block; height: 100%; background: var(--bf-income-fill); border-radius: 4px; }
.bf-emp-income-pct span { font-size: 12px; color: var(--bf-text-muted); flex: none; width: 34px; text-align: right; }
.bf-table-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0 0; font-size: 12px; color: var(--bf-text-muted);
}
.bf-pagination { display: flex; gap: 4px; }
.bf-page-btn {
  background: var(--bf-surface2); border: 1px solid var(--bf-border);
  color: var(--bf-text); cursor: pointer; width: 28px; height: 28px;
  border-radius: 6px; font-size: 12px; display: flex; align-items: center; justify-content: center;
}
.bf-page-btn.active { background: var(--bf-accent-soft); border-color: var(--bf-accent-line); color: var(--bf-accent); font-weight: 600; }

/* ── Reports ─────────────────────────────────────────────────── */
.bf-report-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.bf-rtab {
  background: var(--bf-surface); border: 1px solid var(--bf-border);
  color: var(--bf-text-muted); cursor: pointer;
  padding: 8px 16px; border-radius: var(--bf-radius-sm);
  font-size: 13px; font-weight: 500; transition: all .15s;
}
.bf-rtab:hover { border-color: var(--bf-accent); color: var(--bf-accent); }
.bf-rtab.active { background: var(--bf-accent-soft); border-color: var(--bf-accent-line); color: var(--bf-accent); font-weight: 600; }

.bf-report-placeholder { text-align: center; padding: 60px 20px; color: var(--bf-text-muted); }
.bf-report-placeholder span { font-size: 48px; display: block; margin-bottom: 12px; }

/* Financial statement tables */
.bf-stmt { width: 100%; }
.bf-stmt-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.bf-stmt-period { font-size: 12px; color: var(--bf-text-muted); margin-bottom: 20px; }
.bf-stmt table { width: 100%; border-collapse: collapse; }
.bf-stmt td { padding: 7px 0; font-size: 13px; border-bottom: 1px solid var(--bf-border); }
.bf-stmt td:last-child { text-align: right; font-weight: 600; }
.bf-stmt .bf-stmt-head td { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--bf-text-muted); padding-top: 16px; }
.bf-stmt .bf-stmt-total td { font-weight: 700; font-size: 14px; border-top: 2px solid var(--bf-border); border-bottom: none; padding: 10px 0; }
.bf-stmt .bf-stmt-net td { font-weight: 800; font-size: 16px; color: var(--bf-income); padding: 12px 0; border: none; }
.bf-stmt .bf-stmt-net.loss td { color: var(--bf-expense); }
.bf-stmt .bf-stmt-sub td { padding-left: 16px; color: var(--bf-text-muted); }
.bf-stmt-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; margin-top: 12px; }
.bf-stmt-check.ok   { color: var(--bf-income); }
.bf-stmt-check.fail { color: var(--bf-expense); }

/* ── Monthly Summary (Сарын тойм) ───────────────────────────── */
.bf-ms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.bf-ms-card {
  background: var(--bf-surface2);
  border: 1px solid var(--bf-border);
  border-radius: 12px;
  overflow: hidden;
}
.bf-ms-card-header {
  padding: 10px 14px;
  background: var(--bf-accent-soft);
  border-bottom: 1px solid var(--bf-border);
}
.bf-ms-month-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--bf-accent);
  letter-spacing: .3px;
}
.bf-ms-table {
  width: 100%;
  border-collapse: collapse;
}
.bf-ms-table td {
  padding: 7px 14px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--bf-border);
  vertical-align: middle;
}
.bf-ms-row-head td {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--bf-text-muted);
  font-weight: 600;
  padding-top: 8px;
  padding-bottom: 6px;
}
.bf-ms-row-divider td {
  border-top: 2px solid var(--bf-border);
  padding-top: 10px;
  padding-bottom: 10px;
}
.bf-ms-val {
  text-align: right;
  font-weight: 600;
}
.bf-ms-val.income  { color: var(--bf-income); }
.bf-ms-val.expense { color: var(--bf-expense); }
.bf-ms-val.savings { color: var(--bf-profit); }
.bf-ms-prev-col {
  text-align: right;
  width: 90px;
  min-width: 80px;
}
.bf-ms-delta {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
}
.bf-ms-delta.up        { color: var(--bf-income);  background: var(--bf-income-soft); }
.bf-ms-delta.down      { color: var(--bf-expense); background: var(--bf-expense-soft); }
.bf-ms-delta.neutral   { color: var(--bf-text-muted); background: transparent; }
.bf-ms-delta.ratio-up  { color: var(--bf-expense); background: var(--bf-expense-soft); }
.bf-ms-delta.ratio-down{ color: var(--bf-income);  background: var(--bf-income-soft); }

/* ── Members grid ────────────────────────────────────────────── */
.bf-members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.bf-member-card {
  background: var(--bf-surface);
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius);
  padding: 20px;
  box-shadow: var(--bf-shadow);
}
.bf-member-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.bf-member-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: #e9d1e2;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #3b2f3a; flex-shrink: 0;
}
.bf-member-info h4 { font-size: 15px; font-weight: 700; }
.bf-member-role { font-size: 12px; color: var(--bf-text-muted); }
.bf-member-status {
  display: inline-block; margin-top: 4px;
  padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
}
.bf-member-status.active { background: var(--bf-income-soft); color: var(--bf-income); }
.bf-member-status.inactive { background: var(--bf-surface2); color: var(--bf-text-muted); }
.bf-member-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.bf-member-stat { text-align: center; }
.bf-member-stat-val { font-size: 14px; font-weight: 700; }
.bf-member-stat-lbl { font-size: 10px; color: var(--bf-text-muted); }
.bf-member-access {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; padding: 8px 0; margin-bottom: 8px; border-top: 1px dashed var(--bf-border);
  color: var(--bf-income); font-weight: 600;
}
.bf-member-access.muted { color: var(--bf-text-muted); font-weight: 400; justify-content: flex-start; }
.bf-member-access .bf-link-btn { font-size: 12px; }
.bf-member-actions { display: flex; gap: 8px; }
.bf-member-edit-btn, .bf-member-del-btn {
  flex: 1; padding: 7px; border-radius: 6px; font-size: 12px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--bf-border); transition: all .15s;
}
.bf-member-edit-btn { background: var(--bf-surface2); color: var(--bf-text); }
.bf-member-edit-btn:hover { border-color: var(--bf-accent); color: var(--bf-accent); }
.bf-member-del-btn { background: var(--bf-expense-soft); color: var(--bf-expense); border-color: transparent; }
.bf-member-del-btn:hover { filter: brightness(.96); }

/* ── Settings ────────────────────────────────────────────────── */
.bf-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.bf-settings-grid .bf-card { display: flex; flex-direction: column; gap: 14px; }
.bf-text-muted { color: var(--bf-text-muted); font-size: 13px; }

/* ── Theme picker ────────────────────────────────────────────── */
.bf-theme-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.bf-theme-swatch {
  position: relative;
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color .18s, box-shadow .18s;
  user-select: none;
}
.bf-theme-swatch:hover { border-color: var(--bf-accent-line); }
.bf-theme-swatch.active {
  border-color: var(--bf-accent);
  box-shadow: 0 0 0 3px var(--bf-accent-soft);
}
.bf-theme-swatch-preview {
  height: 48px;
  display: flex;
  align-items: stretch;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}
.bf-theme-swatch-preview span {
  flex: 1;
  display: block;
}
.bf-theme-swatch-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bf-surface2);
  color: var(--bf-text);
}
.bf-theme-swatch-check {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bf-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: transparent;
  transition: all .15s;
}
.bf-theme-swatch.active .bf-theme-swatch-check {
  background: var(--bf-accent);
  border-color: var(--bf-accent);
  color: #fff;
}

/* Category manager */
.bf-settings-grid .bf-cat-card { grid-column: 1 / -1; }
.bf-cat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.bf-cat-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.bf-cat-col-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600; padding-bottom: 8px;
  border-bottom: 1px solid var(--bf-border);
}
.bf-cat-count {
  font-size: 11px; font-weight: 600; color: var(--bf-text-muted);
  background: var(--bf-surface2); border: 1px solid var(--bf-border);
  border-radius: 10px; padding: 1px 8px;
}
.bf-cat-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.bf-cat-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bf-surface2); border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius-sm); padding: 8px 10px; min-height: 42px;
}
.bf-cat-item.editing { border-color: var(--bf-accent-line); }
.bf-cat-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px var(--bf-surface2); }
.bf-cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bf-cat-uses { font-size: 11px; color: var(--bf-text-muted); white-space: nowrap; }
.bf-cat-actions { display: flex; gap: 2px; opacity: .55; transition: opacity .15s; }
.bf-cat-item:hover .bf-cat-actions, .bf-cat-item:focus-within .bf-cat-actions { opacity: 1; }
.bf-cat-btn {
  background: none; border: none; cursor: pointer; color: var(--bf-text);
  font-size: 14px; line-height: 1; padding: 5px 7px; border-radius: 6px;
}
.bf-cat-btn:hover { background: var(--bf-border); }
.bf-cat-save-edit { color: var(--bf-income); font-weight: 700; }
.bf-cat-cancel-edit { color: var(--bf-text-muted); }
.bf-cat-empty { color: var(--bf-text-muted); font-size: 13px; padding: 10px 2px; }
.bf-cat-add { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.bf-cat-add .bf-input, .bf-cat-item .bf-input { flex: 1; min-width: 0; }
.bf-cat-color-input {
  flex: none; width: 34px; height: 34px; padding: 2px; cursor: pointer;
  background: var(--bf-surface2); border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius-sm);
}
.bf-cat-item .bf-cat-color-input { width: 30px; height: 30px; }
.bf-toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.bf-toggle input { opacity: 0; width: 0; height: 0; }
.bf-toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--bf-track); border-radius: 12px; transition: .2s;
}
.bf-toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
  box-shadow: 0 1px 3px rgba(60,30,50,.3);
}
.bf-toggle input:checked + .bf-toggle-slider { background: var(--bf-primary); }
.bf-toggle input:checked + .bf-toggle-slider::before { transform: translateX(20px); }

/* ── Modal ───────────────────────────────────────────────────── */
.bf-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.bf-modal-backdrop { position: absolute; inset: 0; background: var(--bf-overlay); backdrop-filter: blur(4px); }
.bf-modal-box {
  position: relative; z-index: 1;
  background: var(--bf-surface);
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius);
  width: 520px; max-width: 96vw;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--bf-shadow-lg);
}
.bf-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 0;
}
.bf-modal-header h3 { font-size: 16px; font-weight: 700; }
.bf-modal-close, .bf-member-modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--bf-text-muted); font-size: 16px; padding: 4px;
  transition: color .15s;
}
.bf-modal-close:hover, .bf-member-modal-close:hover { color: var(--bf-text); }
.bf-modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.bf-modal-footer { padding: 0 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }

/* Excel import */
.bf-import-box { width: 780px; }
.bf-import-close { font-family: inherit; }
.bf-imp-drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 34px 20px; cursor: pointer;
  border: 2px dashed var(--bf-border); border-radius: var(--bf-radius);
  background: var(--bf-surface2); transition: border-color .15s, background .15s;
}
.bf-imp-drop:hover, .bf-imp-drop.drag { border-color: var(--bf-accent-line); background: var(--bf-accent-soft); }
.bf-imp-drop-icon { font-size: 30px; }
.bf-imp-drop small { color: var(--bf-text-muted); font-size: 12px; }
.bf-imp-help { margin-top: 14px; font-size: 12.5px; color: var(--bf-text-muted); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.bf-imp-help b { color: var(--bf-text); font-weight: 600; }
.bf-imp-file { font-size: 13px; font-weight: 600; word-break: break-all; }
.bf-imp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bf-imp-chip {
  font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 14px;
  background: var(--bf-surface2); border: 1px solid var(--bf-border);
}
.bf-imp-chip.ok   { color: var(--bf-income);  border-color: transparent; background: var(--bf-income-soft); }
.bf-imp-chip.bad  { color: var(--bf-expense); border-color: transparent; background: var(--bf-expense-soft); }
.bf-imp-chip.warn { color: var(--bf-amber);   border-color: transparent; background: var(--bf-amber-soft); }
.bf-imp-note {
  font-size: 12.5px; padding: 8px 12px; border-radius: var(--bf-radius-sm);
  background: var(--bf-profit-soft); border: 1px solid transparent;
}
.bf-imp-table-wrap { max-height: 300px; overflow: auto; border: 1px solid var(--bf-border); border-radius: var(--bf-radius-sm); }
.bf-imp-table { width: 100%; font-size: 12.5px; }
.bf-imp-table th { position: sticky; top: 0; background: var(--bf-surface); z-index: 1; }
.bf-imp-table td { white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.bf-imp-table tr.err td { background: var(--bf-expense-soft); }
.bf-imp-status { font-weight: 600; }
.bf-imp-status.ok { color: var(--bf-income); }
.bf-imp-status.err { color: var(--bf-expense); white-space: normal; }
.bf-imp-status.warn { color: var(--bf-amber); white-space: normal; }
.bf-imp-more { font-size: 12px; color: var(--bf-text-muted); }
.bf-imp-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--bf-text-muted); cursor: pointer; }
.bf-imp-check input { margin-top: 2px; }
.bf-imp-done { text-align: center; padding: 20px 10px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.bf-imp-done-icon { font-size: 40px; }
.bf-imp-done h4 { font-size: 16px; }
.bf-imp-done ul { list-style: none; color: var(--bf-text-muted); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }

/* Type tabs inside modal */
.bf-type-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.bf-type-tab {
  background: var(--bf-surface2); border: 1px solid var(--bf-border);
  color: var(--bf-text-muted); cursor: pointer;
  padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 500;
  transition: all .15s;
}
.bf-type-tab.active { background: var(--bf-accent-soft); border-color: var(--bf-accent-line); color: var(--bf-accent); font-weight: 600; }

/* ── Toast ───────────────────────────────────────────────────── */
.bf-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 300;
  background: var(--bf-toast-bg); color: var(--bf-toast-fg);
  padding: 12px 20px; border-radius: var(--bf-radius-sm);
  font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 28px rgba(60,30,50,.28);
  border-left: 4px solid var(--bf-accent-line);
  animation: bf-toast-in .2s ease;
}
.bf-toast.error { border-color: var(--bf-expense-fill); }
.bf-toast.success { border-color: var(--bf-income-fill); }
@keyframes bf-toast-in { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform: translateY(0); } }

/* Login notice */
.beez-fin-login-notice { text-align: center; padding: 60px; }
.beez-fin-login-notice .bf-btn-primary { margin-top: 16px; display: inline-block; }

/* ── Full-page canvas (templates/canvas.php) ─────────────────── */
body.beez-fin-canvas { margin: 0; background: #ffffff; }
body.beez-fin-canvas:has(.beez-fin-root:not(.bf-light):not(.bf-theme-pastel):not(.bf-theme-calm):not(.bf-theme-ocean):not(.bf-theme-hotpink)) { background: #221a26; }
body.beez-fin-canvas:has(.beez-fin-root.bf-theme-pastel) { background: #f6e3de; }
body.beez-fin-canvas:has(.beez-fin-root.bf-theme-calm)  { background: #e3e9dd; }
body.beez-fin-canvas:has(.beez-fin-root.bf-theme-ocean) { background: #d8ecf4; }
body.beez-fin-canvas:has(.beez-fin-root.bf-theme-hotpink) { background: #fcd5e5; }
body.beez-fin-canvas .beez-fin-login-notice {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  font-family: var(--bf-font); color: #3b2f3a;
  background: #f8e7e2;
}
body.beez-fin-canvas .beez-fin-login-notice .bf-btn-primary {
  color: #33253a;
  text-decoration: none; padding: 11px 26px; font-size: 14px;
}
/* Keep the sticky header below the WP admin bar */
body.admin-bar.beez-fin-canvas .bf-header { top: 32px; }
@media (max-width: 782px) {
  body.admin-bar.beez-fin-canvas .bf-header { top: 46px; }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .bf-kpi-grid { grid-template-columns: 1fr 1fr; }
  .bf-metrics-grid { grid-template-columns: 1fr 1fr; }
  .bf-dash-grid { grid-template-columns: 1fr; }
  .bf-dash-side { position: static; }
  .bf-charts-row { grid-template-columns: 1fr; }
  .bf-settings-grid { grid-template-columns: 1fr; }
  .bf-cat-cols { grid-template-columns: 1fr; }
  .bf-header-inner { gap: 12px; }
  .bf-nav-item { padding: 7px 10px; font-size: 13px; }
}
@media (max-width: 600px) {
  .bf-kpi-grid { grid-template-columns: 1fr 1fr; }
  .bf-metrics-grid { grid-template-columns: 1fr; }
  .bf-page { padding: 14px; }
  .bf-kpi-value { font-size: 20px; }
  .bf-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ============================================================
   Mobile app shell (≤768px)
   Bottom tab bar, quick-add button, bottom-sheet modals, card
   lists. Desktop keeps the top nav — everything here is hidden
   or unchanged above 768px.
   ============================================================ */
.bf-tabbar, .bf-fab { display: none; }

@keyframes bf-sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }

@media (max-width: 768px) {
  :root { --bf-header-h: 56px; --bf-tabbar-h: 64px; }

  body.beez-fin-canvas {
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
  }

  /* Room for the fixed tab bar (+ "+" button on pages that have it) */
  #beez-fin-root {
    padding-bottom: calc(var(--bf-tabbar-h) + env(safe-area-inset-bottom, 0px) + 24px);
  }
  #beez-fin-root[data-bf-page="dashboard"],
  #beez-fin-root[data-bf-page="transactions"] {
    padding-bottom: calc(var(--bf-tabbar-h) + env(safe-area-inset-bottom, 0px) + 92px);
  }

  /* ── Slim app bar (top nav moves to the bottom) ── */
  .bf-header {
    height: calc(var(--bf-header-h) + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
  }
  .bf-header-inner { padding: 0 16px; gap: 10px; }
  .bf-logo-icon { width: 34px; height: 34px; font-size: 17px; border-radius: 9px; }
  .bf-logo-name { font-size: 15px; }
  .bf-nav { display: none; }
  .bf-header-actions { margin-left: auto; }
  #bf-add-tx-btn, #bf-add-tx-btn2 { display: none; }   /* replaced by the "+" button */
  .bf-sub { display: none; }                            /* the dashboard hero shows the expiry on phones */

  /* ── Bottom tab bar ── */
  .bf-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--bf-surface);
    border-top: 1px solid var(--bf-border);
    box-shadow: var(--bf-shadow-up);
  }
  .bf-tabbar-item {
    --tc: var(--bf-profit); --tb: var(--bf-profit-soft);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 52px; margin: 0 2px; padding: 6px 2px;
    background: none; border: none; border-radius: 16px; cursor: pointer;
    color: var(--tc); font: inherit; font-size: 11px; font-weight: 600; line-height: 1.1;
    transition: background .18s, transform .12s;
    -webkit-tap-highlight-color: transparent;
  }
  .bf-tabbar-item .bf-tabbar-emoji {
    display: inline-block;
    font-size: 22px; line-height: 1; flex: none;
    filter: grayscale(35%) opacity(.75);
    transition: transform .18s, filter .18s;
  }
  .bf-tabbar-item span { color: var(--bf-text-muted); transition: color .18s; }
  .bf-tabbar-item.active { background: var(--tb); }
  .bf-tabbar-item.active span { color: var(--tc); }
  .bf-tabbar-item.active .bf-tabbar-emoji { filter: none; transform: scale(1.12); }
  .bf-tabbar-item:active { transform: scale(.93); }
  /* one colour per tab, like the Mongolbee menu */
  .bf-tabbar-item[data-page="dashboard"]    { --tc: var(--bf-profit);  --tb: var(--bf-profit-soft); }
  .bf-tabbar-item[data-page="transactions"] { --tc: var(--bf-income);  --tb: var(--bf-income-soft); }
  .bf-tabbar-item[data-page="reports"]      { --tc: var(--bf-amber);   --tb: var(--bf-amber-soft); }
  .bf-tabbar-item[data-page="members"]      { --tc: var(--bf-cash);    --tb: var(--bf-cash-soft); }
  .bf-tabbar-item[data-page="settings"]     { --tc: var(--bf-expense); --tb: var(--bf-expense-soft); }

  /* ── Floating "add transaction" button (dashboard + transactions only) ── */
  .bf-fab {
    position: fixed; right: 16px; z-index: 99;
    bottom: calc(var(--bf-tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
    width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
    align-items: center; justify-content: center;
    color: var(--bf-primary-fg); background: var(--bf-primary);
    box-shadow: 0 8px 24px rgba(201,184,236,.6);
    transition: transform .12s;
    -webkit-tap-highlight-color: transparent;
  }
  .bf-fab span { font-size: 26px; line-height: 1; }
  .bf-fab:active { transform: scale(.93); }
  #beez-fin-root[data-bf-page="dashboard"] .bf-fab,
  #beez-fin-root[data-bf-page="transactions"] .bf-fab { display: flex; }

  /* ── Toast sits above the tab bar ── */
  .bf-toast {
    left: 16px; right: 16px; text-align: center;
    bottom: calc(var(--bf-tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px);
  }

  /* ── Modals become bottom sheets ── */
  .bf-modal { align-items: flex-end; }
  .bf-modal-box, .bf-import-box {
    width: 100%; max-width: 100%;
    max-height: 92vh; max-height: 92dvh;
    border-radius: 20px 20px 0 0; border-bottom: none;
    animation: bf-sheet-in .25s cubic-bezier(.2,.8,.2,1);
  }
  .bf-modal-box::before {          /* grab handle */
    content: ''; display: block; width: 40px; height: 4px; border-radius: 2px;
    background: var(--bf-border); margin: 8px auto 0;
  }
  .bf-modal-header { padding: 12px 20px 0; }
  .bf-modal-footer {
    position: sticky; bottom: 0; z-index: 2;
    background: var(--bf-surface); border-top: 1px solid var(--bf-border);
    padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px));
  }
  .bf-modal-footer .bf-btn-primary,
  .bf-modal-footer .bf-btn-ghost { flex: 1; padding: 12px 14px; font-size: 14px; }
  .bf-form-row { grid-template-columns: 1fr; gap: 14px; }
  .bf-type-tab { padding: 8px 12px; }

  /* ── Touch-friendly controls (16px stops iOS zooming into fields) ── */
  .bf-input, .bf-select { font-size: 16px; padding: 10px 12px; min-height: 44px; }
  .bf-select { padding-right: 32px; }
  .bf-btn-primary, .bf-btn-ghost, .bf-btn-danger { padding: 11px 18px; font-size: 14px; }
  .bf-icon-btn { width: 38px; height: 38px; }

  /* ── Pages ── */
  .bf-page { padding: 16px 14px; }
  .bf-page-header { margin-bottom: 14px; }
  .bf-page-title { font-size: 18px; }
  .bf-page-actions { width: 100%; }
  .bf-page-actions .bf-input[type="search"] { flex: 1 1 100%; }
  .bf-page-actions .bf-select { flex: 1 1 0; min-width: 0; }
  .bf-page-actions .bf-btn-ghost { flex: 1 1 0; white-space: nowrap; }
  #bf-rep-from, #bf-rep-to { flex: 1 1 0; min-width: 0; }
  #bf-gen-report { flex: 1 1 100%; }

  /* Dashboard filters */
  .bf-filters { gap: 8px; margin-bottom: 14px; }
  .bf-filters > .bf-filter-group { flex: 1 1 100%; flex-wrap: wrap; }
  .bf-filters > .bf-select { flex: 1 1 100%; }
  .bf-filter-group .bf-select { flex: 1 1 100%; min-width: 0; }
  .bf-period-label {
    flex: 1 1 100%; padding: 0 4px; border: none; background: none;
    font-size: 12px; text-align: left; white-space: nowrap;
  }
  .bf-filter-group { gap: 6px; }
  #bf-custom-range .bf-input { flex: 1 1 0; min-width: 0; }
  #bf-custom-range .bf-btn-sm { flex: 1 1 100%; padding: 12px; font-size: 14px; }

  /* Dashboard content */
  .bf-kpi-grid { gap: 10px; }
  .bf-kpi-card { padding: 14px; }
  .bf-kpi-label { font-size: 12px; }
  .bf-kpi-value { font-size: clamp(15px, 4.8vw, 19px); overflow-wrap: anywhere; }
  .bf-metrics-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .bf-metric-card { padding: 12px 14px; }
  .bf-metric-card:last-child { grid-column: 1 / -1; }
  .bf-metric-value { font-size: 17px; }
  .bf-dash-grid, .bf-charts-row { gap: 12px; grid-template-columns: minmax(0, 1fr); }
  .bf-dash-main, .bf-dash-side { min-width: 0; }
  .bf-kpi-grid, .bf-metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bf-charts-row { margin-bottom: 12px; }
  .bf-card { padding: 16px; }
  .bf-card-header { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
  .bf-margin-big { font-size: 30px; }
  .bf-donut-wrap { gap: 14px; }
  .bf-donut-wrap canvas { max-width: 130px; max-height: 130px; }
  .bf-donut-legend { min-width: 0; }
  .bf-recent-item { gap: 12px; }
  .bf-recent-left { flex: 1; min-width: 0; }
  .bf-recent-amount { flex: none; white-space: nowrap; }

  /* Reports: swipeable tab chips */
  .bf-report-tabs {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    margin: 0 -14px 14px; padding: 0 14px; scrollbar-width: none;
  }
  .bf-report-tabs::-webkit-scrollbar { display: none; }
  .bf-rtab { flex: none; white-space: nowrap; }
  .bf-ms-grid { grid-template-columns: 1fr; }
  .bf-ms-prev-col { width: 72px; min-width: 60px; }
  .bf-ms-delta { font-size: 10px; padding: 2px 5px; }

  /* Transactions: table → card list */
  #bf-tx-table, #bf-tx-table tbody { display: block; }
  #bf-tx-table thead { display: none; }
  #bf-tx-table tr[data-id] {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px;
    padding: 12px 0; border-bottom: 1px solid var(--bf-border);
  }
  #bf-tx-table tr[data-id]:last-child { border-bottom: none; }
  /* zero-height items force line breaks: after the amount, and after the date */
  #bf-tx-table tr[data-id]::before,
  #bf-tx-table tr[data-id]::after { content: ''; flex-basis: 100%; height: 0; }
  #bf-tx-table tr[data-id]::before { order: 3; }
  #bf-tx-table tr[data-id]::after  { order: 7; }
  #bf-tx-table tr:hover td { background: none; }
  #bf-tx-table td { padding: 0; border: none; font-size: 12px; color: var(--bf-text-muted); }
  #bf-tx-table .bf-c-desc   { order: 1; flex: 1 1 0; min-width: 0; font-size: 14px; font-weight: 600; color: var(--bf-text); }
  #bf-tx-table .bf-c-amt    { order: 2; margin-left: auto; font-size: 15px; white-space: nowrap; text-align: right; }
  #bf-tx-table .bf-c-type   { order: 4; margin-top: 8px; }
  #bf-tx-table .bf-c-cat    { order: 5; margin-top: 8px; }
  #bf-tx-table .bf-c-date   { order: 6; margin-top: 8px; }
  #bf-tx-table .bf-c-member { order: 8; margin-top: 6px; }
  #bf-tx-table .bf-c-act    { order: 9; margin-top: 2px; margin-left: auto; white-space: nowrap; }
  #bf-tx-table .bf-c-act .bf-link-btn { padding: 6px; font-size: 16px; }
  #bf-tx-table .bf-c-cat:empty { display: none; }
  #bf-tx-table .bf-c-cat::after { content: ' ·'; }
  .bf-table-footer { padding-top: 14px; }

  /* Members / settings */
  .bf-members-grid { grid-template-columns: 1fr; gap: 12px; }
  .bf-member-card { padding: 16px; }
  .bf-cat-add { flex-wrap: wrap; }
  .bf-cat-add .bf-btn-primary { flex: 1 1 100%; }
  .bf-cat-actions { opacity: 1; }
}
