/* =========================================================
   AGBU Lebanon — Prototype Stylesheet
   Design tokens, base styles, layout, components, pages
   ========================================================= */

/* ---------- Design Tokens ---------- */
:root {
  /* Brand palette: deep blue primary, burgundy accent, gold highlight */
  --color-primary:        #1a3a6c;   /* AGBU deep blue */
  --color-primary-dark:   #11264a;
  --color-primary-light:  #2c5499;
  --color-accent:         #8b1c2b;   /* burgundy */
  --color-accent-dark:    #6b1421;
  --color-gold:           #c9a14a;   /* warm gold */
  --color-gold-dark:      #a8852f;

  --color-bg:             #ffffff;
  --color-bg-alt:         #f5f6f8;
  --color-bg-soft:        #eef1f5;
  --color-border:         #dfe3ea;
  --color-text:           #1f2533;
  --color-text-soft:      #4a5468;
  --color-text-muted:     #6f7a8c;
  --color-success:        #1f7a4d;
  --color-warning:        #b06a00;
  --color-danger:         #a01f2c;

  /* Link colours via a token so dark mode can flip them WITHOUT overriding
     buttons/nav (which set their own colour at higher specificity). */
  --link:                 #1a3a6c;   /* = primary */
  --link-hover:           #8b1c2b;   /* = accent  */

  --font-sans: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Georgia", "Times New Roman", serif;
  /* Harmonised Latin + Armenian type system (loaded via Google Fonts in header.php).
     Reusable/extendable sitewide; currently applied on the Activities page. */
  --font-primary: "Noto Sans", "Noto Sans Armenian", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow:    0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.12);

  --container: 1320px;
  --header-h:  72px;

  --transition: 180ms ease;
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--link-hover); }
h1, h2, h3, h4 { font-family: var(--font-serif); color: var(--color-primary-dark); line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.9rem, 3vw, 2.6rem); }
h2 { font-size: clamp(1.5rem, 2.2vw, 2rem); }
h3 { font-size: 1.25rem; }
p  { margin: 0 0 1em; color: var(--color-text-soft); }

/* ---------- Layout ---------- */
/* Fluid: every page fills the user's screen (gutters scale with the viewport). */
.container { max-width: none; width: 100%; margin: 0 auto; padding: 0 clamp(16px, 2.5vw, 60px); }
/* Keep long body text readable even when the page is full-width. */
.page-hero .container > p, .hero .container > p.lead, .section .container > p { max-width: 80ch; }
.section   { padding: 64px 0; }
.section-alt { background: var(--color-bg-alt); }
.section-title { text-align: center; margin-bottom: 36px; }
.section-title h2 { margin-bottom: 8px; }
.section-title p  { max-width: 680px; margin: 0 auto; color: var(--color-text-muted); }

.grid { display: grid; gap: 22px; }
/* minmax(0,1fr) lets wide content (tables) scroll inside its cell instead of
   blowing the column out; grids collapse gracefully on narrow viewports. */
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Header / Navigation ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: #ffffffee;
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--color-border);
}
.header-inner {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-serif);
  color: var(--color-primary-dark);
}
.brand img { height: 40px; width: auto; display: block; }
.brand-text { line-height: 1.1; }
.brand-text .en { display: block; font-weight: 700; font-size: 1.05rem; }
.brand-text .hy { display: block; font-size: .8rem; color: var(--color-accent); }

.main-nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 4px; align-items: center;
  flex-wrap: nowrap;
}
.main-nav a {
  display: inline-block;
  padding: 8px 10px;
  font-size: .92rem;
  color: var(--color-text);
  border-radius: var(--radius-sm);
}
.main-nav a:hover,
.main-nav a.active {
  color: var(--color-primary);
  background: var(--color-bg-soft);
}
.main-nav .nav-cta {
  margin-left: 8px;
  background: var(--color-primary);
  color: #fff;
  padding: 8px 14px;
}
.main-nav .nav-cta:hover { background: var(--color-primary-dark); color: #fff; }

.nav-toggle {
  display: none;
  width: 42px; height: 42px;
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center; justify-content: center;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: ""; display: block;
  width: 22px; height: 2px; background: var(--color-primary);
  position: relative;
}
.nav-toggle span::before { position: absolute; top: -7px; }
.nav-toggle span::after  { position: absolute; top:  7px; }

/* (Old duplicate mobile-nav block removed — the single source of truth for the
   mobile menu is the slide-in drawer at max-width:1024px, further below.) */

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
  text-align: center;
  line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); color: #fff; }
.btn-accent  { background: var(--color-accent); color: #fff; }
.btn-accent:hover  { background: var(--color-accent-dark); color: #fff; }
.btn-gold    { background: var(--color-gold); color: var(--color-primary-dark); }
.btn-gold:hover    { background: var(--color-gold-dark); color: var(--color-primary-dark); }
.btn-outline { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline:hover { background: var(--color-primary); color: #fff; }
.btn-ghost   { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.btn-ghost:hover   { background: var(--color-bg-alt); }
.btn-sm { padding: 7px 14px; font-size: .85rem; }
.btn-block { display: block; width: 100%; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background:
    linear-gradient(135deg, rgba(17, 38, 74, 0.92), rgba(44, 84, 153, 0.88)),
    radial-gradient(ellipse at top right, rgba(201, 161, 74, 0.35), transparent 60%);
  color: #fff;
  padding: 80px 0 90px;
}
.hero h1 { color: #fff; margin-bottom: 14px; }
.hero p.lead { color: #e7ecf5; font-size: 1.15rem; max-width: 720px; margin-bottom: 28px; }
.hero .hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .hero-actions .btn-outline { color: #fff; border-color: #fff; }
.hero .hero-actions .btn-outline:hover { background: #fff; color: var(--color-primary); }

.page-hero {
  background: var(--color-primary);
  color: #fff;
  padding: 56px 0;
}
.page-hero h1 { color: #fff; margin-bottom: 6px; }
.page-hero p  { color: #d9e0ed; margin: 0; }

/* status badges (portal, bookings, leave, tasks, rentals) */
.badge { display:inline-block; padding:2px 9px; border-radius:999px; font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.03em; background:var(--color-bg-soft); color:var(--color-text-soft); }
.badge-pending,.badge-prio-medium { background:#fff3cd; color:#7a5c00; }
.badge-confirmed,.badge-approved,.badge-active { background:#d8f0e2; color:#1f7a4d; }
.badge-rejected,.badge-cancelled,.badge-expired,.badge-terminated,.badge-prio-high { background:#f6d6da; color:#a01f2c; }
.badge-prio-low { background:#e3e8f0; color:#4a5468; }

/* Engagement badges (profile milestones) — shared component, rendered by
   engagement_badges_html() in lib/gamify.php. Used on the portal, the profile
   page, and anywhere added later, so it lives here (global) not in portal.css.
   Universal "core" badges, a "Bonus" divider, then optional badges. */
.badge-row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.bdg {
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 13px; border-radius:999px;
  font-size:.78rem; font-weight:700; letter-spacing:.01em;
  border:1px solid var(--color-border); background:var(--color-bg-alt); color:var(--color-text-soft);
  transition:transform .12s ease;
}
.bdg .ic { font-size:1rem; line-height:1; filter:grayscale(1) opacity(.6); }
.bdg.on {
  background:linear-gradient(150deg, #fbf1d4, #f3e2b0);
  border-color:var(--color-gold); color:#7a5e17;
  box-shadow:0 2px 8px rgba(201,161,74,.28);
}
.bdg.on .ic { filter:none; }
.bdg.on:hover { transform:translateY(-1px); }
.bdg.off { border-style:dashed; color:var(--color-text-muted); background:transparent; }
.bdg.off .ic { filter:grayscale(1) opacity(.45); }
.bdg.bonus.off { opacity:.85; }   /* optional + locked reads softer, not "failed" */
.bdg-sep {
  display:inline-flex; align-items:center; gap:8px; margin-left:4px; cursor:default;
  font-size:.64rem; font-weight:800; letter-spacing:.12em; text-transform:uppercase; color:var(--color-text-muted);
}
.bdg-sep::before { content:""; width:1px; height:16px; background:var(--color-border); margin-right:4px; }
[data-theme="dark"] .bdg.on { background:linear-gradient(150deg, rgba(201,161,74,.30), rgba(201,161,74,.14)); color:#f0daa0; border-color:var(--color-gold); }
/* Tap-to-reveal popover: on phones the badges are icon-only, so a tap shows the
   name + status (built by main.js). */
.bdg-tip { position:absolute; z-index:3000; max-width:220px; background:var(--color-primary-dark); color:#fff;
  padding:8px 12px; border-radius:10px; box-shadow:0 10px 26px rgba(0,0,0,.32);
  font-size:.82rem; line-height:1.35; display:flex; flex-direction:column; gap:1px; pointer-events:none; }
.bdg-tip b { font-weight:700; }
.bdg-tip i { font-style:normal; opacity:.82; font-size:.76rem; }
/* Phones: shrink each badge to just its icon (compact, non-bulky). Tap = popover. */
@media (max-width: 600px) {
  .badge-row { gap:7px; }
  .bdg { width:40px; height:40px; padding:0; border-radius:50%; gap:0; justify-content:center; }
  .bdg .bdg-lbl { display:none; }
  .bdg .ic { font-size:1.2rem; filter:none; }
  .bdg.off .ic { filter:grayscale(1) opacity(.5); }
  .bdg-sep { font-size:.55rem; margin-left:2px; }
  .bdg-sep::before { height:24px; }
}

/* section tab bar (Properties / HR) */
.tabs { display:flex; gap:4px; border-bottom:2px solid var(--color-border); margin:0 0 20px; flex-wrap:wrap; }
.tabs a { padding:9px 18px; font-weight:600; color:var(--color-text-soft); border-bottom:3px solid transparent; margin-bottom:-2px; text-decoration:none; }
.tabs a:hover { color:var(--color-primary); }
.tabs a.active { color:var(--color-primary); border-bottom-color:var(--color-gold); }

/* ---------- Cards ---------- */
.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
.card-icon {
  width: 44px; height: 44px;
  background: var(--color-bg-soft);
  color: var(--color-primary);
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; margin-bottom: 12px;
}

.quick-card {
  display: block;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: left;
  color: var(--color-text);
  transition: all var(--transition);
}
.quick-card:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.quick-card .title { font-weight: 700; color: var(--color-primary-dark); display: block; margin-bottom: 4px; }
.quick-card .desc { color: var(--color-text-muted); font-size: .9rem; }

/* ---------- Event Cards ---------- */
.event-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
}
.event-card .img {
  background: var(--color-bg-soft);
  aspect-ratio: 16/9;
  display: flex; align-items: center; justify-content: center;
}
.event-card .body { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.event-card h3   { margin: 0 0 6px; font-size: 1.1rem; }
.event-card .meta { color: var(--color-text-muted); font-size: .85rem; margin-bottom: 10px; }
.event-card .desc { color: var(--color-text-soft); font-size: .92rem; flex: 1; }
.event-card .actions { display: flex; gap: 8px; margin-top: 14px; }
.event-card .actions .btn { flex: 1; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--color-bg-soft);
  color: var(--color-primary);
}
.badge-accent  { background: #f9e7ea; color: var(--color-accent); }
.badge-gold    { background: #fbf2dc; color: var(--color-gold-dark); }
.badge-success { background: #e0f2e9; color: var(--color-success); }
.badge-muted   { background: var(--color-bg-alt); color: var(--color-text-muted); }

/* ---------- Filters ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 24px;
}
.filter-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
  font-size: .85rem;
  cursor: pointer;
  transition: all var(--transition);
}
.filter-btn:hover { border-color: var(--color-primary); }
.filter-btn.is-active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; }
.field label {
  font-size: .85rem; font-weight: 600;
  color: var(--color-text); margin-bottom: 6px;
}
.field label .req { color: var(--color-accent); }
/* Base look for EVERY text-like control, site-wide. The `input:not([type])`
   selector is the important bit: many inputs are written as a bare
   <input name="…"> with no type attribute, so the old `input[type="text"]`
   rules never matched them and they fell back to the ugly browser default.
   This catches them all (while leaving checkboxes/radios/files/buttons alone). */
input:not([type]),
input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="search"], input[type="url"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="month"], input[type="time"],
select, textarea {
  font: inherit;
  color: var(--color-text);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  box-sizing: border-box;
  max-width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
textarea { min-height: 110px; resize: vertical; }

input:not([type]):focus,
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus,
input[type="tel"]:focus, input[type="search"]:focus, input[type="url"]:focus,
input[type="number"]:focus, input[type="date"]:focus, input[type="datetime-local"]:focus,
input[type="month"]:focus, input[type="time"]:focus,
select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26, 58, 108, 0.15);
}
::placeholder { color: var(--color-text-muted); opacity: .9; }

/* Inside a .field (stacked label + control) the control fills the column. */
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea { width: 100%; }
.field .hint { font-size: .8rem; color: var(--color-text-muted); margin-top: 4px; }

.check {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: .9rem; color: var(--color-text-soft);
}
.check input { margin-top: 3px; }

.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

.notice {
  padding: 14px 16px;
  border-left: 4px solid var(--color-gold);
  background: #fbf6e8;
  color: #6c5210;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 24px;
}
.notice-info    { border-left-color: var(--color-primary); background: #eef2f9; color: #1c3460; }
.notice-warning { border-left-color: var(--color-warning); background: #fdf3e3; color: #6a4205; }
.notice-danger  { border-left-color: var(--color-danger);  background: #fbe9eb; color: #6b1421; }
.notice-success { border-left-color: var(--color-success); background: #e6f3ec; color: #1f4f37; }

.success-message {
  background: #e6f3ec;
  border: 1px solid #b8dec8;
  color: #1f4f37;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-top: 16px;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data, .table {
  width: 100%; border-collapse: collapse;
  background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--radius); overflow: hidden;
  font-size: .9rem;
}
table.data th, table.data td, .table th, .table td {
  text-align: left; padding: 11px 16px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
/* Headers shouldn't wrap to two lines ("Actual Jan–May"); the wrap scrolls instead. */
table.data th, .table th { white-space: nowrap; }
table.data th, .table th {
  background: var(--color-bg-alt);
  color: var(--color-primary-dark);
  font-weight: 700;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;            /* headers never bunch together */
}
table.data tr:last-child td, .table tr:last-child td { border-bottom: none; }
table.data tbody tr:hover, .table tbody tr:hover { background: var(--color-bg-soft); }

/* Sortable table headers */
.table th.th-sort { cursor: pointer; user-select: none; position: relative; padding-right: 24px; }
.table th.th-sort:hover { background: var(--color-bg-soft); }
.table th.th-sort::after { content: "\2195"; position: absolute; right: 9px; opacity: .35; font-size: .85em; }
.table th.sort-asc::after  { content: "\2191"; opacity: 1; }
.table th.sort-desc::after { content: "\2193"; opacity: 1; }

/* Print: hide chrome, show just the statement */
@media print {
  .site-header, .site-footer, .page-hero, .no-print, .nav-toggle { display: none !important; }
  body { background: #fff; }
  .section { padding: 0 !important; }
  .table { font-size: .85rem; }
}

/* ---------- Dashboard Stats ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat {
  background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-sm);
}
.stat .label { color: var(--color-text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { color: var(--color-primary-dark); font-size: 2rem; font-weight: 700; font-family: var(--font-serif); margin-top: 6px; }
.stat .sub   { color: var(--color-text-muted); font-size: .82rem; margin-top: 2px; }

/* ---------- Seating Plan ---------- */
.seating-wrap { background: var(--color-bg-alt); padding: 28px; border-radius: var(--radius); }
.stage-bar {
  background: var(--color-primary-dark);
  color: #fff;
  text-align: center;
  padding: 10px;
  border-radius: var(--radius-sm);
  letter-spacing: .15em;
  margin-bottom: 26px;
  font-size: .9rem;
}
.seat-row {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-bottom: 6px;
}
.seat-row .row-label {
  width: 26px; text-align: center;
  font-weight: 700; color: var(--color-text-muted);
  font-size: .85rem;
}
.seat {
  width: 30px; height: 30px;
  border-radius: 4px 4px 8px 8px;
  background: #d6dde8;
  border: 1px solid #b8c1d1;
  cursor: pointer;
  font-size: .7rem;
  display: flex; align-items: center; justify-content: center;
  color: #4a5468;
  transition: transform var(--transition), background var(--transition);
}
.seat:hover:not(.reserved) { transform: scale(1.08); }
.seat.vip       { background: #f9e7c2; border-color: var(--color-gold); color: #6c5210; }
.seat.reserved  { background: #c0c5d0; border-color: #a3aabb; color: #6b7384; cursor: not-allowed; opacity: .65; }
.seat.selected  { background: var(--color-accent); border-color: var(--color-accent-dark); color: #fff; }
.seat-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 18px; font-size: .85rem; color: var(--color-text-soft);
}
.seat-legend .swatch {
  display: inline-block; width: 16px; height: 16px;
  border-radius: 4px; margin-right: 6px; vertical-align: middle;
  border: 1px solid #b8c1d1;
}
.swatch.s-avail    { background: #d6dde8; }
.swatch.s-vip      { background: #f9e7c2; border-color: var(--color-gold); }
.swatch.s-reserved { background: #c0c5d0; }
.swatch.s-selected { background: var(--color-accent); border-color: var(--color-accent-dark); }

.seating-summary {
  background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 18px;
  margin-top: 22px;
}
.seating-summary h3 { margin-top: 0; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-primary-dark);
  color: #d6dceb;
  padding: 56px 0 24px;
  margin-top: 64px;
}
.site-footer h4 { color: #fff; font-family: var(--font-sans); font-size: 1rem; margin-bottom: 14px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 8px; }
.site-footer a  { color: #d6dceb; font-size: .9rem; }
.site-footer a:hover { color: var(--color-gold); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 30px;
}
@media (max-width: 800px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .footer-grid { grid-template-columns: 1fr; }
}
.footer-brand { font-family: var(--font-serif); color: #fff; font-size: 1.2rem; margin-bottom: 8px; }
.footer-brand .hy { color: var(--color-gold); font-size: .95rem; display: block; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  margin-top: 36px; padding-top: 18px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  font-size: .82rem; color: #9aa4bd;
}

/* ---------- Auth / Login ---------- */
.auth-wrap {
  max-width: 420px;
  margin: 0 auto;
  background: #fff;
  padding: 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.auth-wrap h1 { font-size: 1.5rem; text-align: center; }

/* ---------- Misc ---------- */
.split {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 36px; align-items: center;
}
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }
.list-checks { list-style: none; padding: 0; margin: 0; }
.list-checks li { padding: 6px 0 6px 28px; position: relative; color: var(--color-text-soft); }
.list-checks li::before {
  content: "✓"; position: absolute; left: 0; top: 6px;
  color: var(--color-gold-dark); font-weight: 700;
}
.kicker {
  display: inline-block;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--color-accent);
  font-weight: 700;
  margin-bottom: 8px;
}
.muted { color: var(--color-text-muted); }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 14px; } .mt-3 { margin-top: 22px; } .mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 14px; }
.gap-2 { gap: 14px; } .flex { display: flex; } .flex-wrap { flex-wrap: wrap; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin-bottom: 22px; flex-wrap: wrap; }
.tab-btn {
  background: transparent;
  border: none;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 3px solid transparent;
  font-size: .92rem;
}
.tab-btn:hover { color: var(--color-primary); }
.tab-btn.is-active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* admin layout — FLUID: fills each user's screen automatically (gutters scale with viewport) */
.container.admin-shell { max-width: none; width: 100%; padding-left: clamp(16px, 2.5vw, 60px); padding-right: clamp(16px, 2.5vw, 60px); }
.admin-shell { display: grid; grid-template-columns: 230px 1fr; gap: 28px; }
@media (max-width: 900px) { .admin-shell { grid-template-columns: 1fr; } }
/* Let the content column shrink to the viewport. Without this a 1fr grid track
   keeps its min-width:auto, so a wide table/card row stretches the whole column
   past the screen (then overflow-x:clip on <body> cuts off the right edge).
   min-width:0 lets inner grids (stat cards) reflow and wide tables scroll in-place. */
.admin-shell > main { min-width: 0; }
.admin-side {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  position: sticky; top: calc(var(--header-h) + 16px);
  align-self: start;
  /* The nav is long; give it its own scroll so it stays put (and fully reachable)
     while the data area scrolls independently, instead of the two fighting. */
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;   /* scrolling the panel doesn't drag the page */
  scrollbar-width: thin;
}
.admin-side::-webkit-scrollbar { width: 8px; }
.admin-side::-webkit-scrollbar-thumb { background: #d6dbe4; border-radius: 8px; }
@media (max-width: 900px) {
  /* On mobile the sidebar stacks on top — let it sit naturally, no inner scroll. */
  .admin-side { position: static; max-height: none; overflow: visible; top: auto; }
}
.admin-side h4 { margin: 8px 0; color: var(--color-primary-dark); font-family: var(--font-sans); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.admin-side a {
  display: block; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--color-text); font-size: .9rem;
}
.admin-side a:hover, .admin-side a.active { background: var(--color-bg-soft); color: var(--color-primary); }

/* Print-friendly subtle */
@media print {
  .site-header, .site-footer, .nav-toggle, .filter-bar, .form-actions { display: none !important; }
}

/* =========================================================
   REDESIGN 2026 — header, navigation, homepage components
   Appended last so these rules win over the originals above.
   ========================================================= */

/* Contain the off-canvas mobile menu so it can't widen the page.
   overflow-x: clip (not hidden) does NOT create a scroll container, so the
   sticky header keeps working. */
html, body { overflow-x: clip; }

/* Public pages: contain content to a centred max-width so it doesn't sprawl
   edge-to-edge on large desktops. (Admin/data-tool pages keep full width — they
   don't carry the body.site class.) */
body.site .container { max-width: 1600px; margin-left: auto; margin-right: auto; }

/* ---------- Sticky header + brand ---------- */
.site-header {
  position: sticky; top: 0; z-index: 1200;   /* above the mobile menu backdrop (1090) so the open drawer isn't dimmed/tap-blocked */
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 0 rgba(15,23,42,.04);
  /* MUST stay none: a backdrop-filter/filter here would make the header a
     containing block for the position:fixed mobile drawer, trapping it inside
     the 72px header (menu invisible). Overrides the old blur rule above. */
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.header-inner { display: flex; align-items: center; gap: 24px; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.brand img { height: 50px; width: auto; display: block; }
.brand-text { line-height: 1.05; }
.brand-text .en { display: block; font-family: var(--font-serif); font-weight: 700; font-size: 1.05rem; color: var(--color-primary-dark); }
.brand-text .hy { display: block; font-size: .78rem; color: var(--color-gold); }

/* ---------- Primary nav (desktop) ---------- */
.main-nav { display: flex; align-items: center; flex: 1 1 auto; }
/* Balance the header: logo on the left, nav links + Sign In grouped on the right. */
.main-nav ul.nav-list { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; list-style: none; margin: 0 0 0 auto; padding: 0; }
.nav-list .nav-link { white-space: nowrap; }
.nav-auth { display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; padding-left: 16px; }

/* Keep the whole header on one row on wide desktops, whatever the cascade does. */
@media (min-width: 1401px) {
  .header-inner, .main-nav { flex-wrap: nowrap; }
  .main-nav ul.nav-list, .nav-auth { flex-wrap: nowrap; }
}

.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-weight: 600; font-size: .95rem;
  color: var(--color-text); background: none; border: 0; cursor: pointer;
  white-space: nowrap; transition: color var(--transition), background var(--transition);
}
.nav-link:hover { color: var(--color-primary); background: var(--color-bg-alt); }
.nav-link.active { color: var(--color-primary); box-shadow: inset 0 -2px 0 var(--color-gold); border-radius: 0; }
.caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: .55; }

/* ---------- Dropdowns ---------- */
.has-dropdown { position: relative; }
.dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 1200;
  min-width: 230px; list-style: none; margin: 0; padding: 8px;
  background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.dropdown::before { /* hover bridge so the gap doesn't drop the menu */
  content: ""; position: absolute; top: -10px; left: 0; right: 0; height: 10px;
}
.has-dropdown:hover > .dropdown,
.has-dropdown:focus-within > .dropdown {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.dropdown a {
  display: block; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--color-text); font-weight: 500; font-size: .92rem;
}
.dropdown a:hover { background: var(--color-bg-alt); color: var(--color-primary); }

/* ---------- Sign In pill ---------- */
.nav-login {
  display: inline-block; background: var(--color-gold); color: var(--color-primary-dark);
  padding: 9px 22px; border-radius: 999px; font-weight: 700; font-size: .92rem;
  white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background var(--transition), transform var(--transition);
}
.nav-login:hover { background: var(--color-gold-dark); color: var(--color-primary-dark); transform: translateY(-1px); }
/* Logged-in auth buttons: both solid navy with WHITE text (readable, no clash). The
   logged-out gold "Sign In" pill (.nav-login) is untouched. Two-class selector so the
   white text wins over the .main-nav link colour. */
.nav-login.nav-login-portal, .nav-login.nav-login-alt { background: var(--color-primary); color: #fff; border: none; box-shadow: var(--shadow-sm); }
.nav-login.nav-login-portal:hover, .nav-login.nav-login-alt:hover { background: var(--color-primary-dark); color: #fff; }
.nav-signout { font-size: .9rem; font-weight: 600; color: var(--color-text-muted); white-space: nowrap; }
.nav-signout:hover { color: var(--color-accent); }

/* ---------- Visible keyboard focus ---------- */
.nav-link:focus-visible, .nav-login:focus-visible, .dropdown a:focus-visible, .brand:focus-visible, .nav-toggle:focus-visible {
  outline: 2px solid var(--color-gold); outline-offset: 2px; border-radius: var(--radius-sm);
}

/* ---------- Tagline strip ---------- */
.tagline-strip { background: var(--color-primary-dark); }
.tagline-strip ul {
  list-style: none; margin: 0; padding: 16px 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 0;
}
.tagline-strip li {
  display: inline-flex; align-items: center;
  font-family: var(--font-serif); font-size: 1.02rem; letter-spacing: .03em; color: #e7ecf5;
}
.tagline-strip li:not(:last-child)::after { content: "•"; color: var(--color-gold); margin: 0 22px; }

/* ---------- Membership CTA band ---------- */
.cta-band { background: linear-gradient(120deg, var(--color-accent-dark), var(--color-accent)); }
.cta-band .container { text-align: center; padding: 56px 0; }
.cta-band h2 { color: #fff; }
.cta-band p { color: #f4dfe2; max-width: 60ch; margin: 0 auto 24px; }

/* ---------- Portal strip ---------- */
.portal-strip {
  background: linear-gradient(120deg, var(--color-primary-dark), var(--color-primary));
  border-radius: var(--radius-lg); color: #fff;
  padding: clamp(28px, 4vw, 48px);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 22px;
}
.portal-strip .portal-copy { flex: 1 1 320px; }
.portal-strip h2 { color: #fff; margin: 0 0 8px; }
.portal-strip p { color: #d9e0ed; margin: 0; max-width: 60ch; }
.portal-strip .portal-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Mobile/narrow: hamburger + slide-in drawer (<=1200px) ----------
   Switches to the tidy drawer well before the one-line nav can overflow, so the
   Sign-out button never gets pushed off the right edge on narrower laptops. */
@media (max-width: 1400px) {
  .nav-toggle { display: inline-flex; margin-left: auto; position: relative; z-index: 1101; }

  /* Pin the header + its ☰ while scrolling. position:sticky silently breaks on
     iOS Safari when an ancestor uses overflow:clip (our html/body h-overflow
     guard) — so the header used to scroll away on phones. `fixed` doesn't depend
     on a scroll container, so it stays put; offset the body by the header height
     so nothing hides beneath it. (Same fix the scouts portal uses.) */
  .site-header { position: fixed; left: 0; right: 0; top: 0; }
  body.site { padding-top: var(--header-h); }

  /* Dimmed backdrop below the header; tapping it closes the menu (see main.js).
     Locking body scroll keeps the page still while the drawer is open. */
  body.nav-open { overflow: hidden; }
  body.nav-open::before {
    content: ""; position: fixed; left: 0; right: 0; top: var(--header-h); bottom: 0;
    z-index: 1090; background: rgba(12, 22, 44, .5);
  }

  .main-nav {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; z-index: 2000;
    width: min(320px, 85vw);
    display: flex; flex-direction: column; align-items: stretch; gap: 0;
    background: #fff; box-shadow: 2px 0 26px rgba(16,32,64,.30);
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    /* Slides in from the LEFT. Parked off-screen with a plain transform;
       overflow-x:clip on html/body stops the parked panel making a scrollbar.
       (The real fix for "menu never appears" is killing backdrop-filter on
       .site-header above — otherwise this fixed panel is trapped in the header.) */
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .main-nav.is-open { transform: translateX(0); }

  /* Controls pinned to the top of the drawer. Compact row (mirrors the scouts
     portal): search full-width, the icon controls clustered in a tidy row, then
     the auth buttons full-width — so a lone theme-moon or bell badge never floats
     on its own row with a big empty gap. `order` groups them regardless of the
     source order (View As sits between theme and bell in the markup). */
  .nav-auth {
    order: 1; margin: 0 0 12px; padding: 0 0 14px;
    border-bottom: 1px solid var(--color-bg-alt);
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px;
  }
  .nav-auth .nav-search { order: 0; flex: 1 1 100%; margin: 0; }
  .nav-auth .theme-toggle,
  .nav-auth .nav-bell {
    order: 1; flex: 0 0 auto; width: 44px; height: 44px; margin: 0; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-bg);
  }
  .nav-auth .nav-bell { position: relative; }
  .nav-login, .nav-login-alt { order: 2; flex: 1 1 100%; text-align: center; padding: 12px 18px; margin: 0; }
  .nav-signout { order: 2; flex: 1 1 100%; text-align: center; padding: 10px; margin: 0; }

  .nav-list { order: 2; flex-direction: column; align-items: stretch; gap: 0; width: 100%; }
  /* `.main-nav ul` (0,1,1) sets display:flex + align-items:center + flex-wrap on
     EVERY <ul>, which is more specific than `.nav-list`/`.dropdown` (0,1,0) — so it
     centres the drawer column AND lays each dropdown out as a HORIZONTAL row.
     Override it here (0,2,1) so everything stacks vertically, aligned left. */
  .main-nav ul.nav-list { align-items: stretch; flex-wrap: nowrap; }
  .main-nav ul.dropdown { display: block; flex-wrap: nowrap; }
  /* Force EVERY drawer link — plain <a> and dropdown <button> alike — into an
     identical full-width, left-aligned row. Needs a selector more specific than
     `.main-nav a` (0,1,1), which otherwise makes the <a> links inline-block +
     centred while the <button> toggles stay full-width flex (the "broken menu"). */
  .main-nav .nav-list > li > .nav-link {
    display: flex; box-sizing: border-box; width: 100%;
    justify-content: space-between; align-items: center; gap: 8px; text-align: left;
    padding: 15px 10px; font-size: 1rem;
    border-radius: 0; border-bottom: 1px solid var(--color-bg-alt);
  }
  .nav-link.active { box-shadow: none; border-left: 3px solid var(--color-gold); padding-left: 12px; }
  .caret { border-top-width: 6px; opacity: .7; transition: transform .2s ease; }

  /* Dropdowns become tap-to-expand accordions, visually nested under their parent. */
  .has-dropdown { position: static; }
  .dropdown {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: 0; border-radius: 0; margin: 0; padding: 0;
    background: var(--color-bg-alt);
    max-height: 0; overflow: hidden; transition: max-height .25s ease;
  }
  .dropdown a { padding: 13px 8px 13px 24px; border-bottom: 1px solid rgba(0,0,0,.05); font-weight: 500; font-size: .95rem; }
  .dropdown a:last-child { border-bottom: 0; }
  .has-dropdown.open > .dropdown { max-height: 380px; }
  .has-dropdown.open > .dd-toggle { background: var(--color-bg-alt); }
  .has-dropdown.open > .dd-toggle .caret { transform: rotate(180deg); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .main-nav, .dropdown, .nav-login, .card, .quick-card { transition: none; }
}

/* =========================================================
   Dark theme — activated by data-theme="dark" on <html>.
   Flips the design tokens and the surfaces that hardcode white,
   so the shared chrome (header, sidebar, cards, tables, inputs,
   dropdowns, footer) reads correctly in dark mode. Brand colours
   (primary/accent/gold) are kept so buttons & dark panels are
   unchanged; headings/links/outline buttons are re-coloured for
   contrast. The light theme is untouched.
   ========================================================= */
[data-theme="dark"] {
  --color-bg:          #0f1622;
  --color-bg-alt:      #16202f;
  --color-bg-soft:     #1c2738;
  --color-border:      #2b3750;
  --color-text:        #e6eaf2;
  --color-text-soft:   #c4ccda;
  --color-text-muted:  #93a0b6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow:    0 6px 16px rgba(0,0,0,.5);
  --shadow-lg: 0 14px 36px rgba(0,0,0,.6);
  --link:       #7da9ee;   /* content links read light-blue on dark… */
  --link-hover: #a9c6f5;   /* …but buttons/nav keep their own colour */
  /* Brand blue/burgundy are used as TEXT all over (incl. inline
     color:var(--color-primary) styles) — re-point them LIGHT so every bit of
     blue text reads on dark. Elements that use them as BACKGROUNDS are pinned
     dark just below, so their white text stays legible. */
  --color-primary:       #8fb4f2;
  --color-primary-dark:  #aac6f6;
  --color-primary-light: #b9d0f8;
  --color-accent:        #e79aa4;
  --color-accent-dark:   #f0aeb6;
}
/* Keep the few blue/burgundy BACKGROUNDS dark (white text needs a dark fill). */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-outline:hover,
[data-theme="dark"] .main-nav .nav-cta,
[data-theme="dark"] .main-nav .nav-cta:hover,
[data-theme="dark"] .nav-login-alt,
[data-theme="dark"] .nav-login-alt:hover,
[data-theme="dark"] .filter-btn.is-active,
[data-theme="dark"] .stage-bar { background: #1a3a6c !important; color: #fff !important; border-color: #1a3a6c !important; }
/* dark: both navy solid, white text */
[data-theme="dark"] .nav-login.nav-login-portal, [data-theme="dark"] .nav-login.nav-login-alt { background: #24487f !important; color: #fff !important; border: none !important; }
[data-theme="dark"] .nav-login.nav-login-portal:hover, [data-theme="dark"] .nav-login.nav-login-alt:hover { background: #1a3a6c !important; color: #fff !important; }
[data-theme="dark"] .btn-accent,
[data-theme="dark"] .btn-accent:hover { background: #8b1c2b !important; color: #fff !important; border-color: #8b1c2b !important; }
/* Components that fill with the brand blue + white text (card headers, avatars,
   selected filter chips/tabs) — keep them navy so the white text still reads.
   These are exactly the classes that use background:var(--color-primary). */
[data-theme="dark"] .filter-btn.is-active,
[data-theme="dark"] .seg a.on, [data-theme="dark"] .seg-opt.is-on,
[data-theme="dark"] .tr-card.total,
[data-theme="dark"] .sc-dh, [data-theme="dark"] .me-h, [data-theme="dark"] .pay-h,
[data-theme="dark"] .scal-dh, [data-theme="dark"] .fgc-av, [data-theme="dark"] .hub-av,
[data-theme="dark"] .ce-type,
[data-theme="dark"] .on, [data-theme="dark"] .cur {
  background: #1a3a6c !important; color: #fff !important; border-color: #1a3a6c !important;
}
/* Sweep: many page <style> blocks hardcode a white card/panel fill with no dark
   override, so in dark mode their (now-light) text sits on white = unreadable.
   Flip these card/panel/surface classes to the dark surface. Excludes badges,
   carousel dots, the logo plate, the print-doc .page (those want to stay light),
   and pages that already self-handle (their same-specificity rule wins, later). */
[data-theme="dark"] .ac, [data-theme="dark"] .act, [data-theme="dark"] .box,
[data-theme="dark"] .ci, [data-theme="dark"] .cluster, [data-theme="dark"] .cx-card,
[data-theme="dark"] .dcard, [data-theme="dark"] .doc, [data-theme="dark"] .eval-q,
[data-theme="dark"] .fam-card, [data-theme="dark"] .fam-prompt, [data-theme="dark"] .hub,
[data-theme="dark"] .hub-prog, [data-theme="dark"] .iv-card, [data-theme="dark"] .login-card,
[data-theme="dark"] .lx-cluster, [data-theme="dark"] .merge-group, [data-theme="dark"] .mv-card,
[data-theme="dark"] .nt, [data-theme="dark"] .ov-card, [data-theme="dark"] .role-group,
[data-theme="dark"] .wel-speak, [data-theme="dark"] .yr-m, [data-theme="dark"] .cal-cell,
[data-theme="dark"] .cando, [data-theme="dark"] .hr-tile.has, [data-theme="dark"] .ce,
[data-theme="dark"] .lk, [data-theme="dark"] .admin-search, [data-theme="dark"] .nav-search,
[data-theme="dark"] .day-list .d-row {
  background: var(--color-bg-alt); border-color: var(--color-border);
}
[data-theme="dark"] html { background: var(--color-bg); }
[data-theme="dark"] body { background: var(--color-bg); color: var(--color-text); }
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3,
[data-theme="dark"] h4, [data-theme="dark"] h5 { color: var(--color-text) !important; }
/* Nav + dropdown links read white on the dark header (not link-blue). */
[data-theme="dark"] .main-nav a,
[data-theme="dark"] .dropdown a { color: #fff; }
[data-theme="dark"] .main-nav a:hover,
[data-theme="dark"] .main-nav a.active,
[data-theme="dark"] .dropdown a:hover { color: #fff; background: rgba(255,255,255,.08); }

/* Surfaces that hardcode white in the light theme. */
[data-theme="dark"] .site-header { background: #121b29ee; }
/* Header text needs to read on the now-dark header. */
[data-theme="dark"] .brand-text .en { color: var(--color-text); }
[data-theme="dark"] .nav-link:hover, [data-theme="dark"] .nav-link.active { color: #7da9ee; }
[data-theme="dark"] .card,
[data-theme="dark"] .quick-card,
[data-theme="dark"] .event-card,
[data-theme="dark"] .stat,
[data-theme="dark"] .seating-summary,
[data-theme="dark"] .auth-wrap,
[data-theme="dark"] .admin-side,
[data-theme="dark"] .dropdown,
[data-theme="dark"] .filter-btn { background: var(--color-bg-alt); border-color: var(--color-border); }
/* Stat-tile numbers use the dark brand colour in light mode — lift them so they read on a dark card. */
[data-theme="dark"] .stat .value { color: var(--color-text); }
/* Card titles (homepage program tiles, document cards…) use the dark brand colour — lift on dark. */
[data-theme="dark"] .quick-card .title { color: var(--color-text); }
[data-theme="dark"] .event-card .title { color: var(--color-text); }

/* Brand-blue blocks: tone the bright blue down to a dark navy so the whole page
   reads as one dark theme (white text on them is unchanged). */
[data-theme="dark"] .hero {
  background:
    linear-gradient(135deg, rgba(9,15,26,.96), rgba(18,29,48,.92)),
    radial-gradient(ellipse at top right, rgba(201,161,74,.20), transparent 60%);
}
[data-theme="dark"] .page-hero { background: #13203a; }
[data-theme="dark"] .tagline-strip { background: #0d1626; }
[data-theme="dark"] .site-footer { background: #0d1626; }
[data-theme="dark"] .portal-strip { background: linear-gradient(120deg, #0f1a30, #16243c); }
/* HR "needs attention" tiles: keep counts/labels readable on the dark card (the cream highlighted tiles keep their dark ink). */
[data-theme="dark"] .hr-tile:not(.has) .n { color: #9db8e6; }
[data-theme="dark"] .hr-tile:not(.has) .l { color: var(--color-text-soft); }
[data-theme="dark"] table.data, [data-theme="dark"] .table { background: var(--color-bg-alt); color: var(--color-text); }
[data-theme="dark"] table.data th, [data-theme="dark"] .table th { background: var(--color-bg-soft); color: var(--color-text); }
[data-theme="dark"] table.data td, [data-theme="dark"] .table td,
[data-theme="dark"] table.data th, [data-theme="dark"] .table th { border-color: var(--color-border); }
[data-theme="dark"] table.data tr:nth-child(even) td { background: rgba(255,255,255,.02); }

/* Form controls. */
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
  background: var(--color-bg-soft); color: var(--color-text); border-color: var(--color-border);
}
[data-theme="dark"] input::placeholder, [data-theme="dark"] textarea::placeholder { color: var(--color-text-muted); }
[data-theme="dark"] .nav-search, [data-theme="dark"] .admin-search { background: var(--color-bg-soft); border-color: var(--color-border); }
[data-theme="dark"] .nav-search input, [data-theme="dark"] .admin-search input { color: var(--color-text); background: transparent; }

/* Outline / ghost buttons need lighter ink on a dark page. */
[data-theme="dark"] .btn-outline { color: #cdd8ee; border-color: var(--color-border); }
[data-theme="dark"] .btn-ghost { color: var(--color-text); }

/* Mobile nav drawer (it hardcodes #fff). */
@media (max-width: 1400px) {
  [data-theme="dark"] .main-nav { background: var(--color-bg-alt); }
}

/* Rescue inline NEUTRAL dark-text colours (blues/slates used as body/heading
   text) so they read on dark surfaces. Semantic colours (red/green/amber) are
   intentionally left — they sit on their own light badge/notice backgrounds. */
[data-theme="dark"] [style*="color:#11264a" i],
[data-theme="dark"] [style*="color:#1f2533" i],
[data-theme="dark"] [style*="color:#2b3a55" i],
[data-theme="dark"] [style*="color:#111827" i],
[data-theme="dark"] [style*="color:#1f2937" i],
[data-theme="dark"] [style*="color:#374151" i] { color: var(--color-text) !important; }
[data-theme="dark"] [style*="color:#41506b" i],
[data-theme="dark"] [style*="color:#475569" i] { color: var(--color-text-soft) !important; }
[data-theme="dark"] [style*="color:#6f7a8c" i],
[data-theme="dark"] [style*="color:#9aa3b2" i],
[data-theme="dark"] [style*="color:#5b6573" i],
[data-theme="dark"] [style*="color:#5b6472" i],
[data-theme="dark"] [style*="color:#666677" i] { color: var(--color-text-muted) !important; }

/* Callout / notice boxes → cohesive dark with light, readable ink. */
[data-theme="dark"] .notice          { background:#1b2333; color:var(--color-text-soft); }
[data-theme="dark"] .notice-info     { background:#16243c; color:#cdd9ee; }
[data-theme="dark"] .notice-warning  { background:#2a2110; color:#e8cfa0; }
[data-theme="dark"] .notice-danger   { background:#2a1518; color:#f0b8be; }
[data-theme="dark"] .notice-success  { background:#142a20; color:#b6e3c8; }
[data-theme="dark"] .success-message { background:#142a20; border-color:#1f4f37; color:#b6e3c8; }

/* The toggle button itself (lives in the header). */
.theme-toggle { background: none; border: none; cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 6px 8px; border-radius: 8px; color: inherit; }
.theme-toggle:hover { background: var(--color-bg-soft); }

/* ---- Logo + header text in dark ---- */
.brand .brand-logo-white { display: none; }
[data-theme="dark"] .brand .brand-logo-color { display: none; }
[data-theme="dark"] .brand .brand-logo-white { display: block; }
[data-theme="dark"] .nav-link { color: #fff; }
[data-theme="dark"] .brand-text .en { color: #fff; }

/* ---- Custom content cards (defined in page <style> blocks with a hardcoded
   white background, so the global .card theming missed them). Theme them dark
   so their now-light text reads. Light theme is untouched. ---- */
[data-theme="dark"] .hub,
[data-theme="dark"] .hub-prog,
[data-theme="dark"] .hub-c,
[data-theme="dark"] .box,
[data-theme="dark"] .fam-card,
[data-theme="dark"] .fam-prompt,
[data-theme="dark"] .cx-card,
[data-theme="dark"] .iv-card,
[data-theme="dark"] .ov-card,
[data-theme="dark"] .mv-card,
[data-theme="dark"] .merge-group,
[data-theme="dark"] .role-group,
[data-theme="dark"] .eval-q,
[data-theme="dark"] .cluster,
[data-theme="dark"] .lx-cluster,
[data-theme="dark"] .cal-cell { background: var(--color-bg-alt); border-color: var(--color-border); }
/* Blue accent numbers / summaries inside those cards. */
[data-theme="dark"] .hub-c .n { color: var(--color-text); }
[data-theme="dark"] .ring text { fill: var(--color-text); }
[data-theme="dark"] .prof-check > summary { color: var(--color-text); }

/* Show / hide password toggle (login, reset, change, set password). */
.pw-wrap{position:relative;}
.pw-wrap input{padding-right:44px;}
.pw-toggle{position:absolute;top:0;right:0;height:100%;width:42px;display:flex;
  align-items:center;justify-content:center;background:none;border:none;padding:0;
  cursor:pointer;color:#6b7280;}
.pw-toggle:hover{color:#11264a;}
.pw-toggle:focus-visible{outline:2px solid #c9a14a;outline-offset:-2px;border-radius:8px;}
.pw-toggle svg{width:20px;height:20px;display:block;}
.pw-toggle .icon-hide{display:none;}
.pw-toggle.is-visible .icon-show{display:none;}
.pw-toggle.is-visible .icon-hide{display:block;}
[data-theme="dark"] .pw-toggle:hover{color:var(--color-text);}

/* ============ Finance module (manual-aligned) ============ */
.fin-subnav{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 16px;padding-bottom:10px;border-bottom:1px solid var(--color-border);}
.fin-subnav a{font-size:.8rem;padding:5px 11px;border-radius:999px;border:1px solid var(--color-border);color:var(--color-text-muted);text-decoration:none;white-space:nowrap;}
.fin-subnav a:hover{border-color:var(--color-primary);color:var(--color-primary);}
.fin-subnav a.on{background:var(--color-primary-dark);color:#fff;border-color:var(--color-primary-dark);}
.fin-subnav-sep{width:1px;background:var(--color-border);margin:3px 6px;align-self:stretch;}
.fin-group-h{margin:22px 0 4px;font-size:.78rem;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-muted);font-weight:700;}
/* auto-fit (not auto-fill) so a few cards stretch to fill the row instead of
   leaving phantom empty tracks that squeeze each card — the min lets 4-col
   money tables breathe; minmax(0,…) keeps a wide table scrolling in its cell. */
.fin-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(320px,100%),1fr));gap:14px;margin:12px 0;}
/* Shared finance page header: back-link + title on the left, actions on the right. */
.fin-head{display:flex;align-items:flex-end;justify-content:space-between;gap:14px;flex-wrap:wrap;margin:0 0 16px;}
.fin-head-l{min-width:0;}
.fin-head .fin-back{display:inline-block;font-size:.82rem;color:var(--color-text-muted);text-decoration:none;margin-bottom:1px;}
.fin-head .fin-back:hover{color:var(--color-primary);}
.fin-head h1{margin:2px 0 0;}
.fin-head .fin-sub{margin:5px 0 0;color:var(--color-text-muted);font-size:.9rem;max-width:70ch;}
.fin-head-r{display:flex;gap:8px;flex-wrap:wrap;align-items:center;flex-shrink:0;}
.fin-card{display:block;background:var(--color-surface,#fff);border:1px solid var(--color-border);border-radius:12px;padding:16px 18px;text-decoration:none;color:inherit;transition:border-color .12s,transform .12s;}
.fin-card:hover{border-color:var(--color-primary);transform:translateY(-1px);}
.fin-card .ic{font-size:1.5rem;}
.fin-card h4{margin:6px 0 4px;font-size:1rem;color:var(--color-primary-dark);}
.fin-card p{margin:0;font-size:.8rem;color:var(--color-text-muted);line-height:1.4;}
.fin-kpis{display:flex;gap:10px;flex-wrap:wrap;margin:10px 0;}
.fin-kpi{flex:1;min-width:150px;background:var(--color-surface,#fff);border:1px solid var(--color-border);border-radius:10px;padding:14px 16px;}
.fin-kpi .n{font-size:1.5rem;font-weight:700;line-height:1;}
.fin-kpi .l{font-size:.75rem;color:var(--color-text-muted);margin-top:6px;}
.fin-tag{display:inline-block;font-size:.68rem;font-weight:700;padding:2px 8px;border-radius:6px;letter-spacing:.02em;}
.fin-tag.draft{background:#eceef5;color:#474d72;} .fin-tag.submitted{background:#e7eefb;color:#1e4b91;}
.fin-tag.approved,.fin-tag.signed,.fin-tag.closed,.fin-tag.done{background:#e6f0e8;color:#1f7a3d;}
.fin-tag.rejected,.fin-tag.over{background:#fbe9e6;color:#b02418;}
.fin-tag.paid{background:#e6f0e8;color:#1f7a3d;} .fin-tag.open,.fin-tag.review,.fin-tag.pending{background:#f8efd7;color:#8a5800;}
.fin-pos{color:#1f9d55;font-weight:600;} .fin-neg{color:#b91c1c;font-weight:600;}
.fin-manual{font-size:.72rem;color:var(--color-text-muted);background:var(--color-surface,#f7f8fb);border:1px dashed var(--color-border);border-radius:6px;padding:2px 8px;display:inline-block;}
.fin-form label{display:block;font-size:.78rem;font-weight:600;color:var(--color-text-muted);margin:10px 0 3px;}
.fin-form input,.fin-form select,.fin-form textarea{width:100%;padding:8px 10px;border:1px solid var(--color-border);border-radius:8px;font-family:inherit;font-size:.9rem;background:var(--color-surface,#fff);color:inherit;}
.fin-form .row{display:flex;gap:12px;flex-wrap:wrap;} .fin-form .row>div{flex:1;min-width:160px;}
.fin-check{display:flex;align-items:center;gap:10px;padding:9px 12px;border:1px solid var(--color-border);border-radius:8px;margin:6px 0;}
.fin-check.is-done{background:#e6f0e8;border-color:#b6d3bd;}
/* cash-flow forecast (finance-cashflow.php) */
.cf-chart{margin-top:12px;overflow-x:auto;}
.cf-chart svg{min-width:560px;display:block;}
.cf-legend{font-size:.74rem;color:var(--color-text-muted);display:inline-flex;gap:12px;align-items:center;flex-wrap:wrap;}
.cf-legend .k{display:inline-block;width:11px;height:11px;border-radius:2px;margin-right:4px;vertical-align:middle;}
.cf-note{font-size:.78rem;color:var(--color-text-muted);line-height:1.5;margin:10px 0 0;}
.cf-monthgrid{font-size:.78rem;} .cf-monthgrid td,.cf-monthgrid th{padding:4px 8px;white-space:nowrap;font-variant-numeric:tabular-nums;}
/* interactive cash-flow charts (finance-cashflow-history.php) */
.chartbox .chart-head{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap;}
.chart-zoom{display:inline-flex;gap:4px;}
.chart-zoom button{font-size:.8rem;line-height:1;padding:5px 10px;border:1px solid var(--color-border);border-radius:7px;background:var(--color-surface,#fff);color:inherit;cursor:pointer;}
.chart-zoom button:hover{border-color:var(--color-primary);color:var(--color-primary);}
.chart-legend{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0;}
.chart-legend .cl{display:inline-flex;align-items:center;gap:6px;font-size:.78rem;padding:4px 11px;border:1px solid var(--color-border);border-radius:999px;background:var(--color-surface,#fff);cursor:pointer;color:inherit;user-select:none;}
.chart-legend .cl i{width:11px;height:11px;border-radius:3px;background:var(--c);flex:0 0 auto;}
.chart-legend .cl.off{opacity:.42;text-decoration:line-through;}
.chart-wrap{position:relative;}
.chart-wrap canvas{width:100%;height:340px;display:block;touch-action:none;cursor:crosshair;}
.chart-tip{position:absolute;display:none;pointer-events:none;background:#1f2937;color:#fff;font-size:.72rem;line-height:1.5;padding:6px 9px;border-radius:6px;white-space:nowrap;z-index:5;box-shadow:0 2px 8px rgba(0,0,0,.25);}
.chart-hint{font-size:.72rem;color:var(--color-text-muted);margin:2px 0 0;}
