/* ============================================================
   KIJC v2 — Master Stylesheet
   File: public_html/kijc2/assets/app.css
   Light mode default. Dark mode via body.dark class.
   All values use CSS variables — nothing hardcoded in components.
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=DM+Mono:ital,wght@0,300;0,400;0,500;1,400&display=swap');

/* ── CSS Variables — Light Mode (default) ───────────────────
   Dark mode overrides are at the bottom of this file.         */
:root {
  /* Surfaces */
  --bg:        #F0F4F8;
  --surface:   #FFFFFF;
  --surface2:  #E8EDF5;
  --surface3:  #DDE4F0;
  /* Borders */
  --border:    #D0D8E8;
  --border2:   #B8C4D8;
  /* Text */
  --text:      #1E2535;
  --muted:     #64748B;
  --muted2:    #94A3B8;
  /* Brand colours */
  --accent:    #2563EB;
  --accent-h:  #1D4ED8;   /* hover */
  --accent-s:  rgba(37,99,235,.12); /* subtle bg */
  --accent2:   #7C3AED;
  --accent2-s: rgba(124,58,237,.10);
  /* Semantic */
  --green:     #059669;
  --green-s:   rgba(5,150,105,.10);
  --red:       #DC2626;
  --red-s:     rgba(220,38,38,.10);
  --yellow:    #D97706;
  --yellow-s:  rgba(217,119,6,.12);
  --orange:    #EA580C;
  --orange-s:  rgba(234,88,12,.10);
  --sky:       #0284C7;
  --sky-s:     rgba(2,132,199,.10);
  --pink:      #DB2777;
  --pink-s:    rgba(219,39,119,.10);
  /* Typography */
  --font:      'Sora', sans-serif;
  --mono:      'DM Mono', monospace;
  /* Radii */
  --r-sm:      6px;
  --r:         10px;
  --r-lg:      14px;
  --r-xl:      18px;
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 4px 12px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
  /* Sidebar */
  --sidebar-w: 230px;
  --sidebar-w-collapsed: 60px;
  /* Transitions */
  --t: .16s ease;
}

/* ── Dark Mode ───────────────────────────────────────────── */
body.dark {
  --bg:        #0D1117;
  --surface:   #161B27;
  --surface2:  #1E2535;
  --surface3:  #252D40;
  --border:    #2A3248;
  --border2:   #374060;
  --text:      #E8EDF8;
  --muted:     #6B7A99;
  --muted2:    #4A5570;
  --accent:    #4F8EF7;
  --accent-h:  #6FA0F9;
  --accent-s:  rgba(79,142,247,.12);
  --accent2:   #9D6EF5;
  --accent2-s: rgba(157,110,245,.12);
  --green:     #3ECF8E;
  --green-s:   rgba(62,207,142,.10);
  --red:       #F75E5E;
  --red-s:     rgba(247,94,94,.10);
  --yellow:    #F5C342;
  --yellow-s:  rgba(245,195,66,.12);
  --orange:    #F59A42;
  --orange-s:  rgba(245,154,66,.10);
  --sky:       #38BDF8;
  --sky-s:     rgba(56,189,248,.10);
  --pink:      #F472B6;
  --pink-s:    rgba(244,114,182,.10);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow:    0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.5);
}

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

html { font-size: 14px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted2); }

/* ══════════════════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════════════════ */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--t);
  position: relative;
  z-index: 50;
}
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }

.sidebar-brand {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sidebar-brand-logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: white;
  flex-shrink: 0;
  font-family: var(--mono);
}
.sidebar-brand-text { overflow: hidden; }
.sidebar-brand-text h1 {
  font-size: 15px; font-weight: 700; color: var(--accent);
  white-space: nowrap; letter-spacing: -.3px;
}
.sidebar-brand-text p {
  font-size: 10px; color: var(--muted); white-space: nowrap; margin-top: 1px;
}
.sidebar.collapsed .sidebar-brand-text { display: none; }

/* Collapse toggle button */
.sidebar-collapse-btn {
  position: absolute;
  top: 20px; right: -13px;
  width: 26px; height: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: none; /* shown on ≥769px via media query */
  align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 60;
  transition: background var(--t);
}
.sidebar-collapse-btn:hover { background: var(--surface2); }
.sidebar-collapse-btn svg { width: 12px; height: 12px; color: var(--muted); transition: transform var(--t); }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

/* Sidebar nav */
.sidebar-nav { flex: 1; padding: 10px 0; }
.nav-section {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted2);
  padding: 10px 20px 4px;
  white-space: nowrap; overflow: hidden;
}
.sidebar.collapsed .nav-section { opacity: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--t);
  white-space: nowrap;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active {
  background: var(--accent-s);
  color: var(--accent);
  border-left-color: var(--accent);
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item span { overflow: hidden; text-overflow: ellipsis; }
.sidebar.collapsed .nav-item span { display: none; }
.sidebar.collapsed .nav-item { padding: 10px 0; justify-content: center; }
.sidebar.collapsed .nav-item.active { border-left-color: transparent; border-right: 3px solid var(--accent); }

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-footer-text {
  font-size: 10px; color: var(--muted);
  white-space: nowrap; overflow: hidden;
}
.sidebar-footer-text strong { color: var(--text); font-size: 11px; }
.sidebar.collapsed .sidebar-footer { padding: 10px 0; display: flex; justify-content: center; }
.sidebar.collapsed .sidebar-footer-text { display: none; }

/* Theme toggle in footer */
.theme-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  transition: color var(--t);
  user-select: none;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle-track {
  width: 34px; height: 18px;
  background: var(--border2);
  border-radius: 9px;
  position: relative;
  transition: background var(--t);
  flex-shrink: 0;
}
.theme-toggle-track.on { background: var(--accent); }
.theme-toggle-track::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 12px; height: 12px;
  background: white; border-radius: 50%;
  transition: transform var(--t);
}
.theme-toggle-track.on::after { transform: translateX(16px); }
.sidebar.collapsed .theme-toggle span { display: none; }
.sidebar.collapsed .theme-toggle { padding: 8px 0; justify-content: center; }

/* ── Main content area ───────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  min-width: 0;
}

/* ── Mobile topbar ───────────────────────────────────────── */
.mobile-topbar {
  display: none;
  align-items: center; gap: 10px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 140;
  height: 52px;
}
.mobile-topbar h1 { font-size: 15px; font-weight: 700; color: var(--accent); }
.mobile-topbar p { font-size: 10px; color: var(--muted); }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
  z-index: 130;
}
.sidebar-overlay.show { display: block; }

/* ══════════════════════════════════════════════════════════
   PAGE LAYOUT HELPERS
   ══════════════════════════════════════════════════════════ */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 700; letter-spacing: -.4px; }
.page-header p { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Grid helpers */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }

/* ══════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 6px;
}

/* Stat cards */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.blue::before   { background: var(--accent); }
.stat-card.purple::before { background: var(--accent2); }
.stat-card.green::before  { background: var(--green); }
.stat-card.yellow::before { background: var(--yellow); }
.stat-card.orange::before { background: var(--orange); }
.stat-card.red::before    { background: var(--red); }
.stat-card.sky::before    { background: var(--sky); }
.stat-card.pink::before   { background: var(--pink); }
.stat-val {
  font-size: 26px; font-weight: 700;
  font-family: var(--mono); color: var(--text);
  line-height: 1; margin-top: 6px;
}
.stat-lbl {
  font-size: 10px; color: var(--muted);
  font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border: none; border-radius: var(--r-sm);
  cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  transition: all var(--t);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn-primary   { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-h); }

.btn-ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  background: var(--red-s); color: var(--red);
  border: 1px solid var(--red-s);
}
.btn-danger:hover { background: rgba(220,38,38,.18); }

.btn-success {
  background: var(--green-s); color: var(--green);
  border: 1px solid var(--green-s);
}
.btn-success:hover { background: rgba(5,150,105,.18); }

.btn-sm { padding: 5px 11px; font-size: 11px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }
.btn-block { width: 100%; justify-content: center; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* Icon-only button */
.btn-icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  background: var(--surface2); border: 1px solid var(--border);
  cursor: pointer; transition: all var(--t); color: var(--muted);
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon svg { width: 14px; height: 14px; }

/* ══════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 11px; color: var(--muted);
  font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
}
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--font); font-size: 13px;
  outline: none;
  transition: border var(--t), box-shadow var(--t);
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-s);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--muted2); }
.form-group select option { background: var(--surface2); }
.form-group textarea { resize: vertical; min-height: 80px; }

/* Read-only field */
.form-group input[readonly] {
  background: var(--bg); cursor: default; color: var(--muted);
}

.form-section { margin-bottom: 24px; }
.form-section-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--accent);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

/* Address preview */
.address-preview {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 12px; color: var(--muted);
  margin-top: 8px; min-height: 38px;
  line-height: 1.6;
}
.address-preview strong { color: var(--text); }

/* Form step progress indicator */
.form-steps {
  display: flex; gap: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 24px;
}
.form-step {
  flex: 1; padding: 8px 10px;
  font-size: 11px; font-weight: 600; text-align: center;
  color: var(--muted); cursor: pointer;
  transition: all var(--t); border-right: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.form-step:last-child { border-right: none; }
.form-step:hover { background: var(--surface3); color: var(--text); }
.form-step.active { background: var(--accent); color: white; }
.form-step.done { background: var(--green-s); color: var(--green); }

/* ══════════════════════════════════════════════════════════
   SEARCH & FILTER ROW
   ══════════════════════════════════════════════════════════ */
.search-row {
  display: flex; gap: 10px;
  margin-bottom: 16px;
  align-items: center; flex-wrap: wrap;
}
.search-input {
  flex: 1; min-width: 180px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 12px 9px 36px;
  color: var(--text);
  font-family: var(--font); font-size: 13px;
  outline: none;
  transition: border var(--t);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 11px center;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--muted2); }

.filter-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--font); font-size: 12px;
  outline: none; cursor: pointer;
  transition: border var(--t);
}
.filter-select:focus { border-color: var(--accent); }

/* ══════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--surface2);
  color: var(--muted);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left; white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--t); }
tbody tr:hover { background: var(--surface2); }
tbody td { padding: 10px 14px; vertical-align: middle; }
tbody tr:last-child { border-bottom: none; }

/* Core team highlight row */
tbody tr.row-core { background: rgba(217,119,6,.04); }
tbody tr.row-core:hover { background: rgba(217,119,6,.08); }
tbody tr.row-core td:first-child { border-left: 3px solid var(--yellow); }

/* Retired row */
tbody tr.row-retired { opacity: .45; }
tbody tr.row-retired:hover { opacity: .68; background: var(--surface2); }
tbody tr.row-retired td:first-child { border-left: 3px solid var(--muted2); }

/* ══════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px; font-weight: 700;
  font-family: var(--mono);
  white-space: nowrap;
}
/* Role badges */
.badge-jc     { background: var(--accent-s);  color: var(--accent); }
.badge-ljc    { background: var(--accent2-s); color: var(--accent2); }
.badge-jclt   { background: var(--sky-s);     color: var(--sky); }
.badge-jcrt   { background: var(--pink-s);    color: var(--pink); }
.badge-jjc    { background: var(--surface3);  color: var(--muted); }
/* Status badges */
.badge-core   {
  background: var(--yellow-s); color: var(--yellow);
  border: 1px solid rgba(217,119,6,.25);
}
.badge-lgb    {
  background: var(--green-s); color: var(--green);
  border: 1px solid rgba(5,150,105,.2);
}
.badge-kijc   {
  background: var(--yellow-s); color: var(--yellow);
  border: 1px solid rgba(217,119,6,.28);
}
.badge-desig  { background: var(--orange-s); color: var(--orange); border: 1px solid rgba(234,88,12,.2); }
.badge-retired {
  background: var(--surface3); color: var(--muted);
  border: 1px solid var(--border2);
}
.badge-green  { background: var(--green-s);  color: var(--green); }
.badge-red    { background: var(--red-s);    color: var(--red); }
.badge-blue   { background: var(--accent-s); color: var(--accent); }

/* ══════════════════════════════════════════════════════════
   MEMBER TREE ROWS
   ══════════════════════════════════════════════════════════ */
.mv-table thead { position: sticky; top: 0; z-index: 2; }

/* ══════════════════════════════════════════════════════════
   ATTENDANCE GRID
   ══════════════════════════════════════════════════════════ */
.att-grid-wrap { overflow-x: auto; }
.att-grid-table { width: 100%; border-collapse: collapse; }
.att-grid-table th {
  background: var(--surface2);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
  position: sticky; top: 0; z-index: 2; /* sticky header */
}
.att-grid-table th.col-fam   { color: var(--muted); width: 130px; min-width: 110px; }
.att-grid-table th.col-jc    { color: var(--accent);  border-top: 3px solid var(--accent); }
.att-grid-table th.col-ljc   { color: var(--accent2); border-top: 3px solid var(--accent2); }
.att-grid-table th.col-jjc   { color: var(--green);   border-top: 3px solid var(--green); }
.att-grid-table tbody tr { border-top: 2px solid var(--border); }
.att-grid-table td { border-right: 1px solid var(--border); padding: 3px; vertical-align: top; }
.att-fam-cell {
  background: var(--surface2); padding: 8px 10px;
  font-size: 11px; border-left: 3px solid var(--accent);
  vertical-align: top;
}
.att-fam-id   { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--accent); }
.att-fam-area { font-size: 10px; color: var(--muted); margin-top: 2px; }
.att-fam-cnt  { font-size: 10px; margin-top: 4px; }

.att-cell {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 8px; border-radius: var(--r-sm);
  cursor: pointer; transition: background var(--t); min-height: 36px;
}
.att-cell:hover { background: var(--accent-s); }
.att-cell.checked { background: var(--green-s); }
.att-cell input[type=checkbox] {
  accent-color: var(--accent); width: 15px; height: 15px; flex-shrink: 0; cursor: pointer;
}
.att-cell-name { font-size: 12.5px; flex: 1; line-height: 1.3; }
.att-cell-meta { font-size: 10px; color: var(--muted); }

/* ══════════════════════════════════════════════════════════
   EVENT STRIP (attendance page)
   ══════════════════════════════════════════════════════════ */
.event-strip {
  display: flex; gap: 10px;
  overflow-x: auto; padding-bottom: 10px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.event-strip::-webkit-scrollbar { height: 4px; }

.event-card {
  flex-shrink: 0; scroll-snap-align: start;
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 14px; cursor: pointer;
  transition: all var(--t); min-width: 160px; max-width: 200px;
  position: relative; overflow: hidden;
}
.event-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--border); transition: background var(--t);
}
.event-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.event-card.selected { border-color: var(--accent); background: var(--accent-s); }
.event-card.selected::before { background: var(--accent); }
.event-card-name {
  font-size: 13px; font-weight: 700; line-height: 1.3; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.event-card-date { font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.event-card-count {
  font-size: 11px; font-weight: 600; color: var(--green);
  display: flex; align-items: center; gap: 4px;
}
.event-card-count.zero { color: var(--muted); }

/* ══════════════════════════════════════════════════════════
   LGB ASSIGNMENT TABLE
   ══════════════════════════════════════════════════════════ */
.lgb-table { width: 100%; border-collapse: collapse; }
.lgb-table th {
  font-size: 10px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted); font-weight: 700;
  padding: 8px 12px; border-bottom: 2px solid var(--border); text-align: left;
}
.lgb-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.lgb-dept-header td {
  background: var(--surface2); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .7px;
  padding: 7px 12px;
}
.lgb-row-filled td { background: rgba(5,150,105,.03); }
.lgb-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-s); border: 1px solid rgba(37,99,235,.2);
  border-radius: var(--r-sm); padding: 4px 10px;
  font-size: 12px; font-weight: 600;
}
.lgb-chip-clear {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px;
}
.lgb-chip-clear:hover { color: var(--red); }
.lgb-inline-search { position: relative; min-width: 180px; }
.lgb-inline-search input {
  width: 100%; padding: 5px 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 12px; background: var(--surface2); color: var(--text);
  outline: none; transition: border var(--t);
  font-family: var(--font);
}
.lgb-inline-search input:focus { border-color: var(--accent); }
.lgb-save-btn {
  padding: 4px 12px; font-size: 11px; font-weight: 600;
  border-radius: var(--r-sm); border: 1px solid var(--accent);
  color: var(--accent); background: transparent; cursor: pointer;
  transition: all var(--t);
}
.lgb-save-btn:hover { background: var(--accent); color: white; }
.lgb-remove-btn {
  padding: 3px 8px; font-size: 11px;
  border-radius: var(--r-sm); border: 1px solid var(--border);
  color: var(--muted); background: transparent; cursor: pointer;
  transition: all var(--t);
}
.lgb-remove-btn:hover { border-color: var(--red); color: var(--red); }

/* ══════════════════════════════════════════════════════════
   MEMBER DIRECTORY (portal)
   ══════════════════════════════════════════════════════════ */
.member-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px 16px;
  margin-bottom: 10px; cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t);
}
.member-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.member-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.member-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: white; flex-shrink: 0;
}
.member-avatar.grey { background: linear-gradient(135deg, var(--surface3), var(--border2)); }
.contact-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.contact-btn {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 10px; font-weight: 700;
  cursor: pointer; border: none; text-decoration: none;
  transition: opacity var(--t); font-family: var(--font);
}
.contact-btn:hover { opacity: .8; }
.btn-call { background: var(--green-s); color: var(--green); }
.btn-wa   { background: rgba(37,211,102,.15); color: #25D366; }

/* Privacy lock */
.privacy-lock {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted2); font-style: italic;
}

/* ══════════════════════════════════════════════════════════
   PRIVACY TOGGLE (member profile)
   ══════════════════════════════════════════════════════════ */
.privacy-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.privacy-row:last-child { border-bottom: none; }
.privacy-info { flex: 1; }
.privacy-info strong { font-size: 13px; display: block; }
.privacy-info small { font-size: 11px; color: var(--muted); }
.toggle-switch {
  width: 42px; height: 22px;
  background: var(--border2);
  border-radius: 11px; position: relative;
  cursor: pointer; transition: background var(--t); flex-shrink: 0;
}
.toggle-switch.on { background: var(--accent); }
.toggle-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; background: white;
  border-radius: 50%; transition: transform var(--t);
}
.toggle-switch.on::after { transform: translateX(20px); }

/* ══════════════════════════════════════════════════════════
   CELEBRATIONS / BIRTHDAY LIST
   ══════════════════════════════════════════════════════════ */
.celeb-month-block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; margin-bottom: 14px;
}
.celeb-month-header {
  background: var(--surface2); padding: 10px 16px;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.celeb-month-count { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: auto; }
.celeb-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.celeb-item:last-child { border-bottom: none; }
.celeb-day-badge {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.celeb-day-badge.bday   { background: var(--accent-s); color: var(--accent); }
.celeb-day-badge.anniv  { background: var(--orange-s); color: var(--orange); }
.celeb-info { flex: 1; }
.celeb-name { font-size: 13px; font-weight: 600; }
.celeb-sub  { font-size: 11px; color: var(--muted); margin-top: 1px; }
.celeb-type-badge { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }
.celeb-type-badge.bday  { background: var(--accent-s); color: var(--accent); }
.celeb-type-badge.anniv { background: var(--orange-s); color: var(--orange); }

/* ══════════════════════════════════════════════════════════
   SETTINGS PAGE
   ══════════════════════════════════════════════════════════ */
.settings-tag {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 7px 12px; margin-bottom: 6px;
}
.settings-tag-label { flex: 1; font-size: 13px; }
.settings-tag-code {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  background: var(--bg); padding: 2px 6px; border-radius: 4px;
}
.settings-tag-del {
  background: none; border: none; color: var(--red);
  cursor: pointer; font-size: 16px; opacity: .6; transition: opacity var(--t);
}
.settings-tag-del:hover { opacity: 1; }

/* ══════════════════════════════════════════════════════════
   UPLOAD ZONE
   ══════════════════════════════════════════════════════════ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 36px 20px; text-align: center;
  cursor: pointer; transition: all var(--t);
}
.upload-zone:hover, .upload-zone.drag {
  border-color: var(--accent); background: var(--accent-s);
}
.upload-zone input[type=file] { display: none; }
.upload-zone .upload-icon { font-size: 32px; margin-bottom: 10px; }
.upload-zone p { color: var(--muted); font-size: 13px; }
.upload-zone span { color: var(--accent); font-weight: 600; }

/* ══════════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--text); color: var(--bg);
  border-radius: var(--r);
  padding: 11px 20px;
  font-size: 13px; font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all .3s cubic-bezier(.175,.885,.32,1.275);
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--green);  color: white; }
.toast.error   { background: var(--red);    color: white; }
.toast.info    { background: var(--accent); color: white; }

/* ══════════════════════════════════════════════════════════
   MODAL BASE
   ══════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-header h3 { flex: 1; font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none;
  color: var(--muted); cursor: pointer; font-size: 22px; line-height: 1; padding: 0 4px;
}
.modal-close:hover { color: var(--red); }
.modal-body { padding: 18px 20px; }

/* Bottom-sheet on mobile */
.modal-sheet .modal-box {
  margin-top: auto; border-radius: var(--r-xl) var(--r-xl) 0 0;
  max-height: 85vh;
}

/* ══════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════ */
.empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty svg {
  width: 52px; height: 52px; margin: 0 auto 14px; opacity: .25;
  color: var(--muted);
}
.empty h3 { font-size: 15px; color: var(--text); opacity: .5; margin-bottom: 6px; }
.empty p { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

/* ══════════════════════════════════════════════════════════
   CHILD CARDS (family form)
   ══════════════════════════════════════════════════════════ */
.child-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent2);
  border-radius: var(--r); padding: 14px; margin-bottom: 10px;
  position: relative;
}
.child-card .remove-btn {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none; color: var(--red);
  cursor: pointer; font-size: 18px; line-height: 1;
}
.child-number {
  font-size: 10px; color: var(--accent2); font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px;
}

/* ══════════════════════════════════════════════════════════
   MOBILE FAB
   ══════════════════════════════════════════════════════════ */
.fab {
  position: fixed; bottom: 24px; right: 20px;
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 50%; border: none;
  display: none; /* shown on mobile via media query */
  align-items: center; justify-content: center;
  cursor: pointer; z-index: 90;
  box-shadow: 0 4px 16px rgba(37,99,235,.4);
  transition: all var(--t);
  color: white;
}
.fab:hover { transform: scale(1.08); }
.fab svg { width: 22px; height: 22px; }
.fab-menu {
  position: fixed; bottom: 84px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 89;
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: all var(--t);
}
.fab-menu.open { opacity: 1; transform: translateY(0); pointer-events: all; }
.fab-menu-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 8px 14px;
  font-size: 13px; font-weight: 600; color: var(--text);
  cursor: pointer; box-shadow: var(--shadow); white-space: nowrap;
  transition: background var(--t);
}
.fab-menu-item:hover { background: var(--surface2); }

/* ══════════════════════════════════════════════════════════
   RANK BARS (analytics)
   ══════════════════════════════════════════════════════════ */
.rank-bar-wrap {
  width: 60px; background: var(--border);
  border-radius: 4px; height: 5px; overflow: hidden;
  display: inline-block; vertical-align: middle; margin-right: 6px;
}
.rank-bar { height: 100%; background: var(--accent); border-radius: 4px; }

/* ══════════════════════════════════════════════════════════
   PRINT STYLES
   ══════════════════════════════════════════════════════════ */
@media print {
  .sidebar, .mobile-topbar, .fab, .fab-menu,
  .btn, .search-row, .no-print { display: none !important; }
  body, html { background: white !important; color: black !important; }
  .main { padding: 10px !important; }
  .app { display: block !important; height: auto !important; }
  table th, table td { border: 1px solid #aaa !important; color: black !important; background: white !important; }
  .att-grid-table th { position: static !important; }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  .sidebar-collapse-btn { display: flex; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh;
    z-index: 160; transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
    transition: transform var(--t);
    width: var(--sidebar-w) !important; /* override collapsed */
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-topbar { display: flex; }
  .main { padding: 16px; padding-top: 68px; }
  .grid-3 { grid-template-columns: repeat(2, 1fr) !important; }
  .grid-2 { grid-template-columns: 1fr !important; }
  .form-grid { grid-template-columns: 1fr !important; }
  .fab { display: flex; }
  .page-header h2 { font-size: 18px; }

  /* Member tree → card layout */
  .mv-table thead { display: none; }
  .mv-table, .mv-table tbody { display: block; }
  .mv-table tr {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    grid-template-rows: auto auto auto;
    column-gap: 10px; row-gap: 3px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    align-items: center;
  }
  .mv-table td { display: block; padding: 0; border: none; }
  .mv-table tr.tree-child {
    grid-template-columns: 1fr auto;
    padding: 8px 12px 8px 40px;
    background: var(--surface2);
    border-bottom: 1px dotted var(--border);
  }

  /* LGB table responsive */
  .lgb-table thead { display: none; }
  .lgb-table, .lgb-table tbody { display: block; }
  .lgb-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
  }
  .lgb-table td { display: block; padding: 2px 0; border: none; }
}
