/* ==========================================================================
   Masjid Committee Management System — Design System
   Professional, light, green-accented administrative theme with dark mode.
   ========================================================================== */

:root {
  --green-50:  #eafaf1;
  --green-100: #d2f3e0;
  --green-200: #a7e6c3;
  --green-500: #1f9d55;
  --green-600: #178a49;
  --green-700: #0f6e39;
  --green-800: #0b5a2e;
  /* New deep forest green (matches the reference UI sidebar). */
  --green-900: #0c3b25;
  --green-950: #0a2e1d;

  --accent: var(--green-900);        /* buttons & accents use the new green */
  --accent-hover: #114a2f;           /* slightly lighter on hover */
  --teal: #14b8a6;              /* reference brand tile / accents */
  --teal-600: #0d9488;

  --bg: #eef1f0;               /* soft neutral-green page background */
  --surface: #ffffff;
  --surface-alt: #f5f8f6;
  --border: #e6ebe8;
  --text: #16241d;
  --text-muted: #6a7b72;
  /* Deep forest sidebar with a subtle vertical gradient, per the reference. */
  --sidebar-bg: #0c3b25;
  --sidebar-bg-2: #0a2e1d;
  --sidebar-text: #cfe3d8;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: rgba(255, 255, 255, 0.12);

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  /* Softer, layered elevations for a more premium, less "flat template" feel. */
  --shadow-sm: 0 1px 2px rgba(16, 40, 32, .04), 0 1px 3px rgba(16, 40, 32, .05);
  --shadow-md: 0 2px 6px rgba(16, 40, 32, .05), 0 10px 24px rgba(16, 40, 32, .07);
  --shadow-lg: 0 8px 20px rgba(16, 40, 32, .08), 0 20px 48px rgba(16, 40, 32, .12);

  --sidebar-width: 256px;

  /* ---- Type scale (fluid-ish, rem-based) ---- */
  --fs-xs:   .72rem;
  --fs-sm:   .82rem;
  --fs-base: .92rem;
  --fs-md:   1rem;
  --fs-lg:   1.15rem;
  --fs-xl:   1.5rem;
  --fs-2xl:  2rem;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extra: 800;
  --lh-tight: 1.2;
  --lh-normal: 1.5;

  /* ---- Spacing scale (4px rhythm) ---- */
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  /* ---- Motion ---- */
  --dur-fast: .12s;
  --dur: .2s;
  --dur-slow: .28s;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  /* ---- Focus ring (accessible, brand-tinted) ---- */
  --focus-ring: 0 0 0 .2rem color-mix(in srgb, var(--accent) 30%, transparent);

  /* Skeleton shimmer base/highlight (light). */
  --skeleton-base: #e8ede9;
  --skeleton-hi: #f4f7f5;
}

[data-theme="dark"] {
  --bg: #0f1512;
  --surface: #161d19;
  --surface-alt: #1d2621;
  --border: #283229;
  --text: #e6edea;
  --text-muted: #93a69b;
  --sidebar-bg: #0a241a;
  --sidebar-bg-2: #071a12;
  --sidebar-text: #c7ddce;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 2px 6px rgba(0,0,0,.4), 0 10px 24px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 20px rgba(0,0,0,.5), 0 20px 48px rgba(0,0,0,.6);
  --focus-ring: 0 0 0 .2rem rgba(79, 213, 154, .28);
  --skeleton-base: #1d2621;
  --skeleton-hi: #27332c;
}

/* Bundled Malayalam web font so on-screen Malayalam (inputs, labels, previews)
   renders conjuncts and vowel signs correctly in the browser — the Latin UI
   font (Inter) has no Malayalam glyphs and would show tofu/boxes. */
@font-face {
  font-family: 'Noto Sans Malayalam';
  src: url('../fonts/NotoSansMalayalam.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0D00-0D7F, U+200C-200D, U+20B9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* Noto Sans Malayalam is listed so browsers pick it up for ML codepoints
     (per unicode-range) while Inter handles Latin. */
  font-family: 'Inter', 'Noto Sans Malayalam', 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  font-size: 14.5px;
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Accessible, brand-consistent focus ring for keyboard users across the app. */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.nav-link-item:focus-visible,
a.stat-card:focus-visible { box-shadow: var(--focus-ring); }

/* Force the Malayalam face first on elements that commonly hold Malayalam. */
.ml-text, [dir="auto"], input[name$="_ml"], textarea[name$="_ml"] {
  font-family: 'Noto Sans Malayalam', 'Inter', 'Segoe UI', sans-serif;
}

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

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .25s ease;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 4px; }

.sidebar-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1.1rem 1.1rem;
  font-weight: 700; font-size: 1.02rem;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand .brand-logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--teal), var(--teal-600));
  box-shadow: 0 2px 8px rgba(20,184,166,.35);
  display: grid; place-items: center; font-size: 1.1rem; color: #fff;
  overflow: hidden; flex: none;
}
.sidebar-brand .brand-logo img { width: 100%; height: 100%; object-fit: cover; }

.nav-section { padding: .5rem .6rem; }
.nav-section-title {
  padding: .7rem .9rem .35rem;
  font-size: .66rem; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(255,255,255,.42); font-weight: 700;
}
/* Rounded pill nav items, matching the reference CRM sidebar. */
.nav-link-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .85rem;
  margin: .1rem 0;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-link-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.nav-link-item.active .nav-icon { color: #4fd59a; opacity: 1; }
.nav-link-item .nav-icon { width: 18px; text-align: center; flex: none; opacity: .9; }
.nav-group > .nav-link-item .chevron { margin-left: auto; transition: transform .2s; font-size: .7rem; }
.nav-group.open > .nav-link-item .chevron { transform: rotate(90deg); }
.nav-children { display: none; padding-left: .2rem; }
.nav-group.open > .nav-children { display: block; }
.nav-children .nav-link-item { padding-left: 2.4rem; font-size: .85rem; }

/* ---------- Main ---------- */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex; flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky; top: 0; z-index: 1030;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.4rem;
  box-shadow: var(--shadow-sm);
}
.topbar .page-title { font-weight: 700; font-size: 1.05rem; margin: 0; }
.topbar .spacer { flex: 1; }
.topbar-icon-btn {
  border: 1px solid var(--border); background: var(--surface-alt);
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; cursor: pointer; color: var(--text);
}
.topbar-icon-btn:hover { background: var(--green-50); color: var(--accent); }

.content { padding: 1.4rem; flex: 1; }

.breadcrumb-bar {
  font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--space-4);
  display: flex; align-items: center; flex-wrap: wrap; gap: .1rem;
}
.breadcrumb-bar a { color: var(--text-muted); transition: color var(--dur-fast) var(--ease); }
.breadcrumb-bar a:hover { color: var(--accent); }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-4); margin-bottom: var(--space-5); flex-wrap: wrap;
}
.page-header h1 {
  font-size: var(--fs-xl); margin: 0 0 .2rem; font-weight: var(--fw-extra);
  letter-spacing: -.02em; line-height: var(--lh-tight);
}
.page-header .subtitle { color: var(--text-muted); font-size: var(--fs-base); }
/* Optional eyebrow label above a page title (opt-in). */
.page-header .eyebrow {
  display: inline-block; font-size: var(--fs-xs); font-weight: var(--fw-bold);
  letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
  margin-bottom: .35rem;
}
/* Reusable section heading inside a page/card. */
.section-title {
  font-size: var(--fs-sm); font-weight: var(--fw-bold); letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-muted); margin: 0 0 var(--space-3);
}

/* ---------- Cards ---------- */
.card-ui {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card-ui:hover { box-shadow: var(--shadow-md); }
.card-ui .card-ui-head {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  font-weight: var(--fw-bold); font-size: var(--fs-base); letter-spacing: -.01em;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
}
.card-ui .card-ui-head .card-action { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--accent); }
.card-ui .card-ui-body { padding: 1.25rem; }

/* Summary stat / KPI cards — circular pastel icon chips (reference style) */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.15rem 1.25rem;
  display: flex; flex-direction: column; gap: .3rem;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  height: 100%;
}
a.stat-card:hover, .stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); color: var(--text); }
.stat-card .stat-label { color: var(--text-muted); font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  text-transform: uppercase; letter-spacing: .03em; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: var(--fw-extra); letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; }
.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.15rem;
  background: var(--green-50); color: var(--accent); margin-bottom: .35rem;
}
.stat-card.danger  .stat-icon { background: #fdecec; color: #d14343; }
.stat-card.warning .stat-icon { background: #fff4e2; color: #c87f0a; }
.stat-card.info    .stat-icon { background: #e7f0fd; color: #2b6cb0; }
.stat-card.purple  .stat-icon { background: #f0e9fd; color: #7c54c9; }
.stat-card.teal    .stat-icon { background: #e1f6f2; color: var(--teal-600); }
.stat-card.pink    .stat-icon { background: #fde9f1; color: #c0407e; }
[data-theme="dark"] .stat-card .stat-icon { filter: brightness(.9); }

/* Reusable welcome / highlight banner (reference's greeting block) */
.welcome-banner {
  position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius);
  background:
    radial-gradient(120% 160% at 0% 0%, color-mix(in srgb, var(--accent) 12%, var(--surface)) 0%, var(--surface) 55%),
    var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 1.3rem 1.5rem; margin-bottom: 1.3rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.welcome-banner::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: linear-gradient(var(--accent), var(--teal)); }
.welcome-banner h2 { margin: 0 0 .2rem; font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.welcome-banner p { margin: 0; color: var(--text-muted); font-size: .9rem; }
.welcome-banner .wb-meta { text-align: right; }
.welcome-banner .wb-meta .wb-k { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.welcome-banner .wb-meta .wb-v { font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  border-radius: 10px; font-weight: var(--fw-semibold);
  letter-spacing: .01em;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary, .btn-success {
  background: var(--accent); border-color: var(--accent);
}
.btn-primary:hover, .btn-success:hover {
  background: var(--accent-hover); border-color: var(--accent-hover);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 30%, transparent);
}
.btn-outline-primary { color: var(--accent); border-color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); }
/* Comfortable, consistent icon-only buttons in table rows / toolbars. */
.btn-sm { border-radius: var(--radius-sm); }

/* ---------- Tables ---------- */
.table-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-responsive { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; margin: 0; font-size: .88rem; }
table.data-table thead th {
  background: var(--surface-alt); color: var(--text-muted);
  text-align: left; padding: .75rem .9rem; font-weight: var(--fw-semibold);
  text-transform: uppercase; font-size: var(--fs-xs); letter-spacing: .04em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data-table tbody td { padding: .75rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table tbody tr { transition: background var(--dur-fast) var(--ease); }
table.data-table tbody tr:hover { background: var(--surface-alt); }
table.data-table tbody tr:last-child td { border-bottom: none; }
/* Numeric/amount cells read better right-aligned with tabular figures. */
table.data-table td.money, table.data-table th.text-end, table.data-table td.text-end { font-variant-numeric: tabular-nums; }

/* Light polish for Bootstrap .table used across many pages (coexists with the
   dark-theme token mapping in theme-dark.css). */
.table > thead th {
  text-transform: uppercase; font-size: var(--fs-xs); letter-spacing: .04em;
  color: var(--text-muted); font-weight: var(--fw-semibold);
}
.table-hover > tbody > tr { transition: background var(--dur-fast) var(--ease); }

/* Opt-in sticky header for long tables: add .table-sticky to a scroll wrapper. */
.table-sticky { max-height: 70vh; overflow: auto; }
.table-sticky thead th { position: sticky; top: 0; z-index: 2; }

/* ---------- Status labels ---------- */
.status-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .22rem .62rem; border-radius: var(--radius-pill); font-size: var(--fs-xs);
  font-weight: var(--fw-semibold); line-height: 1.4; white-space: nowrap;
}
.status-active, .status-approved, .status-paid, .status-present { background: var(--green-50); color: var(--green-700); }
.status-inactive, .status-cancelled, .status-absent { background: #f1f3f5; color: #6b7a86; }
.status-pending, .status-draft, .status-excused { background: #fff6e5; color: #c87f0a; }
.status-rejected, .status-overdue { background: #fdecec; color: #c0392b; }
[data-theme="dark"] .status-active, [data-theme="dark"] .status-approved,
[data-theme="dark"] .status-paid { background: rgba(31,157,85,.2); color: #7ee2a8; }

/* ---------- Forms ---------- */
.form-label { font-weight: var(--fw-semibold); font-size: var(--fs-sm); margin-bottom: .3rem; }
.form-control, .form-select {
  border-radius: var(--radius-sm); border-color: var(--border);
  background: var(--surface); color: var(--text);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.form-control:focus, .form-select:focus {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--focus-ring);
}
.form-text { font-size: var(--fs-xs); color: var(--text-muted); }
.required-mark { color: #c0392b; }
.input-group-text { border-radius: var(--radius-sm); background: var(--surface-alt); border-color: var(--border); }

/* ---------- Empty / loading states ---------- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon {
  font-size: 2.6rem; opacity: .5; margin-bottom: .6rem; color: var(--text-muted);
  display: grid; place-items: center;
}
/* Polished circular empty-state icon chip (opt-in by wrapping the icon). */
.empty-state .empty-chip {
  width: 64px; height: 64px; margin: 0 auto .8rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.8rem;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-alt));
  color: var(--accent);
}
.empty-state h5 { font-weight: var(--fw-bold); margin: 0 0 .25rem; color: var(--text); }

/* ---------- Misc ---------- */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035;
}
.text-muted-2 { color: var(--text-muted); }
.money { font-variant-numeric: tabular-nums; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .sidebar-backdrop.show { display: block; }
}

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--green-700), var(--green-500));
  padding: 1.5rem;
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface);
  border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.25);
  padding: 2rem 2rem 1.6rem;
}
.auth-brand { text-align: center; margin-bottom: 1.4rem; }
.auth-brand .auth-logo {
  width: 60px; height: 60px; border-radius: 16px; margin: 0 auto .7rem;
  background: var(--green-50); display: grid; place-items: center;
  font-size: 1.7rem; color: var(--accent);
}
.auth-brand h1 { font-size: 1.25rem; margin: 0; }
.auth-brand p { color: var(--text-muted); font-size: .85rem; margin: .25rem 0 0; }
.pw-toggle { cursor: pointer; }


/* ---------- Pay Now calendar ---------- */
.paynow-cal {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 575.98px) { .paynow-cal { grid-template-columns: repeat(2, 1fr); } }
.pc-cell {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  background: var(--surface); position: relative; user-select: none;
}
.pc-cell .pc-m { font-weight: 700; }
.pc-cell .pc-s { font-size: .76rem; margin-top: 3px; }
.pc-paid { background: #fdecec; border-color: #f3bcbc; }     /* paid -> red, per request */
.pc-paid .pc-m, .pc-paid .pc-s { color: #c0392b; }
.pc-advance { background: #e8f1fd; border-color: #bcd6f5; }
.pc-advance .pc-m { color: #2b6cb0; }
.pc-partial { background: #fff6e5; border-color: #ffe0a3; }
.pc-partial .pc-m { color: #c87f0a; }
.pc-pending { background: var(--surface-alt); }
.pc-none, .pc-future, .pc-exempt { background: var(--surface-alt); color: var(--text-muted); }
.pc-selectable { cursor: pointer; }
.pc-selectable:hover { border-color: var(--accent); }
.pc-cell.pc-selected {
  outline: 3px solid var(--accent); border-color: var(--accent);
  background: var(--green-50);
}
.pc-cell.pc-selected .pc-m { color: var(--green-700); }
.pc-cell.pc-selected::after {
  content: '\2713'; position: absolute; top: 6px; right: 8px;
  color: var(--accent); font-weight: 700;
}
.paynow-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .78rem; color: var(--text-muted); }
.paynow-legend .dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: middle; }
.paynow-legend .d-paid { background: #f3bcbc; }
.paynow-legend .d-advance { background: #bcd6f5; }
.paynow-legend .d-partial { background: #ffe0a3; }
.paynow-legend .d-pending { background: #e3e8ee; border: 1px solid #c9d3cd; }
.paynow-legend .d-none { background: var(--surface-alt); border: 1px solid var(--border); }

/* Shared legend-swatch classes (used by collection calendars/legends) so the
   small reference chips are theme-aware instead of hardcoded inline colours.
   Light values here; dark variants live in theme-dark.css. */
.lg-paid     { background: #a7e6c3; }
.lg-advance  { background: #eaf2fd; border: 1px solid #aecbf2; }
.lg-partial  { background: #ffe0a3; }
.lg-pending  { background: #f3bcbc; }
.lg-due      { background: #fdecec; border: 1px solid #e8a9a9; }
.lg-selected { background: #1f9d55; }
.lg-notdue   { background: #f7f9fa; border: 1px dashed #dde4e8; }
.lg-none     { background: #e3e8ee; }

/* ============================================================
   Backend-backed searchable select ([data-search-select])
   ============================================================ */
.ass-wrap { position: relative; }
.ass-hidden-native {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ass-control {
  display: flex; align-items: center; gap: .5rem;
  cursor: pointer; min-height: calc(1.5em + .75rem + 2px);
}
.ass-control:focus { outline: 0; border-color: #86b7fe;
  box-shadow: 0 0 0 .25rem rgba(13,110,253,.25); }
.ass-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.ass-label.ass-placeholder { color: #8a9197; }
.ass-clear {
  border: 0; background: transparent; font-size: 1.25rem; line-height: 1;
  color: #8a9197; padding: 0 .15rem; cursor: pointer; display: none;
}
.ass-clear:hover { color: #dc3545; }

.ass-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 1056;
  background: var(--card-bg, #fff); border: 1px solid rgba(0,0,0,.15);
  border-radius: .5rem; box-shadow: 0 .5rem 1rem rgba(0,0,0,.175);
  padding: .5rem; max-width: 100%;
}
.ass-panel.ass-up { top: auto; bottom: calc(100% + 2px); }
.ass-search-row { margin-bottom: .4rem; }
.ass-results { max-height: 240px; overflow-y: auto; }
.ass-item {
  padding: .4rem .55rem; border-radius: .35rem; cursor: pointer;
  display: flex; flex-direction: column; gap: 1px;
}
.ass-item:hover, .ass-item.active { background: rgba(13,110,253,.1); }
.ass-item-label { font-weight: 500; }
.ass-item-detail { font-size: .8125rem; color: #6c757d; }
.ass-msg { padding: .6rem .55rem; color: #6c757d; font-size: .875rem; text-align: center; }
.ass-msg.ass-empty { color: #8a9197; }
.ass-more { font-style: italic; }

/* Dark theme */
[data-theme="dark"] .ass-panel {
  background: #1b2420; border-color: rgba(255,255,255,.14);
}
[data-theme="dark"] .ass-item:hover,
[data-theme="dark"] .ass-item.active { background: rgba(120,190,150,.18); }
[data-theme="dark"] .ass-item-detail,
[data-theme="dark"] .ass-msg { color: #9fb0a7; }

/* Responsive: on small screens the panel can use full width comfortably */
@media (max-width: 575.98px) {
  .ass-results { max-height: 50vh; }
}

/* ============================================================
   Premium interactions, entrance animations & skeleton loaders
   All motion is opt-in to prefers-reduced-motion: users who ask
   for less motion get an instant, static UI.
   ============================================================ */

/* Sidebar nav sub-group expand/collapse easing (height-less, opacity+slide). */
.nav-children { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .nav-group > .nav-children {
    /* collapsed state handled by display:none in the base rules; when open,
       the items fade/slide in subtly. */
  }
  .nav-group.open > .nav-children .nav-link-item {
    animation: navItemIn var(--dur) var(--ease) both;
  }
  @keyframes navItemIn {
    from { opacity: 0; transform: translateX(-4px); }
    to   { opacity: 1; transform: translateX(0); }
  }

  /* Page content reveal: .content children fade/rise in a gentle stagger once
     the app shell marks itself ready (JS adds .app-ready to <body>). */
  body.app-ready .content > * {
    animation: revealUp var(--dur-slow) var(--ease-out) both;
  }
  body.app-ready .content > *:nth-child(1) { animation-delay: .02s; }
  body.app-ready .content > *:nth-child(2) { animation-delay: .06s; }
  body.app-ready .content > *:nth-child(3) { animation-delay: .10s; }
  body.app-ready .content > *:nth-child(4) { animation-delay: .14s; }
  body.app-ready .content > *:nth-child(5) { animation-delay: .18s; }
  body.app-ready .content > *:nth-child(n+6) { animation-delay: .2s; }
  @keyframes revealUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Interactive stat cards get a slightly springier lift. */
  a.stat-card { transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }

  /* Dropdown + modal entrance polish (coexists with Bootstrap's own classes). */
  .dropdown-menu.show { animation: ddIn var(--dur-fast) var(--ease-out) both; }
  @keyframes ddIn { from { opacity: 0; transform: translateY(-4px) scale(.99); } to { opacity: 1; transform: none; } }
  .modal.fade .modal-dialog { transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-slow) var(--ease-out); }

  /* Skeleton shimmer. */
  .skeleton { position: relative; overflow: hidden; }
  .skeleton::after {
    content: ""; position: absolute; inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, var(--skeleton-hi), transparent);
    animation: shimmer 1.3s infinite;
  }
  @keyframes shimmer { 100% { transform: translateX(100%); } }
}

/* Skeleton base blocks (visible regardless of motion preference; only the
   shimmer sweep above is motion-gated). */
.skeleton {
  background: var(--skeleton-base);
  border-radius: var(--radius-sm);
  display: block;
}
.skeleton-text { height: .8rem; margin: .4rem 0; width: 100%; }
.skeleton-text.w-60 { width: 60%; }
.skeleton-text.w-40 { width: 40%; }
.skeleton-card { height: 96px; border-radius: var(--radius); }
.skeleton-avatar { width: 44px; height: 44px; border-radius: 50%; }

/* A small inline loading spinner utility for buttons / inline states. */
.loading-dots::after {
  content: ""; display: inline-block; width: 1em; text-align: left;
  animation: none;
}
@media (prefers-reduced-motion: no-preference) {
  .loading-dots::after { animation: dots 1.2s steps(4, end) infinite; }
  @keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
}

/* Topbar gains a soft shadow once the page is scrolled (JS toggles .scrolled). */
.topbar { transition: box-shadow var(--dur) var(--ease); }
.topbar.scrolled { box-shadow: var(--shadow-md); }

/* Honour reduced motion globally: neutralise transitions/animations. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
