:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e6eaf0;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-deep: #0b3d3a;
  --brand-soft: #e6f7f4;
  --accent: #f59e0b;
  --ok: #059669;
  --ok-soft: #e7f7ef;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #be123c;
  --danger-soft: #ffe4e9;
  --info: #0369a1;
  --info-soft: #e0f2fe;
  --sidebar: #0b1526;
  --sidebar-2: #0e1c31;
  --on-dark-accent: #5eead4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 14px 34px -22px rgba(15, 23, 42, .35);
  --shadow-lg: 0 24px 60px -28px rgba(15, 23, 42, .45);
  --font: "Segoe UI", system-ui, -apple-system, "Inter", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
button { font-family: inherit; }

/* ---------- Shell ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 40;
  background: linear-gradient(168deg, var(--sidebar) 0%, var(--sidebar-2) 55%, #0b2230 100%);
  color: #cbd5e1; display: flex; flex-direction: column;
  padding: 22px 16px 18px; overflow: hidden;
  transition: transform .25s ease;
}
.sidebar::after {
  content: ""; position: absolute; inset: auto -60px -120px auto; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(45, 212, 191, .16), transparent 65%);
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 6px; }
.brand-logo { width: 42px; height: 42px; flex: 0 0 auto; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(16, 185, 129, .35)); }
.brand-name { color: #f8fafc; font-weight: 700; font-size: 15px; line-height: 1.25; letter-spacing: -.01em; }
.brand-sub { color: #7dd3c7; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }
.side-label {
  margin: 12px 10px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: #64748b;
}
.nav { display: flex; flex-direction: column; gap: 1px; flex: 0 0 auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 7px 11px; border-radius: 10px;
  color: #b6c2d2; font-weight: 500; font-size: 13px; position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; opacity: .85; }
.nav-item:hover { background: rgba(148, 163, 184, .1); color: #e2e8f0; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(45, 212, 191, .16), rgba(45, 212, 191, .04));
  color: #5eead4; font-weight: 600;
}
.nav-item.active::before {
  content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 4px 4px 0; background: #2dd4bf;
}
.nav-item.soon { opacity: .62; cursor: default; }
.nav-item .badge-soon {
  margin-left: auto; font-size: 9px; font-weight: 700; letter-spacing: .06em;
  background: rgba(148, 163, 184, .14); color: #94a3b8; padding: 2px 6px; border-radius: 999px;
}
.sidebar-foot { margin-top: auto; padding: 10px 10px 0; border-top: 1px solid rgba(148, 163, 184, .13); }
.sidebar-foot .who { color: #94a3b8; font-size: 11.5px; }
.sidebar-foot .who b { color: #e2e8f0; font-weight: 600; }

.main { margin-left: 264px; min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .25s ease; }
.search-global { position: relative; width: min(340px, 32vw); }
.search-global input {
  width: 100%; padding: 9px 12px 9px 36px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); font-size: 13px; outline: none; transition: .2s;
}
.search-global input:focus { border-color: #99d8d0; box-shadow: 0 0 0 4px rgba(15, 118, 110, .09); background: #fff; }
.search-global svg { position: absolute; left: 12px; top: 9px; width: 16px; height: 16px; color: var(--muted); }
.session-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark); font-size: 12px; font-weight: 700;
}
.session-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(140deg, #0f766e, #0d9488); color: #fff; font-size: 13px;
}
.userbox { position: relative; }
.userbox summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 9px; }
.userbox summary::-webkit-details-marker { display: none; }
.userbox .menu {
  position: absolute; right: 0; top: 46px; width: 232px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px; z-index: 50;
}
.userbox .menu .meta { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.userbox .menu .meta b { display: block; font-size: 13px; }
.userbox .menu .meta span { font-size: 11.5px; color: var(--muted); }
.userbox .menu button {
  width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px;
  font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.userbox .menu a { display: block; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.userbox .menu a:hover { background: var(--surface-2); }
.userbox .menu button:hover { background: #fef2f2; color: var(--danger); }

.content { padding: 16px 20px 28px; width: 100%; max-width: 1460px; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h2 { font-size: 19px; font-weight: 800; }
.page-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px;
  border-radius: 10px; border: 1px solid transparent; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: .18s; white-space: nowrap; background: #fff; color: var(--ink-2);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, #0f766e, #0d9488); color: #fff; box-shadow: 0 8px 18px -10px rgba(13, 148, 136, .7); }
.btn-primary:hover { color: #fff; filter: brightness(1.04); }
.btn-ghost { border-color: var(--line); background: #fff; }
.btn-ghost:hover { border-color: #cbd5e1; background: var(--surface-2); }
.btn-danger { background: #fff1f3; color: var(--danger); border-color: #fecdd3; }
.btn-soft { background: var(--brand-soft); color: var(--brand-dark); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- Cards / KPI ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 0; }
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-head .right { margin-left: auto; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.kpi { padding: 18px 20px; display: flex; align-items: center; gap: 14px; position: relative; overflow: hidden; }
.kpi::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px;
  border-radius: 50%; background: radial-gradient(circle, rgba(15, 118, 110, .08), transparent 70%);
}
.kpi-icon {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--brand-soft); color: var(--brand);
}
.kpi-icon svg { width: 22px; height: 22px; }
.kpi-icon.amber { background: var(--warn-soft); color: var(--warn); }
.kpi-icon.rose { background: var(--danger-soft); color: var(--danger); }
.kpi-icon.sky { background: var(--info-soft); color: var(--info); }
.kpi-num { font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.kpi-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi-note { font-size: 11px; color: var(--muted); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.grid-2.equal { grid-template-columns: 1fr 1fr; }

.chart { display: flex; flex-direction: column; gap: 13px; padding: 18px 22px 10px; }
.chart-row { display: grid; grid-template-columns: 150px 1fr 44px; align-items: center; gap: 12px; }
.chart-label { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-track { height: 9px; background: #eef2f6; border-radius: 999px; overflow: hidden; }
.chart-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #14b8a6, #0f766e); min-width: 4px; }
.chart-count { font-size: 12.5px; font-weight: 700; text-align: right; color: var(--ink-2); }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.quick {
  display: flex; align-items: center; gap: 11px; padding: 13px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid transparent; color: var(--ink-2); font-weight: 600; font-size: 13px;
}
.quick:hover { border-color: #d7eee9; background: var(--brand-soft); color: var(--brand-dark); }
.quick svg { width: 19px; height: 19px; color: var(--brand); }

/* ---------- Tables ---------- */
.table-card { overflow: hidden; }
.table-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  text-align: left; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table tbody td { padding: 12px 14px; border-bottom: 1px solid #f0f3f7; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcfe; }
.table .name-cell { font-weight: 600; color: var(--ink); }
.table .muted { color: var(--muted); }
.table .num { font-variant-numeric: tabular-nums; }
.empty { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 42px; height: 42px; color: #cbd5e1; margin-bottom: 10px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-muted { background: #f1f5f9; color: var(--muted); }

.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--brand-soft); color: var(--brand); display: inline-grid; place-items: center; font-weight: 700; font-size: 11.5px; }

.pagination { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.pagination .info { font-size: 12px; color: var(--muted); margin-right: auto; }
.page-btn {
  min-width: 32px; height: 32px; padding: 0 9px; display: inline-grid; place-items: center; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; font-size: 12.5px; color: var(--ink-2);
}
.page-btn.current { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.page-btn.disabled { opacity: .45; pointer-events: none; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 9px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; }
.filters .field input, .filters .field select { min-width: 128px; padding: 8px 10px; font-size: 12.5px; }
.filters .grow { flex: 1; min-width: 220px; }
.filters .grow input { width: 100%; }

/* ---------- Forms ---------- */
.form-card { margin-bottom: 18px; }
.form-head { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fbfdfe, #fff); border-radius: var(--radius) var(--radius) 0 0; }
.form-head .step { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; font-size: 12px; }
.form-head h3 { font-size: 14.5px; }
.form-head .sub { font-size: 11.5px; color: var(--muted); }
.form-body { padding: 20px 22px; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px 18px; }
.form-grid .col-2 { grid-column: span 2; }
.form-grid .col-3 { grid-column: span 3; }
.form-grid .col-4 { grid-column: span 4; }
.field label { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; letter-spacing: .01em; }
.field label .req { color: var(--danger); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #dbe2ea; border-radius: 9px; font-size: 13px;
  font-family: inherit; color: var(--ink); background: #fff; outline: none; transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #7fc9c0; box-shadow: 0 0 0 4px rgba(15, 118, 110, .08); }
.field input:disabled, .field input[readonly] { background: var(--surface-2); color: var(--muted); }
.field textarea { min-height: 74px; resize: vertical; }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.field.invalid input, .field.invalid select { border-color: #fda4af; background: #fff7f8; }
.field .error { font-size: 11.5px; color: var(--danger); margin-top: 4px; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.check {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 12.5px; background: var(--surface-2); cursor: pointer;
}
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 4px 0 20px; }

.photo-drop { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px dashed #cbd5e1; border-radius: 12px; background: var(--surface-2); }
.photo-drop img, .photo-preview { width: 66px; height: 78px; border-radius: 9px; object-fit: cover; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.photo-drop .txt { font-size: 12px; color: var(--muted); }
.photo-drop input { display: block; margin-top: 6px; font-size: 12px; }
.photo-cam-btn { margin: 6px 0; }
.cam-modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px; background: rgba(15,23,42,.65); }
.cam-modal[hidden] { display: none; }
.cam-box { width: min(440px, 100%); background: #0f172a; border-radius: 14px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.cam-box video { width: 100%; display: block; aspect-ratio: 3 / 4; object-fit: cover; background: #000; }
.cam-actions { display: flex; gap: 8px; padding: 10px; }
.cam-actions .btn { flex: 1; }
.cam-note { padding: 18px 16px; color: #cbd5e1; font-size: 13px; line-height: 1.5; display: grid; gap: 6px; }
.cam-note[hidden] { display: none; }
.cam-note b { color: #fff; font-size: 14px; }

/* ---------- Profile ---------- */
.profile-hero { display: flex; gap: 20px; align-items: center; padding: 22px; flex-wrap: wrap; }
.profile-photo { width: 96px; height: 116px; border-radius: 14px; object-fit: cover; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 30px; font-weight: 800; box-shadow: var(--shadow); }
.profile-main h2 { font-size: 22px; }
.profile-main .meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 7px 0 8px; align-items: center; color: var(--muted); font-size: 12.5px; }
.profile-hero .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 20px; }
.detail label { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; display: block; margin-bottom: 2px; }
.detail div { font-size: 13.5px; font-weight: 500; }
.detail .full { grid-column: span 3; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 18px; margin-bottom: 0; overflow-x: auto; }
.tab { padding: 12px 14px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--brand); border-color: var(--brand); }
.subhead { font-size: 13px; font-weight: 700; margin: 18px 0 10px; display: flex; align-items: center; gap: 8px; }
.subhead span { font-size: 11px; color: var(--muted); font-weight: 500; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 12.5px; margin-bottom: 14px; }
.notice svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
.notice-info { background: var(--info-soft); color: #075985; }
.notice-warn { background: var(--warn-soft); color: #92400e; }

/* ---------- ID cards ---------- */
.id-toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; }
.id-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58mm, 1fr)); gap: 14px; }
.id-card {
  width: 58mm; height: 92mm; background: #fff; border: 1px solid #dbe2ea; border-radius: 9px;
  overflow: hidden; display: flex; flex-direction: column; page-break-inside: avoid; break-inside: avoid;
  box-shadow: 0 10px 24px -18px rgba(15, 23, 42, .5);
}
.id-top { background: linear-gradient(150deg, #0f766e, #0b3d3a); color: #fff; padding: 8px 9px 7px; display: flex; gap: 7px; align-items: center; }
.id-top .crest { width: 26px; height: 26px; flex: 0 0 auto; }
.id-top .t1 { font-size: 7.2px; font-weight: 800; letter-spacing: .02em; line-height: 1.2; text-transform: uppercase; }
.id-top .t2 { font-size: 5.6px; opacity: .8; letter-spacing: .04em; }
.id-body { padding: 8px 9px; display: flex; gap: 8px; flex: 1; }
.id-photo { width: 21mm; height: 26mm; border-radius: 5px; object-fit: cover; background: #e6f7f4; color: #0f766e; display: grid; place-items: center; font-weight: 800; font-size: 14px; border: 1px solid #dfeeeb; flex: 0 0 auto; }
.id-fields { font-size: 6.6px; line-height: 1.45; min-width: 0; }
.id-fields b { display: block; font-size: 8.2px; line-height: 1.25; margin-bottom: 2px; color: #0f172a; }
.id-fields .k { color: #64748b; letter-spacing: .04em; text-transform: uppercase; font-size: 5.6px; }
.id-fields .row { margin-bottom: 3.5px; }
.id-fields .gr { font-weight: 800; font-size: 8px; color: #0f766e; letter-spacing: .02em; }
.id-foot { border-top: 1px dashed #e2e8f0; padding: 5px 9px 7px; font-size: 5.4px; color: #64748b; display: flex; justify-content: space-between; gap: 6px; align-items: flex-end; }
.id-foot .sign { border-top: 1px solid #cbd5e1; padding-top: 1px; width: 26mm; text-align: center; color: #94a3b8; }
.id-barcode { display: flex; gap: 1px; height: 7mm; align-items: stretch; margin-top: 4px; }
.id-barcode i { width: 1px; background: #0f172a; }
.id-barcode i.w { width: 2.2px; }
.id-barcode i.space { background: transparent; }
.id-card.id-card-landscape { width: 92mm; height: 58mm; }
.id-grid.id-grid-landscape { grid-template-columns: repeat(auto-fill, minmax(92mm, 1fr)); }
.id-card-landscape .id-top { padding: 6px 9px 5px; }
.id-card-landscape .id-body { padding: 6px 9px; }
.id-card-landscape .id-photo { width: 17mm; height: 22mm; font-size: 12px; }
.id-card-landscape .id-fields { flex: 1; display: grid; grid-template-columns: 1fr 1fr; column-gap: 8px; align-content: start; }
.id-card-landscape .id-fields b,
.id-card-landscape .id-fields .row:last-child { margin-bottom: 0; }
.id-card-landscape .id-fields b { grid-column: 1 / -1; }
.id-card-landscape .id-barcode { height: 5mm; }
.id-card-landscape .id-foot { padding: 4px 9px 6px; }
.id-card.idc-image .id-top { background: linear-gradient(150deg, rgba(15, 23, 42, .72), rgba(15, 23, 42, .55)); }
.id-card.idc-custom .id-foot { border-top-color: rgba(148, 163, 184, .45); }
.id-card.idc-custom:not(.idc-image) .id-fields,
.id-card.idc-custom:not(.idc-image) .id-fields b,
.id-card.idc-custom:not(.idc-image) .id-fields .gr,
.id-card.idc-custom:not(.idc-image) .id-foot { color: var(--idc-ink, #0f172a); }
.id-card.idc-custom:not(.idc-image) .id-fields .k { color: var(--idc-ink, #64748b); opacity: .72; }
.id-card.idc-ink-light .id-foot { border-top-color: rgba(255, 255, 255, .4); }
.id-card.idc-ink-light .id-foot .sign { color: rgba(255, 255, 255, .85); border-top-color: rgba(255, 255, 255, .55); }
.id-card.idc-ink-light .id-barcode i { background: #fff; }

/* ---------- ID card background designer (settings) ---------- */
.idc-title { font-size: 13px; font-weight: 800; color: var(--ink); margin: 22px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.idc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 20px; align-items: start; }
.field[hidden] { display: none; }
.idc-preview { width: 100%; max-width: 220px; aspect-ratio: 58 / 92; border-radius: 10px; border: 1px solid #dbe2ea; overflow: hidden; display: flex; flex-direction: column; color: #0f172a; box-shadow: 0 10px 24px -18px rgba(15, 23, 42, .5); }
.idc-pv-top { display: flex; gap: 6px; align-items: center; padding: 8px; background: linear-gradient(150deg, #0f766e, #0b3d3a); color: #fff; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
.idc-preview.idc-pv-image .idc-pv-top { background: rgba(15, 23, 42, .62); }
.idc-pv-top img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; background: #fff; flex: 0 0 auto; }
.idc-pv-body { flex: 1; display: flex; gap: 8px; padding: 10px 9px; }
.idc-pv-photo { width: 52px; height: 64px; border-radius: 5px; background: rgba(255, 255, 255, .85); border: 1px solid rgba(148, 163, 184, .5); flex: 0 0 auto; }
.idc-pv-lines { flex: 1; display: grid; gap: 7px; align-content: start; }
.idc-pv-lines i { display: block; height: 7px; border-radius: 3px; background: rgba(255, 255, 255, .78); }
.idc-pv-lines i:nth-child(2) { width: 70%; }
.idc-pv-lines i:nth-child(3) { width: 85%; }
@media (max-width: 820px) {
  .idc-grid { grid-template-columns: 1fr; }
  .idc-preview { max-width: 190px; }
}

/* ---------- Import ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.step { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.step .n { width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 12px; display: grid; place-items: center; flex: 0 0 auto; }
.step b { display: block; font-size: 12.5px; }
.step span { font-size: 11.5px; color: var(--muted); line-height: 1.45; display: block; }
.dropzone { display: block; border: 1.5px dashed #cbd5e1; border-radius: 12px; padding: 26px 18px; text-align: center; background: #fafcfe; transition: .15s; cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone svg { width: 34px; height: 34px; color: var(--brand); display: block; margin: 0 auto 6px; }
.dropzone .file-name { font-size: 12.5px; font-weight: 700; color: var(--brand); margin-top: 6px; }
.import-summary { display: flex; gap: 10px; flex-wrap: wrap; }
.import-summary .pill { padding: 8px 12px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.row-new td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.row-dup td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.row-err td:first-child { box-shadow: inset 3px 0 0 var(--danger); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-left {
  position: relative; overflow: hidden; padding: 54px; color: #ecfdf5;
  background: radial-gradient(1200px 600px at -10% -10%, var(--brand-dark), transparent 60%), linear-gradient(160deg, #07131f, var(--sidebar-3, #0b2230) 55%, var(--brand-deep));
  display: flex; flex-direction: column;
}
.auth-left::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(45, 212, 191, .16) 1px, transparent 1px);
  background-size: 26px 26px; mask-image: linear-gradient(160deg, rgba(0,0,0,.7), transparent 75%);
}
.auth-brand { display: flex; align-items: center; gap: 14px; position: relative; }
.auth-brand .brand-logo { width: 54px; height: 54px; }
.auth-brand b { display: block; font-size: 19px; color: #f8fafc; letter-spacing: -.02em; }
.auth-brand span { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--on-dark-accent); }
.auth-brand .brand-addr, .brand-addr { display: block; margin-top: 3px; letter-spacing: .02em; text-transform: none; font-size: 11.5px; font-weight: 500; color: #94a3b8; max-width: 340px; line-height: 1.45; }
.auth-copy { margin-top: auto; position: relative; max-width: 520px; }
.auth-copy h2 { font-size: 40px; line-height: 1.12; letter-spacing: -.035em; color: #f8fafc; }
.auth-copy p { margin-top: 16px; color: #94a3b8; font-size: 14.5px; line-height: 1.65; }
.auth-points { display: flex; gap: 22px; margin-top: 28px; flex-wrap: wrap; }
.auth-point { font-size: 12px; color: #cbd5e1; display: flex; gap: 8px; align-items: center; }
.auth-point svg { width: 16px; height: 16px; color: var(--on-dark-accent); }
.auth-left footer { margin-top: 34px; font-size: 11px; color: #64748b; }
.auth-left footer b { color: #94a3b8; }
.auth-right { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .logo-mobile { display: none; }
.auth-card h1 { font-size: 26px; letter-spacing: -.03em; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin: 6px 0 26px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card .field input { padding: 12px 13px; border-radius: 11px; }
.auth-card .btn { width: 100%; padding: 12px; border-radius: 11px; font-size: 14px; }
.auth-card .foot { text-align: center; margin-top: 22px; font-size: 11.5px; color: var(--muted); }
.auth-error { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: 12.5px; margin-bottom: 16px; }

/* ---------- Feedback ---------- */
.flash-stack { position: fixed; right: 22px; top: 18px; z-index: 80; display: flex; flex-direction: column; gap: 9px; }
.flash {
  display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line);
  border-left: 3px solid var(--brand); border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 11px 14px; font-size: 12.5px; min-width: 280px; max-width: 380px; animation: slide-in .25s ease;
}
.flash.success { border-left-color: var(--ok); }
.flash.danger { border-left-color: var(--danger); }
.flash.warn { border-left-color: var(--accent); }
@keyframes slide-in { from { transform: translateY(-8px); opacity: 0; } }
.flash .x { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.right { text-align: right; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.badge-count { background: var(--brand-soft); color: var(--brand-dark); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.overline { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.print-only { display: none; }

/* ---------- Student Directory ---------- */
.dir-search { position: relative; margin-bottom: 18px; }
.dir-search-box {
  position: relative; display: flex; gap: 9px; padding: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.dir-search-box > svg { position: absolute; left: 24px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.dir-search-box input {
  flex: 1; min-width: 0; padding: 10px 12px 10px 42px; border: 1px solid transparent; background: var(--surface-2);
  border-radius: 10px; font-size: 13.5px; font-family: inherit; color: var(--ink); outline: none; transition: .15s;
}
.dir-search-box input:focus { border-color: #99d8d0; box-shadow: 0 0 0 4px rgba(15, 118, 110, .08); background: #fff; }

.dir-suggest {
  position: absolute; left: 10px; right: 10px; top: calc(100% - 8px); z-index: 80;
  background: #eef2f7; border: 1px solid #cbd5e1; border-radius: 12px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .24); max-height: 360px; overflow: auto;
}
.dir-suggest[hidden] { display: none; }
.dir-suggest-head {
  position: sticky; top: 0; z-index: 2; padding: 8px 12px; background: #e2e8f0;
  border-bottom: 1px solid #cbd5e1; font-size: 11px; font-weight: 700; color: var(--ink-2);
}
.dir-suggest-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dir-suggest-table th {
  position: sticky; top: 32px; z-index: 1; background: #eef2f7; text-align: left; padding: 7px 10px;
  font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid #cbd5e1;
}
.dir-suggest-table td { padding: 7px 10px; border-bottom: 1px solid #dbe3ec; white-space: nowrap; }
.dir-suggest-table tbody tr { cursor: pointer; }
.dir-suggest-table tbody tr:hover, .dir-suggest-table tbody tr.sel { background: var(--brand-soft); }
.dir-suggest-table tbody tr:hover td, .dir-suggest-table tbody tr.sel td { color: var(--brand-dark); }
.suggest-host { position: relative; }
.suggest-host .dir-suggest { left: 0; right: auto; top: calc(100% + 8px); width: 760px; max-width: calc(100vw - 32px); }
.search-global .search-suggest { left: 0; right: auto; top: calc(100% + 8px); width: 620px; max-width: calc(100vw - 32px); }

.dir-layout { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 18px; align-items: start; }
.dir-side { position: sticky; top: 84px; }
.dir-shift { display: flex; gap: 6px; margin: 10px 0 4px; }
.dir-shift a {
  flex: 1; text-align: center; padding: 6px 4px; border-radius: 8px; border: 1px solid var(--line);
  font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: #fff;
}
.dir-shift a:hover { border-color: #cbd5e1; background: var(--surface-2); }
.dir-shift a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.dir-check { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); margin: 8px 0 10px; cursor: pointer; }
.dir-check input { width: 14px; height: 14px; accent-color: var(--brand); }
.dir-class-wrap { position: relative; max-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.dir-class-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 11.5px; }
.dir-class-table th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; padding: 6px 5px;
  font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line);
}
.dir-class-table td { padding: 5px; border-bottom: 1px solid #f2f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-class-table tbody tr:hover { background: #f8fbfd; }
.dir-class-table tr.active { background: var(--brand-soft); }
.dir-class-table tr.active td { font-weight: 700; color: var(--brand-dark); }
.dir-class-table .cnt { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.dir-class-table .ttl { display: block; overflow: hidden; text-overflow: ellipsis; }

.dir-top { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; align-items: start; }
.dir-sheet { overflow: hidden; }
.dir-sheet-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fbfdfe, #fff);
}
.dir-sheet-head .right { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dir-sheet-title { font-size: 15px; font-weight: 800; margin-top: 2px; }
.dir-sheet-body { display: flex; gap: 18px; padding: 16px 18px; flex-wrap: wrap; }
.dir-idbox { width: 128px; flex: 0 0 auto; text-align: center; }
.dir-idbox .ph {
  width: 96px; height: 116px; margin: 0 auto; border-radius: 12px; object-fit: cover; overflow: hidden;
  background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 26px; font-weight: 800;
}
.dir-idbox .nm { font-size: 12.5px; font-weight: 700; margin-top: 8px; line-height: 1.3; }
.dir-idbox .sm { font-size: 11px; color: var(--muted); }
.dir-details { flex: 1; min-width: 260px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 16px; align-content: start; }
.dir-details .detail { border-bottom: 1px dashed #eef2f6; padding-bottom: 5px; }
.dir-details .detail.full { grid-column: span 2; border-bottom: 0; }
.dir-details .detail label { font-size: 9.5px; letter-spacing: .07em; }
.dir-details .detail div { font-size: 12.8px; }
.dir-details .dir-input {
  width: 100%; min-width: 0; margin: 0; padding: 1px 0;
  font: inherit; font-size: 12.8px; color: var(--ink);
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  appearance: none; -webkit-appearance: none;
}
.dir-details .dir-input.mono { font-family: "Courier New", monospace; font-size: 12px; }
.dir-details .dir-input:disabled { opacity: 1; color: var(--ink); -webkit-text-fill-color: var(--ink); }
.dir-details .dir-input:enabled { border-color: var(--line); background: #fff; padding: 4px 6px; }
.dir-details select.dir-input:enabled { appearance: auto; -webkit-appearance: auto; padding-right: 20px; }
.dir-details .dir-pair { display: flex; gap: 6px; }
.dir-details .dir-pair .dir-input { flex: 1; }
.dir-details .dir-edit-error { color: #b91c1c; font-size: 12px; min-height: 0; padding-bottom: 0; }
.dir-details .dir-edit-error:empty { display: none; }
.dir-upgrade-btn { margin-top: 10px; width: 100%; justify-content: center; }
.dir-empty { padding: 38px 22px; text-align: center; color: var(--muted); }

.dir-family { overflow: hidden; }
.dir-family-head {
  display: flex; align-items: center; gap: 8px; padding: 14px 18px;
  border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fbfdfe, #fff);
}
.dir-family-head .badge-count { margin-left: auto; }
.dir-family-list { max-height: 470px; overflow: auto; }
.dir-sib { display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px; border-bottom: 1px solid #f2f5f9; color: inherit; }
.dir-sib:last-child { border-bottom: 0; }
.dir-sib:hover { background: #f8fbfd; color: inherit; }
.dir-sib-main { flex: 1; min-width: 0; }
.dir-sib-name { font-weight: 700; font-size: 12.5px; color: var(--ink); }
.dir-sib .small { font-size: 11px; }
.dir-reasons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.dir-reasons .chip { font-size: 9.5px; padding: 2px 7px; }
.dir-sib-arrow { color: var(--muted); font-size: 18px; line-height: 1; margin-top: 4px; }

.dir-grid { overflow: hidden; }
.dir-statusbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 12.5px; }
.dir-statusbar .title { margin-left: auto; font-weight: 700; color: var(--ink-2); }
.dir-table { font-size: 12px; }
.dir-table thead th { padding: 8px 10px; font-size: 9.5px; }
.dir-table tbody td { padding: 7px 10px; }
.dir-table tbody tr.hl { background: #fff7ed; }
.dir-table tbody tr.hl:hover { background: #fff1dc; }
.dir-table tbody tr.moved { background: #fffbeb; box-shadow: inset 3px 0 0 #f59e0b; }
.dir-table tbody tr.moved:hover { background: #fef3c7; }
.dir-table tbody tr.moved.hl { background: #fff7ed; box-shadow: inset 3px 0 0 var(--brand); }
.dir-table .gr-link { font-weight: 700; }

.moves-card-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fbfdfe, #fff); }
.moves-card-head > div:first-child { flex: 1; min-width: 220px; }
.moves-batch-title { font-weight: 700; font-size: 13.5px; color: var(--ink); margin-top: 2px; }
.moves-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.moves-head-actions form { margin: 0; }
.moves-batch-table tbody tr.active { background: #f0f7ff; }
.moves-batch-table td .small { font-size: 11px; }
.moves-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fff; font-size: 12.5px; }
.moves-tools .dir-check { margin: 0; }
.moves-count b { color: var(--ink); }
.moves-item-table tbody tr.is-restored { color: var(--muted); }
.moves-item-table tbody tr.is-restored td { background: #fafbfc; }
.moves-item-table .moves-check { width: 34px; text-align: center; padding-left: 12px !important; padding-right: 4px !important; }
.moves-item-table .moves-check input { width: 14px; height: 14px; accent-color: var(--brand); cursor: pointer; }

@media (max-width: 1320px) {
  .dir-top { grid-template-columns: 1fr; }
}
@media (max-width: 1080px) {
  .dir-layout { grid-template-columns: 1fr; }
  .dir-side { position: static; }
  .dir-class-wrap { max-height: 280px; }
}
@media (max-width: 620px) {
  .dir-details { grid-template-columns: 1fr; }
  .dir-details .detail.full { grid-column: span 1; }
  .dir-search-box { flex-wrap: wrap; }
  .dir-search-box > svg { display: none; }
  .dir-search-box input { padding-left: 12px; width: 100%; flex: 1 1 100%; }
  .dir-search-box .btn { width: 100%; }
  .dir-suggest { left: 0; right: 0; }
  .dir-suggest-table th:nth-child(4), .dir-suggest-table td:nth-child(4),
  .dir-suggest-table th:nth-child(6), .dir-suggest-table td:nth-child(6) { display: none; }
}

/* ---------- School Leaving Certificate (A4 letterhead) ---------- */
.slc-sheet {
  background: #fff; color: #0f172a; width: 210mm; max-width: 100%; min-height: 285mm; margin: 0 auto;
  border: 1.5px solid #0f172a; padding: 70mm 18mm 14mm; box-sizing: border-box;
  font-family: Georgia, "Times New Roman", serif; position: relative;
  display: flex; flex-direction: column;
}
.slc-title {
  text-align: center; font-size: 24px; font-weight: 700; color: #1e3a8a; letter-spacing: .1em;
  text-transform: uppercase; margin: 0 0 1mm;
}
.slc-sub { text-align: center; font-family: "Segoe UI", Arial, sans-serif; font-size: 10.5px; color: #64748b; margin-bottom: 14mm; }
.slc-fields { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.slc-fields th {
  text-align: left; vertical-align: bottom; font-weight: 700; color: #1e3a8a;
  padding: 2.2mm 2mm 1.2mm 0; white-space: nowrap; width: 46mm;
}
.slc-fields th.narrow { width: 30mm; padding-left: 6mm; }
.slc-fields td {
  padding: 1.6mm 2mm 1mm; border-bottom: 1.2px solid #0f172a; font-weight: 700;
  vertical-align: bottom; font-family: "Segoe UI", Arial, sans-serif; font-size: 12px;
}
.slc-fields td.words { font-size: 10.5px; letter-spacing: .02em; }
.slc-cert {
  margin: 14mm 0 2mm; font-family: "Segoe UI", Arial, sans-serif; font-size: 12px; font-weight: 600; color: #1e3a8a;
}
.slc-school-line { text-align: right; font-size: 13px; font-weight: 700; color: #1e3a8a; padding-right: 4mm; }
.slc-signline {
  margin: auto auto 0; width: 70mm; text-align: center; font-family: "Segoe UI", Arial, sans-serif;
  font-size: 10.5px; font-weight: 600; color: #1e3a8a; border-top: 1px solid #0f172a; padding-top: 2.5mm;
}
@media print {
  .slc-sheet {
    width: 210mm; min-height: 285mm; margin: 0; border: 0; box-shadow: none;
    padding: 70mm 18mm 14mm;
  }
}

/* ESMIS-style printable student list */
.esmis-sheet {
  background: #fff; color: #0f172a; width: 210mm; max-width: 100%; margin: 0 auto;
  padding: 9mm 8mm; border: 1px solid #e2e8f0; box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
  font-family: "Segoe UI", Arial, sans-serif;
}
.esmis-head { display: grid; grid-template-columns: 20mm minmax(52mm, 1fr) auto auto; gap: 5mm; align-items: center; }
.esmis-logo { width: 21mm; height: auto; max-height: 19mm; object-fit: contain; }
.esmis-school-name { font-family: Georgia, "Times New Roman", serif; font-weight: 800; font-size: 16.5px; line-height: 1.15; color: #1e3a8a; text-transform: uppercase; letter-spacing: .02em; }
.esmis-school-sub { color: #b91c1c; font-size: 9px; margin-top: 2px; }
.esmis-title-box { border: 2px solid #0f172a; padding: 3px 14px; font-size: 19px; font-weight: 800; letter-spacing: .08em; box-shadow: 3px 3px 0 #cbd5e1; white-space: nowrap; }
.esmis-meta { font-size: 9.5px; line-height: 1.55; text-align: right; white-space: nowrap; }
.esmis-campus { text-align: center; font-size: 10.5px; margin: 4mm 0 3mm; }
.esmis-group { margin-bottom: 4mm; break-inside: avoid; page-break-inside: avoid; }
.esmis-group-meta { display: flex; gap: 22px; font-size: 10px; margin-bottom: 2px; }
.esmis-table { width: 100%; border-collapse: collapse; font-size: 9.6px; }
.esmis-table th, .esmis-table td { border: 1px solid #1e293b; padding: 2.5px 4px; text-align: left; vertical-align: top; }
.esmis-table thead th { background: #e2e8f0; font-weight: 700; }
.esmis-table .esmis-class-title { text-align: center; font-size: 11px; font-weight: 800; letter-spacing: .03em; }
.esmis-table .esmis-col-s { width: 8mm; }
@media (max-width: 760px) {
  .esmis-head { grid-template-columns: 16mm 1fr; }
  .esmis-title-box, .esmis-meta { grid-column: span 2; justify-self: start; text-align: left; }
}
.overlay { position: fixed; inset: 0; background: rgba(8, 15, 30, .5); z-index: 35; opacity: 0; pointer-events: none; transition: .2s; }
.overlay.show { opacity: 1; pointer-events: auto; }
.menu-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto;
  border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink-2);
}
.menu-btn:hover { background: var(--surface-2); }
.menu-btn svg { width: 18px; height: 18px; }
html.sidebar-collapsed .sidebar { transform: translateX(-100%); }
html.sidebar-collapsed .main { margin-left: 0; }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid .col-3, .form-grid .col-4 { grid-column: span 2; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .detail .full { grid-column: span 2; }
}

@media (min-width: 901px) and (max-height: 680px) {
  .sidebar { overflow-y: auto; }
  .sidebar::-webkit-scrollbar { width: 6px; }
  .sidebar::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, .25); border-radius: 999px; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .search-global { display: none; }
  .content { padding: 18px 16px 36px; }
  .auth { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .auth-card .logo-mobile { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
  .auth-card .logo-mobile .brand-logo { width: 42px; height: 42px; }
}

@media (max-width: 620px) {
  .kpis { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .col-2, .form-grid .col-3, .form-grid .col-4 { grid-column: span 1; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail .full { grid-column: span 1; }
  .page-head h2 { font-size: 19px; }
  .check-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: 1fr; }
  .table-tools { padding: 12px; }
  .chart-row { grid-template-columns: 100px 1fr 38px; }
  .steps { grid-template-columns: 1fr; }
}

@media print {
  @page { size: A4; margin: 8mm; }
  body { background: #fff; }
  .sidebar, .flash-stack, .no-print, .page-head .actions, .id-toolbar, .overlay { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; }
  .id-grid { display: flex; flex-wrap: wrap; gap: 5mm; }
  .id-card { box-shadow: none; border: 1px solid #cbd5e1; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-only { display: block; }
  .print-title { display: block; margin-bottom: 5mm; }
  .table thead th { background: #f1f5f9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .id-top { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .esmis-sheet { width: auto; max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; }
  .esmis-sheet, .esmis-sheet * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .esmis-table { font-size: 9.2px; }
  .esmis-head { grid-template-columns: 18mm minmax(50mm, 1fr) auto auto; }
  /* Fees due / ledger print: poora grid A4 width mein fit ho */
  .table-wrap { overflow: visible !important; }
  .ledger-search, .lh-range { display: none !important; }
  .table.table { font-size: 9.5px; }
  .table thead th { font-size: 7.8px; padding: 4px 5px; letter-spacing: .03em; white-space: normal; }
  .table tbody td { padding: 4px 5px; }
  .ledger-table { min-width: 0 !important; width: 100%; font-size: 8.4px; }
  .ledger-table th, .ledger-table td { white-space: normal; padding: 3px 4px; }
  .ledger-table td.name-cell { white-space: normal; }
  .ledger-foot td { font-size: 8.6px; }
  .yb-card, .stat-strip, .ledger-table tfoot td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .yb-card { break-inside: avoid; }
  .card.table-card { break-inside: auto; }
}

/* ---------- Activity ---------- */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow); }
.stat .label { display: block; font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.stat b { font-size: 20px; letter-spacing: -.02em; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.hub-card { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease; }
.hub-card:hover { transform: translateY(-2px); border-color: #c7d2de; }
.hub-badge { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; }
.hub-brand { background: var(--brand-soft); color: var(--brand-dark); }
.hub-info { background: var(--info-soft); color: var(--info); }
.hub-ok { background: var(--ok-soft); color: var(--ok); }
.hub-warn { background: var(--warn-soft); color: var(--warn); }
.hub-title { font-weight: 700; color: var(--ink); font-size: 14px; }
.hub-desc { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.list-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.tt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tt-head h3 { font-size: 15px; margin-top: 2px; }
.tt-table { width: 100%; border-collapse: collapse; min-width: 820px; }
.tt-table th, .tt-table td { border-bottom: 1px solid #eef2f7; padding: 8px; text-align: center; font-size: 12px; vertical-align: middle; }
.tt-table thead th { background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 11.5px; }
.tt-table th.tt-day { text-align: left; min-width: 96px; position: sticky; left: 0; background: var(--surface-2); z-index: 2; }
.tt-table tbody th.tt-day { background: #fff; font-weight: 700; color: var(--ink-2); }
.tt-time { display: block; font-weight: 500; font-size: 10px; color: var(--muted); }
.tt-select { width: 100%; min-width: 92px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 6px; font-size: 11.5px; background: #fff; color: var(--ink); }
.tt-select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.tt-chip { background: var(--brand-soft); border-radius: 8px; padding: 5px 6px; line-height: 1.25; }
.tt-chip b { display: block; font-size: 11.5px; color: var(--brand-dark); }
.tt-chip span { font-size: 10px; color: var(--brand); }
.att-bar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.att-quick { display: flex; gap: 6px; margin-left: auto; }
.att-counts { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.att-select { width: 120px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12px; font-weight: 600; }
.att-p { background: var(--ok-soft); color: var(--ok); border-color: #bbf7d0; }
.att-a { background: var(--danger-soft); color: var(--danger); border-color: #fecdd3; }
.att-l { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }
.att-h { background: #f1f5f9; color: var(--muted); }
.att-table .att-status-col { width: 140px; }
.marks-total { width: 76px; display: inline-block; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font-size: 13px; font-weight: 700; text-align: center; }
.marks-table th.marks-th { min-width: 86px; font-size: 11px; }
.marks-table .sticky-col { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 180px; text-align: left; }
.marks-table thead .sticky-col { background: var(--surface-2); }
.mark-input { width: 68px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; font-size: 12px; text-align: center; }
.mark-input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.grade-tag { font-size: 10px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.grade-ap, .grade-a1, .grade-a { color: var(--ok); }
.grade-b, .grade-c { color: var(--info); }
.grade-d, .grade-e { color: var(--warn); }
.grade-f { color: var(--danger); }
.slab-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.slab-chip { font-size: 11.5px; color: var(--text); }
.slab-chip b { margin-right: 2px; }
.slab-table td { vertical-align: middle; }
.slab-table td:nth-child(4) input { min-width: 260px; }
.class-setup { display: grid; grid-template-columns: 390px minmax(0, 1fr); gap: 16px; align-items: start; }
.cs-shift-form { display: flex; gap: 14px; flex-wrap: wrap; }
.cs-table td, .cs-table th { white-space: nowrap; }
.cs-table a { color: inherit; }
.cs-table tbody tr.active { background: var(--brand-soft); }
.cs-table tbody tr.active a { font-weight: 700; }
.cs-class-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.cs-class-head h3 { margin: 2px 0 0; }
.cs-class-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.btn-danger-ghost { color: var(--danger); }
@media (max-width: 980px) { .class-setup { grid-template-columns: 1fr; } }

/* Fee receipt (A4 + thermal 80mm) */
.fee-receipt { background:#fff; width:190mm; max-width:100%; margin:0 auto; padding:12mm 14mm; border:1px solid #e2e8f0; box-shadow:0 12px 30px rgba(15,23,42,.12); font-family:"Segoe UI",Arial,sans-serif; font-size:13px; color:#0f172a; }
.fr-head { display:flex; justify-content:space-between; align-items:flex-start; gap:6mm; border-bottom:2px solid #1e3a8a; padding-bottom:3mm; }
.fr-school { font-family:Georgia,"Times New Roman",serif; font-weight:800; font-size:17px; color:#1e3a8a; text-transform:uppercase; }
.fr-sub { font-size:9.5px; color:#475569; margin-top:2px; }
.fr-title { border:2px solid #0f172a; padding:2px 10px; font-weight:800; letter-spacing:.08em; font-size:14px; white-space:nowrap; }
.fr-meta { display:grid; grid-template-columns:1fr 1fr; gap:2px 10mm; margin:3mm 0 2mm; font-size:11.5px; }
.fr-meta span, .fr-student span { color:#64748b; margin-right:4px; }
.fr-meta div, .fr-student div { display:flex; justify-content:space-between; border-bottom:1px dotted #cbd5e1; padding:1px 0; }
.fr-student { display:grid; grid-template-columns:26mm minmax(0,1fr); gap:2px 10mm; font-size:11.5px; }
.fr-class { font-size:11px; color:#475569; margin:2mm 0 1mm; }
.fr-table { width:100%; border-collapse:collapse; font-size:11.5px; margin-top:1mm; }
.fr-table th, .fr-table td { border:1px solid #94a3b8; padding:3px 5px; }
.fr-table thead th { background:#e2e8f0; text-align:left; }
.fr-table th.num, .fr-table td.num { text-align:right; }
.fr-table tfoot td { border-top:1.5px solid #0f172a; }
.fr-table .fr-strong td { font-weight:800; }
.fr-note { font-size:10px; color:#475569; margin:2.5mm 0; }
.fr-sign { display:flex; justify-content:space-between; gap:10mm; margin-top:8mm; font-size:10px; color:#334155; }
.fr-signline { border-top:1px solid #0f172a; margin-top:10mm; padding-top:2px; min-width:40mm; text-align:center; }

/* Thermal slip: 80mm roll */
.fee-receipt.receipt-thermal { width:72mm; padding:0; font-size:10px; border:0; box-shadow:none; }
.receipt-thermal .fr-head { flex-direction:column; align-items:center; text-align:center; gap:1mm; border-bottom:1px dashed #0f172a; padding-bottom:1.5mm; }
.receipt-thermal .fr-school { font-size:12px; }
.receipt-thermal .fr-sub { font-size:8px; margin-top:0; }
.receipt-thermal .fr-title { border:0; padding:0; font-size:11px; letter-spacing:.14em; }
.receipt-thermal .fr-meta { grid-template-columns:1fr; gap:1px; margin:1.5mm 0 1mm; }
.receipt-thermal .fr-meta div, .receipt-thermal .fr-student div { border-bottom:1px dotted #e2e8f0; }
.receipt-thermal .fr-student { grid-template-columns:1fr; gap:1px; }
.receipt-thermal .fr-meta, .receipt-thermal .fr-student { font-size:9.5px; }
.receipt-thermal .fr-class { font-size:9px; margin:1.5mm 0 .5mm; }
.receipt-thermal .fr-table { font-size:9.5px; }
.receipt-thermal .fr-table th, .receipt-thermal .fr-table td { border:0; border-bottom:1px solid #cbd5e1; padding:2px 3px; }
.receipt-thermal .fr-table thead th { background:none; border-bottom:1.5px solid #0f172a; }
.receipt-thermal .fr-table tfoot td { border-bottom:0; }
.receipt-thermal .fr-note { font-size:8.5px; margin:1.5mm 0; }
.receipt-thermal .fr-sign { gap:6mm; margin-top:5mm; font-size:8.5px; }
.receipt-thermal .fr-sign > div { flex:1; }
.receipt-thermal .fr-signline { margin-top:6mm; min-width:0; }
.fr-thanks { text-align:center; font-size:8.5px; color:#475569; margin-top:2.5mm; }
@media print { .fee-receipt { width:auto; max-width:none; border:0; box-shadow:none; padding:0; } }
.slab-table input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 12.5px; }
.slab-table input.slab-input { width: 90px; text-align: center; }
.slab-table input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.form-grid .form-actions { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 2px; }
.inline-form { display: inline-flex; align-items: center; gap: 4px; }
.mini-select { border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; font-size: 11.5px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-x { display: inline-flex; margin-left: 4px; }
.chip-x button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; }
.diary-table .diary-text { max-width: 320px; }
.row-active { background: var(--brand-soft) !important; }
.row-today { background: #f0fdf4 !important; }
.row-open { background: var(--surface-2); }
.ledger-table th.right, .ledger-table td.num { font-variant-numeric: tabular-nums; }
.summary-line { cursor: pointer; font-weight: 600; color: var(--ink-2); }
@media (max-width: 1080px) {
  .form-grid-4, .form-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .form-grid-4, .form-grid-5 { grid-template-columns: 1fr; }
}

/* ---------- Subject setup ---------- */
.subject-setup { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.subject-catalog { max-height: 560px; overflow: auto; }
.subject-catalog thead th { position: sticky; top: 0; z-index: 1; }
.subject-catalog table.table { table-layout: fixed; width: 100%; }
.subject-catalog thead th { white-space: normal; line-height: 1.2; font-size: 10px; padding: 9px 8px; }
.subject-catalog tbody td { padding: 9px 8px; font-size: 12px; overflow-wrap: anywhere; }
.subject-catalog th:nth-child(1) { width: 28%; }
.subject-catalog th:nth-child(2) { width: 23%; }
.subject-catalog th:nth-child(3) { width: 28%; }
.subject-catalog th:nth-child(4) { width: 21%; }
.subject-catalog tbody td:last-child { white-space: nowrap; padding: 6px; }
.subject-catalog tbody td:last-child .btn { padding: 5px 9px; }
.subject-catalog tbody td:last-child .chip { padding: 3px 7px; font-size: 10.5px; }
.setup-table { table-layout: fixed; min-width: 950px; width: 100%; }
.setup-table thead th {
  font-size: 9.5px; letter-spacing: .03em; font-weight: 700;
  white-space: normal; overflow-wrap: break-word; line-height: 1.2;
  padding: 8px 5px; vertical-align: bottom; text-align: left;
}
.setup-table td { padding: 6px 7px; overflow-wrap: anywhere; }
.setup-table .name-cell { min-width: 0; }
.setup-table th:nth-child(1), .setup-table td:nth-child(1),
.setup-table th:nth-child(2), .setup-table td:nth-child(2) { width: 86px; }
.setup-table th:nth-child(3), .setup-table td:nth-child(3) { width: 118px; }
.setup-table th:nth-child(4), .setup-table td:nth-child(4) { width: 52px; }
.setup-table th:nth-child(5), .setup-table td:nth-child(5) { width: 44px; }
.setup-table th:nth-child(6), .setup-table td:nth-child(6) { width: 56px; }
.setup-table th:nth-child(7), .setup-table td:nth-child(7) { width: 62px; }
.setup-table th:nth-child(8), .setup-table td:nth-child(8) { width: 122px; }
.setup-table th:nth-child(9), .setup-table td:nth-child(9) { width: 52px; }
.setup-table th:nth-child(10), .setup-table td:nth-child(10) { width: 96px; }
.setup-table th:nth-child(11), .setup-table td:nth-child(11) { width: 122px; }
.setup-table th:nth-child(12), .setup-table td:nth-child(12) { width: 38px; }
.setup-table .center { text-align: center; }
.seq-input { width: 58px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; font-size: 12px; text-align: center; }
.date-input { width: 128px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; font-size: 11.5px; }
.setup-table .seq-input, .setup-table .date-input, .setup-table .mini-select { width: 100%; box-sizing: border-box; }
.setup-table .seq-input { padding: 5px 2px; }
.setup-table .date-input { padding: 5px 3px; }
.setup-table .mini-select { padding: 5px 3px; }
.logo-upload { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface-2); }
.logo-preview { width: 64px; height: 64px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px; flex: 0 0 auto; }
.logo-upload input[type="file"] { font-size: 12px; max-width: 100%; }
.check-inline { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 6px; }
.setup-legend { display: flex; align-items: center; gap: 8px; padding: 11px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.setup-legend .spacer { flex: 1; }
.legend-chip { padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 600; border: 1px solid var(--line); }
.sheet-0 { background: #f8fafc; color: var(--ink-2); }
.sheet-1 { background: #fef9c3; color: #854d0e; }
.sheet-2 { background: #ffedd5; color: #9a3412; }
.sheet-3 { background: #e0f2fe; color: #075985; }
select.sheet-0, select.sheet-1, select.sheet-2, select.sheet-3 { font-weight: 600; }
@media (max-width: 1180px) {
  .subject-setup { grid-template-columns: minmax(0, 1fr); }
  .subject-catalog { max-height: 300px; }
}

/* ---------- Admit card ---------- */
.admit-stack { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.admit-sheet {
  width: 210mm; max-width: 100%; min-height: 146mm; background: #fff; color: #0f172a;
  border: 1px solid #cbd5e1; padding: 7mm 10mm 6mm; margin: 0 auto;
  display: flex; flex-direction: column; font-family: Georgia, "Times New Roman", serif;
  box-shadow: 0 10px 30px -24px rgba(15, 23, 42, .5);
}
.admit-head { display: grid; grid-template-columns: 26mm minmax(0, 1fr) 66mm; gap: 4mm; align-items: center; }
.admit-logo { width: 24mm; height: 24mm; object-fit: contain; }
.admit-school { text-align: center; line-height: 1.2; }
.admit-school .nm { font-size: 17px; font-weight: 700; letter-spacing: .02em; }
.admit-school .ad { font-size: 10.5px; margin-top: 1mm; }
.admit-school .ph { font-size: 10px; font-weight: 700; }
.admit-title .box {
  background: #e0f2fe; border: 1px solid #0f172a; text-align: center;
  font-size: 21px; letter-spacing: .1em; padding: 2.2mm 1mm; color: #0c4a6e;
}
.admit-title .exam { text-align: center; border-bottom: 1px solid #0f172a; padding: 2.5mm 1mm 1mm; font-size: 13px; font-weight: 700; }
.admit-body { display: grid; grid-template-columns: minmax(0, 1fr) 25mm; gap: 6mm; margin-top: 4.5mm; }
.admit-line { display: flex; align-items: baseline; gap: 2.4mm; margin-bottom: 3mm; font-size: 12px; white-space: nowrap; }
.admit-line .lbl { color: #7f1d1d; font-weight: 600; }
.admit-line .val { border-bottom: 1px solid #0f172a; min-width: 22mm; padding: 0 1.5mm 0.4mm; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.admit-line .val.wide { flex: 1; min-width: 70mm; }
.admit-photo { width: 25mm; height: 30mm; border: 1px solid #64748b; display: grid; place-items: center; overflow: hidden; font-family: var(--font); font-size: 18px; font-weight: 700; color: #94a3b8; background: #f8fafc; justify-self: end; }
.admit-photo img { width: 100%; height: 100%; object-fit: cover; }
.admit-table { width: 100%; border-collapse: collapse; margin-top: 4mm; table-layout: fixed; }
.admit-table th, .admit-table td { border: 1px solid #0f172a; padding: 1.3mm 2mm; font-size: 11.5px; }
.admit-table th { background: #e0f2fe; font-weight: 700; }
.admit-table .subj { font-weight: 600; }
.admit-table .date { text-align: center; font-family: var(--font); }
.admit-table th:nth-child(1), .admit-table th:nth-child(4) { width: 27%; }
.admit-table th:nth-child(2), .admit-table th:nth-child(5) { width: 16%; }
.admit-table th:nth-child(3), .admit-table th:nth-child(6) { width: 7%; }
.admit-foot { margin-top: auto; padding-top: 3mm; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2mm 6mm; align-items: end; font-size: 11px; font-family: var(--font); }
.admit-notebox { border: 1px solid #0f172a; padding: 1.5mm 2mm; }
.admit-notebox span { color: #7f1d1d; font-weight: 700; }
.admit-issue { text-align: right; font-size: 10px; }
.admit-id { font-family: "Courier New", monospace; font-size: 12px; letter-spacing: .04em; }
.admit-sign { text-align: center; border-top: 1px solid #7f1d1d; color: #7f1d1d; font-weight: 700; padding-top: 1mm; min-width: 52mm; }
.admit-single { position: absolute; right: 6mm; top: 6mm; font-size: 10px; color: var(--brand); opacity: 0; }
.admit-sheet:hover .admit-single { opacity: 1; }
.admit-sheet { position: relative; }
@media print {
  .admit-stack { display: block; }
  .admit-sheet { width: 210mm; min-height: 146mm; max-width: none; border: 0; box-shadow: none; margin: 0; page-break-after: always; break-after: page; padding: 7mm 10mm 6mm; }
  .admit-sheet:last-child { page-break-after: auto; break-after: auto; }
  .admit-single { display: none; }
}

/* ---------- Blank marks sheet ---------- */
.ms-stage { overflow-x: auto; }
.ms-sheet {
  width: 100%; max-width: 281mm; background: #fff; color: #0f172a;
  border: 1px solid #cbd5e1; padding: 5mm 6mm; margin: 0 auto;
  box-shadow: 0 10px 30px -24px rgba(15, 23, 42, .5);
}
.ms-head { display: grid; grid-template-columns: 20mm minmax(0, 1fr) 70mm; gap: 4mm; align-items: center; }
.ms-logo { width: 18mm; height: 18mm; object-fit: contain; }
.ms-school { text-align: center; line-height: 1.25; }
.ms-school .nm { font-size: 16px; font-weight: 800; }
.ms-school .ad { font-size: 9.5px; margin-top: .6mm; }
.ms-title .box { background: #e0f2fe; border: 1px solid #0f172a; text-align: center; font-size: 15px; font-weight: 800; letter-spacing: .06em; padding: 1.8mm 1mm; color: #0c4a6e; }
.ms-title .exam { text-align: center; border-bottom: 1px solid #0f172a; padding: 1.8mm 1mm .8mm; font-size: 10.5px; font-weight: 700; }
.ms-meta { display: flex; flex-wrap: wrap; gap: 2mm 8mm; margin: 3mm 0 2mm; font-size: 9.5px; }
.ms-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 8.5px; }
.ms-table th, .ms-table td { border: 1px solid #0f172a; padding: 1mm 1.2mm; text-align: left; }
.ms-table thead th { background: #e2e8f0; font-size: 7px; line-height: 1.15; text-transform: uppercase; letter-spacing: .02em; vertical-align: bottom; overflow-wrap: anywhere; white-space: normal; }
.ms-table .ms-subj { display: block; }
.ms-table .ms-max { display: block; font-weight: 400; color: #475569; }
.ms-table tbody td { height: 6mm; }
.ms-table tbody td.c { text-align: center; }
.ms-table tbody td.nm { font-weight: 600; }
.ms-table tbody .mono { font-family: "Courier New", monospace; }
.ms-table tbody tr { page-break-inside: avoid; break-inside: avoid; }
.ms-table .ms-totals td { background: #f1f5f9; font-size: 8px; font-weight: 700; height: 6mm; }
.ms-table .ms-totals td[colspan] { text-align: right; padding-right: 2mm; }
.ms-table .ms-total-row td { border-top: 2px solid #0f172a; }
.ms-table .ms-totals { page-break-inside: avoid; break-inside: avoid; }
.ms-table thead th, .ms-title .box { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ms-foot { display: flex; justify-content: space-between; gap: 4mm; margin-top: 2mm; font-size: 8px; color: #475569; }
@media print {
  .ms-stage { overflow: visible; }
  .ms-sheet { width: 100%; max-width: none; border: 0; box-shadow: none; padding: 0; margin: 0; }
  .ms-table thead { display: table-header-group; }
}

/* ---------- Top navigation shell (2026-11-30) ---------- */
.appbar {
  position: sticky; top: 0; z-index: 45; display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 16px;
  background: linear-gradient(90deg, var(--sidebar) 0%, var(--sidebar-2) 62%, #0b2230 100%);
  color: #cbd5e1;
}
.ab-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 0 auto; }
.ab-logo { width: 30px; height: 30px; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(16, 185, 129, .3)); }
.ab-name {
  color: #f8fafc; font-weight: 700; font-size: 13px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}
.topnav { display: flex; align-items: center; gap: 1px; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }
.topnav::-webkit-scrollbar { display: none; }
.tn-link {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 9px; border-radius: 8px;
  color: #cbd5e1; font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer; list-style: none;
}
.tn-link::-webkit-details-marker { display: none; }
.tn-link:hover { background: rgba(148, 163, 184, .12); color: #f1f5f9; }
.tn-link.active { background: rgba(45, 212, 191, .18); color: var(--on-dark-accent); }
.tn-caret { width: 13px; height: 13px; opacity: .75; transition: transform .18s ease; }
.tn-group[open] .tn-caret { transform: rotate(180deg); }
.tn-group { position: relative; flex: 0 0 auto; }
.tn-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 215px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 60; display: flex; flex-direction: column; gap: 2px;
}
.tn-item { padding: 8px 11px; border-radius: 8px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.tn-item:hover { background: var(--surface-2); color: var(--ink); }
.tn-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.tn-item.soon { color: var(--muted); cursor: default; display: flex; align-items: center; gap: 8px; }
.tn-item .badge-soon {
  font-size: 9px; font-weight: 700; letter-spacing: .06em;
  background: #f1f5f9; color: #94a3b8; padding: 2px 6px; border-radius: 999px;
}
.ab-spacer { flex: 1 1 12px; }
.appbar .ab-session { font-size: 10.5px; padding: 4px 9px; background: rgba(45, 212, 191, .14); color: var(--on-dark-accent); white-space: nowrap; }
.appbar .ab-session .dot { background: var(--on-dark-accent); box-shadow: 0 0 0 3px rgba(45, 212, 191, .16); }
.appbar .avatar { width: 30px; height: 30px; font-size: 11.5px; }
.appbar .userbox .menu { top: 42px; }
@media (max-width: 1150px) { .appbar .ab-session { display: none; } }
@media (max-width: 1280px) { .ab-name { display: none; } }
.main { margin-left: 0; min-height: calc(100vh - 52px); }
@media (max-width: 900px) {
  .appbar { padding: 0 12px; gap: 10px; }
  .ab-name { display: none; }
}
@media print {
  .appbar { display: none !important; }
}

/* ESMIS-style fees ledger (2026-11-30) */
.ledger-search { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.ledger-search label { min-width: 90px; }
.ledger-search input {
  flex: 0 1 260px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; background: #fff;
}
.ledger-head { padding: 12px 14px 14px; }
.lh-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 10px 18px; }
.lh-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lh-label { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.lh-item b { font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lh-balance b { color: #b91c1c; font-size: 16px; }
.lh-range { grid-column: span 2; }
.lh-range-inputs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lh-range input[type="date"] {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; background: #fff;
}
.ledger-table { min-width: 1080px; font-size: 12.5px; }
.ledger-table th { white-space: nowrap; }
.ledger-table td { white-space: nowrap; }
.ledger-table tfoot td { border-top: 1.5px solid var(--ink); background: var(--surface-2); font-size: 12.5px; }
.ledger-table tfoot td.num b { color: var(--ink); }
.ledger-foot td b { margin-right: 4px; }
@media (max-width: 760px) {
  .lh-grid { grid-template-columns: 1fr; }
  .lh-range { grid-column: auto; }
}

/* Fees due breakup strip (2026-11-30) */
.bk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 0; flex-wrap: wrap; }
.bk-grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 14px 14px; }
.bk-item {
  min-width: 132px; display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 13px; background: var(--surface-2);
}
.bk-label { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.bk-item b { font-size: 15px; color: var(--ink); }
.bk-sub { font-size: 10.5px; color: var(--muted); }
.bk-total { background: var(--brand-soft); border-color: transparent; }
.bk-total b { color: var(--brand-dark); font-size: 17px; }

/* ESMIS-style Year breakup (Fees Due) */
.yb-card { padding: 0; }
.yb-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 12px 14px; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.yb-head h3 { margin: 2px 0 0; font-size: 15px; }
.yb-grid { display: flex; gap: 10px; padding: 12px 14px 14px; flex-wrap: wrap; align-items: stretch; }
.yb-col { flex: 1 1 170px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.yb-cell { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: #fff; }
.yb-cell span { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yb-cell b { font-size: 13px; color: var(--ink); white-space: nowrap; }
.yb-zero b { color: var(--muted); font-weight: 600; }
.yb-total { flex: 0 0 150px; border: 1.5px solid var(--ink); border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 10px; }
.yb-total span { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.yb-total b { font-size: 18px; color: var(--ink); }

/* Dashboard search/session bar */
.dash-bar { display: flex; align-items: center; gap: 12px; padding: 8px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.dash-bar .dash-search { width: min(420px, 46vw); }
.dash-bar .dash-search input { padding: 7px 12px 7px 34px; font-size: 12.5px; }
.dash-bar .dash-search svg { top: 8px; width: 15px; height: 15px; }
.dash-bar .dash-session { font-size: 11.5px; padding: 5px 11px; }
@media (max-width: 900px) { .dash-bar { padding: 8px 16px; } }
/* Permissions page */
.perm-special { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.perm-special-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.perm-user { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.perm-quick { display: flex; gap: 6px; }
.perm-group { margin-top: 8px; }
.perm-group-label { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.perm-items { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.perm-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.perm-item input { width: 14px; height: 14px; accent-color: var(--brand); }
.perm-actions { margin-top: 16px; position: sticky; bottom: 0; padding: 10px 0; background: linear-gradient(to top, var(--bg) 60%, transparent); }

/* ---------- Themes (2026-12-02) ---------- */
.search-global input, .field input, .field select, .field textarea, .mini-select,
.page-btn, .userbox .menu, .tn-menu, .flash, .btn-ghost { background: var(--surface); }
.search-global input:focus { background: var(--surface); }
.appbar { background: linear-gradient(90deg, var(--sidebar) 0%, var(--sidebar-2) 62%, var(--sidebar-3, #0b2230) 100%); }
.sidebar { background: linear-gradient(168deg, var(--sidebar) 0%, var(--sidebar-2) 55%, var(--sidebar-3, #0b2230) 100%); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); }
.avatar { background: linear-gradient(140deg, var(--brand), var(--brand-dark)); }

html[data-theme="ocean"] {
  --brand: #1d4ed8; --brand-dark: #1e40af; --brand-deep: #172554; --brand-soft: #e3ecff;
  --sidebar: #0a1730; --sidebar-2: #0f2a4f; --sidebar-3: #0c3557; --on-dark-accent: #93c5fd;
}
html[data-theme="forest"] {
  --brand: #15803d; --brand-dark: #166534; --brand-deep: #14532d; --brand-soft: #e4f6e9;
  --sidebar: #081f12; --sidebar-2: #0c2c1a; --sidebar-3: #0e3a22; --on-dark-accent: #86efac;
}
html[data-theme="violet"] {
  --brand: #7c3aed; --brand-dark: #6d28d9; --brand-deep: #4c1d95; --brand-soft: #f0e9ff;
  --sidebar: #120d22; --sidebar-2: #1c1533; --sidebar-3: #241a41; --on-dark-accent: #c4b5fd;
}
html[data-theme="sunset"] {
  --brand: #be185d; --brand-dark: #9d174d; --brand-deep: #500724; --brand-soft: #ffe6f1;
  --accent: #f97316; --sidebar: #260b17; --sidebar-2: #381024; --sidebar-3: #45142c; --on-dark-accent: #f9a8d4;
}
html[data-theme="midnight"] {
  --bg: #0b1220; --surface: #121b2c; --surface-2: #0e1626;
  --ink: #e6edf7; --ink-2: #c3d0e2; --muted: #8b9cb3; --line: #243349;
  --brand: #2dd4bf; --brand-dark: #14b8a6; --brand-deep: #0f766e; --brand-soft: #0f3330;
  --ok: #34d399; --ok-soft: #0e3327; --warn: #fbbf24; --warn-soft: #3a2b10;
  --danger: #fb7185; --danger-soft: #3c1420; --info: #38bdf8; --info-soft: #0c2b43;
  --accent: #f59e0b; --sidebar: #050a13; --sidebar-2: #0a1626; --sidebar-3: #0c2033; --on-dark-accent: #5eead4;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 14px 34px -22px rgba(0, 0, 0, .9);
  --shadow-lg: 0 24px 60px -28px rgba(0, 0, 0, .95);
}
html[data-theme="midnight"] .table thead th { background: #16233a; }
html[data-theme="midnight"] .table tbody td { border-bottom-color: #1d2b42; }
html[data-theme="midnight"] .table tbody tr:hover { background: #16233a; }
html[data-theme="midnight"] .btn { background: #182741; color: var(--ink-2); border-color: var(--line); }
html[data-theme="midnight"] .btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #04241f; }
html[data-theme="midnight"] .btn-primary:hover { color: #04241f; }
html[data-theme="midnight"] .btn-ghost { background: #182741; border-color: var(--line); }
html[data-theme="midnight"] .btn-ghost:hover { background: #1e3050; border-color: #2f4463; }
html[data-theme="midnight"] .btn-danger, html[data-theme="midnight"] .btn-danger-ghost { background: #3c1420; color: #fb7185; border-color: #5a1e2c; }
html[data-theme="midnight"] .btn-soft { background: var(--brand-soft); color: var(--brand); }
html[data-theme="midnight"] .chip-muted { background: #1d2b42; }
html[data-theme="midnight"] .search-global input:focus { border-color: #2dd4bf; background: #182741; }
html[data-theme="midnight"] .field input, html[data-theme="midnight"] .field select, html[data-theme="midnight"] .field textarea { border-color: var(--line); }
html[data-theme="midnight"] .field input:focus, html[data-theme="midnight"] .field select:focus, html[data-theme="midnight"] .field textarea:focus { border-color: #2dd4bf; }
html[data-theme="midnight"] .tn-item:hover { background: #1d2b42; }
html[data-theme="midnight"] .userbox .menu button:hover { background: #3c1420; }
html[data-theme="midnight"] .page-btn.current { color: #04241f; }
html[data-theme="midnight"] .dropzone { background: #101b2e; border-color: #2f4463; }
html[data-theme="midnight"] .empty svg { color: #3a4d68; }
html[data-theme="midnight"] .row-today { background: #12301f !important; }
html[data-theme="midnight"] .dir-table tbody tr.hl, html[data-theme="midnight"] .dir-sib:hover { background: #1c2b45; }

/* Theme picker (user menu) */
.theme-pick { padding: 10px; border-top: 1px solid var(--line); margin-top: 6px; }
.tp-label { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.theme-grid { display: flex; gap: 7px; flex-wrap: wrap; }
.theme-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; background: none; padding: 0; cursor: pointer; display: grid; place-items: center; }
.userbox .menu .theme-swatch { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid transparent; background: none; text-align: center; }
.userbox .menu .theme-swatch:hover { background: none; border-color: var(--line); color: inherit; }
.userbox .menu .theme-swatch.active { border-color: var(--brand); }
.userbox .menu .theme-swatch.active:hover { border-color: var(--brand); }
.theme-swatch span { width: 18px; height: 18px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }
.theme-swatch:hover { border-color: var(--line); }
.theme-swatch.active { border-color: var(--brand); }
.login-theme { display: flex; gap: 8px; justify-content: center; margin-top: 22px; }
.login-theme .theme-swatch { width: 22px; height: 22px; }
.login-theme .theme-swatch span { width: 15px; height: 15px; }
