/* ═══════════════════════════════════════════════════════════════════
   School SaaS — Enterprise UI  |  public/css/app.css
   ═══════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ──────────────────────────────────────────────────── */
:root {
  /* Brand (overridden per-tenant inline in layout) */
  --brand:            #2E5496;
  --brand-light:      #EEF2FF;
  --brand-dark:       #1E3A6E;

  /* Sidebar */
  --sidebar-bg:          #0F172A;
  --sidebar-width:       268px;
  --sidebar-width-rail:  68px;
  --sidebar-text:        #94A3B8;
  --sidebar-hover-bg:    rgba(255,255,255,0.06);
  --sidebar-active-bg:   rgba(255,255,255,0.10);
  --sidebar-item-hover:  rgba(255,255,255,0.06);
  --sidebar-item-active-bg: rgba(255,255,255,0.10);

  /* Surfaces */
  --bg-page:          #F0F4F8;
  --bg-card:          #FFFFFF;
  --bg-card-hover:    #FAFBFF;

  /* Borders */
  --border:           #E2E8F0;
  --border-focus:     var(--brand);

  /* Text */
  --text-heading:     #0F172A;
  --text-body:        #334155;
  --text-muted:       #94A3B8;
  --text-inverse:     #FFFFFF;

  /* Semantic */
  --success:          #10B981;
  --success-light:    #ECFDF5;
  --danger:           #EF4444;
  --danger-light:     #FEF2F2;
  --warning:          #F59E0B;
  --warning-light:    #FFFBEB;
  --info:             #3B82F6;
  --info-light:       #EFF6FF;
  --purple:           #8B5CF6;
  --purple-light:     #F5F3FF;
  --pink:             #EC4899;
  --pink-light:       #FDF2F8;
  --teal:             #0F766E;
  --teal-light:       #F0FDFA;

  /* Shadows */
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg:    0 10px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-brand: 0 4px 20px rgba(46,84,150,0.25);

  /* Radii */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-pill: 999px;

  /* Motion */
  --transition: all 0.18s cubic-bezier(0.4,0,0.2,1);

  /* Typography pairing — Inter for body/data, Poppins for display */
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Poppins', 'Inter', system-ui, sans-serif;

  /* Legacy aliases (keep for inline-style compat in existing views) */
  --content-bg:   var(--bg-page);
  --card-bg:      var(--bg-card);
  --text-primary: var(--text-heading);
  --text-light:   var(--text-muted);
  --border-color: var(--border);
  --radius:       var(--radius-md);
  --shadow:       var(--shadow-sm);
  --header-height: 64px;
}

/* ── Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text-body);
  background: var(--bg-page);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Font pairing (tenant portal shell only; SaaS console keeps Inter) ──
   Inter carries body & data; Poppins gives headings/titles their character. */
.mobile-app-shell,
.guest-shell { font-family: var(--font-body); }

.mobile-app-shell h1,
.mobile-app-shell h2,
.mobile-app-shell h3,
.mobile-app-shell h4,
.mobile-app-shell h5,
.mobile-app-shell .page-title,
.mobile-app-shell .section-title,
.mobile-app-shell .app-card-title,
.mobile-app-shell .table-card-title,
.mobile-app-shell .chart-card-title,
.mobile-app-shell .stat-value {
  font-family: var(--font-display);
}

a { color: var(--brand); text-decoration: none; }
a:hover { opacity: .85; }

/* ═══ PAGE PROGRESS BAR ═════════════════════════════════════════════ */

#page-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--info));
  z-index: 99999;
  transition: width 0.35s ease, opacity 0.4s ease;
  border-radius: 0 2px 2px 0;
}

/* ═══ SIDEBAR ═══════════════════════════════════════════════════════ */

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1040;
  transition: width 0.22s cubic-bezier(0.4,0,0.2,1), transform 0.22s cubic-bezier(0.4,0,0.2,1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
}

/* ── Sidebar header ─────────────────────────────────────────────── */
.sidebar-header {
  padding: 16px 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 60px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.sidebar-logo-icon {
  width: 34px; height: 34px;
  background: var(--brand);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
  color: #fff;
  box-shadow: var(--shadow-brand);
}

.sidebar-school-name {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--transition);
}

/* Rail collapse toggle inside sidebar header */
.sidebar-rail-toggle {
  width: 28px; height: 28px;
  border: none;
  background: rgba(255,255,255,.07);
  color: var(--sidebar-text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.sidebar-rail-toggle:hover {
  background: rgba(255,255,255,.13);
  color: #fff;
}

/* ── Sidebar nav ─────────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 6px 0 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Collapsible group header */
.sidebar-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 5px;
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  gap: 6px;
  min-height: 0;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #475569;
  white-space: nowrap;
}

.sidebar-group-chevron {
  font-size: 11px;
  color: #475569;
  transition: transform 0.22s ease;
  flex-shrink: 0;
}

.sidebar-group-toggle.is-collapsed .sidebar-group-chevron {
  transform: rotate(-90deg);
}

/* Collapsible group panel */
.sidebar-group {
  overflow: hidden;
  max-height: 600px;
  transition: max-height 0.25s ease;
}

.sidebar-group.is-collapsed {
  max-height: 0;
}

/* ── Sidebar items ───────────────────────────────────────────────── */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 450;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  border-left: 3px solid transparent;
  white-space: nowrap;
  position: relative;
}

.sidebar-item:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
  text-decoration: none;
}

.sidebar-item.active {
  background: var(--sidebar-active-bg);
  color: #fff;
  border-left-color: var(--brand);
  font-weight: 500;
}

.sidebar-item i {
  font-size: 15px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  opacity: .8;
}

.sidebar-item.active i { opacity: 1; }

.sidebar-item .nav-label { transition: opacity 0.18s, width 0.18s; }

/* ── Sidebar footer / user card ─────────────────────────────────── */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(46,84,150,0.35);
}

.sidebar-user-info {
  min-width: 0;
  flex: 1;
  transition: var(--transition);
}

.sidebar-user-name {
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 10px;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.sidebar-user-gear {
  color: var(--sidebar-text);
  font-size: 14px;
  flex-shrink: 0;
  transition: var(--transition);
}

.sidebar-user-gear:hover { color: #fff; opacity: 1; }

/* ═══ SIDEBAR COLLAPSED (RAIL) MODE ═════════════════════════════════ */

.sidebar.rail {
  width: var(--sidebar-width-rail);
  overflow: visible;
}

.sidebar.rail .sidebar-school-name { display: none; }
.sidebar.rail .sidebar-rail-toggle i { transform: scaleX(-1); }
.sidebar.rail .nav-label { opacity: 0; width: 0; overflow: hidden; pointer-events: none; }
.sidebar.rail .sidebar-group-chevron { display: none; }
.sidebar.rail .sidebar-section-label { display: none; }
.sidebar.rail .sidebar-group-toggle { display: none; }
.sidebar.rail .sidebar-group.is-collapsed { max-height: 600px; } /* show all when rail */
.sidebar.rail .sidebar-item { justify-content: center; padding: 10px 0; }
.sidebar.rail .sidebar-item i { width: auto; }
.sidebar.rail .sidebar-user-info { display: none; }
.sidebar.rail .sidebar-user-gear { display: none; }
.sidebar.rail .sidebar-user { justify-content: center; }
.sidebar.rail .sidebar-header { justify-content: center; padding: 14px 0; }
.sidebar.rail .sidebar-logo-icon { margin: 0; }

/* Tooltip on rail items */
.sidebar.rail .sidebar-item {
  position: relative;
}

.sidebar.rail .sidebar-item::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(var(--sidebar-width-rail) - 4px);
  top: 50%;
  transform: translateY(-50%);
  background: #1E293B;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: var(--shadow-md);
  transition: opacity 0.15s, left 0.15s;
  z-index: 2000;
}

.sidebar.rail .sidebar-item:hover::after {
  opacity: 1;
  left: calc(var(--sidebar-width-rail) + 4px);
}

/* ═══ SIDEBAR — LIGHT THEME ════════════════════════════════════════ */
/* Applied when appearance.sidebar_style = "light" (set in Settings → Appearance). */
.sidebar.sidebar-light {
  background: #FFFFFF;
  border-right: 1px solid #E2E8F0;
}
.sidebar-light .sidebar-header { border-bottom-color: #EDF1F6; }
.sidebar-light .sidebar-school-name { color: var(--text-heading); }
.sidebar-light .sidebar-rail-toggle { background: #F1F5F9; color: #64748B; }
.sidebar-light .sidebar-rail-toggle:hover { background: #E2E8F0; color: var(--text-heading); }
.sidebar-light .sidebar-section-label { color: #94A3B8; }
.sidebar-light .sidebar-group-chevron { color: #94A3B8; }
.sidebar-light .sidebar-item { color: #475569; }
.sidebar-light .sidebar-item:hover { background: #F1F5F9; color: var(--text-heading); }
.sidebar-light .sidebar-item.active {
  background: var(--brand-light); color: var(--brand); border-left-color: var(--brand);
}
.sidebar-light .sidebar-sub-menu { background: #F8FAFC; }
.sidebar-light .sidebar-sub-item { color: #64748B; }
.sidebar-light .sidebar-sub-item:hover,
.sidebar-light .sidebar-sub-item.active { color: var(--brand); }
.sidebar-light .sidebar-footer { border-top-color: #EDF1F6; }
.sidebar-light .sidebar-user-name { color: var(--text-heading); }
.sidebar-light .sidebar-user-role { color: #94A3B8; }
.sidebar-light .sidebar-user-gear { color: #94A3B8; }
.sidebar-light .sidebar-user-gear:hover { color: var(--brand); }

/* ═══ MAIN WRAPPER ══════════════════════════════════════════════════ */

.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.22s cubic-bezier(0.4,0,0.2,1);
}

.main-wrapper.rail { margin-left: var(--sidebar-width-rail); }

/* ── Top header ──────────────────────────────────────────────────── */
.top-header {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.header-page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-heading);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  text-decoration: none;
  transition: var(--transition);
}

.header-icon-btn:hover { background: var(--border); color: var(--text-heading); }

.header-tenant-badge {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  white-space: nowrap;
}

.header-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  cursor: pointer;
}

.sidebar-toggle {
  display: none;
  width: 36px; height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0;
  flex-shrink: 0;
}

.sidebar-toggle:hover { background: var(--bg-page); color: var(--text-heading); }

/* ── Content area ────────────────────────────────────────────────── */
.content-area {
  flex: 1;
  padding: 28px;
}

/* ═══ PAGE HEADER ════════════════════════════════════════════════════ */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 4px;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0; padding: 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  margin-right: 4px;
  color: var(--text-muted);
  opacity: .5;
}

.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item a:hover { color: var(--brand); }
.breadcrumb-item.active { color: var(--text-body); font-weight: 500; }

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ═══ CARD ENTRANCE ANIMATION ════════════════════════════════════════ */

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; }
}

.app-card, .table-card, .form-card, .stat-card {
  animation: cardIn 0.28s ease both;
}

.stat-card:nth-child(1) { animation-delay: 0.04s; }
.stat-card:nth-child(2) { animation-delay: 0.08s; }
.stat-card:nth-child(3) { animation-delay: 0.12s; }
.stat-card:nth-child(4) { animation-delay: 0.16s; }
.stat-card:nth-child(5) { animation-delay: 0.20s; }

/* ═══ CARDS ══════════════════════════════════════════════════════════ */

.app-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.app-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
  margin: 0;
}

.app-card-body { padding: 20px; }

.app-card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: #FAFBFF;
}

/* ═══ STAT CARDS ═════════════════════════════════════════════════════ */

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 18px 18px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  position: relative;
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.stat-card-inner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 14px;
}

.stat-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.stat-icon-blue   { background: var(--info-light);    color: var(--info); }
.stat-icon-green  { background: var(--success-light); color: var(--success); }
.stat-icon-red    { background: var(--danger-light);  color: var(--danger); }
.stat-icon-yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon-purple { background: var(--purple-light);  color: var(--purple); }
.stat-icon-indigo { background: var(--brand-light);   color: var(--brand); }
.stat-icon-brand  { background: var(--brand-light);   color: var(--brand); }

.stat-meta { flex: 1; min-width: 0; }

.stat-trend {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}

.stat-trend-up   { background: var(--success-light); color: var(--success); }
.stat-trend-down { background: var(--danger-light);  color: var(--danger); }
.stat-trend-warn { background: var(--warning-light); color: var(--warning); }
.stat-trend-info { background: var(--info-light);    color: var(--info); }

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1;
  letter-spacing: -.03em;
  margin-top: 6px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-top: 5px;
}

/* Progress bar at bottom of stat card */
.stat-bar {
  height: 3px;
  width: 100%;
  background: var(--border);
  border-radius: 0;
  overflow: hidden;
  flex-shrink: 0;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 0;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

/* ═══ GREETING HERO ══════════════════════════════════════════════════ */

.greeting-card {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-brand);
  margin-bottom: 24px;
  animation: cardIn 0.35s ease both;
}

.greeting-hero-text { position: relative; z-index: 1; }

.greeting-name {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.2;
}

.greeting-date {
  font-size: 13.5px;
  opacity: .75;
  margin-bottom: 4px;
}

.greeting-school {
  font-size: 12.5px;
  opacity: .6;
  font-weight: 500;
  letter-spacing: .02em;
}

.greeting-deco {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  opacity: .10;
  pointer-events: none;
}

/* ═══ DASHBOARD QUICK ACTIONS ════════════════════════════════════════ */

.quick-action-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: var(--transition);
  background: #fff;
  cursor: pointer;
}

.quick-action-tile:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  background: var(--brand-light);
  transform: translateY(-2px);
  text-decoration: none;
}

.quick-action-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.quick-action-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
}

.quick-action-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ═══ CHART CONTAINERS ════════════════════════════════════════════════ */

.chart-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chart-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.chart-toggle-btn {
  border: none;
  background: none;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.chart-toggle-btn.active {
  background: #fff;
  color: var(--text-heading);
  box-shadow: var(--shadow-sm);
}

.chart-container {
  position: relative;
  height: 240px;
}

.chart-container-sm {
  position: relative;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.doughnut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  text-align: center;
  pointer-events: none;
}

.doughnut-center-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1;
}

.doughnut-center-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 3px;
}

.chart-legend-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.chart-legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-body);
}

.chart-legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ═══ TABLES ══════════════════════════════════════════════════════════ */

.table-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.table-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
  margin: 0;
}

.table-row-count {
  font-size: 12px;
  color: var(--text-muted);
}

.app-table {
  width: 100%;
  border-collapse: collapse;
}

.app-table thead tr { background: #F8FAFC; }

.app-table th {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6A788D;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.app-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
  color: var(--text-body);
  font-size: 13.5px;
}

.app-table tbody tr:last-child td { border-bottom: none; }

.app-table tbody tr:hover td { background: var(--bg-card-hover); }
.app-table tbody tr.row-overdue td { background: #FFF5F5; }

/* Clickable rows */
.app-table tbody tr[data-href] { cursor: pointer; }
.app-table tbody tr[data-href]:hover td { background: var(--brand-light); }

.app-table .col-actions { width: 120px; text-align: right; }

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-state {
  padding: 52px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

.empty-state i {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
  opacity: .3;
}

.empty-state-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 6px;
}

/* Reusable state-panel icon badge (subscription / module / empty pages). */
.state-icon {
  width: 76px; height: 76px; margin: 0 auto 20px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.state-icon-brand   { background: var(--brand-light);   color: var(--brand); }
.state-icon-danger  { background: var(--danger-light);  color: var(--danger); }
.state-icon-warning { background: var(--warning-light); color: var(--warning); }
.state-icon-info    { background: var(--info-light);    color: var(--info); }
.state-icon-success { background: var(--success-light); color: var(--success); }

/* Borderless muted text button (secondary actions: cancel / sign out). */
.btn-text-muted {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 8px 12px; border-radius: var(--radius-md);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: var(--transition);
}
.btn-text-muted:hover { color: var(--text-body); background: #F1F5F9; }

/* ═══ DATATABLES OVERRIDES ════════════════════════════════════════════ */

.dataTables_wrapper .dt-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: #FAFBFF;
}

.dataTables_wrapper .dataTables_filter label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--text-body);
  background: #fff;
  outline: none;
  margin-left: 6px;
  min-width: 220px;
  font-family: 'Inter', system-ui, sans-serif;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(46,84,150,.10);
}

.dataTables_wrapper .dataTables_length label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  height: 34px;
  padding: 0 28px 0 10px;
  font-size: 13px;
  color: var(--text-body);
  background: #fff;
  outline: none;
  margin: 0 6px;
  font-family: 'Inter', system-ui, sans-serif;
  cursor: pointer;
}

.dataTables_wrapper .dataTables_info {
  padding: 12px 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.dataTables_wrapper .dataTables_paginate {
  padding: 10px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 3px;
}

.dataTables_wrapper .paginate_button {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-body) !important;
  padding: 5px 11px !important;
  font-size: 12.5px !important;
  background: #fff !important;
  cursor: pointer !important;
  transition: var(--transition) !important;
}

.dataTables_wrapper .paginate_button:hover:not(.disabled) {
  background: var(--bg-page) !important;
  border-color: var(--border) !important;
  color: var(--text-heading) !important;
}

.dataTables_wrapper .paginate_button.current {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
}

.dataTables_wrapper .paginate_button.current:hover {
  background: var(--brand-dark) !important;
  border-color: var(--brand-dark) !important;
  color: #fff !important;
}

.dataTables_wrapper .paginate_button.disabled { opacity: .4 !important; cursor: default !important; }

/* DT bottom bar */
.dataTables_wrapper .dt-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  background: #FAFBFF;
  flex-wrap: wrap;
}

/* Sort indicator overrides */
table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after {
  font-family: 'bootstrap-icons';
  font-size: 11px;
  margin-left: 5px;
  opacity: .5;
}

table.dataTable thead th.sorting::after       { content: '\F2FC'; } /* bi-chevron-expand */
table.dataTable thead th.sorting_asc::after   { content: '\F235'; opacity: 1; color: var(--brand); } /* bi-chevron-up */
table.dataTable thead th.sorting_desc::after  { content: '\F229'; opacity: 1; color: var(--brand); } /* bi-chevron-down */

/* ═══ BADGES ══════════════════════════════════════════════════════════ */

/* Base badge (used by x-badge component and inline) */
.badge-pill, .status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}

.badge-active      { background: var(--success-light); color: var(--success); }
.badge-inactive    { background: #F1F5F9; color: #64748B; }
.badge-paid        { background: var(--success-light); color: var(--success); }
.badge-unpaid      { background: var(--danger-light);  color: var(--danger); }
.badge-partial     { background: var(--warning-light); color: var(--warning); }
.badge-suspended   { background: var(--danger-light);  color: var(--danger); }
.badge-graduated   { background: var(--info-light);    color: var(--info); }
.badge-alumni      { background: var(--info-light);    color: var(--info); }
.badge-transferred { background: var(--purple-light);  color: var(--purple); }
.badge-withdrawn   { background: #F1F5F9; color: #64748B; }
.badge-overdue     { background: var(--danger-light);  color: var(--danger); }
.badge-reversal    { background: var(--warning-light); color: var(--warning); }
.badge-recurring   { background: var(--success-light); color: var(--success); }
.badge-one-time    { background: #F1F5F9; color: #64748B; }
.badge-cash        { background: var(--success-light); color: var(--success); }
.badge-bank        { background: var(--info-light);    color: var(--info); }
.badge-cheque      { background: var(--purple-light);  color: var(--purple); }
.badge-adjustment  { background: var(--warning-light); color: var(--warning); }
.badge-concession  { background: var(--success-light); color: var(--success); }
.badge-monthly     { background: var(--info-light);    color: var(--info); }
.badge-annual      { background: var(--brand-light);   color: var(--brand); }
.badge-present     { background: var(--success-light); color: var(--success); }
.badge-absent      { background: var(--danger-light);  color: var(--danger); }
.badge-late        { background: var(--warning-light); color: var(--warning); }
.badge-published   { background: var(--info-light);    color: var(--info); }
.badge-draft       { background: #F1F5F9; color: #64748B; }

/* Bootstrap-tone bridge — soft pill tones keyed by contextual colour name
   (success/info/warning/danger/secondary/dark/primary/light), so SaaS
   console badges match the app's soft badge system instead of solid
   Bootstrap `.badge.bg-*` fills. */
.badge-tone-primary   { background: var(--brand-light);   color: var(--brand); }
.badge-tone-success   { background: var(--success-light); color: var(--success); }
.badge-tone-info      { background: var(--info-light);    color: var(--info); }
.badge-tone-warning   { background: var(--warning-light); color: var(--warning); }
.badge-tone-danger    { background: var(--danger-light);  color: var(--danger); }
.badge-tone-secondary { background: #F1F5F9; color: #64748B; }
.badge-tone-dark      { background: #E2E8F0; color: #334155; }
.badge-tone-light     { background: #F1F5F9; color: #64748B; }

/* Size modifier for prominent status badges (e.g. subscription header). */
.status-badge-lg { font-size: 13px; padding: 5px 14px; }

/* ═══ ACTION BUTTONS ══════════════════════════════════════════════════ */

/* Base action button */
.btn-action {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  flex-shrink: 0;
}

/* Semantic colored variants */
.btn-action-view {
  background: var(--info-light);
  color: var(--info);
}

.btn-action-edit {
  background: var(--warning-light);
  color: var(--warning);
}

.btn-action-delete {
  background: var(--danger-light);
  color: var(--danger);
}

.btn-action-pay {
  background: var(--success-light);
  color: var(--success);
}

.btn-action-print {
  background: var(--purple-light);
  color: var(--purple);
}

.btn-action-view:hover   { background: var(--info);    color: #fff; transform: scale(1.06); text-decoration: none; }
.btn-action-edit:hover   { background: var(--warning); color: #fff; transform: scale(1.06); text-decoration: none; }
.btn-action-delete:hover { background: var(--danger);  color: #fff; transform: scale(1.06); text-decoration: none; }
.btn-action-pay:hover    { background: var(--success); color: #fff; transform: scale(1.06); text-decoration: none; }
.btn-action-print:hover  { background: var(--purple);  color: #fff; transform: scale(1.06); text-decoration: none; }

/* Legacy hover styles (still used in old views) */
.btn-action:hover { text-decoration: none; }
.btn-action.view:hover   { background: var(--info-light);    color: var(--info);    }
.btn-action.edit:hover   { background: var(--warning-light); color: var(--warning); }
.btn-action.delete:hover { background: var(--danger-light);  color: var(--danger);  }
.btn-action.collect:hover { background: var(--success-light); color: var(--success); }

/* ═══ PRIMARY BUTTONS ═════════════════════════════════════════════════ */

.btn-brand {
  background: var(--brand);
  color: #fff;
  border: 1px solid transparent;
  padding: 0 20px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  white-space: nowrap;
  font-family: 'Inter', system-ui, sans-serif;
  box-shadow: var(--shadow-brand);
}

.btn-brand:hover {
  background: var(--brand-dark);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(46,84,150,0.3);
}

.btn-brand:active { transform: translateY(0); }
.btn-brand:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-outline {
  background: #fff;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0 18px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  white-space: nowrap;
  font-family: 'Inter', system-ui, sans-serif;
}

.btn-outline:hover {
  background: var(--bg-page);
  color: var(--text-heading);
  border-color: #CBD5E1;
  text-decoration: none;
}

.btn-danger-solid {
  background: var(--danger);
  color: #fff;
  border: 1px solid transparent;
  padding: 0 18px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-danger-solid:hover { opacity: .88; color: #fff; text-decoration: none; }

.btn-success {
  background: var(--success);
  color: #fff;
  border: 1px solid transparent;
  padding: 0 16px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  white-space: nowrap;
  font-family: 'Inter', system-ui, sans-serif;
}

.btn-success:hover { opacity: .88; color: #fff; text-decoration: none; }

.btn-sm   { padding: 0 12px; height: 32px; font-size: 12.5px; }
.btn-lg   { padding: 0 28px; height: 46px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }

/* ═══ FORMS ════════════════════════════════════════════════════════════ */

.form-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border-top: 4px solid var(--brand);
}

.form-section {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
}

.form-section:last-of-type { border-bottom: none; }

.form-section-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-muted);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 5px;
  display: block;
}

.required-star { color: var(--danger); margin-left: 2px; }

.form-control, .form-select {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 13.5px;
  color: var(--text-body);
  background: #fff;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: 'Inter', system-ui, sans-serif;
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(46,84,150,.12);
  outline: none;
}

.form-control.is-invalid, .form-select.is-invalid {
  border-color: var(--danger);
  background-image: none;
}

.form-control.is-invalid:focus, .form-select.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

textarea.form-control {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
}

.field-error {
  font-size: 11.5px;
  color: var(--danger);
  margin-top: 4px;
  display: block;
}

.form-text { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

.form-check-input {
  width: 16px; height: 16px;
  border: 1.5px solid #D1D5DB;
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--brand);
  flex-shrink: 0;
}

.form-check-label { font-size: 13.5px; color: var(--text-body); }

.form-sticky-footer {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  z-index: 100;
  box-shadow: 0 -4px 12px rgba(0,0,0,.06);
}

.input-group-text {
  border-color: var(--border);
  background: #F9FAFB;
  color: var(--text-muted);
  font-size: 13.5px;
  font-family: 'Inter', system-ui, sans-serif;
}

.error-alert {
  background: var(--danger-light);
  border: 1px solid #FECACA;
  border-left: 4px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
}

.error-alert ul {
  margin: 0; padding-left: 18px;
  font-size: 13px;
  color: #DC2626;
}

/* ═══ FLASH MESSAGES ══════════════════════════════════════════════════ */

.flash-container {
  position: fixed;
  top: 80px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.flash-message {
  pointer-events: all;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 340px;
  min-width: 260px;
  border-left: 4px solid;
  animation: flashIn .28s cubic-bezier(0.4,0,0.2,1);
}

@keyframes flashIn {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes flashOut {
  to { opacity: 0; transform: translateX(28px); }
}

.flash-message.flash-success { border-left-color: var(--success); }
.flash-message.flash-error   { border-left-color: var(--danger); }
.flash-message.flash-warning { border-left-color: var(--warning); }

.flash-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.flash-success .flash-icon { color: var(--success); }
.flash-error   .flash-icon { color: var(--danger); }
.flash-warning .flash-icon { color: var(--warning); }

.flash-text { font-size: 13px; color: var(--text-heading); flex: 1; line-height: 1.45; font-weight: 500; }
.flash-sub  { font-size: 12px; color: var(--text-muted); font-weight: 400; }

.flash-close {
  background: none; border: none;
  cursor: pointer; color: var(--text-muted);
  font-size: 14px; padding: 0; line-height: 1;
  flex-shrink: 0;
}

.flash-close:hover { color: var(--text-heading); }
.flash-dismiss { animation: flashOut .25s ease forwards; }

/* ═══ FILTER BAR ══════════════════════════════════════════════════════ */

.filter-bar {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
  margin-bottom: 20px;
}

/* ═══ AVATAR CIRCLE ════════════════════════════════════════════════════ */

.avatar-circle {
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 80px; height: 80px; font-size: 28px; }

/* ═══ ATTENDANCE ═══════════════════════════════════════════════════════ */

.att-quick-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.att-counter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-body);
  margin-left: auto;
}

.att-counter-chip .att-marked { color: var(--brand); }

.attendance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.attendance-student-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  border-left: 4px solid transparent;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.attendance-student-card:hover { box-shadow: var(--shadow-md); }

.attendance-student-card:has(.btn-check[value="present"]:checked) {
  border-left-color: var(--success);
  background: var(--success-light);
}

.attendance-student-card:has(.btn-check[value="absent"]:checked) {
  border-left-color: var(--danger);
  background: var(--danger-light);
}

.attendance-student-card:has(.btn-check[value="late"]:checked) {
  border-left-color: var(--warning);
  background: var(--warning-light);
}

.attendance-student-card:has(.btn-check[value="leave"]:checked) {
  border-left-color: #CBD5E1;
  background: #F8FAFC;
}

.att-student-name {
  font-size: 12.5px; font-weight: 600;
  color: var(--text-heading);
  text-align: center;
  line-height: 1.3;
}

.att-roll { font-size: 11px; color: var(--text-muted); }

.att-controls {
  display: flex;
  width: 100%;
  gap: 3px;
}

.att-btn {
  flex: 1;
  padding: 5px 2px;
  border-radius: 5px;
  border: 1.5px solid;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background var(--transition), color var(--transition);
  line-height: 1.4;
}

.att-p  { border-color: #6EE7B7; color: var(--success); }
.att-a  { border-color: #FCA5A5; color: var(--danger); }
.att-l  { border-color: #FDE68A; color: var(--warning); }
.att-lv { border-color: #CBD5E1; color: #64748B; }

.btn-check:checked + .att-p  { background: var(--success); color: #fff; border-color: var(--success); }
.btn-check:checked + .att-a  { background: var(--danger);  color: #fff; border-color: var(--danger);  }
.btn-check:checked + .att-l  { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-check:checked + .att-lv { background: #94A3B8;        color: #fff; border-color: #94A3B8;        }

.btn-check { position: absolute; clip: rect(0,0,0,0); pointer-events: none; }

/* Pulsing save button */
@keyframes pulseGlow {
  0%   { box-shadow: var(--shadow-brand); }
  50%  { box-shadow: 0 4px 28px rgba(46,84,150,0.45); }
  100% { box-shadow: var(--shadow-brand); }
}

.btn-save-pulse {
  animation: pulseGlow 2.5s ease infinite;
}

/* ═══ LOGIN PAGE ════════════════════════════════════════════════════════ */

.login-page {
  min-height: 100vh;
  display: flex;
}

.login-branding {
  width: 42%;
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.login-branding::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}

.login-branding::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -60px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}

.login-branding-icon {
  font-size: 72px;
  margin-bottom: 24px;
  opacity: .9;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.login-branding h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 12px;
  text-align: center;
  line-height: 1.3;
  position: relative;
  z-index: 1;
}

.login-branding p {
  font-size: 14px;
  opacity: .72;
  text-align: center;
  max-width: 260px;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

.login-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: #fff;
}

.login-form-inner {
  width: 100%;
  max-width: 380px;
}

.login-form-inner h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 6px;
}

.login-subtitle { font-size: 13.5px; color: var(--text-muted); margin-bottom: 28px; }

.login-error {
  background: var(--danger-light);
  border: 1px solid #FECACA;
  border-left: 4px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #DC2626;
  margin-bottom: 18px;
}

.login-form-label {
  font-size: 12.5px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
  display: block;
}

.login-hint { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 20px; }

/* ═══ RECEIPT / PRINT ════════════════════════════════════════════════ */

.receipt-card {
  max-width: 680px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.receipt-header {
  padding: 28px 32px;
  text-align: center;
  border-bottom: 2px solid var(--border);
}

.receipt-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  overflow: hidden;
}

.receipt-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  background: #fff;
}

.receipt-school-name { font-size: 20px; font-weight: 700; color: var(--text-heading); }
.receipt-doc-type { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.receipt-amount-box {
  padding: 24px;
  text-align: center;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border);
}

.receipt-amount-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.receipt-amount-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -.03em;
}

.receipt-paid-full {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--success-light);
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  margin-top: 10px;
}

/* ═══ INFO ROWS ════════════════════════════════════════════════════════ */

.info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.info-item {
  flex: 1;
  min-width: 140px;
  padding: 14px 16px;
  border-right: 1px solid var(--border);
}

.info-item:last-child { border-right: none; }

.info-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.info-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-heading);
}

/* ═══ INVOICE BANNER ════════════════════════════════════════════════════ */

.invoice-banner {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--warning);
  overflow: hidden;
  margin-bottom: 22px;
}

/* ═══ MODAL ENHANCEMENTS ════════════════════════════════════════════════ */

.modal-header {
  border-top: 4px solid var(--brand);
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  border-radius: 0 !important;
}

.modal-header .modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-header .btn-close {
  opacity: .5;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  background: #F8FAFC;
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  gap: 8px;
}

.modal-dialog:not(.modal-sm) {
  width: min(60vw, 980px);
  max-width: calc(100vw - 32px) !important;
}

.modal-dialog.modal-sm {
  max-width: min(420px, calc(100vw - 32px));
}

.modal-content {
  border: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

@media (max-width: 1199.98px) {
  .modal-dialog:not(.modal-sm) {
    width: min(72vw, calc(100vw - 32px));
  }
}

@media (max-width: 767.98px) {
  .modal-dialog,
  .modal-dialog:not(.modal-sm),
  .modal-dialog.modal-sm {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px) !important;
    margin-left: auto;
    margin-right: auto;
  }

  .modal-body {
    padding: 18px 16px;
  }

  .modal-footer {
    padding: 14px 16px;
  }
}

/* Academic-module modal overrides (acad-modal) */
.acad-modal { border-radius: 18px !important; }
.acad-modal .modal-header {
  border-top: none !important;
  border-radius: 0 !important;
  border-bottom: 1px solid #EEF2F7;
  padding: 20px 24px 16px;
}

/* ═══ PORTAL ════════════════════════════════════════════════════════════ */

.portal-greeting {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 4px;
}

.portal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.portal-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  background: #fff;
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.portal-tab:hover { border-color: var(--brand); color: var(--brand); }

.portal-tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}

.portal-tab-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.portal-child-panel { display: none; }
.portal-child-panel.active { display: block; }

.portal-child-hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-brand);
}

.portal-child-hero-info { flex: 1; min-width: 0; }

.portal-child-hero-name {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}

.portal-child-hero-meta {
  font-size: 13px;
  opacity: .75;
}

.portal-mini-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  border-top: 3px solid;
  transition: var(--transition);
  text-decoration: none;
  display: block;
}

.portal-mini-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}

.portal-mini-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.portal-mini-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1;
  margin-bottom: 4px;
}

.portal-mini-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Legacy portal child card (fallback) */
.portal-child-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  border-top: 3px solid var(--brand);
  transition: var(--transition);
}

.portal-child-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.portal-child-name { font-size: 16px; font-weight: 600; color: var(--text-heading); margin-bottom: 4px; }
.portal-child-meta { font-size: 13px; color: var(--text-muted); }

/* ═══ DASHBOARD GREETING ════════════════════════════════════════════════ */

/* Legacy aliases */
.dashboard-greeting { font-size: 20px; font-weight: 600; color: var(--text-heading); margin-bottom: 4px; }
.dashboard-date { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

/* ═══ PAGINATION ══════════════════════════════════════════════════════════ */

.pagination { gap: 3px; margin: 14px 0 0; flex-wrap: wrap; }

.page-link {
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-body) !important;
  padding: 6px 12px !important;
  font-size: 13px !important;
  font-family: 'Inter', system-ui, sans-serif;
  transition: background var(--transition) !important;
}

.page-item.active .page-link {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
}

.page-link:hover { background: var(--bg-page) !important; }

/* ═══ MOBILE OVERLAY ══════════════════════════════════════════════════════ */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1039;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active { display: block; }

/* ═══ UTILITY ═════════════════════════════════════════════════════════════ */

.text-brand   { color: var(--brand) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted   { color: var(--text-muted) !important; }
.fw-500       { font-weight: 500; }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }

.d-flex-center {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.divider { border-top: 1px solid var(--border); margin: 16px 0; }

/* ═══ RESPONSIVE ══════════════════════════════════════════════════════════ */

@media (max-width: 1199.98px) {
  .sidebar { width: var(--sidebar-width); }
}

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.rail { transform: translateX(-100%); width: var(--sidebar-width); }
  .sidebar.rail.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .main-wrapper.rail { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .sidebar-rail-toggle { display: none; }
  .header-tenant-badge { display: none; }
  .content-area { padding: 16px; }
  .top-header { padding: 0 16px; }
  .sidebar.rail .sidebar-item::after { display: none; }
}

@media (max-width: 767.98px) {
  .attendance-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header-actions { width: 100%; }
  .info-item { min-width: 120px; }
  .greeting-card { padding: 20px; }
  .greeting-name { font-size: 20px; }
  .greeting-deco { display: none; }
  .portal-child-hero { flex-direction: column; align-items: flex-start; gap: 12px; }
}

@media (max-width: 575.98px) {
  .login-branding { display: none; }
  .login-form-panel { padding: 28px 20px; }
  .stat-card { padding: 14px 14px 0; }
  .stat-value { font-size: 24px; }
  .attendance-grid { grid-template-columns: 1fr 1fr; }
  .header-right .header-tenant-badge { display: none; }
  .att-quick-bar { gap: 6px; }
}

/* ── Sidebar sub-menu (Academics / any collapsible group) ─────────────── */
.sidebar-has-sub {
  display: flex;
  flex-direction: column;
}

.sidebar-sub-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  transition: var(--transition);
  text-align: left;
}

.sidebar-sub-toggle:hover {
  background: var(--sidebar-item-hover);
  color: #fff;
}

.sidebar-has-sub.is-open > .sidebar-sub-toggle {
  background: linear-gradient(90deg, rgba(78,120,200,0.30) 0%, rgba(78,120,200,0.10) 100%);
  color: #fff;
  border-left-color: rgba(122,174,255,0.6);
}

.sidebar-sub-chevron {
  font-size: 11px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.sidebar-has-sub.is-open > .sidebar-sub-toggle .sidebar-sub-chevron {
  transform: rotate(180deg);
}

.sidebar-sub-menu {
  padding-left: 28px;
  margin-top: 2px;
  overflow: hidden;
  animation: slideDown 0.18s ease forwards;
}

.sidebar-sub-menu.d-none {
  display: none !important;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; }
}

.sidebar-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin-bottom: 1px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  transition: var(--transition);
}

.sidebar-sub-item i { font-size: 13px; opacity: 0.75; flex-shrink: 0; }

.sidebar-sub-item:hover {
  background: var(--sidebar-item-hover);
  color: #fff;
}

.sidebar-sub-item.active {
  background: var(--sidebar-item-active-bg);
  color: #fff;
  font-weight: 500;
}

.sidebar-sub-item.active i { opacity: 1; }

/* Hide sub-menu text in rail mode */
.sidebar.rail .sidebar-sub-menu { display: none !important; }
.sidebar.rail .sidebar-sub-chevron { display: none; }

/* ═══ PRINT ═══════════════════════════════════════════════════════════════ */

@media print {
  .sidebar, .top-header, .no-print, .sidebar-overlay,
  .flash-container, .page-header-actions,
  #page-progress { display: none !important; }
  .main-wrapper, .main-wrapper.rail { margin-left: 0 !important; }
  .content-area { padding: 0 !important; background: #fff !important; }
  body { background: #fff !important; }
  .receipt-card { box-shadow: none !important; border: 1px solid #ddd !important; max-width: 100% !important; }
  .app-card, .table-card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ═══ TOM SELECT OVERRIDES ════════════════════════════════════════════════ */

.ts-wrapper.form-control,
.ts-wrapper.form-select { padding: 0; border: none; height: auto; background: none; }

.ts-wrapper .ts-control {
  min-height: 40px;
  height: auto;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0 12px !important;
  font-size: 13.5px !important;
  color: var(--text-body) !important;
  background: #fff !important;
  box-shadow: none !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.ts-wrapper.is-invalid .ts-control { border-color: var(--danger) !important; }

.ts-wrapper.focus .ts-control,
.ts-wrapper.focus .ts-control:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(46,84,150,.12) !important;
  outline: none !important;
}

.ts-wrapper .ts-dropdown {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-md) !important;
  font-size: 13.5px !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  margin-top: 2px !important;
  z-index: 9999 !important;
}

.ts-wrapper .ts-dropdown .option {
  padding: 8px 12px !important;
  color: var(--text-body) !important;
}

.ts-wrapper .ts-dropdown .option:hover,
.ts-wrapper .ts-dropdown .option.active {
  background: var(--brand-light) !important;
  color: var(--brand) !important;
}

.ts-wrapper .ts-dropdown .option.selected {
  background: var(--brand) !important;
  color: #fff !important;
}

.ts-wrapper .ts-control input {
  font-size: 13.5px !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  color: var(--text-body) !important;
}

/* Tom Select item (selected tag) */
.ts-wrapper .ts-control .item {
  background: var(--brand-light) !important;
  color: var(--brand) !important;
  border-radius: 4px !important;
  padding: 2px 8px !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  border: none !important;
}

.ts-wrapper.plugin-remove_button .item .remove {
  border-left: 1px solid rgba(46,84,150,.25) !important;
  color: var(--brand) !important;
}

/* ═══ FLATPICKR OVERRIDES ═════════════════════════════════════════════════ */

.flatpickr-input { cursor: pointer; }

.flatpickr-calendar {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  font-size: 13px !important;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
}

.flatpickr-day:hover { background: var(--brand-light) !important; }

.flatpickr-months .flatpickr-month {
  background: var(--brand) !important;
  color: #fff !important;
}

.flatpickr-current-month select,
.flatpickr-current-month input.cur-year {
  color: #fff !important;
  font-family: 'Inter', system-ui, sans-serif !important;
}

.flatpickr-monthDropdown-months { color: #fff !important; }
.flatpickr-weekdays { background: var(--brand-light) !important; }
.flatpickr-weekday { color: var(--brand) !important; font-weight: 600 !important; }
.flatpickr-prev-month svg, .flatpickr-next-month svg { fill: #fff !important; }
.flatpickr-prev-month:hover svg, .flatpickr-next-month:hover svg { fill: rgba(255,255,255,.7) !important; }

/* ═══ SWEETALERT2 OVERRIDES ═══════════════════════════════════════════════ */

.swal2-popup {
  border-radius: var(--radius-lg) !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  font-size: 14px !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 28px 28px 24px !important;
}

.swal2-title {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: var(--text-heading) !important;
  line-height: 1.3 !important;
}

.swal2-html-container {
  font-size: 13.5px !important;
  color: var(--text-body) !important;
  line-height: 1.55 !important;
}

.swal2-icon { margin: 0 auto 16px !important; }

.swal2-actions { gap: 8px !important; margin-top: 20px !important; }

.swal2-confirm {
  background: var(--danger) !important;
  border-radius: var(--radius-sm) !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  padding: 0 20px !important;
  height: 40px !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  box-shadow: none !important;
}

.swal2-cancel {
  background: #fff !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  padding: 0 18px !important;
  height: 40px !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  box-shadow: none !important;
}

.swal2-cancel:hover { background: var(--bg-page) !important; color: var(--text-heading) !important; }

/* ═══ PROFILE / SHOW PAGE ════════════════════════════════════════════════ */

.profile-hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow-brand);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.profile-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  pointer-events: none;
}

.profile-hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  pointer-events: none;
}

.profile-hero-avatar {
  width: 88px; height: 88px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  flex-shrink: 0;
  border: 3px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.2);
  position: relative;
  z-index: 1;
}

.profile-hero-info {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.profile-hero-name {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}

.profile-hero-sub {
  font-size: 13.5px;
  opacity: .75;
  margin-bottom: 10px;
}

.profile-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-hero-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  background: rgba(255,255,255,.15);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-weight: 500;
}

.profile-hero-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.btn-hero-edit {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 0 18px;
  height: 38px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  white-space: nowrap;
  font-family: 'Inter', system-ui, sans-serif;
  backdrop-filter: blur(4px);
}

.btn-hero-edit:hover { background: rgba(255,255,255,.30); color: #fff; text-decoration: none; }

.btn-hero-danger {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.4);
  color: #fff;
  padding: 0 18px;
  height: 38px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  white-space: nowrap;
  font-family: 'Inter', system-ui, sans-serif;
}

.btn-hero-danger:hover { background: rgba(239,68,68,.25); color: #fff; text-decoration: none; }

/* Profile stat chips */
.profile-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.profile-stat-chip {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
  flex: 1;
  min-width: 120px;
  text-align: center;
}

.profile-stat-chip-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1;
  margin-bottom: 4px;
}

.profile-stat-chip-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}

/* Detail section cards */
.detail-section {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

.detail-section-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FAFBFF;
}

.detail-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
  margin: 0;
  flex: 1;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0;
}

.detail-cell {
  padding: 14px 20px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.detail-cell:last-child { border-right: none; }

.detail-cell-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.detail-cell-value {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-heading);
  line-height: 1.4;
}

/* ═══ FORM SECTION STEPS INDICATOR ════════════════════════════════════════ */

.form-steps {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.form-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  white-space: nowrap;
  cursor: default;
  transition: var(--transition);
}

.form-step.active {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand);
}

.form-step-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.form-step.active .form-step-num {
  background: var(--brand);
  color: #fff;
}

/* ═══ BADGE ADDITIONS ════════════════════════════════════════════════════ */

.badge-info      { background: var(--info-light);    color: var(--info); }
.badge-warning   { background: var(--warning-light); color: var(--warning); }
.badge-secondary { background: #F1F5F9; color: #64748B; }
.badge-purple    { background: var(--purple-light);  color: var(--purple); }
.badge-on-leave  { background: var(--warning-light); color: var(--warning); }
.badge-resigned  { background: var(--purple-light);  color: var(--purple); }
.badge-terminated { background: var(--danger-light); color: var(--danger); }
.badge-retired   { background: var(--info-light);    color: var(--info); }
.badge-teaching  { background: var(--brand-light);   color: var(--brand); }
.badge-admin     { background: var(--info-light);    color: var(--info); }
.badge-accounts  { background: var(--success-light); color: var(--success); }

/* ═══ SECTION DIVIDER ════════════════════════════════════════════════════ */

.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 18px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ═══ FORM SECTION ICON HEADER ════════════════════════════════════════════ */

.form-section-header i {
  width: 20px; height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-light);
  color: var(--brand);
  border-radius: 4px;
  font-size: 11px;
  flex-shrink: 0;
}

/* ═══ INPUT WITH ICON ════════════════════════════════════════════════════ */

.input-icon-wrap {
  position: relative;
}

.input-icon-wrap .form-control {
  padding-left: 36px;
}

.input-icon-wrap .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}

/* ═══ TOGGLE SWITCH ══════════════════════════════════════════════════════ */

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0; height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #CBD5E1;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-switch input:checked + .toggle-slider { background: var(--brand); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

.toggle-label { font-size: 13.5px; color: var(--text-body); }
.toggle-sub   { font-size: 11.5px; color: var(--text-muted); }

/* ═══ INFO BANNER ════════════════════════════════════════════════════════ */

.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--info-light);
  border: 1px solid #BFDBFE;
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}

.info-banner i { color: var(--brand); font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.info-banner-text { font-size: 12.5px; color: #1E40AF; line-height: 1.5; }

/* ═══ RESPONSIVE ADDITIONS ════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
  .profile-hero { flex-direction: column; align-items: flex-start; gap: 16px; }
  .profile-hero-actions { flex-direction: row; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════════════════════════════════
   PREMIUM VISUAL POLISH — Enhancement Pass 2
   ══════════════════════════════════════════════════════════════════════ */

/* ── Page background ──────────────────────────────────────────────── */
body { background-color: #E8EDF5; }

/* ── Content area page-enter animation ───────────────────────────── */
/* NOTE: 'to' has no transform so fill-mode:both doesn't retain
   transform:translateY(0) — which would create a stacking context
   and trap position:fixed modals below the backdrop. */
.content-area { animation: pageIn .22s ease both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; }
}

/* ── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
  background: linear-gradient(180deg, #0D1526 0%, #131E33 100%);
  box-shadow: 4px 0 28px rgba(0,0,0,0.22);
}

.sidebar-logo-icon {
  background: linear-gradient(135deg, var(--brand) 0%, #4F7FD4 100%);
  box-shadow: 0 3px 14px rgba(46,84,150,0.55);
  width: 36px; height: 36px; border-radius: 10px;
}

.sidebar-item {
  margin: 1px 8px;
  border-radius: 8px;
  padding: 9px 10px;
  border-left: 3px solid transparent;
}

.sidebar-item.active {
  background: linear-gradient(90deg, rgba(78,120,200,0.40) 0%, rgba(78,120,200,0.14) 100%);
  border-left-color: #7AAEFF;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

.sidebar-item.active i { opacity: 1; color: #A8C7FF; }
.sidebar-item:hover { background: rgba(255,255,255,0.07); }

.sidebar-sub-item { border-radius: 6px; margin: 1px 0; }
.sidebar-sub-item.active { background: rgba(255,255,255,0.12); color: #fff; }

/* ── Top header glass ─────────────────────────────────────────────── */
.top-header {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.06), 0 2px 12px rgba(0,0,0,0.04);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

/* ── Page header divider ──────────────────────────────────────────── */
.page-header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}

/* ── Cards ────────────────────────────────────────────────────────── */
.app-card, .table-card {
  border: 1px solid rgba(226,232,240,0.9);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
}

.app-card-header, .table-card-header, .chart-card-header {
  background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFF 100%);
}

.form-card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(226,232,240,0.9);
  border-top: 3px solid var(--brand);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
}

/* ── Stat cards ────────────────────────────────────────────────────── */
.stat-card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(226,232,240,0.9);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
}
.stat-card:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.05);
  transform: translateY(-4px);
}

.stat-icon { width: 48px; height: 48px; font-size: 20px; border-radius: 12px; }

.stat-icon-blue   { background: linear-gradient(135deg,#EFF6FF,#BFDBFE); box-shadow:0 3px 10px rgba(59,130,246,.18); }
.stat-icon-green  { background: linear-gradient(135deg,#ECFDF5,#A7F3D0); box-shadow:0 3px 10px rgba(16,185,129,.18); }
.stat-icon-red    { background: linear-gradient(135deg,#FEF2F2,#FECACA); box-shadow:0 3px 10px rgba(239,68,68,.15); }
.stat-icon-yellow { background: linear-gradient(135deg,#FFFBEB,#FDE68A); box-shadow:0 3px 10px rgba(245,158,11,.18); }
.stat-icon-purple { background: linear-gradient(135deg,#F5F3FF,#DDD6FE); box-shadow:0 3px 10px rgba(139,92,246,.18); }
.stat-icon-brand  { background: linear-gradient(135deg,#EEF2FF,#C7D2FE); box-shadow:0 3px 10px rgba(46,84,150,.18); }
.stat-icon-indigo { background: linear-gradient(135deg,#EEF2FF,#C7D2FE); box-shadow:0 3px 10px rgba(46,84,150,.18); }

.stat-value { font-size: 34px; }

.stat-bar-fill { animation: barGrow .9s cubic-bezier(0.4,0,0.2,1) both 0.5s; }
@keyframes barGrow { from { width: 0 !important; } }

/* ── Greeting card ────────────────────────────────────────────────── */
.greeting-card {
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 55%, #050A1A) 100%);
}

/* ── Filter bar ───────────────────────────────────────────────────── */
.filter-bar {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ── Table enhancements ──────────────────────────────────────────── */
.app-table { font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
.app-table thead tr { background: linear-gradient(135deg,#F8FAFD 0%,#EEF3FF 100%); }
.app-table th { font-size: 11.5px; letter-spacing: .055em; }
.app-table tbody tr { transition: background .12s ease; }
.app-table tbody tr:hover td { background: #F6F9FE; }
.app-table tbody tr.is-selected td { background: #EAF1FD; }
.app-table tbody tr[data-href]:hover td {
  background: linear-gradient(90deg, var(--brand-light) 0%, #FAFBFF 100%);
}

/* Comfortable edge padding so data isn't flush to the card */
.app-table th:first-child,
.app-table td:first-child { padding-left: 20px; }
.app-table th:last-child,
.app-table td:last-child { padding-right: 20px; }

/* Uniform sortable-header affordance */
.app-table thead th a { color: inherit; }
.app-table thead th a:hover,
.app-table thead th a.is-active { color: var(--brand); }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn-brand {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(46,84,150,.28);
}
.btn-brand:hover {
  background: linear-gradient(135deg, var(--brand-dark) 0%, #0F1F3D 100%);
  box-shadow: 0 6px 24px rgba(46,84,150,.38);
}
.btn-outline:hover {
  background: var(--brand-light);
  color: var(--brand);
  border-color: rgba(46,84,150,.3);
}

/* ── Action buttons ──────────────────────────────────────────────── */
.btn-action { width: 34px; height: 34px; border-radius: 8px; font-size: 14.5px; }
.btn-action:hover { transform: scale(1.10); }

/* ── Form section header ─────────────────────────────────────────── */
.form-section-header {
  background: linear-gradient(90deg, var(--brand-light) 0%, transparent 100%);
  border-radius: var(--radius-sm);
  color: var(--brand);
  font-size: 12px;
  letter-spacing: .07em;
}

/* ── Profile hero ─────────────────────────────────────────────────── */
.profile-hero { border-radius: var(--radius-xl); }

/* ── Detail section header ─────────────────────────────────────────── */
.detail-section-header { background: linear-gradient(90deg, #F8FAFF 0%, #FAFBFF 100%); }

/* ── Status badge depth ────────────────────────────────────────────── */
.status-badge { box-shadow: inset 0 1px 2px rgba(0,0,0,.05); }

/* ── Sticky form footer ─────────────────────────────────────────────── */
.form-sticky-footer { background: linear-gradient(90deg, #FAFBFF 0%, #fff 100%); }

/* ── Input group icon background ────────────────────────────────────── */
.input-group-text { background: linear-gradient(135deg,#F9FAFB 0%,#F1F5F9 100%); }

/* ── Flash messages ─────────────────────────────────────────────────── */
.flash-message { border-radius: var(--radius-lg); }

/* ── Portal mini cards ──────────────────────────────────────────────── */
.portal-mini-card { border-radius: var(--radius-lg); }

/* ── Global header search bar ─────────────────────────────────────── */
.header-search {
  display: flex; align-items: center;
  background: var(--bg-page); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 0 12px 0 10px;
  height: 36px; gap: 8px; min-width: 220px; transition: var(--transition);
}
.header-search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(46,84,150,.10);
  background: #fff;
}
.header-search i { color: var(--text-muted); font-size: 13px; flex-shrink: 0; }
.header-search input {
  border: none; background: none; font-size: 13px;
  color: var(--text-body); font-family: 'Inter', system-ui, sans-serif;
  outline: none; width: 100%;
}
.header-search input::placeholder { color: var(--text-muted); }

/* ── Notification dot ─────────────────────────────────────────────── */
.header-notif-wrap { position: relative; display: inline-flex; }
.header-notif-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px;
  background: var(--danger); border-radius: 50%;
  border: 1.5px solid #fff;
  animation: notifPulse 2.5s ease infinite;
}
@keyframes notifPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  50%      { box-shadow: 0 0 0 4px rgba(239,68,68,.22); }
}

/* ── Login page premium redesign ─────────────────────────────────── */
.login-branding {
  width: 52%;
  background: linear-gradient(155deg, #0D1526 0%, #162544 55%, #0F1F3D 100%);
  position: relative; overflow: hidden;
}
.login-branding::before {
  content: '';
  position: absolute; top: -140px; right: -120px;
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(46,84,150,.30) 0%, transparent 70%);
  pointer-events: none;
}
.login-branding::after {
  content: '';
  position: absolute; bottom: -100px; left: -80px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(46,84,150,.18) 0%, transparent 70%);
  pointer-events: none;
}
.login-branding-icon {
  width: 64px; height: 64px; border-radius: 18px;
  background: linear-gradient(135deg, var(--brand) 0%, #4F7FD4 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff; margin-bottom: 24px;
  box-shadow: 0 8px 28px rgba(46,84,150,.45);
  position: relative; z-index: 1;
}
.login-branding h1 { font-size: 28px; line-height: 1.25; position: relative; z-index: 1; }
.login-branding p  { font-size: 14px; line-height: 1.65; opacity: .70; max-width: 280px; position: relative; z-index: 1; }
.login-features-list { margin-top: 28px; position: relative; z-index: 1; }

.login-feature {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; opacity: .82; margin-top: 14px;
  position: relative; z-index: 1;
}
.login-feature-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255,255,255,.12); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.15);
}

/* Demo box on login */
.login-demo-box {
  background: #F0F5FF;
  border: 1px solid #C7D2FE;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 16px;
}
.login-demo-title {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--brand); margin-bottom: 8px;
}
.login-demo-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; color: #374151; margin-bottom: 4px;
}
.login-demo-row:last-child { margin-bottom: 0; }
.login-demo-val {
  font-family: monospace; font-size: 12px; color: var(--brand);
  background: rgba(46,84,150,.09); padding: 2px 8px; border-radius: 4px;
  cursor: pointer;
}

/* ── Responsive enhancements ─────────────────────────────────────── */
@media (max-width: 991.98px) {
  .header-search { display: none; }
}
@media (max-width: 575.98px) {
  .login-branding { width: 100%; min-height: 180px; padding: 28px 24px; }
  .login-form-panel { flex: none; width: 100%; }
  .login-page { flex-direction: column; }
}

/* ═══ TOP HEADER IMPROVEMENTS ════════════════════════════════════════ */

/* Title + tenant chip side by side */
.header-title-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.header-tenant-chip {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  white-space: nowrap;
  display: none; /* shown at ≥ md via media query below */
}

@media (min-width: 768px) {
  .header-tenant-chip { display: inline-flex; }
}

/* Search kbd shortcut badge */
.header-search-kbd {
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: 'Inter', system-ui, sans-serif;
  background: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: .7;
  pointer-events: none;
}

/* ── Header user button (dropdown trigger) ───────────────────────── */
.header-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 10px 4px 4px;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.header-user-btn:hover,
.header-user-btn:focus-visible {
  background: var(--border);
  border-color: #CBD5E1;
  outline: none;
}

/* Remove Bootstrap's auto-generated caret */
.header-user-btn.dropdown-toggle::after { display: none; }

/* The inner avatar circle inside the button keeps the existing .header-user-avatar class */
.header-user-btn .header-user-avatar {
  width: 30px; height: 30px;
  font-size: 11px;
  cursor: inherit;
}

.header-user-meta {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.header-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.header-user-role {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: capitalize;
  line-height: 1.2;
}

.header-chevron {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.header-user-btn[aria-expanded="true"] .header-chevron {
  transform: rotate(180deg);
}

/* Hide name/role/chevron on small screens — just show the avatar pill */
@media (max-width: 767.98px) {
  .header-user-meta,
  .header-chevron { display: none; }
  .header-user-btn { padding: 4px; }
}

/* ── Header dropdown menu ─────────────────────────────────────────── */
.header-dropdown-menu {
  min-width: 240px;
  padding: 6px !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06) !important;
  margin-top: 8px !important;
}

.header-dd-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 10px 12px;
}

.header-dd-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(46,84,150,.28);
}

.header-dd-info { min-width: 0; flex: 1; }

.header-dd-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-dd-email {
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 170px;
}

.header-dd-item {
  display: flex !important;
  align-items: center;
  gap: 9px;
  padding: 8px 10px !important;
  font-size: 13.5px !important;
  font-weight: 450;
  color: var(--text-body) !important;
  border-radius: 6px;
  transition: background 0.15s !important;
}

.header-dd-item:hover {
  background: var(--bg-page) !important;
  color: var(--text-heading) !important;
}

.header-dd-item i {
  font-size: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.header-dd-item:hover i { color: var(--brand); }

.header-dd-logout,
.header-dd-logout:hover { color: var(--danger) !important; }
.header-dd-logout:hover { background: var(--danger-light) !important; }
.header-dd-logout i,
.header-dd-logout:hover i { color: var(--danger) !important; }

/* Remove the old legacy tenant badge (now replaced by header-tenant-chip) */
.header-tenant-badge { display: none; }

/* ═══ HEADER BACK BUTTON ═════════════════════════════════════════════ */

.header-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 15px;
  flex-shrink: 0;
  transition: var(--transition);
  text-decoration: none;
}

.header-back-btn:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  text-decoration: none;
  transform: translateX(-2px);
}

/* Thin divider line between back button and page title */
.header-back-btn + .header-title-group {
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid var(--border);
}

/* ═══ STEPPER SUBTITLE ════════════════════════════════════════════════ */

.stepper-sub {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
  opacity: 0;
  transition: opacity 0.18s;
}

/* Show subtitle only on active/completed steps to reduce noise */
.stepper-step.active .stepper-sub,
.stepper-step.completed .stepper-sub { opacity: 1; }

/* On small screens hide the subtitle entirely */
@media (max-width: 991.98px) {
  .stepper-sub { display: none; }
}

/* ═══ STEPPER & FORM PANEL ENHANCEMENTS ══════════════════════════════ */

/* Stepper card — stronger visual treatment */
.stepper-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  border: 1px solid var(--border);
  border-top: 3px solid var(--brand);
  position: sticky;
  top: var(--header-height);
  z-index: 20;
}

/* Step pane card — lifted card feel */
.step-pane {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
  padding: 0;
  margin-top: 18px;
  overflow: hidden;
}

/* Pane section — cleaner internal separator */
.pane-section {
  padding: 22px 28px;
  border-bottom: 1px solid #F1F5F9;
}

.pane-section:last-of-type { border-bottom: none; }

/* Section header pill treatment */
.pane-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--brand);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.pane-section-header i { font-size: 14px; }

.section-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--brand-light);
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* Step nav bar — stronger separator & shadow */
.step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: #FAFBFF;
  border-top: 1px solid var(--border);
}

/* Info banner inside form panes */
.info-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--info-light);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12.5px;
  color: #1D4ED8;
  margin-bottom: 16px;
}

.info-banner i { flex-shrink: 0; font-size: 14px; }

/* Sidebar visual refresh */
.sidebar {
  background:
    linear-gradient(180deg, #101A2E 0%, #0C1424 52%, #09111F 100%);
  border-right: 1px solid rgba(255,255,255,.08);
}

.sidebar-header {
  min-height: 72px;
  padding: 18px 14px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,0));
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 66%, #38BDF8));
  box-shadow: 0 12px 28px rgba(46,84,150,.34), inset 0 1px 0 rgba(255,255,255,.24);
}

.sidebar-logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
  border-radius: inherit;
  background: #fff;
}

.sidebar-school-name {
  font-size: 14.5px;
  font-weight: 800;
}

.sidebar-rail-toggle {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255,255,255,.075);
  border: 1px solid rgba(255,255,255,.08);
}

.sidebar-nav {
  padding: 10px 10px 14px;
}

.sidebar-group-toggle {
  padding: 16px 8px 7px;
}

.sidebar-section-label {
  color: #71809A;
  font-size: 10.5px;
  letter-spacing: .12em;
}

.sidebar-group-chevron {
  color: #71809A;
}

.sidebar-item {
  min-height: 44px;
  gap: 12px;
  margin: 3px 0;
  padding: 6px 10px;
  border-left: 0;
  border-radius: 12px;
  color: #B7C4D8;
  font-size: 13.2px;
  font-weight: 650;
}

.sidebar-item:hover {
  background: rgba(255,255,255,.075);
  color: #F8FAFC;
  opacity: 1;
}

.sidebar-item.active {
  background: linear-gradient(90deg, rgba(255,255,255,.14), rgba(255,255,255,.07));
  color: #FFFFFF;
  border-left: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 10px 26px rgba(0,0,0,.14);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 999px;
  background: var(--nav-icon-color, var(--brand));
  box-shadow: 0 0 14px var(--nav-icon-color, var(--brand));
}

.sidebar-item > i:first-child {
  --nav-icon-color: #38BDF8;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--nav-icon-color);
  background: color-mix(in srgb, var(--nav-icon-color) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nav-icon-color) 22%, transparent);
  font-size: 15.5px;
  opacity: 1;
}

.sidebar-item:hover > i:first-child,
.sidebar-item.active > i:first-child {
  color: #fff;
  background: linear-gradient(135deg, var(--nav-icon-color), color-mix(in srgb, var(--nav-icon-color) 70%, #fff));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--nav-icon-color) 32%, transparent);
}

.sidebar-item > .bi-grid-1x2-fill { --nav-icon-color: #38BDF8; }
.sidebar-item > .bi-house-heart-fill { --nav-icon-color: #F472B6; }
.sidebar-item > .bi-people-fill { --nav-icon-color: #22C55E; }
.sidebar-item > .bi-person-hearts { --nav-icon-color: #EC4899; }
.sidebar-item > .bi-briefcase-fill { --nav-icon-color: #F59E0B; }
.sidebar-item > .bi-calendar-check-fill { --nav-icon-color: #14B8A6; }
.sidebar-item > .bi-clock-fill { --nav-icon-color: #8B5CF6; }
.sidebar-item > .bi-clipboard-check-fill { --nav-icon-color: #6366F1; }
.sidebar-item > .bi-receipt { --nav-icon-color: #06B6D4; }
.sidebar-item > .bi-tags-fill { --nav-icon-color: #F97316; }
.sidebar-item > .bi-list-ul { --nav-icon-color: #A855F7; }
.sidebar-item > .bi-bar-chart-fill,
.sidebar-item > .bi-bar-chart { --nav-icon-color: #10B981; }
.sidebar-item > .bi-gear { --nav-icon-color: #60A5FA; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.025);
}

.sidebar-user {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.065);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #22C55E, #38BDF8);
  box-shadow: 0 10px 22px rgba(34,197,94,.20);
}

.sidebar-user-name {
  font-weight: 800;
}

.sidebar-user-gear {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.08);
}

.sidebar.rail .sidebar-header {
  padding: 16px 0;
}

.sidebar.rail .sidebar-nav {
  padding-left: 8px;
  padding-right: 8px;
}

.sidebar.rail .sidebar-item {
  justify-content: center;
  padding: 6px 0;
}

.sidebar.rail .sidebar-item > i:first-child {
  width: 38px;
  height: 38px;
}

.sidebar.sidebar-light {
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  border-right: 1px solid #DCE5F0;
}

.sidebar-light .sidebar-header {
  background: linear-gradient(180deg, #FFFFFF, #F8FAFC);
}

.sidebar-light .sidebar-section-label,
.sidebar-light .sidebar-group-chevron {
  color: #8A98AD;
}

.sidebar-light .sidebar-item {
  color: #526175;
}

.sidebar-light .sidebar-item:hover {
  background: #EEF4FB;
  color: #10213D;
}

.sidebar-light .sidebar-item.active {
  background: #FFFFFF;
  color: #10213D;
  box-shadow: 0 8px 22px rgba(15,23,42,.08), inset 0 0 0 1px #DCE5F0;
}

.sidebar-light .sidebar-item > i:first-child {
  background: color-mix(in srgb, var(--nav-icon-color) 13%, #fff);
}

.sidebar-light .sidebar-item:hover > i:first-child,
.sidebar-light .sidebar-item.active > i:first-child {
  color: #fff;
}

.sidebar-light .sidebar-user {
  background: #FFFFFF;
  box-shadow: inset 0 0 0 1px #DCE5F0, 0 8px 20px rgba(15,23,42,.06);
}

/* Sidebar icon palette - final override */
.sidebar .sidebar-item { --nav-icon-color: #38BDF8; }
.sidebar .sidebar-item[href="/dashboard"] { --nav-icon-color: #38BDF8; }
.sidebar .sidebar-item[href*="/portal"] { --nav-icon-color: #F472B6; }
.sidebar .sidebar-item[href*="/students"] { --nav-icon-color: #22C55E; }
.sidebar .sidebar-item[href*="/guardians"] { --nav-icon-color: #EC4899; }
.sidebar .sidebar-item[href*="/staff"] { --nav-icon-color: #F59E0B; }
.sidebar .sidebar-item[href*="/attendance"] { --nav-icon-color: #14B8A6; }
.sidebar .sidebar-item[href*="timetable"] { --nav-icon-color: #8B5CF6; }
.sidebar .sidebar-item[href*="/exams"] { --nav-icon-color: #6366F1; }
.sidebar .sidebar-item[href*="/fees/invoices"] { --nav-icon-color: #06B6D4; }
.sidebar .sidebar-item[href*="/fees/heads"] { --nav-icon-color: #F97316; }
.sidebar .sidebar-item[href*="/fees/structures"] { --nav-icon-color: #A855F7; }
.sidebar .sidebar-item[href*="/fees/reports"],
.sidebar .sidebar-item[href*="/reports"] { --nav-icon-color: #10B981; }
.sidebar .sidebar-item[href*="/settings"] { --nav-icon-color: #60A5FA; }

.sidebar .sidebar-item[href="/dashboard"] > i:first-child { --nav-icon-color: #38BDF8; }
.sidebar .sidebar-item[href*="/portal"] > i:first-child { --nav-icon-color: #F472B6; }
.sidebar .sidebar-item[href*="/students"] > i:first-child { --nav-icon-color: #22C55E; }
.sidebar .sidebar-item[href*="/guardians"] > i:first-child { --nav-icon-color: #EC4899; }
.sidebar .sidebar-item[href*="/staff"] > i:first-child { --nav-icon-color: #F59E0B; }
.sidebar .sidebar-item[href*="/attendance"] > i:first-child { --nav-icon-color: #14B8A6; }
.sidebar .sidebar-item[href*="timetable"] > i:first-child { --nav-icon-color: #8B5CF6; }
.sidebar .sidebar-item[href*="/exams"] > i:first-child { --nav-icon-color: #6366F1; }
.sidebar .sidebar-item[href*="/fees/invoices"] > i:first-child { --nav-icon-color: #06B6D4; }
.sidebar .sidebar-item[href*="/fees/heads"] > i:first-child { --nav-icon-color: #F97316; }
.sidebar .sidebar-item[href*="/fees/structures"] > i:first-child { --nav-icon-color: #A855F7; }
.sidebar .sidebar-item[href*="/fees/reports"] > i:first-child,
.sidebar .sidebar-item[href*="/reports"] > i:first-child { --nav-icon-color: #10B981; }
.sidebar .sidebar-item[href*="/settings"] > i:first-child { --nav-icon-color: #60A5FA; }

.sidebar .sidebar-item > i:first-child {
  color: var(--nav-icon-color) !important;
  background: color-mix(in srgb, var(--nav-icon-color) 18%, transparent) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nav-icon-color) 28%, transparent) !important;
}

.sidebar .sidebar-item:hover > i:first-child,
.sidebar .sidebar-item.active > i:first-child {
  color: #fff !important;
  background: linear-gradient(135deg, var(--nav-icon-color), color-mix(in srgb, var(--nav-icon-color) 68%, #fff)) !important;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--nav-icon-color) 34%, transparent) !important;
}

.sidebar .sidebar-item.active::before {
  background: var(--nav-icon-color) !important;
  box-shadow: 0 0 14px var(--nav-icon-color) !important;
}

/* Mobile app experience
   Shared responsive layer for the tenant web app. It keeps desktop intact while
   turning the mobile viewport into a tabbed, card-based application shell. */
.mobile-bottom-nav {
  display: none;
}

.mobile-filter-trigger,
.mobile-filter-backdrop,
.mobile-filter-drawer-head {
  display: none;
}

@media (max-width: 767.98px) {
  :root {
    --header-height: 58px;
    --mobile-bottom-nav-height: 74px;
  }

  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    background:
      linear-gradient(180deg, #F7FAFD 0%, #EEF4F8 42%, #F8FAFC 100%);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .main-wrapper,
  .main-wrapper.rail {
    margin-left: 0;
    min-height: 100dvh;
  }

  .top-header {
    height: var(--header-height);
    padding: 0 max(14px, env(safe-area-inset-left)) 0 max(14px, env(safe-area-inset-right));
    border-bottom: 1px solid rgba(226,232,240,.9);
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(18px);
    box-shadow: 0 8px 24px rgba(15,23,42,.06);
  }

  .header-left {
    gap: 8px;
    min-width: 0;
    flex: 1;
  }

  .header-right {
    gap: 6px;
  }

  .header-page-title {
    font-size: 15px;
    font-weight: 800;
    max-width: 46vw;
  }

  .sidebar-toggle,
  .header-icon-btn,
  .header-user-btn .header-user-avatar,
  .header-back-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .sidebar-toggle {
    display: inline-flex;
    background: #F3F7FB;
    border: 1px solid #E1EAF3;
    color: #334155;
    font-size: 20px;
  }

  .header-back-btn {
    background: #F3F7FB;
  }

  .header-back-btn + .header-title-group {
    padding-left: 0;
    margin-left: 0;
    border-left: 0;
  }

  .header-notif-wrap {
    display: none;
  }

  .content-area {
    padding: 14px 14px calc(var(--mobile-bottom-nav-height) + 22px + env(safe-area-inset-bottom));
  }

  body.mobile-filter-open {
    overflow: hidden;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 1035;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    min-height: 64px;
    padding: 7px;
    border: 1px solid rgba(203,213,225,.86);
    border-radius: 22px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 16px 38px rgba(15,23,42,.18), inset 0 1px 0 rgba(255,255,255,.85);
    backdrop-filter: blur(20px);
  }

  .mobile-bottom-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 50px;
    padding: 5px 2px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: #64748B;
    text-decoration: none;
    font: inherit;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.05;
    cursor: pointer;
  }

  .mobile-bottom-item i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 18px;
    line-height: 1;
  }

  .mobile-bottom-item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-bottom-item.active {
    color: var(--brand);
    background: var(--brand-light);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 14%, transparent);
  }

  .sidebar {
    width: min(88vw, 340px);
    max-width: 340px;
    transform: translateX(calc(-100% - 20px));
    border-radius: 0 28px 28px 0;
    box-shadow: 18px 0 50px rgba(15,23,42,.28);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar.rail {
    width: min(88vw, 340px);
  }

  .sidebar.rail .nav-label,
  .sidebar.rail .sidebar-school-name,
  .sidebar.rail .sidebar-user-info {
    display: block;
    opacity: 1;
    width: auto;
    pointer-events: auto;
  }

  .sidebar.rail .sidebar-group-chevron,
  .sidebar.rail .sidebar-section-label,
  .sidebar.rail .sidebar-user-gear {
    display: inline-flex;
  }

  /* Mobile turns the rail into a full drawer, so restore the group headers. */
  .sidebar.rail .sidebar-group-toggle {
    display: flex;
  }

  .sidebar.rail .sidebar-header,
  .sidebar.rail .sidebar-item,
  .sidebar.rail .sidebar-user {
    justify-content: flex-start;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1038;
    display: block;
    pointer-events: none;
    background: rgba(15,23,42,.42);
    opacity: 0;
    backdrop-filter: blur(4px);
    transition: opacity .2s ease;
  }

  .sidebar-overlay.active {
    pointer-events: auto;
    opacity: 1;
  }

  .page-header {
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }

  .page-title {
    font-size: 20px;
    line-height: 1.15;
  }

  .page-subtitle {
    font-size: 12.5px;
  }

  .page-header,
  .page-header-actions,
  .table-card-header,
  .table-card-head,
  .app-card-header,
  .chart-card-header {
    flex-direction: column;
  }

  .page-header-actions,
  .table-card-header,
  .table-card-head,
  .app-card-header,
  .chart-card-header {
    align-items: stretch;
  }

  .app-card,
  .table-card,
  .form-card,
  .stat-card,
  .filter-bar,
  .step-pane,
  .stepper-card,
  .staff-filter-panel,
  .students-filter-panel,
  .settings-card,
  .report-filter-panel {
    border-radius: 18px !important;
    border-color: #DCE6F0 !important;
    box-shadow: 0 10px 28px rgba(15,23,42,.07) !important;
  }

  .form-card,
  .step-pane,
  .stepper-card {
    width: 100% !important;
    max-width: none !important;
    border-radius: 16px !important;
  }

  .form-card + .form-card,
  .step-pane + .step-pane,
  .app-card + .form-card,
  .form-card + .app-card {
    margin-top: 12px !important;
  }

  .form-section,
  .pane-section {
    padding: 16px 0 !important;
    border-bottom: 1px solid #E8EEF5 !important;
  }

  .form-section:first-child,
  .pane-section:first-child {
    padding-top: 0 !important;
  }

  .form-section:last-child,
  .pane-section:last-child {
    padding-bottom: 0 !important;
    border-bottom: 0 !important;
  }

  .pane-section.ps-collapsed,
  .pane-section.ps-collapsed .pane-section-body {
    display: block !important;
    visibility: visible !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .form-section-title,
  .pane-section-header {
    margin-bottom: 12px !important;
    padding-bottom: 0 !important;
    border-bottom: 0 !important;
    font-size: 12px !important;
    letter-spacing: .06em !important;
  }

  .form-card .row,
  .step-pane .row,
  .settings-card .row,
  .modal-body .row {
    --bs-gutter-x: 0;
    --bs-gutter-y: 12px;
  }

  .form-card .row > [class*="col"],
  .form-card .row > [class*="col-"],
  .step-pane .row > [class*="col"],
  .step-pane .row > [class*="col-"],
  .settings-card .row > [class*="col"],
  .settings-card .row > [class*="col-"],
  .modal-body .row > [class*="col"],
  .modal-body .row > [class*="col-"] {
    width: 100%;
    flex: 0 0 100%;
  }

  .app-card-header,
  .table-card-header,
  .table-card-head,
  .chart-card-header {
    gap: 10px;
    padding: 14px 15px;
  }

  .app-card-body,
  .form-card-body,
  .pane-section {
    padding: 15px;
  }

  .greeting-card {
    min-height: 154px;
    padding: 20px;
    border-radius: 24px;
    overflow: hidden;
  }

  .greeting-name {
    font-size: 21px;
    line-height: 1.15;
  }

  .greeting-school,
  .greeting-date {
    font-size: 12.5px;
  }

  .greeting-deco {
    right: -46px;
    bottom: -36px;
    opacity: .16;
    transform: scale(.84);
  }

  .row {
    --bs-gutter-x: .75rem;
    --bs-gutter-y: .75rem;
  }

  .stat-card {
    min-height: 108px;
    padding: 15px;
  }

  .stat-card-inner {
    align-items: flex-start;
  }

  .stat-value {
    font-size: 22px;
  }

  .stat-label {
    font-size: 12px;
  }

  .quick-action-tile {
    min-height: 122px;
    border-radius: 18px;
  }

  .chart-container,
  .chart-container-sm {
    min-height: 220px;
  }

  .filter-bar,
  .students-filter-panel,
  .staff-filter-panel,
  .report-filter-panel {
    padding: 14px;
  }

  .mobile-filter-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 46px;
    margin: 0 0 12px;
    border: 1px solid #D7E0EA;
    border-radius: 15px;
    background: #fff;
    color: var(--text-heading);
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 8px 20px rgba(15,23,42,.06);
  }

  .mobile-filter-trigger i {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--brand-light);
    color: var(--brand);
    font-size: 15px;
  }

  .mobile-filter-trigger.is-active {
    border-color: color-mix(in srgb, var(--brand) 34%, #D7E0EA);
    color: var(--brand);
  }

  .mobile-filter-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(15,23,42,.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }

  .mobile-filter-backdrop.is-active {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-filter-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1055;
    display: block;
    width: min(88vw, 370px);
    max-width: 370px;
    margin: 0 !important;
    padding: 0 16px calc(18px + env(safe-area-inset-bottom)) !important;
    border: 0 !important;
    border-radius: 24px 0 0 24px !important;
    background: #F8FAFC !important;
    box-shadow: -18px 0 48px rgba(15,23,42,.24) !important;
    overflow-y: auto;
    transform: translateX(108%);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
  }

  .mobile-filter-panel.is-open {
    transform: translateX(0);
  }

  .mobile-filter-drawer-head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 -16px 14px;
    padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
    border-bottom: 1px solid #E2EAF3;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(18px);
  }

  .mobile-filter-title {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
  }

  .mobile-filter-title > span {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 13px;
    background: var(--brand-light);
    color: var(--brand);
  }

  .mobile-filter-title strong,
  .mobile-filter-title small {
    display: block;
  }

  .mobile-filter-title strong {
    color: var(--text-heading);
    font-size: 15px;
    font-weight: 950;
    line-height: 1.15;
  }

  .mobile-filter-title small {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 750;
  }

  .mobile-filter-close {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid #D7E0EA;
    border-radius: 13px;
    background: #fff;
    color: #64748B;
  }

  .mobile-filter-close:hover {
    color: var(--danger);
    background: var(--danger-light);
  }

  .mobile-filter-panel > .students-filter-head,
  .mobile-filter-panel > .staff-filter-head,
  .mobile-filter-panel > .report-filter-head {
    display: none !important;
  }

  .mobile-filter-panel .row {
    margin-left: 0;
    margin-right: 0;
  }

  .mobile-filter-panel .row > * {
    padding-left: 0;
    padding-right: 0;
  }

  .mobile-filter-panel .filter-actions,
  .mobile-filter-panel .col-auto,
  .mobile-filter-panel button[type="submit"],
  .mobile-filter-panel .btn-brand,
  .mobile-filter-panel .btn-outline {
    width: 100%;
  }

  .filter-bar .row > [class*="col"],
  .filter-bar .row > [class*="col-"] {
    width: 100%;
    flex: 0 0 100%;
  }

  .form-control,
  .form-select,
  .input-group-text,
  .ts-control {
    min-height: 46px;
    border-radius: 12px !important;
    font-size: 16px;
  }

  .form-check-input {
    width: 20px;
    height: 20px;
    min-height: 20px;
    border-radius: 6px !important;
  }

  .form-check-input[type="radio"] {
    border-radius: 50% !important;
  }

  textarea.form-control {
    min-height: 112px;
  }

  .form-label,
  .settings-label,
  .filter-field label,
  .saas-label {
    margin-bottom: 6px;
    color: #526175;
    font-size: 12px;
    font-weight: 800;
  }

  .invalid-feedback,
  .form-text {
    font-size: 12px;
  }

  .btn-brand,
  .btn-outline,
  .btn-danger,
  .btn-secondary,
  .btn-primary,
  button[type="submit"] {
    min-height: 44px;
    border-radius: 13px;
    justify-content: center;
    gap: 7px;
    touch-action: manipulation;
  }

  .btn-action,
  .btn-action-view,
  .btn-action-edit,
  .btn-action-delete,
  .btn-action-pay,
  .btn-action-print {
    width: 40px !important;
    height: 40px !important;
    border-radius: 13px !important;
  }

  .modal-dialog {
    margin: 10px;
  }

  .modal-content {
    border-radius: 22px;
    overflow: hidden;
  }

  .modal-header,
  .modal-footer {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 16px;
  }

  .dataTables_wrapper {
    overflow: visible;
  }

  .dataTables_wrapper .dt-header,
  .dataTables_wrapper .dt-bottom {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid #EEF2F7;
    background: #FBFDFF;
  }

  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    width: 100%;
    text-align: left;
  }

  .dataTables_wrapper .dataTables_filter label,
  .dataTables_wrapper .dataTables_length label {
    display: grid;
    gap: 6px;
    width: 100%;
    margin: 0;
    color: #64748B;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    margin-left: 0 !important;
    min-height: 44px;
    border-radius: 13px;
    border: 1px solid #D7E0EA;
    background: #fff;
    font-size: 15px;
  }

  .dataTables_wrapper .dataTables_length select {
    width: 100%;
    min-height: 44px;
    margin-left: 0;
    border-radius: 13px;
    border: 1px solid #D7E0EA;
    background-color: #fff;
    font-size: 15px;
  }

  .dataTables_wrapper .dataTables_paginate {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  .dataTables_wrapper .dataTables_paginate .paginate_button {
    min-width: 38px;
    min-height: 38px;
    border-radius: 12px !important;
  }

  .table-responsive {
    overflow: visible;
  }

  .app-table.mobile-card-table,
  .app-table.mobile-card-table thead,
  .app-table.mobile-card-table tbody,
  .app-table.mobile-card-table tr,
  .app-table.mobile-card-table th,
  .app-table.mobile-card-table td {
    display: block;
  }

  .app-table.mobile-card-table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 12px !important;
    background: transparent;
  }

  .app-table.mobile-card-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
  }

  .app-table.mobile-card-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .app-table.mobile-card-table tbody tr {
    position: relative;
    min-width: 0;
    padding: 14px;
    border: 1px solid #DCE6F0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15,23,42,.065);
  }

  .app-table.mobile-card-table tbody tr:hover td,
  .app-table.mobile-card-table tbody tr[data-href]:hover td,
  .app-table.mobile-card-table tbody tr.row-overdue td {
    background: transparent;
  }

  .app-table.mobile-card-table tbody tr.row-overdue {
    border-color: #FECACA;
    box-shadow: 0 8px 22px rgba(239,68,68,.08);
  }

  .app-table.mobile-card-table td {
    min-height: 0;
    height: auto !important;
    padding: 5px 0 !important;
    border: 0 !important;
    text-align: left !important;
    white-space: normal;
    color: var(--text-body);
    font-size: 12.5px;
  }

  .app-table.mobile-card-table td::before {
    content: attr(data-label);
    display: none;
    margin-bottom: 2px;
    color: #94A3B8;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
  }

  .app-table.mobile-card-table td.col-actions::before,
  .app-table.mobile-card-table td.student-select-cell::before,
  .app-table.mobile-card-table td.staff-select-cell::before {
    display: none;
  }

  .app-table.mobile-card-table td.col-actions,
  .app-table.mobile-card-table td:last-child {
    padding-top: 10px !important;
    border-top: 1px solid #EEF2F7 !important;
  }

  .app-table.mobile-card-table td:nth-child(n+5):not(.col-actions):not(:last-child)::before {
    display: none;
  }

  .app-table.mobile-card-table td:nth-child(2),
  .app-table.mobile-card-table td:first-child:not(.student-select-cell):not(.staff-select-cell) {
    padding-top: 0 !important;
  }

  .app-table.mobile-card-table .student-identity-cell,
  .app-table.mobile-card-table .staff-identity-cell,
  .app-table.mobile-card-table td:nth-child(2) > div:first-child,
  .app-table.mobile-card-table td:first-child > div:first-child {
    margin-bottom: 6px;
  }

  .app-table.mobile-card-table .student-name-link,
  .app-table.mobile-card-table .staff-name-link,
  .app-table.mobile-card-table td:first-child,
  .app-table.mobile-card-table td:nth-child(2) {
    color: var(--text-heading);
    font-weight: 850;
  }

  .app-table.mobile-card-table .student-subline,
  .app-table.mobile-card-table .staff-subline,
  .app-table.mobile-card-table .admission-stack small,
  .app-table.mobile-card-table .grid-text-stack small,
  .app-table.mobile-card-table .contact-stack small {
    font-size: 11px;
  }

  .app-table.mobile-card-table .grid-text-stack,
  .app-table.mobile-card-table .admission-stack,
  .app-table.mobile-card-table .contact-stack {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    margin-right: 8px;
  }

  .app-table.mobile-card-table .grid-main,
  .app-table.mobile-card-table .student-code,
  .app-table.mobile-card-table .staff-code {
    font-size: 11.5px;
    font-weight: 800;
  }

  .app-table.mobile-card-table .status-badge {
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10.5px;
  }

  .students-data-table.mobile-card-table td:nth-child(2),
  .staff-data-table.mobile-card-table td:nth-child(3) {
    display: block !important;
  }

  .students-data-table.mobile-card-table td:nth-child(3),
  .students-data-table.mobile-card-table td:nth-child(5),
  .staff-data-table.mobile-card-table td:nth-child(2),
  .staff-data-table.mobile-card-table td:nth-child(5),
  .staff-data-table.mobile-card-table td:nth-child(6) {
    display: none !important;
  }

  .students-data-table.mobile-card-table td:nth-child(4),
  .students-data-table.mobile-card-table td:nth-child(6),
  .staff-data-table.mobile-card-table td:nth-child(4),
  .staff-data-table.mobile-card-table td:nth-child(7) {
    display: inline-flex !important;
    width: auto;
    max-width: 100%;
    margin-right: 8px;
    vertical-align: middle;
  }

  .students-data-table.mobile-card-table td.col-actions,
  .staff-data-table.mobile-card-table td.col-actions,
  .students-data-table.mobile-card-table td:last-child,
  .staff-data-table.mobile-card-table td:last-child {
    display: block !important;
    width: 100%;
    margin-top: 8px;
  }

  .students-data-table.mobile-card-table tbody tr,
  .staff-data-table.mobile-card-table tbody tr {
    padding-left: 15px;
    border-left: 4px solid var(--brand);
  }

  .app-table.mobile-card-table .col-actions,
  .app-table.mobile-card-table .text-end {
    text-align: left !important;
  }

  .app-table.mobile-card-table .d-flex.justify-content-end,
  .app-table.mobile-card-table .student-row-actions,
  .app-table.mobile-card-table .staff-row-actions {
    justify-content: flex-start !important;
    flex-wrap: wrap;
  }

  .student-identity-cell,
  .staff-identity-cell {
    min-width: 0 !important;
  }

  .students-metrics-grid,
  .staff-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px;
    overflow: visible;
    padding: 0;
  }

  .student-metric,
  .staff-metric {
    min-height: 76px;
    padding: 10px;
    gap: 8px;
    border-radius: 15px;
    box-shadow: 0 6px 16px rgba(15,23,42,.06);
  }

  .student-metric-icon,
  .staff-metric-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    font-size: 14px;
  }

  .student-metric-value,
  .student-metric-copy strong,
  .staff-metric-copy strong {
    font-size: 17px;
    line-height: 1;
  }

  .student-metric-top span,
  .student-metric-copy small,
  .staff-metric-copy small {
    font-size: 10.5px;
    line-height: 1.15;
  }

  .stat-card {
    min-height: 96px;
    padding: 12px;
    border-radius: 16px !important;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 16px;
  }

  .stat-value {
    font-size: 19px;
  }

  .stat-trend {
    font-size: 10px;
    padding: 3px 7px;
  }

  .row > [class*="col"]:has(> .stat-card) {
    width: 33.333333%;
    flex: 0 0 auto;
  }

  .students-filter-head,
  .staff-filter-head,
  .student-grid-card-head,
  .staff-grid-card-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .students-filter-grid,
  .staff-filter-grid {
    grid-template-columns: 1fr !important;
    gap: 11px;
  }

  .filter-search {
    grid-column: auto !important;
  }

  .filter-actions,
  .grid-header-actions,
  .bulk-action-panel,
  .student-grid-footer,
  .staff-grid-footer,
  .student-footer-left,
  .staff-footer-left {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .students-filter-panel,
  .staff-filter-panel,
  .filter-bar,
  .report-filter-panel {
    border-radius: 16px !important;
  }

  .students-filter-head,
  .staff-filter-head,
  .filter-title-group {
    align-items: flex-start;
  }

  .filter-title-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .filter-title-group h2 {
    font-size: 15px;
  }

  .filter-title-group p {
    font-size: 11.5px;
  }

  .filter-actions .btn-brand,
  .filter-actions .btn-outline,
  .grid-header-actions .btn-brand,
  .bulk-action-panel .form-select,
  .bulk-apply-btn,
  .export-icon-btn {
    width: 100% !important;
  }

  .bulk-action-panel {
    padding: 10px;
    border-radius: 16px;
  }

  .bulk-action-panel,
  .student-select-cell,
  .staff-select-cell,
  .app-table.mobile-card-table td.student-select-cell,
  .app-table.mobile-card-table td.staff-select-cell {
    display: none !important;
  }

  .grid-header-bulk-actions {
    display: flex !important;
  }

  .selected-pill {
    justify-content: center;
    min-height: 28px;
  }

  .student-pagination-controls,
  .staff-pagination-controls {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }

  .pagination-page-chip {
    flex: 1;
    justify-content: center;
  }

  .stepper-card {
    position: static;
    overflow-x: auto;
  }

  .step-nav {
    position: sticky;
    bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
    z-index: 20;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 28px rgba(15,23,42,.10);
  }

  .step-nav .btn-brand,
  .step-nav .btn-outline {
    width: 100%;
  }

  .flash-container {
    left: 12px;
    right: 12px;
    bottom: calc(var(--mobile-bottom-nav-height) + 18px + env(safe-area-inset-bottom));
    top: auto;
  }

  .flash-message {
    width: 100%;
    border-radius: 16px;
  }
}

@media (max-width: 575.98px) {
  .content-area {
    padding-left: 12px;
    padding-right: 12px;
  }

  .mobile-bottom-nav {
    left: 8px;
    right: 8px;
    border-radius: 20px;
  }

  .mobile-bottom-item {
    font-size: 9.8px;
  }

  .mobile-bottom-item i {
    font-size: 17px;
  }

  .greeting-name {
    font-size: 19px;
  }

  .stat-card {
    min-height: 102px;
  }

  .row > [class*="col"]:has(> .stat-card) {
    width: 50%;
  }

  .students-metrics-grid,
  .staff-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .student-metric,
  .staff-metric {
    min-height: 72px;
    padding: 9px;
  }

  .app-table.mobile-card-table tbody {
    padding: 8px;
  }
}

/* Mobile minimal mode: keep the app focused and remove desktop scaffolding. */
@media (max-width: 767.98px) {
  #page-progress,
  .header-back-btn,
  .header-tenant-chip,
  .page-subtitle,
  .table-row-count,
  .stat-bar,
  .stat-trend,
  .greeting-deco,
  .chart-toggle,
  .stepper-card,
  .stepper-mobile-bar,
  .stepper-desc-bar,
  .section-badge,
  .ps-collapse-chevron,
  .stepper-sub,
  .header-back-btn + .header-title-group {
    display: none !important;
  }

  .top-header {
    box-shadow: 0 6px 18px rgba(15,23,42,.055);
  }

  .header-page-title {
    max-width: 62vw;
  }

  .content-area {
    padding-top: 10px;
  }

  .page-header {
    margin-bottom: 10px;
  }

  .app-card,
  .table-card,
  .form-card,
  .stat-card,
  .pane-section,
  .step-pane {
    box-shadow: 0 6px 18px rgba(15,23,42,.055) !important;
  }

  .app-card-header,
  .table-card-header,
  .table-card-head,
  .chart-card-header,
  .pane-section-header {
    min-height: 0 !important;
    padding: 12px 14px !important;
  }

  .app-card-title,
  .table-card-title,
  .chart-card-header h3,
  .pane-section-header,
  .section-title-text {
    font-size: 14px !important;
    line-height: 1.2 !important;
  }

  .section-subtitle,
  .table-card-sub,
  .quick-action-desc,
  .student-metric-top span,
  .student-metric-copy small,
  .staff-metric-copy small {
    display: none !important;
  }

  .greeting-card {
    min-height: auto;
    padding: 16px;
  }

  .greeting-name {
    font-size: 18px;
  }

  .greeting-date,
  .greeting-school {
    font-size: 11.5px;
  }

  .quick-action-tile {
    min-height: 86px;
    padding: 12px;
  }

  .quick-action-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .quick-action-label {
    font-size: 12.5px;
  }

  .chart-container,
  .chart-container-sm {
    min-height: 180px;
  }

  .dataTables_wrapper .dt-header,
  .dataTables_wrapper .dt-bottom {
    padding: 10px;
  }

  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_info {
    display: none !important;
  }

  .mobile-bottom-nav {
    min-height: 60px;
    padding: 6px;
  }

  .mobile-bottom-item {
    min-height: 46px;
  }
}

/* Enterprise mobile shell completion
   Final scoped overrides for generic module pages. Desktop and tablet layouts
   keep using the existing rules above. */
.mobile-fab {
  display: none;
}

.mobile-topbar,
.mobile-drawer,
.mobile-drawer-overlay,
.mobile-dashboard-screen {
  display: none;
}

@media (min-width: 768px) {
  .mobile-bottom-nav,
  .mobile-fab,
  .mobile-topbar,
  .mobile-drawer,
  .mobile-drawer-overlay,
  .mobile-dashboard-screen {
    display: none !important;
  }
}

@media (max-width: 767.98px) {
  body.mobile-app-shell {
    color-scheme: light;
  }

  body.mobile-app-shell::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
      radial-gradient(circle at 16% -10%, rgba(56,189,248,.13), transparent 34%),
      linear-gradient(180deg, rgba(255,255,255,.72), rgba(248,250,252,0));
  }

  .mobile-fab {
    position: fixed;
    right: 18px;
    bottom: calc(var(--mobile-bottom-nav-height) + 22px + env(safe-area-inset-bottom));
    z-index: 1034;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100vw - 36px);
    min-height: 48px;
    padding: 0 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    box-shadow: 0 16px 34px color-mix(in srgb, var(--brand) 28%, transparent);
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
  }

  .mobile-fab:hover {
    color: #fff;
    opacity: 1;
  }

  .mobile-fab i {
    font-size: 18px;
  }

  .mobile-app-shell .content-area > .row,
  .mobile-app-shell .app-card-body > .row,
  .mobile-app-shell .form-card-body > .row,
  .mobile-app-shell .modal-body > .row {
    --bs-gutter-x: .85rem;
    --bs-gutter-y: .85rem;
  }

  .mobile-app-shell .content-area > .row > [class*="col-"],
  .mobile-app-shell .app-card-body > .row > [class*="col-"],
  .mobile-app-shell .form-card-body > .row > [class*="col-"],
  .mobile-app-shell .modal-body > .row > [class*="col-"] {
    width: 100%;
    flex: 0 0 100%;
  }

  .mobile-app-shell .breadcrumb {
    display: none;
  }

  .mobile-app-shell .page-header-actions > *,
  .mobile-app-shell .table-card-header > *,
  .mobile-app-shell .table-card-head > *,
  .mobile-app-shell .grid-header-actions > * {
    width: 100%;
  }

  .mobile-app-shell .btn,
  .mobile-app-shell .btn-brand,
  .mobile-app-shell .btn-outline,
  .mobile-app-shell .btn-primary,
  .mobile-app-shell .btn-secondary,
  .mobile-app-shell .btn-danger,
  .mobile-app-shell button[type="submit"] {
    min-height: 44px;
    border-radius: 14px;
  }

  .mobile-app-shell .dropdown-menu,
  .mobile-app-shell .header-dropdown-menu {
    border-radius: 18px;
    border: 1px solid #DCE6F0;
    box-shadow: 0 18px 44px rgba(15,23,42,.18);
  }

  .mobile-app-shell .app-table.mobile-card-table td::before {
    display: block;
  }

  .mobile-app-shell .app-table.mobile-card-table td:first-child::before,
  .mobile-app-shell .app-table.mobile-card-table td:nth-child(2)::before,
  .mobile-app-shell .app-table.mobile-card-table td.col-actions::before,
  .mobile-app-shell .app-table.mobile-card-table td:last-child::before {
    display: none;
  }

  .mobile-app-shell .app-table.mobile-card-table td:nth-child(n+3):not(.col-actions):not(:last-child) {
    display: grid;
    grid-template-columns: minmax(86px, 34%) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  .mobile-app-shell .app-table.mobile-card-table td:nth-child(n+3):not(.col-actions):not(:last-child)::before {
    display: block;
    margin: 0;
  }

  .mobile-app-shell .app-table.mobile-card-table td:empty,
  .mobile-app-shell .app-table.mobile-card-table td[data-label=""]::before {
    display: none;
  }

  .mobile-app-shell .app-table.mobile-card-table .dropdown,
  .mobile-app-shell .app-table.mobile-card-table .btn-group,
  .mobile-app-shell .app-table.mobile-card-table form {
    max-width: 100%;
  }

  .mobile-app-shell .app-table.mobile-card-table .dropdown-menu.show {
    position: fixed !important;
    left: 10px !important;
    right: 10px !important;
    bottom: calc(var(--mobile-bottom-nav-height) + 10px + env(safe-area-inset-bottom)) !important;
    top: auto !important;
    width: auto !important;
    max-height: 58vh;
    padding: 8px;
    overflow-y: auto;
    transform: none !important;
    border-radius: 22px 22px 18px 18px;
  }

  .mobile-app-shell .app-table.mobile-card-table .dropdown-item {
    min-height: 44px;
    border-radius: 12px;
    font-weight: 750;
  }

  .mobile-app-shell .table-responsive {
    border-radius: 18px;
  }

  .mobile-app-shell .table:not(.app-table) {
    min-width: 0;
    font-size: 12.5px;
  }

  .mobile-app-shell .table:not(.app-table) th,
  .mobile-app-shell .table:not(.app-table) td {
    padding: 10px 8px;
    white-space: normal;
  }

  .mobile-app-shell .attendance-grid,
  .mobile-app-shell .quick-actions-grid,
  .mobile-app-shell .settings-grid,
  .mobile-app-shell .module-grid,
  .mobile-app-shell .reports-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .mobile-app-shell .portal-tabs {
    flex-wrap: nowrap;
    margin: 0 -14px 14px;
    padding: 0 14px 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mobile-app-shell .portal-tabs::-webkit-scrollbar {
    display: none;
  }

  .mobile-app-shell .portal-tab {
    flex: 0 0 auto;
    min-height: 42px;
    border-width: 1px;
    border-radius: 15px;
  }

  .mobile-app-shell .portal-child-hero,
  .mobile-app-shell .profile-hero {
    border-radius: 22px;
    padding: 18px;
  }

  .mobile-app-shell .profile-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 14px;
  }

  .mobile-app-shell .profile-hero-avatar {
    width: 64px;
    height: 64px;
    font-size: 21px;
  }

  .mobile-app-shell .profile-hero-name {
    font-size: 21px;
  }

  .mobile-app-shell .profile-hero-sub {
    line-height: 1.45;
  }

  .mobile-app-shell .profile-hero-meta {
    gap: 8px;
  }

  .mobile-app-shell .profile-hero-meta-item {
    max-width: 100%;
    white-space: normal;
  }

  .mobile-app-shell .profile-hero-actions {
    width: 100%;
  }

  .mobile-app-shell .btn-hero-edit {
    justify-content: center;
    width: 100%;
    min-height: 44px;
    border-radius: 14px;
  }

  .mobile-app-shell .detail-section {
    border: 1px solid #DCE6F0;
    border-radius: 18px;
    box-shadow: 0 6px 18px rgba(15,23,42,.055);
  }

  .mobile-app-shell .detail-section-header {
    padding: 13px 14px;
  }

  .mobile-app-shell .detail-grid {
    grid-template-columns: 1fr;
  }

  .mobile-app-shell .detail-cell {
    padding: 12px 14px;
    border-right: 0;
  }

  .mobile-app-shell .portal-mini-card {
    min-height: 104px;
    border-radius: 17px;
  }

  .mobile-app-shell form:not(.filter-form) .form-footer,
  .mobile-app-shell form:not(.filter-form) .form-actions,
  .mobile-app-shell .sticky-action-bar,
  .mobile-app-shell .card-footer:has(button[type="submit"]),
  .mobile-app-shell .modal-footer {
    position: sticky;
    bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
    z-index: 22;
    margin-left: -14px;
    margin-right: -14px;
    padding: 12px 14px;
    border-top: 1px solid #DCE6F0;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(18px);
    box-shadow: 0 -10px 28px rgba(15,23,42,.10);
  }

  .mobile-app-shell form:not(.filter-form) .form-footer .btn,
  .mobile-app-shell form:not(.filter-form) .form-actions .btn,
  .mobile-app-shell .sticky-action-bar .btn,
  .mobile-app-shell .modal-footer .btn {
    flex: 1 1 0;
    justify-content: center;
  }

  .mobile-app-shell .form-control,
  .mobile-app-shell .form-select,
  .mobile-app-shell .ts-control {
    box-shadow: none !important;
  }

  .mobile-app-shell .invalid-feedback,
  .mobile-app-shell .text-danger {
    font-size: 12px;
    font-weight: 700;
  }
}

@media (max-width: 767.98px) {
  :root {
    --header-height: 58px;
    --mobile-bottom-nav-height: 70px;
  }

  html,
  body.mobile-app-shell {
    min-height: 100%;
    overflow-x: hidden;
    background: #F4F7FB;
  }

  body.mobile-app-shell {
    padding-top: calc(58px + env(safe-area-inset-top));
  }

  body.mobile-app-shell .sidebar,
  body.mobile-app-shell .top-header,
  body.mobile-app-shell .sidebar-overlay {
    display: none !important;
  }

  body.mobile-app-shell .main-wrapper,
  body.mobile-app-shell .main-wrapper.rail {
    margin-left: 0 !important;
    min-height: calc(100dvh - 58px);
  }

  body.mobile-app-shell .content-area {
    padding: 12px 12px calc(var(--mobile-bottom-nav-height) + 24px + env(safe-area-inset-bottom)) !important;
    background: transparent;
  }

  .mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1042;
    display: flex;
    align-items: center;
    gap: 10px;
    height: calc(58px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    border-bottom: 1px solid rgba(220,230,240,.92);
    background: rgba(255,255,255,.96);
    box-shadow: 0 8px 24px rgba(15,23,42,.07);
    backdrop-filter: blur(18px);
  }

  .mobile-icon-btn,
  .mobile-avatar-btn {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid #DCE6F0;
    border-radius: 15px;
    background: #F8FAFC;
    color: #25324A;
    font: inherit;
  }

  .mobile-icon-btn i {
    font-size: 19px;
  }

  .mobile-avatar-btn {
    border: 0;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    font-size: 13px;
    font-weight: 900;
  }

  .mobile-topbar-title {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 1px;
  }

  .mobile-topbar-title span,
  .mobile-topbar-title small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-topbar-title span {
    color: #0F172A;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.15;
  }

  .mobile-topbar-title small {
    color: #64748B;
    font-size: 11px;
    font-weight: 700;
  }

  .mobile-topbar-actions {
    display: inline-flex;
    gap: 7px;
    flex-shrink: 0;
  }

  .mobile-drawer {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1052;
    display: flex;
    flex-direction: column;
    width: min(88vw, 340px);
    padding: calc(14px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom));
    background: #FFFFFF;
    box-shadow: 18px 0 48px rgba(15,23,42,.24);
    transform: translateX(-108%);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
  }

  .mobile-drawer.is-open {
    transform: translateX(0);
  }

  .mobile-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: block;
    border: 0;
    background: rgba(15,23,42,.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    backdrop-filter: blur(4px);
  }

  .mobile-drawer-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  body.mobile-drawer-open {
    overflow: hidden;
  }

  .mobile-drawer-profile {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 4px 0 14px;
    border-bottom: 1px solid #E7EDF5;
  }

  .mobile-drawer-avatar {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 17px;
    background: linear-gradient(135deg, #22C55E, #38BDF8);
    color: #fff;
    font-weight: 950;
  }

  .mobile-drawer-profile div:nth-child(2) {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 2px;
  }

  .mobile-drawer-profile strong,
  .mobile-drawer-profile span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-drawer-profile strong {
    color: #0F172A;
    font-size: 14px;
    font-weight: 900;
  }

  .mobile-drawer-profile span {
    color: #64748B;
    font-size: 11px;
    font-weight: 750;
  }

  .mobile-drawer-close {
    width: 38px;
    height: 38px;
  }

  .mobile-drawer-nav {
    display: grid;
    gap: 7px;
    padding: 14px 0 0;
    overflow-y: auto;
  }

  .mobile-drawer-nav a {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 16px;
    color: #334155;
    text-decoration: none;
    font-size: 13px;
    font-weight: 850;
  }

  .mobile-drawer-nav a i {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--brand-light);
    color: var(--brand);
  }

  .mobile-drawer-nav a.active {
    color: var(--brand);
    background: var(--brand-light);
  }

  .desktop-dashboard-layout {
    display: none !important;
  }

  .mobile-dashboard-screen {
    display: grid;
    gap: 14px;
  }

  .mobile-welcome-card,
  .mobile-summary-card,
  .mobile-section {
    border: 1px solid #DCE6F0;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(15,23,42,.07);
  }

  .mobile-welcome-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
    background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 68%, #0F766E));
    color: #fff;
  }

  .mobile-kicker {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
    font-weight: 850;
    opacity: .78;
    text-transform: uppercase;
  }

  .mobile-welcome-card h2,
  .mobile-welcome-card p {
    margin: 0;
  }

  .mobile-welcome-card h2 {
    font-size: 22px;
    font-weight: 950;
    line-height: 1.1;
  }

  .mobile-welcome-card p {
    margin-top: 5px;
    font-size: 12px;
    font-weight: 700;
    opacity: .82;
  }

  .mobile-welcome-avatar {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 18px;
    background: rgba(255,255,255,.18);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.22);
    font-size: 19px;
    font-weight: 950;
  }

  .mobile-stat-strip,
  .mobile-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .mobile-stat-card,
  .mobile-action-grid a {
    min-height: 104px;
    display: grid;
    align-content: center;
    gap: 7px;
    padding: 14px;
    border: 1px solid #DCE6F0;
    border-radius: 20px;
    background: #fff;
    color: #0F172A;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(15,23,42,.06);
  }

  .mobile-stat-card i,
  .mobile-action-grid i,
  .mobile-summary-head > i {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: var(--brand-light);
    color: var(--brand);
    font-size: 17px;
  }

  .mobile-stat-card strong {
    font-size: 20px;
    font-weight: 950;
    line-height: 1;
  }

  .mobile-stat-card span,
  .mobile-action-grid span {
    color: #64748B;
    font-size: 11.5px;
    font-weight: 800;
  }

  .mobile-section,
  .mobile-summary-card {
    padding: 14px;
  }

  .mobile-section-head,
  .mobile-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .mobile-section-head {
    margin-bottom: 12px;
  }

  .mobile-section-head h3 {
    margin: 0;
    color: #0F172A;
    font-size: 15px;
    font-weight: 950;
  }

  .mobile-section-head span,
  .mobile-section-head a,
  .mobile-summary-head span {
    color: #64748B;
    font-size: 11.5px;
    font-weight: 800;
  }

  .mobile-summary-head {
    justify-content: flex-start;
  }

  .mobile-summary-head div {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 2px;
  }

  .mobile-summary-head strong {
    color: #0F172A;
    font-size: 14px;
    font-weight: 950;
  }

  .mobile-summary-head b {
    color: var(--brand);
    font-size: 15px;
  }

  .mobile-progress-track {
    height: 10px;
    margin: 14px 0 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #E7EDF5;
  }

  .mobile-progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--success), #38BDF8);
  }

  .mobile-summary-pills {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
  }

  .mobile-summary-pills span {
    padding: 5px 8px;
    border-radius: 999px;
    background: #F1F5F9;
    color: #64748B;
    font-size: 10.5px;
    font-weight: 850;
  }

  .mobile-summary-pills .success {
    color: var(--success);
    background: var(--success-light);
  }

  .mobile-summary-pills .danger {
    color: var(--danger);
    background: var(--danger-light);
  }

  .mobile-inline-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    color: var(--brand);
    font-size: 12px;
    font-weight: 900;
  }

  .mobile-card-list {
    display: grid;
    gap: 9px;
  }

  .mobile-record-card {
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px;
    border: 1px solid #E7EDF5;
    border-radius: 17px;
    color: #0F172A;
    text-decoration: none;
    background: #FBFDFF;
  }

  .mobile-record-avatar {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 15px;
    color: #fff;
    font-weight: 950;
  }

  .mobile-record-main {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 2px;
  }

  .mobile-record-main strong,
  .mobile-record-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-record-main strong {
    font-size: 13.5px;
    font-weight: 950;
  }

  .mobile-record-main small {
    color: #64748B;
    font-size: 11.5px;
    font-weight: 750;
  }

  .mobile-empty-state {
    min-height: 104px;
    display: grid;
    place-items: center;
    gap: 8px;
    color: #64748B;
    font-size: 12px;
    font-weight: 800;
  }

  .mobile-empty-state i {
    font-size: 28px;
    color: #CBD5E1;
  }

  body.mobile-app-shell .mobile-bottom-nav {
    display: grid !important;
  }

  body.mobile-app-shell .mobile-bottom-item[data-action="sidebar-toggle"] {
    display: none !important;
  }

  body.mobile-app-shell .table-card,
  body.mobile-app-shell .app-card,
  body.mobile-app-shell .form-card,
  body.mobile-app-shell .filter-bar,
  body.mobile-app-shell .students-filter-panel,
  body.mobile-app-shell .staff-filter-panel,
  body.mobile-app-shell .report-filter-panel {
    border-radius: 21px !important;
  }

  body.mobile-app-shell .page-header {
    display: block;
    margin: 0 0 10px;
  }

  body.mobile-app-shell .page-header-actions {
    display: grid;
    gap: 8px;
  }

  body.mobile-app-shell .app-table.mobile-card-table tbody {
    padding: 0;
    background: transparent;
  }

  body.mobile-app-shell .app-table.mobile-card-table tbody tr {
    border-radius: 20px;
  }

  body.mobile-app-shell .att-controls {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  body.mobile-app-shell .att-btn {
    width: 100%;
    min-width: 0;
    height: 42px;
    border-radius: 14px;
  }

  body.mobile-app-shell .modal-footer,
  body.mobile-app-shell .mobile-sticky-actions,
  body.mobile-app-shell .step-nav {
    bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom)) !important;
  }

  .mobile-app-shell .header-user-meta,
  .mobile-app-shell .header-chevron {
    display: none;
  }

  .mobile-app-shell .header-user-btn {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .mobile-app-shell .mobile-fab span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
  }

  .mobile-app-shell .mobile-fab {
    width: 52px;
    height: 52px;
    justify-content: center;
    padding: 0;
    border-radius: 18px;
  }

  .mobile-app-shell .page-title {
    font-size: 18px;
  }

  .mobile-app-shell .page-header-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .mobile-app-shell .page-header-actions .btn,
  .mobile-app-shell .table-card-header .btn,
  .mobile-app-shell .table-card-head .btn,
  .mobile-app-shell .grid-header-actions .btn {
    width: 100%;
  }

  .mobile-app-shell .stat-card {
    padding-bottom: 12px;
  }

  .mobile-app-shell .stat-label,
  .mobile-app-shell .portal-mini-label {
    line-height: 1.15;
  }

  .mobile-app-shell .modal.show .modal-dialog {
    display: flex;
    align-items: flex-end;
    min-height: calc(100% - 20px);
  }

  .mobile-app-shell .modal.show .modal-content {
    max-height: calc(100dvh - 24px);
    border-radius: 24px 24px 0 0;
  }

  body.mobile-app-shell.has-mobile-native-page .content-area > :not(.mobile-native-page):not(.mobile-dashboard-screen) {
    display: none !important;
  }

  body.mobile-app-shell.has-mobile-native-page .content-area {
    isolation: isolate;
  }

  body.mobile-app-shell.mobile-native-has-form .mobile-fab {
    display: none !important;
  }

  .mobile-native-page {
    display: grid;
    gap: 14px;
  }

  .mobile-native-hero {
    min-height: 108px;
    display: grid;
    align-content: end;
    gap: 5px;
    padding: 18px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 62%, #0F766E));
    color: #fff;
    box-shadow: 0 16px 34px color-mix(in srgb, var(--brand) 24%, transparent);
  }

  .mobile-native-hero h2,
  .mobile-native-hero p {
    margin: 0;
  }

  .mobile-native-hero h2 {
    font-size: 22px;
    font-weight: 950;
    line-height: 1.1;
  }

  .mobile-native-hero p {
    max-width: 28rem;
    font-size: 12px;
    font-weight: 720;
    opacity: .82;
  }

  .mobile-native-action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .mobile-native-action-row > a,
  .mobile-native-action-row > button,
  .mobile-native-action-row > .dropdown {
    width: 100% !important;
    min-height: 46px;
    justify-content: center;
    border-radius: 16px !important;
  }

  .mobile-native-btn {
    min-height: 46px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 0 14px !important;
    border: 1px solid #DCE6F0 !important;
    border-radius: 16px !important;
    background: #FFFFFF !important;
    color: #334155 !important;
    box-shadow: none !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-align: center !important;
    text-decoration: none !important;
    letter-spacing: 0 !important;
    transform: none !important;
    white-space: normal !important;
    touch-action: manipulation;
  }

  .mobile-native-btn-primary {
    border-color: transparent !important;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark)) !important;
    color: #FFFFFF !important;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 22%, transparent) !important;
  }

  .mobile-native-btn-secondary {
    background: #F8FAFC !important;
    color: #334155 !important;
  }

  .mobile-native-btn-danger {
    border-color: #FECACA !important;
    background: #FEF2F2 !important;
    color: #DC2626 !important;
  }

  .mobile-native-btn-icon {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    border-radius: 15px !important;
  }

  .mobile-native-btn i {
    font-size: 16px;
    line-height: 1;
  }

  .mobile-native-filter {
    border: 1px solid #DCE6F0;
    border-radius: 21px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(15,23,42,.065);
    overflow: hidden;
  }

  .mobile-native-filter summary {
    min-height: 54px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    color: #0F172A;
    font-size: 13px;
    font-weight: 950;
    list-style: none;
  }

  .mobile-native-filter summary::-webkit-details-marker {
    display: none;
  }

  .mobile-native-filter summary i {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: var(--brand-light);
    color: var(--brand);
  }

  .mobile-native-filter > form,
  .mobile-native-filter > div {
    margin: 0 !important;
    padding: 0 14px 14px !important;
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  .mobile-native-filter .mobile-native-btn {
    width: 100% !important;
  }

  .mobile-native-filter .row,
  .mobile-native-filter [class*="filter-grid"] {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 11px !important;
  }

  .mobile-native-list {
    display: grid;
    gap: 11px;
  }

  .mobile-native-info-list {
    display: grid;
    gap: 11px;
  }

  .mobile-native-info-card {
    min-height: 76px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 13px;
    border: 1px solid #DCE6F0;
    border-radius: 21px;
    background: #fff;
    color: #0F172A;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(15,23,42,.065);
  }

  .mobile-native-info-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: var(--brand-light);
    color: var(--brand);
    font-size: 17px;
    font-weight: 950;
  }

  .mobile-native-info-body {
    min-width: 0;
    display: grid;
    gap: 4px;
  }

  .mobile-native-info-body strong,
  .mobile-native-info-body small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-native-info-body strong {
    color: #0F172A;
    font-size: 14px;
    font-weight: 950;
  }

  .mobile-native-info-body small {
    color: #64748B;
    font-size: 11.5px;
    font-weight: 760;
  }

  .mobile-native-card {
    position: relative;
    min-height: 98px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 11px;
    align-items: center;
    padding: 13px;
    border: 1px solid #DCE6F0;
    border-radius: 22px;
    background: #fff;
    color: #0F172A;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(15,23,42,.065);
  }

  article.mobile-native-card {
    cursor: default;
  }

  .mobile-native-avatar {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 17px;
    background: linear-gradient(135deg, var(--brand), #14B8A6);
    color: #fff;
    font-size: 15px;
    font-weight: 950;
  }

  .mobile-native-card-body {
    min-width: 0;
    display: grid;
    gap: 4px;
  }

  .mobile-native-card-body strong,
  .mobile-native-card-body small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-native-card-body strong {
    color: #0F172A;
    font-size: 14px;
    font-weight: 950;
  }

  .mobile-native-card-body small {
    color: #64748B;
    font-size: 11.5px;
    font-weight: 760;
  }

  .mobile-native-meta {
    grid-column: 1 / -1;
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    padding-top: 9px;
    border-top: 1px solid #EEF2F7;
  }

  .mobile-native-meta span {
    display: inline-flex;
    gap: 5px;
    max-width: 100%;
    padding: 5px 8px;
    border-radius: 999px;
    background: #F8FAFC;
    color: #334155;
    font-size: 10.5px;
    font-weight: 820;
  }

  .mobile-native-meta b {
    color: #94A3B8;
    font-weight: 900;
    text-transform: uppercase;
  }

  .mobile-native-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid #EEF2F7;
  }

  .mobile-native-actions td,
  .mobile-native-actions .col-actions,
  .mobile-native-actions > * {
    display: flex !important;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
    padding: 0 !important;
    border: 0 !important;
  }

  .mobile-native-actions .btn-action,
  .mobile-native-actions a,
  .mobile-native-actions button {
    min-width: 42px;
    min-height: 42px;
    border-radius: 14px !important;
  }

  .mobile-native-actions .mobile-native-btn {
    flex: 1 1 44px;
  }

  .mobile-native-chevron {
    color: #CBD5E1;
    font-size: 18px;
  }

  .mobile-native-empty,
  .mobile-native-panel {
    min-height: 150px;
    display: grid;
    place-items: center;
    gap: 9px;
    padding: 22px;
    border: 1px solid #DCE6F0;
    border-radius: 22px;
    background: #fff;
    color: #64748B;
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(15,23,42,.065);
  }

  .mobile-native-empty i,
  .mobile-native-panel i {
    color: #CBD5E1;
    font-size: 32px;
  }

  .mobile-native-form {
    display: grid;
    gap: 13px;
    margin: 0 !important;
    padding-bottom: calc(var(--mobile-bottom-nav-height) + 36px + env(safe-area-inset-bottom));
  }

  .mobile-native-form,
  .mobile-native-form * {
    letter-spacing: 0 !important;
  }

  .mobile-native-form .row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .mobile-native-step {
    display: grid;
    gap: 11px;
    padding: 14px;
    border: 1px solid #DCE6F0;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(15,23,42,.065);
  }

  .mobile-native-surface,
  .mobile-native-step-pane,
  .mobile-native-section-body {
    display: grid !important;
    gap: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  .mobile-native-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .mobile-native-step h3 {
    margin: 0;
    color: #0F172A;
    font-size: 13px;
    font-weight: 950;
    line-height: 1.25;
  }

  .mobile-native-step[hidden],
  .mobile-native-step-pane[hidden] {
    display: none !important;
  }

  .mobile-native-tabs {
    position: sticky;
    top: calc(58px + env(safe-area-inset-top));
    z-index: 15;
    display: flex;
    gap: 8px;
    margin: -2px -12px 2px;
    padding: 10px 12px;
    overflow-x: auto;
    border-bottom: 1px solid #E2EAF3;
    background: rgba(244,247,251,.96);
    backdrop-filter: blur(16px);
    scrollbar-width: none;
  }

  .mobile-native-tabs::-webkit-scrollbar {
    display: none;
  }

  .mobile-native-tab {
    width: min(72vw, 210px);
    max-width: 210px;
    min-width: 112px;
    min-height: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 7px 10px;
    border: 1px solid #DCE6F0;
    border-radius: 17px;
    background: #fff;
    color: #475569;
    box-shadow: 0 6px 16px rgba(15,23,42,.045);
    font: inherit;
    text-align: left;
  }

  .mobile-native-tab span {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 11px;
    background: #EEF4FB;
    color: #64748B;
    font-size: 12px;
    font-weight: 950;
  }

  .mobile-native-tab strong {
    min-width: 0;
    max-width: 100%;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11.5px;
    font-weight: 900;
    line-height: 1.15;
  }

  .mobile-native-tab.is-active {
    border-color: transparent;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 24%, transparent);
  }

  .mobile-native-tab.is-active span {
    background: rgba(255,255,255,.18);
    color: #fff;
  }

  .mobile-native-tab.is-complete:not(.is-active) span {
    background: var(--success-light);
    color: var(--success);
  }

  .mobile-native-wizard-pane[hidden] {
    display: none !important;
  }

  .mobile-native-wizard-pane.is-active {
    display: grid !important;
  }

  .mobile-native-form .mobile-native-step:has(.mobile-native-wizard-pane[hidden]) {
    display: none !important;
  }

  .mobile-native-form .mobile-native-step.is-active {
    display: grid !important;
  }

  .mobile-native-wizard-nav {
    position: sticky;
    bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
    z-index: 18;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin: 2px -12px -12px;
    padding: 12px;
    border: 1px solid #DCE6F0;
    border-radius: 22px 22px 0 0;
    background: rgba(255,255,255,.96);
    box-shadow: 0 -12px 30px rgba(15,23,42,.12);
    backdrop-filter: blur(18px);
  }

  .mobile-native-wizard-nav::before {
    content: 'Step ' attr(data-mobile-step) ' of ' attr(data-mobile-total);
    grid-column: 1 / -1;
    color: #64748B;
    font-size: 11px;
    font-weight: 900;
    text-align: center;
  }

  .mobile-native-wizard-nav [hidden] {
    display: none !important;
  }

  .mobile-native-wizard-nav .mobile-native-final-submit:not([hidden]) {
    display: inline-flex !important;
    grid-column: 1 / -1;
  }

  .mobile-native-field,
  .mobile-native-form .mb-3,
  .mobile-native-form .col,
  .mobile-native-form [class*="col-"] {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .mobile-native-label {
    display: block !important;
    margin: 0 0 7px !important;
    color: #475569 !important;
    font-size: 12px !important;
    font-weight: 900 !important;
    line-height: 1.2 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
  }

  .mobile-native-form .form-control,
  .mobile-native-form .form-select,
  .mobile-native-form .ts-control,
  .mobile-native-control {
    width: 100% !important;
    min-height: 50px !important;
    padding: 0 14px !important;
    border: 1px solid #D7E2EE !important;
    border-radius: 16px !important;
    background: #F8FAFC !important;
    color: #0F172A !important;
    box-shadow: none !important;
    font-size: 16px !important;
    font-weight: 650 !important;
    line-height: 1.35 !important;
  }

  textarea.mobile-native-control,
  .mobile-native-form textarea {
    min-height: 116px !important;
    padding-top: 13px !important;
  }

  .mobile-native-control[type="file"] {
    min-height: 50px !important;
    padding: 7px !important;
    line-height: 1.2 !important;
  }

  .mobile-native-control[type="file"]::file-selector-button {
    min-height: 36px;
    margin: 0 10px 0 0;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    background: var(--brand-light);
    color: var(--brand);
    font: inherit;
    font-size: 13px;
    font-weight: 900;
  }

  .mobile-native-control:focus,
  .mobile-native-form .form-control:focus,
  .mobile-native-form .form-select:focus,
  .mobile-native-form .ts-control:focus {
    border-color: var(--brand) !important;
    background: #FFFFFF !important;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 13%, transparent) !important;
    outline: none !important;
  }

  .mobile-native-input-group {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: stretch;
    border: 1px solid #D7E2EE;
    border-radius: 16px;
    background: #F8FAFC;
    overflow: hidden;
  }

  .mobile-native-input-group .mobile-native-control,
  .mobile-native-input-group .form-control {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

  .mobile-native-input-addon {
    min-width: 46px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 0 !important;
    background: transparent !important;
    color: #64748B !important;
  }

  .mobile-native-help {
    margin-top: 6px !important;
    color: #64748B !important;
    font-size: 12px !important;
    font-weight: 750 !important;
    line-height: 1.35 !important;
  }

  .mobile-native-form .invalid-feedback,
  .mobile-native-form .text-danger.mobile-native-help {
    color: #DC2626 !important;
  }

  .mobile-native-submitbar {
    position: sticky !important;
    bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom)) !important;
    z-index: 18 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 9px !important;
    margin: 4px -12px -12px !important;
    padding: 12px !important;
    border: 1px solid #DCE6F0 !important;
    border-radius: 22px 22px 0 0 !important;
    background: rgba(255,255,255,.96) !important;
    box-shadow: 0 -12px 30px rgba(15,23,42,.12) !important;
    backdrop-filter: blur(18px);
  }

  .mobile-native-submitbar .nav-left,
  .mobile-native-submitbar .nav-right {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 9px !important;
    width: 100% !important;
  }

  .mobile-native-submitbar .mobile-native-btn {
    width: 100% !important;
  }

  .mobile-native-form button[type="submit"],
  .mobile-native-form input[type="submit"],
  .mobile-native-form .btn-brand {
    position: sticky;
    bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
    z-index: 12;
    width: 100%;
    min-height: 48px;
    border-radius: 16px;
  }

  .mobile-native-submitbar button[type="submit"],
  .mobile-native-submitbar input[type="submit"],
  .mobile-native-wizard-nav button,
  .mobile-native-wizard-nav input[type="submit"] {
    position: static !important;
    bottom: auto !important;
    z-index: auto !important;
  }

  .mobile-native-form .form-check,
  .mobile-native-form .form-switch {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #E2EAF3;
    border-radius: 16px;
    background: #F8FAFC;
  }

  .mobile-native-form .form-check-input {
    width: 22px !important;
    height: 22px !important;
    min-height: 22px !important;
    margin: 0 !important;
    flex-shrink: 0;
  }

  .mobile-native-form .form-check-label {
    margin: 0 !important;
    color: #334155 !important;
    font-size: 13px !important;
    font-weight: 850 !important;
  }

  .mobile-native-choice-field {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .mobile-native-choice-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .mobile-native-choice-card {
    min-width: 0;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 11px 12px;
    border: 1px solid #DCE6F0;
    border-radius: 16px;
    background: #F8FAFC;
    color: #334155;
    font-size: 13px;
    font-weight: 850;
    line-height: 1.25;
  }

  .mobile-native-choice-card span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .mobile-native-check-input {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    margin: 0 !important;
    accent-color: var(--brand);
  }
}
