:root {
  --erp-primary: #0d6e6e;
  --erp-primary-dark: #0a5252;
  --erp-accent: #e8a838;
  --erp-sidebar-width: 260px;
  --erp-bg: #f0f3f7;
  --erp-surface: #ffffff;
  --erp-text: #1a2332;
  --erp-muted: #6b7a90;
  --erp-border: #e2e8f0;
  --erp-success: #198754;
  --erp-danger: #dc3545;
  --erp-warning: #e8a838;
  --erp-info: #0dcaf0;
  --erp-radius: 12px;
  --erp-shadow: 0 4px 20px rgba(16, 40, 60, 0.06);
}

[data-bs-theme="dark"] {
  --erp-bg: #0f1419;
  --erp-surface: #1a222d;
  --erp-text: #e8eef5;
  --erp-muted: #8b9bb0;
  --erp-border: #2a3544;
  --erp-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body.erp-body {
  margin: 0;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  background: var(--erp-bg);
  color: var(--erp-text);
  min-height: 100vh;
}

.erp-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--erp-sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, #0d6e6e 0%, #0a4a4a 100%);
  color: #fff;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
  overflow: hidden;
}

[data-bs-theme="dark"] .erp-sidebar {
  background: linear-gradient(180deg, #0a3d3d 0%, #061f1f 100%);
}

.erp-brand {
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  text-decoration: none;
  color: #fff;
}

.erp-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,.15);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .5px;
}

.erp-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.erp-brand-text strong { font-size: .95rem; }
.erp-brand-text small { opacity: .75; font-size: .7rem; }

.erp-nav {
  flex: 1;
  overflow-y: auto;
  padding: .75rem 0 1.5rem;
}

.erp-nav-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem 1.25rem;
  color: rgba(255,255,255,.82);
  text-decoration: none;
  font-size: .9rem;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}

.erp-nav-link:hover,
.erp-nav-link.active {
  background: rgba(255,255,255,.1);
  color: #fff;
  border-left-color: var(--erp-accent);
}

.erp-nav-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; }

.erp-nav-group {
  padding: .85rem 1.25rem .35rem;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .55;
  font-weight: 600;
}

.erp-nav-sub .erp-nav-link {
  padding-left: 2.6rem;
  font-size: .85rem;
}

.erp-main {
  margin-left: var(--erp-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.erp-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--erp-surface);
  border-bottom: 1px solid var(--erp-border);
  padding: .7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--erp-shadow);
}

.erp-content {
  padding: 1.25rem;
  flex: 1;
}

.erp-stat-card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: var(--erp-radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--erp-shadow);
  height: 100%;
  transition: transform .2s ease, box-shadow .2s ease;
  animation: erpFadeUp .45s ease both;
}

.erp-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(16, 40, 60, 0.1);
}

.erp-stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  color: #fff;
}

.erp-stat-card .stat-value {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: .35rem;
}

.erp-stat-card .stat-label {
  color: var(--erp-muted);
  font-size: .8rem;
  margin-top: .15rem;
}

.bg-teal { background: #0d6e6e !important; }
.bg-gold { background: #e8a838 !important; }
.bg-coral { background: #e05a4e !important; }
.bg-indigo { background: #4f6bed !important; }
.bg-emerald { background: #1a9c6c !important; }
.bg-slate { background: #5a6a7e !important; }

.erp-card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: var(--erp-radius);
  box-shadow: var(--erp-shadow);
  animation: erpFadeUp .5s ease both;
}

.erp-card .card-header {
  background: transparent;
  border-bottom: 1px solid var(--erp-border);
  font-weight: 600;
  padding: .9rem 1.15rem;
}

.erp-card .card-body { padding: 1.15rem; }

.erp-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  padding: 1rem .5rem;
  border-radius: 12px;
  border: 1px dashed var(--erp-border);
  background: var(--erp-surface);
  color: var(--erp-text);
  text-decoration: none;
  transition: all .2s;
  height: 100%;
}

.erp-quick-btn:hover {
  border-color: var(--erp-primary);
  color: var(--erp-primary);
  background: rgba(13, 110, 110, 0.06);
  transform: translateY(-2px);
}

.erp-quick-btn i { font-size: 1.4rem; }

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

.session-badge {
  background: rgba(13, 110, 110, .12);
  color: var(--erp-primary);
  border-radius: 999px;
  padding: .25rem .7rem;
  font-size: .78rem;
  font-weight: 600;
}

[data-bs-theme="dark"] .session-badge {
  background: rgba(232, 168, 56, .15);
  color: var(--erp-accent);
}

@keyframes erpFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.erp-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1035;
}

@media (max-width: 991.98px) {
  .erp-sidebar {
    transform: translateX(-100%);
  }
  .erp-sidebar.show {
    transform: translateX(0);
  }
  .erp-sidebar-overlay.show {
    display: block;
  }
  .erp-main {
    margin-left: 0;
  }
}

.table-erp > :not(caption) > * > * {
  background: transparent;
  color: var(--erp-text);
  border-color: var(--erp-border);
}

.form-control, .form-select {
  background: var(--erp-surface);
  color: var(--erp-text);
  border-color: var(--erp-border);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(13,110,110,.25), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(232,168,56,.2), transparent 45%),
    linear-gradient(145deg, #0a3d3d 0%, #103741 45%, #1a2332 100%);
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--erp-surface);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: erpFadeUp .5s ease both;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0d6e6e, #0a5252);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.1rem;
  margin: 0 auto 1rem;
}

/* ── Page Hero ─────────────────────────────────────── */
.erp-page-hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--erp-border);
  background: var(--erp-surface);
}
.erp-page-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(13,110,110,.12) 0%, rgba(232,168,56,.08) 50%, transparent 100%);
  pointer-events: none;
}
[data-bs-theme="dark"] .erp-page-hero-bg {
  background: linear-gradient(135deg, rgba(13,110,110,.2) 0%, rgba(232,168,56,.1) 100%);
}
.erp-page-hero-content { position: relative; z-index: 1; }
.erp-page-hero-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, var(--erp-primary), var(--erp-primary-dark));
  color: #fff; display: grid; place-items: center; font-size: 1.4rem;
  box-shadow: 0 8px 20px rgba(13,110,110,.25);
}
.erp-page-hero-title { font-size: 1.35rem; font-weight: 700; }
.erp-page-hero-sub { font-size: .85rem; color: var(--erp-muted); margin-top: .15rem; }

/* ── Mini stat strip ─────────────────────────────── */
.erp-mini-stats { display: flex; flex-wrap: wrap; gap: .75rem; }
.erp-mini-stat {
  flex: 1; min-width: 120px; padding: .85rem 1rem;
  border-radius: 12px; border: 1px solid var(--erp-border);
  background: var(--erp-surface); text-align: center;
}
.erp-mini-stat .val { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.erp-mini-stat .lbl { font-size: .72rem; color: var(--erp-muted); text-transform: uppercase; letter-spacing: .04em; }
.erp-mini-stat.present .val { color: #198754; }
.erp-mini-stat.absent .val { color: #dc3545; }
.erp-mini-stat.late .val { color: #e8a838; }
.erp-mini-stat.money .val { color: var(--erp-primary); }

/* ── Attendance grid ───────────────────────────────── */
.attendance-sheet { border-radius: 12px; overflow: hidden; }
.att-row {
  display: grid; grid-template-columns: 48px 1fr auto;
  gap: .75rem; align-items: center; padding: .65rem 1rem;
  border-bottom: 1px solid var(--erp-border);
  transition: background .15s;
}
.att-row:hover { background: rgba(13,110,110,.04); }
.att-row .att-photo {
  width: 40px; height: 40px; border-radius: 10px; object-fit: cover;
  background: var(--erp-border);
}
.att-status-group { display: flex; gap: .35rem; flex-wrap: wrap; }
.att-btn {
  border: 2px solid var(--erp-border); background: var(--erp-surface);
  border-radius: 8px; padding: .35rem .65rem; font-size: .75rem; font-weight: 600;
  cursor: pointer; transition: all .15s; color: var(--erp-muted);
}
.att-btn:hover { border-color: var(--erp-primary); color: var(--erp-primary); }
.att-btn.active[data-status="present"] { background: #198754; border-color: #198754; color: #fff; }
.att-btn.active[data-status="absent"] { background: #dc3545; border-color: #dc3545; color: #fff; }
.att-btn.active[data-status="late"] { background: #e8a838; border-color: #e8a838; color: #fff; }
.att-btn.active[data-status="leave"] { background: #6c757d; border-color: #6c757d; color: #fff; }
.att-toolbar {
  position: sticky; top: 60px; z-index: 10;
  background: var(--erp-surface); border: 1px solid var(--erp-border);
  border-radius: 12px; padding: .75rem 1rem; margin-bottom: 1rem;
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  box-shadow: var(--erp-shadow);
}
.att-bulk-btn { font-size: .78rem; padding: .3rem .6rem; }

/* ── Notice cards ──────────────────────────────────── */
.notice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.notice-card {
  border-radius: 14px; border: 1px solid var(--erp-border);
  background: var(--erp-surface); overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  text-decoration: none; color: inherit; display: block;
}
.notice-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(16,40,60,.1);
  color: inherit;
}
.notice-card-accent { height: 4px; }
.notice-card-accent.cat-student { background: #0d6efd; }
.notice-card-accent.cat-teacher { background: #4f6bed; }
.notice-card-accent.cat-parents { background: #198754; }
.notice-card-accent.cat-general { background: #6c757d; }
.notice-card-accent.cat-important { background: #dc3545; }
.notice-card-body { padding: 1.1rem 1.2rem; }
.notice-card-title { font-weight: 600; font-size: 1rem; margin-bottom: .4rem; line-height: 1.35; }
.notice-card-meta { font-size: .75rem; color: var(--erp-muted); display: flex; gap: .75rem; flex-wrap: wrap; }
.notice-pill {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .68rem; font-weight: 600; padding: .2rem .5rem;
  border-radius: 999px; text-transform: uppercase; letter-spacing: .03em;
}
.notice-filter-pills { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.notice-filter-pills a {
  padding: .4rem .85rem; border-radius: 999px; font-size: .8rem; font-weight: 500;
  border: 1px solid var(--erp-border); text-decoration: none; color: var(--erp-text);
  transition: all .15s;
}
.notice-filter-pills a:hover, .notice-filter-pills a.active {
  background: var(--erp-primary); border-color: var(--erp-primary); color: #fff;
}

/* ── Fee collect UI ────────────────────────────────── */
.fee-student-card {
  border-radius: 16px; padding: 1.25rem;
  background: linear-gradient(135deg, rgba(13,110,110,.08), rgba(232,168,56,.06));
  border: 1px solid var(--erp-border);
}
.fee-line {
  display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem;
  border: 1px solid var(--erp-border); border-radius: 10px; margin-bottom: .5rem;
  background: var(--erp-surface); transition: border-color .15s;
}
.fee-line:has(input:checked) { border-color: var(--erp-primary); background: rgba(13,110,110,.04); }
.fee-line .fee-amount { font-weight: 700; color: var(--erp-primary); min-width: 80px; text-align: right; }
.fee-search-wrap {
  max-width: 480px; margin: 0 auto 1.5rem;
}
.fee-search-wrap .input-group { box-shadow: 0 8px 24px rgba(16,40,60,.08); border-radius: 12px; overflow: hidden; }
.fee-search-wrap .form-control { border: none; padding: .85rem 1rem; font-size: 1rem; }

/* ── Receipt print ─────────────────────────────────── */
.receipt-wrap { max-width: 400px; margin: 2rem auto; padding: 1.5rem; border: 2px dashed var(--erp-border); border-radius: 12px; }
@media print {
  .no-print { display: none !important; }
  .receipt-wrap { border: none; margin: 0; max-width: 100%; }
}

/* ── Category tabs ─────────────────────────────────── */
.erp-tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--erp-border); margin-bottom: 1.25rem; }
.erp-tabs a {
  padding: .6rem 1rem; text-decoration: none; color: var(--erp-muted);
  font-weight: 500; font-size: .9rem; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color .15s;
}
.erp-tabs a:hover, .erp-tabs a.active { color: var(--erp-primary); border-bottom-color: var(--erp-primary); }
