/* ==========================================================================
   STIR Technologies — School Management System (Demo)
   Colour palette is taken directly from the STIR Technologies logo.
   Logo samples: navy #00071A / #001336, deep blue #012161, royal #004AFA,
   azure #0193FE, cyan #00B5FD, gold #D49518, star-gold #F6CC3F
   ========================================================================== */
:root {
  --navy-950: #00071a;
  --navy-900: #001336;
  --navy-800: #012161;
  --primary: #004afa;
  --primary-600: #003ad0;
  --azure: #0193fe;
  --cyan: #00b5fd;
  --gold: #d49518;
  --gold-2: #f6cc3f;
  --primary-soft: #e8f1ff;
  --gold-soft: #fdf4dc;

  --bg: #f2f6fc;
  --surface: #ffffff;
  --surface-2: #f6f9fe;
  --border: #e0e8f4;
  --border-strong: #c9d6ea;
  --text: #0b1730;
  --muted: #5b6b86;
  --success: #16a34a;
  --success-soft: #e3f6ea;
  --danger: #dc2626;
  --danger-soft: #fde8e8;
  --warning: #f59e0b;
  --warning-soft: #fff3d6;

  --sidebar-w: 252px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 62px;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 19, 54, 0.06), 0 4px 14px rgba(0, 19, 54, 0.05);
  --shadow-lg: 0 18px 50px rgba(0, 7, 26, 0.35);
  --font: "Segoe UI", Inter, system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #030b1e;
  --surface: #0a1630;
  --surface-2: #0d1c3b;
  --border: #172a52;
  --border-strong: #223a6b;
  --text: #e6eefb;
  --muted: #8ea2c6;
  --primary-soft: #0e2350;
  --gold-soft: #2b2208;
  --success-soft: #0d2a1a;
  --danger-soft: #2c1115;
  --warning-soft: #2e2208;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

.i { display: inline-block; vertical-align: -0.2em; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 7px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #2a1d00; }
.btn-gold:hover { filter: brightness(1.05); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-icon { width: 30px; height: 30px; padding: 0; border-radius: 6px; background: transparent; border: 1px solid transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-icon:hover { background: var(--primary-soft); color: var(--primary); }
.btn-icon.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- Forms ---------- */
label.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; letter-spacing: .02em; }
.input, select.input, textarea.input {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 7px;
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 13.5px; outline: none;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; min-height: 70px; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 74, 250, .14); }
.input[readonly] { background: var(--surface-2); }
.input-sm { height: 30px; font-size: 13px; }
.field { margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.search-box { position: relative; }
.search-box .i { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.search-box .input { padding-left: 33px; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.checkline input { width: 16px; height: 16px; accent-color: var(--primary); }

/* ---------- Cards / layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.page-head p { margin: 3px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.toolbar .search-box { flex: 1 1 240px; max-width: 360px; }
.toolbar select.input { width: auto; min-width: 120px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.actions { white-space: nowrap; text-align: right; }
.person { display: flex; align-items: center; gap: 10px; }
.person b { font-weight: 600; display: block; }
.person small { color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 12.5px; object-fit: cover; flex-shrink: 0; }
.avatar.lg { width: 84px; height: 84px; font-size: 28px; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--azure); }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.pager .btns { display: flex; gap: 6px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warning { background: var(--warning-soft); color: #b45309; }
.badge.gold { background: var(--gold-soft); color: #9a6b00; }
.badge.gray { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.tier { font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; background: rgba(246, 204, 63, .18); color: var(--gold-2); margin-left: auto; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 18px; }
.stats.s4 { grid-template-columns: repeat(4, 1fr); }
.stats.s3 { grid-template-columns: repeat(3, 1fr); }
.stat { padding: 16px 18px; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--azure); }
.stat.gold::before { background: var(--gold); }
.stat.green::before { background: var(--success); }
.stat.red::before { background: var(--danger); }
.stat .lbl2 { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .val { font-size: 24px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 16px; font-weight: 600; font-size: 13.5px; color: var(--muted); border: none; background: none; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Banners / empty ---------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-radius: var(--radius); background: var(--gold-soft); border: 1px solid #ecd48a; color: #7a5600; margin-bottom: 16px; font-size: 13.5px; }
[data-theme="dark"] .banner { border-color: #5a4710; color: var(--gold-2); }
.banner b { font-weight: 700; }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .i { color: var(--border-strong); margin-bottom: 8px; }
.empty h4 { color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------- App shell ---------- */
#app { min-height: 100vh; }
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 100%);
  color: #b7c6e4; position: fixed; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; z-index: 40;
  transition: width .2s ease; border-right: 1px solid #0b2150;
}
.sb-brand { padding: 14px 14px 8px; display: flex; flex-direction: column; align-items: center; }
.sb-brand img.wordmark { width: 168px; height: auto; border-radius: 8px; display: block; }
.sb-brand img.mark { display: none; width: 40px; height: 40px; border-radius: 8px; }
.sb-brand .sub { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #6f86b3; margin-top: 8px; }
.sb-nav { flex: 1; overflow-y: auto; padding: 8px 10px 14px; scrollbar-width: thin; scrollbar-color: #12306b transparent; }
.sb-group { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; color: #5c74a6; padding: 16px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 7px; color: #b7c6e4; cursor: pointer; font-weight: 500; position: relative; margin-bottom: 1px; }
.nav-item:hover { background: rgba(1, 147, 254, .1); color: #fff; }
.nav-item.active { background: rgba(1, 147, 254, .18); color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--cyan); }
.nav-item.active .i { color: var(--cyan); }
.nav-item .nav-label { white-space: nowrap; overflow: hidden; }
.sb-foot { padding: 12px 14px; border-top: 1px solid #0b2150; font-size: 11.5px; color: #6f86b3; display: flex; align-items: center; gap: 8px; }
.sb-foot .i { color: var(--gold-2); }
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .sb-brand img.wordmark, .sidebar.collapsed .sb-brand .sub, .sidebar.collapsed .nav-label, .sidebar.collapsed .tier, .sidebar.collapsed .sb-foot span { display: none; }
.sidebar.collapsed .sb-brand img.mark { display: block; }
.sidebar.collapsed .sb-group { font-size: 0; padding: 10px 0 4px; }
.sidebar.collapsed .sb-group::after { content: ""; display: block; height: 1px; background: #12306b; margin: 0 12px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .nav-item.active::before { left: -10px; }

.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; transition: margin-left .2s ease; position: relative; }
.main.collapsed { margin-left: var(--sidebar-w-collapsed); }
.topbar { height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 22px; position: sticky; top: 0; z-index: 30; }
.topbar .title { font-size: 17px; font-weight: 700; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.topbar .gsearch { position: relative; width: 300px; }
.topbar .gsearch .i { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.topbar .gsearch input { width: 100%; height: 36px; padding: 0 12px 0 33px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font-family: inherit; outline: none; }
.topbar .gsearch input:focus { border-color: var(--primary); background: var(--surface); }
.dropdown { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 60; overflow: hidden; }
.gsearch .dropdown { top: 42px; left: 0; right: 0; max-height: 360px; overflow-y: auto; }
.dd-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.dd-item:last-child { border-bottom: none; }
.dd-item:hover { background: var(--primary-soft); }
.dd-item small { color: var(--muted); display: block; }
.demo-pill { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #2a1d00; font-weight: 800; font-size: 11px; letter-spacing: .08em; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.topbar .school { font-weight: 600; color: var(--muted); font-size: 13px; white-space: nowrap; }
.topbar .date { color: var(--muted); font-size: 13px; white-space: nowrap; }
.pkg-select { height: 30px; font-size: 12.5px; font-weight: 600; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 0 8px; }
.icon-btn { position: relative; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.userchip { display: flex; align-items: center; gap: 9px; padding: 3px 12px 3px 3px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; position: relative; background: var(--surface); white-space: nowrap; flex-shrink: 0; height: 40px; }
.userchip > div:not(.dropdown) { line-height: 1.15; }
.userchip .avatar { width: 30px; height: 30px; background: linear-gradient(135deg, var(--primary), var(--cyan)); font-size: 12px; }
.userchip b { font-size: 13px; display: block; line-height: 1.1; }
.userchip small { color: var(--muted); font-size: 11px; }
.userchip .dropdown { top: 44px; right: 0; width: 200px; }
.notif { top: 44px; right: 0; width: 320px; }

.content { padding: 22px; flex: 1; position: relative; }
.content::before { content: "DEMO"; position: fixed; top: 52%; left: calc(50% + 120px); transform: translate(-50%, -50%) rotate(-24deg); font-size: 190px; font-weight: 900; letter-spacing: .1em; color: rgba(0, 74, 250, .035); pointer-events: none; z-index: 0; user-select: none; }
[data-theme="dark"] .content::before { color: rgba(0, 181, 253, .035); }
.content > * { position: relative; z-index: 1; }
.app-footer { padding: 16px 22px; border-top: 1px solid var(--border); background: var(--surface); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.app-footer b { color: var(--text); }
.app-footer .tag { color: var(--gold); font-weight: 700; }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: 1.5fr 1fr 1.2fr; gap: 14px; margin-bottom: 18px; }
.dash-grid2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-bottom: 18px; }
.quick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 18px; }
.quick button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text); transition: all .15s; font-family: inherit; }
.quick button:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.quick .qi { width: 40px; height: 40px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.quick button:nth-child(even) .qi { background: var(--gold-soft); color: #9a6b00; }
.activity { list-style: none; margin: 0; padding: 4px 18px 10px; }
.activity li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.activity li:last-child { border-bottom: none; }
.activity .ai { width: 30px; height: 30px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.activity small { color: var(--muted); display: block; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.chart-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--c); margin-right: 6px; }
svg.chart text { font-family: var(--font); fill: var(--muted); font-size: 11px; }

/* ---------- Attendance ---------- */
.att-btns { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 7px; overflow: hidden; }
.att-btns button { border: none; background: var(--surface); padding: 5px 13px; font-size: 12.5px; font-weight: 700; cursor: pointer; color: var(--muted); border-right: 1px solid var(--border-strong); font-family: inherit; }
.att-btns button:last-child { border-right: none; }
.att-btns button.on-P { background: var(--success); color: #fff; }
.att-btns button.on-A { background: var(--danger); color: #fff; }
.att-btns button.on-L { background: var(--warning); color: #fff; }

/* ---------- Profile ---------- */
.profile-head { display: flex; align-items: center; gap: 18px; padding: 20px; background: linear-gradient(120deg, var(--navy-950), var(--navy-800)); color: #fff; border-radius: var(--radius) var(--radius) 0 0; }
.profile-head h2 { font-size: 21px; }
.profile-head .meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 6px; color: #a9bde3; font-size: 13px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 0; }
.kv > div { padding: 9px 0; border-bottom: 1px solid var(--border); }
.kv > div:nth-child(odd) { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.kv-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 36px; }

/* ---------- Class cards ---------- */
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.class-card { padding: 18px; cursor: pointer; transition: all .15s; }
.class-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.class-card h3 { font-size: 17px; }
.class-card .secs { display: flex; gap: 6px; margin: 10px 0; flex-wrap: wrap; }

/* ---------- Timetable ---------- */
.tt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.tt th { background: var(--navy-900); color: #fff; padding: 10px; font-weight: 600; }
.tt th:first-child { border-radius: 8px 0 0 0; } .tt th:last-child { border-radius: 0 8px 0 0; }
.tt td { border: 1px solid var(--border); padding: 8px; text-align: center; cursor: pointer; background: var(--surface); }
.tt td:hover { background: var(--primary-soft); }
.tt td.day { background: var(--surface-2); font-weight: 700; cursor: default; text-align: left; width: 110px; }
.tt td b { display: block; font-size: 13px; }
.tt td small { color: var(--muted); }

/* ---------- Modal / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 7, 26, .62); backdrop-filter: blur(2px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .15s ease; }
.modal.lg { max-width: 880px; } .modal.xl { max-width: 1020px; } .modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal.preview .modal-body { background: #5c6b86; padding: 22px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--navy-900); color: #fff; padding: 12px 18px; border-radius: 8px; box-shadow: var(--shadow-lg); border-left: 4px solid var(--success); display: flex; gap: 10px; align-items: center; font-weight: 500; animation: pop .2s ease; max-width: 380px; }
.toast.error { border-left-color: var(--danger); } .toast.info { border-left-color: var(--cyan); } .toast.warn { border-left-color: var(--warning); }
#tooltip { position: fixed; z-index: 400; background: var(--navy-950); color: #fff; font-size: 12px; padding: 5px 9px; border-radius: 5px; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow); }
.loader { display: flex; align-items: center; justify-content: center; padding: 60px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Packages ---------- */
.pkg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: stretch; }
.pkg { padding: 26px 24px; display: flex; flex-direction: column; position: relative; }
.pkg.featured { border: 2px solid var(--primary); box-shadow: 0 10px 34px rgba(0, 74, 250, .16); }
.pkg .ribbon { position: absolute; top: -12px; right: 20px; background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #2a1d00; font-size: 11px; font-weight: 800; letter-spacing: .08em; padding: 4px 12px; border-radius: 999px; }
.pkg h3 { font-size: 15px; letter-spacing: .12em; color: var(--primary); }
.pkg .price { font-size: 34px; font-weight: 800; margin: 8px 0 2px; letter-spacing: -.02em; }
.pkg .once { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.pkg h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 0 8px; }
.pkg ul { list-style: none; padding: 0; margin: 0; }
.pkg li { padding: 4px 0 4px 24px; position: relative; font-size: 13.5px; }
.pkg li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 12px; height: 7px; border-left: 2px solid var(--success); border-bottom: 2px solid var(--success); transform: rotate(-45deg); }
.pkg li.head { font-weight: 700; padding-left: 0; }
.pkg li.head::before { display: none; }
.pkg .btns { margin-top: auto; padding-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.svc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.svc { padding: 18px; }
.svc .qi { width: 38px; height: 38px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.svc h4 { font-size: 14.5px; margin-bottom: 4px; } .svc p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- Reports ---------- */
.rep-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.rep-cat { padding: 18px; }
.rep-cat h3 { font-size: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; color: var(--primary); }
.rep-link { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.rep-link:hover { background: var(--primary-soft); color: var(--primary); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; background: var(--navy-950); }
.login-left { position: relative; overflow: hidden; color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 56px; background: radial-gradient(1000px 600px at 30% 20%, #0a2a78 0%, transparent 60%), linear-gradient(160deg, var(--navy-950), var(--navy-900) 60%, var(--navy-800)); }
.login-left::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(1, 147, 254, .28) 1px, transparent 1.4px); background-size: 26px 26px; mask-image: linear-gradient(120deg, transparent 20%, #000 90%); opacity: .5; pointer-events: none; }
.login-left > * { position: relative; z-index: 1; }
.login-left .logo { width: min(560px, 100%); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.login-left h1 { font-size: 34px; font-weight: 800; margin-top: 30px; letter-spacing: -.02em; }
.login-left .tag { font-size: 20px; margin-top: 8px; color: var(--cyan); font-weight: 600; letter-spacing: .04em; }
.login-left .pts { display: flex; gap: 22px; margin-top: 26px; flex-wrap: wrap; color: #bcd0f2; }
.login-left .pts div { display: flex; align-items: center; gap: 8px; }
.login-left .pts .i { color: var(--gold-2); }
.login-left .foot { color: #7e95c0; font-size: 12.5px; }
.login-right { background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 28px; letter-spacing: -.02em; }
.login-card .lead { color: var(--muted); margin: 6px 0 24px; }
.login-card .btn { width: 100%; height: 42px; font-size: 15px; }
.demo-note { margin-top: 22px; padding: 14px 16px; border-radius: 8px; border: 1px dashed var(--border-strong); background: var(--surface); font-size: 13px; color: var(--muted); }
.demo-note b { color: var(--text); }
.err { color: var(--danger); font-size: 13px; margin-bottom: 10px; min-height: 18px; }

/* ==========================================================================
   Printable documents (shared by on-screen preview and print)
   ========================================================================== */
.doc { background: #fff; color: #111; font-family: "Segoe UI", Arial, sans-serif; font-size: 12.5px; line-height: 1.4; position: relative; margin: 0 auto 18px; box-shadow: 0 6px 26px rgba(0, 0, 0, .3); box-sizing: border-box; overflow: hidden; }
.doc::before { content: "DEMO"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-28deg); font-size: 120px; font-weight: 900; letter-spacing: .12em; color: rgba(0, 74, 250, .05); pointer-events: none; z-index: 0; }
.doc > * { position: relative; z-index: 1; }
.doc-a4 { width: 210mm; min-height: 297mm; padding: 13mm 14mm; }
.doc-a4l { width: 297mm; min-height: 210mm; padding: 12mm 14mm; }
.doc-receipt { width: 148mm; padding: 9mm 10mm; }
.doc-head { display: flex; align-items: center; gap: 14px; border-bottom: 3px double #001336; padding-bottom: 10px; margin-bottom: 12px; }
.doc-head img { width: 62px; height: 62px; border-radius: 8px; object-fit: contain; background: #00071a; }
.doc-head .t { flex: 1; text-align: center; }
.doc-head h1 { font-size: 21px; color: #001336; letter-spacing: .02em; text-transform: uppercase; }
.doc-head p { margin: 2px 0 0; color: #444; font-size: 11.5px; }
.doc-title { text-align: center; font-size: 15px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #fff; background: #001336; padding: 6px; margin: 10px 0 12px; border-radius: 3px; }
.doc-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 16px; margin-bottom: 12px; }
.doc-meta.c2 { grid-template-columns: repeat(2, 1fr); }
.doc-meta div { border-bottom: 1px dotted #999; padding: 2px 0; }
.doc-meta span { color: #555; font-size: 11px; display: block; text-transform: uppercase; letter-spacing: .04em; }
.doc-meta b { font-size: 13px; }
table.doc-tbl { width: 100%; border-collapse: collapse; margin: 8px 0; }
table.doc-tbl th { background: #e8f1ff; color: #001336; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border: 1px solid #9db3d9; text-align: left; }
table.doc-tbl td { padding: 5px 8px; border: 1px solid #b9c7e0; font-size: 12px; }
table.doc-tbl td.num, table.doc-tbl th.num { text-align: right; }
table.doc-tbl tr.total td { background: #f4f7fd; font-weight: 800; }
.doc-sign { display: flex; justify-content: space-between; gap: 30px; margin-top: 42px; }
.doc-sign div { flex: 1; text-align: center; border-top: 1px solid #222; padding-top: 4px; font-size: 11.5px; }
.doc-foot { margin-top: 14px; text-align: center; color: #666; font-size: 10.5px; border-top: 1px solid #ccc; padding-top: 6px; }
.doc-note { font-size: 11px; color: #555; margin-top: 8px; }
.doc-photo { width: 78px; height: 92px; border: 1px solid #333; object-fit: cover; display: block; }
.doc-photo.ph { display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 28px; color: #fff; }

.doc-paper { font-family: "Times New Roman", Georgia, serif; font-size: 13.5px; }
.doc-paper .doc-head h1 { font-family: "Times New Roman", serif; }
.doc-paper .sec { text-align: center; font-weight: 800; font-size: 14px; border: 1.5px solid #000; padding: 4px; margin: 16px 0 8px; letter-spacing: .06em; }
.doc-paper .sec small { display: block; font-weight: 500; font-size: 12px; letter-spacing: 0; }
.doc-paper .q { margin: 8px 0; display: flex; gap: 8px; }
.doc-paper .q .n { font-weight: 700; min-width: 22px; }
.doc-paper .q .b { flex: 1; }
.doc-paper .q .m { font-weight: 700; white-space: nowrap; }
.doc-paper .opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 18px; margin-top: 3px; }
.doc-paper .rtl, .rtl { direction: rtl; text-align: right; font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Segoe UI", Tahoma, serif; line-height: 2; }
.doc-paper .paper-top { display: flex; justify-content: space-between; margin: 6px 0 6px; font-weight: 700; border-bottom: 1.5px solid #000; padding-bottom: 6px; }
.doc-paper .name-line { margin: 8px 0; }

.doc-card { border: 3px double #001336; padding: 9mm 10mm; }
.doc-card .doc-head { border-bottom-width: 2px; }
.doc-card .remarks { margin-top: 10px; border: 1px solid #b9c7e0; border-radius: 4px; padding: 8px 10px; background: #fafcff; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.summary-grid div { border: 1px solid #9db3d9; border-radius: 4px; padding: 6px 8px; background: #f4f7fd; }
.summary-grid span { display: block; font-size: 10.5px; color: #555; text-transform: uppercase; }
.summary-grid b { font-size: 15px; color: #001336; }

.doc-cert { width: 297mm; height: 210mm; padding: 9mm; background: #fffdf6; }
.cert-border { height: 100%; border: 5px solid #001336; outline: 2px solid #d49518; outline-offset: -11px; padding: 10mm 16mm; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; }
.cert-border::before, .cert-border::after { content: ""; position: absolute; width: 46px; height: 46px; border: 3px solid #d49518; }
.cert-border::before { top: 14px; left: 14px; border-right: none; border-bottom: none; }
.cert-border::after { bottom: 14px; right: 14px; border-left: none; border-top: none; }
.cert-logo { width: 74px; height: 74px; border-radius: 10px; background: #00071a; object-fit: contain; }
.cert-school { font-family: Georgia, serif; font-size: 27px; font-weight: 700; color: #001336; letter-spacing: .06em; text-transform: uppercase; margin-top: 6px; }
.cert-addr { color: #555; font-size: 12px; }
.cert-title { font-family: Georgia, "Times New Roman", serif; font-size: 38px; font-style: italic; color: #004afa; margin: 14px 0 4px; }
.cert-line { width: 220px; height: 3px; background: linear-gradient(90deg, transparent, #d49518, transparent); margin: 2px 0 14px; }
.cert-body { font-family: Georgia, serif; font-size: 17px; line-height: 2; color: #222; max-width: 215mm; }
.cert-body b { color: #001336; border-bottom: 1px dotted #555; padding: 0 6px; }
.cert-foot { margin-top: auto; width: 100%; display: flex; justify-content: space-between; align-items: flex-end; }
.cert-foot .sig { width: 200px; border-top: 1.5px solid #222; padding-top: 4px; font-size: 12.5px; }
.cert-stamp { width: 86px; height: 86px; border: 2px dashed #9aa6bd; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #9aa6bd; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; text-align: center; }
.cert-no { font-size: 12px; color: #555; display: flex; justify-content: space-between; width: 100%; margin-bottom: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .quick { grid-template-columns: repeat(3, 1fr); }
  .svc-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar .school { display: none; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; width: var(--sidebar-w) !important; }
  .sidebar.open { transform: none; }
  .main, .main.collapsed { margin-left: 0; }
  .topbar .gsearch, .topbar .date, .userchip div, .pkg-select { display: none; }
  .dash-grid, .dash-grid2, .pkg-grid, .grid-3, .grid-4, .kv-2 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .content { padding: 14px; }
  .stats, .stats.s4, .stats.s3 { grid-template-columns: repeat(2, 1fr); }
  .quick { grid-template-columns: repeat(2, 1fr); }
  .svc-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 120px 1fr; }
  .overlay { padding: 12px 8px; }
}
@media (max-width: 560px) { .stats, .stats.s4, .stats.s3 { grid-template-columns: 1fr; } .topbar { padding: 0 12px; } .demo-pill { display: none; } }

/* grid children must be allowed to shrink (prevents horizontal page scroll on phones) */
.dash-grid > *, .dash-grid2 > *, .grid > *, .stats > *, .quick > *, .pkg-grid > * { min-width: 0; }
.card { min-width: 0; }
.main, .content { min-width: 0; max-width: 100%; }
svg.chart { max-width: 100%; height: auto; }
