/* ============================================================
   Waro App Jo — Styles
   Inspired by SW USA Majalis & Festivals flyer:
   ivory/cream ground, deep forest green, warm gold accents.
   ============================================================ */

:root {
  /* ----- Forest green (primary) ----- */
  --forest-900: #0c3a27;
  --forest-800: #124a31;
  --forest-700: #1a5a3a;
  --forest-600: #247149;
  --forest-500: #358f5e;
  --forest-400: #5ab087;
  --forest-100: #e1ede4;
  --forest-50:  #f1f7f2;

  /* ----- Ivory / cream ground ----- */
  --ivory-900: #d8c891;     /* deepest border tint */
  --ivory-700: #e5d5a1;     /* stripe / separator */
  --ivory-500: #efe4c4;     /* darker surface */
  --ivory-300: #f6ecd3;     /* app background */
  --ivory-200: #faf2dc;     /* secondary surfaces */
  --ivory-100: #fdf8e9;     /* cards */
  --ivory-50:  #fffbf0;     /* near-white card */

  /* ----- Gold / bronze accents ----- */
  --gold-900: #6b4f13;      /* dark gold text */
  --gold-700: #8e6a1d;
  --gold-600: #a78329;      /* mid gold */
  --gold-500: #c9a257;      /* flyer date gold */
  --gold-400: #d9b775;
  --gold-200: #ecd9a6;
  --gold-100: #f5ecd1;

  /* ----- Neutral text ----- */
  --ink-900: #1d2d23;       /* deep forest-tinted ink */
  --ink-800: #2a3a2f;
  --ink-700: #40504a;
  --ink-600: #59695f;
  --ink-500: #7b897f;
  --ink-400: #a0aba4;
  --ink-300: #c4ccc7;
  --ink-200: #dde3df;
  --ink-100: #eaeeeb;
  --ink-50:  #f4f6f5;

  /* ----- Feedback ----- */
  --red-500:  #c14a3a;
  --red-50:   #fbe9e5;
  --amber-500:#b48223;
  --amber-50: #fbf2d9;
  --blue-500: #2e5d8b;
  --whatsapp: #25d366;

  /* ----- Radii & shadows ----- */
  --radius:     12px;
  --radius-sm:  8px;
  --radius-lg:  18px;
  --shadow-sm:  0 1px 2px rgba(22, 40, 28, 0.06);
  --shadow:     0 2px 10px rgba(22, 40, 28, 0.08);
  --shadow-lg:  0 14px 30px rgba(22, 40, 28, 0.14);

  /* ----- Typography ----- */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  --font-serif: "Playfair Display", "DM Serif Display", "Georgia", "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  color: var(--ink-900);
  background:
    radial-gradient(circle at 0% 0%, rgba(201, 162, 87, 0.08), transparent 38%),
    radial-gradient(circle at 100% 100%, rgba(26, 90, 58, 0.06), transparent 42%),
    var(--ivory-300);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body { min-height: 100vh; min-height: 100dvh; }

h1, h2, h3, .serif { font-family: var(--font-serif); letter-spacing: 0.005em; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea, button { font-size: 16px; }

.hidden { display: none !important; }

/* ---------- Loading screen ---------- */
.loading-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--forest-800), var(--forest-900));
  color: var(--ivory-200); gap: 16px; z-index: 9999;
}
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(255, 251, 240, 0.25); border-top-color: var(--gold-400);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Auth
   ============================================================ */
.auth-view {
  min-height: 100vh; min-height: 100dvh;
  background:
    radial-gradient(circle at 50% -10%, rgba(201, 162, 87, 0.25), transparent 55%),
    linear-gradient(160deg, var(--forest-800) 0%, var(--forest-900) 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px; gap: 16px;
  position: relative;
}
.auth-view::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(201, 162, 87, 0.08) 1px, transparent 0);
  background-size: 14px 14px;
  pointer-events: none;
}
.auth-card {
  position: relative;
  width: 100%; max-width: 420px;
  background: var(--ivory-50);
  border-radius: var(--radius-lg);
  padding: 28px 24px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--ivory-700);
}
.auth-card::after {
  /* subtle top ornament */
  content: ""; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 60px; height: 2px; background: var(--gold-500); border-radius: 2px; opacity: 0.6;
}
.auth-header { text-align: center; margin-bottom: 20px; }
.auth-header .logo {
  width: 68px; height: 68px; border-radius: 20px;
  background: linear-gradient(135deg, var(--forest-700), var(--forest-900));
  color: var(--gold-300, var(--gold-400));
  font-family: var(--font-serif);
  font-weight: 700; font-size: 34px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px; box-shadow: var(--shadow);
  border: 2px solid var(--gold-500);
}
.auth-header h1 {
  margin: 0; font-size: 26px; color: var(--forest-900);
  font-family: var(--font-serif); font-weight: 700; letter-spacing: 0.02em;
}
.auth-header .subtitle {
  margin: 6px 0 0; color: var(--gold-700); font-size: 12px;
  letter-spacing: 0.2em; text-transform: uppercase; font-weight: 600;
}

.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--ivory-200); border: 1px solid var(--ivory-700);
  border-radius: var(--radius-sm);
  padding: 4px; margin-bottom: 20px;
}
.auth-tab {
  background: transparent; border: none; padding: 10px; font-weight: 600;
  border-radius: 6px; color: var(--ink-600); transition: all 0.2s;
  font-family: var(--font-sans);
}
.auth-tab.active {
  background: var(--ivory-50); color: var(--forest-800); box-shadow: var(--shadow-sm);
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; color: var(--ink-700); font-weight: 600;
  letter-spacing: 0.02em;
}
.auth-form input, .auth-form select {
  border: 1px solid var(--ivory-700); border-radius: var(--radius-sm);
  padding: 12px 14px; background: var(--ivory-50);
  font-size: 16px; color: var(--ink-900);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-form input:focus, .auth-form select:focus {
  outline: none; border-color: var(--forest-600);
  box-shadow: 0 0 0 3px rgba(36, 113, 73, 0.15);
}
.auth-form small { color: var(--ink-500); font-weight: 400; }
.auth-error { color: var(--red-500); font-size: 14px; margin: 0; min-height: 18px; }
.auth-note {
  color: var(--ink-500); font-size: 13px; text-align: center; margin: 4px 0 0;
  font-style: italic;
}
.auth-footer {
  color: rgba(245, 236, 209, 0.7); font-size: 12px;
  letter-spacing: 0.1em; text-transform: uppercase;
}

.link-btn {
  background: none; border: none; color: var(--forest-700);
  font-size: 14px; font-weight: 600; padding: 4px; text-align: center;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; transition: all 0.15s;
  text-decoration: none; min-height: 44px;
  font-family: var(--font-sans);
}
.btn-primary { background: var(--forest-700); color: var(--ivory-50); }
.btn-primary:hover { background: var(--forest-800); }
.btn-primary:disabled { background: var(--ink-400); cursor: not-allowed; }
.btn-secondary {
  background: var(--ivory-100); color: var(--ink-800);
  border-color: var(--ivory-700);
}
.btn-secondary:hover { background: var(--ivory-200); }
.btn-danger { background: var(--red-500); color: white; }
.btn-danger:hover { background: #a33d2f; }
.btn-ghost { background: transparent; color: var(--forest-800); }
.btn-ghost:hover { background: var(--forest-50); }
.btn-whatsapp { background: var(--whatsapp); color: white; }
.btn-whatsapp:hover { background: #1fb558; }
.btn-gold { background: var(--gold-500); color: var(--forest-900); border-color: var(--gold-600); }
.btn-gold:hover { background: var(--gold-400); }
.btn-sm { padding: 6px 12px; min-height: 32px; font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  background: transparent; border: none; color: var(--ink-700);
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--ink-100); }
.icon-btn.danger { color: var(--red-500); }

/* ============================================================
   App shell
   ============================================================ */
.app-view {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: transparent;
}
.app-header {
  background: linear-gradient(180deg, var(--forest-800) 0%, var(--forest-900) 100%);
  color: var(--ivory-100);
  padding-top: env(safe-area-inset-top);
  position: sticky; top: 0; z-index: 40;
  box-shadow: var(--shadow);
  border-bottom: 2px solid var(--gold-500);
}
.app-header-inner {
  max-width: 900px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
}
.app-header h1 {
  font-size: 20px; margin: 0; font-weight: 700; letter-spacing: 0.02em;
  font-family: var(--font-serif);
  color: var(--ivory-100);
}
.app-header-actions { display: flex; align-items: center; gap: 8px; }
.app-header .icon-btn { color: var(--ivory-100); }
.app-header .icon-btn:hover { background: rgba(255,251,240,0.1); }
.user-chip {
  font-size: 12px; background: rgba(201, 162, 87, 0.22);
  padding: 4px 10px; border-radius: 999px; font-weight: 600;
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border: 1px solid rgba(201, 162, 87, 0.55);
  color: var(--gold-200);
}
.user-chip.admin    { background: rgba(201, 162, 87, 0.35); color: var(--gold-100); }
.user-chip.jkadmin  { background: rgba(201, 162, 87, 0.22); color: var(--gold-200); }
.user-chip.scope    { background: rgba(255,251,240,0.16); border-color: rgba(255,251,240,0.3); color: var(--ivory-100); }

.page-content {
  flex: 1; max-width: 900px; width: 100%;
  margin: 0 auto; padding: 16px;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--ivory-50); border-top: 1px solid var(--ivory-700);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
  box-shadow: 0 -2px 12px rgba(22, 40, 28, 0.06);
}
.nav-btn {
  flex: 1 1 0;
  background: none; border: none; padding: 10px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--ink-500); font-size: 11px; font-weight: 600;
  transition: color 0.15s;
  font-family: var(--font-sans);
}
.nav-btn.hidden { display: none !important; }
.nav-btn.active { color: var(--forest-800); }
.nav-btn.active svg { stroke: var(--forest-700); }
.nav-btn:hover { color: var(--forest-700); }

/* ============================================================
   Generic components
   ============================================================ */
.card {
  background: var(--ivory-50);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--ivory-700);
  margin-bottom: 12px;
}
.card-title {
  font-size: 11px; font-weight: 700; color: var(--gold-700);
  text-transform: uppercase; letter-spacing: 0.14em; margin: 0 0 12px;
}

.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin: 16px 0 12px; gap: 8px; flex-wrap: wrap;
  padding-bottom: 8px; border-bottom: 1px solid var(--ivory-700);
}
.section-header h2 {
  margin: 0; font-size: 22px; color: var(--forest-900);
  font-family: var(--font-serif); font-weight: 700; letter-spacing: 0.01em;
}
.section-header .subtitle {
  font-size: 11px; color: var(--gold-700);
  letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700;
  font-family: var(--font-sans);
  display: block;
}

.empty-state {
  text-align: center; padding: 40px 16px; color: var(--ink-500);
  background: var(--ivory-100); border-radius: var(--radius);
  border: 1px dashed var(--ivory-700);
}
.empty-state .icon { font-size: 44px; margin-bottom: 8px; }
.empty-state h3 { margin: 0 0 4px; color: var(--forest-900); font-family: var(--font-serif); }
.empty-state p { margin: 0; font-size: 14px; }

.search-bar {
  position: relative; margin-bottom: 12px;
}
.search-bar input {
  width: 100%; padding: 10px 14px 10px 40px;
  border: 1px solid var(--ivory-700); border-radius: var(--radius-sm);
  background: var(--ivory-50); font-size: 15px; color: var(--ink-900);
}
.search-bar input:focus {
  outline: none; border-color: var(--forest-600);
  box-shadow: 0 0 0 3px rgba(36, 113, 73, 0.15);
}
.search-bar::before {
  content: "🔍"; position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%); opacity: 0.4; pointer-events: none; font-size: 14px;
}

.filter-chips {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px;
  scrollbar-width: thin;
}
.filter-chips::-webkit-scrollbar { height: 4px; }
.filter-chips::-webkit-scrollbar-thumb { background: var(--ivory-700); border-radius: 2px; }

.chip {
  flex-shrink: 0; background: var(--ivory-50); border: 1px solid var(--ivory-700);
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
  color: var(--ink-700); font-weight: 500;
  transition: all 0.15s; cursor: pointer;
  font-family: var(--font-sans);
}
.chip.active { background: var(--forest-700); color: var(--ivory-50); border-color: var(--forest-700); }
.chip:hover:not(.active) { background: var(--ivory-200); }

.no-match-hint {
  font-size: 13px; color: var(--ink-500); font-style: italic;
  padding: 6px 8px;
}

/* ---------- Members page: controls & advanced filters ---------- */
.members-controls { margin-bottom: 6px; }
.members-list { margin-bottom: 8px; }

.search-bar-sm input { padding-top: 9px; padding-bottom: 9px; font-size: 14px; }
.search-bar.jk-search { margin-top: 4px; margin-bottom: 8px; }
.search-bar.jk-search::before { content: "🏛️"; opacity: 0.55; }

.filters-bar {
  display: flex; justify-content: flex-end; margin: 6px 0 0;
}
.filters-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ivory-50); border: 1px solid var(--ivory-700);
  color: var(--forest-800); padding: 8px 12px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13px; letter-spacing: 0.02em;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
  font-family: var(--font-sans);
}
.filters-toggle:hover { background: var(--ivory-100); border-color: var(--forest-400); }
.filters-toggle .ft-label { display: inline-flex; align-items: center; gap: 6px; }
.filters-toggle .ft-icon { display: inline-flex; color: var(--gold-700); }
.filters-toggle .ft-chevron { display: inline-flex; color: var(--ink-500); transition: transform 0.2s; }
.filters-toggle[aria-expanded="true"] .ft-chevron { transform: rotate(180deg); }
.filters-toggle .filters-badge {
  background: var(--gold-500); color: var(--forest-900);
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.filters-panel {
  max-height: 0; overflow: hidden;
  transition: max-height 0.25s ease, margin 0.25s ease;
  margin-top: 0;
}
.filters-panel.open {
  max-height: 600px; margin-top: 8px;
}
.filters-panel > :first-child { margin-top: 2px; }
.filters-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  background: var(--ivory-100); border: 1px solid var(--ivory-700);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm);
}
@media (min-width: 600px) { .filters-grid { grid-template-columns: repeat(4, 1fr); } }
.filters-grid .filter-field {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  cursor: default;
}
.filters-grid .filter-field > span {
  font-size: 10px; color: var(--gold-700); font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.filters-grid select {
  border: 1px solid var(--ivory-700); border-radius: var(--radius-sm);
  padding: 9px 10px; background: var(--ivory-50); color: var(--ink-900);
  font-size: 14px; width: 100%;
  font-family: var(--font-sans);
}
.filters-grid select:focus {
  outline: none; border-color: var(--forest-600);
  box-shadow: 0 0 0 3px rgba(36, 113, 73, 0.15);
}
.filters-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

.result-count {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold-700); font-weight: 700;
  margin: 14px 2px 8px;
}

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  background: var(--ink-100); color: var(--ink-700);
  font-family: var(--font-sans);
}
.tag-green { background: var(--forest-100); color: var(--forest-800); }
.tag-gold  { background: var(--gold-100);  color: var(--gold-900); border: 1px solid var(--gold-400); }
.tag-red   { background: var(--red-50);    color: var(--red-500); }
.tag-amber { background: var(--amber-50);  color: #7a5114; }
.tag-blue  { background: #dbe6f2;          color: #1f3d63; }
.tag-gray  { background: var(--ink-100);   color: var(--ink-600); }

/* ============================================================
   Dashboard
   ============================================================ */
.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; margin-bottom: 16px;
}
.stat-card {
  background: var(--ivory-50); padding: 16px; border-radius: var(--radius);
  border: 1px solid var(--ivory-700); box-shadow: var(--shadow-sm);
  position: relative;
}
.stat-card::before {
  content: ""; position: absolute; left: 16px; top: 0;
  width: 28px; height: 3px; background: var(--gold-500); border-radius: 0 0 3px 3px;
}
.stat-label {
  font-size: 10px; color: var(--gold-700);
  text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700;
  margin-top: 4px;
}
.stat-value {
  font-size: 30px; font-weight: 700;
  color: var(--forest-900); margin-top: 2px;
  font-family: var(--font-serif); line-height: 1.1;
}
.stat-sub { font-size: 12px; color: var(--ink-500); margin-top: 2px; }

/* ----- Demographics widgets ----- */
.demographics-grid {
  display: grid; grid-template-columns: 1fr; gap: 14px;
  margin-bottom: 20px;
}
@media (min-width: 680px) {
  .demographics-grid { grid-template-columns: 1fr 1fr; gap: 18px; }
  .demographics-grid .demo-card.full { grid-column: span 2; }
}
.demo-card {
  position: relative;
  background: var(--ivory-50);
  border: 1px solid var(--ivory-700);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.demo-card::before {
  content: ""; position: absolute; top: 0; left: 22px;
  width: 48px; height: 3px;
  background: var(--gold-500); border-radius: 0 0 3px 3px;
}
.demo-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.demo-eyebrow {
  font-size: 10px; color: var(--gold-700);
  font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
  font-family: var(--font-sans);
}
.demo-metric {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 24px; color: var(--forest-900);
  line-height: 1; letter-spacing: 0.01em;
}

.bar-list { display: flex; flex-direction: column; gap: 14px; }
.bar-list .bar-empty {
  font-size: 13px; color: var(--ink-500); font-style: italic;
  padding: 6px 0;
}

.bar-row {
  display: flex; flex-direction: column; gap: 6px;
}
.bar-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px;
}
.bar-header .bar-label {
  font-size: 14px; color: var(--ink-800); font-weight: 600;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-header .bar-value {
  display: inline-flex; align-items: baseline; gap: 6px; flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.bar-header .bar-count {
  font-family: var(--font-serif); font-weight: 700; font-size: 16px;
  color: var(--forest-900);
}
.bar-header .bar-pct {
  font-size: 11px; color: var(--gold-700); font-weight: 700;
  letter-spacing: 0.1em;
}
.bar-row .bar-track {
  height: 10px; background: var(--ivory-200); border-radius: 999px; overflow: hidden;
  border: 1px solid var(--ivory-700);
}
.bar-row .bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--forest-600), var(--forest-500));
  border-radius: 999px; min-width: 3px;
  transition: width 0.35s ease;
}
.bar-row .bar-fill.gold { background: linear-gradient(90deg, var(--gold-600), var(--gold-400)); }
.bar-row .bar-fill.blue { background: linear-gradient(90deg, var(--blue-500), #5a8cc0); }
.bar-row .bar-fill.pink { background: linear-gradient(90deg, #b63f74, #e07aa7); }

/* Donut (gender, etc.) */
.demo-donut {
  display: flex; align-items: center; gap: 18px;
  flex-wrap: wrap;
}
.demo-donut .donut-svg { flex-shrink: 0; }
.demo-donut-legend {
  flex: 1; min-width: 140px;
  display: flex; flex-direction: column; gap: 10px;
  font-size: 13px;
}
.demo-donut-legend .legend-item {
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  align-items: center; gap: 10px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--ivory-700);
}
.demo-donut-legend .legend-item:last-child { border-bottom: none; }
.demo-donut-legend .legend-swatch {
  width: 12px; height: 12px; border-radius: 3px;
}
.demo-donut-legend .legend-label {
  color: var(--ink-800); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.demo-donut-legend .legend-value {
  font-family: var(--font-serif); font-weight: 700; color: var(--forest-900);
  font-size: 15px; font-variant-numeric: tabular-nums;
}
.demo-donut-legend .legend-pct {
  font-size: 11px; font-weight: 700; color: var(--gold-700);
  letter-spacing: 0.08em; min-width: 32px; text-align: right;
}

.scope-banner {
  background: var(--gold-100); border: 1px solid var(--gold-400);
  color: var(--gold-900); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 13px; font-weight: 600;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.scope-banner::before {
  content: "📍"; font-size: 14px;
}

/* ============================================================
   Members list
   ============================================================ */
.member-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--ivory-50); padding: 12px; border-radius: var(--radius);
  border: 1px solid var(--ivory-700); margin-bottom: 8px;
  transition: all 0.15s;
}
.member-row:hover { border-color: var(--forest-500); }

.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--forest-500), var(--forest-800));
  color: var(--ivory-100); font-weight: 700; font-size: 16px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-family: var(--font-serif);
  border: 2px solid var(--gold-400);
}
.avatar.female { background: linear-gradient(135deg, #b63f74, #7a2c4d); }

.member-info { flex: 1; min-width: 0; }
.member-name { font-weight: 700; color: var(--forest-900); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-serif); }
.member-sub { font-size: 12px; color: var(--ink-600); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.member-sub .dot-sep { color: var(--ink-400); }

.member-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }

.whatsapp-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--whatsapp); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; transition: transform 0.15s;
}
.whatsapp-icon:hover { transform: scale(1.06); }
.whatsapp-icon svg { width: 20px; height: 20px; }

/* ============================================================
   Forms
   ============================================================ */
.form-grid { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label {
  font-size: 12px; color: var(--ink-700); font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.form-row input, .form-row select, .form-row textarea {
  border: 1px solid var(--ivory-700); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 15px; background: var(--ivory-50); color: var(--ink-900); width: 100%;
  transition: border-color 0.15s;
  font-family: var(--font-sans);
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--forest-600);
  box-shadow: 0 0 0 3px rgba(36, 113, 73, 0.15);
}
.form-row textarea { min-height: 72px; resize: vertical; }
.form-row .checkbox-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px; margin-top: 4px;
}
.checkbox-pill {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--ivory-700); border-radius: var(--radius-sm);
  background: var(--ivory-50); font-size: 13px; line-height: 1.3; cursor: pointer;
  transition: all 0.15s;
  min-width: 0;
  word-break: normal;
  overflow-wrap: break-word;
  color: var(--ink-800);
}
.checkbox-pill input {
  margin: 0 8px 0 0;
  accent-color: var(--forest-700);
  vertical-align: middle;
}
.checkbox-pill > span {
  display: inline;
  vertical-align: middle;
  white-space: normal;
}
.checkbox-pill.checked {
  background: var(--forest-50); border-color: var(--forest-500);
  color: var(--forest-900); font-weight: 600;
}

.form-actions { display: flex; gap: 8px; margin-top: 8px; }
.form-hint {
  font-size: 12px; color: var(--ink-600); margin-top: 4px;
  font-style: italic;
}

@media (min-width: 600px) {
  .form-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
}

/* ----- Segmented control (ceremony picker) ----- */
.segmented-control {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border: 1px solid var(--ivory-700); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--ivory-200);
  padding: 4px; gap: 4px;
}
.seg-btn {
  background: transparent; border: none;
  padding: 10px 12px;
  font-size: 14px; font-weight: 600;
  color: var(--ink-600); border-radius: 6px;
  transition: all 0.15s;
  font-family: var(--font-sans);
  cursor: pointer;
}
.seg-btn:hover:not(:disabled):not(.active) { background: var(--ivory-100); color: var(--ink-800); }
.seg-btn.active {
  background: var(--ivory-50);
  color: var(--forest-900);
  box-shadow: var(--shadow-sm);
}
.seg-btn:last-child.active {
  background: var(--gold-100);
  color: var(--gold-900);
  border: 1px solid var(--gold-500);
}
.seg-btn:disabled {
  opacity: 0.45; cursor: not-allowed;
  text-decoration: line-through;
}

/* ----- Ceremony section header (under the calendar) ----- */
.ceremony-header {
  display: flex; justify-content: space-between; align-items: center;
  margin: 20px 0 10px; gap: 8px;
  padding: 10px 12px;
  background: var(--forest-50); border: 1px solid var(--forest-100);
  border-left: 4px solid var(--forest-600);
  border-radius: var(--radius-sm);
}
.ceremony-header h3 {
  margin: 0; font-size: 14px;
  font-family: var(--font-sans);
  color: var(--forest-900); font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.ceremony-header.majlis {
  background: var(--gold-100); border-color: var(--gold-400);
  border-left-color: var(--gold-600);
}
.ceremony-header.majlis h3 { color: var(--gold-900); }
.ceremony-header .btn-gold {
  background: var(--gold-500); color: var(--forest-900); border-color: var(--gold-600);
}
.ceremony-header .btn-gold:hover { background: var(--gold-400); }

/* Majlis-ceremony card accent */
.event-card.majlis-ceremony {
  background: linear-gradient(180deg, #fcf3dc 0%, var(--ivory-50) 100%);
  border-color: var(--gold-400);
}

/* Majlis-ceremony calendar dot: gold ring around status dot */
.dot.majlis-waro {
  box-shadow: 0 0 0 1.5px var(--gold-500);
}
.calendar-day.selected .dot.majlis-waro {
  box-shadow: 0 0 0 1.5px var(--gold-200);
}

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(12, 40, 26, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 100; animation: fadeIn 0.2s; padding: 0;
  backdrop-filter: blur(2px);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--ivory-50);
  width: 100%; max-width: 500px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 92vh; overflow: hidden;
  display: flex; flex-direction: column;
  animation: slideUp 0.25s cubic-bezier(.2,.8,.2,1);
  border: 1px solid var(--ivory-700);
  border-top: 3px solid var(--gold-500);
}
@keyframes slideUp { from { transform: translateY(30px); } to { transform: translateY(0); } }
@media (min-width: 600px) {
  .modal-overlay { align-items: center; padding: 16px; }
  .modal { border-radius: var(--radius-lg); border-top-width: 3px; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--ivory-700);
}
.modal-header h3 {
  margin: 0; font-size: 19px; font-family: var(--font-serif);
  color: var(--forest-900); font-weight: 700;
}
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer {
  display: flex; gap: 8px; padding: 12px 20px;
  border-top: 1px solid var(--ivory-700); background: var(--ivory-200);
  justify-content: flex-end;
}
.modal-footer .btn { min-width: 80px; }

/* ============================================================
   Calendar / Schedule
   ============================================================ */
.calendar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--forest-800); color: var(--ivory-100);
  border-radius: var(--radius); border: 1px solid var(--forest-900);
  box-shadow: var(--shadow-sm);
}
.calendar-header h2 {
  margin: 0; font-size: 18px; font-family: var(--font-serif); letter-spacing: 0.08em;
  text-transform: uppercase; font-weight: 700; color: var(--ivory-100);
}
.calendar-nav { display: flex; gap: 4px; }
.calendar-nav .icon-btn { color: var(--gold-300, var(--gold-400)); }
.calendar-nav .icon-btn:hover { background: rgba(201, 162, 87, 0.2); }
.calendar-nav .btn-ghost { color: var(--ivory-100); }
.calendar-nav .btn-ghost:hover { background: rgba(201, 162, 87, 0.2); }

.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px; margin-bottom: 12px;
}
.calendar-weekday {
  text-align: center; font-size: 10px; color: var(--gold-700);
  font-weight: 700; text-transform: uppercase; padding: 6px 0; letter-spacing: 0.14em;
}
.calendar-day {
  background: var(--ivory-50); border: 1px solid var(--ivory-700);
  border-radius: var(--radius-sm); padding: 6px 4px;
  min-height: 56px; cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: all 0.15s;
}
.calendar-day:hover { border-color: var(--forest-500); }
.calendar-day.other-month { opacity: 0.4; background: var(--ivory-200); }
.calendar-day.today { background: var(--forest-50); border-color: var(--forest-500); }
.calendar-day.selected {
  background: var(--forest-800); border-color: var(--forest-900);
  color: var(--ivory-100);
  box-shadow: 0 2px 8px rgba(18, 74, 49, 0.35);
}
.calendar-day .day-num { font-size: 14px; font-weight: 700; font-family: var(--font-serif); }
.calendar-day .dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--forest-600); }
.dot.majlis { background: var(--gold-500); }
.dot.scheduled { background: var(--forest-600); }
.dot.performed { background: var(--blue-500); }
.dot.missed { background: var(--red-500); }
.calendar-day.selected .dot { background: var(--gold-400); }
.calendar-day.selected .dot.majlis { background: var(--gold-200); }

.day-events { margin-top: 8px; }
.event-card {
  background: var(--ivory-50); border: 1px solid var(--ivory-700); border-radius: var(--radius);
  padding: 12px; margin-bottom: 8px;
  display: flex; gap: 10px; align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.event-card.majlis-event {
  background: linear-gradient(180deg, var(--gold-100), var(--ivory-200));
  border-color: var(--gold-400);
}
.event-stripe {
  width: 4px; align-self: stretch; border-radius: 2px;
  background: var(--forest-600); flex-shrink: 0;
}
.event-stripe.majlis { background: var(--gold-500); }
.event-body { flex: 1; min-width: 0; }
.event-title { font-weight: 700; font-size: 15px; color: var(--forest-900); font-family: var(--font-serif); letter-spacing: 0.01em; }
.event-sub { font-size: 12px; color: var(--ink-600); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.event-actions { display: flex; gap: 4px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* ============================================================
   Toast
   ============================================================ */
.toast-root {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; width: calc(100% - 32px); max-width: 420px;
}
.toast {
  background: var(--forest-900); color: var(--ivory-100);
  padding: 12px 16px; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: 14px;
  animation: toastIn 0.2s;
  pointer-events: auto;
  border: 1px solid var(--forest-700);
  border-left: 4px solid var(--gold-500);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.toast.success { background: var(--forest-800); border-left-color: var(--gold-500); }
.toast.error { background: var(--red-500); border-left-color: #fff0ec; }
.toast.warning { background: var(--amber-500); color: #2a1c00; border-left-color: var(--forest-700); }

/* ============================================================
   Floating action button
   ============================================================ */
.fab {
  position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--forest-700); color: var(--ivory-50); border: 2px solid var(--gold-500);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg); z-index: 30;
  cursor: pointer; transition: all 0.2s;
}
.fab:hover { background: var(--forest-800); transform: scale(1.05); }
.fab svg { width: 24px; height: 24px; }

/* ============================================================
   Misc
   ============================================================ */
.language-note {
  background: var(--amber-50); border: 1px solid #e9c97a;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13px; color: #6a4610; margin-bottom: 12px;
}

/* ============================================================
   Users management page
   ============================================================ */
.users-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.users-stat {
  background: var(--ivory-50);
  border: 1px solid var(--ivory-700);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--ink-600);
  text-align: center;
}
.users-stat strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--forest-800);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 2px;
}
.users-stat.pending   strong { color: var(--gold-700); }
.users-stat.admin     strong { color: var(--forest-700); }
.users-stat.suspended strong { color: var(--red-500); }

@media (max-width: 520px) {
  .users-summary { grid-template-columns: repeat(2, 1fr); }
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.user-card {
  background: var(--ivory-50);
  border: 1px solid var(--ivory-700);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.user-card.suspended {
  opacity: 0.7;
  border-color: var(--red-50);
  border-left: 4px solid var(--red-500);
}
.user-card-main {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}
.user-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--forest-600), var(--forest-800));
  color: var(--ivory-100);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.user-card-body {
  min-width: 0;
  flex: 1;
}
.user-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.user-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
  color: var(--forest-900);
}
.user-email {
  font-size: 13px;
  color: var(--ink-700);
  margin-top: 2px;
  word-break: break-all;
}
.user-scope {
  font-size: 12px;
  color: var(--ink-600);
  margin-top: 4px;
}
.user-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.user-card-actions {
  flex-shrink: 0;
}

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid transparent;
}
.role-badge.role-admin {
  background: var(--gold-100);
  color: var(--gold-900);
  border-color: var(--gold-400);
}
.role-badge.role-jkadmin {
  background: var(--gold-100);
  color: var(--gold-700);
  border-color: var(--gold-200);
}
.role-badge.role-team {
  background: var(--forest-100);
  color: var(--forest-800);
}
.role-badge.role-pending {
  background: var(--ink-100);
  color: var(--ink-700);
}

/* Manage-user modal secondary actions */
.form-section-label {
  margin-top: 18px;
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-700);
  font-weight: 700;
}
.user-action-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-action-stack .btn { justify-content: center; }
