/* Admin panel — International Public School, Purnea */
:root {
  --navy: #1c2539; --navy-dark: #121a2b; --side: #101827; --side-2: #172133;
  --brand: #198754; --brand-dark: #136b42; --brand-soft: #e8f5ee; --accent: #11d82b;
  --line: #e4e8f0; --line-2: #eef1f6; --bg: #f4f6fa; --ink: #1d2433; --ink-2: #344054; --muted: #667085; --faint: #98a2b3;
  --red: #d92d20; --red-soft: #fef3f2; --amber: #b54708; --amber-soft: #fffaeb;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06); --shadow-lg: 0 12px 24px -6px rgba(16,24,40,.12);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 14.5px/1.55 'Nunito Sans', Arial, sans-serif; color: var(--ink); background: var(--bg); display: flex; min-height: 100vh; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: 'Red Hat Display', sans-serif; margin: 0; letter-spacing: -.01em; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

/* ---------- Sidebar ---------- */
.side { width: 268px; background: var(--side); color: #c7cfdd; flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; scrollbar-width: thin; scrollbar-color: #2b3750 transparent; }
.side-brand { display: flex; gap: 12px; align-items: center; padding: 20px 20px 18px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.06); }
.side-brand img { width: 44px; height: 44px; border-radius: 10px; background: #fff; padding: 3px; flex: none; }
.side-brand span { font: 700 16px/1.25 'Red Hat Display', sans-serif; }
.side-brand small { display: block; font: 600 11.5px/1.35 'Nunito Sans', sans-serif; color: #8a97ad; margin-top: 2px; }
.side nav { padding: 14px 12px 24px; flex: 1; }
.side nav a { display: flex; gap: 12px; align-items: center; padding: 9px 12px; margin: 2px 0; color: #c7cfdd; border-radius: 8px; font-weight: 600; font-size: 14px; position: relative; transition: background .15s, color .15s; }
.side nav a i { width: 18px; text-align: center; color: #7b88a1; font-size: 15px; transition: color .15s; }
.side nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.side nav a:hover i { color: #cfd6e3; }
.side nav a.on { background: rgba(25,135,84,.18); color: #fff; }
.side nav a.on i { color: var(--accent); }
.side nav a.on::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-label { padding: 20px 12px 6px; font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: #5f6c85; }

/* Menu groups: a menu item with an icon and a chevron; its pages open below it, indented */
.side nav a span, .side-group span { flex: 1; }
.side nav a .ext { width: auto; font-size: 11px; color: #5f6c85; }
.side-sec { margin: 2px 0; }
.side-sec .side-group { display: flex; width: 100%; gap: 12px; align-items: center; background: none; border: 0; cursor: pointer; font: 600 14px 'Nunito Sans', sans-serif; color: #c7cfdd; text-align: left; padding: 9px 12px; border-radius: 8px; transition: background .15s, color .15s; }
.side-sec .side-group > i:first-child { width: 18px; text-align: center; color: #7b88a1; font-size: 15px; }
.side-sec .side-group .chev { font-size: 10px; color: #5f6c85; transition: transform .2s; }
.side-sec .side-group:hover { background: rgba(255,255,255,.05); color: #fff; }
.side-sec.open > .side-group { color: #fff; }
.side-sec.open > .side-group > i:first-child { color: var(--accent); }
.side-sec.open > .side-group .chev { transform: rotate(90deg); color: #9aa6bb; }
.side-items { display: none; margin: 2px 0 6px 21px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.08); }
.side-sec.open .side-items { display: block; animation: sideIn .18s ease; }
.side nav .side-items a { padding: 7px 12px; font-size: 13.5px; font-weight: 600; color: #9aa6bb; margin: 1px 0; }
.side nav .side-items a:hover { color: #fff; background: rgba(255,255,255,.04); }
.side nav .side-items a.on { color: #fff; background: rgba(25,135,84,.18); }
.side nav .side-items a.on::before { left: -13px; top: 6px; bottom: 6px; }
@keyframes sideIn { from { opacity: 0; transform: translateY(-3px); } }
.side-foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.06); font-size: 12px; color: #5f6c85; }

/* ---------- Top bar ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 32px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; position: sticky; top: 0; z-index: 50; }
.crumbs { font-size: 12.5px; color: var(--faint); font-weight: 600; margin-bottom: 2px; }
.crumbs a { color: var(--muted); }
.crumbs i { font-size: 9px; margin: 0 6px; }
.top h1 { font-size: 22px; color: var(--ink); font-weight: 700; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.top form { display: flex; gap: 10px; align-items: center; margin: 0; }
.who { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 30px; font-weight: 700; color: var(--ink-2); font-size: 13.5px; }
.who .avatar-i { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 13px; text-transform: uppercase; }
.content { padding: 28px 32px 64px; width: 100%; max-width: 1280px; }
.intro { color: var(--muted); margin: 0 0 20px; }
h2.group { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--faint); margin: 28px 0 12px; }
h2.group:first-of-type { margin-top: 8px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; gap: 8px; align-items: center; justify-content: center; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; font: 700 13.5px 'Nunito Sans', sans-serif; cursor: pointer; line-height: 1.2; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; box-shadow: var(--shadow); }
.btn-primary { background: var(--brand); color: #fff; } .btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-light { background: #fff; border-color: #d0d5dd; color: var(--ink-2); } .btn-light:hover { background: #f9fafb; color: var(--ink); border-color: #b9c0cc; }
.btn-danger { background: #fff; border-color: #fda29b; color: var(--red); } .btn-danger:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn-icon { width: 34px; height: 34px; padding: 0; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(25,135,84,.18); }

/* ---------- Dashboard cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 16px; display: grid; grid-template-columns: 46px 1fr; gap: 4px 14px; align-items: center; box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s; }
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.card > i { width: 46px; height: 46px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 19px; }
.card b { font: 700 24px 'Red Hat Display', sans-serif; display: block; line-height: 1.1; color: var(--ink); }
.card span { color: var(--muted); font-weight: 600; font-size: 13.5px; }
.card p { grid-column: 1 / -1; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; }
.card p .btn { flex: 1; padding: 7px 10px; font-size: 13px; }

/* ---------- Lists ---------- */
.bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.count { margin-left: auto; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; background: #f9fafb; font-size: 12px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:hover td { background: #fcfcfd; }
tr:last-child td { border-bottom: 0; }
.thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.thumb.big { width: 150px; height: 110px; margin-bottom: 8px; }
.actions { white-space: nowrap; text-align: right; } .actions form { display: inline; }
.actions .btn { padding: 6px 11px; font-size: 13px; }
.muted { color: var(--faint); }
.empty { background: #fff; border: 1px dashed #d0d5dd; border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Forms ---------- */
.form { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 26px 20px; box-shadow: var(--shadow); display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0 24px; align-items: start; }
.form > .alert, .form > .bar, .form > .field.full { grid-column: 1 / -1; }
.form .bar { margin: 8px 0 0; padding-top: 18px; border-top: 1px solid var(--line-2); }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; font-size: 13.5px; color: var(--ink-2); margin-bottom: 6px; }
.field em { color: var(--red); font-style: normal; }
.field small { color: var(--muted); display: block; margin-top: 5px; font-size: 12.5px; }
input, select, textarea { width: 100%; padding: 9px 12px; border: 1px solid #d0d5dd; border-radius: 8px; font: inherit; font-size: 14px; color: var(--ink); background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.04); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(25,135,84,.14); }
input[type=file] { padding: 7px; background: #f9fafb; cursor: pointer; }
input[type=file]::file-selector-button { border: 1px solid #d0d5dd; background: #fff; border-radius: 6px; padding: 5px 12px; margin-right: 10px; font: 700 13px 'Nunito Sans', sans-serif; cursor: pointer; }
textarea { resize: vertical; }
.field.bad input, .field.bad select, .field.bad textarea { border-color: var(--red); }
.select-add { display: flex; gap: 6px; }
.select-add select { flex: 1; }
.select-add .add-opt { flex: none; padding: 0 14px; }
.add-opt-row { display: flex; gap: 6px; margin-top: 6px; }
.add-opt-row input { flex: 1; }
.add-opt-row .btn { flex: none; }
.field small.add-opt-msg { color: var(--brand); }
.field small.add-opt-msg.err { color: var(--red); }
.current { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.word-count { display: block; text-align: right; color: var(--muted); }
.word-count.over { color: var(--red); font-weight: 700; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 600; display: flex; gap: 10px; align-items: flex-start; }
.alert.ok { background: #ecfdf3; color: #067647; border: 1px solid #abefc6; }
.alert.err { background: var(--red-soft); color: #b42318; border: 1px solid #fecdca; }
.alert ul { margin: 0; padding-left: 18px; }

/* ---------- Filters, tabs, excel ---------- */
.filters-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; box-shadow: var(--shadow); }
.filters-bar input, .filters-bar select { width: auto; min-width: 150px; flex: 1 1 160px; }
.inline-check { display: flex; gap: 6px; align-items: center; white-space: nowrap; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.inline-check input { width: auto; }
.filters-bar .inline-check input { min-width: 140px; flex: none; }
.btn-excel { color: #1d6f42; border-color: #9fd0b2; } .btn-excel:hover { background: #1d6f42; border-color: #1d6f42; color: #fff; }
.tabs-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.cat-help { margin: 0 0 14px; font-size: 14px; }
.cat-table input { min-width: 180px; }
.cat-table input.cat-order { width: 90px; min-width: 0; }
.cat-table .actions form { display: inline; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 30px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.nowrap { white-space: nowrap; }

/* ---------- Login ---------- */
.login-page { align-items: center; justify-content: center; background: radial-gradient(circle at 20% 20%, #23304a, var(--side) 60%); padding: 20px; }
.login-box { background: #fff; border-radius: 16px; padding: 36px 32px 28px; width: 100%; max-width: 400px; box-shadow: 0 24px 60px rgba(0,0,0,.35); text-align: center; }
.login-box img { width: 82px; margin: 0 auto 10px; display: block; }
.login-box h1 { font-size: 23px; color: var(--ink); }
.login-box .sub { color: var(--muted); font-size: 13px; margin: 4px 0 20px; }
.login-box label { display: block; text-align: left; font-weight: 700; font-size: 13.5px; margin: 14px 0 6px; color: var(--ink-2); }
.login-box .btn { width: 100%; margin-top: 22px; padding: 11px; }
.login-box .alert { text-align: left; }
.back { display: inline-block; margin-top: 18px; font-size: 13px; color: var(--muted); }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  body { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; }
  .side-sec .side-items { display: none; }
  .side-sec.open .side-items { display: block; }
  .top { position: static; padding: 12px 16px; }
  .content { padding: 20px 16px 48px; }
}
