:root {
  /* Brand / dark surfaces (kept dark in both themes) */
  --ink: #1B2340;
  --ink-soft: #2A3358;

  /* Page & text */
  --paper: #FAF8F3;
  --text: #2B2E33;
  --heading: #1B2340;

  /* Accent */
  --amber: #D98E2B;
  --amber-dark: #B5721C;

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 88px;

  /* Shadows */
  --card-shadow: 0 1px 3px rgba(27, 35, 64, 0.08);

  /* Surfaces */
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --subtle: #f8f9fb;
  --subtle-2: #f1f3f5;
  --row-hover: #fbfaf7;

  /* Borders */
  --border: #e5e7eb;
  --border-soft: #eef0f3;
  --border-faint: #f1f3f5;

  /* Text tones */
  --muted: #6b7280;
  --muted-2: #8a8f98;
  --muted-3: #9aa0a6;
  --muted-4: #a7adb8;

  /* Tinted soft backgrounds & accents */
  --amber-soft: #FFF7EA;
  --amber-rgb: 217, 142, 43;
  --green: #2F855A;
  --green-soft: #F0FBF4;
  --green-soft-2: #effaf2;
  --green-border: #BFE3CD;
  --teal: #0e8a7d;
  --teal-rgb: 14, 138, 125;
  --red: #B3403E;
  --red-soft: #FDF4F4;
  --red-border: #F3D4D6;
  --blue: #2b3a4a;
  --blue-soft: #EAF0F7;
  --blue-border: #94a3b8;
  --gray-soft: #E8EAEF;
  --neutral: #f3f4f6;
  --scroll-thumb: #d3d7df;
}

[data-theme="dark"] {
  --paper: #0e131f;
  --text: #E6E8EF;
  --heading: #E7E9F2;

  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);

  --surface: #161b28;
  --surface-2: #1c2231;
  --subtle: #1a2030;
  --subtle-2: #202738;
  --row-hover: #1c2230;

  --border: #2b3242;
  --border-soft: #262d3d;
  --border-faint: #232a38;

  --muted: #98a1b5;
  --muted-2: #8791a6;
  --muted-3: #6f798b;
  --muted-4: #687283;

  --amber-soft: #31291a;
  --amber-rgb: 217, 142, 43;
  --green: #5fb98a;
  --green-soft: #13291c;
  --green-soft-2: #142b1e;
  --green-border: #2c4b38;
  --teal: #25b9a6;
  --teal-rgb: 37, 185, 166;
  --red: #e07a83;
  --red-soft: #30171b;
  --red-border: #52333a;
  --blue: #a9b7c9;
  --blue-soft: #192435;
  --blue-border: #3b4b5f;
  --gray-soft: #2b3242;
  --neutral: #232a38;
  --scroll-thumb: #3a4354;
}

body {
  background: var(--paper);
  color: var(--text);
  font-family: "Public Sans", -apple-system, sans-serif;
  transition: background 0.2s ease, color 0.2s ease;
}

/* Never let a single over-wide child (a nowrap button group, an unbroken
   string, a wide card) blow the page out into a full horizontal scrollbar —
   that makes every app page feel sloppy. Widgets that are *meant* to pan
   (seat-map canvas, calendar/session rails, table scroll areas) manage their
   own overflow containers, so they keep working as before.

   IMPORTANT: use `overflow-x: clip` — NOT `overflow-x: hidden` — here.
   `hidden` makes <html>/<body> an intermediate *scroll container*, which
   breaks `position: sticky` on the app sidebar (it no longer pins to the
   viewport and scrolls away with the page). `clip` suppresses the horizontal
   scrollbar without creating a scroll container, so the sticky sidebar keeps
   working even at the very bottom of a long page. */
html,
body {
  overflow-x: clip;
  max-width: 100%;
}

.brand-serif {
  font-family: "Lora", serif;
}

/* Unify the surfaces Bootstrap leaves to itself so cards, tables, and forms
   share the same background token and adapt cleanly to the active theme. */
.card,
.table-card,
.dropdown-menu,
.form-control,
.form-select,
.form-check-input {
  background-color: var(--surface);
}
.form-control,
.form-select {
  color: var(--text);
}
/* Keep Bootstrap table bodies on the same surface token as their wrapping card. */
.table {
  --bs-table-bg: var(--surface);
  --bs-table-striped-bg: var(--surface-2);
  --bs-table-hover-bg: var(--row-hover);
  background-color: var(--surface);
}

/* ---- Dashboard shell ---- */
.app-shell {
  min-height: 100vh;
}

/* =============================================================================
   Top navigation (owner / staff / member portal).
   A sticky bar inside the main column so it resizes automatically as the
   sidebar collapses (desktop) and becomes an off-canvas drawer (mobile). The
   rail of quick-action pills scrolls horizontally with the scrollbar hidden.
   ============================================================================= */
.app-topnav {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  /* Pull flush against the main column's padding, then leave a small gap
     under the bar so content doesn't hug it. */
  margin: -0.5rem -0.5rem 0.85rem;
  padding: 0.55rem 0.9rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}
.topnav-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
}

/* Mobile-only hamburger. Hidden on desktop where the pill rail + right
   cluster carry the bar. */
.topnav-menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  padding: 0;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.topnav-menu-toggle:hover { background: var(--subtle-2); color: var(--heading); }
.topnav-menu-toggle .icon-close { display: none; }
body.sidebar-open .topnav-menu-toggle .icon-menu { display: none; }
body.sidebar-open .topnav-menu-toggle .icon-close { display: block; }

/* Horizoally scrollable pill rail for quick actions. */
.topnav-actions {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.topnav-scroll {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  white-space: nowrap;
  padding: 3px;
  /* Hide the scrollbar completely for a clean, professional rail. */
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* legacy Edge */
}
.topnav-scroll::-webkit-scrollbar { display: none; }  /* Chrome / Safari */
.topnav-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.95rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.topnav-pill svg { color: var(--muted); }
.topnav-pill:hover {
  background: var(--amber-soft);
  border-color: rgba(var(--amber-rgb), 0.35);
  color: var(--amber-dark);
  transform: translateY(-1px);
}
.topnav-pill.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.topnav-pill.active svg { color: inherit; }

/* "Search member" quick-search pill in the top nav. Unlike the other pills it
   is an *input*: typing queries member-suggest-api and shows the matches in a
   suggestions list pinned below the pill, so staff can jump to a member's page
   without visiting the member list. The list uses `position: fixed` (its
   position is set in JS) so the rail's `overflow-x` never clips it. */
.topnav-member-search { position: relative; }
.topnav-member-search-field {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.8rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.topnav-member-search-field:focus-within {
  background: var(--surface);
  border-color: rgba(var(--amber-rgb), 0.5);
}
.topnav-search-icon { color: var(--muted); flex: 0 0 auto; line-height: 1; }
.topnav-member-search-input {
  width: 120px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0;
}
.topnav-member-search-input::placeholder { color: var(--muted); }
/* Member-portal "Search venues" pill: same search-field treatment as the staff
   "Search member" pill, but a touch wider so the longer placeholder reads fully. */
.topnav-org-search .topnav-member-search-input { width: 138px; }
.topnav-member-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
}
.topnav-member-search-clear:hover { background: var(--subtle-2); color: var(--heading); }
.topnav-member-search-clear[hidden] { display: none; }

/* Suggestions list (below the pill). Positioned with `position: fixed` in JS. */
.topnav-member-suggest {
  position: fixed;
  z-index: 1045;
  max-width: min(360px, calc(100vw - 24px));
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}
.topnav-member-suggest[hidden] { display: none; }
.topnav-member-suggest-empty {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 10px 12px;
}
.topnav-member-suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
}
.topnav-member-suggest-item:hover,
.topnav-member-suggest-item.highlighted { background: var(--subtle); }
.topnav-member-suggest-avatar {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  flex: 0 0 auto;
}
.topnav-member-suggest-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.topnav-member-suggest-name { font-weight: 600; min-width: 0; }
.topnav-member-suggest-sub { color: var(--muted); font-size: 0.78rem; }

/* Right-justified cluster: theme toggle, notification bell, org avatar. */
.topnav-right {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
  flex: 0 0 auto;
}
.topnav-theme {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.topnav-theme:hover { background: var(--subtle-2); color: var(--heading); }
.topnav-theme svg { display: none; }
[data-theme="dark"] .topnav-theme .icon-sun { display: block; }
[data-theme="light"] .topnav-theme .icon-moon { display: block; }

/* Organisation logo / avatar dropdown trigger. */
.org-menu { position: relative; }
.org-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.org-menu-btn:hover, .org-menu-btn[aria-expanded="true"] {
  border-color: rgba(var(--amber-rgb), 0.55);
  background: var(--surface);
}
.org-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(var(--amber-rgb), 0.9), var(--amber-dark));
  color: #fff;
  font-family: "Lora", serif;
  font-weight: 700;
  font-size: 0.85rem;
  overflow: hidden;
  flex-shrink: 0;
}
.org-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.org-menu-btn[aria-expanded="true"] .org-caret { transform: rotate(180deg); }
.org-caret { color: var(--muted); transition: transform 0.15s ease; }
.org-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: 264px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.org-menu-panel[hidden] { display: none; }
.org-menu-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-faint);
  background: var(--subtle);
}
.org-menu-org {
  font-family: "Lora", serif;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.org-menu-user {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.org-menu-role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--amber-soft);
  color: var(--amber-dark);
  border-radius: 999px;
  padding: 2px 7px;
}
.org-menu-body { padding: 6px; }
.org-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
}
.org-menu-item svg { color: var(--muted); }
.org-menu-item:hover { background: var(--subtle-2); color: var(--heading); }
.org-menu-item:hover svg { color: var(--amber-dark); }
.org-menu-foot { border-top: 1px solid var(--border-faint); padding: 6px; }
.org-menu-logout { color: var(--red); }
.org-menu-logout svg { color: var(--red); }
.org-menu-logout:hover { background: var(--red-soft); color: var(--red); }
.org-menu-logout:hover svg { color: var(--red); }
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  min-height: 100vh;
  background: var(--ink);
  flex-shrink: 0;
  overflow: hidden;
  position: sticky;
  top: 0;
  transition: width 0.25s ease;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  /* Let the protruding expand toggle stick out beyond the right edge
     instead of being clipped by the sidebar's overflow. */
  overflow: visible;
}

/* Header (brand + toggle) */
.sidebar-header {
  position: relative;
  z-index: 1;
}

.sidebar-header .sidebar-brand {
  color: #fff;
  min-width: 0;
}

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

/* Brand logo chip — shows the logo on a light rounded tile so it stays crisp
   against the dark navy sidebar / auth panel in both themes. */
.brand-logo-chip,
.auth-brand-logo-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #fff;
  padding: 2px;
  box-shadow: 0 1px 3px rgba(15, 20, 40, 0.35);
}
.brand-logo {
  width: 100%;
  height: 100%;
  display: block;
}

.sidebar-toggle {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #C9CEDC;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-toggle:hover {
  background: var(--ink-soft);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

/* ---- Theme toggle ---- */
.theme-toggle {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #C9CEDC;
  flex-shrink: 0;
  margin-right: 0.35rem;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover {
  background: var(--ink-soft);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}
.theme-toggle svg {
  display: none;
}
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
.sidebar.collapsed .theme-toggle { display: none; }

/* Standalone toggle used on the auth pages (top-right, floating). */
.auth-theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1030;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.auth-theme-toggle:hover {
  color: var(--amber-dark);
  border-color: rgba(var(--amber-rgb), 0.5);
}
.auth-theme-toggle svg { display: none; }
[data-theme="dark"] .auth-theme-toggle .icon-sun { display: block; }
[data-theme="light"] .auth-theme-toggle .icon-moon { display: block; }

.sidebar-toggle .icon-expand {
  display: none;
}

.sidebar.collapsed .sidebar-toggle .icon-collapse {
  display: none;
}

.sidebar.collapsed .sidebar-toggle .icon-expand {
  display: block;
}

/* Scrollable middle section: nav + quick actions scroll,
   while header & footer stay pinned. */
.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin-right: -8px;
  padding-right: 8px;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 6px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 3px;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

.sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: #C9CEDC;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  font-size: 0.95rem;
  position: relative;
  white-space: nowrap;
}

.nav-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
  background: var(--ink-soft);
  color: #fff;
}

/* Navigation section groupers: subtle uppercase labels that break a
   long flat nav (owner/staff lists) into scannable clusters. In the
   collapsed icon-rail these are hidden (only icons remain). */
.sidebar .nav-section {
  margin-top: 1rem;
}
.sidebar .nav-section:first-child {
  margin-top: 0;
}
.sidebar .nav-section-label {
  display: block;
  color: rgba(201, 206, 220, 0.55);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 0.9rem;
  margin-bottom: 0.3rem;
  white-space: nowrap;
}
.sidebar.collapsed .nav-section {
  display: none;
}

/* Collapsed state: icon rail. The brand text, quick actions and footer
   details hide, leaving the logo + nav icons. The collapse/expand toggle
   stays anchored to the LEFT of the logo, exactly as in the expanded row —
   so the header layout is consistent at every size. */
.sidebar.collapsed .nav-text,
.sidebar.collapsed .quick-actions,
.sidebar.collapsed .sidebar-user-text,
.sidebar.collapsed .logout-text,
.sidebar.collapsed hr {
  display: none !important;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 0.55rem;
  gap: 0;
}

.sidebar.collapsed .nav-link .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.5rem;
  line-height: 1;
  min-width: 14px;
  height: 14px;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Tooltips in the collapsed rail (progressively enhanced) */
.sidebar.collapsed .nav-link[data-label]::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink-soft);
  color: #fff;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 20;
}

.sidebar.collapsed .nav-link:hover::after {
  opacity: 1;
}

/* Keep the header row flush with the collapse toggle on the left, then the
   logo. Reduce the row's horizontal padding so toggle + logo both fit in the
   narrow rail without clipping, and centre the header vertically. */
.sidebar.collapsed {
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}
.sidebar.collapsed .sidebar-header {
  justify-content: flex-start;
  gap: 0.4rem;
}
.sidebar.collapsed .sidebar-header .sidebar-brand {
  margin: 0;
}
.sidebar.collapsed .sidebar-header .brand-logo-chip {
  width: 30px;
  height: 30px;
}
.sidebar.collapsed .theme-toggle {
  display: none;
}

.sidebar .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.25);
  color: #C9CEDC;
  font-size: 0.85rem;
}

.sidebar .btn-outline-light:hover {
  background: var(--ink-soft);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.sidebar-brand {
  color: #fff;
}

/* ---- Buttons ---- */
.btn-amber {
  background: var(--amber);
  border-color: var(--amber);
  color: #1B2340;
  font-weight: 600;
}

.btn-amber:hover {
  background: var(--amber-dark);
  border-color: var(--amber-dark);
  color: #fff;
}

/* ---- Cards ---- */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
}

.stat-card .stat-value {
  font-family: "Lora", serif;
  font-size: 2.1rem;
  font-weight: 600;
  color: var(--heading);
}

.stat-card .stat-label {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---- Auth split screen ---- */
.auth-split {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-brand-panel {
  background: var(--ink);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 41.666667%; /* col-lg-5 = 5/12 = 41.666667% */
  max-width: 41.666667%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem; /* p-5 = 3rem */
  overflow-y: auto;
}

.auth-brand-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
}

.auth-brand-panel .brand-serif {
  line-height: 1.35;
}

.auth-form-panel {
  margin-left: 41.666667%; /* offset for fixed left panel */
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.auth-form-inner {
  width: 100%;
  max-width: 680px;
  padding: 2rem 1.5rem;
}

@media (max-width: 991.98px) {
  .auth-split {
    flex-direction: column;
  }
  .auth-brand-panel {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: auto;
    padding: 2.5rem 1.5rem;
    display: block;
  }
  .auth-brand-content {
    max-height: none;
    overflow-y: visible;
  }
  .auth-form-panel {
    margin-left: 0;
    min-height: auto;
    padding: 2rem 1rem;
    display: block;
  }
  .auth-form-inner {
    max-width: 100%;
    padding: 0;
  }
}

/* ---- Building groups (halls page) ---- */
.building-group {
  scroll-margin-top: 1rem;
}

.building-group-header {
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-soft);
}

.building-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  flex-shrink: 0;
}

.building-icon-unassigned {
  background: var(--gray-soft);
  color: var(--muted);
}

/* ---- Hall cards ---- */
.hall-card {
  border-left: 4px solid var(--amber);
}

.hall-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--amber-soft);
  color: var(--amber-dark);
  flex-shrink: 0;
}

.hall-stat {
  background: var(--subtle);
  border-radius: 10px;
  padding: 0.6rem 0.4rem;
}

.hall-stat-value {
  font-family: "Lora", serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--heading);
  line-height: 1.2;
}

.hall-stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Muted "Enrol in a plan" action -- shown when the member already holds a
   plan, to signal a possible overlap/duplicate. Kept clickable on purpose:
   a member may legitimately hold more than one plan (e.g. day + monthly). */
.enroll-muted {
  opacity: 0.55;
}

.enroll-muted:hover,
.enroll-muted:focus {
  opacity: 0.9;
}

.hall-terms {
  border-top: 1px solid var(--border-soft);
}

.hall-terms-preview {
  white-space: pre-line;
}

/* ---- Plan cards (plans page) ---- */
.plan-card {
  border: 1px solid var(--border-soft);
  border-top: 3px solid var(--amber);
}

.plan-card .plan-name {
  color: var(--heading);
  font-weight: 600;
}

.plan-card .plan-name:hover {
  color: var(--amber-dark);
}

.plan-card .plan-price {
  font-family: "Lora", serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--heading);
  line-height: 1.1;
}

.plan-card .plan-details {
  margin-bottom: 0;
}

.plan-card .plan-details > div {
  border-bottom: 1px solid var(--border-faint);
}

.plan-card .plan-details > div:last-child {
  border-bottom: 0;
}

/* ---- Seat map ---- */
.seat-card {
  border-radius: 10px;
  padding: 0.7rem 0.5rem;
  text-align: center;
  border: 1.5px solid var(--border);
  background: var(--surface);
  height: 100%;
}

.seat-card .seat-number {
  font-family: "Lora", serif;
  font-weight: 600;
}

.seat-available {
  border-style: dashed;
  color: var(--muted-3);
}

.seat-pending {
  border-color: var(--amber);
  background: var(--amber-soft);
}

.seat-present {
  border-color: var(--green);
  background: var(--green-soft);
}

.seat-done {
  /* Checked-out (left) but still booked → clearly occupied, distinct from the
     dashed, muted .seat-available (truly empty). */
  border-color: var(--blue-border);
  background: var(--blue-soft);
  color: var(--blue);
}

.seat-dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
}

.seat-dot-done {
  background: var(--blue-border);
  vertical-align: 0.05rem;
}

.seat-until {
  font-size: 0.7rem;
  color: var(--muted-2);
  margin-top: 0.35rem;
}

/* ---- Price history (plan detail) ---- */
.price-history-scroll {
  max-height: 360px;
  overflow-y: auto;
  margin-right: -0.5rem;
  padding-right: 0.5rem;
}

@media (max-width: 992px) {
  .price-history-scroll {
    max-height: 480px;
  }
}

/* ---- Professional invoice ---- */
.invoice-meta th {
  width: 40%;
  padding-right: 0.5rem;
}
.invoice-items thead th {
  border-bottom: 1px solid var(--border);
}
.invoice-items tbody td {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-faint);
}

/* ---- Member dashboard: attendance calendar ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-weekday {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
  padding: 0.2rem 0;
}

.calendar-cell {
  position: relative;
  min-height: 58px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  padding: 0.35rem;
}

.calendar-cell.blank {
  border: none;
  background: transparent;
  min-height: 0;
}

.calendar-day {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
}

.calendar-meta {
  font-size: 0.66rem;
  color: var(--muted);
  margin-top: 0.2rem;
  line-height: 1.25;
}

.calendar-cell.today {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(var(--amber-rgb), 0.18);
}

.calendar-cell.present {
  background: var(--green-soft);
  border-color: var(--green-border);
}

.calendar-cell.present .calendar-day {
  color: var(--green);
}

.calendar-cell.checked {
  background: var(--amber-soft);
  border-color: rgba(var(--amber-rgb), 0.35);
}

.calendar-cell.checked .calendar-day {
  color: var(--amber-dark);
}

.calendar-cell.absent {
  background: var(--red-soft);
  border-color: var(--red-border);
}

.calendar-cell.absent .calendar-day {
  color: var(--red);
}

.calendar-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.calendar-dot.present {
  background: var(--green);
}

.calendar-dot.checked {
  background: var(--amber);
}

.calendar-dot.absent {
  background: var(--red);
}

/* Green intensity shading for attended days (deeper = more study time). */
.calendar-cell.shade-1 { background: #E7F6EC; border-color: #BFE3CD; }
.calendar-cell.shade-2 { background: #B9E4C9; border-color: #93D1AC; }
.calendar-cell.shade-3 { background: #7CCD9C; border-color: #5FBD86; }
.calendar-cell.shade-4 { background: #43AB6E; border-color: #36975D; }
.calendar-cell.shade-5 { background: #1F7A4B; border-color: #17663C; }

.calendar-cell.shade-3,
.calendar-cell.shade-4,
.calendar-cell.shade-5 { color: #fff; }
.calendar-cell.shade-3 .calendar-day,
.calendar-cell.shade-4 .calendar-day,
.calendar-cell.shade-5 .calendar-day,
.calendar-cell.shade-3 .calendar-meta,
.calendar-cell.shade-4 .calendar-meta,
.calendar-cell.shade-5 .calendar-meta { color: #fff; }
.calendar-cell.shade-3 .calendar-dot.checked,
.calendar-cell.shade-4 .calendar-dot.checked,
.calendar-cell.shade-5 .calendar-dot.checked {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

/* ---- Member dashboard: compact attendance heatmap (3m/6m/1y) ---- */
.heat-months {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
}

.heat-month {
  flex: 1 1 132px;
  min-width: 104px;
  max-width: 210px;
}

.heat-month-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.heat-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.heat-hd {
  font-size: 0.55rem;
  color: var(--muted-3);
  text-align: center;
  line-height: 1.15;
}

.heat-cell {
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background: var(--neutral);
}

.heat-cell.blank { background: transparent; }
.heat-cell.empty { background: var(--neutral); }
.heat-cell.absent { background: var(--red); }
.heat-cell.today { outline: 2px solid var(--amber); outline-offset: -1px; }

.heat-cell.shade-1 { background: #e7f6ec; }
.heat-cell.shade-2 { background: #b9e4c9; }
.heat-cell.shade-3 { background: #7ccd9c; }
.heat-cell.shade-4 { background: #43ab6e; }
.heat-cell.shade-5 { background: #1f7a4b; }

/* Legend swatches reuse the same intensity palette. */
.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  vertical-align: middle;
}
.legend-swatch.shade-1 { background: #e7f6ec; }
.legend-swatch.shade-2 { background: #b9e4c9; }
.legend-swatch.shade-3 { background: #7ccd9c; }
.legend-swatch.shade-4 { background: #43ab6e; }
.legend-swatch.shade-5 { background: #1f7a4b; }
.legend-swatch.absent { background: #e5484d; }

/* Member dashboard: scrollable terms block */
.terms-scroll::-webkit-scrollbar {
  width: 6px;
}

.terms-scroll::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 3px;
}

/* ---- Invoice / receipt sheet (a clean A5-proportioned "paper" document) ---- */
.invoice-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.invoice-sheet {
  width: 148mm;               /* A5 width -- two of these nestle onto one A4 sheet */
  max-width: 100%;
  background: #fff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 20, 40, 0.08);
  padding: 8mm 9mm;
  font-size: 12px;
  line-height: 1.45;
}
.invoice-hdr {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid #1e293b;
  margin-bottom: 15px;
}
.invoice-from { display: flex; align-items: flex-start; gap: 12px; }
.invoice-org-logo { max-height: 58px; max-width: 90px; object-fit: contain; }
.org-logo-preview { max-height: 72px; max-width: 160px; object-fit: contain; border: 1px solid var(--bs-border-color); border-radius: 6px; padding: 6px; background: #fff; }
.invoice-org-mark {
  width: 46px; height: 46px; border-radius: 10px;
  background: #1e293b; color: #f59e0b;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 22px;
}
.invoice-org-name { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }
.invoice-org-details { color: #6b7280; font-size: 11.5px; margin-top: 2px; }
.invoice-hdr-right { text-align: right; }
.invoice-doc-title { font-size: 20px; font-weight: 800; letter-spacing: 0.18em; color: #1e293b; }
.invoice-no { font-size: 13px; font-weight: 600; color: #4b5563; margin-top: 2px; }
.invoice-status { margin-top: 6px; }
.invoice-badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
.invoice-badge-paid { background: #dcfce7; color: #15803d; }
.invoice-badge-overdue { background: #fee2e2; color: #b91c1c; }
.invoice-badge-due { background: #fef3c7; color: #b45309; }
.invoice-badge-cancelled { background: #f3f4f6; color: #6b7280; }

.invoice-bill { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.invoice-billto { flex: 1; max-width: 45%; }
.invoice-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: #6b7280; font-weight: 600; margin-bottom: 4px;
}
.invoice-billto-name { font-weight: 700; font-size: 14px; }
.invoice-billto-line { color: #6b7280; font-size: 11.5px; }
.invoice-meta { margin-left: auto; }
.invoice-meta td { padding: 2.5px 0 2.5px 18px; }
.invoice-meta td:first-child {
  color: #9ca3af; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
}
.invoice-meta td:last-child { font-weight: 600; font-size: 12px; }

.invoice-items { width: 100%; border-collapse: collapse; }
.invoice-items thead th {
  background: #1e293b; color: #fff; text-align: left;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 7px 8px;
}
.invoice-items thead th.right, .invoice-items td.right { text-align: right; }
.invoice-items thead th.c-idx, .invoice-items td.c-idx { width: 30px; text-align: center; }
.invoice-items td { padding: 8px; border-bottom: 1px solid #eef0f3; font-size: 12.5px; vertical-align: top; }
.invoice-items td.right { font-weight: 600; white-space: nowrap; vertical-align: top; }
.invoice-items .sub { color: #6b7280; font-size: 11px; font-weight: 400; margin-top: 1px; }
.muted { color: #6b7280; }

.invoice-totals { display: flex; justify-content: flex-end; margin-top: 6px; }
.invoice-totals table.totals { width: 220px; border-collapse: collapse; }
.invoice-totals td { padding: 4px 8px; border-bottom: 1px solid #f3f4f6; }
.invoice-totals td:first-child { color: #6b7280; }
.invoice-totals td:last-child { text-align: right; font-weight: 600; }
.invoice-totals tr.total td {
  border-top: 2px solid #1e293b; border-bottom: none;
  font-size: 15px; font-weight: 800; color: #111827;
}
.invoice-totals tr.total td:first-child { color: #111827; }
.invoice-totals tr.balance td {
  border-top: 2px solid #1e293b; background: #f8fafc;
  font-size: 14px; font-weight: 800;
}
.invoice-totals tr.balance td:first-child { color: #111827; }

.invoice-footer {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid #e5e7eb; margin-top: 18px; padding-top: 10px;
}
.invoice-thanks { color: #6b7280; font-size: 11.5px; }
.invoice-seatplot {
  display: inline-flex; align-items: center; gap: 5px;
  color: #6b7280; font-size: 11px;
}
.invoice-seatplot .seatplot-logo { width: 16px; height: 16px; border-radius: 4px; }
.invoice-seatplot strong { color: #475569; font-weight: 600; }


/* ---- Print (invoice/receipt) ---- */
@media print {
  .no-print {
    display: none !important;
  }
  /* Hide all app chrome (mobile top bar, side nav, and its backdrop) so only
     the printable sheet itself survives. These are separate from .no-print
     because they live in the base layout, and the mobile app-bar would
     otherwise reappear in the printout on narrow paper/PDF widths. */
  .sidebar,
  .app-bar,
  .app-topnav,
  .sidebar-backdrop {
    display: none !important;
  }
  main {
    padding: 0 !important;
  }
  /* The invoice is its own paper sheet -- drop the wrapping card chrome. */
  .card {
    box-shadow: none !important;
  }
  .invoice-wrap {
    display: block;
    margin: 0;
  }
  .invoice-sheet {
    width: 100%;
    max-width: 100%;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 7mm 8mm;
  }
  .invoice-sheet,
  .invoice-sheet * {
    box-shadow: none !important;
  }
  /* Compact the sheet so it fits comfortably inside A5. */
  .invoice-items td {
    padding: 6px 8px;
  }
  .invoice-meta td {
    padding: 2px 0 2px 16px;
  }
  .invoice-totals tr.balance td {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .invoice-items thead th {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ---- Responsive / mobile ----------
   main (the content column) must be allowed to shrink inside the flex
   shell so cards/tables don't blow the page width on narrow screens. */
main {
  min-width: 0; /* allow flex children to shrink instead of overflowing */
}

/* Mobile-only app bar. Hidden on desktop (the sidebar carries the brand);
   shown (sticky) on phones & tablets where the sidebar is hidden as an
   off-canvas drawer. Menu button sits at the LEFT of the dynamic logo. */
.app-bar {
  display: none;
}

@media (max-width: 991.98px) {
  .app-shell {
    display: block;
  }

  /* The fixed sidebar becomes an off-canvas drawer, hidden by default. It
     only appears when the menu button (in the app bar) is tapped. Scoped to
     `.app-shell` so the seat-map builder's own docked rail is untouched. */
  .app-shell .sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: var(--sidebar-width) !important;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
  }
  .app-shell .sidebar.open {
    transform: translateX(0);
  }
  /* The drawer is always the full expanded layout (never the icon rail). */
  .app-shell .sidebar.collapsed {
    width: var(--sidebar-width) !important;
  }
  .app-shell .sidebar .sidebar-brand-text,
  .app-shell .sidebar .nav-text,
  .app-shell .sidebar .quick-actions,
  .app-shell .sidebar .sidebar-user-text,
  .app-shell .sidebar .logout-text,
  .app-shell .sidebar hr {
    display: initial !important;
  }
  .app-shell .sidebar .nav-link {
    justify-content: flex-start;
    gap: 0.7rem;
    padding: 0.55rem 0.9rem;
  }
  .app-shell .sidebar .nav-link .badge {
    position: static;
    min-width: auto;
    height: auto;
    padding: 0 0.5rem;
    font-size: 0.75rem;
  }
  /* In the drawer the header's collapse/theme buttons are redundant — the
     app bar provides the menu (close) button and the theme toggle. */
  .app-shell .sidebar .sidebar-header .sidebar-toggle,
  .app-shell .sidebar .sidebar-header .theme-toggle {
    display: none;
  }
  .app-shell .sidebar .sidebar-header .sidebar-brand {
    margin: 0 auto;
  }
/* Show the top nav hamburger so users can open the off-canvas drawer. */
  .topnav-menu-toggle { display: inline-flex; }
  .topnav-actions { padding-right: 0.25rem; }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 40, 0.55);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }
  .sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
  }

  /* Sticky app bar: [menu] [logo] [brand] ........ [theme]. */
  .app-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--ink);
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  }
  .app-bar .app-bar-brand {
    color: #fff;
    min-width: 0;
  }
  .app-bar .app-bar-brand .brand-logo-chip {
    width: 28px;
    height: 28px;
  }
  .app-bar .app-bar-brand-text {
    font-size: 1.02rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .app-bar-toggle {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.07);
    color: #C9CEDC;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }
  .app-bar-toggle:hover {
    background: var(--ink-soft);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
  }
  .app-bar-toggle .icon-close { display: none; }
  body.sidebar-open .app-bar-toggle .icon-menu { display: none; }
  body.sidebar-open .app-bar-toggle .icon-close { display: block; }

  /* The theme toggle borrowed from the sidebar styles, restyled for the bar. */
  .app-bar .app-bar-theme {
    margin-left: auto;
    width: 36px;
    height: 36px;
  }
}

/* ---- Reduce excessive side spacing on small phones ----
   The main content area uses Bootstrap's p-4 utility (24px each side),
   which wastes too much width on narrow screens. Tighter horizontal
   padding gives cards/tables more room on phones. */
@media (max-width: 575.98px) {
  main {
    padding-top: 0.5rem !important;
    padding-right: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    padding-left: 0.5rem !important;
  }
  .card { border-radius: 10px; }
}

/* ---- My attendance: grouped multi-session list ---- */
.attendance-list th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom-width: 1px;
}
.attendance-list tbody tr {
  border-bottom: 1px solid var(--border-faint);
}
.attendance-list tbody tr:last-child {
  border-bottom: none;
}
.attendance-day-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-family: "Lora", serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--amber-dark, #9a5d0c);
  background: linear-gradient(180deg, rgba(217, 142, 43, 0.16), rgba(217, 142, 43, 0.06));
  border: 1px solid rgba(217, 142, 43, 0.22);
  flex-shrink: 0;
}
.attendance-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green);
  background: var(--green-soft-2);
  border: 1px solid var(--green-border);
  border-radius: 999px;
  white-space: nowrap;
}
.attendance-chip-present {
  color: var(--teal);
  background: rgba(var(--teal-rgb), 0.1);
  border-color: rgba(var(--teal-rgb), 0.25);
}

/* =====================================================================
   Data tables — shared professional table system
   Used by the Members list and the (member) membership history table.
   ===================================================================== */

/* A card that wraps a table, with an optional header row. */
.table-card {
  overflow: hidden;
}
.table-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border-faint);
  background: var(--surface);
}
.table-card-header .table-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0;
}
.table-card-header .table-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--heading);
}

/* Refined table chrome */
.table thead th {
  font-family: "Public Sans", -apple-system, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
  padding: 0.7rem 1rem;
  white-space: nowrap;
  vertical-align: middle;
}
.table tbody td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-faint);
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table tbody tr {
  transition: background 0.12s ease;
}
.table tbody tr:hover {
  background: var(--row-hover);
}

/* Primary name link */
.table .name-link {
  color: var(--heading);
  font-weight: 600;
}
.table .name-link:hover {
  color: var(--amber-dark);
}
.table .cell-sub {
  font-size: 0.78rem;
  color: var(--muted-2);
  margin-top: 0.1rem;
  line-height: 1.35;
}

/* Soft-amber circular avatar with initials */
.avatar-sm {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--amber-soft);
  color: var(--amber-dark);
  border: 1px solid rgba(var(--amber-rgb), 0.22);
  font-family: "Lora", serif;
  font-weight: 600;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Status pill — dot + label */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
}
.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-pill-active   { color: var(--green); background: var(--green-soft-2); }
.status-pill-expiring { color: var(--amber-dark); background: var(--amber-soft); }
.status-pill-pending  { color: var(--amber-dark); background: var(--amber-soft); }
.status-pill-inactive { color: var(--muted); background: var(--subtle-2); }
.status-pill-cancelled{ color: var(--red); background: var(--red-soft); }
.status-pill-none     { color: var(--muted-4); background: var(--subtle-2); }

/* Icon-only action buttons */
.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.btn-icon:hover {
  color: var(--amber-dark);
  border-color: rgba(var(--amber-rgb), 0.5);
  background: var(--amber-soft);
}
.btn-icon-danger:hover {
  color: var(--red);
  border-color: var(--red-border);
  background: var(--red-soft);
}

/* Leading glyph inside a dropdown item (e.g. the auto-renew ✓) */
.dropdown-item-addon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  margin-right: 0.5rem;
  color: var(--amber-dark);
  font-weight: 700;
}
/* Dropdown items backed by a <form>/<button> keep link styling */
.dropdown-menu .dropdown-item { cursor: pointer; }
.dropdown-menu form { margin: 0; }
.dropdown-menu .dropdown-header { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* Search box for table toolbars */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box .search-icon {
  position: absolute;
  left: 0.65rem;
  color: var(--muted-4);
  pointer-events: none;
  display: flex;
}
.search-input {
  padding: 0.42rem 2rem 0.42rem 2.15rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  width: 240px;
  max-width: 100%;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.search-input::placeholder {
  color: var(--muted-4);
}
.search-input:focus {
  outline: none;
  border-color: rgba(var(--amber-rgb), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--amber-rgb), 0.12);
}
/* In-table search clear button (absolute within .search-box) */
.search-clear {
  position: absolute;
  right: 0.5rem;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  color: var(--muted-4);
  background: transparent;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.search-clear:hover {
  color: var(--amber-dark);
  background: var(--subtle-2);
}

/* Mini progress bar (e.g. days remaining on a membership) */
.mini-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--subtle-2);
  overflow: hidden;
  margin-top: 0.4rem;
}
.mini-progress > div {
  height: 100%;
  border-radius: 999px;
  background: var(--amber);
}
.mini-progress > div.is-warning { background: #f0a32a; }
.mini-progress > div.is-danger  { background: #e5484d; }

/* Small meta chips (e.g. shift on a plan) */
.meta-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  color: var(--muted);
  background: var(--subtle-2);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .search-input { width: 180px; }
}

/* Segmented status filter pills (e.g. the memberships list) */
.filter-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.filter-pills .btn {
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.32rem 0.85rem;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
}
.filter-pills .btn:hover {
  border-color: rgba(var(--amber-rgb), 0.5);
  color: var(--amber-dark);
}
.filter-pills .btn.btn-active {
  background: var(--amber);
  border-color: var(--amber);
  color: #1B2340;
}

/* Checkbox category chips (member "what is this about?" picker) */
.chip-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
  user-select: none;
}
.chip-check input {
  accent-color: var(--amber);
  margin: 0;
  flex-shrink: 0;
}
.chip-check:hover {
  border-color: rgba(var(--amber-rgb), 0.5);
  color: var(--amber-dark);
}
.chip-check:has(input:checked) {
  background: var(--amber-soft);
  border-color: rgba(var(--amber-rgb), 0.55);
  color: var(--amber-dark);
  font-weight: 600;
}

/* Star rating picker (member review form) */
.star-rate {
  display: inline-flex;
  flex-direction: row;
  direction: rtl; /* reverse so filling works with sibling selectors */
  gap: 0.1rem;
}
.star-rate .star-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.star-rate .star {
  display: inline-block;
  font-size: 1.85rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted-3);
  transition: color 0.15s ease, transform 0.1s ease;
  -webkit-user-select: none;
  user-select: none;
}
.star-rate .star:hover,
.star-rate .star:hover ~ .star,
.star-rate .star-input:checked ~ .star {
  color: var(--amber);
}
.star-rate .star:active {
  transform: scale(0.88);
}
.star-rate .star-input:focus-visible + .star {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =====================================================================
   Dark-mode overrides for Bootstrap light utilities
   ===================================================================== */
[data-theme="dark"] .bg-light,
[data-theme="dark"] .text-bg-light {
  background-color: var(--surface) !important;
}
[data-theme="dark"] .text-bg-light {
  color: var(--text) !important;
}

/* =====================================================================
   Member profile hero (owner/staff member detail page)
   ===================================================================== */
/* The hero header is theme-aware: in light mode it is a soft warm/paper band
   with dark ink text; in dark mode it becomes a navy band with white text.
   All colours flow from the --mh-* variables (overridden for dark below), so
   the band matches the active theme instead of fighting it. */
.member-profile-cover {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--mh-cover-1) 0%, var(--mh-cover-2) 100%);
}

/* Brand accent glows (subtle so they never fight the copy) */
.member-profile-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 90% 0%, var(--mh-glow) 0%, transparent 46%),
    radial-gradient(circle at 4% 100%, rgba(217, 142, 43, 0.05) 0%, transparent 50%);
}

.member-profile-cover-inner {
  position: relative;
  z-index: 1;
  padding: 1.35rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  color: var(--mh-text);
}

/* Avatar ring: a crisp ring with a soft amber halo, sitting cleanly on the band.
   (The old design overlapped an empty cover strip with a negative margin; the
   band now *holds* the identity so nothing floats.) */
.member-profile-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--mh-avatar-bg);
  border: 3px solid var(--mh-avatar-ring);
  box-shadow: 0 0 0 4px rgba(217, 142, 43, 0.3), var(--mh-avatar-shadow);
  color: var(--mh-text);
}

.member-profile-avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Lora", serif;
  font-size: 1.7rem;
  font-weight: 600;
}

/* Meta line (username, joined, last login) */
.member-profile-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.85rem;
  margin-top: 0.35rem;
  color: var(--mh-text-muted);
  font-size: 0.8125rem;
}
.member-profile-meta svg {
  opacity: 0.88;
  flex-shrink: 0;
}
.member-profile-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Role chip */
.member-profile-role {
  background: var(--mh-role-bg);
  color: var(--mh-role-text);
  border: 1px solid var(--mh-role-border);
  font-weight: 500;
}

/* Quick actions, right-aligned, wrapping on small screens. `.btn-outline-light`
   outside the sidebar isn't themed by the app, so we pin the button variables
   here to match the band (soft outline in light, "glass" in dark). */
.member-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.member-profile-actions .btn-outline-light {
  --bs-btn-color: var(--mh-btn-color);
  --bs-btn-hover-color: var(--mh-btn-hover-color);
  --bs-btn-active-color: var(--mh-btn-hover-color);
  --bs-btn-border-color: var(--mh-btn-border);
  --bs-btn-hover-bg: var(--mh-btn-hover-bg);
  --bs-btn-active-bg: var(--mh-btn-hover-bg);
  --bs-btn-hover-border-color: var(--mh-btn-border);
  --bs-btn-active-border-color: var(--mh-btn-border);
}

/* ---------- LIGHT theme defaults ---------- */
.member-profile-hero {
  --mh-cover-1: #f7f4ed;
  --mh-cover-2: #e9eff9;
  --mh-glow: rgba(217, 142, 43, 0.1);
  --mh-text: #1B2340;
  --mh-text-muted: #6b7280;
  --mh-role-bg: #FFF7EA;
  --mh-role-text: #B5721C;
  --mh-role-border: rgba(217, 142, 43, 0.4);
  --mh-avatar-bg: #eef1f7;
  --mh-avatar-ring: #ffffff;
  --mh-avatar-shadow: 0 8px 18px rgba(27, 35, 64, 0.16);
  --mh-btn-color: #1B2340;
  --mh-btn-border: rgba(27, 35, 64, 0.26);
  --mh-btn-hover-bg: rgba(27, 35, 64, 0.92);
  --mh-btn-hover-color: #ffffff;
}

/* ---------- DARK theme override ---------- */
[data-theme="dark"] .member-profile-hero {
  --mh-cover-1: #242f58;
  --mh-cover-2: #141a26;
  --mh-glow: rgba(217, 142, 43, 0.18);
  --mh-text: #ffffff;
  --mh-text-muted: rgba(255, 255, 255, 0.72);
  --mh-role-bg: rgba(255, 255, 255, 0.14);
  --mh-role-text: #ffffff;
  --mh-role-border: rgba(255, 255, 255, 0.26);
  --mh-avatar-bg: rgba(255, 255, 255, 0.04);
  --mh-avatar-ring: rgba(255, 255, 255, 0.92);
  --mh-avatar-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
  --mh-btn-color: #ffffff;
  --mh-btn-border: rgba(255, 255, 255, 0.4);
  --mh-btn-hover-bg: rgba(255, 255, 255, 0.92);
  --mh-btn-hover-color: #1B2340;
}

.member-hero-stat {
  font-family: "Lora", serif;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--heading);
}

.member-hero-stat-label {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Member profile hero: status line + at-a-glance KPI tiles ---- */
.member-profile-statusline {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  color: var(--mh-text-muted);
  font-size: 0.8125rem;
}
.member-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.35rem;
}
.member-status-dot.is-active { background: #22c55e; }
.member-status-dot.is-warning { background: #f59e0b; }

.member-hero-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.5rem;
}
@media (max-width: 1199px) { .member-hero-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 575px)  { .member-hero-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.member-hero-kpi {
  padding: 0.7rem 0.4rem;
  border-radius: 0.7rem;
  background: rgba(127, 127, 127, 0.07);
  border: 1px solid var(--border-soft);
  text-align: center;
  min-width: 0;
}
.member-hero-kpi-value {
  font-family: "Lora", serif;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.15;
  color: var(--heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-hero-kpi-label {
  margin-top: 0.25rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.member-hero-kpi-sub {
  margin-top: 0.1rem;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Current plan & seat tile (member detail page) ---- */
.member-seat-tile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
}
.member-seat-tile-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--amber-soft);
  color: var(--amber-dark);
}
.member-seat-tile-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.member-seat-tile-value {
  font-family: "Lora", serif;
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.1;
  color: var(--heading);
}
.member-seat-detail {
  padding: 0.5rem 0.35rem;
  border-radius: 0.5rem;
  background: rgba(127, 127, 127, 0.05);
}
.member-seat-detail-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
/* ---- Profile information card ---- */
.section-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--amber-soft);
  color: var(--amber-dark);
  flex-shrink: 0;
}

.profile-section-title {
  margin-top: 1.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.profile-section-title:first-of-type {
  margin-top: 0;
}

.profile-field-label {
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.profile-field-value {
  color: var(--text);
}

/* ---- Compact profile field grid ---- */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem 2.25rem;
}

.profile-grid--2 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.profile-grid--1 {
  grid-template-columns: minmax(0, 1fr);
}

.profile-field-wide {
  grid-column: 1 / -1;
}

@media (min-width: 577px) and (max-width: 991px) {
  .profile-grid:not(.profile-grid--2):not(.profile-grid--1) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 576px) {
  .profile-grid:not(.profile-grid--2):not(.profile-grid--1),
  .profile-grid--2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

.profile-field-value {
  line-height: 1.45;
  word-break: break-word;
}

.profile-field-value a {
  color: var(--bs-link-color);
  font-weight: 500;
  text-decoration: none;
}

.profile-field-value a:hover {
  color: var(--bs-link-hover-color);
  text-decoration: underline;
}


/* ---- Disabled / in-flight submit buttons (app.js submit guard) ---- */
.btn.btn-disabled {
  opacity: 0.7;
  cursor: not-allowed;
  position: relative;
}
/* =====================================================================
   Centralized notification widget (member + owner portal).
   Bell FAB (bottom-right) -> dropdown panel + auto-dismiss toasts.
   ===================================================================== */
/* Floating bell button (platform_admin portal). Inside the owner/staff/member
   top nav it is overridden below into a compact inline icon button. */
.notif-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1060;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}
.notif-fab:hover { transform: translateY(-2px); }
.notif-fab[aria-expanded="true"] { background: var(--amber); color: #fff; }

/* Inline bell trigger inside the top nav (replaces the FAB look there). */
.app-topnav .notif-fab {
  position: relative;   /* anchor for the unread badge */
  right: auto;
  bottom: auto;
  z-index: auto;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.app-topnav .notif-fab:hover {
  transform: none;
  background: var(--subtle-2);
  color: var(--heading);
  border-color: var(--border);
}
.app-topnav .notif-fab[aria-expanded="true"] {
  background: var(--amber-soft);
  color: var(--amber-dark);
  border-color: rgba(var(--amber-rgb), 0.4);
}
.app-topnav .notif-bell-icon { width: 19px; height: 19px; }

/* Unread count badge on the bell */
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  border: 2px solid var(--surface);
}

/* Dropdown panel (platform_admin portal): fixed bottom-right FAB panel. In
   the top nav it is overridden below to anchor under the bell. */
.notif-panel {
  position: fixed;
  right: 20px;
  bottom: 84px;
  z-index: 1055;
  width: min(380px, calc(100vw - 40px));
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.notif-panel[hidden] { display: none; }
/* In the top nav, the panel anchors under the bell (right-aligned to the
   top nav's right cluster) instead of floating at the bottom of the page. */
.app-topnav .notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  bottom: auto;
  z-index: 60;
  width: min(380px, calc(100vw - 32px));
}

.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-faint);
  background: var(--subtle);
}
.notif-panel-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-family: "Lora", serif;
  font-size: 15px;
}
.notif-head-icon { color: var(--amber); }
.notif-mark-all {
  border: none;
  background: none;
  color: var(--amber-dark);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.notif-mark-all:hover { text-decoration: underline; }

.notif-panel-body {
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Individual notification row */
.notif-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-faint);
  transition: background 0.15s ease;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--subtle); }

.notif-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-top: 6px;
  border-radius: 50%;
}
.notif-dot--info    { background: var(--blue); }
.notif-dot--success { background: var(--green); }
.notif-dot--warning { background: var(--amber); }
.notif-dot--danger  { background: var(--red); }

.notif-item-content { flex: 1 1 auto; min-width: 0; }
.notif-item-title {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.35;
  word-break: break-word;
}
.notif-item-message {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
  word-break: break-word;
}
.notif-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.notif-item-time { color: var(--muted-3); font-size: 11.5px; }
.notif-item-action {
  color: var(--amber-dark);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.notif-item-action:hover { text-decoration: underline; }

/* Per-item "mark read" button */
.notif-mark-one {
  flex: 0 0 auto;
  border: none;
  background: none;
  color: var(--muted-3);
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}
.notif-item:hover .notif-mark-one,
.notif-mark-one:focus-visible {
  visibility: visible;
  opacity: 1;
}
.notif-mark-one:hover { color: var(--green); background: var(--green-soft); }

/* Empty state */
.notif-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted-2);
}
.notif-empty-mark { margin-bottom: 10px; color: var(--muted-3); }
.notif-empty-text { font-size: 13px; }

/* Auto-dismiss toast stack */
.notif-toasts {
  position: fixed;
  right: 20px;
  bottom: 84px;
  z-index: 1070;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 40px));
  pointer-events: none;
}
.notif-toast {
  pointer-events: auto;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
  animation: notif-toast-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
}
.notif-toast.is-leaving { animation: notif-toast-out 0.22s ease forwards; }
.notif-toast--info    { border-left-color: var(--blue); }
.notif-toast--success { border-left-color: var(--green); }
.notif-toast--warning { border-left-color: var(--amber); }
.notif-toast--danger  { border-left-color: var(--red); }
.notif-toast-title { font-weight: 600; font-size: 13px; }
.notif-toast-message { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.notif-toast-close {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--muted-3);
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.notif-toast-close:hover { color: var(--text); }

@keyframes notif-toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes notif-toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

@media (max-width: 575.98px) {
  .notif-panel { right: 14px; bottom: 74px; width: calc(100vw - 28px); }
  .notif-toasts { right: 14px; bottom: 74px; width: calc(100vw - 28px); }
  .notif-fab { right: 14px; bottom: 14px; }
  /* Top-nav bell + panel tweaks on very small screens. */
  .app-topnav .notif-panel { right: 0; bottom: auto; width: min(360px, calc(100vw - 20px)); }
}
/* =============================================================================
   Focus / checkout layout (sidebar-less self-serve payment flow)
   ============================================================================= */
.app-shell--focus {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.focus-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
}
.focus-topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.focus-brand {
  color: var(--heading);
  font-weight: 600;
}
.focus-brand:hover {
  color: var(--amber-dark);
}
.focus-brand-name {
  font-size: 1.05rem;
}
.focus-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.focus-theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  margin: 0;
  flex-shrink: 0;
}
.focus-theme-toggle:hover {
  color: var(--amber-dark);
  border-color: rgba(var(--amber-rgb), 0.5);
}

.focus-main {
  flex: 1 1 auto;
}
.focus-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
/* QR generated by the qrcode library (.upi-dynamic-qr): the library appends a
   <canvas> inside this element, so keep that canvas sized to ~170px but allowed
   to shrink on narrow columns (width + max-width:100% + height:auto) and centred,
   so it stays inside the bordered box instead of spilling out past it. */
.upi-dynamic-qr {
  display: flex;
  justify-content: center;
}
.upi-dynamic-qr canvas {
  width: 170px;
  max-width: 100%;
  height: auto;
  display: block;
}
.focus-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

/* ---- Current subscription summary ---- */
.current-plan-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--green-border);
  background: var(--green-soft);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
}
.current-plan-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.current-plan-title {
  margin: 0.1rem 0 0.15rem;
}
.current-plan-name {
  font-family: "Lora", serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--heading);
}
.days-left {
  display: inline-block;
  margin-left: 0.35rem;
  background: rgba(47, 133, 90, 0.12);
  color: var(--green);
  font-weight: 600;
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
}
.current-plan-cta .small {
  max-width: 34rem;
}

/* ---- Pricing tier cards ---- */
.billing-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin: 0 0 1.4rem;
}
.billing-section-title {
  color: var(--heading);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  align-items: start;
}

.tier-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.tier-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(27, 35, 64, 0.1);
}
[data-theme="dark"] .tier-card:hover {
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5);
}

.tier-top {
  height: 6px;
  flex-shrink: 0;
  background: var(--tier-top, var(--amber));
}
.tier-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 1.4rem 1.35rem 1.5rem;
}

.tier-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.tier-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tier-soft, var(--amber-soft));
  color: var(--tier, var(--amber-dark));
  flex-shrink: 0;
}
.tier-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}
.tier-badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.tier-badge--popular {
  background: var(--amber);
  color: #1B2340;
}
.tier-badge--current {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.tier-name {
  margin: 0 0 0.25rem;
  font-family: "Lora", serif;
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--heading);
}
.tier-tag {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.tier-price {
  margin-bottom: 1.1rem;
}
.tier-price-now {
  font-family: "Lora", serif;
  font-weight: 600;
  font-size: 2.1rem;
  line-height: 1.05;
  color: var(--heading);
}
.tier-price-unit {
  margin-left: 0.2rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}
.tier-price-caption {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted-2);
  font-size: 0.78rem;
}

.tier-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}
.tier-features li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.26rem 0;
  color: var(--text);
  font-size: 0.92rem;
}
.tier-features .check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 0.12rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
  background: var(--tier-check, var(--amber));
}

.tier-cta {
  display: block;
  margin-top: auto;
  padding: 0.72rem 1rem;
  border-radius: 10px;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--tier-cta-fg, #1B2340);
  background: var(--tier-cta, var(--amber));
  border: 1px solid var(--tier-cta, var(--amber));
  transition: filter 0.15s ease, transform 0.08s ease;
}
.tier-cta:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
}
.tier-alts {
  margin-top: 0.7rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.8;
}
.tier-alts a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tier-alts a:hover {
  color: var(--heading);
}

/* Per-tier accents */
.tier--starter {
  --tier: var(--teal);
  --tier-soft: var(--teal-soft);
  --tier-top: var(--teal);
  --tier-check: var(--teal);
  --tier-cta: var(--teal);
  --tier-cta-fg: #fff;
}
.tier--growth {
  --tier: var(--amber);
  --tier-soft: var(--amber-soft);
  --tier-top: var(--amber);
  --tier-check: var(--amber);
  --tier-cta: var(--amber);
  --tier-cta-fg: #1B2340;
}

/* Featured (recommended) tier sits slightly forward of its neighbours. */
.tier--featured {
  border-width: 2px;
  border-color: rgba(var(--amber-rgb), 0.55);
  box-shadow: 0 0 0 1px rgba(var(--amber-rgb), 0.3), 0 18px 42px rgba(27, 35, 64, 0.12);
}
[data-theme="dark"] .tier--featured {
  box-shadow: 0 0 0 1px rgba(var(--amber-rgb), 0.35), 0 18px 42px rgba(0, 0, 0, 0.5);
}

/* Active / "Your plan" state beats the tier colour on the top bar. */
.tier--current {
  border-color: var(--green-border);
}
.tier--current .tier-top {
  background: var(--green);
}

/* Enterprise — premium dark surface. */
.tier--enterprise {
  --tier: var(--amber);
  --tier-soft: rgba(255, 255, 255, 0.10);
  --tier-top: var(--amber);
  --tier-check: var(--amber);
  --tier-cta: var(--amber);
  --tier-cta-fg: #1B2340;
  background: var(--ink);
  border-color: var(--ink-soft);
  color: #E6E8EF;
}
.tier--enterprise .tier-name,
.tier--enterprise .tier-price-now {
  color: #fff;
}
.tier--enterprise .tier-tag,
.tier--enterprise .tier-price-unit,
.tier--enterprise .tier-price-caption,
.tier--enterprise .tier-alts {
  color: #C9CEDC;
}
.tier--enterprise .tier-features li {
  color: #E6E8EF;
}
.tier--enterprise .tier-cta--ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}
.tier--enterprise .tier-cta--ghost:hover {
  background: #fff;
  color: var(--ink);
  filter: none;
}
.tier-contact {
  margin-top: auto;
}

/* =============================================================================
   Subscription & billing page
   ============================================================================= */
.billing-head-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.billing-section {
  margin-top: 2rem;
}

/* ---- Current-subscription status card ---- */
.sub-status-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  border: 1px solid var(--green-border);
  background: linear-gradient(120deg, var(--green-soft), var(--surface));
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.5rem;
}
.sub-status--trial {
  border-color: rgba(var(--amber-rgb), 0.45);
  background: linear-gradient(120deg, var(--amber-soft), var(--surface));
}
.sub-status-main {
  flex: 1 1 300px;
  min-width: 240px;
}
.sub-status-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.sub-status-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.15rem 0 0.2rem;
}
.sub-status-name {
  font-family: "Lora", serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--heading);
}
.sub-status-meta {
  color: var(--muted);
  font-size: 0.9rem;
}
.sub-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.sub-badge--active {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green-border);
}
.sub-badge--trial {
  background: rgba(var(--amber-rgb), 0.16);
  color: var(--amber-dark);
  border: 1px solid rgba(var(--amber-rgb), 0.35);
}
[data-theme="dark"] .sub-badge--trial {
  color: #f0c27b;
}
.sub-days-left {
  display: inline-block;
  margin-left: 0.5rem;
  background: rgba(47, 133, 90, 0.12);
  color: var(--green);
  font-weight: 600;
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
}
.sub-status--trial .sub-days-left {
  background: rgba(var(--amber-rgb), 0.16);
  color: var(--amber-dark);
}
[data-theme="dark"] .sub-status--trial .sub-days-left {
  color: #f0c27b;
}
.sub-progress {
  margin-top: 0.85rem;
  height: 7px;
  border-radius: 999px;
  background: var(--neutral);
  overflow: hidden;
  max-width: 420px;
}
[data-theme="dark"] .sub-progress {
  background: var(--subtle-2);
}
.sub-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--green);
  transition: width 0.4s ease;
}
.sub-status--trial .sub-progress-fill {
  background: var(--amber);
}
.sub-status-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
  flex: 0 1 320px;
}
.sub-status-cta .small {
  max-width: 26rem;
}

/* ---- Free Trial tier card ---- */
.tier--trial {
  --tier: var(--teal);
  --tier-soft: var(--teal);
  --tier-top: var(--teal);
  --tier-check: var(--teal);
  --tier-cta: var(--teal);
  --tier-cta-fg: #fff;
  background:
    linear-gradient(180deg, rgba(var(--teal-rgb), 0.06), transparent 42%),
    var(--surface);
}
.tier--trial .tier-icon {
  color: var(--teal);
}
.tier-badge--trial {
  background: rgba(var(--teal-rgb), 0.14);
  color: var(--teal);
  border: 1px solid rgba(var(--teal-rgb), 0.35);
}
.tier--trial .tier-current-note {
  margin-top: auto;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: var(--subtle);
  border: 1px dashed var(--border);
}

/* ---- Recent payments ---- */
.recent-payments {
  margin-top: 2.25rem;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
  padding: 1.25rem 1.4rem;
}
.recent-payments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.recent-payments-title {
  color: var(--heading);
}
.recent-payments-head a {
  color: var(--muted);
  text-decoration: none;
}
.recent-payments-head a:hover {
  color: var(--amber-dark);
  text-decoration: underline;
}
.recent-payments-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.recent-payment {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--border-faint);
}
.recent-payment:first-of-type {
  border-top: none;
}
.recent-payment-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-soft);
  color: var(--muted);
}
.recent-payment-info {
  flex: 1 1 auto;
  min-width: 0;
}
.recent-payment-plan {
  font-weight: 600;
  color: var(--heading);
  font-size: 0.93rem;
}
.recent-payment-date {
  margin-top: 0.1rem;
}
.recent-payment-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}
.recent-payment-amount {
  font-weight: 600;
  font-size: 0.93rem;
  color: var(--heading);
}
.pay-status {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.pay-status--paid {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green-border);
}
.pay-status--pending,
.pay-status--authorized {
  background: var(--amber-soft);
  color: var(--amber-dark);
  border: 1px solid rgba(var(--amber-rgb), 0.35);
}
[data-theme="dark"] .pay-status--pending,
[data-theme="dark"] .pay-status--authorized {
  color: #f0c27b;
}
.pay-status--failed,
.pay-status--cancelled,
.pay-status--refunded {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid var(--red-border);
}

/* Billing page within the (wide) focus container. */
.focus-container {
  max-width: 960px;
}

/* =====================================================================
   Seat history timeline (compact) — member detail page
   ===================================================================== */
/* A vertical rail with a dot per entry, running from the member's first
   seat (top) to their most recent (bottom). */
.seat-history-timeline {
  position: relative;
}
.seat-history-timeline::before {
  /* vertical rail */
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 11px;
  width: 2px;
  background: rgba(127, 127, 127, 0.35);
}
.seat-history-item {
  position: relative;
  padding-left: 2.2rem;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}
.seat-history-item:first-of-type {
  padding-top: 0.25rem;
}
.seat-history-item:last-of-type {
  padding-bottom: 0.25rem;
}
.seat-history-dot {
  position: absolute;
  left: 2px;
  top: 0.85rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--amber-soft, rgba(217, 142, 43, 0.16));
  border: 2px solid var(--amber-dark, #9a5d0c);
}
.seat-history-date {
  width: 7.5rem;
  flex-shrink: 0;
}
.seat-history-body {
  min-width: 0;
}
