/* ============================================================
   NexaSchool ERP — app.css
   Premium enterprise design system for Indian schools.
   Light / dark / system themes · reduced motion · print modes
   ============================================================ */

/* ---------- 1. tokens ---------- */
:root {
  --brand-50: #eef2ff; --brand-100: #e0e7ff; --brand-200: #c7d2fe; --brand-300: #a5b4fc;
  --brand-400: #818cf8; --brand-500: #6366f1; --brand-600: #4f46e5; --brand-700: #4338ca;
  --brand-grad: linear-gradient(135deg, #6366f1, #4f46e5);
  --brand-grad-soft: linear-gradient(135deg, rgba(99,102,241,.12), rgba(79,70,229,.12));
  --ink-strong: #0f172a; --ink: #1e293b; --ink-2: #475569; --ink-3: #64748b;
  --bg: #f1f5f9; --surface-1: #ffffff; --surface-2: #f8fafc; --surface-3: #eef2f7;
  --line: #e2e8f0; --line-strong: #cbd5e1;
  --success: #059669; --success-soft: #ecfdf5;
  --info: #0284c7; --info-soft: #f0f9ff;
  --warning: #d97706; --warning-soft: #fffbeb;
  --danger: #dc2626; --danger-soft: #fef2f2;
  --violet: #7c3aed; --violet-soft: #f5f3ff;
  --cyan: #0891b2; --cyan-soft: #ecfeff;
  --orange: #ea580c; --orange-soft: #fff7ed;
  --radius: 14px; --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 4px 16px rgba(15,23,42,.06);
  --shadow-lg: 0 8px 30px rgba(15,23,42,.14);
  --sidebar-w: 262px;
  --topbar-h: 64px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
}
[data-theme="dark"] {
  --ink-strong: #f1f5f9; --ink: #e2e8f0; --ink-2: #cbd5e1; --ink-3: #94a3b8;
  --bg: #0b1120; --surface-1: #111a2e; --surface-2: #16213a; --surface-3: #1b2744;
  --line: #1e293b; --line-strong: #334155;
  --success: #34d399; --success-soft: rgba(16,185,129,.12);
  --info: #38bdf8; --info-soft: rgba(14,165,233,.12);
  --warning: #fbbf24; --warning-soft: rgba(245,158,11,.12);
  --danger: #f87171; --danger-soft: rgba(239,68,68,.12);
  --violet: #a78bfa; --violet-soft: rgba(139,92,246,.12);
  --cyan: #22d3ee; --cyan-soft: rgba(6,182,212,.12);
  --orange: #fb923c; --orange-soft: rgba(249,115,22,.12);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.5);
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
  animation-duration: .01ms !important; transition-duration: .01ms !important;
}

/* ---------- 2. base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--ink);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-500); text-decoration: none; }
b, strong { font-weight: 700; color: var(--ink-strong); }
img, svg { vertical-align: middle; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
::selection { background: var(--brand-200); color: var(--ink-strong); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: 4px; }

/* ---------- 3. app shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--surface-1);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 60;
  transform: translateX(0); transition: transform .25s ease;
}
.side-head { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 12px; background: var(--brand-grad); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79,70,229,.35);
}
.brand-txt b { font-size: 16px; color: var(--ink-strong); display: block; line-height: 1.1; }
.brand-txt em { font-style: normal; font-size: 11px; color: var(--brand-500); font-weight: 700; letter-spacing: .14em; }
.side-close { display: none; margin-left: auto; }
.side-nav { flex: 1; overflow-y: auto; padding: 12px 10px 20px; }
.nav-group { margin-bottom: 2px; }
.nav-parent {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); text-align: left; transition: background .15s ease;
}
.nav-parent:hover { background: var(--surface-2); color: var(--ink-strong); }
.nav-parent.active { color: var(--brand-600); }
.nav-parent .ni { width: 20px; text-align: center; display: inline-flex; justify-content: center; flex-shrink: 0; }
.nav-parent svg:last-child { margin-left: auto; transition: transform .2s ease; opacity: .5; }
.nav-group.open .nav-parent svg:last-child { transform: rotate(180deg); }
.nav-children { display: none; padding-left: 14px; }
.nav-group.open .nav-children { display: block; animation: fadeIn .18s ease; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 7.5px 12px; margin: 1px 0;
  border-radius: 9px; font-size: 13px; color: var(--ink-3); font-weight: 500;
  border-left: 2px solid transparent; transition: all .15s ease;
}
.nav-item:hover { color: var(--ink-strong); background: var(--surface-2); }
.nav-item.active { color: var(--brand-600); font-weight: 600; background: var(--brand-grad-soft); border-left-color: var(--brand-500); }
.nav-item .dot { width: 5px; height: 5px; border-radius: 99px; background: var(--line-strong); display: inline-block; }
.nav-item.active .dot { background: var(--brand-500); }
.side-foot { border-top: 1px solid var(--line); padding: 14px 18px; display: flex; align-items: center; gap: 9px; }
.side-mode {
  width: 34px; height: 34px; border-radius: 10px; background: var(--brand-grad-soft); color: var(--brand-500);
  display: inline-flex; align-items: center; justify-content: center;
}

.topbar {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0; height: var(--topbar-h);
  background: color-mix(in srgb, var(--surface-1) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; gap: 14px; z-index: 50;
}
.crumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); }
.crumb span { display: inline-flex; align-items: center; gap: 6px; }
.crumb b { color: var(--ink-strong); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); transition: background .15s ease, transform .15s ease; position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink-strong); transform: translateY(-1px); }
.icon-btn .badge-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 99px; background: var(--danger); border: 2px solid var(--surface-1); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px; border-radius: 12px; cursor: pointer; position: relative; transition: background .15s ease; }
.user-chip:hover { background: var(--surface-2); }
.uc-txt b { display: block; font-size: 12.5px; line-height: 1.2; color: var(--ink-strong); }
.uc-txt span { font-size: 11px; color: var(--ink-3); }
.uc-menu { display: flex; color: var(--ink-3); padding: 4px; border-radius: 6px; }
.uc-drop {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 210px; background: var(--surface-1);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; display: none; z-index: 80;
}
.uc-drop.show { display: block; animation: popIn .16s ease; }
.uc-drop a, .uc-drop button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 9px;
  font-size: 13px; color: var(--ink-2); font-weight: 500; text-align: left; transition: background .13s ease;
}
.uc-drop a:hover, .uc-drop button:hover { background: var(--surface-2); color: var(--ink-strong); }
.uc-drop hr { border: none; border-top: 1px solid var(--line); margin: 5px 4px; }

.page {
  margin-left: var(--sidebar-w); padding: calc(var(--topbar-h) + 24px) 26px 48px; min-height: 100vh;
  max-width: 1560px;
}
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; color: var(--ink-strong); }
.page-sub { color: var(--ink-3); font-size: 13.5px; margin-top: 3px; }
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); opacity: 0; pointer-events: none; transition: opacity .2s ease; z-index: 55; }
.overlay.show { opacity: 1; pointer-events: auto; }
.bottom-nav { display: none; }

/* ---------- 4. cards ---------- */
.card {
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card.pad { padding: 18px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--ink-strong); display: flex; align-items: center; gap: 8px; }
.card-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.card-body { padding: 12px 18px 18px; }
.stat-card { padding: 16px 18px; transition: transform .18s ease, box-shadow .18s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-value { font-size: 24px; font-weight: 800; color: var(--ink-strong); letter-spacing: -.02em; margin-top: 4px; }
.stat-ic {
  width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-ic.brand { background: var(--brand-grad-soft); color: var(--brand-500); }
.stat-ic.violet { background: var(--violet-soft); color: var(--violet); }
.stat-ic.cyan { background: var(--cyan-soft); color: var(--cyan); }
.stat-ic.green { background: var(--success-soft); color: var(--success); }
.stat-ic.orange { background: var(--orange-soft); color: var(--orange); }
.stat-ic.red { background: var(--danger-soft); color: var(--danger); }
.stat-ic.blue { background: var(--info-soft); color: var(--info); }

/* ---------- 5. buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: 11px; font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; transition: all .16s ease; white-space: nowrap; line-height: 1.2;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: 0 4px 14px rgba(79,70,229,.28); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(79,70,229,.38); transform: translateY(-1px); }
.btn-secondary { background: var(--surface-2); color: var(--ink-strong); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-outline { background: transparent; color: var(--brand-500); border-color: var(--brand-300); }
.btn-outline:hover { background: var(--brand-grad-soft); }
.btn-outline.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-outline.danger:hover { background: var(--danger-soft); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; box-shadow: 0 4px 14px rgba(220,38,38,.28); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-icon {
  width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3); transition: all .13s ease;
}
.btn-icon:hover { background: var(--surface-2); color: var(--ink-strong); }
.btn-icon.sm { width: 28px; height: 28px; border-radius: 8px; }
.btn-icon.danger:hover { background: var(--danger-soft); color: var(--danger); }
.link-btn { font-size: 12.5px; color: var(--brand-500); font-weight: 600; }

/* ---------- 6. badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warn { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-cyan { background: var(--cyan-soft); color: var(--cyan); }
.badge-brand { background: var(--brand-grad-soft); color: var(--brand-600); }
.badge-neutral { background: var(--surface-3); color: var(--ink-3); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--ink-2);
}
.chip.dim { opacity: .7; }

/* ---------- 7. forms ---------- */
.form-group { margin-bottom: 13px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.form-group .hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.form-grid .form-group.half { grid-column: span 1; }
.form-grid .form-group:not(.half) { grid-column: 1 / -1; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], input[type="month"], input[type="search"], input[type="tel"], select, textarea {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--line); border-radius: 11px;
  background: var(--surface-1); transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3.5px var(--brand-100);
}
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.fe { display: block; font-size: 11.5px; color: var(--danger); margin-top: 4px; min-height: 0; }
.chk { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; font-weight: 500; }
.chk input { width: 16px; height: 16px; accent-color: var(--brand-600); cursor: pointer; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; background: var(--line-strong); border-radius: 99px; transition: background .18s ease; cursor: pointer;
}
.switch span::before {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 99px; background: #fff;
  top: 3px; left: 3px; transition: transform .18s ease; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + span { background: var(--brand-500); }
.switch input:checked + span::before { transform: translateX(18px); }

/* ---------- 8. tables ---------- */
.table-card { overflow: hidden; }
.table-tools { display: flex; gap: 10px; padding: 12px 18px 4px; flex-wrap: wrap; }
.tbl-search { max-width: 280px; }
.table-wrap { overflow-x: auto; padding: 8px 18px 0; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase;
  letter-spacing: .05em; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: middle; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: var(--surface-2); }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-main b { display: block; font-size: 13.5px; color: var(--ink-strong); line-height: 1.3; }
.cell-main span:not(.avatar) { display: block; font-size: 12px; color: var(--ink-3); }
.row-actions { text-align: right; white-space: nowrap; width: 1%; }
.tbl-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 18px 15px; flex-wrap: wrap; }
.tbl-count { font-size: 12px; color: var(--ink-3); }
.tbl-pager { display: flex; align-items: center; gap: 8px; }
.pg-info { font-size: 12.5px; font-weight: 600; color: var(--ink-2); min-width: 52px; text-align: center; }
.sort-ic { font-size: 10px; }
.bar { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; display: inline-block; vertical-align: middle; }
.bar i { display: block; height: 100%; border-radius: 99px; transition: width .4s ease; }

/* ---------- 9. modal & toast ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
  opacity: 0; transition: opacity .18s ease;
}
.modal-overlay.in { opacity: 1; }
.modal-overlay.out { opacity: 0; pointer-events: none; }
.modal {
  background: var(--surface-1); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%;
  max-height: 88vh; display: flex; flex-direction: column; border: 1px solid var(--line);
  transform: translateY(12px) scale(.98); transition: transform .18s ease;
}
.modal-overlay.in .modal { transform: translateY(0) scale(1); }
.modal-sm { max-width: 420px; }
.modal-md { max-width: 600px; }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1080px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--line); }
#toastHost { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  display: flex; align-items: flex-start; gap: 11px; background: var(--surface-1); border: 1px solid var(--line);
  border-left: 4px solid var(--info); border-radius: 13px; padding: 13px 14px; box-shadow: var(--shadow-lg);
  animation: slideIn .25s ease; transition: opacity .2s ease, transform .2s ease;
}
.toast.out { opacity: 0; transform: translateX(20px); }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warn { border-left-color: var(--warning); }
.toast-ic { color: var(--info); display: inline-flex; }
.toast-success .toast-ic { color: var(--success); }
.toast-error .toast-ic { color: var(--danger); }
.toast-warn .toast-ic { color: var(--warning); }
.toast-body b { display: block; font-size: 13px; }
.toast-body p { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
.toast-x { color: var(--ink-3); margin-left: auto; display: inline-flex; padding: 2px; }

/* ---------- 10. empty & skeleton ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--ink-3); }
.empty h3 { font-size: 15px; margin: 10px 0 4px; color: var(--ink-strong); }
.empty p { font-size: 13px; max-width: 360px; margin: 0 auto 14px; }
.skeleton { padding: 20px 0; }
.sk-row { height: 24px; width: 40%; border-radius: 8px; background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; margin-bottom: 18px; }
.sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 14px; }
.sk-card { height: 110px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }

/* ---------- 11. charts ---------- */
.chart-box { margin-top: 12px; }
.c-axis { fill: var(--ink-3); font-size: 10px; font-family: var(--font); }
.c-center { fill: var(--ink-strong); font-size: 13px; font-weight: 700; font-family: var(--font); }
.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.legend { display: flex; flex-direction: column; gap: 6px; }
.lg { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg b { font-weight: 700; margin-left: 2px; }

/* ---------- 12. hero, kanban, calendar ---------- */
.hero-banner {
  background: var(--brand-grad); border-radius: 18px; color: #fff; padding: 24px 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  box-shadow: 0 10px 30px rgba(79,70,229,.28); position: relative; overflow: hidden;
}
.hero-banner::after {
  content: ''; position: absolute; width: 320px; height: 320px; border-radius: 99px; right: -90px; top: -140px;
  background: radial-gradient(circle, rgba(255,255,255,.14), transparent 70%);
}
.hero-banner h2 { color: #fff; }
.hero-banner p { color: rgba(255,255,255,.85); }
.hero-chip {
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); padding: 8px 14px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; backdrop-filter: blur(4px);
  position: relative; z-index: 1;
}
.kanban { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; align-items: start; }
.kb-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 120px; }
.kb-col h5 { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .04em; }
.kb-col .cnt { margin-left: auto; background: var(--surface-1); border: 1px solid var(--line); color: var(--ink-2); font-size: 11px; padding: 1px 8px; border-radius: 99px; }
.kb-card {
  background: var(--surface-1); border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px;
  margin-bottom: 9px; box-shadow: var(--shadow-sm); transition: transform .14s ease, box-shadow .14s ease; cursor: pointer;
}
.kb-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kb-card b { font-size: 13px; display: block; }
.kb-card p { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.kb-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 6px 0; text-transform: uppercase; }
.cal-day { min-height: 78px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; position: relative; transition: border-color .13s ease; }
.cal-day.today { border-color: var(--brand-500); box-shadow: 0 0 0 1px var(--brand-500); }
.cal-day.muted { opacity: .35; }
.d-num { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.evts { display: flex; flex-direction: column; gap: 2px; margin-top: 3px; }
.cal-ev { font-size: 10.5px; padding: 1px 5px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-1 { background: var(--brand-grad-soft); color: var(--brand-600); }
.ev-2 { background: var(--success-soft); color: var(--success); }
.ev-3 { background: var(--info-soft); color: var(--info); }
.ev-4 { background: var(--warning-soft); color: var(--warning); }
.ev-5 { background: var(--violet-soft); color: var(--violet); }
.ev-6 { background: var(--danger-soft); color: var(--danger); }
.ev-7 { background: var(--orange-soft); color: var(--orange); }

/* ---------- 13. auth & error pages ---------- */
.auth-body { background: var(--bg); }
.auth-wrap { display: flex; min-height: 100vh; }
.auth-visual {
  flex: 1.1; background: linear-gradient(160deg, #312e81 0%, #4f46e5 55%, #7c3aed 100%);
  color: #fff; padding: 44px 52px; display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.auth-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 2; }
.auth-hero { margin: auto 0; position: relative; z-index: 2; max-width: 560px; }
.auth-hero h1 { font-size: clamp(28px, 3.4vw, 42px); font-weight: 800; letter-spacing: -.02em; line-height: 1.18; }
.auth-hero p { font-size: 15.5px; color: rgba(255,255,255,.82); margin-top: 16px; line-height: 1.65; max-width: 460px; }
.auth-stats { display: flex; gap: 34px; position: relative; z-index: 2; }
.auth-stats b { font-size: 24px; font-weight: 800; display: block; }
.auth-stats span { font-size: 12.5px; color: rgba(255,255,255,.75); }
.auth-orb { position: absolute; border-radius: 99px; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.orb-1 { width: 420px; height: 420px; right: -120px; bottom: -140px; }
.orb-2 { width: 240px; height: 240px; left: -70px; top: 30%; }
.auth-form-side { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 26px; }
.auth-card { width: 100%; max-width: 420px; }
.pass-wrap { position: relative; }
.pass-eye { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 15px; opacity: .55; padding: 4px; }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha {
  background: var(--surface-3); border: 1.5px dashed var(--line-strong); border-radius: 11px; padding: 10px 14px;
  font-family: var(--mono); font-weight: 700; font-size: 16px; color: var(--ink-2); letter-spacing: 4px; user-select: none;
}
.captcha-row input { flex: 1; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; color: var(--ink-3); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.demo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.demo-chip {
  padding: 9px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
  font-size: 12px; font-weight: 600; color: var(--ink-2); transition: all .13s ease; text-align: center;
}
.demo-chip:hover { border-color: var(--brand-400); color: var(--brand-600); background: var(--brand-grad-soft); transform: translateY(-1px); }
.demo-note {
  margin-top: 16px; padding: 10px 14px; border-radius: 11px; background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent); font-size: 11.5px; color: var(--warning); line-height: 1.5;
}
.demo-note b { color: var(--warning); }
.auth-foot { margin-top: 22px; font-size: 12px; color: var(--ink-3); }
.auth-foot a { color: var(--brand-500); font-weight: 600; }
.error-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.error-box { text-align: center; }
.error-code {
  font-size: 96px; font-weight: 900; letter-spacing: -.04em; line-height: 1;
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- 14. command palette & tour ---------- */
.cmd-input { width: 100%; padding: 13px 15px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 14px; background: var(--surface-2); }
.cmd-list { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; max-height: 340px; overflow-y: auto; }
.cmd-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; text-align: left;
  font-size: 13.5px; color: var(--ink-2); font-weight: 500; transition: background .12s ease;
}
.cmd-item:hover { background: var(--surface-2); color: var(--ink-strong); }
.tour-pop {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 300;
  background: var(--surface-1); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: min(420px, calc(100vw - 32px)); padding: 18px; animation: slideUp .25s ease;
}
.tour-foot { display: flex; justify-content: space-between; margin-top: 14px; }
.tour-highlight { outline: 3px solid var(--brand-500); outline-offset: 3px; border-radius: 12px; }

/* ---------- 15. misc components ---------- */
.avatar {
  border-radius: 99px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0; letter-spacing: .02em; user-select: none;
}
.qr-placeholder { font-family: var(--mono); font-size: 6px; line-height: 6px; color: #000; }
.id-card {
  width: 100%; max-width: 340px; border: 2px solid var(--brand-600); border-radius: 16px; overflow: hidden;
  background: #fff; color: #0f172a; font-size: 12px;
}
.id-top { background: var(--brand-grad); color: #fff; padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
.id-top b { color: #fff; font-size: 13.5px; display: block; }
.id-top span { font-size: 9.5px; opacity: .85; letter-spacing: .12em; }
.id-logo { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; }
.id-avatar { text-align: center; margin-top: 14px; }
.id-name { text-align: center; font-weight: 800; font-size: 15px; margin-top: 8px; color: #0f172a; }
.id-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 12px 18px; }
.id-meta span { font-size: 8.5px; letter-spacing: .1em; color: #64748b; display: block; }
.id-meta b { font-size: 12px; color: #0f172a; }
.id-qr { display: flex; justify-content: center; padding: 4px 0 10px; }
.id-sign { text-align: center; font-size: 9px; color: #94a3b8; padding-bottom: 10px; display: flex; align-items: center; justify-content: center; gap: 4px; }

/* print documents (receipts, report cards, certificates, payslips) */
.print-doc { background: #fff; color: #111; border-radius: 12px; padding: 26px 30px; }
.print-doc .doc-head { display: flex; gap: 14px; align-items: center; padding-bottom: 14px; border-bottom: 3px double #cbd5e1; margin-bottom: 16px; }
.print-doc .dl { width: 44px; height: 44px; border-radius: 12px; background: #4f46e5; color: #fff; display: flex; align-items: center; justify-content: center; }
.print-doc h2 { font-size: 19px; font-weight: 800; color: #111; }
.print-doc h2 + p { font-size: 12px; color: #64748b; }
.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; margin: 14px 0; }
.dg { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed #e2e8f0; padding: 7px 0; font-size: 13px; }
.dg span { color: #64748b; }
.dg b { color: #111; }
.sig-row { display: flex; justify-content: space-between; gap: 20px; margin-top: 40px; }
.sig-row > div { text-align: center; font-size: 12px; color: #475569; }
.sig-line { border-top: 1.5px solid #334155; width: 120px; margin-bottom: 7px; }
.tt .period-cell b { display: block; font-size: 13px; }
.tt .period-cell span { font-size: 11px; }
.tt td { text-align: center; min-width: 120px; cursor: pointer; }
.tt td.break-cell { background: var(--surface-2); color: var(--ink-3); font-size: 12px; cursor: default; }
.tt-slot { padding: 7px 8px; border-radius: 9px; background: var(--brand-grad-soft); color: var(--brand-700); }
.tt-slot b { display: block; font-size: 12.5px; color: var(--brand-700); }
.tt-slot span { display: block; font-size: 11px; opacity: .85; }
td.conflict .tt-slot { background: var(--danger-soft); color: var(--danger); outline: 1px dashed var(--danger); }
.tt-add { color: var(--ink-3); font-size: 15px; opacity: 0; transition: opacity .13s ease; }
td:hover .tt-add { opacity: 1; }
.rp-card {
  display: flex; gap: 11px; align-items: flex-start; text-align: left; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-1);
  transition: all .14s ease;
}
.rp-card:hover { border-color: var(--brand-300); box-shadow: var(--shadow); transform: translateY(-2px); }
.rp-card b { display: block; }
.rp-card span:last-child span { display: block; margin-top: 2px; }
.org-row { display: flex; justify-content: center; gap: 16px; margin: 10px 0; flex-wrap: wrap; }
.org-node {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 20px; background: var(--surface-1);
  min-width: 130px; box-shadow: var(--shadow-sm);
}
.org-node b { display: block; font-size: 13.5px; }
.org-node span { font-size: 11.5px; color: var(--ink-3); display: block; margin-top: 2px; }
.org-line { width: 2px; height: 18px; background: var(--line-strong); margin: 0 auto; }
.role-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 11px; text-align: left; transition: background .12s ease; }
.role-row:hover { background: var(--surface-2); }
.role-row b { display: block; font-size: 13px; }
.role-row span span { display: block; font-size: 11px; color: var(--ink-3); }
.perm { display: inline-flex; width: 18px; height: 18px; border-radius: 5px; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; background: var(--surface-3); color: var(--ink-3); margin: 0 1px; }
.perm.on { background: var(--success-soft); color: var(--success); }
.qa-card {
  display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-1); transition: all .14s ease; text-align: left;
}
.qa-card:hover { border-color: var(--brand-300); transform: translateY(-2px); box-shadow: var(--shadow); }
.qa-card .fs-12 { color: var(--ink-2); }
.n-item { display: flex; gap: 11px; padding: 12px; border-radius: 12px; cursor: pointer; transition: background .12s ease; }
.n-item:hover { background: var(--surface-2); }
.n-item.unread { background: var(--brand-grad-soft); }
.n-ic { width: 36px; height: 36px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.n-body b { font-size: 13px; display: block; }
.n-body p { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.n-body time { font-size: 11px; color: var(--ink-3); }
.class-card { transition: all .15s ease; cursor: pointer; }
.class-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand-300); }
.divider-muted { border: none; border-top: 1px solid var(--line); margin: 14px 0; }

/* ---------- 16. utilities ---------- */
.flex { display: flex; }
.between { justify-content: space-between; align-items: center; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.pad { padding: 18px; }
.fs-11 { font-size: 11px; } .fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; } .fs-14 { font-size: 14px; } .fs-16 { font-size: 16px; }
.fw-6 { font-weight: 600; } .fw-7 { font-weight: 700; }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-3); }
.text-danger { color: var(--danger); } .text-success { color: var(--success); } .text-warn { color: var(--warning); }
.mono { font-family: var(--mono); }
.hint { font-size: 12px; color: var(--ink-3); }

/* ---------- 17. animations ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- 18. responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .auth-visual { display: none; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .side-close { display: inline-flex; }
  .topbar { left: 0; }
  .page { margin-left: 0; padding: calc(var(--topbar-h) + 18px) 16px 92px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 70;
    background: color-mix(in srgb, var(--surface-1) 90%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--ink-3); padding: 6px 10px; border-radius: 10px; font-weight: 600; }
  .bottom-nav a.on { color: var(--brand-500); }
  .bottom-nav button { color: var(--brand-500); }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .uc-txt { display: none; }
  .crumb { display: none; }
  .page-head h1 { font-size: 20px; }
  .hero-banner { padding: 20px; }
  .demo-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .stat-value { font-size: 20px; }
  .table-tools { padding: 10px 12px 4px; }
  .tbl-search { max-width: 100%; width: 100%; }
  .table-wrap { padding: 6px 12px 0; }
  .tbl-foot { padding: 11px 12px 13px; }
  .modal-body { padding: 14px 15px; }
  .auth-form-side { padding: 28px 18px; }
}

/* ---------- 19. print ---------- */
@media print {
  .sidebar, .topbar, .bottom-nav, .btn, .tbl-pager, .toast, .tour-pop, .modal-foot, .hero-chip, #toastHost { display: none !important; }
  .page { margin: 0; padding: 0; max-width: none; }
  .card { border: none; box-shadow: none; }
  .stat-card, .table-card, .modal, .print-doc, .id-card { break-inside: avoid; }
  body { background: #fff; }
  body.print-mode * { visibility: visible; }
  .print-doc { padding: 0; }
  .modal-overlay { position: static; background: none; padding: 0; opacity: 1; }
  .modal { max-height: none; box-shadow: none; border: none; transform: none; }
  .modal-overlay.in .modal { transform: none; }
  @page { margin: 14mm 12mm; }
}
