/* ==========================================================================
   Nile Finance CRM — UI layer
   --------------------------------------------------------------------------
   Loaded AFTER the legacy theme (style.css) and re-themes every class the
   page templates already use, plus the new shell (header / sidebar /
   modal / toast / command palette) that base.html renders.

   Colours follow the official Nile University Brand Guide, the same tokens
   the Nile Online CRM uses:
     NILE Blue    #1C4DA1  (Pantone 2728C)  primary, 60%
     Mantis Green #6FBF58  (Pantone 7488C)  accent, 30%
     Mine Shaft   #333435  (Pantone 426C)   text, 10%
   Typeface: Lato (shared with Nile Online).

   Brand hard rules: flat colours only. No gradients, glows, glass/blur or
   shimmer. Depth comes from 1px borders and soft neutral shadows.

   Motion follows the animations.dev rules: short ease-out entrances,
   transform/opacity only, no motion on high-frequency interactions, and a
   reduced-motion variant that fades instead of moving.
   ========================================================================== */

:root {
  /* Brand */
  --nile-blue: #1C4DA1;
  --nile-blue-600: #173F84;
  --nile-blue-700: #133670;
  --nile-blue-800: #0F2B59;
  --nile-blue-900: #0B2146;
  --nile-blue-50: #EAF0F9;
  --nile-blue-100: #D5E1F3;
  --nile-blue-200: #ADC3E7;
  --nile-green: #6FBF58;
  --nile-green-600: #5AA844;
  --nile-green-700: #3F7F2D;
  --nile-green-50: #EAF6E6;
  --nile-green-100: #D3ECC9;
  --nile-sky: #4A7CC9;

  /* Ink (Mine Shaft) */
  --ink: #333435;
  --ink-2: #4A4D52;
  --ink-3: #5F6577;
  --ink-4: #7A8899;

  /* Ground */
  --bg: #F5F7FB;
  --sidebar-bg: #EDF1F8;
  --sidebar-hover: #E2E8F4;
  --surface: #FFFFFF;
  --surface-2: #F5F7FA;
  --surface-3: #EEF0F4;
  --line: #DDE1E9;
  --line-2: #CDD3DE;

  /* Status triples: text / surface / border (flat) */
  --success: #1A7A4A; --success-bg: #EAF6E6; --success-line: #C6E4BC;
  --warning: #B7791F; --warning-bg: #FDF6E7; --warning-line: #EDD9A9;
  --danger:  #C0392B; --danger-bg:  #FBECEB; --danger-line:  #F1C9C4;
  --info:    #1C4DA1; --info-bg:    #EAF0F9; --info-line:    #C7D6EE;

  /* Brand guide: inputs/buttons ~9px, cards ~12px, chips ~6px, modals ~16px */
  --radius: 12px;
  --radius-sm: 9px;
  --radius-chip: 6px;
  --radius-lg: 16px;
  --radius-xl: 16px;

  /* Soft neutral shadows only */
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-2: 0 2px 16px rgba(0, 0, 0, .06);
  --shadow-3: 0 12px 40px rgba(0, 0, 0, .14);
  --ring: 0 0 0 3px rgba(28, 77, 161, .18);

  --font-sans: "Lato", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: var(--font-sans);
  --font-mono: var(--font-sans);
  --font-code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease-out-expo: cubic-bezier(.19, 1, .22, 1);
  --ease-out-quad: cubic-bezier(.25, .46, .45, .94);
  --ease-in-out-cubic: cubic-bezier(.645, .045, .355, 1);
  --ease-vaul: cubic-bezier(.32, .72, 0, 1);

  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
  --header-h: 64px;
}

/* Lato, the same files the Nile Online CRM ships */
@font-face { font-family: "Lato"; font-weight: 300; font-style: normal; font-display: swap;
  src: url("../fonts/lato/Lato-Light.woff2") format("woff2"), url("../fonts/lato/Lato-Light.woff") format("woff"); }
@font-face { font-family: "Lato"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../fonts/lato/Lato-Regular.woff2") format("woff2"), url("../fonts/lato/Lato-Regular.woff") format("woff"); }
@font-face { font-family: "Lato"; font-weight: 500 700; font-style: normal; font-display: swap;
  src: url("../fonts/lato/Lato-Bold.woff2") format("woff2"), url("../fonts/lato/Lato-Bold.woff") format("woff"); }
@font-face { font-family: "Lato"; font-weight: 800 900; font-style: normal; font-display: swap;
  src: url("../fonts/lato/Lato-Black.woff2") format("woff2"), url("../fonts/lato/Lato-Black.woff") format("woff"); }

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
html { scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body.nile {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body.nile h1, body.nile h2, body.nile h3, body.nile h4, body.nile h5, body.nile h6 {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -.01em;
}
body.nile a { color: var(--nile-blue); text-decoration: none; }
body.nile a:hover, body.nile a:focus, body.nile a.active { color: var(--nile-blue-600); }
body.nile ::selection { background: var(--nile-green-100); }
body.nile :focus-visible { outline: 2px solid var(--nile-blue); outline-offset: 2px; border-radius: 4px; }
body.nile .text-muted { color: var(--ink-3) !important; }
body.nile .text-primary { color: var(--nile-blue) !important; }
body.nile .text-success { color: var(--success) !important; }
body.nile .text-danger { color: var(--danger) !important; }
body.nile .text-warning { color: var(--warning) !important; }
body.nile strong, body.nile b { font-weight: 600; }
body.nile code, body.nile .mono, body.nile .nile-code, body.nile pre { font-family: var(--font-code); font-size: .9em; letter-spacing: 0; }
body.nile .tabular { font-variant-numeric: tabular-nums; }

/* The legacy skin sets a preloader + main-wrapper fade; make sure nothing hides. */
body.nile #main-wrapper { opacity: 1; }

/* --------------------------------------------------------------------------
   Shell: sidebar + header + main
   -------------------------------------------------------------------------- */
.nile-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 220ms var(--ease-out-expo);
}
body.nile.is-collapsed .nile-shell { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

/* Sidebar ------------------------------------------------------------------ */
/* Light blue-grey panel with the standard blue logo, the same layout as the
   Nile hostel CRM. Active item = white card with blue text. */
.nile-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  color: var(--ink);
  overflow: hidden;
  z-index: 40;
}

.nile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--header-h);
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.nile-brand a { display: flex; align-items: center; gap: 12px; min-width: 0; }
.nile-brand-logo { display: block; height: 36px; width: auto; }
.nile-brand-mark {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: none; place-items: center;
  background: var(--nile-blue);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  color: #fff;
}
body.nile.is-collapsed .nile-brand-logo { display: none; }
body.nile.is-collapsed .nile-brand-mark { display: grid; }
body.nile.is-collapsed .nile-brand { justify-content: center; padding: 0; }

.nile-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 12px 24px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.nile-nav::-webkit-scrollbar { width: 6px; }
.nile-nav::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

.nile-nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 18px 12px 6px;
  white-space: nowrap;
}
.nile-nav-group:first-child .nile-nav-label { padding-top: 4px; }
body.nile.is-collapsed .nile-nav-label { font-size: 0; padding: 12px 0 4px; }
body.nile.is-collapsed .nile-nav-label::after { content: ""; display: block; height: 1px; margin: 0 16px; background: var(--line); }

.nile-nav-link,
.nile-nav-sub > .nile-nav-sub-toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  /* Hover is seen dozens of times a minute: colour only, fast. */
  transition: background-color 120ms ease, color 120ms ease;
}
.nile-nav-link svg, .nile-nav-sub > .nile-nav-sub-toggle svg.nile-ico {
  width: 18px; height: 18px; flex-shrink: 0;
  stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
  color: var(--ink-3);
}
.nile-nav-link span, .nile-nav-sub > .nile-nav-sub-toggle span { overflow: hidden; text-overflow: ellipsis; }
.nile-nav-link:hover, .nile-nav-sub > .nile-nav-sub-toggle:hover { background: var(--sidebar-hover); }
.nile-nav-link[aria-current="page"] {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.nile-nav-link[aria-current="page"] svg,
.nile-nav-sub[data-active] > .nile-nav-sub-toggle svg.nile-ico { color: var(--nile-blue); }
.nile-nav-link[aria-current="page"]::after {
  content: ""; margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--nile-green); flex-shrink: 0;
}

.nile-nav-sub > .nile-nav-sub-toggle .nile-chev {
  margin-left: auto; width: 14px; height: 14px; color: var(--ink-4);
  stroke: currentColor; fill: none; stroke-width: 2;
  transition: transform 180ms var(--ease-out-expo);
}
.nile-nav-sub[open] > .nile-nav-sub-toggle .nile-chev { transform: rotate(90deg); }
.nile-nav-sublist {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 200ms var(--ease-out-expo);
}
.nile-nav-sub[open] .nile-nav-sublist { grid-template-rows: 1fr; }
.nile-nav-sublist > div {
  overflow: hidden; min-height: 0; visibility: hidden;
  transition: visibility 0s linear 200ms;
  margin-left: 21px; border-left: 1px solid var(--line-2); padding-left: 8px;
}
.nile-nav-sub[open] .nile-nav-sublist > div { visibility: visible; transition-delay: 0s; }
.nile-nav-sub[open] .nile-nav-sublist > div { padding-top: 2px; padding-bottom: 6px; }
.nile-nav-sublist a {
  display: flex; align-items: center;
  min-height: 34px;
  margin: 1px 0;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.3;
  transition: background-color 120ms ease, color 120ms ease;
}
.nile-nav-sublist a:hover { background: var(--sidebar-hover); }
.nile-nav-sublist a[aria-current="page"] { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-weight: 700; }

body.nile.is-collapsed .nile-nav-link,
body.nile.is-collapsed .nile-nav-sub > .nile-nav-sub-toggle { justify-content: center; padding: 0; }
body.nile.is-collapsed .nile-nav-link span,
body.nile.is-collapsed .nile-nav-link::after,
body.nile.is-collapsed .nile-nav-sub > .nile-nav-sub-toggle span,
body.nile.is-collapsed .nile-nav-sub > .nile-nav-sub-toggle .nile-chev,
body.nile.is-collapsed .nile-nav-sublist { display: none; }
/* Tooltip label when collapsed */
body.nile.is-collapsed .nile-nav-link[data-label]:hover::before,
body.nile.is-collapsed .nile-nav-sub > .nile-nav-sub-toggle[data-label]:hover::before {
  content: attr(data-label);
  position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 700;
  padding: 6px 10px; border-radius: 7px; white-space: nowrap; box-shadow: var(--shadow-2);
  z-index: 60; pointer-events: none;
  animation: nile-pop 140ms var(--ease-out-expo) backwards;
}
body.nile.is-collapsed .nile-nav { overflow: visible; }
body.nile.is-collapsed .nile-sidebar { overflow: visible; }

.nile-sidebar-foot {
  flex-shrink: 0;
  padding: 12px;
  border-top: 1px solid var(--line);
}
.nile-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  min-width: 0;
  transition: background-color 120ms ease;
}
.nile-user:hover { background: var(--sidebar-hover); }
.nile-user .nile-avatar { flex-shrink: 0; }
.nile-user-meta { min-width: 0; line-height: 1.25; }
.nile-user-meta strong { display: block; font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nile-user-meta span { display: block; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.nile.is-collapsed .nile-user { justify-content: center; padding: 8px 0; }
body.nile.is-collapsed .nile-user-meta { display: none; }

.nile-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--nile-blue-50);
  border: 1px solid var(--nile-blue-100);
  color: var(--nile-blue); font-family: var(--font-display); font-weight: 700; font-size: 13px;
  letter-spacing: .02em;
}
.nile-avatar.is-sm { width: 28px; height: 28px; font-size: 11px; }

/* Header ------------------------------------------------------------------- */
.nile-main { min-width: 0; display: flex; flex-direction: column; }
.nile-header {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.nile-header-logo { display: flex; align-items: center; height: 100%; }
.nile-header-logo img { height: 30px; width: auto; display: block; }
.nile-iconbtn {
  width: 36px; height: 36px; border-radius: 9px;
  display: inline-grid; place-items: center;
  border: 1px solid transparent; background: transparent; color: var(--ink-2);
  cursor: pointer; padding: 0;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 150ms var(--ease-out-quad);
}
.nile-iconbtn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nile-iconbtn:hover { background: var(--surface-3); border-color: var(--line); color: var(--ink); }
.nile-iconbtn:active { transform: scale(.94); }

.nile-search {
  margin-left: auto;
  display: flex; align-items: center; gap: 10px;
  height: 38px; width: min(380px, 34vw);
  padding: 0 12px 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-4);
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}
.nile-search:hover { border-color: var(--nile-blue-200); background: #fff; }
.nile-search:focus-visible { border-color: var(--nile-blue); box-shadow: var(--ring); outline: none; }
.nile-search svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.nile-search span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nile-kbd {
  font-family: var(--font-sans); font-weight: 700; font-size: 11px; color: var(--ink-3);
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px;
  padding: 1px 6px; background: var(--surface-2); line-height: 1.4;
}
.nile-header-right { display: flex; align-items: center; gap: 8px; }
.nile-pill {
  font-family: var(--font-sans); font-weight: 700; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 9px; border-radius: var(--radius-chip); border: 1px solid var(--line-2); color: var(--ink-3); background: var(--surface);
}

/* Header dropdown (user) */
.nile-menu { position: relative; }
.nile-menu > button { display: flex; align-items: center; gap: 8px; background: transparent; border: 0; padding: 4px; border-radius: 999px; cursor: pointer; }
.nile-menu > button:hover .nile-avatar { box-shadow: 0 0 0 3px var(--nile-blue-100); }
.nile-menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-2);
  padding: 6px;
  transform-origin: top right;
  opacity: 0; transform: scale(.96) translateY(-4px); visibility: hidden;
  transition: opacity 160ms var(--ease-out-expo), transform 160ms var(--ease-out-expo), visibility 0s linear 160ms;
  z-index: 50;
}
.nile-menu.is-open .nile-menu-panel { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.nile-menu-head { padding: 10px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.nile-menu-head strong { display: block; font-size: 13.5px; }
.nile-menu-head span { display: block; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nile-menu-panel a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; color: var(--ink-2); font-size: 13.5px; font-weight: 500;
}
.nile-menu-panel a svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.nile-menu-panel a:hover { background: var(--surface-3); color: var(--ink); }
.nile-menu-panel a.is-danger:hover { background: var(--danger-bg); color: var(--danger); }

/* Page ---------------------------------------------------------------------- */
.nile-page { flex: 1; }
body.nile .content-body { margin-left: 0 !important; padding: 0 !important; min-height: 0 !important; transition: none !important; }
body.nile .content-body > .container-fluid,
body.nile .content-body .container-fluid { padding: 26px 28px 56px; max-width: 1640px; }
@media (max-width: 767px) { body.nile .content-body .container-fluid { padding: 18px 16px 48px; } }

/* Page title row (legacy .page-titles) */
body.nile .page-titles {
  background: transparent !important;
  padding: 0 0 20px !important;
  margin: 0 0 8px !important;
  box-shadow: none !important;
  border: 0 !important;
  align-items: center;
}
body.nile .page-titles .welcome-text h4 {
  font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -.01em; color: var(--nile-blue);
}
body.nile .page-titles .welcome-text p, body.nile .page-titles .welcome-text span { color: var(--ink-3); font-size: 13px; margin: 2px 0 0; }
body.nile .breadcrumb {
  background: transparent !important; padding: 0 !important; margin: 0 !important;
  font-family: var(--font-sans); font-weight: 700; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
}
body.nile .breadcrumb-item + .breadcrumb-item::before { content: "/"; color: var(--ink-4); padding: 0 8px; }
body.nile .breadcrumb-item a { color: var(--ink-3); }
body.nile .breadcrumb-item a:hover { color: var(--nile-blue); }
body.nile .breadcrumb-item.active:last-child a { color: var(--ink); }

/* --------------------------------------------------------------------------
   Legacy vocabulary, re-themed
   -------------------------------------------------------------------------- */

/* Cards */
body.nile .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  margin-bottom: 24px;
  height: auto;
}
body.nile .card-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 16px 20px;
  background: transparent;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}
body.nile .card-header .card-title { margin: 0; margin-right: auto; }
body.nile .card-title { font-size: 15px; font-weight: 600; margin: 0; }
body.nile .card-body { padding: 20px; }
body.nile .card .card { box-shadow: none; }
body.nile .card-header form { margin: 0; }
body.nile .card-header .form-control { height: 36px; min-width: 240px; }
body.nile .card-footer { background: var(--surface-2); border-top: 1px solid var(--line); padding: 14px 20px; }

/* Stat tiles (legacy .widget-stat) → clean tiles with a coloured rule */
body.nile .widget-stat.card {
  background: var(--surface) !important;
  border: 1px solid var(--line);
  overflow: hidden;
  position: relative;
}
body.nile .widget-stat.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--nile-blue);
}
body.nile .widget-stat.card.bg-success::before { background: var(--nile-green); }
body.nile .widget-stat.card.bg-danger::before { background: var(--danger); }
body.nile .widget-stat.card.bg-warning::before { background: var(--warning); }
body.nile .widget-stat.card.bg-info::before { background: var(--nile-sky); }
body.nile .widget-stat.card.bg-secondary::before { background: var(--ink-4); }
body.nile .widget-stat .card-header { display: block; border: 0; padding: 18px 20px 16px !important; }
body.nile .widget-stat .card-title.text-white {
  color: var(--ink-3) !important;
  font-family: var(--font-sans); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 8px;
}
body.nile .widget-stat h5.text-white {
  color: var(--ink) !important;
  font-family: var(--font-sans); font-size: 26px; font-weight: 700; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
body.nile .widget-stat .fa-caret-up { display: none; }
body.nile .widget-stat .card-body { display: none; }

/* Buttons */
body.nile .btn {
  font-family: var(--font-sans);
  font-size: 14px; font-weight: 700; line-height: 1;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms var(--ease-out-quad);
  white-space: nowrap;
}
body.nile .btn:active:not(:disabled) { transform: scale(.97); }
body.nile .btn:focus, body.nile .btn.focus { box-shadow: none; }
body.nile .btn:focus-visible { box-shadow: var(--ring); outline: none; }
body.nile .btn-sm { padding: 7px 10px; font-size: 12.5px; min-height: 30px; }
body.nile .btn-sm i { font-size: 15px; line-height: 1; }
body.nile .btn i { line-height: 1; }
body.nile .btn-block { width: 100%; }
body.nile .btn-xs { padding: 4px 8px; font-size: 12px; }

body.nile .btn-primary,
body.nile .btn-primary:not(:disabled):not(.disabled):active,
body.nile .btn-primary:not(:disabled):not(.disabled).active,
body.nile .show > .btn-primary.dropdown-toggle {
  background: var(--nile-blue); border-color: var(--nile-blue); color: #fff;
  box-shadow: none;
}
body.nile .btn-primary:hover { background: var(--nile-blue-600); border-color: var(--nile-blue-600); color: #fff; }
body.nile .btn-success,
body.nile .btn-success:not(:disabled):not(.disabled):active { background: var(--nile-green-600); border-color: var(--nile-green-600); color: #fff; }
body.nile .btn-success:hover { background: var(--nile-green-700); border-color: var(--nile-green-700); color: #fff; }
body.nile .btn-danger,
body.nile .btn-danger:not(:disabled):not(.disabled):active { background: var(--danger); border-color: var(--danger); color: #fff; }
body.nile .btn-danger:hover { background: #A33024; border-color: #A33024; color: #fff; }
body.nile .btn-warning,
body.nile .btn-warning:not(:disabled):not(.disabled):active { background: #9C6619; border-color: #9C6619; color: #fff; }
body.nile .btn-warning:hover { background: #83550F; border-color: #83550F; color: #fff; }
body.nile .btn-info { background: var(--nile-sky); border-color: var(--nile-sky); color: #fff; }
body.nile .btn-info:hover { background: #3B69B0; border-color: #3B69B0; color: #fff; }
body.nile .btn-secondary,
body.nile .btn-dark { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
body.nile .btn-secondary:hover, body.nile .btn-dark:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
body.nile .btn-light,
body.nile .btn-light:not(:disabled):not(.disabled):active {
  background: var(--surface); border-color: var(--line-2); color: var(--ink-2);
}
body.nile .btn-light:hover { background: var(--surface-3); border-color: var(--line-2); color: var(--ink); }
body.nile .btn-outline-primary { background: transparent; border: 1.5px solid var(--nile-blue); color: var(--nile-blue); }
body.nile .btn-outline-primary:hover { background: var(--nile-blue-50); border-color: var(--nile-blue); color: var(--nile-blue); }
body.nile .btn-outline-secondary { background: transparent; border-color: var(--line-2); color: var(--ink-2); }
body.nile .btn-outline-secondary:hover { background: var(--surface-3); color: var(--ink); }
body.nile .btn-outline-danger { background: transparent; border-color: var(--danger-line); color: var(--danger); }
body.nile .btn-outline-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
body.nile .btn-outline-success { background: transparent; border-color: var(--success-line); color: var(--success); }
body.nile .btn-outline-success:hover { background: var(--success-bg); color: var(--success); }
body.nile .btn-link { color: var(--nile-blue); background: transparent; border: 0; }
body.nile .btn:disabled, body.nile .btn.disabled { opacity: .55; cursor: not-allowed; }
/* Anchor-wrapped buttons ("<a><button>Cancel</button></a>") */
body.nile a > .btn { pointer-events: none; }

/* Badges */
body.nile .badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-sans);
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 8px; border-radius: var(--radius-chip); line-height: 1.2;
  border: 1px solid transparent;
}
body.nile .badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
body.nile .badge-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
body.nile .badge-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-line); }
body.nile .badge-primary { background: var(--info-bg);    color: var(--info);    border-color: var(--info-line); }
body.nile .badge-info    { background: var(--info-bg); color: var(--nile-sky); border-color: var(--info-line); }
body.nile .badge-secondary { background: var(--surface-3); color: var(--ink-2); border-color: var(--line-2); }
body.nile .badge-light   { background: var(--surface-2); color: var(--ink-2); border-color: var(--line); }
body.nile .badge-dark    { background: var(--ink-2); color: #fff; }
body.nile .badge-pill { border-radius: var(--radius-chip); }

/* Alerts */
body.nile .alert {
  border: 1px solid var(--line); border-left-width: 3px;
  border-radius: var(--radius-sm);
  padding: 12px 40px 12px 14px;
  font-size: 13.5px;
  position: relative;
  background: var(--surface);
  color: var(--ink-2);
  animation: nile-rise 220ms var(--ease-out-expo) backwards;
}
body.nile .alert-success { background: var(--success-bg); border-color: var(--success-line); border-left-color: var(--success); color: var(--success); }
body.nile .alert-warning { background: var(--warning-bg); border-color: var(--warning-line); border-left-color: var(--warning); color: var(--warning); }
body.nile .alert-danger  { background: var(--danger-bg);  border-color: var(--danger-line);  border-left-color: var(--danger); color: var(--danger); }
body.nile .alert-info, body.nile .alert-primary { background: var(--info-bg); border-color: var(--info-line); border-left-color: var(--nile-blue); color: var(--info); }
body.nile .alert-light { background: var(--surface-2); border-left-color: var(--ink-4); }
body.nile .alert .close {
  position: absolute; right: 10px; top: 8px;
  font-size: 18px; font-weight: 400; line-height: 1; opacity: .5; color: inherit; text-shadow: none;
  width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px;
}
body.nile .alert .close:hover { opacity: 1; background: rgba(0, 0, 0, .06); }

/* Forms */
body.nile .form-group { margin-bottom: 16px; }
body.nile .form-label, body.nile label {
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; display: inline-block;
}
body.nile .form-control,
body.nile .custom-select,
body.nile select.form-control,
body.nile input[type="search"].form-control {
  height: 40px;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  background-color: var(--surface);
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius-sm);
  box-shadow: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}
body.nile textarea.form-control { height: auto; min-height: 96px; line-height: 1.5; }
body.nile .form-control:hover:not(:disabled):not([readonly]) { border-color: var(--nile-blue-200); }
body.nile .form-control:focus, body.nile .custom-select:focus {
  border-color: var(--nile-blue); box-shadow: var(--ring); background-color: #fff; outline: none;
}
body.nile .form-control::placeholder { color: var(--ink-4); }
body.nile .form-control:disabled, body.nile .form-control[readonly] {
  background: var(--surface-2); color: var(--ink-2); border-color: var(--line); cursor: default;
}
body.nile select.form-control, body.nile .custom-select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
  padding-right: 34px;
}
body.nile select.form-control[multiple] { background-image: none; height: auto; }
body.nile .form-control-sm { height: 32px; font-size: 12.5px; }
body.nile .form-control-lg { height: 46px; font-size: 15px; }
body.nile input[type="file"].form-control { padding: 6px 10px; line-height: 1.6; }
body.nile input[type="checkbox"], body.nile input[type="radio"] { accent-color: var(--nile-blue); width: 15px; height: 15px; }
body.nile .input-group-text { background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink-3); border-radius: var(--radius-sm); font-size: 13px; }
body.nile .form-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
body.nile .form-inline .form-group { display: flex; flex-direction: column; align-items: flex-start; margin: 0; }
body.nile .form-inline .form-group label { margin: 0 0 6px; }
body.nile .form-inline .form-control { width: auto; min-width: 180px; }
body.nile .filter-panel { padding: 16px 20px !important; margin: 0 !important; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
body.nile .filter-panel .panel { margin: 0; }
body.nile .filter-col { color: var(--ink-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
body.nile .text-danger:not(.btn):not(h1):not(h2):not(h3):not(h4):not(i) { font-size: 12.5px; }
body.nile div.text-danger { margin-top: 4px; }
body.nile .custom-control-label::before { border-color: var(--line-2); }
body.nile .custom-control-input:checked ~ .custom-control-label::before { background: var(--nile-blue); border-color: var(--nile-blue); }
body.nile .custom-checkbox .custom-control-label::before { border-radius: 4px; }

/* Tables */
body.nile .table-responsive { border-radius: var(--radius-sm); }
body.nile .table, body.nile table.dataTable {
  width: 100%; margin-bottom: 0; color: var(--ink);
  border-collapse: separate; border-spacing: 0;
}
body.nile .table thead th, body.nile table.dataTable thead th, body.nile table.dataTable thead td, body.nile .table th {
  font-family: var(--font-sans);
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-3);
  border: 0; border-bottom: 1px solid var(--line);
  padding: 11px 14px;
  white-space: nowrap;
  vertical-align: middle;
}
body.nile .table thead th:first-child { border-top-left-radius: var(--radius-sm); }
body.nile .table thead th:last-child { border-top-right-radius: var(--radius-sm); }
body.nile .table tbody td, body.nile table.dataTable tbody td, body.nile .table td {
  padding: 11px 14px;
  border-top: 0; border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 13.5px;
}
body.nile .table tbody tr:last-child td { border-bottom: 0; }
/* Row hover is seen dozens of times a minute → instant, no transition */
body.nile .table tbody tr:hover td, body.nile table.dataTable tbody tr:hover td { background: var(--nile-blue-50); }
body.nile .table-hover tbody tr:hover { background: transparent; color: inherit; }
body.nile .table-striped tbody tr:nth-of-type(odd) { background: var(--surface-2); }
body.nile .table td .btn-sm { padding: 5px 8px; min-height: 28px; }
body.nile .table td .btn-sm + .btn-sm, body.nile .table td .btn-sm + a { margin-left: 4px; }
body.nile .table td a strong { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
body.nile .table td > strong { font-variant-numeric: tabular-nums; }
body.nile .table-bordered, body.nile .table-bordered td, body.nile .table-bordered th { border-color: var(--line); }
body.nile table.dataTable.no-footer { border-bottom: 1px solid var(--line); }
body.nile table.dataTable thead .sorting::before, body.nile table.dataTable thead .sorting::after,
body.nile table.dataTable thead .sorting_asc::before, body.nile table.dataTable thead .sorting_asc::after,
body.nile table.dataTable thead .sorting_desc::before, body.nile table.dataTable thead .sorting_desc::after { bottom: 10px; opacity: .3; }
body.nile table.dataTable thead .sorting_asc::before, body.nile table.dataTable thead .sorting_desc::after { opacity: 1; color: var(--nile-blue); }
body.nile .dataTables_wrapper { padding-bottom: 4px; }
body.nile .dataTables_wrapper .dataTables_length,
body.nile .dataTables_wrapper .dataTables_filter { margin-bottom: 14px; font-size: 13px; color: var(--ink-3); }
body.nile .dataTables_wrapper .dataTables_filter input,
body.nile .dataTables_wrapper .dataTables_length select {
  height: 34px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 4px 10px;
  font-family: var(--font-sans); font-size: 13px; background: var(--surface); margin-left: 8px;
}
body.nile .dataTables_wrapper .dataTables_filter input:focus { border-color: var(--nile-blue); box-shadow: var(--ring); outline: none; }
body.nile .dataTables_wrapper .dataTables_info { font-size: 12.5px; color: var(--ink-3); padding-top: 16px; }
body.nile .dataTables_wrapper .dataTables_paginate { padding-top: 12px; }
body.nile .dataTables_wrapper .dataTables_paginate .paginate_button,
body.nile .dataTables_wrapper .dataTables_paginate .paginate_button.current,
body.nile .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--surface); border: 1px solid var(--line-2) !important; border-radius: 7px; color: var(--ink-2) !important;
  padding: 5px 10px; margin: 0 2px; font-size: 12.5px; min-width: 32px; box-shadow: none;
}
body.nile .dataTables_wrapper .dataTables_paginate .paginate_button:hover { background: var(--surface-3); color: var(--ink) !important; border-color: var(--line-2) !important; }
body.nile .dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--nile-blue) !important; border-color: var(--nile-blue) !important; color: #fff !important; }
body.nile .dataTables_wrapper .dataTables_paginate .paginate_button.disabled { opacity: .45; }

/* Pagination */
body.nile .pagination { gap: 4px; margin: 18px 0 0; }
body.nile .page-link {
  border: 1px solid var(--line-2); border-radius: 7px !important; color: var(--ink-2); background: var(--surface);
  font-size: 12.5px; padding: 6px 11px; min-width: 34px; text-align: center; margin: 0;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
body.nile .page-link:hover { background: var(--surface-3); color: var(--ink); border-color: var(--line-2); }
body.nile .page-item.active .page-link { background: var(--nile-blue); border-color: var(--nile-blue); color: #fff; box-shadow: none; }
body.nile .page-item.page-indicator .page-link { color: var(--ink-3); }
body.nile .page-item.disabled .page-link { opacity: .5; }

/* Tabs */
body.nile .nav-tabs { border-bottom: 1px solid var(--line); gap: 2px; margin-bottom: 20px; flex-wrap: wrap; }
body.nile .nav-tabs .nav-link {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--ink-3); font-size: 13.5px; font-weight: 500; padding: 10px 14px; margin-bottom: -1px;
  transition: color 120ms ease, border-color 120ms ease;
  background: transparent !important;
}
body.nile .nav-tabs .nav-link:hover { color: var(--ink); border-bottom-color: var(--line-2); }
body.nile .nav-tabs .nav-link.active, body.nile .custom-tab-1 .nav.nav-tabs .nav-link.active {
  color: var(--nile-blue); border-bottom-color: var(--nile-blue); background: transparent !important; border-left: 0; border-right: 0; border-top: 0;
}
body.nile .tab-content { padding-top: 4px; }
body.nile .tab-pane { animation: nile-fade 200ms ease; }
body.nile .profile-tab .nav-item .nav-link.active { border-color: var(--nile-blue); }

/* Dropdowns (bootstrap) */
body.nile .dropdown-menu {
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); padding: 6px;
  font-size: 13.5px; animation: nile-pop 160ms var(--ease-out-expo);
  transform-origin: top center;
}
body.nile .dropdown-item { border-radius: 8px; padding: 8px 10px; color: var(--ink-2); font-weight: 500; }
body.nile .dropdown-item:hover, body.nile .dropdown-item:focus { background: var(--surface-3); color: var(--ink); }
body.nile .dropdown-divider { border-color: var(--line); }

/* Bootstrap modal (data-toggle="modal") */
body.nile .modal-backdrop { background: #0B1220; }
body.nile .modal-backdrop.show { opacity: .45; }
body.nile .modal-content {
  border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-3); overflow: hidden;
}
body.nile .modal-header { padding: 18px 22px; border-bottom: 1px solid var(--line); align-items: center; }
body.nile .modal-title { font-size: 16px; font-weight: 600; }
body.nile .modal-header .close { margin: -8px -8px -8px auto; padding: 8px; font-size: 22px; font-weight: 300; opacity: .5; text-shadow: none; border-radius: 8px; line-height: 1; }
body.nile .modal-header .close:hover { opacity: 1; background: var(--surface-3); }
body.nile .modal-body { padding: 22px; }
body.nile .modal-footer { padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); gap: 8px; }
body.nile .modal-footer > * { margin: 0; }
body.nile .modal.fade .modal-dialog {
  transform: scale(.96) translateY(10px);
  transition: transform 260ms var(--ease-out-expo);
}
body.nile .modal.show .modal-dialog { transform: none; }
body.nile .modal.fade { transition: opacity 180ms ease; }

/* .nile-confirm: a centred, icon-led confirmation modal (no header bar).
   The icon's stroke/fill sit on the <svg> itself so it never renders as a filled block. */
body.nile .nile-confirm .modal-dialog { max-width: 440px; }
body.nile .nile-confirm .modal-body { position: relative; padding: 28px 28px 22px; text-align: center; }
body.nile .nile-confirm .close { position: absolute; top: 12px; right: 12px; padding: 6px 10px; font-size: 22px; font-weight: 300; opacity: .5; text-shadow: none; border-radius: 8px; line-height: 1; }
body.nile .nile-confirm .close:hover { opacity: 1; background: var(--surface-3); }
.nile-confirm-icon { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: var(--success-bg); box-shadow: 0 0 0 8px var(--nile-green-50); }
.nile-confirm-title { font-size: 18px; font-weight: 700; color: var(--ink); margin: 0 0 6px; }
.nile-confirm-text { color: var(--ink-3); font-size: 14px; margin: 0 auto 18px; max-width: 34ch; }
.nile-confirm-summary { margin: 0 0 16px; padding: 4px 14px; text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.nile-confirm-summary div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; }
.nile-confirm-summary div + div { border-top: 1px dashed var(--line); }
.nile-confirm-summary dt { font-weight: 400; color: var(--ink-3); font-size: 13px; }
.nile-confirm-summary dd { margin: 0; font-weight: 600; color: var(--ink); text-align: right; overflow-wrap: anywhere; }
.nile-confirm-summary dd.is-amount { font-size: 16px; color: var(--nile-blue); }
.nile-confirm-check { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px; text-align: left; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; color: var(--ink-2); }
.nile-confirm-check:hover { background: var(--surface-2); }
.nile-confirm-check input { width: 16px; height: 16px; accent-color: var(--nile-blue); }
body.nile .nile-confirm .modal-footer { justify-content: stretch; }
body.nile .nile-confirm .modal-footer .btn { flex: 1; }

/* Timeline (audit widget) */
body.nile .timeline { list-style: none; padding: 0; margin: 0; position: relative; }
body.nile .timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); border-radius: 2px; }
body.nile .timeline > li { position: relative; padding-left: 26px; margin-bottom: 14px; }
body.nile .timeline-badge { position: absolute; left: 3px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--nile-blue); box-shadow: 0 0 0 3px var(--nile-blue-50); }
body.nile .timeline-badge.success { background: var(--nile-green); box-shadow: 0 0 0 3px var(--nile-green-50); }
body.nile .timeline-panel { display: block; padding: 0; margin: 0 !important; background: transparent; border: 0; }
body.nile .timeline-panel h5 { font-family: var(--font-sans); font-size: 13.5px; font-weight: 500; color: var(--ink); margin: 0 0 2px; }
body.nile .timeline-panel small { color: var(--ink-3); font-size: 12px; }
body.nile .widget-todo { overflow: auto; }

/* SweetAlert2 */
body.nile .swal2-popup, .swal2-popup {
  font-family: var(--font-sans); border-radius: var(--radius-lg) !important; box-shadow: var(--shadow-3);
  padding: 28px 24px 22px;
}
.swal2-title { font-family: var(--font-display) !important; font-size: 19px !important; font-weight: 700 !important; color: var(--ink) !important; letter-spacing: -.01em; }
.swal2-content, .swal2-html-container { font-size: 14px !important; color: var(--ink-2) !important; }
.swal2-styled.swal2-confirm { background: var(--nile-blue) !important; border-radius: var(--radius-sm) !important; font-weight: 500 !important; padding: 10px 18px !important; box-shadow: none !important; font-size: 13.5px !important; }
.swal2-styled.swal2-cancel { background: var(--surface) !important; color: var(--ink-2) !important; border: 1px solid var(--line-2) !important; border-radius: var(--radius-sm) !important; font-weight: 500 !important; padding: 10px 18px !important; font-size: 13.5px !important; }
.swal2-styled:focus { box-shadow: var(--ring) !important; }
.swal2-icon.swal2-success [class^="swal2-success-line"] { background-color: var(--nile-green) !important; }
.swal2-icon.swal2-success .swal2-success-ring { border-color: var(--nile-green-100) !important; }
.swal2-icon.swal2-error { border-color: var(--danger) !important; }
.swal2-icon.swal2-error [class^="swal2-x-mark-line"] { background-color: var(--danger) !important; }
.swal2-show { animation: nile-pop 260ms var(--ease-out-expo) !important; }
.swal2-container.swal2-backdrop-show, .swal2-container.swal2-shown { background: rgba(11, 18, 32, .45) !important; }

/* Misc legacy bits */
body.nile .panel, body.nile .panel-body { background: transparent; border: 0; padding: 0; margin: 0; }
body.nile hr { border-color: var(--line); }
body.nile .list-group-item { border-color: var(--line); }
body.nile .progress { height: 8px; border-radius: 999px; background: var(--surface-3); }
body.nile .progress-bar { background: var(--nile-blue); }
body.nile .bg-primary:not(.widget-stat) { background: var(--nile-blue) !important; }
body.nile .bg-success:not(.widget-stat) { background: var(--nile-green-600) !important; }
body.nile .bg-light { background: var(--surface-2) !important; }
body.nile .border, body.nile .border-top, body.nile .border-bottom, body.nile .border-left, body.nile .border-right { border-color: var(--line) !important; }
body.nile pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-family: var(--font-code); font-size: 12.5px; }
body.nile .fa-spin { color: inherit; }
body.nile .error-page .error-text { font-family: var(--font-display); font-size: 96px; font-weight: 900; color: var(--nile-blue); }

/* --------------------------------------------------------------------------
   New components
   -------------------------------------------------------------------------- */

/* Remote modal (data-modal links) --------------------------------------- */
.nile-modal {
  position: fixed; inset: 0; z-index: 1100;
  display: grid; place-items: center;
  padding: 24px;
  visibility: hidden;
  transition: visibility 0s linear 200ms;
}
.nile-modal.is-open { visibility: visible; transition-delay: 0s; }
.nile-modal-overlay {
  position: absolute; inset: 0;
  background: rgba(11, 18, 32, .45);
  opacity: 0;
  transition: opacity 200ms ease;
}
.nile-modal.is-open .nile-modal-overlay { opacity: 1; }
.nile-modal-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  transform: scale(.96) translateY(12px);
  opacity: 0;
  /* Modals appear centred, so transform-origin stays centre. Exit is shorter. */
  transition: transform 160ms var(--ease-out-quad), opacity 140ms ease;
}
.nile-modal.is-open .nile-modal-panel {
  transform: none; opacity: 1;
  transition: transform 240ms var(--ease-vaul), opacity 180ms ease;
}
.nile-modal-panel.is-lg { width: min(1040px, 100%); }
.nile-modal-panel.is-xl { width: min(1320px, 100%); }
.nile-modal-panel.is-sm { width: min(520px, 100%); }
.nile-modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.nile-modal-head h2 { font-size: 18px; color: var(--nile-blue); margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nile-modal-head .nile-modal-eyebrow { display: block; font-weight: 700; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 3px; }
.nile-modal .nile-modal-body { overflow: auto; flex: 1 1 auto; }
.nile-modal .nile-modal-body > .nile-modal-inner { animation: nile-fade 220ms ease; }
/* Unwrap the fetched page: no shell padding, no page title row, flat cards */
.nile-modal .nile-modal-body .content-body .container-fluid { padding: 22px 22px 8px !important; max-width: none; }
.nile-modal .nile-modal-body .page-titles { display: none !important; }
.nile-modal .nile-modal-body .card { border: 0; box-shadow: none; margin-bottom: 0; background: transparent; }
.nile-modal .nile-modal-body .card-header { display: none; }
.nile-modal .nile-modal-body .card-body { padding: 0; }
.nile-modal .nile-modal-body .card .card .card-header { display: flex; }
.nile-modal .nile-modal-body .card .card { border: 1px solid var(--line); background: var(--surface); margin-bottom: 16px; }
.nile-modal .nile-modal-body .card .card .card-body { padding: 16px; }
.nile-modal .nile-modal-body .row > [class*="col-"] { margin-bottom: 0; }
.nile-modal .nile-modal-body .col-lg-12 > .btn, .nile-modal-body .col-md-12 > .btn,
.nile-modal .nile-modal-body .col-lg-12 > a > .btn, .nile-modal-body .col-md-12 > a > .btn { margin: 6px 6px 16px 0; }
.nile-modal .nile-modal-body .alert { margin: 0 0 16px; }

/* Skeleton while a remote modal loads */
.nile-skeleton { display: grid; gap: 14px; padding: 22px; }
.nile-skeleton-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.nile-skel {
  height: 38px; border-radius: var(--radius-sm);
  background: var(--surface-3);
  animation: nile-pulse 1.2s ease-in-out infinite alternate;
}
.nile-skel.is-label { height: 12px; width: 40%; }
.nile-skel.is-btn { height: 38px; width: 120px; }
@keyframes nile-pulse { from { opacity: 1; } to { opacity: .55; } }

/* Toasts ----------------------------------------------------------------- */
.nile-toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 1200;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
  width: min(380px, calc(100vw - 40px));
}
.nile-toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 3px solid var(--success);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-3);
  font-size: 14px;
  /* Transitions, not keyframes: a toast added while another leaves stays interruptible. */
  opacity: 1; transform: translateX(0);
  transition: opacity 200ms ease, transform 240ms var(--ease-out-expo);
  @starting-style { opacity: 0; transform: translateX(16px); }
}
.nile-toast.is-leaving { opacity: 0; transform: translateX(16px); transition-duration: 150ms, 160ms; }
.nile-toast-dot { display: none; }
.nile-toast.is-error { border-left-color: var(--danger); }
.nile-toast.is-warning { border-left-color: var(--warning); }
.nile-toast.is-info { border-left-color: var(--nile-blue); }
.nile-toast p { margin: 0; flex: 1; line-height: 1.45; }
.nile-toast button { background: transparent; border: 0; color: var(--ink-4); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.nile-toast button:hover { color: var(--ink); }

/* Command palette --------------------------------------------------------- */
.nile-palette {
  position: fixed; inset: 0; z-index: 1150;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
  visibility: hidden;
  transition: visibility 0s linear 160ms;
}
.nile-palette.is-open { visibility: visible; transition-delay: 0s; }
.nile-palette-overlay { position: absolute; inset: 0; background: rgba(11, 18, 32, .45); opacity: 0; transition: opacity 160ms ease; }
.nile-palette.is-open .nile-palette-overlay { opacity: 1; }
.nile-palette-panel {
  position: relative; width: min(640px, 100%);
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-3);
  overflow: hidden;
  transform: scale(.97) translateY(-8px); opacity: 0;
  transition: transform 140ms var(--ease-out-quad), opacity 120ms ease;
}
.nile-palette.is-open .nile-palette-panel { transform: none; opacity: 1; transition: transform 220ms var(--ease-out-expo), opacity 160ms ease; }
.nile-palette-input {
  display: flex; align-items: center; gap: 12px; padding: 6px 16px; border-bottom: 1px solid var(--line);
}
.nile-palette-input svg { width: 18px; height: 18px; stroke: var(--ink-3); fill: none; stroke-width: 2; }
.nile-palette-input input {
  flex: 1; height: 50px; border: 0; outline: 0; font-family: var(--font-sans); font-size: 16px; color: var(--ink); background: transparent;
}
.nile-palette-input input::placeholder { color: var(--ink-4); }
.nile-palette-list { max-height: 52vh; overflow: auto; padding: 8px; }
.nile-palette-group { font-weight: 700; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-4); padding: 10px 10px 4px; }
.nile-palette-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: 9px; color: var(--ink-2); font-size: 13.5px; cursor: pointer;
}
.nile-palette-item svg { width: 16px; height: 16px; stroke: var(--ink-3); fill: none; stroke-width: 2; flex-shrink: 0; }
.nile-palette-item .nile-palette-crumb { margin-left: auto; font-size: 12px; color: var(--ink-4); }
/* Selection highlight tracks arrow keys: instant, never animated. */
.nile-palette-item.is-active { background: var(--nile-blue-50); color: var(--nile-blue); }
.nile-palette-item.is-active svg { stroke: var(--nile-blue); }
.nile-palette-item mark { background: var(--nile-green-100); color: inherit; border-radius: 3px; padding: 0 1px; }
.nile-palette-empty { padding: 28px; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.nile-palette-foot { display: flex; gap: 14px; padding: 8px 16px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 11.5px; color: var(--ink-3); }
.nile-palette-foot span { display: inline-flex; align-items: center; gap: 5px; }

/* Dashboard ----------------------------------------------------------------- */
.nile-hero {
  position: relative;
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 26px;
  color: var(--ink-2);
  background: var(--nile-blue-50);
  border: 1px solid var(--info-line);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end;
}
.nile-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 10px; display: flex; align-items: center; gap: 10px;
}
.nile-eyebrow::before { content: ""; width: 22px; height: 3px; border-radius: 2px; background: var(--nile-green); }
.nile-hero h1 { color: var(--nile-blue); font-size: 30px; font-weight: 900; letter-spacing: -.01em; margin: 0 0 6px; line-height: 1.15; }
.nile-hero p { margin: 0; color: var(--ink-2); font-size: 14px; max-width: 60ch; }
.nile-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
body.nile .nile-hero-actions .btn-light { background: var(--surface); border: 1.5px solid var(--nile-blue); color: var(--nile-blue); }
body.nile .nile-hero-actions .btn-light:hover { background: var(--nile-blue); color: #fff; border-color: var(--nile-blue); }
@media (max-width: 900px) { .nile-hero { grid-template-columns: 1fr; padding: 24px; } .nile-hero-actions { justify-content: flex-start; } }

.nile-section { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.nile-section h2 { font-size: 18px; margin: 0; color: var(--nile-blue); }
.nile-section .nile-pill { background: var(--nile-blue-50); border-color: var(--nile-blue-100); color: var(--nile-blue); }
.nile-section .nile-section-line { flex: 1; height: 1px; background: var(--line); }

.nile-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px;
}
@media (max-width: 1400px) { .nile-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .nile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .nile-stats { grid-template-columns: 1fr; } }
.nile-stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 14px;
  box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; gap: 6px;
  min-height: 108px;
}
.nile-stat > * { position: relative; }
/* Hover lift lives on an inner element, never on the hovered card itself. */
.nile-stat-inner { transition: transform 200ms var(--ease-out-expo); }
@media (hover: hover) and (pointer: fine) { .nile-stat:hover .nile-stat-inner { transform: translateY(-2px); } }
.nile-stat-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.nile-stat-label::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--stat-color, var(--nile-blue)); flex-shrink: 0; }
.nile-stat-value { font-size: 30px; font-weight: 900; letter-spacing: -.01em; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.nile-stat-foot { font-size: 12px; color: var(--ink-3); margin-top: auto; }
.nile-stat-foot b { color: var(--ink-2); font-weight: 700; }
.nile-stat.is-hero { grid-column: span 2; background: var(--nile-blue); border-color: var(--nile-blue); color: #fff; --stat-color: var(--nile-green); }
.nile-stat.is-hero .nile-stat-label, .nile-stat.is-hero .nile-stat-foot { color: rgba(255, 255, 255, .82); }
.nile-stat.is-hero .nile-stat-value { color: #fff; font-size: 40px; }
.nile-stat.is-hero .nile-stat-foot b { color: #fff; }
.nile-stat.is-green { --stat-color: var(--nile-green); }
.nile-stat.is-red { --stat-color: var(--danger); }
.nile-stat.is-amber { --stat-color: var(--warning); }
.nile-stat.is-sky { --stat-color: var(--nile-sky); }
.nile-stat.is-slate { --stat-color: var(--ink-4); }
@media (max-width: 520px) { .nile-stat.is-hero { grid-column: auto; } }

/* Funnel bars */
.nile-funnel { display: grid; gap: 10px; }
.nile-funnel-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 70px; gap: 12px; align-items: center; font-size: 13px; }
.nile-funnel-row .nile-funnel-name { color: var(--ink-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nile-funnel-track { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.nile-funnel-bar {
  height: 100%; border-radius: 999px;
  background: var(--nile-blue);
  width: var(--w, 0%);
  transform: scaleX(0); transform-origin: left center;
  animation: nile-grow 500ms var(--ease-out-expo) forwards;
  animation-delay: calc(var(--i, 0) * 50ms + 120ms);
}
.nile-funnel-row.is-green .nile-funnel-bar { background: var(--nile-green); }
.nile-funnel-row .nile-funnel-num { font-variant-numeric: tabular-nums; text-align: right; color: var(--ink); font-weight: 700; font-size: 13px; }
.nile-funnel-row .nile-funnel-num small { color: var(--ink-4); font-weight: 400; margin-left: 4px; }
@keyframes nile-grow { to { transform: scaleX(1); } }

/* Two-column dashboard body */
.nile-grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
@media (max-width: 1200px) { .nile-grid-main { grid-template-columns: 1fr; } }

/* Audit feed */
.nile-feed { list-style: none; margin: 0; padding: 0; position: relative; max-height: 440px; overflow: auto; }
.nile-feed::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.nile-feed li { position: relative; padding: 0 0 16px 30px; }
.nile-feed li::before {
  content: ""; position: absolute; left: 4px; top: 5px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--nile-blue); box-sizing: border-box;
}
.nile-feed li:nth-child(3n)::before { border-color: var(--nile-green); }
.nile-feed li:nth-child(3n+2)::before { border-color: var(--nile-sky); }
.nile-feed-who { font-weight: 600; color: var(--ink); font-size: 13px; }
.nile-feed-what { color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.nile-feed-when { font-size: 12px; color: var(--ink-4); margin-top: 3px; }

/* Empty state */
.nile-empty { text-align: center; padding: 36px 20px; color: var(--ink-3); font-size: 13.5px; }
.nile-empty svg { width: 40px; height: 40px; stroke: var(--ink-4); fill: none; stroke-width: 1.5; margin-bottom: 10px; }
.nile-empty strong { display: block; color: var(--ink-2); font-size: 14px; margin-bottom: 2px; }

/* Program chip */
.nile-prog { font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 3px 7px; border-radius: 6px; background: var(--nile-blue-50); color: var(--nile-blue); border: 1px solid var(--nile-blue-100); }
.nile-prog.is-ug { background: var(--nile-green-50); color: var(--nile-green-700); border-color: var(--nile-green-100); }

/* Person cell (name + secondary line) */
.nile-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nile-person div { min-width: 0; line-height: 1.25; }
.nile-person strong { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nile-person span { display: block; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Row action buttons: icon-only, quiet until hover */
body.nile .table td .btn-sm.btn-primary { background: var(--nile-blue-50); border-color: var(--nile-blue-100); color: var(--nile-blue); box-shadow: none; }
body.nile .table td .btn-sm.btn-primary:hover { background: var(--nile-blue); border-color: var(--nile-blue); color: #fff; }
body.nile .table td .btn-sm.btn-success { background: var(--nile-green-50); border-color: var(--nile-green-100); color: var(--nile-green-700); }
body.nile .table td .btn-sm.btn-success:hover { background: var(--nile-green-600); border-color: var(--nile-green-600); color: #fff; }
body.nile .table td .btn-sm.btn-danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
body.nile .table td .btn-sm.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
body.nile .table td .btn-sm.btn-warning { background: var(--warning-bg); border-color: var(--warning-line); color: var(--warning); }
body.nile .table td .btn-sm.btn-warning:hover { background: #9C6619; border-color: #9C6619; color: #fff; }

/* Mobile ------------------------------------------------------------------ */
.nile-scrim { position: fixed; inset: 0; z-index: 35; background: rgba(11, 18, 32, .45); opacity: 0; visibility: hidden; transition: opacity 200ms ease, visibility 0s linear 200ms; }
@media (max-width: 991px) {
  .nile-shell, body.nile.is-collapsed .nile-shell { grid-template-columns: minmax(0, 1fr); }
  .nile-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); height: 100vh;
    transform: translateX(-100%);
    transition: transform 280ms var(--ease-vaul);
    box-shadow: none;
  }
  body.nile.is-nav-open .nile-sidebar { transform: none; box-shadow: var(--shadow-3); }
  body.nile.is-nav-open .nile-scrim { opacity: 1; visibility: visible; transition-delay: 0s; }
  body.nile.is-collapsed .nile-brand-text, body.nile.is-collapsed .nile-nav-link span, body.nile.is-collapsed .nile-nav-sub > .nile-nav-sub-toggle span,
  body.nile.is-collapsed .nile-nav-sub > .nile-nav-sub-toggle .nile-chev, body.nile.is-collapsed .nile-nav-sublist, body.nile.is-collapsed .nile-user-meta { display: revert; }
  body.nile.is-collapsed .nile-nav-sublist { display: grid; }
  body.nile.is-collapsed .nile-brand-logo { display: block; }
  body.nile.is-collapsed .nile-brand-mark { display: none; }
  body.nile.is-collapsed .nile-brand { justify-content: flex-start; padding: 0 16px 0 18px; }
  body.nile.is-collapsed .nile-nav-label { font-size: 11px; padding: 18px 12px 6px; }
  body.nile.is-collapsed .nile-nav-label::after { display: none; }
  body.nile.is-collapsed .nile-nav-link, body.nile.is-collapsed .nile-nav-sub > .nile-nav-sub-toggle { justify-content: flex-start; padding: 0 12px; }
  body.nile.is-collapsed .nile-nav-link::after { display: block; }
  body.nile.is-collapsed .nile-sidebar { overflow: hidden; }
  body.nile.is-collapsed .nile-nav { overflow-y: auto; }
  .nile-header { padding: 0 14px; }
  .nile-search { width: auto; flex: 1; }
  .nile-search span, .nile-search .nile-kbd { display: none; }
  .nile-header-logo img { height: 26px; }
  .nile-collapse-btn { display: none; }
}
@media (min-width: 992px) { .nile-menu-btn { display: none; } .nile-scrim { display: none; } }

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */
@keyframes nile-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes nile-fade { from { opacity: 0; } }
@keyframes nile-pop  { from { opacity: 0; transform: scale(.96); } }

/* Page body on arrival: once per navigation, `backwards` holds frame 0 through paint. */
.enter-rise { animation: nile-rise 240ms var(--ease-out-expo) backwards; }
/* Children stagger 40ms apart, most important first (DOM order). Decorative: never blocks input. */
.stagger > * { animation: nile-rise 240ms var(--ease-out-expo) backwards; animation-delay: calc(var(--i, 0) * 35ms); }
.nile-stats > .nile-stat { animation: nile-rise 260ms var(--ease-out-expo) backwards; animation-delay: calc(var(--i, 0) * 35ms + 40ms); }
.nile-count { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .enter-rise, .stagger > *, .nile-stats > .nile-stat, body.nile .alert { animation-name: nile-fade; animation-duration: 200ms; }
  .nile-shell, .nile-nav-sublist, .nile-nav-sub > .nile-nav-sub-toggle .nile-chev, .nile-sidebar { transition: none; }
  .nile-modal-panel, .nile-palette-panel { transform: none; transition: opacity 160ms ease; }
  .nile-toast { transition: opacity 180ms ease; transform: none; @starting-style { transform: none; } }
  .nile-toast.is-leaving { transform: none; }
  .nile-funnel-bar { animation: none; transform: none; }
  .nile-skel { animation: none; }
  .nile-stat-inner { transition: none; }
  body.nile .btn:active:not(:disabled) { transform: none; }
  body.nile .modal.fade .modal-dialog { transform: none; transition: none; }
  body.nile .dropdown-menu, .swal2-show { animation: nile-fade 160ms ease !important; }
}

/* Print: content only */
@media print {
  .nile-sidebar, .nile-header, .nile-toasts, .nile-modal, .nile-palette, .nile-scrim { display: none !important; }
  .nile-shell { display: block; }
  body.nile { background: #fff; }
  body.nile .card { box-shadow: none; }
}

/* Portal chip keeps the legacy badge classes (tests count them) but reads as a code. */
body.nile .badge.nile-prog { letter-spacing: .06em; border-radius: var(--radius-chip); background: var(--nile-blue-50); color: var(--nile-blue); border-color: var(--nile-blue-100); }
body.nile .badge.nile-prog.is-ug { background: var(--nile-green-50); color: var(--nile-green-700); border-color: var(--nile-green-100); }

/* --------------------------------------------------------------------------
   Specificity guards. The base rules `body.nile a` and `body.nile h1..h6`
   are (0,1,2) and would otherwise repaint shell links and headings in the
   default link blue / ink. Every colour that must survive them lives here.
   -------------------------------------------------------------------------- */
body.nile .nile-nav-link,
body.nile .nile-nav-sub > .nile-nav-sub-toggle { color: var(--ink); }
body.nile .nile-nav-link:hover,
body.nile .nile-nav-link:focus,
body.nile .nile-nav-sub > .nile-nav-sub-toggle:hover { color: var(--ink); }
body.nile .nile-nav-link[aria-current="page"] { color: var(--nile-blue); }
body.nile .nile-nav-sublist a { color: var(--ink-2); }
body.nile .nile-nav-sublist a:hover,
body.nile .nile-nav-sublist a:focus { color: var(--ink); }
body.nile .nile-nav-sublist a[aria-current="page"] { color: var(--nile-blue); }
body.nile .nile-brand a,
body.nile .nile-user,
body.nile .nile-user:hover { color: var(--ink); }
body.nile .nile-menu-panel a { color: var(--ink-2); }
body.nile .nile-menu-panel a:hover { color: var(--ink); }
body.nile .nile-menu-panel a.is-danger:hover { color: var(--danger); }
body.nile .nile-hero h1 { color: var(--nile-blue); }
body.nile .nile-section h2,
body.nile .nile-modal-head h2,
body.nile .nile-auth-card h2 { color: var(--nile-blue); }
body.nile .nile-error h1 { color: var(--ink); }
/* The sidebar carries the white lockup on desktop; the header repeats the
   colour logo only when the sidebar is off-canvas (mobile). */
@media (min-width: 992px) { .nile-header-logo { display: none; } }
/* DataTables wraps its length/search controls in <label>; keep them sentence case. */
body.nile .dataTables_wrapper label { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; color: var(--ink-3); }

/* --------------------------------------------------------------------------
   Layout fixes found in the page-by-page screenshot audit
   -------------------------------------------------------------------------- */

/* Tables: a little tighter so wide lists fit, and when one still overflows
   (nile-ui.js adds .is-scrollable) the Action column sticks to the right edge
   instead of being clipped off-screen. */
body.nile .table thead th, body.nile table.dataTable thead th, body.nile .table th { padding: 10px 12px; }
body.nile .table tbody td, body.nile table.dataTable tbody td, body.nile .table td { padding: 10px 12px; }
body.nile .table-responsive, body.nile .dataTables_wrapper { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
body.nile .dataTables_wrapper { overflow-x: auto; }
body.nile .is-scrollable table > thead > tr > :last-child,
body.nile .is-scrollable table > tbody > tr > :last-child {
  position: sticky; right: 0; z-index: 1;
  /* !important: the legacy theme sets every DataTables cell to
     `background: transparent !important`, which let the columns that scroll
     underneath show through the pinned one. */
  background: var(--surface) !important;
  box-shadow: inset 1px 0 0 var(--line);
}
body.nile .is-scrollable table > thead > tr > :last-child { background: var(--surface-3) !important; }
body.nile .is-scrollable table > tbody > tr:hover > :last-child { background: var(--nile-blue-50) !important; }

/* Row actions: consistent spacing when several buttons wrap onto two lines. */
body.nile table td > .btn,
body.nile table td > a > .btn,
body.nile table td > form { margin: 2px 4px 2px 0; }
body.nile table td > .btn + .btn,
body.nile table td > .btn-sm + a,
body.nile .table td .btn-sm + .btn-sm,
body.nile .table td .btn-sm + a { margin-left: 0; }
body.nile table td > form { display: inline-block; }
body.nile table td .btn { white-space: nowrap; }

/* Soft row buttons on every table, DataTables included (it uses .display, not .table). */
body.nile table td .btn-sm.btn-primary { background: var(--nile-blue-50); border-color: var(--nile-blue-100); color: var(--nile-blue); box-shadow: none; }
body.nile table td .btn-sm.btn-primary:hover { background: var(--nile-blue); border-color: var(--nile-blue); color: #fff; }
body.nile table td .btn-sm.btn-success { background: var(--nile-green-50); border-color: var(--nile-green-100); color: var(--nile-green-700); }
body.nile table td .btn-sm.btn-success:hover { background: var(--nile-green-600); border-color: var(--nile-green-600); color: #fff; }
body.nile table td .btn-sm.btn-danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
body.nile table td .btn-sm.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
body.nile table td .btn-sm.btn-info { background: var(--info-bg); border-color: var(--info-line); color: var(--nile-sky); }
body.nile table td .btn-sm.btn-info:hover { background: var(--nile-sky); border-color: var(--nile-sky); color: #fff; }
body.nile table td .btn-sm.btn-secondary { background: var(--surface-3); border-color: var(--line-2); color: var(--ink-2); }
body.nile table td .btn-sm.btn-secondary:hover { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }

/* Checkbox / radio labels read as sentence text, not as uppercase field labels. */
body.nile .custom-control-label,
body.nile .form-check-label,
body.nile input[type="checkbox"] + label,
body.nile input[type="radio"] + label,
body.nile label:has(> input[type="checkbox"]),
body.nile label:has(> input[type="radio"]) {
  text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13.5px; color: var(--ink-2);
}
body.nile .custom-checkbox ul, body.nile .custom-radio ul { list-style: none; padding: 0; margin: 0 0 6px; }

/* File inputs: styled button instead of the raw browser control. */
body.nile input[type="file"] { font-family: var(--font-sans); font-size: 13px; color: var(--ink-3); max-width: 100%; }
body.nile input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700; color: var(--nile-blue);
  background: var(--nile-blue-50); border: 1px solid var(--nile-blue-100); border-radius: 7px;
  padding: 5px 12px; margin-right: 10px; cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
body.nile input[type="file"]::file-selector-button:hover { background: var(--nile-blue); color: #fff; }
body.nile input[type="file"]::file-selector-button { vertical-align: middle; margin: 0 10px 0 0; }
body.nile input[type="file"].form-control,
body.nile input[type="file"]:not(.form-control) {
  height: auto; min-height: 40px; min-width: 210px; padding: 4px 6px; line-height: 1.5;
  border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface);
}

/* Inline filter bars: the flex gap does the spacing, so legacy mr-*/ml-* on the
   direct children would push the last button onto its own line. */
body.nile .form-inline { gap: 10px; }
body.nile .form-inline > .mr-1, body.nile .form-inline > .mr-2, body.nile .form-inline > .mr-3,
body.nile .form-inline > .ml-1, body.nile .form-inline > .ml-2, body.nile .form-inline > .ml-3,
body.nile .form-inline > .m-2 { margin: 0 !important; }
body.nile .form-inline label.mr-1 { margin-right: 0 !important; }
body.nile .form-inline .form-control { min-width: 150px; max-width: 280px; }

/* Legacy accordion ("Upload and Import", "All Upload"): flat header, 1px border. */
body.nile .accordion__item { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 14px; overflow: hidden; box-shadow: none !important; }
body.nile .accordion__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--surface-2) !important; border: 0 !important; border-radius: 0 !important;
  box-shadow: none !important; color: var(--ink); cursor: pointer;
}
body.nile .accordion__header--text { font-weight: 700; font-size: 14px; }
body.nile .accordion__header--indicator { position: static !important; transform: none !important; color: var(--ink-3); }
body.nile .accordion__body { border: 0 !important; }
body.nile .accordion__body--text { padding: 14px 16px !important; }
body.nile .card-body > .accordion { margin: 0; }

/* Bare section headings inside forms (e.g. "Semester" on the academic calendar):
   the legacy markup is a .card-header with a big m-5 margin. */
body.nile form .card-header.m-5, body.nile .card-body .card-header.m-5 { margin: 12px 0 8px !important; padding: 0 0 8px; border-bottom: 1px solid var(--line); }
body.nile form .card-header.m-5 h5 { font-size: 15px; color: var(--nile-blue); }

/* Grade result rows: keep the remove button detached from its input. */
body.nile #inputFormRow .input-group-append .btn, body.nile #removeRow { margin-left: 8px; border-radius: var(--radius-sm) !important; text-transform: capitalize; }

/* Buttons that also carry .form-control (legacy "full-width button in a form row"). */
body.nile .btn.form-control { height: 40px; width: 100%; }
body.nile .btn.btn-primary.form-control { background: var(--nile-blue); border: 1px solid var(--nile-blue); color: #fff; }
body.nile .btn.btn-primary.form-control:hover { background: var(--nile-blue-600); border-color: var(--nile-blue-600); }
body.nile .btn.btn-success.form-control { background: var(--nile-green-600); border: 1px solid var(--nile-green-600); color: #fff; }
body.nile .btn.btn-danger.form-control { background: var(--danger); border: 1px solid var(--danger); color: #fff; }

/* Bare .display tables that DataTables never initialised (e.g. LVS "Previous Runs"). */
body.nile table.display:not(.dataTable) { width: 100%; border-collapse: separate; border-spacing: 0; }
body.nile table.display:not(.dataTable) thead th {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
  background: var(--surface-3); border-bottom: 1px solid var(--line); padding: 10px 12px; white-space: nowrap; text-align: left;
}
body.nile table.display:not(.dataTable) tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
body.nile table.display:not(.dataTable) tbody tr:hover td { background: var(--nile-blue-50); }

/* ==========================================================================
   HOD workload overview (applicantcrm/hod_workload.html)
   A fixed-layout list rather than a DataTable, so it never scrolls sideways
   and long department lists collapse to chips.
   ========================================================================== */
body.nile .nile-hod { padding: 0; overflow: hidden; }
.nile-hod-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.nile-hod-title { font-weight: 700; font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 8px; margin-right: auto; }
.nile-hod-total, .nile-hod-seg button span {
  font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-3);
}
.nile-hod-seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--radius-sm); }
.nile-hod-seg button {
  border: 0; background: transparent; color: var(--ink-3); font: inherit; font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 7px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}
.nile-hod-seg button:hover { color: var(--ink); }
.nile-hod-seg button.is-active { background: var(--surface); color: var(--nile-blue); box-shadow: var(--shadow-1); }
.nile-hod-seg button.is-active span { background: var(--nile-blue-50); color: var(--nile-blue); }
body.nile .nile-hod-find {
  display: flex; align-items: center; gap: 8px; margin: 0;
  width: 300px; max-width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.nile-hod-find:focus-within { border-color: var(--nile-blue); box-shadow: var(--ring); }
.nile-hod-find svg { width: 16px; height: 16px; stroke: var(--ink-4); fill: none; stroke-width: 2; flex-shrink: 0; }
body.nile .nile-hod-find input { flex: 1; min-width: 0; height: auto; padding: 0; box-shadow: none; border: 0; outline: 0; background: transparent; font: inherit; font-size: 13.5px; color: var(--ink); width: 100%; }

/* Three tiles: the hero takes half, the other two a quarter each, at any width. */
.nile-stats.is-three { grid-template-columns: 2fr 1fr 1fr; }
@media (max-width: 900px) { .nile-stats.is-three { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .nile-stats.is-three { grid-template-columns: 1fr; } }
.nile-stats.is-three .nile-stat.is-hero { grid-column: auto; }
@media (max-width: 900px) { .nile-stats.is-three .nile-stat.is-hero { grid-column: 1 / -1; } }

.nile-hod-table { width: 100%; min-width: 720px; table-layout: fixed; border-collapse: collapse; }
.nile-hod-table col.c-who { width: 30%; }
.nile-hod-table col.c-num { width: 88px; }
.nile-hod-table col.c-act { width: 88px; }
@media (max-width: 1280px) {
  .nile-hod-table col.c-num { width: 76px; }
  .nile-hod-table th, .nile-hod-table td { padding-left: 10px; padding-right: 10px; }
}
.nile-hod-table th {
  padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); text-align: left;
}
.nile-hod-table th button {
  border: 0; background: none; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.nile-hod-table th button:hover { color: var(--ink); }
.nile-hod-table th button.is-sorted { color: var(--nile-blue); }
.nile-hod-table th button.is-sorted::after { content: "↓"; font-size: 12px; }
.nile-hod-table th button.is-sorted[aria-sort="ascending"]::after { content: "↑"; }
.nile-hod-table th.num, .nile-hod-table td.num { text-align: center; }
.nile-hod-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.nile-hod-table tbody tr[data-href] { cursor: pointer; transition: background-color 150ms ease; }
.nile-hod-table tbody tr[data-href]:hover { background: var(--nile-blue-50); }
.nile-hod-table tbody tr:last-child td { border-bottom: 0; }
body.nile .nile-hod-table .nile-person strong,
.nile-hod-name { display: block; font-weight: 700; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.nile a.nile-hod-name:hover { color: var(--nile-blue); text-decoration: none; }

/* .nile-person styles every span as the email line; the avatar is a span too. */
body.nile .nile-hod-table .nile-person > .nile-avatar {
  display: grid; flex-shrink: 0; font-size: 13px; color: var(--nile-blue); line-height: 1; overflow: visible;
}
.nile-hod-depts { display: flex; flex-wrap: wrap; gap: 6px; }
.nile-hod-chip {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  padding: 3px 9px; border-radius: var(--radius-chip); background: var(--surface-3); border: 1px solid var(--line);
}
.nile-hod-chip.is-more { color: var(--ink-3); background: var(--surface); }
.nile-hod-chip.is-scope { color: var(--nile-blue); background: var(--nile-blue-50); border-color: var(--nile-blue-100); }

body.nile a.nile-hod-n {
  display: inline-grid; place-items: center; min-width: 36px; height: 28px; padding: 0 8px;
  border-radius: 8px; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums;
  text-decoration: none; border: 1px solid transparent;
  transition: background-color 150ms ease, border-color 150ms ease;
}
body.nile a.nile-hod-n.is-zero { color: var(--ink-4); font-weight: 400; }
body.nile a.nile-hod-n.is-pending { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-line); }
body.nile a.nile-hod-n.is-approved { color: var(--success); }
body.nile a.nile-hod-n.is-rejected { color: var(--danger); }
body.nile a.nile-hod-n.is-clarify { color: var(--nile-blue); }
body.nile a.nile-hod-n:hover { background: var(--surface); border-color: var(--line-2); }
body.nile a.nile-hod-n.is-pending:hover { border-color: var(--warning); background: var(--warning-bg); }

.nile-hod-actions { text-align: right; white-space: nowrap; }
.nile-hod-actions form { display: inline; margin: 0; }
.nile-hod-actions .nile-iconbtn { width: 32px; height: 32px; vertical-align: middle; }
.nile-hod-actions .nile-iconbtn svg { width: 17px; height: 17px; }
.nile-hod-actions button.nile-iconbtn:hover { color: var(--nile-blue); background: var(--nile-blue-50); border-color: var(--nile-blue-100); }

.nile-hod-foot { padding: 12px 20px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }

.nile-hod-alert {
  display: flex; flex-direction: column; gap: 2px; margin-bottom: 18px;
  padding: 12px 16px 12px 14px; border-radius: var(--radius); font-size: 13.5px;
  background: var(--warning-bg); border: 1px solid var(--warning-line); border-left: 4px solid var(--warning); color: var(--ink-2);
}
.nile-hod-alert strong { color: var(--warning); }

@media (max-width: 720px) {
  .nile-hod-find { width: 100%; }
  .nile-hod-title { width: 100%; }
}

/* Plain horizontal scroller for the custom lists. Deliberately NOT
   .table-responsive: nile-ui.js pins the last column of those, and these
   lists turn into cards on phones instead. */
.nile-scroll { overflow-x: auto; scrollbar-width: thin; }

body.nile .nile-hod-select {
  height: 36px; padding: 0 30px 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background-color: var(--surface); font: inherit; font-size: 13.5px; color: var(--ink-2); max-width: 220px;
}
body.nile .nile-hod-select:focus { border-color: var(--nile-blue); box-shadow: var(--ring); outline: none; }
.nile-hod-chip.is-warn { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-line); }

/* Department review queue ------------------------------------------------- */
.nile-queue col.c-who { width: 25%; }
.nile-queue col.c-app { width: 29%; }
.nile-queue col.c-dept { width: 17%; }
.nile-queue col.c-go { width: 140px; }
.nile-queue tbody tr:not(.nile-hod-none):hover { background: var(--surface-2); }
.nile-queue td { vertical-align: top; }
.nile-queue td.is-lead, .nile-queue td.nile-hod-actions { vertical-align: middle; }
.nile-queue-app { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.nile-queue-degree { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 1px 0 6px; }
.nile-queue .nile-hod-chip { font-size: 11.5px; padding: 1px 7px; }
.nile-queue-wait { font-weight: 700; color: var(--ink); }
.nile-queue-wait.is-overdue { color: var(--danger); }
.nile-queue-by { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nile-queue-note {
  margin-top: 4px; font-size: 12.5px; color: var(--ink-2); font-style: italic;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
body.nile .nile-queue .nile-queue-decide { min-width: 76px; }

/* Decision dialog */
.nile-decide-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.nile-decide-choices { display: grid; gap: 8px; margin-bottom: 14px; }
body.nile .nile-decide-choice {
  display: flex; align-items: flex-start; gap: 10px; margin: 0; cursor: pointer;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color 150ms ease, background-color 150ms ease;
}
.nile-decide-choice input { margin-top: 3px; accent-color: var(--nile-blue); }
.nile-decide-choice span { display: flex; flex-direction: column; line-height: 1.3; }
.nile-decide-choice b { font-size: 14px; color: var(--ink); }
.nile-decide-choice small { font-size: 12.5px; color: var(--ink-3); }
.nile-decide-choice:hover { border-color: var(--line-2); background: var(--surface-2); }
.nile-decide-choice.is-approve:has(input:checked) { border-color: var(--success); background: var(--success-bg); }
.nile-decide-choice.is-approve input { accent-color: var(--success); }
.nile-decide-choice.is-clarify:has(input:checked) { border-color: var(--warning); background: var(--warning-bg); }
.nile-decide-choice.is-clarify input { accent-color: var(--warning); }
.nile-decide-choice.is-reject:has(input:checked) { border-color: var(--danger); background: var(--danger-bg); }
.nile-decide-choice.is-reject input { accent-color: var(--danger); }
.nile-decide-choice.is-blocked b::after { content: " · documents missing"; font-weight: 400; color: var(--warning); font-size: 12.5px; }

/* ==========================================================================
   Phone layout for the custom lists (.nile-cards): each row becomes a card.
   td[data-label] get their column name above the value; .is-lead is the
   card title; .is-corner sits top-right; .num cells share one row.
   ========================================================================== */
@media (max-width: 767px) {
  .nile-cards, .nile-cards tbody { display: block; width: 100%; min-width: 0 !important; }
  .nile-cards colgroup, .nile-cards thead { display: none; }
  .nile-cards tbody tr { display: flex; flex-wrap: wrap; gap: 10px 0; position: relative; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .nile-cards tbody tr:last-child { border-bottom: 0; }
  .nile-cards tbody tr[hidden] { display: none; }
  .nile-cards tbody td { display: block; width: 100%; padding: 0 !important; border: 0 !important; text-align: left !important; }
  .nile-cards tbody td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 3px;
    font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-4);
  }
  .nile-cards tbody td.is-lead { padding-right: 84px !important; }
  .nile-cards tbody td.is-corner { position: absolute; top: 12px; right: 10px; width: auto; }
  .nile-cards tbody td.num { width: 25%; }
  .nile-cards tbody td.is-half { width: 50%; }
  .nile-cards tbody .nile-hod-none td { width: 100%; }

  /* Queue: actions become a full-width bar at the bottom of the card. */
  .nile-queue tbody td.is-lead { padding-right: 0 !important; }
  .nile-queue tbody td.nile-hod-actions { position: static; width: 100%; display: flex; gap: 8px; justify-content: flex-end; }
  body.nile .nile-queue .nile-queue-decide { flex: 1; height: 36px; }
  .nile-queue tbody td.nile-hod-actions .nile-iconbtn { width: 36px; height: 36px; border-color: var(--line); }

  .nile-hod-toolbar { padding: 14px 16px; }
  .nile-hod-seg { flex: 1; }
  .nile-hod-seg button { flex: 1; justify-content: center; }
  body.nile .nile-hod-select { max-width: none; width: 100%; }
  .nile-hod-foot { padding: 12px 16px; }
}
.nile-queue col.c-view { width: 64px; }
@media (max-width: 767px) {
  /* Detail tabs: only a chevron in the corner, so the title keeps its width. */
  .nile-queue tbody td.nile-hod-actions:only-child, .tab-pane .nile-queue tbody td.nile-hod-actions { position: absolute; top: 10px; right: 8px; width: auto; }
  .tab-pane .nile-queue tbody td.is-lead { padding-right: 44px !important; }
}
.nile-stats.is-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .nile-stats.is-four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px) {
  body.nile .nile-hod-find { width: 100%; }
  /* Tabs scroll sideways rather than wrapping onto a second line. */
  body.nile .card-body > .nav-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  body.nile .card-body > .nav-tabs .nav-link { white-space: nowrap; }
}

/* PG School review ---------------------------------------------------------- */
.nile-pgs col.c-who { width: 28%; }
.nile-pgs col.c-app { width: 30%; }
.nile-pgs col.c-by { width: 22%; }
body.nile .nile-hod-mine {
  display: inline-flex; align-items: center; gap: 7px; margin: 0; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
body.nile .nile-hod-mine[hidden] { display: none; }
.nile-hod-mine input { accent-color: var(--nile-blue); width: 15px; height: 15px; }
/* The tab switcher leads the toolbar, so it takes the title's place. */
[data-pgs] .nile-hod-seg { margin-right: auto; }
@media (max-width: 767px) {
  /* Decision rows: only a chevron in the corner. */
  .nile-pgs tbody td.nile-hod-actions:not(:has(.nile-queue-decide)) { position: absolute; top: 12px; right: 10px; width: auto; }
  .nile-pgs tbody tr:not(:has(.nile-queue-decide)) td.is-lead { padding-right: 44px !important; }
}

/* ==========================================================================
   Application preview (PG preview.html / UG screening_preview.html)
   ========================================================================== */
.nile-apphead {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  margin-bottom: 18px; overflow: hidden;
}
.nile-apphead-main { display: flex; gap: 18px; align-items: flex-start; padding: 22px 24px 18px; }
.nile-apphead-photo {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
  border: 1px solid var(--line);
}
.nile-apphead-photo.is-initials {
  display: grid; place-items: center; background: var(--nile-blue-50); border-color: var(--nile-blue-100);
  color: var(--nile-blue); font-weight: 700; font-size: 22px;
}
.nile-apphead-who { flex: 1; min-width: 0; }
body.nile .nile-apphead h1 { font-size: 24px; line-height: 1.2; margin: 0 0 6px; color: var(--ink); font-weight: 700; }
.nile-apphead-id { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
body.nile .nile-apphead-copy {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; margin-left: -8px;
  border: 1px solid transparent; border-radius: 7px; background: none;
  font: inherit; font-weight: 700; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.nile-apphead-copy svg { width: 14px; height: 14px; stroke: var(--ink-4); fill: none; stroke-width: 2; }
.nile-apphead-copy:hover { background: var(--surface-2); border-color: var(--line); }
.nile-apphead-copy.is-copied { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.nile-apphead-copy.is-copied svg { stroke: var(--success); }
.nile-apphead-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.nile-apphead-contact { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13.5px; }
body.nile .nile-apphead-contact a { color: var(--ink-3); }
body.nile .nile-apphead-contact a:hover { color: var(--nile-blue); }
.nile-apphead-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
body.nile .nile-apphead-actions .btn-light { background: var(--surface); border: 1px solid var(--line-2); color: var(--ink-2); font-weight: 600; }
body.nile .nile-apphead-actions .btn-light:hover { border-color: var(--nile-blue); color: var(--nile-blue); }

.nile-apphead-facts {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0;
  border-top: 1px solid var(--line); background: var(--surface-2);
}
.nile-apphead-facts > div { padding: 12px 24px; min-width: 0; border-left: 1px solid var(--line); }
.nile-apphead-facts > div:first-child { border-left: 0; }
.nile-apphead-facts dt { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-4); margin-bottom: 2px; }
.nile-apphead-facts dd { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Status pills (plain-word status, coloured by outcome). */
.nile-status {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; border: 1px solid var(--line); background: var(--surface-3); color: var(--ink-2);
}
.nile-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.nile-status.is-success { color: var(--success); background: var(--success-bg); border-color: var(--success-line); }
.nile-status.is-danger  { color: var(--danger);  background: var(--danger-bg);  border-color: var(--danger-line); }
.nile-status.is-warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-line); }
.nile-status.is-info    { color: var(--nile-blue); background: var(--info-bg); border-color: var(--info-line); }

/* "Waiting for your decision" banner with the one Review button. */
.nile-decide-banner {
  display: flex; align-items: center; gap: 16px; margin-bottom: 18px;
  padding: 14px 18px; border-radius: var(--radius); background: var(--nile-blue-50); border: 1px solid var(--nile-blue-100);
}
.nile-decide-banner > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nile-decide-banner strong { color: var(--nile-blue); font-size: 14.5px; }
.nile-decide-banner span { font-size: 13px; color: var(--ink-3); }
.nile-decide-banner em { font-size: 13px; color: var(--ink-2); }
body.nile .nile-decide-banner .btn { min-width: 120px; }

/* Tabs on the preview: one line, and pinned under the header while the long
   forms scroll, so switching section never means scrolling back up. */
body.nile .profile-tab .custom-tab-1 > .nav-tabs {
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  position: sticky; top: var(--header-h); z-index: 6; background: var(--surface);
  margin: -20px -20px 20px; padding: 6px 12px 0;
}
body.nile .profile-tab .custom-tab-1 > .nav-tabs::-webkit-scrollbar { display: none; }
body.nile .profile-tab .custom-tab-1 > .nav-tabs .nav-link { white-space: nowrap; }

@media (max-width: 1100px) {
  .nile-apphead-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nile-apphead-facts > div:nth-child(4) { border-left: 0; }
  .nile-apphead-facts > div:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 767px) {
  .nile-apphead-main { flex-wrap: wrap; padding: 18px 16px 14px; gap: 14px; }
  .nile-apphead-photo { width: 52px; height: 52px; }
  .nile-apphead-photo.is-initials { font-size: 18px; }
  body.nile .nile-apphead h1 { font-size: 20px; }
  .nile-apphead-actions { width: 100%; justify-content: flex-start; }
  .nile-apphead-actions .btn { flex: 1; }
  .nile-apphead-facts { grid-template-columns: 1fr 1fr; }
  .nile-apphead-facts > div { padding: 10px 16px; border-left: 0; border-top: 1px solid var(--line); }
  .nile-apphead-facts > div:nth-child(-n+2) { border-top: 0; }
  .nile-apphead-facts > div:nth-child(even) { border-left: 1px solid var(--line); }
  .nile-apphead-facts > div:last-child { grid-column: 1 / -1; border-left: 0; }
  .nile-decide-banner { flex-direction: column; align-items: stretch; }
}

/* Documents tab: one row per expected document, uploaded ones first. */
.nile-docs { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.nile-doc { display: flex; align-items: flex-start; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--line); }
.nile-doc:first-child { border-top: 0; }
.nile-doc.is-missing { background: var(--surface-2); }
.nile-doc-main { flex: 1; display: flex; gap: 12px; min-width: 0; }
.nile-doc-ico { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; stroke: var(--nile-blue); fill: none; stroke-width: 1.8; stroke-linejoin: round; }
.nile-doc.is-missing .nile-doc-ico { stroke: var(--ink-4); }
.nile-doc-text { min-width: 0; }
.nile-doc-text strong { display: block; font-size: 14px; color: var(--ink); }
.nile-doc.is-missing .nile-doc-text strong { color: var(--ink-3); font-weight: 600; }
.nile-doc-file { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; font-size: 12.5px; color: var(--ink-3); }
body.nile .nile-doc-file a { font-weight: 700; color: var(--nile-blue); }
.nile-doc-upload { flex-shrink: 0; width: 320px; max-width: 45%; }
.nile-doc-upload details { margin: 0 !important; text-align: right; }
.nile-doc-upload details[open] { text-align: left; }
@media (max-width: 767px) {
  .nile-doc { flex-direction: column; gap: 8px; }
  .nile-doc-upload { width: 100%; max-width: none; padding-left: 32px; }
  .nile-doc-upload details { text-align: left; }
}

/* ==========================================================================
   Finance module (discount requests, payments, refunds, LVS retry)
   ========================================================================== */
/* Segmented control made of links (server-side filters) behaves like the buttons. */
.nile-hod-seg a {
  border: 0; background: transparent; color: var(--ink-3); font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 7px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease;
}
body.nile .nile-hod-seg a:hover { color: var(--ink); text-decoration: none; }
body.nile .nile-hod-seg a.is-active { background: var(--surface); color: var(--nile-blue); box-shadow: var(--shadow-1); }
.nile-hod-seg a span {
  font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--ink-3);
}
.nile-hod-seg a.is-active span { background: var(--nile-blue-50); color: var(--nile-blue); }
.nile-hod-seg-wrap { flex-wrap: wrap; max-width: 100%; }
.nile-hod-toolbar > .nile-hod-seg:first-child { margin-right: auto; }

.nile-hod-searchform { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.nile-hod-toolbar > .nile-hod-searchform:first-child { margin-right: auto; }
.nile-hod-downloads { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
body.nile .nile-hod-export { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-weight: 600; }
body.nile .nile-hod-export:hover { border-color: var(--nile-blue); color: var(--nile-blue); }
.nile-hod-export svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body.nile .nile-hod-clear { font-size: 13px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
body.nile .nile-hod-clear:hover { color: var(--danger); }

.nile-hod-filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
body.nile .nile-hod-date { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 600; color: var(--ink-3); }
body.nile .nile-hod-date input {
  height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  font: inherit; font-size: 13.5px; color: var(--ink);
}
body.nile .nile-hod-date input:focus { border-color: var(--nile-blue); box-shadow: var(--ring); outline: none; }

/* Export menu (details/summary: works without JS, closes on outside click via nile-ui.js). */
.nile-dd { position: relative; }
.nile-dd > summary { list-style: none; cursor: pointer; }
.nile-dd > summary::-webkit-details-marker { display: none; }
.nile-dd-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 260px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-3);
  animation: nile-pop 150ms var(--ease-out-expo);
}
body.nile .nile-dd-menu a { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 7px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
body.nile .nile-dd-menu a:hover { background: var(--nile-blue-50); color: var(--nile-blue); text-decoration: none; }
.nile-dd-menu small { font-size: 11.5px; font-weight: 400; color: var(--ink-4); }
.nile-dd-menu hr { margin: 4px 6px; border: 0; border-top: 1px solid var(--line); }

.nile-mono { font-family: var(--font-code); font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nile-amount { font-weight: 700; font-size: 14.5px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nile-hod-table th.num-r, .nile-hod-table td.num-r { text-align: right; }

/* Column widths per list */
.nile-fin col.c-who { width: 27%; }
.nile-discounts col.c-app { width: 27%; }
.nile-discounts col.c-disc { width: 17%; }
.nile-discounts col.c-dec { width: 15%; }
.nile-discounts col.c-go { width: 150px; }
.nile-payments col.c-app { width: 24%; }
.nile-payments col.c-ref { width: 25%; }
.nile-payments col.c-amt { width: 140px; }
.nile-payments col.c-go { width: 64px; }
.nile-pending col.c-app { width: 15%; }
.nile-pending col.c-ref { width: 20%; }
.nile-pending col.c-amt { width: 130px; }
.nile-pending col.c-step { width: 200px; }
.nile-pending col.c-act { width: 110px; }
.nile-refunds col.c-app { width: 26%; }
.nile-refunds col.c-amt { width: 140px; }
.nile-refunds col.c-stage { width: 22%; }
.nile-refunds col.c-view { width: 64px; }
.nile-fin td.nile-hod-actions .btn { margin-left: 4px; }
.nile-refunds tbody tr[data-href], .nile-lvs tbody tr[data-href] { cursor: pointer; }
.nile-refunds tbody tr[data-href]:hover, .nile-lvs tbody tr[data-href]:hover { background: var(--nile-blue-50); }

/* Mini four-step tracker in the refunds list */
.nile-steps { display: flex; gap: 3px; margin: 6px 0 2px; max-width: 120px; }
.nile-steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.nile-steps i.is-done { background: var(--success); }
.nile-steps i.is-now { background: var(--nile-blue); }
.nile-steps i.is-failed { background: var(--danger); }

/* Refund detail */
.nile-refund-amount { text-align: right; flex-shrink: 0; }
.nile-refund-amount span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-4); }
.nile-refund-amount strong { font-size: 26px; color: var(--ink); font-variant-numeric: tabular-nums; }
.nile-track { display: flex; list-style: none; margin: 0; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface-2); gap: 8px; }
.nile-track li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-4); min-width: 0; }
.nile-track li i { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; border: 2px solid var(--line-2); background: var(--surface); position: relative; }
.nile-track li::after { content: ""; flex: 1; height: 2px; background: var(--line); border-radius: 1px; }
.nile-track li:last-child::after { display: none; }
.nile-track li.is-done { color: var(--success); }
.nile-track li.is-done i { border-color: var(--success); background: var(--success); }
.nile-track li.is-done i::after { content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.nile-track li.is-done::after { background: var(--success); }
.nile-track li.is-now { color: var(--nile-blue); }
.nile-track li.is-now i { border-color: var(--nile-blue); box-shadow: 0 0 0 3px var(--nile-blue-100); }
.nile-track li.is-failed { color: var(--danger); }
.nile-track li.is-failed i { border-color: var(--danger); background: var(--danger); }
.nile-track li.is-failed i::before, .nile-track li.is-failed i::after { content: ""; position: absolute; left: 8px; top: 3px; width: 2px; height: 12px; background: #fff; transform: rotate(45deg); }
.nile-track li.is-failed i::after { transform: rotate(-45deg); }

.nile-refund-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.nile-refund-grid .card { margin-bottom: 18px; }
.nile-refund-actions p { font-size: 14px; color: var(--ink-2); }
.nile-dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; margin: 0; }
.nile-dl > div.is-wide { grid-column: 1 / -1; }
.nile-dl dt { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-4); margin-bottom: 2px; }
.nile-dl dd { margin: 0; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.nile-dl .nile-apphead-copy { margin-left: -8px; }

.nile-timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.nile-timeline li { position: relative; padding: 0 0 16px 14px; }
.nile-timeline li:last-child { padding-bottom: 0; }
.nile-timeline li::before { content: ""; position: absolute; left: -26px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); }
.nile-timeline li.is-done::before { background: var(--success); border-color: var(--success); }
.nile-timeline li.is-now::before { border-color: var(--nile-blue); box-shadow: 0 0 0 3px var(--nile-blue-100); }
.nile-timeline li.is-failed::before { background: var(--danger); border-color: var(--danger); }
.nile-timeline strong { display: block; font-size: 14px; color: var(--ink); }
.nile-timeline span { font-size: 12.5px; color: var(--ink-3); }
.nile-timeline p { margin: 4px 0 0; font-size: 13px; font-style: italic; color: var(--ink-2); }

/* LVS retry runs */
.nile-lvs col.c-run { width: 34%; }
.nile-lvs col.c-status { width: 30%; }
.nile-lvs col.c-num { width: 88px; }
.nile-lvs col.c-view { width: 64px; }
.nile-progress { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 7px 0 3px; max-width: 220px; }
.nile-progress i { display: block; height: 100%; background: var(--nile-blue); border-radius: 3px; }
.nile-lvs-err { color: var(--danger); font-weight: 700; }

/* Pager under the custom lists */
.nile-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
.nile-pager > div { display: flex; gap: 6px; }
body.nile .nile-pager .btn-light { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-weight: 600; }
body.nile .nile-pager .btn-light:hover { border-color: var(--nile-blue); color: var(--nile-blue); }
.nile-pager .disabled { opacity: .45; pointer-events: none; }

@media (max-width: 1100px) {
  .nile-refund-grid { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .nile-hod-filters { padding: 12px 16px; }
  .nile-hod-filters .nile-hod-select, .nile-hod-filters .nile-hod-find { width: 100%; max-width: none; }
  .nile-hod-searchform, .nile-hod-downloads { width: 100%; }
  .nile-hod-downloads > * { flex: 1; }
  .nile-dd-menu { left: 0; right: auto; }
  .nile-hod-seg-wrap { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .nile-hod-seg a { flex: 0 0 auto; }
  .nile-fin tbody td.nile-hod-actions:not(.is-corner) { position: static; width: 100%; display: flex; gap: 8px; justify-content: flex-end; }
  .nile-fin tbody td.nile-hod-actions:not(.is-corner) .btn { flex: 1; margin: 0; }
  .nile-fin tbody td.is-lead { padding-right: 44px !important; }
  .nile-cards tbody td.num-r { text-align: left !important; }
  .nile-refund-amount { width: 100%; text-align: left; }
  .nile-track { padding: 12px 16px; }
  .nile-track li span { display: none; }
  .nile-track li.is-now span, .nile-track li.is-failed span { display: inline; }
  .nile-dl { grid-template-columns: 1fr; }
  .nile-pager { padding: 12px 16px; }
  .nile-lvs tbody td.num { width: 33.33%; }
}

/* ==========================================================================
   Students module
   ========================================================================== */
.nile-students col.c-who { width: 30%; }
.nile-students col.c-bal { width: 150px; }
.nile-students col.c-status { width: 130px; }
.nile-students col.c-act { width: 140px; }
.nile-students tbody tr[data-href] { cursor: pointer; }
.nile-students tbody tr[data-href]:hover { background: var(--nile-blue-50); }
.nile-mono-inline { font-variant-numeric: tabular-nums; }
.nile-amount.is-owed { color: var(--ink); }
.nile-amount.is-credit { color: var(--success); }
.nile-amount.is-settled { color: var(--ink-4); font-weight: 600; }
.nile-hod-filters > .nile-hod-seg:only-child { margin: 0; }

/* Manage student */
.nile-legacy {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin: -4px 0 18px;
  padding: 10px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--surface);
}
.nile-legacy dt { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-4); margin-right: 4px; }
.nile-legacy div { display: flex; gap: 6px; align-items: baseline; font-size: 13px; }
.nile-legacy span { color: var(--ink-3); }
.nile-legacy b { color: var(--ink); font-variant-numeric: tabular-nums; }
.nile-tabbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; font-size: 13px; color: var(--ink-3); }
.custom-tab-1 .nile-hod-table { border: 1px solid var(--line); border-radius: var(--radius); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.nile-rows col.c-a { width: 34%; }
.nile-rows col.c-amt { width: 160px; }
.nile-rows col.c-act { width: 170px; }
.nile-tuition col.c-disc { width: 150px; }
.nile-services col.c-a { width: 34%; }
.nile-services col.c-flags { width: 40%; }
.nile-ledger col.c-when { width: 130px; }
.nile-ledger col.c-in, .nile-ledger col.c-out { width: 170px; }
.nile-ledger-kind { font-weight: 700; color: var(--ink); }
.nile-ledger-kind::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--ink-4); vertical-align: 1px; }
.nile-ledger-kind.is-payment::before, .nile-ledger-kind.is-credit::before, .nile-ledger-kind.is-discount::before { background: var(--success); }
.nile-ledger-kind.is-charge::before, .nile-ledger-kind.is-debit::before { background: var(--danger); }
.nile-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.nile-flags span { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-chip); border: 1px solid var(--line); color: var(--ink-4); text-decoration: line-through; text-decoration-color: var(--line-2); }
.nile-flags span.is-on { color: var(--success); background: var(--success-bg); border-color: var(--success-line); text-decoration: none; }
body.nile .nile-btn-danger { border: 1px solid var(--danger-line); color: var(--danger); background: var(--surface); font-weight: 600; }
body.nile .nile-btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.nile-hod-actions form { display: inline; }
@media (max-width: 767px) {
  .nile-legacy { flex-direction: column; align-items: flex-start; gap: 4px; }
  .nile-rows tbody td.nile-hod-actions, .nile-ledger tbody td.nile-hod-actions { position: static; width: 100%; text-align: left; }
}

/* Student import pages: one row per import type, and the approval queue. */
body.nile table.nile-import td, body.nile table.nile-approvals td { vertical-align: middle; }
body.nile table.nile-import td:first-child { font-weight: 700; color: var(--ink); width: 26%; }
body.nile table.nile-import td:nth-child(2) { width: 140px; }
body.nile table.nile-import form { margin: 0; }
body.nile table.nile-import form .row { align-items: center; margin: 0 -6px; }
body.nile table.nile-import form .row > [class*="col-"] { padding: 0 6px; }
body.nile table.nile-import input[type=file] {
  height: auto; padding: 5px 8px; font-size: 13px; border: 1px dashed var(--line-2); border-radius: var(--radius-sm); background: var(--surface-2);
}
body.nile table.nile-import input[type=file]:hover { border-color: var(--nile-blue); background: var(--nile-blue-50); }
body.nile table.nile-import input[type=file]::file-selector-button {
  margin-right: 10px; padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface);
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
body.nile table.nile-approvals td:first-child { font-weight: 700; color: var(--ink); }
body.nile table.nile-approvals td .btn { margin: 2px 4px 2px 0; }
body.nile table.nile-approvals td:last-child { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
@media (max-width: 767px) {
  body.nile table.nile-import, body.nile table.nile-import tbody, body.nile table.nile-import tr, body.nile table.nile-import td,
  body.nile table.nile-approvals, body.nile table.nile-approvals tbody, body.nile table.nile-approvals tr, body.nile table.nile-approvals td { display: block; width: 100% !important; }
  body.nile table.nile-import thead, body.nile table.nile-approvals thead { display: none; }
  body.nile table.nile-import tr, body.nile table.nile-approvals tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  body.nile table.nile-import td, body.nile table.nile-approvals td { border: 0 !important; padding: 4px 0 !important; }
  body.nile table.nile-import form .row > [class*="col-"] { flex: 0 0 100%; max-width: 100%; margin-bottom: 6px; }
}

/* Nile Online lists */
.nile-online-filters .nile-online-total { margin-left: auto; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
body.nile .nile-online-narrow { width: 170px; }
.nile-online col.c-who { width: 36%; }
.nile-online col.c-status { width: 26%; }
.nile-online col.c-go { width: 64px; }
.nile-online-pay col.c-a { width: 28%; }
.nile-online-pay col.c-amt { width: 150px; }
.nile-dd-check > summary { display: inline-flex; align-items: center; min-width: 170px; line-height: 34px; }
.nile-dd-check .nile-dd-menu { left: 0; right: auto; max-height: 340px; overflow-y: auto; }
body.nile .nile-dd-check .nile-dd-menu label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px 8px; border-radius: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
body.nile .nile-dd-check .nile-dd-menu label:hover { background: var(--nile-blue-50); }
.nile-dd-check input { accent-color: var(--nile-blue); }
@media (max-width: 767px) {
  .nile-online-filters .nile-online-total { margin-left: 0; width: 100%; }
  body.nile .nile-online-narrow { width: 100%; }
  .nile-dd-check, .nile-dd-check > summary { width: 100%; }
}
body.nile table.nile-import form .row { flex-wrap: nowrap; }
body.nile table.nile-import form .row > [class*="col-"]:last-child { flex: 0 0 auto; width: auto; max-width: none; }
body.nile table.nile-import form .row > [class*="col-"]:not(:last-child) { flex: 1 1 0; max-width: none; min-width: 0; }
@media (max-width: 767px) {
  body.nile table.nile-import form .row { flex-wrap: wrap; }
  .nile-ledger tbody tr.is-in td[data-label="Money out"], .nile-ledger tbody tr.is-out td[data-label="Money in"] { display: none; }
}

/* ==========================================================================
   Administration
   ========================================================================== */
.nile-staff col.c-who { width: 34%; }
.nile-staff col.c-roles { width: 26%; }
.nile-staff col.c-act { width: 120px; }

/* DataTables toolbar: a search box with an icon, "25 per page" beside it. */
body.nile .dataTables_wrapper .dataTables_filter input {
  width: 260px; margin-left: 0; padding-left: 34px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A8899' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center / 16px;
}
body.nile .dataTables_wrapper .dataTables_length label, body.nile .dataTables_wrapper .dataTables_filter label { display: inline-flex; align-items: center; gap: 8px; margin: 0; }

/* Older tables as cards on phones (nile-ui.js adds .nile-auto-cards and data-labels). */
@media (max-width: 767px) {
  body.nile table.nile-auto-cards { min-width: 0 !important; width: 100% !important; }
  body.nile table.nile-auto-cards, body.nile table.nile-auto-cards tbody { display: block; }
  body.nile table.nile-auto-cards thead { display: none; }
  body.nile table.nile-auto-cards tbody tr { display: flex; flex-wrap: wrap; gap: 8px 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); background: transparent !important; }
  body.nile table.nile-auto-cards tbody td { display: block; flex: 1 1 45%; min-width: 0; padding: 0 !important; border: 0 !important; background: transparent !important; position: static !important; box-shadow: none !important; text-align: left !important; }
  body.nile table.nile-auto-cards tbody td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-4);
  }
  body.nile table.nile-auto-cards tbody td.is-index { display: none; }
  body.nile table.nile-auto-cards tbody td.is-actions { flex-basis: 100%; }
  body.nile table.nile-auto-cards tbody td.is-actions::before { display: none; }
  body.nile table.nile-auto-cards tbody tr.is-empty td { flex-basis: 100%; text-align: center !important; }
  body.nile table.nile-auto-cards tbody tr.is-empty td::before { display: none; }
  body.nile .dataTables_wrapper .dataTables_filter, body.nile .dataTables_wrapper .dataTables_filter label, body.nile .dataTables_wrapper .dataTables_filter input { width: 100%; }
  body.nile .dataTables_wrapper .dataTables_length { float: none; }
}

/* Staff add/edit: roles and review scope */
.nile-form-section { margin: 4px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-4); }
.nile-form-section:not(:first-of-type) { margin-top: 10px; }
.nile-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.nile-checklist { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.nile-checklist.is-inline { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; }
.nile-checklist-search { display: block; width: 100%; height: 38px; padding: 0 12px 0 34px; border: 0; border-bottom: 1px solid var(--line); border-radius: var(--radius-sm) var(--radius-sm) 0 0; font: inherit; font-size: 13.5px; outline: none;
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A8899' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center / 15px; }
.nile-checklist-search:focus { background-color: var(--surface); box-shadow: inset 0 -2px 0 var(--nile-blue); }
.nile-checklist-items { max-height: 220px; overflow-y: auto; padding: 4px; }
body.nile .nile-check { display: flex; align-items: center; gap: 9px; margin: 0; padding: 7px 9px; border-radius: 7px; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--ink-2); line-height: 1.3; }
body.nile .nile-check[hidden] { display: none; }
.nile-check:hover { background: var(--nile-blue-50); }
.nile-check input { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--nile-blue); margin: 0; }
.nile-check:has(input:checked) { color: var(--ink); font-weight: 700; }
.nile-check code { margin-left: auto; font-size: 11.5px; color: var(--ink-4); background: none; }
.nile-check em { color: var(--warning); font-style: normal; font-weight: 400; font-size: 12px; }
.nile-checklist.is-inline .nile-check { border: 1px solid var(--line); background: var(--surface); padding: 6px 11px; }
.nile-checklist.is-inline .nile-check:has(input:checked) { border-color: var(--nile-blue-100); background: var(--nile-blue-50); color: var(--nile-blue); }
.nile-checklist-none { padding: 10px; font-size: 13px; color: var(--ink-4); text-align: center; }
.nile-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.nile-chips:empty { display: none; }
body.nile .nile-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; border-radius: 999px;
  border: 1px solid var(--nile-blue-100); background: var(--nile-blue-50); color: var(--nile-blue); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
body.nile .nile-chip::after { content: "×"; font-size: 15px; line-height: 1; opacity: .6; }
body.nile .nile-chip:hover { background: var(--nile-blue); color: #fff; border-color: var(--nile-blue); }
body.nile .nile-chip:hover::after { opacity: 1; }
.nile-field-error { margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--danger); }
.nile-access [data-dept-scope][hidden] { display: none; }

/* Enrolment */
.nile-apphead-actions form { display: inline; margin: 0; }
.nile-enrol col.c-who { width: 34%; }
.nile-enrol col.c-state { width: 18%; }
.nile-enrol col.c-act { width: 190px; }

/* Staff: individual permissions */
.nile-perms { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.nile-perms-bar { display: flex; align-items: center; gap: 10px; padding-right: 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.nile-perms-bar .nile-checklist-search { flex: 1; border-bottom: 0; }
.nile-perms-bar .nile-check { white-space: nowrap; padding: 4px 6px; font-size: 12.5px; }
.nile-perms-bar .nile-hod-total { white-space: nowrap; }
.nile-perms-list { max-height: 320px; overflow-y: auto; padding: 4px 6px 8px; }
.nile-perms-group[hidden] { display: none; }
.nile-perms-group h6 { position: sticky; top: 0; z-index: 1; margin: 0; padding: 8px 9px 4px; background: var(--surface); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-4); }
.nile-perms .nile-check em { margin-left: auto; font-size: 11.5px; font-style: normal; color: var(--nile-blue); background: var(--nile-blue-50); padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
body.nile .nile-perms .nile-check.is-via { color: var(--ink-3); font-weight: 500; cursor: default; }
.nile-perms .nile-check.is-via input { opacity: .55; }
@media (max-width: 767px) { .nile-perms-bar { flex-wrap: wrap; padding: 0 0 8px; } .nile-perms-bar .nile-checklist-search { flex-basis: 100%; } }

/* PG Admissions / UG Screening status pages (applicantcrm/pg_status_list.html). */
/* All proportional: a fixed-px action column on top of percentages overflowed
   the card at narrower windows / browser zoom and scrolled the names away. */
.nile-stage-list col.c-who { width: 27%; }
.nile-stage-list col.c-deg { width: 24%; }
.nile-stage-list col.c-st { width: 16%; }
.nile-stage-list col.c-go { width: 33%; }
.nile-stage-list.has-sid col.c-who { width: 23%; }
.nile-stage-list.has-sid col.c-deg { width: 20%; }
.nile-stage-list.has-sid col.c-sid { width: 11%; }
.nile-stage-list.has-sid col.c-st { width: 14%; }
.nile-stage-list.has-sid col.c-go { width: 32%; }
/* Buttons wrap onto a second line rather than spill out of the cell. */
.nile-stage-list td.nile-hod-actions { text-align: right; white-space: normal; }
@media (min-width: 768px) { body.nile .nile-stage-list td.nile-hod-actions .btn { margin: 3px 0 3px 4px; white-space: nowrap; } }
@media (max-width: 767px) {
  .nile-stage-list tbody td.nile-hod-actions:not(.is-corner) { flex-wrap: wrap; }
  .nile-stage-list tbody td.nile-hod-actions .btn { min-width: 0; white-space: nowrap; }
}
.nile-stage-list .nile-queue-degree { white-space: normal; }

/* Review queues: a labelled View button beside Review (was an eye icon). */
body.nile .nile-queue td.nile-hod-actions > a.btn-light { margin-right: 4px; }
@media (max-width: 767px) {
  body.nile .nile-queue tbody td.nile-hod-actions > a.btn-light { height: 36px; display: inline-flex; align-items: center; margin: 0; padding: 0 16px; }
}

/* Decision banner on the application page: Approve / clarify / Reject. */
.nile-decide-banner > .nile-decide-actions { flex: none; flex-direction: row; flex-wrap: wrap; gap: 8px; align-items: center; }
body.nile .nile-decide-banner .nile-decide-actions .btn { min-width: 0; }
@media (max-width: 767px) {
  .nile-decide-banner > .nile-decide-actions .btn { flex: 1 1 auto; }
}

/* "View as" banner (layout/base.html): sticky, impossible to miss. */
.nile-viewas { position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 20px; background: var(--warning-bg); border-bottom: 1px solid var(--warning-line); color: var(--ink); font-size: 13px; }
.nile-viewas b { color: var(--warning); }
.nile-viewas form { margin: 0; flex: none; }
@media (max-width: 767px) { .nile-viewas { flex-direction: column; align-items: stretch; text-align: center; } }

/* Sortable tables (nile-ui.js, table[data-sortable]). */
body.nile th[data-sort] .nile-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; }
body.nile th[data-sort] .nile-sort::after { content: "↕"; opacity: .35; font-size: 11px; }
body.nile th[data-sort][aria-sort="ascending"] .nile-sort::after { content: "↑"; opacity: 1; color: var(--nile-blue); }
body.nile th[data-sort][aria-sort="descending"] .nile-sort::after { content: "↓"; opacity: 1; color: var(--nile-blue); }
body.nile th[data-sort] .nile-sort:focus-visible { outline: 2px solid var(--nile-blue); outline-offset: 2px; border-radius: 3px; }
.nile-rows col.c-date { width: 120px; }
