/* AI School ERP — dashboard visual system
   Dark charcoal sidebar, light grey canvas, white panels, coloured KPI tiles, indigo accent. */

:root {
  /* Surfaces */
  --canvas: #f3f4f7;
  --surface: #ffffff;
  --surface-muted: #f8f9fb;
  --line: #e4e7ec;
  --line-soft: #eef0f4;

  /* Text */
  --ink: #1d2433;
  --ink-muted: #667085;
  --ink-faint: #98a2b3;

  /* Sidebar */
  --side-bg: #2b3036;
  --side-bg-deep: #22262b;
  --side-text: #c7ccd4;
  --side-muted: #8a929d;
  --side-hover: rgba(255, 255, 255, 0.06);
  --side-active: #3a4048;

  /* Brand */
  --primary: #4b44c8;
  --primary-deep: #3a34a8;
  --primary-soft: #eceafd;
  --ai-bg: #262257;

  /* KPI tile colours */
  --k-navy: #1f2a44;
  --k-teal: #1f7a8c;
  --k-orange: #f2994a;
  --k-red: #c94f4f;
  --k-maroon: #8e2f45;
  --k-purple: #4b2d7f;
  --k-amber: #d9a03f;
  --k-green: #1e8a6e;

  /* Status */
  --ok: #12855f;
  --warn: #b7791f;
  --danger: #c2413b;

  /* Chart categorical order (validated: CVD + normal-vision separation) */
  --c1: #2f6fdb;
  --c2: #12a089;
  --c3: #e8a33c;
  --c4: #d6455d;
  --c5: #7a52c7;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-width: 248px;
  --topbar-height: 68px;

  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif;

  --bs-body-font-family: var(--font-body);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--canvas);
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--ink-muted);
  --bs-primary: var(--primary);
  --bs-primary-rgb: 75, 68, 200;
  --bs-link-color: var(--primary);
  --bs-link-color-rgb: 75, 68, 200;
  --bs-link-hover-color: var(--primary-deep);
  --bs-border-radius: var(--radius-sm);
}

body {
  background: var(--canvas);
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: 100vh;
}
h1, h2, h3, h4 { color: var(--ink); letter-spacing: -0.01em; }
a { text-underline-offset: 3px; }
code { color: var(--primary-deep); background: var(--primary-soft); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.85em; }
.tabular { font-variant-numeric: tabular-nums; }
.text-muted-ink { color: var(--ink-muted) !important; }
.min-w-0 { min-width: 0; }

/* ------------------------------------------------------------------
   Buttons & forms
   ------------------------------------------------------------------ */
.btn { font-weight: 600; border-radius: var(--radius-sm); }
.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-deep);
  --bs-btn-hover-border-color: var(--primary-deep);
  --bs-btn-active-bg: var(--primary-deep);
  --bs-btn-active-border-color: var(--primary-deep);
  --bs-btn-disabled-bg: var(--primary);
  --bs-btn-disabled-border-color: var(--primary);
}
.btn-outline-primary {
  --bs-btn-color: var(--ink);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-soft);
  --bs-btn-hover-border-color: #cfcaf7;
  --bs-btn-active-color: var(--primary);
  --bs-btn-active-bg: var(--primary-soft);
  --bs-btn-active-border-color: var(--primary);
}
.btn-outline-danger { --bs-btn-color: var(--danger); --bs-btn-border-color: #f1cdcb; --bs-btn-hover-bg: var(--danger); --bs-btn-hover-border-color: var(--danger); }
.btn-outline-success { --bs-btn-color: var(--ok); --bs-btn-border-color: #c3e6d6; --bs-btn-hover-bg: var(--ok); --bs-btn-hover-border-color: var(--ok); }
.btn-accent { --bs-btn-color: #fff; --bs-btn-bg: var(--k-amber); --bs-btn-border-color: var(--k-amber); --bs-btn-hover-bg: #c58c2c; --bs-btn-hover-color: #fff; }

.form-control, .form-select {
  border-color: var(--line);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  background-color: var(--surface);
}
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 0.2rem rgba(75, 68, 200, 0.18); }
.form-label { font-weight: 600; font-size: 0.85rem; margin-bottom: 0.3rem; }
.form-text { color: var(--ink-muted); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* ------------------------------------------------------------------
   Shell
   ------------------------------------------------------------------ */
.app-shell { min-height: 100vh; }
.erp-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.erp-sidebar {
  /* !important: Bootstrap's .offcanvas-lg forces a transparent background on desktop */
  background-color: var(--side-bg) !important;
  color: var(--side-text);
  --bs-offcanvas-width: var(--sidebar-width);
}
@media (min-width: 992px) {
  .erp-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex !important;
    flex-direction: column;
    transition: margin-left 0.2s ease;
  }
  .app-shell.sidebar-hidden .erp-sidebar { margin-left: calc(-1 * var(--sidebar-width)); }
}
.erp-sidebar .offcanvas-body { display: flex !important; flex-direction: column; padding: 0; overflow-y: auto; }
.erp-sidebar .offcanvas-header { border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.erp-sidebar::-webkit-scrollbar, .erp-sidebar .offcanvas-body::-webkit-scrollbar { width: 6px; }
.erp-sidebar .offcanvas-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1rem 0.75rem;
  color: #fff;
  text-decoration: none;
  min-width: 0;
}
.sidebar-brand:hover { color: #fff; }
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 0.95rem; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { display: block; font-size: 0.72rem; color: var(--side-muted); font-weight: 500; }

.sidebar-search { padding: 0 0.85rem 0.75rem; }
.sidebar-search .input-group { background: var(--side-bg-deep); border-radius: var(--radius-sm); }
.sidebar-search input {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 0.85rem;
  padding: 0.45rem 0.7rem;
}
.sidebar-search input::placeholder { color: var(--side-muted); }
.sidebar-search input:focus { background: transparent; color: #fff; box-shadow: none; }
.sidebar-search .input-group-text { background: transparent; border: 0; color: var(--side-muted); }
.sidebar-search .input-group:focus-within { box-shadow: 0 0 0 2px rgba(124, 118, 230, 0.6); }

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--side-muted);
  padding: 0.9rem 1.1rem 0.35rem;
}
.erp-sidebar .nav-link {
  color: var(--side-text);
  padding: 0.5rem 0.75rem;
  margin: 1px 0.6rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.86rem;
  font-weight: 500;
  width: calc(100% - 1.2rem);
  text-align: left;
  border: 0;
  background: transparent;
}
.erp-sidebar .nav-link .bi { font-size: 1rem; width: 1.1rem; text-align: center; color: var(--side-muted); }
.erp-sidebar .nav-link:hover, .erp-sidebar .nav-link:focus-visible { background: var(--side-hover); color: #fff; }
.erp-sidebar .nav-link:hover .bi { color: #fff; }
.erp-sidebar .nav-link.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 #8b85f0; }
.erp-sidebar .nav-link.active .bi { color: #a9a4f7; }
.erp-sidebar .nav-link .chev { margin-left: auto; font-size: 0.7rem; transition: transform 0.2s ease; }
.erp-sidebar .nav-link[aria-expanded="true"] .chev { transform: rotate(90deg); }
.nav-sub { list-style: none; padding: 0.15rem 0 0.35rem; margin: 0; }
.nav-sub .nav-link { padding-left: 2.6rem; font-size: 0.82rem; }
.sidebar-empty-search { color: var(--side-muted); font-size: 0.8rem; padding: 0.5rem 1.1rem; }

.erp-topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1020;
}
.topbar-greeting { min-width: 0; }
.topbar-greeting .hello { font-size: 1.15rem; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-greeting .meta { font-size: 0.78rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-greeting .meta .sep { color: var(--line); margin: 0 0.35rem; }
.role-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  vertical-align: middle;
  margin-left: 0.4rem;
}
.topbar-tools .tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  position: relative;
}
.topbar-tools .tool-btn:hover { background: var(--surface-muted); color: var(--ink); }
.topbar-tools .lang-chip { font-size: 0.8rem; color: var(--ink-muted); border: 1px solid var(--line); border-radius: 999px; padding: 0.25rem 0.65rem; }
.topbar-search { max-width: 260px; }
.topbar-search .form-control { background: var(--surface-muted); border-color: var(--line-soft); font-size: 0.85rem; padding-left: 2.1rem; }
.topbar-search .bi { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--ink-faint); }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--k-amber);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dropdown-menu { border-color: var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(16, 24, 40, 0.12); padding: 0.4rem; font-size: 0.875rem; }
.dropdown-item { border-radius: var(--radius-sm); padding: 0.45rem 0.7rem; }
.dropdown-item:active { background: var(--primary); }

.erp-main { padding: 1.25rem 1.5rem 2.5rem; width: 100%; }
@media (max-width: 767.98px) { .erp-main { padding: 1rem 0.85rem 2rem; } }

/* ------------------------------------------------------------------
   Generic page parts
   ------------------------------------------------------------------ */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-title { font-weight: 700; font-size: 1.45rem; margin: 0; line-height: 1.2; }
.page-subtitle { color: var(--ink-muted); margin: 0.25rem 0 0; max-width: 70ch; }
.breadcrumb { --bs-breadcrumb-divider-color: var(--ink-faint); --bs-breadcrumb-item-active-color: var(--ink-muted); font-size: 0.82rem; margin-bottom: 0.5rem; }
.breadcrumb a { color: var(--ink-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }

.card {
  --bs-card-border-color: var(--line);
  --bs-card-border-radius: var(--radius-lg);
  --bs-card-inner-border-radius: calc(var(--radius-lg) - 1px);
  --bs-card-cap-bg: transparent;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.card-header { border-bottom-color: var(--line-soft); padding: 0.85rem 1.1rem; font-weight: 700; font-size: 0.95rem; }
.card-header a, .card-header .small { font-weight: 600; }
.card-body { padding: 1.1rem; }
.panel-note { background: #fff8eb; border: 1px solid #f6e3bc; border-radius: var(--radius); padding: 1rem 1.15rem; font-size: 0.88rem; }
.panel-note h2 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.5rem; }

/* ------------------------------------------------------------------
   KPI tiles (dashboard top row)
   ------------------------------------------------------------------ */
.kpi-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
@media (max-width: 1399.98px) { .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; } }
.kpi {
  position: relative;
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem 0.7rem;
  color: #fff;
  min-height: 94px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-decoration: none;
}
.kpi::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -26px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}
.kpi-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.9; }
.kpi-value { font-size: 1.45rem; font-weight: 800; line-height: 1.15; margin-top: 0.2rem; font-variant-numeric: tabular-nums; }
.kpi-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; font-size: 0.72rem; opacity: 0.9; gap: 0.5rem; }
.kpi-foot .bi { font-size: 1.15rem; opacity: 0.85; }
.kpi-chip { background: rgba(255, 255, 255, 0.18); border-radius: 999px; padding: 0.05rem 0.45rem; font-weight: 600; white-space: nowrap; }
.kpi-navy { background: var(--k-navy); }
.kpi-teal { background: var(--k-teal); }
.kpi-orange { background: var(--k-orange); }
.kpi-red { background: var(--k-red); }
.kpi-maroon { background: var(--k-maroon); }
.kpi-purple { background: var(--k-purple); }
.kpi-amber { background: var(--k-amber); }
.kpi-green { background: var(--k-green); }

/* ------------------------------------------------------------------
   Module summary cards (Fees / Students / HR)
   ------------------------------------------------------------------ */
.module-card { display: flex; flex-direction: column; height: 100%; }
.module-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line-soft);
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
}
.module-head h2 { font-size: 0.95rem; font-weight: 700; margin: 0; }
.module-head .head-icon { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 0.95rem; }
.module-head a { margin-left: auto; font-size: 0.8rem; font-weight: 600; text-decoration: none; }
.tint-red { background: #fdf1f1; } .tint-red .head-icon { background: var(--k-red); }
.tint-blue { background: #eef2fb; } .tint-blue .head-icon { background: var(--k-navy); }
.tint-green { background: #ecf7f3; } .tint-green .head-icon { background: var(--k-green); }

.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); text-align: center; padding: 0.85rem 0.5rem 0.6rem; }
.mini-stats.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mini-stat-value { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.mini-stat-label { font-size: 0.66rem; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.v-green { color: var(--ok); } .v-red { color: var(--danger); } .v-blue { color: var(--c1); } .v-muted { color: var(--ink-faint); }

.module-tabs { margin: 0 1rem; background: var(--surface-muted); border-radius: var(--radius-sm); padding: 3px; display: flex; gap: 2px; }
.module-tabs .nav-link {
  flex: 1;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
  border-radius: 5px;
  padding: 0.3rem 0.5rem;
  border: 0;
  background: transparent;
}
.module-tabs .nav-link.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08); }
.module-pane { padding: 0.85rem 1rem; font-size: 0.82rem; flex: 1; }

.split-row { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 0.25rem; }
.meter { height: 6px; background: var(--line-soft); border-radius: 999px; overflow: hidden; margin-bottom: 0.75rem; }
.meter > span { display: block; height: 100%; border-radius: 999px; }
.meter-blue > span { background: var(--c1); }
.meter-red > span { background: var(--c4); }
.meter-green > span { background: var(--c2); }
.meter-amber > span { background: var(--c3); }

.notice { display: flex; gap: 0.5rem; align-items: flex-start; background: #fff8eb; border: 1px solid #f6e3bc; color: #7a4f0a; border-radius: var(--radius-sm); padding: 0.45rem 0.6rem; font-size: 0.78rem; }
.notice-info { background: var(--primary-soft); border-color: #d9d5fb; color: #3a34a8; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; gap: 0.55rem; padding: 0.35rem 0; border-bottom: 1px dashed var(--line-soft); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .who { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list .when { margin-left: auto; color: var(--ink-faint); font-size: 0.74rem; white-space: nowrap; }

.quick-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.7rem 1rem 0.9rem; border-top: 1px solid var(--line-soft); }
.quick-actions .btn { font-size: 0.74rem; padding: 0.3rem 0.55rem; font-weight: 600; }
.quick-actions .btn .bi { margin-right: 0.25rem; }
.quick-actions .btn:disabled { color: var(--ink-faint); border-color: var(--line); background: var(--surface-muted); opacity: 1; }

/* ------------------------------------------------------------------
   Charts
   ------------------------------------------------------------------ */
.chart-box { position: relative; }
.chart-fallback { font-size: 0.82rem; }
.chart-fallback[hidden] { display: none !important; }
.chart-caption { font-size: 0.75rem; color: var(--ink-faint); font-weight: 500; margin-left: 0.35rem; }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.donut-center strong { font-size: 1.35rem; font-weight: 800; line-height: 1; }
.donut-center span { font-size: 0.7rem; color: var(--ink-muted); }
.analytics-tile { border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 0.75rem 0.85rem; height: 100%; background: var(--surface); }
.analytics-tile-stack { height: auto; flex: 1; }
.analytics-tile h3 { font-size: 0.82rem; font-weight: 700; margin: 0 0 0.5rem; display: flex; align-items: center; justify-content: space-between; }
.analytics-tile h3 .bi { color: var(--ink-faint); }

/* Plain-HTML bars (fallback + simple charts) */
.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.bar-row { display: grid; grid-template-columns: 7rem 1fr 2.5rem; align-items: center; gap: 0.6rem; font-size: 0.82rem; }
.bar-label { font-weight: 600; }
.bar-track { display: block; height: 8px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 0.4rem; vertical-align: -1px; }

/* AI assistant panel */
.ai-panel { background: linear-gradient(160deg, #2c2766 0%, var(--ai-bg) 70%); color: #e7e5ff; border: 0; height: 100%; }
.ai-panel .card-header { border-bottom-color: rgba(255, 255, 255, 0.1); color: #fff; }
.ai-panel .ai-sub { font-size: 0.75rem; color: #b7b3ef; font-weight: 500; }
.ai-panel .ai-sub-head { color: var(--k-amber); }
.ai-prompt { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.ai-prompt:last-child { border-bottom: 0; }
.ai-prompt .ai-icon { width: 34px; height: 34px; border-radius: 9px; background: rgba(255, 255, 255, 0.1); display: inline-flex; align-items: center; justify-content: center; color: var(--k-amber); flex-shrink: 0; }
.ai-prompt .ai-text { font-weight: 600; font-size: 0.85rem; color: #fff; }
.ai-prompt .btn { white-space: nowrap; flex-shrink: 0; margin-left: auto; font-size: 0.72rem; padding: 0.25rem 0.6rem; color: #e7e5ff; border-color: rgba(255, 255, 255, 0.25); }
.ai-panel .ai-note { font-size: 0.75rem; color: #b7b3ef; }

/* ------------------------------------------------------------------
   Lists, tables, filters
   ------------------------------------------------------------------ */
.filter-bar { padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--line-soft); background: var(--surface-muted); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.table { --bs-table-bg: transparent; --bs-table-hover-bg: #f9fafb; --bs-table-border-color: var(--line-soft); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 0.7rem 1.1rem; }
.table thead th { font-size: 0.72rem; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-muted); border-bottom: 1px solid var(--line); white-space: nowrap; }

.person { display: flex; align-items: center; gap: 0.7rem; min-width: 12rem; }
.person-initials { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-deep); font-size: 0.72rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.person-name { font-weight: 600; line-height: 1.2; }
.person-email { color: var(--ink-muted); font-size: 0.8rem; overflow-wrap: break-word; word-break: break-word; }

.status { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 600; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-active { color: var(--ok); }
.status-inactive { color: var(--ink-faint); }

.role-tag { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 0.18rem 0.55rem; border-radius: 999px; white-space: nowrap; }
.role-SCHOOL_ADMIN { background: var(--primary-soft); color: var(--primary-deep); }
.role-TEACHER { background: #e4f4f1; color: #0d6e5e; }
.role-STUDENT { background: #e8effc; color: #1f55b5; }
.role-PARENT { background: #fdf2e1; color: #93600e; }
.role-ACCOUNTANT { background: #fbe9ec; color: #a53349; }

.pagination { --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary); --bs-pagination-color: var(--ink); }

/* Neutral register strip (platform pages) */
.register { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1.25rem; }
.register-cell { padding: 1rem 1.1rem; border-left: 1px solid var(--line-soft); min-width: 0; }
.register-cell:first-child { border-left: 0; }
.register-value { font-weight: 800; font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.register-value.is-text { font-size: 1.15rem; padding-top: 0.3rem; }
.register-label { color: var(--ink-muted); font-size: 0.8rem; margin-top: 0.3rem; }
.register-cell.is-highlight { background: var(--primary-soft); }
@media (max-width: 767.98px) {
  .register { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .register-cell:nth-child(odd) { border-left: 0; }
  .register-cell:nth-child(n + 3) { border-top: 1px solid var(--line-soft); }
  .register-cell:last-child:nth-child(odd) { grid-column: span 2; }
}

/* Empty states */
.empty-state { text-align: center; padding: 2.5rem 1.5rem; color: var(--ink-muted); }
.empty-state .bi { font-size: 1.6rem; color: var(--primary); background: var(--primary-soft); width: 56px; height: 56px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.empty-state h1, .empty-state h2 { font-size: 1.1rem; font-weight: 700; color: var(--ink); margin: 0.9rem 0 0.35rem; }
.empty-state p { max-width: 46ch; margin: 0 auto 1rem; }

.alert { border-radius: var(--radius); font-weight: 500; }
.alert-success { background: #e9f6f0; border-color: #c3e6d6; color: #0d5c41; }
.alert-danger { background: #fcecec; border-color: #f1cdcb; color: #8f2d28; }
.alert-info { background: var(--primary-soft); border-color: #d9d5fb; color: var(--primary-deep); }
.alert-warning { background: #fff8eb; border-color: #f6e3bc; color: #7a4f0a; }

/* Member dashboard tiles */
.module-tile { border: 1px dashed var(--line); border-radius: var(--radius); padding: 1rem; height: 100%; background: var(--surface-muted); }
.module-tile .bi { font-size: 1.2rem; color: var(--primary); }
.module-tile .module-name { font-weight: 700; margin-top: 0.45rem; }
.module-tile .module-phase { font-size: 0.78rem; color: var(--ink-muted); }

/* School chooser */
.choice-list { display: grid; gap: 0.6rem; }
.choice { width: 100%; display: flex; align-items: center; gap: 1rem; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; color: var(--ink); }
.choice:hover { border-color: var(--primary); }
.choice.is-current { border-color: var(--primary); box-shadow: inset 4px 0 0 var(--primary); }
.choice-school { font-weight: 700; font-size: 1rem; }
.choice-meta { color: var(--ink-muted); font-size: 0.82rem; }

.facts { display: grid; grid-template-columns: 9rem 1fr; gap: 0.55rem 1rem; margin: 0; }
.facts dt { color: var(--ink-muted); font-weight: 500; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 575.98px) { .facts { grid-template-columns: 1fr; gap: 0.15rem; } .facts dd { margin-bottom: 0.6rem; } }

.school-logo { width: 80px; height: 80px; border-radius: var(--radius); border: 1px solid var(--line); object-fit: contain; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.8rem; color: var(--primary); flex-shrink: 0; }

/* ------------------------------------------------------------------
   Sign-in
   ------------------------------------------------------------------ */
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-board {
  background: var(--side-bg);
  background-image: radial-gradient(ellipse at 20% 10%, rgba(124, 118, 230, 0.25), transparent 55%), radial-gradient(ellipse at 90% 100%, rgba(0, 0, 0, 0.3), transparent 60%);
  color: var(--side-text);
  padding: 2.5rem 3rem;
  display: flex;
  flex-direction: column;
}
.auth-board .board-copy { margin: auto 0; max-width: 32rem; padding: 2rem 0; }
.auth-board .board-title { font-weight: 800; font-size: clamp(1.9rem, 1.2rem + 2.2vw, 3rem); line-height: 1.08; color: #fff; letter-spacing: -0.025em; margin-bottom: 1.1rem; }
.auth-board .board-lede { color: #aeb5c0; font-size: 1rem; max-width: 30rem; }
.board-subjects { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; max-width: 28rem; }
.board-subjects li { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: var(--radius); padding: 0.6rem 0.75rem; font-size: 0.85rem; color: #e2e5ea; display: flex; align-items: center; gap: 0.5rem; }
.board-subjects li .bi { color: #a9a4f7; }
.board-ledge { display: none; }
.auth-paper { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; background: var(--canvas); }
.auth-form { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 2rem; box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06); }
.auth-form h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.3rem; }
.auth-form .lede { color: var(--ink-muted); margin-bottom: 1.5rem; }
.auth-form .btn-primary { padding: 0.65rem 1rem; }
@media (max-width: 991.98px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-board { padding: 1.5rem; }
  .auth-board .board-copy { padding: 1.25rem 0 0.5rem; }
  .auth-board .board-title { font-size: 1.7rem; }
  .board-subjects { display: none; }
  .auth-form { padding: 1.5rem; }
}

/* ------------------------------------------------------------------
   Accessibility
   ------------------------------------------------------------------ */
:focus-visible { outline: 3px solid rgba(124, 118, 230, 0.75); outline-offset: 2px; }
.skip-link { position: absolute; left: -999px; top: 0.5rem; z-index: 2000; }
.skip-link:focus { left: 0.5rem; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ------------------------------------------------------------------
   Print (receipts, report cards, timetables, reports)
   ------------------------------------------------------------------ */
.timetable td, .timetable th { min-width: 120px; vertical-align: top; }
.print-only { display: none; }
.doc-sheet { max-width: 820px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 2rem; }
.doc-sheet .doc-head { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--ink); padding-bottom: 0.75rem; margin-bottom: 1rem; }
.doc-sheet .doc-school { font-size: 1.25rem; font-weight: 800; }
.doc-sheet table th, .doc-sheet table td { padding: 0.45rem 0.6rem; }
@media print {
  @page { margin: 12mm; }
  body { background: #fff; font-size: 11pt; }
  .erp-sidebar, .erp-topbar, .no-print, .breadcrumb, .alert, .skip-link { display: none !important; }
  .print-only { display: block; }
  .erp-main { padding: 0 !important; }
  .card, .doc-sheet { border: 0 !important; box-shadow: none !important; }
  a { color: inherit; text-decoration: none; }
}

/* Attendance */
.att-group .btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink-muted); font-weight: 600; min-width: 4.2rem; }
.btn-check:checked + .att-P { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-check:checked + .att-A { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-check:checked + .att-L { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-check:checked + .att-V { background: var(--k-purple); border-color: var(--k-purple); color: #fff; }
.att-matrix td, .att-matrix th { padding: 0.25rem 0.35rem; }
.att-cell-A { background: #fcecec; color: var(--danger); font-weight: 700; }
.att-cell-L { background: #fff8eb; color: var(--warn); font-weight: 700; }
.att-cell-V { background: #f1ebfb; color: var(--k-purple); font-weight: 700; }
.att-cell-P { color: var(--ok); }

/* Homework status chips */
.hw-status { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 0.18rem 0.55rem; border-radius: 999px; white-space: nowrap; }
.hw-pending { background: #e8effc; color: #1f55b5; }
.hw-overdue { background: #fbe9ec; color: #a53349; }
.hw-submitted { background: #fdf2e1; color: #93600e; }
.hw-resubmit { background: #f1ebfb; color: #5a3d8a; }
.hw-reviewed { background: #e4f4f1; color: #0d6e5e; }
.ai-panel .btn-outline-light { --bs-btn-color: #e7e5ff; --bs-btn-border-color: rgba(255,255,255,.3); }

/* ---------- Notifications ---------- */
.notif-item { display: flex; gap: 0.6rem; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0; padding: 0.25rem 0; color: inherit; }
.notif-item:hover .fw-semibold { color: var(--primary); }
.notif-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; margin-top: 0.45rem; flex: none; background: transparent; }
.notif-unread { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.notif-unread .notif-dot { background: var(--primary); }
.bell-count { position: absolute; top: 2px; right: 2px; min-width: 1.1rem; height: 1.1rem; padding: 0 0.25rem; border-radius: 999px; background: var(--danger, #dc3545); color: #fff; font-size: 0.65rem; font-weight: 700; line-height: 1.1rem; text-align: center; }
.tool-btn { position: relative; }
.notif-menu { width: 330px; max-height: 420px; overflow-y: auto; }
.notif-menu .notif-item { padding: 0.45rem 0.75rem; font-size: 0.85rem; }
.notif-menu .notif-item:hover { background: var(--bs-tertiary-bg, #f4f5f7); }

/* ---------- AI ---------- */
.ai-output { white-space: pre-wrap; }
.chat-log { display: flex; flex-direction: column; gap: 0.75rem; max-height: 60vh; overflow-y: auto; padding: 1rem; }
.chat-msg { max-width: 85%; padding: 0.6rem 0.85rem; border-radius: 0.75rem; white-space: pre-wrap; font-size: 0.92rem; }
.chat-msg.me { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 0.2rem; }
.chat-msg.ai { align-self: flex-start; background: var(--bs-tertiary-bg, #f1f2f6); border-bottom-left-radius: 0.2rem; }
.quiz-q { border-left: 3px solid var(--primary); padding-left: 0.75rem; margin-bottom: 1rem; }

/* ---------- Make fee (fee counter) ---------- */
.fee-block { overflow: hidden; }
.fee-bar { background: #2563eb; color: #fff; font-weight: 700; font-size: 1.05rem; padding: 0.85rem 1.1rem; }
.fee-bar .req { color: #ffd1d1; font-weight: 500; font-size: 0.8rem; margin-left: 0.4rem; }
.head-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0; font-size: 0.98rem; }
.head-item .form-check-input { margin: 0; flex: none; }
.head-item .disc-tag { margin-left: auto; }
.head-item.is-paid label, .month-item.is-paid label { color: #3f9a6c; }
.month-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.65rem 1.25rem; }
@media (max-width: 767px) { .month-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.month-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.98rem; }
.month-item .form-check-input { margin: 0; flex: none; }
.month-item .tick { color: #2e9e64; }
#monthsBlock.is-off .month-grid { opacity: 0.45; }
.paid-tag { background: #1f9d55; color: #fff; font-size: 0.72rem; font-weight: 700; border-radius: 0.3rem; padding: 0.12rem 0.45rem; }
.due-tag { background: #e8effc; color: #1f55b5; font-size: 0.72rem; font-weight: 700; border-radius: 0.3rem; padding: 0.12rem 0.45rem; }
.part-tag { background: #fdf2e1; color: #93600e; font-size: 0.72rem; font-weight: 700; border-radius: 0.3rem; padding: 0.12rem 0.45rem; }
.late-tag { background: #fde8e8; color: #b42318; font-size: 0.72rem; font-weight: 700; border-radius: 0.3rem; padding: 0.12rem 0.45rem; }
.disc-tag { background: #2f80ed; color: #fff; font-size: 0.75rem; font-weight: 700; border-radius: 0.35rem; padding: 0.15rem 0.5rem; }
.sel-pill { background: linear-gradient(135deg, #6d28d9, #2563eb); color: #fff; font-weight: 700; border-radius: 0.8rem; padding: 0.7rem 1.4rem; box-shadow: 0 6px 16px rgba(76, 52, 200, .3); }
.sel-heads { background: #1f9d55; color: #fff; font-weight: 700; font-size: 0.8rem; border-radius: 0.35rem; padding: 0.2rem 0.5rem; }
.late-input { max-width: 8rem; margin-left: auto; }

/* ---------- Student fee receipts ---------- */
.row-picked td:first-child { box-shadow: inset 3px 0 0 #2563eb; }
.chip { display: inline-block; font-size: 0.78rem; font-weight: 700; border-radius: 0.35rem; padding: 0.15rem 0.55rem; }
.chip-blue { background: #e8effc; color: #1f55b5; }
.chip-green { background: #e4f4ec; color: #146c43; }
.chip-amber { background: #fdf2c9; color: #8a5a00; }
.receipts-card { overflow: hidden; }
.receipts-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem;
                 background: linear-gradient(90deg, #1e5bb5, #4a8ac9); color: #fff; padding: 1.4rem 1.2rem; }
.receipts-head .title { font-weight: 700; font-size: 1.15rem; }
.receipts-head .sub { font-size: 0.85rem; opacity: .85; }
.receipts-head .pill { background: rgba(255,255,255,.2); color: #fff; font-weight: 700; font-size: 0.85rem; border-radius: 0.45rem; padding: 0.4rem 0.75rem; text-decoration: none; }
.receipts-head .pill-action { background: #fff; color: #1e5bb5; }
.found { background: #eefaf3; border: 1px solid #b7e2c8; color: #146c43; font-weight: 700; border-radius: 0.5rem; padding: 0.8rem 1rem; margin-bottom: 1rem; }
.receipts-table th { text-transform: uppercase; font-size: 0.78rem; letter-spacing: .3px; }
.btn-print { background: linear-gradient(135deg, #1e5bb5, #4a8ac9); color: #fff; font-weight: 700; border: 0; }
.btn-print:hover { color: #fff; filter: brightness(1.05); }

/* Make fee: live fee details */
.fee-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.25rem, 1fr)); gap: 0.6rem; }
.fee-totals > div { background: var(--bs-tertiary-bg, #f4f6fb); border-radius: 0.55rem; padding: 0.6rem 0.8rem; display: flex; flex-direction: column; gap: 0.15rem; }
.fee-totals span { font-size: 0.8rem; color: var(--bs-secondary-color, #5b6475); }
.fee-totals strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.fee-totals .is-minus strong { color: #1f9d55; }
.fee-totals .is-late strong { color: #b42318; }
.fee-totals .is-total { background: linear-gradient(135deg, #6d28d9, #2563eb); }
.fee-totals .is-total span, .fee-totals .is-total strong { color: #fff; }
.head-item .tick { color: #2e9e64; }

/* All students list */
.student-table th { white-space: nowrap; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .3px; }
@media print { .student-table .person-initials { display: none; } .student-table td, .student-table th { padding: 0.25rem 0.4rem; font-size: 9pt; } }
.disc-sub { font-weight: 700; color: #1f55b5; border-top: 1px dashed var(--line, #dfe3ec); padding-top: 0.85rem; margin-top: 0.25rem; }
.disc-tag.disc-late { background: #d9480f; }
.fee-bar-link { float: right; color: #fff; font-size: 0.82rem; font-weight: 600; opacity: .9; text-decoration: underline; }
.student-table td:nth-child(2), .student-table td:nth-child(4), .student-table code { white-space: nowrap; }
.student-table { font-size: 0.9rem; }
.student-table > :not(caption) > * > * { padding: 0.55rem 0.5rem; }
.student-table .person-initials { width: 1.9rem; height: 1.9rem; font-size: 0.72rem; }
.student-table code { font-size: 0.78rem; }
.waived-tag { background: #e4f4ec; color: #146c43; font-size: 0.72rem; font-weight: 700; border-radius: 0.3rem; padding: 0.12rem 0.45rem; }
