/* ═══════════════════════════════════════════════════════════════
   GilFlow — site.css  v0.9.4
   Global styles: variables, layout shell, sidebar, topbar,
   shared components (cards, buttons, inputs, badges, tables)
   ═══════════════════════════════════════════════════════════════ */

/* ─── Transitions ───────────────────────────────────────────── */
:root {
  --transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Dark Theme ────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-base:         #0d1117;
  --bg-sidebar:      #0f1520;
  --bg-card:         #1a2335;
  --bg-card-hover:   #1f2a3f;
  --bg-input:        rgba(255,255,255,0.04);
  --bg-input-focus:  rgba(255,255,255,0.07);
  --border:          rgba(255,255,255,0.07);
  --border-hover:    rgba(255,255,255,0.14);
  --accent:          #c9a84c;
  --accent-dim:      rgba(201,168,76,0.12);
  --accent-glow:     rgba(201,168,76,0.22);
  --text-primary:    #eef0f4;
  --text-secondary:  #8a94a6;
  --text-muted:      #4f5a6e;
  --sidebar-active:  rgba(201,168,76,0.1);
  --shadow-card:     0 4px 24px rgba(0,0,0,0.4);
  --shadow-hover:    0 12px 40px rgba(0,0,0,0.5);
  --topbar-bg:       rgba(13,17,23,0.9);
  --chart-bar:       rgba(201,168,76,0.7);
  --chart-bar2:      rgba(26,79,160,0.5);
  --positive:        #4caf7a;
  --negative:        #e05c5c;
  --tag-bg:          rgba(255,255,255,0.05);
  --logo-bar:        #c9a84c;
  --bg-panel:        #131a24;
  --divider:         rgba(255,255,255,0.06);
  color-scheme: dark;
}

/* ─── Light Theme ───────────────────────────────────────────── */
[data-theme="light"] {
  --bg-base:         #f0f4f8;
  --bg-sidebar:      #ffffff;
  --bg-card:         #ffffff;
  --bg-card-hover:   #f8fafc;
  --bg-input:        rgba(0,0,0,0.03);
  --bg-input-focus:  rgba(0,0,0,0.06);
  --border:          rgba(0,0,0,0.07);
  --border-hover:    rgba(0,0,0,0.16);
  --accent:          #1a4fa0;
  --accent-dim:      rgba(26,79,160,0.08);
  --accent-glow:     rgba(26,79,160,0.18);
  --text-primary:    #0f1923;
  --text-secondary:  #4a5568;
  --text-muted:      #9aa5b4;
  --sidebar-active:  rgba(26,79,160,0.08);
  --shadow-card:     0 2px 12px rgba(0,0,0,0.07);
  --shadow-hover:    0 8px 30px rgba(0,0,0,0.12);
  --topbar-bg:       rgba(240,244,248,0.9);
  --chart-bar:       rgba(26,79,160,0.7);
  --chart-bar2:      rgba(201,168,76,0.5);
  --positive:        #4caf7a;
  --negative:        #e05c5c;
  --tag-bg:          rgba(0,0,0,0.05);
  --logo-bar:        #1a4fa0;
  --bg-panel:        #e8edf3;
  --divider:         rgba(0,0,0,0.06);
  color-scheme: light;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ─── Layout Shell ──────────────────────────────────────────── */
.shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4,0,0.2,1), background var(--transition);
  overflow: visible;
  position: relative;
  z-index: 50;
}

.sidebar.collapsed { width: 56px; }

.sidebar.collapsed .logo-text,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .user-info,
.sidebar.collapsed #userChevron,
.sidebar.collapsed .sidebar-collapse-btn { display: none; }

.sidebar.collapsed .sidebar-logo {
  padding: 1rem 0;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}

.sidebar.collapsed .sidebar-section { padding: 0.8rem 0.5rem 0.4rem; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0.65rem; gap: 0; }
.sidebar.collapsed .nav-item.active::before { display: none; }
.sidebar.collapsed .user-row { justify-content: center; padding: 0.5rem; }
.sidebar.collapsed .user-avatar { margin: 0; }

.sidebar.collapsed .user-popup {
  left: 56px;
  bottom: 0;
  right: auto;
  min-width: 220px;
}

/* Floating re-expand button */
.sidebar-expand-float {
  display: none;
  position: fixed;
  top: 50%;
  left: 56px;
  transform: translateY(-50%);
  z-index: 200;
  width: 20px;
  height: 48px;
  align-items: center;
  justify-content: center;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.sidebar-expand-float:hover { background: var(--accent-dim); color: var(--accent); }
body.sidebar-collapsed .sidebar-expand-float { display: flex; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.5rem 1rem 1.2rem 1.4rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-collapse-btn {
  margin-left: auto;
  width: 26px; height: 26px;
  border-radius: 6px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: background 0.18s, color 0.18s;
}
.sidebar-collapse-btn:hover { background: var(--accent-dim); color: var(--accent); }

.logo-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}
.sidebar-logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
}
.sidebar-logo-link:hover { text-decoration: none; }

.sidebar-section { padding: 1.2rem 0.8rem 0.4rem; }

.sidebar-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0 0.6rem;
  margin-bottom: 0.4rem;
}

.workspace-name {
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  margin-bottom: 2px;
  text-decoration: none;
  position: relative;
}

.nav-item:hover { background: var(--accent-dim); color: var(--text-primary); }

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--accent);
  font-weight: 500;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.nav-item .bi { font-size: 1rem; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 100px;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 1rem 0.8rem;
  position: relative;
}

/* ─── User Popup ────────────────────────────────────────────── */
.user-menu-wrap { position: relative; }

.user-popup {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-hover);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
}

.user-popup.open { opacity: 1; transform: translateY(0); pointer-events: all; }

.user-popup-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.9rem 1rem;
}

.user-avatar-lg {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

[data-theme="dark"] .user-avatar-lg { color: #0d1117; }

.popup-name { font-size: 0.84rem; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popup-email { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popup-divider { height: 1px; background: var(--border); margin: 0; }

.popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 1rem;
  font-size: 0.83rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  width: 100%;
}

.popup-item:hover { background: var(--accent-dim); color: var(--text-primary); }
.popup-item .bi { font-size: 0.95rem; color: var(--text-muted); }
.popup-item:hover .bi { color: var(--accent); }
.popup-item-danger { color: var(--negative) !important; }
.popup-item-danger .bi { color: var(--negative) !important; opacity: 0.7; }
.popup-item-danger:hover { background: rgba(224,92,92,0.08) !important; }

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s;
}
.user-row:hover { background: var(--accent-dim); }

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}
[data-theme="dark"] .user-avatar { color: #0d1117; }

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.82rem; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--text-muted); }

/* ─── Main & Page Content ───────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.8rem;
}

/* ─── Topbar ────────────────────────────────────────────────── */
.topbar {
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.4rem;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background var(--transition);
  gap: 10px;
  position: relative;
  z-index: 100;
}

.topbar-left  { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* Workspace Switcher */
.ws-trigger {
  display: flex; align-items: center; gap: 7px;
  padding: 0.38rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.ws-trigger:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }
.ws-trigger .bi-building { color: var(--accent); }
.ws-trigger .bi-chevron-down { color: var(--text-muted); font-size: 0.7rem; }

.ws-currency-tag {
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.ws-item-currency {
  margin-left: auto;
  background: var(--tag-bg);
  color: var(--text-muted);
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
}

/* Invite Button */
.btn-invite {
  display: flex; align-items: center; gap: 6px;
  padding: 0.38rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s;
}
.btn-invite:hover { background: var(--accent-glow); }
.ws-personal-icon { color: #a78bfa; }
.ws-team-icon { color: #60a5fa; }
.ws-invited-icon  { color: #fb923c; }
.btn-invite[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* Topbar Icons */
.topbar-icon-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  position: relative;
  text-decoration: none;
}
.topbar-icon-btn:hover { background: var(--accent-dim); color: var(--accent); }

.topbar-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  background: var(--negative);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 100px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

.topbar-avatar-btn {
  border: none; background: none; cursor: pointer; padding: 0;
}

.topbar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
}
[data-theme="dark"] .topbar-avatar { color: #0d1117; }

/* Topbar Search */
.topbar-search {
  position: relative;
  display: flex; align-items: center;
}
.topbar-search-icon {
  position: absolute; left: 10px;
  color: var(--text-muted); font-size: 0.85rem; pointer-events: none;
}
.topbar-search-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.75rem 0.35rem 2rem;
  font-size: 0.82rem;
  color: var(--text-primary);
  width: 220px;
  outline: none;
  transition: border-color 0.18s, width 0.25s;
  font-family: 'DM Sans', sans-serif;
}
.topbar-search-input::placeholder { color: var(--text-muted); }
.topbar-search-input:focus { border-color: var(--accent); width: 280px; }

/* ─── Generic Dropdown ──────────────────────────────────────── */
.tb-dropdown { position: relative; }

.tb-menu {
  position: absolute;
  top: calc(100% + 8px); left: 0;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  opacity: 0; transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 300; overflow: hidden;
}
.tb-menu.right { left: auto; right: 0; }
.tb-menu.open  { opacity: 1; transform: translateY(0); pointer-events: all; }

.tb-menu-header {
  padding: 0.7rem 1rem 0.5rem;
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted); font-weight: 500;
}

.tb-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 0.55rem 1rem;
  font-size: 0.83rem; color: var(--text-secondary);
  text-decoration: none; cursor: pointer;
  transition: background 0.15s, color 0.15s; white-space: nowrap;
}
.tb-menu-item:hover { background: var(--accent-dim); color: var(--text-primary); }
.tb-menu-item .bi { font-size: 0.95rem; color: var(--text-muted); flex-shrink: 0; }
.tb-menu-item:hover .bi { color: var(--accent); }
.tb-menu-item.active { color: var(--accent); font-weight: 500; }
.tb-menu-item.active .bi { color: var(--accent); }
.tb-menu-divider { height: 1px; background: var(--border); margin: 0.3rem 0; }

/* ─── Page Header ───────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap;
}

.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.9rem; font-weight: 500;
  color: var(--text-primary); line-height: 1.2;
}

.page-subtitle {
  font-size: 0.83rem; color: var(--text-muted); margin-top: 3px;
}

/* ─── Cards ─────────────────────────────────────────────────── */
.cf-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.cf-card:hover { box-shadow: var(--shadow-hover); border-color: var(--border-hover); }

.cf-card-title {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted); font-weight: 500; margin-bottom: 0.4rem;
}

/* Stat card */
.stat-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem; font-weight: 500;
  color: var(--text-primary); line-height: 1.1;
}

.stat-delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.75rem; font-weight: 500; margin-top: 4px;
}
.stat-delta.up   { color: var(--positive); }
.stat-delta.down { color: var(--negative); }

/* ─── Buttons ───────────────────────────────────────────────── */
.cf-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.84rem; font-weight: 500;
  cursor: pointer; border: none;
  transition: background 0.18s, opacity 0.18s;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
}

.cf-btn-primary {
  background: var(--accent); color: #fff;
}
[data-theme="dark"] .cf-btn-primary { color: #0d1117; }
.cf-btn-primary:hover { opacity: 0.88; }

.cf-btn-secondary {
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.cf-btn-secondary:hover { border-color: var(--border-hover); color: var(--text-primary); }

.cf-btn-danger {
  background: rgba(224,92,92,0.12);
  border: 1px solid rgba(224,92,92,0.2);
  color: var(--negative);
}
.cf-btn-danger:hover { background: rgba(224,92,92,0.2); }

/* ─── Form Inputs ───────────────────────────────────────────── */
.cf-label {
  display: block;
  font-size: 0.75rem; font-weight: 500;
  color: var(--text-muted); letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.cf-input,
.cf-select,
.cf-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.18s, background 0.18s;
  font-family: 'DM Sans', sans-serif;
}
.cf-input:focus, .cf-select:focus, .cf-textarea:focus {
  border-color: var(--accent);
  background: var(--bg-input-focus);
}
.cf-input::placeholder, .cf-textarea::placeholder { color: var(--text-muted); }

/* Select dropdown fix for dark/light mode */
.cf-select,
.cf-select option {
  color: var(--text-primary);
  background-color: var(--bg-card);
}

[data-theme="dark"] .cf-select {
  color-scheme: dark;
  color: #eef0f4;
  background-color: #1a2335;
}
[data-theme="dark"] .cf-select option {
  color: #eef0f4;
  background-color: #1a2335;
}

[data-theme="light"] .cf-select {
  color-scheme: light;
  color: #0f1923;
  background-color: #ffffff;
}
[data-theme="light"] .cf-select option {
  color: #0f1923;
  background-color: #ffffff;
}

/* ─── Badges / Status Pills ──────────────────────────────────── */
.badge-status {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 100px;
  font-size: 0.7rem; font-weight: 500;
}
.badge-posted  { background: rgba(76,175,122,0.1);  color: var(--positive); }
.badge-pending { background: rgba(201,168,76,0.12); color: var(--accent); }
.badge-void    { background: var(--tag-bg);          color: var(--text-muted); }
.badge-active  { background: rgba(76,175,122,0.1);  color: var(--positive); }
.badge-inactive { background: var(--tag-bg);         color: var(--text-muted); }

.badge-role-admin       { background: rgba(201,168,76,0.12); color: var(--accent); border: 1px solid rgba(201,168,76,0.25); }
.badge-role-contributor { background: rgba(76,175,122,0.1);  color: var(--positive); border: 1px solid rgba(76,175,122,0.2); }
.badge-role-auditor     { background: rgba(74,128,208,0.1);  color: #4a80d0; border: 1px solid rgba(74,128,208,0.2); }

.badge-expense { background: rgba(224,92,92,0.1);  color: var(--negative); }
.badge-income  { background: rgba(76,175,122,0.1); color: var(--positive); }

/* ─── Tables ────────────────────────────────────────────────── */
.cf-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }

.cf-table th {
  padding: 0.6rem 1rem;
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); font-weight: 500;
  border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap;
}

.cf-table td {
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.cf-table tr:last-child td { border-bottom: none; }
.cf-table tbody tr:hover td { background: var(--bg-card-hover); }
.cf-table .td-primary { color: var(--text-primary); font-weight: 500; }
.cf-table .td-positive { color: var(--positive); font-weight: 500; }
.cf-table .td-negative { color: var(--negative); font-weight: 500; }

/* ─── Category Icon Chip ─────────────────────────────────────── */
.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 100px;
  background: var(--tag-bg); color: var(--text-secondary);
  font-size: 0.75rem;
}
.cat-chip .bi { color: var(--accent); font-size: 0.85rem; }

/* ─── SweetAlert2 Overrides ─────────────────────────────────── */
.swal2-popup {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-hover) !important;
  border-radius: 16px !important;
  font-family: 'DM Sans', sans-serif !important;
  color: var(--text-primary) !important;
}
.swal2-title { color: var(--text-primary) !important; font-family: 'Cormorant Garamond', serif !important; font-weight: 500 !important; }
.swal2-html-container { color: var(--text-secondary) !important; font-size: 0.88rem !important; }
.swal2-confirm { background: var(--negative) !important; border-radius: 8px !important; font-family: 'DM Sans', sans-serif !important; font-weight: 500 !important; }
.swal2-confirm.safe { background: var(--accent) !important; }
.swal2-cancel { background: var(--tag-bg) !important; color: var(--text-secondary) !important; border: 1px solid var(--border) !important; border-radius: 8px !important; font-family: 'DM Sans', sans-serif !important; }

/* ─── Modal Overlay ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: 16px; padding: 1.8rem;
  width: 480px; max-width: 95vw;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  transform: translateY(12px);
  transition: transform 0.2s;
  max-height: 90vh; overflow-y: auto;
}
.modal-overlay.open .modal-box { transform: translateY(0); }

/* ─── Invite Modal Role Selector ─────────────────────────────── */
.inv-role-option {
  border: 1.5px solid var(--border);
  border-radius: 10px; padding: 0.75rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 0.5rem;
}
.inv-role-option:hover { background: var(--tag-bg); }
.inv-role-option.selected { border-color: var(--accent); background: var(--accent-dim); }
.inv-role-header { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.inv-role-desc { font-size: 0.73rem; color: var(--text-muted); line-height: 1.5; }
.inv-role-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 100px;
  font-size: 0.7rem; font-weight: 500;
}
.inv-role-admin       { background: rgba(201,168,76,0.12);  color: var(--accent);    border: 1px solid rgba(201,168,76,0.25); }
.inv-role-contributor { background: rgba(76,175,122,0.1);   color: var(--positive);  border: 1px solid rgba(76,175,122,0.2); }
.inv-role-auditor     { background: rgba(74,128,208,0.1);   color: #4a80d0;          border: 1px solid rgba(74,128,208,0.2); }

/* ─── Alert / Flash Messages ─────────────────────────────────── */
.cf-alert {
  display: flex; align-items: center; gap: 10px;
  padding: 0.75rem 1rem; border-radius: 10px;
  font-size: 0.84rem; margin-bottom: 1rem;
}
.cf-alert-success { background: rgba(76,175,122,0.1);  border: 1px solid rgba(76,175,122,0.2);  color: var(--positive); }
.cf-alert-error   { background: rgba(224,92,92,0.1);   border: 1px solid rgba(224,92,92,0.2);   color: var(--negative); }
.cf-alert-warning { background: rgba(201,168,76,0.1);  border: 1px solid rgba(201,168,76,0.2);  color: var(--accent); }
.cf-alert-info    { background: rgba(74,128,208,0.1);  border: 1px solid rgba(74,128,208,0.2);  color: #4a80d0; }

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 4rem 2rem; text-align: center;
  color: var(--text-muted);
}
.empty-state .bi { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state h5 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state p  { font-size: 0.83rem; max-width: 320px; line-height: 1.6; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  #expandFloat { display: none !important; }
  .topbar-search-input { width: 140px; }
  .topbar-search-input:focus { width: 180px; }
  .btn-invite span { display: none; }
  .page-content { padding: 1rem; }
}

/* ─── Topbar extras (Batch 3) ─────────────────────────────────── */
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 1rem;
  transition: background 0.15s, color 0.15s; position: relative;
}
.icon-btn:hover { background: var(--accent-dim); color: var(--accent); }

.notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--negative); border: 2px solid var(--topbar-bg);
}
.notif-count-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--negative); color: #fff;
  font-size: 0.6rem; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 100px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; border: 1.5px solid var(--topbar-bg);
}

/* Notification dropdown items */
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 0.7rem 1rem; border-bottom: 1px solid var(--border);
  transition: background 0.12s; position: relative; cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-card-hover); }
.notif-item.unread { background: var(--tag-bg); }
.notif-item.unread::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent); border-radius: 0 2px 2px 0;
}
.notif-type-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; flex-shrink: 0;
}
.notif-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.58rem; font-weight: 700; flex-shrink: 0; margin-top: 2px;
}
[data-theme="dark"] .notif-avatar { color: #0d1117; }
.notif-body { flex: 1; min-width: 0; }
.notif-desc { font-size: 0.77rem; color: var(--text-secondary); line-height: 1.4; }
.notif-desc strong { color: var(--text-primary); font-weight: 500; }
.notif-time { font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; }
.notif-unread-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0; margin-top: 5px;
}
.notif-footer {
  display: block; text-align: center;
  padding: 0.55rem 1rem; font-size: 0.75rem;
  color: var(--accent); text-decoration: none;
  border-top: 1px solid var(--border);
  transition: background 0.12s;
}
.notif-footer:hover { background: var(--accent-dim); }

/* Theme pill button */
.theme-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 0.28rem 0.75rem; border-radius: 100px;
  border: 1px solid var(--border); background: var(--tag-bg);
  color: var(--text-secondary); font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem; cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.theme-pill:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* Language trigger */
.lang-trigger {
  display: flex; align-items: center; gap: 5px;
  background: none; border: none; color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif; font-size: 0.8rem;
  cursor: pointer; padding: 0.3rem 0.5rem; border-radius: 7px;
  transition: color 0.15s;
}
.lang-trigger:hover { color: var(--text-primary); }
.lang-flag { font-size: 1rem; }

/* Help menu sub-label */
.tb-menu-sub-label {
  padding: 0.4rem 1rem 0.2rem;
  font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted); font-weight: 500;
}
.tb-menu-sub-label i { margin-right: 6px; font-size: .78rem; }
.help-menu { min-width: 200px; }

/* ─── SweetAlert2 Global Theme ────────────────────────────────── */
.swal2-popup {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-hover) !important;
  border-radius: 16px !important;
  font-family: 'DM Sans', sans-serif !important;
  color: var(--text-primary) !important;
}
.swal2-title {
  color: var(--text-primary) !important;
  font-family: 'Cormorant Garamond', serif !important;
  font-weight: 500 !important;
  font-size: 1.4rem !important;
}
.swal2-html-container { color: var(--text-secondary) !important; font-size: 0.88rem !important; }
.swal2-icon.swal2-warning { border-color: var(--accent) !important; color: var(--accent) !important; }
.swal2-icon.swal2-error   { border-color: var(--negative) !important; color: var(--negative) !important; }
.swal2-icon.swal2-success { border-color: var(--positive) !important; color: var(--positive) !important; }
.swal2-icon.swal2-info    { border-color: #4a80d0 !important; color: #4a80d0 !important; }
.swal2-icon.swal2-question { border-color: #7c6ee0 !important; color: #7c6ee0 !important; }
.swal2-confirm {
  background: var(--negative) !important;
  border-radius: 8px !important;
  font-family: 'DM Sans', sans-serif !important;
  font-weight: 500 !important;
}
.swal2-confirm.safe { background: var(--accent) !important; }
.swal2-confirm.swal2-styled:focus { box-shadow: 0 0 0 3px rgba(224,92,92,0.3) !important; }
.swal2-cancel {
  background: var(--tag-bg) !important;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  font-family: 'DM Sans', sans-serif !important;
}
.swal2-cancel:hover { background: var(--bg-card-hover) !important; color: var(--text-primary) !important; }
.swal2-actions { gap: 8px !important; }
.swal2-close { color: var(--text-muted) !important; }
.swal2-close:hover { color: var(--text-primary) !important; }

/* ─── Responsive: 1280px — sidebar compression ─────────────────── */
@media (max-width: 1280px) {
  .sidebar { width: 200px; }
  .sidebar.collapsed { width: 56px; }
}

/* ─── Responsive: 1100px ────────────────────────────────────────── */
@media (max-width: 1100px) {
  .topbar-search-input { width: 160px; }
}

/* ─── Responsive: 900px ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 180px; }
  .topbar-search { display: none; }
  .theme-pill span { display: none; }
  .lang-trigger span#langCode { display: none; }
}

/* ─── Responsive: 768px (override & extend) ─────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.collapsed { display: none; }
  #expandFloat { display: none !important; }
  .topbar { padding: 0 1rem; }
  .topbar-search { display: none; }
  .btn-invite span { display: none; }
  .theme-pill span { display: none; }
  .page-content { padding: 1rem; }
  .prof-layout { grid-template-columns: 1fr; }
  .np-layout { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; height: auto; }
  .plan-cards-grid { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
  .tl-row { grid-template-columns: 1fr; }
  .tl-dot, .tl-left { display: none; }
  .tl-right-cell { grid-column: 1; }
  .tl-col-headers { grid-template-columns: 1fr; }
  .tl-col-label.exp { display: none; }
  .tl-center-line { left: 12px; transform: none; }
  .tl-date-label { justify-content: flex-start; padding-left: 2rem; }
  .split { grid-template-columns: 1fr; height: auto; gap: 1rem; }
  .split-left { overflow-y: visible; max-height: none; }
  .split-right { min-height: 420px; }
  .filter-row-top { flex-wrap: wrap; }
  .filter-input { width: 100%; }
  .filter-row-bottom { flex-wrap: wrap; gap: 3px; }
}

/* ─── Native select — dark/light mode fix (global) ──────────────── */
select, select option {
  color: var(--text-primary);
  background-color: var(--bg-card);
}
[data-theme="dark"] select,
[data-theme="dark"] select option {
  color: #eef0f4;
  background-color: #1a2335;
  color-scheme: dark;
}
[data-theme="light"] select,
[data-theme="light"] select option {
  color: #0f1923;
  background-color: #ffffff;
  color-scheme: light;
}

/* ─── Date inputs — dark/light mode fix (global) ────────────────── */
input[type="date"] {
  color-scheme: dark;
}
[data-theme="light"] input[type="date"] {
  color-scheme: light;
}

/* ─── Scrollbar styling (global) ────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Focus ring (global) ───────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Modal overlay (global — used by all pages) ────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: 16px;
  padding: 1.8rem;
  width: 480px; max-width: 95vw;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  transform: translateY(12px);
  transition: transform 0.2s;
  max-height: 90vh; overflow-y: auto;
}
.modal-overlay.open .modal-box { transform: translateY(0); }

/* ─── Invite modal role cards (global) ──────────────────────────── */
.inv-role-option {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 0.5rem;
}
.inv-role-option:hover { background: var(--tag-bg); }
.inv-role-option.selected { border-color: var(--accent); background: var(--accent-dim); }
.inv-role-header { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.inv-role-desc { font-size: 0.73rem; color: var(--text-muted); line-height: 1.5; }
.inv-role-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 100px; font-size: 0.7rem; font-weight: 500; }
.inv-role-admin       { background: rgba(201,168,76,0.12); color: var(--accent); border: 1px solid rgba(201,168,76,0.25); }
.inv-role-auditor     { background: rgba(74,128,208,0.1);  color: #4a80d0;       border: 1px solid rgba(74,128,208,0.2); }
.inv-role-contributor { background: rgba(76,175,122,0.1);  color: var(--positive); border: 1px solid rgba(76,175,122,0.2); }

/* ─── cf-input / cf-label (layout invite modal) ─────────────────── */
.cf-label {
  display: block;
  font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted);
  font-weight: 500; margin-bottom: 0.4rem;
}
.cf-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.62rem 0.9rem;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.18s, background 0.18s;
}
.cf-input:focus { border-color: var(--accent); background: var(--bg-input-focus); }
.cf-input::placeholder { color: var(--text-muted); }
.cf-btn {
  padding: 0.6rem 1.2rem; border-radius: 9px;
  border: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-size: 0.84rem;
  font-weight: 500; display: inline-flex; align-items: center;
  gap: 7px; transition: opacity 0.2s;
}
.cf-btn:hover { opacity: 0.85; }
.cf-btn-primary { background: var(--accent); color: #fff; }
[data-theme="dark"] .cf-btn-primary { color: #0d1117; }

/* ─── Page header helpers (used across all content pages) ───────── */
.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem; font-weight: 500; color: var(--text-primary);
}
.page-sub {
  font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.3rem;
}
.ph {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 1.8rem; flex-wrap: wrap; gap: 0.8rem;
}
.ph-actions { display: flex; gap: 8px; align-items: center; }

/* ─── Shared button helpers ─────────────────────────────────────── */
.btn-p {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0.5rem 1.2rem; border-radius: 8px;
  border: none; background: var(--accent); color: #fff;
  font-family: 'DM Sans', sans-serif; font-size: 0.82rem;
  font-weight: 500; cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s;
  text-decoration: none;
}
[data-theme="dark"] .btn-p { color: #0d1117; }
.btn-p:hover { opacity: 0.85; box-shadow: 0 6px 18px var(--accent-glow); }
.btn-o {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0.5rem 1rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif; font-size: 0.82rem;
  cursor: pointer; transition: border-color 0.2s, color 0.2s;
  text-decoration: none;
}
.btn-o:hover { border-color: var(--border-hover); color: var(--text-primary); }

/* ─── Animation helpers ─────────────────────────────────────────── */
@keyframes fadeOut {
  to { opacity: 0; transform: scale(0.95); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.widget-new { animation: fadeIn 0.25s ease forwards; }
