/* ============================================================
   Big Faith OS — Shared Design Tokens
   Big Faith Consulting | One System. From Credit Repair to Funding.
   Single source of truth for color + typography across all templates.
   Legacy variable names (--navy, --emerald, etc.) are kept as aliases
   so existing template styles resolve unchanged against the new palette.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;0,800;1,500&family=Nunito+Sans:ital,opsz,wght@0,6..12,300;0,6..12,400;0,6..12,500;0,6..12,600;0,6..12,700;1,6..12,400&family=Dancing+Script:wght@600&display=swap');

:root {
  /* Official Big Faith Consulting brand colors */
  --deep-calling:     #3E275D;
  --royal-purpose:    #7935D7;
  --radiant-gold:     #E3C14B;
  --golden-oak:       #B98539;
  --heavenly-light:   #F6F3FF;
  --steadfast-black:  #221F24;

  /* Legacy token aliases used throughout existing templates */
  --navy:         var(--deep-calling);
  --navy-mid:     #4B2F72;
  --navy-light:   #5B3A8A;
  --emerald:      var(--royal-purpose);
  --emerald-dim:  #5B2E96;
  --emerald-pale: #EDE4FB;
  --white:        #FFFFFF;
  --off-white:    var(--heavenly-light);
  --mist:         #F1ECFB;
  --slate:        #6E6678;
  --ink:          var(--steadfast-black);
  --border:       #E3D9F5;
  --gold-oak:     var(--golden-oak);

  /* Semantic colors — kept distinct from the brand accent on purpose,
     so success/error/info states stay legible and don't collide with
     Royal Purpose as the primary interactive color */
  --red-soft:   #E35B5B;
  --blue:       #3B82F6;
  --amber:      var(--radiant-gold);
  --amber-pale: #FBF2DC;
}

/* ─────────────────────────────────────────────
   Sidebar nav: disabled / "coming soon" module entries
   (Faith Qualify, Faith Funding, Faith Vault, Faith Automate,
   Faith Insights, Settings — not yet built; shown but inert)
   ───────────────────────────────────────────── */
.sidebar-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.sidebar-item .soon-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: var(--mist);
  color: var(--slate);
  padding: 2px 6px;
  border-radius: 8px;
  white-space: nowrap;
}

/* ─────────────────────────────────────────────
   Collapsible sidebar (desktop/tablet, >=768px — the existing mobile
   hamburger drawer below 768px is untouched and takes over there).
   Toggled by static/sidebar.js, which also swaps the topbar logo image
   between the compact lockup and the icon-only symbol, and remembers
   the choice in localStorage.
   ───────────────────────────────────────────── */
.topbar-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--white);
  font-size: 17px;
  cursor: pointer;
  border-radius: 6px;
  margin-left: 6px;
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: rgba(255, 255, 255, 0.1); }
@media (max-width: 768px) { .sidebar-collapse-btn { display: none; } }

body.sidebar-collapsed .dash-body,
body.sidebar-collapsed .page-body {
  grid-template-columns: 68px 1fr;
}
body.sidebar-collapsed .sidebar { padding-left: 10px; padding-right: 10px; }
body.sidebar-collapsed .sidebar-section-label { display: none; }
body.sidebar-collapsed .sidebar-item {
  font-size: 0;
  gap: 0;
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
body.sidebar-collapsed .sidebar-item .badge-count,
body.sidebar-collapsed .sidebar-item .soon-badge {
  display: none;
}
@media (max-width: 768px) {
  /* Collapse never applies in the mobile drawer — always show full labels there */
  body.sidebar-collapsed .dash-body,
  body.sidebar-collapsed .page-body { grid-template-columns: 1fr !important; }
  body.sidebar-collapsed .sidebar-section-label { display: block; }
  body.sidebar-collapsed .sidebar-item { font-size: inherit; gap: 10px; justify-content: flex-start; padding: 9px 12px; }
}

/* ============================================================
   Enterprise shell — shared across every authenticated page.
   Sidebar now carries the logo (top) and a collapse toggle
   (bottom); the old full-width dark topbar is gone. A slim
   mobile-only strip replaces it below 768px for the drawer
   hamburger, matching the design-reference shell.
   ============================================================ */

.icon { display: block; flex-shrink: 0; }
.icon.rotate-180 { transform: rotate(180deg); }

/* ── Sidebar shell ── */
.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 4px 12px 20px;
  margin-bottom: 4px;
}
.sidebar-brand-img { height: 26px; width: auto; display: block; }
body.sidebar-collapsed .sidebar-brand { padding-left: 0; padding-right: 0; justify-content: center; }

.sidebar-item svg.icon { color: inherit; }
.sidebar-item.active svg.icon { color: var(--emerald-dim); }

.sidebar-bottom {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-collapse-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--slate);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: 'Nunito Sans', sans-serif;
}
.sidebar-collapse-row:hover { background: var(--mist); color: var(--navy); }
.sidebar-collapse-row .chev { margin-left: auto; transition: transform 0.2s ease; }
body.sidebar-collapsed .sidebar-collapse-row { justify-content: center; padding-left: 0; padding-right: 0; }
body.sidebar-collapsed .sidebar-collapse-row .chev { transform: rotate(180deg); margin-left: 0; }
body.sidebar-collapsed .sidebar-collapse-row .collapse-label { display: none; }

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* ── Page header (replaces the old dark topbar) ── */
.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-header-text { display: flex; gap: 12px; }
.page-header-accent {
  width: 4px;
  border-radius: 3px;
  background: var(--radiant-gold);
  flex-shrink: 0;
}
.page-header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 9px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }
.btn-primary { background: var(--emerald); color: #fff; }
.btn-primary:hover { background: var(--emerald-dim); }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--border); }
.btn-secondary:hover { background: var(--mist); }
.btn-destructive { background: #fff; color: var(--red-soft); border-color: #F5C6C6; }
.btn-destructive:hover { background: #FEF2F2; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ── Icon-button (table actions, bell) ── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: none;
  border: none;
  color: var(--slate);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--mist); color: var(--navy); }
.icon-btn:focus-visible { outline: 2px solid var(--emerald); outline-offset: 1px; }
.icon-btn.danger:hover { background: #FEF2F2; color: var(--red-soft); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--radiant-gold);
  border: 1.5px solid #fff;
}

/* ── Avatar + account dropdown ── */
.account-menu { position: relative; }
.account-trigger {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  padding: 4px; border-radius: 8px;
}
.account-trigger:hover { background: var(--mist); }
.account-trigger .chev { color: var(--slate); }
.account-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(62,39,93,0.16);
  min-width: 180px; padding: 6px; z-index: 300;
  display: none;
}
.account-dropdown.open { display: block; }
.account-dropdown a, .account-dropdown .dd-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 7px;
  font-size: 13px; font-weight: 500; color: var(--navy);
  text-decoration: none; cursor: pointer;
}
.account-dropdown a:hover, .account-dropdown .dd-item:hover { background: var(--mist); }
.account-dropdown .dd-item.disabled { color: var(--slate); opacity: 0.6; cursor: not-allowed; pointer-events: none; }
.account-dropdown .dd-divider { height: 1px; background: var(--border); margin: 5px 2px; }

/* ── Mobile-only top strip (sidebar lives below 768px as a drawer) ── */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 150;
}
.mobile-topbar img { height: 22px; }
@media (max-width: 768px) {
  .mobile-topbar { display: flex; }
}
