/* ============================================================================
   SCHOOL ERP — DESIGN SYSTEM
   Mobile-first, accessible, printable. Built on top of Bootstrap 5 utilities.
   ============================================================================ */

:root {
  --erp-primary: #1a4d8f;      /* deep academic blue */
  --erp-primary-dark: #123a6b;
  --erp-accent: #e8912d;       /* warm accent (marigold) */
  --erp-success: #1c8a5a;
  --erp-danger: #c0392b;
  --erp-warning: #c9860a;
  --erp-bg: #f4f6f9;
  --erp-surface: #ffffff;
  --erp-border: #e1e5eb;
  --erp-text: #202733;
  --erp-text-muted: #667085;
  --erp-radius: 10px;
  --erp-sidebar-width: 250px;
  --erp-topbar-height: 60px;
  --erp-font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--erp-font);
  background: var(--erp-bg);
  color: var(--erp-text);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

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

.erp-sidebar {
  width: var(--erp-sidebar-width);
  background: linear-gradient(180deg, var(--erp-primary-dark), var(--erp-primary));
  color: #fff;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  transition: transform .25s ease;
  z-index: 1030;
}
.erp-sidebar .brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1rem 1.1rem;
  font-weight: 700; font-size: 1.05rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.erp-sidebar .brand img { height: 32px; width: 32px; border-radius: 6px; background: #fff; }
.erp-nav-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .65rem 1.1rem;
  color: rgba(255,255,255,.85);
  font-size: .92rem;
  border-left: 3px solid transparent;
}
.erp-nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.erp-nav-link.active {
  background: rgba(255,255,255,.14);
  border-left-color: var(--erp-accent);
  color: #fff;
  font-weight: 600;
}
.erp-nav-section-title {
  padding: 1rem 1.1rem .35rem;
  font-size: .7rem; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255,255,255,.5);
}

.erp-main { flex: 1; margin-left: var(--erp-sidebar-width); min-width: 0; }

.erp-topbar {
  height: var(--erp-topbar-height);
  background: var(--erp-surface);
  border-bottom: 1px solid var(--erp-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky; top: 0; z-index: 1020;
}
.erp-topbar .menu-toggle { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--erp-text); }

.erp-content { padding: 1.25rem; max-width: 1400px; margin: 0 auto; }

/* ---------- Cards / panels ---------- */
.erp-card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: var(--erp-radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.erp-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; flex-wrap: wrap; gap: .5rem;
}
.erp-card-header h2, .erp-card-header h3 { margin: 0; font-size: 1.1rem; font-weight: 700; }

.stat-card {
  background: var(--erp-surface);
  border-radius: var(--erp-radius);
  border: 1px solid var(--erp-border);
  padding: 1.1rem;
  display: flex; align-items: center; gap: .9rem;
}
.stat-card .icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff; flex-shrink: 0;
}
.stat-card .value { font-size: 1.4rem; font-weight: 800; line-height: 1.1; }
.stat-card .label { color: var(--erp-text-muted); font-size: .82rem; }

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

/* ---------- Tables ---------- */
.erp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.erp-table { width: 100%; border-collapse: collapse; font-size: .89rem; }
table.erp-table th {
  background: #f8f9fb; text-align: left; padding: .65rem .75rem;
  border-bottom: 2px solid var(--erp-border); white-space: nowrap;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--erp-text-muted);
}
table.erp-table td { padding: .65rem .75rem; border-bottom: 1px solid var(--erp-border); vertical-align: middle; }
table.erp-table tbody tr:hover { background: #f9fafc; }

.badge-status { padding: .3em .6em; border-radius: 20px; font-size: .74rem; font-weight: 600; }
.badge-active, .badge-paid, .badge-present { background: #e3f5ec; color: var(--erp-success); }
.badge-inactive, .badge-absent { background: #fdeceb; color: var(--erp-danger); }
.badge-pending, .badge-partial, .badge-late { background: #fdf3e2; color: var(--erp-warning); }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: .86rem; margin-bottom: .3rem; }
.form-section-title {
  font-weight: 700; font-size: .95rem; color: var(--erp-primary);
  margin: 1.25rem 0 .75rem; padding-bottom: .4rem; border-bottom: 2px solid var(--erp-border);
}
.required::after { content: " *"; color: var(--erp-danger); }

/* ---------- Timetable grid ---------- */
.timetable-grid { display: grid; grid-template-columns: 90px repeat(6, 1fr); gap: 4px; }
.timetable-grid .cell {
  background: var(--erp-surface); border: 1px solid var(--erp-border); border-radius: 6px;
  padding: .5rem; font-size: .76rem; min-height: 56px;
}
.timetable-grid .cell.head { background: var(--erp-primary); color: #fff; font-weight: 700; text-align: center; }
.timetable-grid .cell.break-cell { background: #fdf3e2; }
.timetable-grid .subj { font-weight: 700; }
.timetable-grid .teacher { color: var(--erp-text-muted); }

/* ---------- Receipt / printable ---------- */
.receipt-box { max-width: 720px; margin: 0 auto; background: #fff; padding: 2rem; border: 1px solid var(--erp-border); }
@media print {
  .erp-sidebar, .erp-topbar, .no-print { display: none !important; }
  .erp-main { margin-left: 0 !important; }
  body { background: #fff; }
}

/* ---------- Mobile responsiveness ---------- */
@media (max-width: 991.98px) {
  .erp-sidebar { transform: translateX(-100%); }
  .erp-sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.2); }
  .erp-main { margin-left: 0; }
  .erp-topbar .menu-toggle { display: block; }
  .erp-content { padding: 1rem .75rem; }
  .timetable-grid { grid-template-columns: 70px repeat(6, minmax(90px, 1fr)); font-size: .7rem; overflow-x: auto; }
}

.erp-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1025;
}
.erp-overlay.show { display: block; }

.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--erp-primary-dark), var(--erp-primary));
  padding: 1rem;
}
.login-card { background: #fff; border-radius: var(--erp-radius); padding: 2.5rem 2rem; width: 100%; max-width: 400px; }
