/* ==========================================================================
   SAMPARK SETU ADMIN — Design System
   Single source of truth for tokens (color/type/space/radius/shadow) and
   shared components. Page-level <style> blocks should only add layout,
   never redefine colors/fonts/radii — always reference the vars below.

   Brand palette drawn from the org's logo (media/logo/mainlogo.png): a
   royal blue/indigo ring shading into violet, a golden-yellow medallion
   and sunburst, and orange at the sunburst's outer tips. Semantic green
   (success/status) and red (danger only) are deliberately kept as a
   separate scale from the brand colors below, per design direction.
   ========================================================================== */

:root {
  /* ---- Typography (global, exact tokens — do not hardcode elsewhere) ---- */
  --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* ---- Charcoal neutral scale ---- */
  --charcoal-950: #14171a;
  --charcoal-900: #1b1f22;
  --charcoal-800: #23282b;
  --charcoal-700: #2d3336;
  --charcoal-600: #3d4448;
  --charcoal-500: #565f63;
  --charcoal-400: #767f83;
  --charcoal-300: #9aa1a4;
  --charcoal-200: #c2c7c9;
  --charcoal-100: #e3e6e7;
  --charcoal-50: #f5f6f6;

  /* ---- Royal blue/violet primary scale (brand) ---- */
  --royal-900: #1e2260;
  --royal-800: #262b7d;
  --royal-700: #2f3699;
  --royal-600: #3b45b8;
  --royal-500: #4f5ad1;
  --royal-400: #7680e0;
  --royal-300: #a6aeec;
  --royal-100: #e1e4f9;
  --royal-50: #f1f2fd;
  --royal-600-rgb: 59, 69, 184;

  /* ---- Violet — gradient endpoint paired with royal blue ---- */
  --violet-700: #5c2e8c;
  --violet-600: #6f3aa3;
  --violet-500: #8a4fbe;

  /* ---- Golden yellow accent scale (from the logo's medallion/sunburst) ---- */
  --gold-900: #6b4400;
  --gold-800: #8a5900;
  --gold-700: #ad7200;
  --gold-600: #d08a00;
  --gold-500: #e9a324;
  --gold-400: #f0b94e;
  --gold-300: #f6d08b;
  --gold-100: #fbeacb;
  --gold-50: #fdf5e7;

  /* ---- Sunset orange accent — gradient endpoint paired with gold ---- */
  --sunset-600: #e2650f;
  --sunset-500: #f1791f;
  --sunset-100: #fce0c8;

  /* ---- Subtle brand gradients — used sparingly on a few key surfaces
         (primary buttons, header CTA, sidebar active state, avatars),
         not applied indiscriminately everywhere. ---- */
  --brand-gradient: linear-gradient(135deg, var(--royal-600) 0%, var(--violet-600) 100%);
  --brand-gradient-hover: linear-gradient(135deg, var(--royal-700) 0%, var(--violet-700) 100%);
  --accent-gradient: linear-gradient(135deg, var(--gold-500) 0%, var(--sunset-500) 100%);

  /* ---- Dedicated green scale — success/status only, intentionally kept
         separate from the royal-blue brand scale above so "success" never
         drifts if the brand palette changes again. ---- */
  --green-800: #14753f;
  --green-600: #1e9e5a;
  --green-300: #9be0bb;
  --green-50: #e8f8ef;

  /* ---- Semantic status colors (kept distinct from brand) ---- */
  --color-success: var(--green-600);
  --color-success-strong: var(--green-800);
  --color-success-bg: var(--green-50);
  --color-success-border: var(--green-300);
  --color-danger: #c8323f;
  --color-danger-bg: #fbeaec;
  --color-danger-border: #f0b8bd;
  --color-warning: var(--gold-700);
  --color-warning-bg: var(--gold-50);
  --color-warning-border: var(--gold-300);
  --color-info: #0f7c8c;
  --color-info-bg: #e3f4f6;
  --color-info-border: #a9dbe2;

  /* ---- Surfaces / text ---- */
  --surface-page: #f4f6f5;
  --surface-card: #ffffff;
  --surface-sidebar: var(--charcoal-950);
  --surface-sidebar-hover: rgba(255, 255, 255, 0.06);
  --surface-sidebar-active: rgba(59, 69, 184, 0.30);
  --border-color: var(--charcoal-100);
  --text-primary: var(--charcoal-900);
  --text-secondary: var(--charcoal-500);
  --text-muted: var(--charcoal-400);
  --text-on-dark: #eef1f0;
  --text-on-dark-muted: #9aa5a1;

  /* ---- Spacing scale (4px base) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 7px;
  --space-4: 8px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* ---- Radius scale ---- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 999px;

  /* ---- Shadows (charcoal-tinted, not purple) ---- */
  --shadow-sm: 0 1px 2px rgba(20, 23, 26, 0.06);
  --shadow-md: 0 4px 14px rgba(20, 23, 26, 0.08);
  --shadow-lg: 0 12px 32px rgba(20, 23, 26, 0.12);

  --sidebar-width: 260px;
  --sidebar-width-collapsed: 76px;
  --header-height: 64px;

  /* ---- Map Bootstrap variables onto our tokens so untouched Bootstrap
         components (badges, alerts, buttons, spinners, modals, switches)
         re-skin automatically ---- */
  --bs-body-font-family: var(--font-sans);
  --bs-body-color: var(--text-primary);
  --bs-body-bg: var(--surface-page);
  --bs-border-radius: var(--radius-md);
  --bs-border-radius-sm: var(--radius-sm);
  --bs-border-radius-lg: var(--radius-lg);
  --bs-primary: var(--royal-600);
  --bs-primary-rgb: 59, 69, 184;
  --bs-link-color: var(--royal-700);
  --bs-link-hover-color: var(--royal-800);
  --bs-focus-ring-color: rgba(59, 69, 184, 0.25);
  --bs-success: var(--color-success);
  --bs-danger: var(--color-danger);
  --bs-warning: var(--color-warning);
  --bs-info: var(--color-info);
  --bs-card-spacer-y: var(--space-4);
  --bs-card-spacer-x: var(--space-4);
  --bs-modal-padding: var(--space-4);
}

/* ==========================================================================
   Base
   ========================================================================== */

html, body {
  font-family: var(--font-sans);
  background-color: var(--surface-page);
  color: var(--text-primary);
}

code, pre, kbd, .font-mono {
  font-family: var(--font-mono);
}

a {
  color: var(--royal-700);
}
a:hover {
  color: var(--royal-800);
}

/* ==========================================================================
   Header
   ========================================================================== */

.app-header {
  height: var(--header-height);
  background: var(--surface-sidebar);
  color: var(--text-on-dark);
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  /* No left padding: .app-header-left's box must start flush at x=0, same as
     .app-sidebar below it, so their widths (and the toggle button sitting on
     .app-header-left's right edge) actually line up with the sidebar edge. */
  padding: 0 var(--space-4) 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Width-matched to the sidebar's current width (and transitions together
   with it) so this column's right edge always lines up with the sidebar's
   right edge below it — that shared edge is where the collapse toggle sits. */
.app-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  position: relative;
  width: var(--sidebar-width);
  padding-left: var(--space-4);
  box-sizing: border-box;
  transition: width 0.2s ease;
}
body.sidebar-collapsed .app-header-left {
  width: var(--sidebar-width-collapsed);
  /* Center the logo in the narrower rail so it lines up with the centered
     nav icons below it (see body.sidebar-collapsed .sidebar-nav .nav-link). */
  justify-content: center;
  padding-left: 0;
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--text-on-dark);
  flex-shrink: 0;
}

.app-header .brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.app-header .brand-text {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--text-on-dark);
  white-space: nowrap;
}

body.sidebar-collapsed .app-header .brand-text {
  display: none;
}

/* Sits on the boundary between .app-header-left's column and the rest of the
   header — straddling the same vertical line as the sidebar's right edge
   below it — rather than taking up its own space in the header's flex row
   or the sidebar's nav flow. Positioned (not flex-flowed) on purpose. */
.sidebar-collapse-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-on-dark-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
  position: absolute;
  top: 50%;
  right: -17px;
  transform: translateY(-50%);
  z-index: 2;
}
.sidebar-collapse-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-on-dark);
}

.app-page-title {
  margin: 0;
  /* Clears the collapse toggle, which straddles .app-header-left's right
     edge right where this element starts — no border here on purpose, the
     toggle button itself now marks that boundary. */
  padding-left: var(--space-6);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-on-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}
.app-page-title:empty {
  padding-left: 0;
}

/* Page-supplied header actions (e.g. "Add New Album"), sitting left of the
   user trigger. Empty on pages that don't fill the header_actions block, so
   it drops out of the header's flex layout entirely and changes nothing
   there. */
.app-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.app-header-actions:empty {
  display: none;
}
.app-header-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--brand-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-4);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.15s ease;
}
.app-header-btn:hover {
  filter: brightness(1.08);
  color: #fff;
}

.header-user {
  position: relative;
  /* Always pinned to the header's right edge, independent of whether
     .app-page-title (the flex-grow spacer before it) is visible. */
  margin-left: auto;
}

.header-user-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-on-dark);
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: background-color 0.15s ease;
}
.header-user-trigger:hover {
  background: rgba(255, 255, 255, 0.06);
}

.header-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.header-user-name {
  font-size: 0.875rem;
  font-weight: 500;
}

.header-user .dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  min-width: 160px;
  padding: var(--space-2);
  margin: 0;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.header-user:hover .dropdown-menu,
.header-user:focus-within .dropdown-menu {
  display: block;
}
.header-user .dropdown-menu a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}
.header-user .dropdown-menu a:hover {
  background: var(--charcoal-50);
  color: var(--color-danger);
}

/* ==========================================================================
   Layout shell
   ========================================================================== */

.app-shell {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--header-height));
}

/* ==========================================================================
   Sidebar — compact, expandable, collapses to an icon rail with tooltips.
   Pinned below the sticky header with its own scrollbar, independent of the
   page content, which is the thing that actually scrolls.
   ========================================================================== */

.app-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface-sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  transition: width 0.2s ease;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-x: hidden;
  overflow-y: auto;
  /* `position: sticky` always creates its own stacking context (per spec),
     but with no z-index it defaults to "auto" — its rank against unrelated
     .content descendants then depends on tree order and on whatever those
     descendants themselves do with position/z-index, which varies page to
     page. That's why the collapsed-sidebar flyout (position: fixed, nested
     inside this element) could end up rendering behind cards/tables on some
     pages despite its own z-index: 1040 — that value only orders it among
     siblings *within* this stacking context, not against the rest of the
     page. Giving the sidebar itself an explicit z-index makes its whole
     subtree — flyout included — reliably outrank ordinary page content
     everywhere, while still sitting below the header and Bootstrap modals. */
  z-index: 1025;
}

body.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-width-collapsed);
}

.sidebar-nav {
  list-style: none;
  padding: var(--space-4) var(--space-3);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav .nav-item {
  position: relative;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  color: var(--text-on-dark-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.sidebar-nav .nav-link:hover {
  background: var(--surface-sidebar-hover);
  color: var(--text-on-dark);
}

.sidebar-nav .nav-link i.nav-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.95rem;
}

.sidebar-nav .nav-link .nav-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav .nav-link .chevron {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: var(--text-on-dark-muted);
}

.sidebar-nav .nav-item.expanded > .nav-link .chevron {
  transform: rotate(180deg);
}

.sidebar-nav .nav-link.active,
.sidebar-nav .nav-link.dashboard-active {
  background: var(--surface-sidebar-active);
  color: #fff;
}
.sidebar-nav .nav-link.active i.nav-icon,
.sidebar-nav .nav-link.dashboard-active i.nav-icon {
  /* Gold, not blue, so the active icon pops against the royal-blue wash
     above it instead of blending in — echoes the logo's blue-and-gold pairing. */
  color: var(--gold-400);
}

.sidebar-nav .submenu {
  list-style: none;
  padding: 2px 0 2px var(--space-5);
  margin: 0;
  gap: 2px;
  /* No `display` here on purpose: Bootstrap's own .collapse rule (display:
     none unless .show is present) must be the thing that decides visibility.
     Setting display:flex unconditionally here used to have equal specificity
     to — and load after, so beat — Bootstrap's hide rule, which is why every
     submenu rendered open regardless of its actual collapsed/expanded state. */
}
.sidebar-nav .submenu.show {
  display: flex;
  flex-direction: column;
}

.sidebar-nav .submenu .nav-link {
  padding: var(--space-2) var(--space-3);
  font-weight: 400;
  font-size: 0.8125rem;
}

.sidebar-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-on-dark-muted);
  padding: var(--space-4) var(--space-3) var(--space-1);
}

/* Collapsed (icon-rail) state: hide section labels/chevrons, center icons,
   rely on title attributes + bootstrap tooltips for identification. Submenus
   are handled separately below — sections that have one (Members, Designees,
   Executive, Albums, Banners) get a flyout instead of losing their items. */
body.sidebar-collapsed .sidebar-section-label,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .chevron {
  display: none !important;
}
body.sidebar-collapsed .sidebar-nav .nav-link {
  justify-content: center;
  padding: var(--space-3);
}
body.sidebar-collapsed .sidebar-nav .nav-link i.nav-icon {
  width: auto;
  font-size: 1.05rem;
}

/* Collapsed sidebar flyout: a section's submenu pops out to the right on
   hover or tap, instead of the submenu being reachable only when the
   sidebar is expanded. Positioned with `position: fixed` (JS sets top/left
   inline to the icon's actual on-screen position) rather than `absolute`,
   because `.app-sidebar` needs `overflow-y: auto` for its own scrollbar —
   and per the CSS overflow spec, pairing that with overflow-x:visible just
   gets silently coerced back to overflow-x:auto by the browser, which would
   still clip an absolutely-positioned flyout at the sidebar's right edge.
   `position: fixed` escapes that clipping entirely. */
body.sidebar-collapsed .sidebar-nav .nav-item > .submenu {
  display: none;
}
body.sidebar-collapsed .sidebar-nav .nav-item > .submenu.flyout-visible {
  display: flex !important;
  flex-direction: column;
  position: fixed;
  min-width: 200px;
  margin: 0;
  padding: var(--space-2);
  gap: 2px;
  background: var(--charcoal-900);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1040;
}
body.sidebar-collapsed .sidebar-nav .nav-item > .submenu.flyout-visible .nav-link {
  justify-content: flex-start;
  padding: var(--space-2) var(--space-3);
  white-space: nowrap;
}
body.sidebar-collapsed .sidebar-nav .nav-item > .submenu.flyout-visible .nav-label {
  display: inline !important;
}
body.sidebar-collapsed .sidebar-nav .nav-item > .submenu.flyout-visible i.nav-icon {
  width: 16px;
  font-size: 0.85rem;
}

/* ==========================================================================
   Content area
   ========================================================================== */

.content {
  flex: 1;
  padding: var(--space-4);
  background: var(--surface-page);
  min-width: 0;
  /* Bootstrap's .row applies negative left/right margins (to offset its
     .col-* children's padding) that only stay contained when a parent's
     padding is at least as large as that overshoot. .content's padding is
     smaller than Bootstrap's default row gutter on pages that place a .row
     directly inside .content (e.g. the dashboard's stat-card rows) rather
     than inside a further-padded wrapper like .card-body — so the row's
     phantom edge spilled a few pixels past .content, then past .app-shell,
     causing a page-wide horizontal scrollbar (and the scrollbar itself
     eating a sliver of vertical space). Clipping it here contains only that
     invisible negative-margin overshoot — no real content is ever meant to
     extend past .content, so nothing visible is affected — and fixes this
     for any current or future page with the same pattern, not just this one. */
  overflow-x: hidden;
}

/* The page title now lives in .app-page-title in the app header, not here —
   keeps the content area free for actual content instead of a big heading. */

.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

/* ---- Tighter, consistent spacing throughout .content: Bootstrap's spacer
   utilities compile to fixed rem values (not CSS vars), so the common ones
   used across pages are trimmed here rather than edited file by file. ---- */
.content .mb-5 { margin-bottom: var(--space-4) !important; }
.content .mb-4 { margin-bottom: var(--space-4) !important; }
.content .mb-3 { margin-bottom: var(--space-3) !important; }
.content .mt-4 { margin-top: var(--space-4) !important; }
.content .mt-3 { margin-top: var(--space-3) !important; }
.content .p-4 { padding: var(--space-4) !important; }
.content .py-4 { padding-top: var(--space-4) !important; padding-bottom: var(--space-4) !important; }
.content .px-4 { padding-left: var(--space-4) !important; padding-right: var(--space-4) !important; }

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card .card-header {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 100%;
  border-left: 3px solid var(--charcoal-200);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.stat-card.stat-emerald { border-left-color: var(--royal-600); }
.stat-card.stat-warning { border-left-color: var(--color-warning); }
.stat-card.stat-info { border-left-color: var(--color-info); }
.stat-card.stat-charcoal { border-left-color: var(--charcoal-600); }

.stat-card .stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  background: var(--charcoal-50);
  color: var(--charcoal-500);
}
.stat-card.stat-emerald .stat-icon { background: var(--royal-50); color: var(--royal-700); }
.stat-card.stat-warning .stat-icon { background: var(--color-warning-bg); color: var(--color-warning); }
.stat-card.stat-info .stat-icon { background: var(--color-info-bg); color: var(--color-info); }
.stat-card.stat-charcoal .stat-icon { background: var(--charcoal-100); color: var(--charcoal-700); }

.stat-card .stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.member-card {
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.member-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  font-family: var(--font-sans);
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.btn-primary {
  background-color: var(--royal-600);
  background-image: var(--brand-gradient);
  border-color: var(--violet-700);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--royal-700);
  background-image: var(--brand-gradient-hover);
  border-color: var(--violet-700);
  color: #fff;
}

.btn-outline-primary {
  color: var(--royal-700);
  border-color: var(--royal-500);
}
.btn-outline-primary:hover {
  background-color: var(--royal-600);
  border-color: var(--royal-600);
  color: #fff;
}

.btn-secondary {
  background-color: var(--charcoal-100);
  border-color: var(--charcoal-100);
  color: var(--charcoal-700);
}
.btn-secondary:hover {
  background-color: var(--charcoal-200);
  border-color: var(--charcoal-200);
  color: var(--charcoal-800);
}

.btn-outline-secondary {
  color: var(--charcoal-600);
  border-color: var(--charcoal-200);
}
.btn-outline-secondary:hover {
  background-color: var(--charcoal-600);
  border-color: var(--charcoal-600);
  color: #fff;
}

.btn-danger {
  background-color: var(--color-danger);
  border-color: var(--color-danger);
}
.btn-danger:hover {
  background-color: #a92834;
  border-color: #a92834;
}
.btn-outline-danger {
  color: var(--color-danger);
  border-color: var(--color-danger-border);
}
.btn-outline-danger:hover {
  background-color: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
}

/* Compact row-action buttons — used across member/designee/executive rows */
.row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-1);
  align-items: center;
}
.row-actions .btn {
  padding: 5px 10px !important;
  font-size: 0.75rem !important;
  line-height: 1.2 !important;
  height: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  border-radius: var(--radius-sm) !important;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ==========================================================================
   Badges / status pills
   ========================================================================== */

.badge {
  font-weight: 600;
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
  border-radius: var(--radius-full);
  padding: 4px 10px;
}
.bg-success { background-color: var(--color-success) !important; }
.bg-danger { background-color: var(--color-danger) !important; }
.bg-warning { background-color: var(--color-warning) !important; color: #fff !important; }
.bg-info { background-color: var(--color-info) !important; }
.bg-secondary { background-color: var(--charcoal-400) !important; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}
.status-pill.is-active,
.status-pill.status-success {
  background: var(--color-success-bg);
  color: var(--color-success-strong);
}
.status-pill.is-inactive,
.status-pill.status-neutral {
  background: var(--charcoal-100);
  color: var(--charcoal-600);
}
.status-pill.status-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}
.status-pill.status-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}
.status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table {
  --bs-table-bg: var(--surface-card);
  font-size: 0.875rem;
  margin-bottom: 0;
}
.table thead th {
  background: var(--charcoal-50);
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
  padding: var(--space-3) var(--space-4);
  white-space: nowrap;
}
.table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}
.table tbody tr:hover {
  background: var(--charcoal-50);
}
.table-card {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
  .table-card { overflow-x: auto; }
}

/* Row-item style (member/designee/executive list rows) */
.member-item,
.designee-item,
.executive-item {
  background: var(--surface-card);
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.member-item:hover,
.designee-item:hover,
.executive-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--charcoal-200) !important;
}
.designee-photo img,
.executive-photo img {
  border: 2px solid var(--royal-100);
  box-shadow: var(--shadow-sm);
}
.designee-initials,
.executive-initials {
  background: var(--charcoal-100);
  color: var(--charcoal-600);
}
.drag-handle {
  color: var(--text-muted);
  cursor: grab;
}
.dragging-disabled .drag-handle {
  opacity: 0.35;
  pointer-events: none;
}

/* ==========================================================================
   Search / filter bars
   ========================================================================== */

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.search-bar .search-icon {
  position: absolute;
  left: var(--space-3);
  color: var(--text-muted);
  pointer-events: none;
}
.search-bar input[type="text"],
.search-bar input[type="search"] {
  padding-left: calc(var(--space-3) * 2 + 14px);
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-label {
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}
.required::after,
.required:after {
  content: " *";
  color: var(--color-danger);
}

.form-control,
.form-select {
  height: 38px;
  font-size: 0.875rem;
  border-color: var(--charcoal-200);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}
textarea.form-control {
  height: auto;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--royal-500);
  box-shadow: 0 0 0 3px rgba(var(--royal-600-rgb), 0.15);
}

.form-section {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.form-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-color);
}

/* Shared upload-form component (album/banner add/edit) */
.form-container {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
}
.preview-container {
  border: 2px dashed var(--charcoal-200);
  border-radius: var(--radius-md);
  background: var(--charcoal-50);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  min-height: 220px;
  text-align: center;
}
.preview-image {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.current-image {
  max-width: 200px;
  max-height: 200px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-3);
}
.file-input-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--royal-600);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.file-input-wrapper:hover {
  background: var(--royal-700);
}
.file-input-wrapper input[type="file"] {
  position: absolute;
  left: -9999px;
}

/* ==========================================================================
   Add Designee / Add Executive redesign — language header, role-specific
   block, and the compact "selected member" summary card with its
   collapsible details panel.
   ========================================================================== */

.form-lang-header {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-color);
}
.form-lang-badge {
  flex: 1;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--royal-700);
  background: var(--royal-50);
  border: 1px solid var(--royal-100);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  text-align: center;
}

.form-role-block {
  background: var(--charcoal-50);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-3) var(--space-1);
  margin-bottom: var(--space-4);
}

.selected-member-card {
  border: 1px solid var(--royal-100);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  margin-bottom: var(--space-4);
  overflow: hidden;
}
.selected-member-card-main {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  flex-wrap: wrap;
  background: var(--royal-50);
}
.selected-member-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}
.selected-member-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--royal-100);
  color: var(--royal-700);
  font-size: 1.25rem;
  font-weight: 700;
}
.selected-member-info {
  flex: 1;
  min-width: 160px;
}
.selected-member-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.selected-member-mobile {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.selected-member-actions {
  flex-shrink: 0;
  margin-left: auto;
}

.member-details-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  background: var(--charcoal-50);
  border: none;
  border-top: 1px solid var(--border-color);
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--royal-700);
  cursor: pointer;
}
.member-details-toggle:hover {
  background: var(--charcoal-100);
}
.member-details-toggle i {
  transition: transform 0.15s ease;
}
.member-details-toggle:not(.collapsed) i {
  transform: rotate(180deg);
}

.member-details-panel-inner {
  padding: var(--space-4) var(--space-3) var(--space-1);
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   Member-picker component (shared across add/edit Designee & Executive)
   ========================================================================== */

.member-picker-wrap {
  position: relative;
}
.member-picker-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1050;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.member-picker-row,
.member-picker-subrow {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
}
.member-picker-row:last-child,
.member-picker-subrow:last-child {
  border-bottom: none;
}
.member-picker-row:hover,
.member-picker-subrow:hover {
  background: var(--charcoal-50);
}
.member-picker-subrow {
  padding-left: 2.5rem;
  background: var(--charcoal-50);
}
.member-picker-row-matched {
  font-weight: 600;
  color: var(--royal-700);
}
.member-picker-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.member-picker-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--charcoal-100);
  color: var(--charcoal-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}
.member-picker-row-name {
  font-size: 0.875rem;
  color: var(--text-primary);
}
.member-picker-row-mobile {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.member-picker-relation {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--royal-50);
  color: var(--royal-700);
}
.member-picker-empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.member-picker-chip-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--royal-50);
  border: 1px solid var(--royal-100);
  border-radius: var(--radius-md);
}
.member-picker-chip-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}
.member-picker-chip-mobile {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}
.member-picker-change-btn {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--royal-700);
  background: transparent;
  border: 1px solid var(--royal-300);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
}
.member-picker-change-btn:hover {
  background: var(--royal-100);
}

/* ==========================================================================
   Empty states
   ========================================================================== */

.empty-state {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--text-muted);
}
.empty-state i {
  font-size: 2.25rem;
  color: var(--charcoal-200);
  margin-bottom: var(--space-3);
  display: block;
}
.empty-state h5,
.empty-state h6 {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-content {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.modal-header {
  border-bottom: 1px solid var(--border-color);
}
.modal-footer {
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination .page-link {
  color: var(--royal-700);
  border-color: var(--border-color);
}
.pagination .page-item.active .page-link {
  background-color: #ffffff;
  border-color: var(--royal-600);
}
.pagination .page-link:hover {
  background-color: var(--royal-50);
}

/* Custom toggle switch (users list) — "on" = Admin, a status, so it stays green */
.admin-toggle .toggle-slider {
  background-color: var(--charcoal-200);
}
.admin-toggle input:checked + .toggle-slider {
  background-color: var(--color-success);
}
.toggle-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert-success { background-color: var(--color-success-bg); color: var(--color-success-strong); border-color: var(--color-success-border); }
.alert-danger { background-color: var(--color-danger-bg); color: var(--color-danger); border-color: var(--color-danger-border); }
.alert-warning { background-color: var(--color-warning-bg); color: var(--color-warning); border-color: var(--color-warning-border); }
.alert-info { background-color: var(--color-info-bg); color: var(--color-info); border-color: var(--color-info-border); }

/* ==========================================================================
   Bootstrap tooltip re-skin (used for collapsed sidebar labels)
   ========================================================================== */

.tooltip .tooltip-inner {
  background: var(--charcoal-900);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
}
.tooltip.bs-tooltip-end .tooltip-arrow::before,
.tooltip.bs-tooltip-auto[data-popper-placement^="right"] .tooltip-arrow::before {
  border-right-color: var(--charcoal-900);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 992px) {
  .app-sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    height: auto;
    z-index: 1020;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-mobile-open .app-sidebar {
    transform: translateX(0);
  }
  body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-width);
  }
  body.sidebar-collapsed .app-header .brand-text {
    display: inline;
  }
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .chevron,
  body.sidebar-collapsed .sidebar-section-label {
    display: block !important;
  }
  body.sidebar-collapsed .submenu {
    display: none;
  }
  body.sidebar-collapsed .nav-item.expanded .submenu {
    display: flex !important;
  }
}

/* Compact header for phones/small tablets. The header-left column is
   normally width-matched to the sidebar (see .app-header-left above) so the
   collapse toggle lines up with its edge - but at these widths the sidebar
   is already an off-canvas drawer (see the 992px block above), so nothing
   needs that alignment anymore. Left at its fixed sidebar-matched width,
   the full wordmark plus a full-text header action button plus the user
   trigger no longer fit, which was overflowing the page horizontally and
   pushing the user trigger off-screen past the right edge. */
@media (max-width: 768px) {
  .app-header-left {
    width: auto;
    padding-left: var(--space-3);
  }
  .app-header .brand-text,
  body.sidebar-collapsed .app-header .brand-text {
    display: none !important;
  }
  /* No longer straddling the sidebar's edge (there's nothing to align with -
     the sidebar is an off-canvas drawer here), so flow it normally after the
     logo instead of absolutely positioning it, which overlapped the logo
     once .app-header-left shrank to auto width above. */
  .sidebar-collapse-toggle {
    position: static;
    transform: none;
  }
  .app-header-btn {
    padding: var(--space-2) var(--space-3);
  }
  .app-header-btn-label {
    display: none;
  }
  .header-user-name {
    display: none;
  }
}

@media (max-width: 576px) {
  .content { padding: var(--space-4); }
  .page-header { font-size: 1.15rem; }
}
