:root {
  --blue: #1768e5;
  --blue-dark: #0d3f99;
  --blue-soft: #eaf2ff;
  --ink: #182238;
  --muted: #6f7c92;
  --line: #e6ebf2;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --success: #189f72;
  --danger: #dc4e5f;
  --orange: #f29b38;
  --green: #4d9b6a;
  --shadow: 0 16px 42px rgba(28, 52, 91, .08);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.eyebrow { margin: 0 0 8px; font-size: 11px; line-height: 1.2; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .72; }
.eyebrow.blue { color: var(--blue); opacity: 1; }
.muted { color: var(--muted); line-height: 1.55; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(420px, .95fr); }
.login-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 32px; padding: clamp(54px, 8vw, 112px); color: #fff; background: linear-gradient(145deg, #0d377d 0%, #1768e5 58%, #4095ff 100%); }
.login-brand h1 { margin: 0; font-size: clamp(54px, 7vw, 92px); letter-spacing: -.06em; line-height: .96; }
.login-lead { max-width: 520px; margin: 22px 0 0; font-size: clamp(18px, 2vw, 24px); line-height: 1.45; color: rgba(255,255,255,.84); }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: #fff; background: var(--blue); font-size: 14px; font-weight: 900; letter-spacing: -.05em; box-shadow: 0 8px 18px rgba(23,104,229,.24); }
.brand-mark.large { width: 72px; height: 72px; border-radius: 22px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); backdrop-filter: blur(12px); font-size: 22px; box-shadow: none; }
.login-orbit { position: absolute; width: 420px; height: 420px; right: -160px; bottom: -155px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; }
.login-orbit::before, .login-orbit::after { content: ""; position: absolute; inset: 55px; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; }
.login-orbit::after { inset: 118px; }
.login-orbit span { position: absolute; width: 11px; height: 11px; border-radius: 50%; background: #fff; box-shadow: 0 0 24px #fff; }
.login-orbit span:nth-child(1) { left: 52px; top: 75px; }
.login-orbit span:nth-child(2) { right: 12px; top: 180px; }
.login-orbit span:nth-child(3) { left: 186px; bottom: 0; }
.login-panel { display: grid; place-items: center; padding: 42px; background: #fff; }
.auth-card { width: min(100%, 450px); }
.auth-card h2 { margin: 0 0 10px; font-size: 36px; letter-spacing: -.04em; }
.auth-card label, .field label { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 9px; font-size: 13px; font-weight: 750; }
.auth-card input, .field input, .field textarea, .toolbar select { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; color: var(--ink); background: #fff; outline: none; transition: border .2s, box-shadow .2s; }
.auth-card input:focus, .field input:focus, .field textarea:focus, .toolbar select:focus, .search-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(23,104,229,.1); }
.auth-icon { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 28px; border-radius: 18px; color: var(--blue); background: var(--blue-soft); font-size: 26px; }
.button { border: 0; border-radius: 13px; padding: 13px 18px; font-weight: 750; transition: transform .15s, box-shadow .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--blue); box-shadow: 0 10px 20px rgba(23,104,229,.22); }
.button.primary:hover { background: #0d5bd1; }
.button.secondary { color: var(--blue); background: var(--blue-soft); }
.button.ghost { color: var(--ink); background: #f0f3f8; }
.button.wide { width: 100%; margin-top: 16px; }
.security-note { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 12px; }
.back-link, .text-button { border: 0; padding: 0; color: var(--blue); background: transparent; font-weight: 700; }
.back-link { margin-bottom: 28px; }
.otp-input { text-align: center; font-size: 28px !important; font-weight: 800; letter-spacing: .35em; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 16px 18px; color: #fff; background: #102044; }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 0 8px 30px; }
.brand-row .brand-mark { background: #fff; color: var(--blue); }
.brand-row strong { display: block; font-size: 17px; }
.brand-row small { display: block; margin-top: 2px; color: #8fa3c9; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 13px; width: 100%; border: 0; border-radius: 12px; padding: 12px 14px; color: #afbdd9; background: transparent; text-align: left; font-weight: 650; }
.nav-item span { width: 21px; text-align: center; font-size: 19px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; background: var(--blue); box-shadow: 0 8px 18px rgba(23,104,229,.3); }
.sidebar-footer { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 16px 6px 0; border-top: 1px solid rgba(255,255,255,.1); }
.avatar { flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; color: #fff; background: linear-gradient(145deg, #4d9cff, #1768e5); font-weight: 800; }
.avatar.small { width: 36px; height: 36px; border-radius: 12px; }
.profile-mini { min-width: 0; flex: 1; }
.profile-mini strong, .profile-mini small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-mini strong { font-size: 12px; }
.profile-mini small { margin-top: 3px; color: #8fa3c9; font-size: 10px; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 12px; color: inherit; background: transparent; font-size: 18px; }
.icon-button:hover { background: rgba(255,255,255,.08); }

.workspace { min-width: 0; padding: 0 34px 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 110px; }
.topbar h1 { margin: 0; font-size: 30px; letter-spacing: -.035em; }
.top-actions, .top-profile { display: flex; align-items: center; gap: 12px; }
.top-profile { padding-left: 12px; border-left: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.notification-button { position: relative; color: var(--ink); background: #fff; border: 1px solid var(--line); }
.badge { min-width: 19px; height: 19px; display: inline-grid; place-items: center; border-radius: 10px; padding: 0 5px; color: #fff; background: var(--danger); font-size: 10px; }
.notification-button .badge { position: absolute; top: -6px; right: -6px; }
.nav-item .badge { margin-left: auto; }
.view { animation: reveal .28s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.loading-card { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 180px; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.welcome-card { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; min-height: 190px; border-radius: 24px; padding: 36px 40px; color: #fff; background: linear-gradient(125deg, #0e3f98, #1768e5 68%, #4a9cff); box-shadow: var(--shadow); }
.welcome-card::after { content: ""; position: absolute; width: 300px; height: 300px; right: -80px; top: -120px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; box-shadow: 0 0 0 56px rgba(255,255,255,.05), 0 0 0 112px rgba(255,255,255,.035); }
.welcome-card h2 { position: relative; z-index: 1; margin: 0 0 8px; font-size: clamp(26px, 4vw, 40px); letter-spacing: -.045em; }
.welcome-card p { position: relative; z-index: 1; margin: 0; color: rgba(255,255,255,.78); }
.welcome-symbol { position: relative; z-index: 1; display: grid; place-items: center; width: 82px; height: 82px; border: 1px solid rgba(255,255,255,.3); border-radius: 25px; background: rgba(255,255,255,.12); font-size: 34px; backdrop-filter: blur(12px); }
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 20px 0; }
.action-card { display: flex; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 20px; padding: 21px 23px; color: var(--ink); background: #fff; text-align: left; box-shadow: 0 8px 24px rgba(28,52,91,.04); }
.action-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.action-card > b { margin-left: auto; color: var(--muted); font-size: 20px; }
.action-card span strong, .action-card span small { display: block; }
.action-card span strong { font-size: 16px; }
.action-card span small { margin-top: 5px; color: var(--muted); }
.action-icon { display: grid !important; place-items: center; width: 48px; height: 48px; border-radius: 15px; font-size: 27px; }
.action-card.award .action-icon { color: var(--success); background: #e9f8f2; }
.action-card.violation .action-icon { color: var(--danger); background: #fff0f2; }
.dashboard-grid { display: grid; grid-template-columns: 1.08fr .92fr; gap: 20px; }
.panel { border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 8px 26px rgba(28,52,91,.035); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 24px 25px 12px; }
.panel-heading h3 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.soft-pill { display: inline-flex; align-items: center; border-radius: 99px; padding: 5px 9px; color: var(--blue); background: var(--blue-soft); font-size: 10px; font-weight: 800; }
.house-list, .top-list { padding: 4px 24px 20px; }
.house-row { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.house-row:last-child { border: 0; }
.house-emblem { display: grid; place-items: center; width: 40px; height: 44px; clip-path: polygon(8% 0, 92% 0, 92% 72%, 50% 100%, 8% 72%); color: #fff; font-weight: 900; }
.house-row.vision .house-emblem { background: var(--blue); }
.house-row.imperium .house-emblem { background: var(--orange); }
.house-row.sapientiae .house-emblem { background: var(--green); }
.house-meta strong, .house-meta small { display: block; }
.house-meta small { margin-top: 4px; color: var(--muted); }
.house-points { font-size: 16px; font-weight: 850; }
.top-student { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.top-student:last-child { border: 0; }
.rank { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; color: var(--blue); background: var(--blue-soft); font-size: 11px; font-weight: 900; }
.top-student strong { font-size: 13px; }
.top-student small { display: block; margin-top: 3px; color: var(--muted); }
.top-score { font-weight: 850; }

.toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) repeat(3, auto); gap: 10px; padding: 14px; margin-bottom: 16px; }
.toolbar select { min-width: 145px; padding: 12px 14px; }
.search-field { display: flex; align-items: center; gap: 9px; min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; background: #fff; transition: border .2s, box-shadow .2s; }
.search-field span { color: var(--muted); font-size: 20px; }
.search-field input { min-width: 0; width: 100%; border: 0; padding: 12px 0; outline: 0; color: var(--ink); background: transparent; }
.table-panel { overflow: hidden; }
.table-summary { display: flex; align-items: baseline; gap: 14px; padding: 22px 24px 14px; }
.table-summary span { color: var(--muted); font-size: 12px; }
.student-table-wrap { overflow-x: auto; }
.student-table { width: 100%; border-collapse: collapse; }
.student-table th { padding: 12px 24px; color: var(--muted); background: #f9fafc; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.student-table td { padding: 15px 24px; border-top: 1px solid var(--line); font-size: 13px; }
.student-table tbody tr { cursor: pointer; }
.student-table tbody tr:hover { background: #f8fbff; }
.student-name strong, .student-name small { display: block; }
.student-name small { margin-top: 3px; color: var(--muted); }
.house-chip { display: inline-flex; padding: 5px 9px; border-radius: 8px; background: #f2f4f8; font-size: 11px; font-weight: 750; }
.score { font-size: 15px; font-weight: 900; }
.empty { display: grid; justify-items: center; padding: 60px 20px; text-align: center; color: var(--muted); }
.empty span { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; color: var(--blue); background: var(--blue-soft); font-size: 24px; }
.empty strong { margin-top: 15px; color: var(--ink); }
.empty p { margin: 6px 0 0; }
.notification-list { display: grid; gap: 12px; }
.notification-card { display: grid; grid-template-columns: 45px 1fr auto; gap: 15px; align-items: start; padding: 20px; }
.notification-card > span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: var(--blue); background: var(--blue-soft); }
.notification-card h3 { margin: 2px 0 6px; font-size: 15px; }
.notification-card p { margin: 0; color: var(--muted); font-size: 13px; }
.notification-card time { color: var(--muted); font-size: 11px; }
.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.more-card { padding: 26px; }
.more-card > span:first-child { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: var(--blue); background: var(--blue-soft); font-size: 23px; }
.more-card h3 { margin: 18px 0 8px; }
.more-card p { color: var(--muted); line-height: 1.5; }
.more-card.disabled { opacity: .72; }

.dialog { width: min(760px, calc(100vw - 30px)); max-height: calc(100vh - 30px); border: 0; border-radius: 24px; padding: 0; color: var(--ink); background: #fff; box-shadow: 0 30px 100px rgba(11,33,72,.25); }
.dialog.compact { width: min(580px, calc(100vw - 30px)); }
.dialog::backdrop { background: rgba(10,24,52,.52); backdrop-filter: blur(4px); }
.dialog-card { padding: 26px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.dialog-heading h2 { margin: 0; font-size: 26px; letter-spacing: -.03em; }
.dialog-close { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 11px; color: var(--muted); background: #f1f3f7; font-size: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field.full, .form-grid.full { grid-column: 1 / -1; }
.field textarea { resize: vertical; }
.picker-button { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; color: var(--ink); background: #fff; text-align: left; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 9px; padding: 7px 9px; color: var(--blue-dark); background: var(--blue-soft); font-size: 11px; font-weight: 700; }
.chip button { border: 0; padding: 0; color: inherit; background: transparent; }
.quick-points, .multipliers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 8px; }
.quick-points button, .multipliers button { border: 1px solid var(--line); border-radius: 11px; padding: 10px 6px; color: var(--ink); background: #fff; font-weight: 800; }
.quick-points button.active, .multipliers button.active { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.suggestions { display: grid; gap: 7px; margin-top: 9px; }
.suggestion { border: 1px solid #dce8fc; border-radius: 12px; padding: 10px 12px; color: var(--blue-dark); background: #f5f9ff; text-align: left; font-size: 12px; }
.suggestion strong { display: block; margin-bottom: 3px; }
.dialog-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.dialog-footer > span { margin-right: auto; color: var(--muted); font-size: 12px; }
.picker-list { max-height: 410px; overflow: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: 15px; }
.picker-row { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.picker-row:last-child { border: 0; }
.picker-row input { width: 18px; height: 18px; accent-color: var(--blue); }
.picker-row span { flex: 1; }
.picker-row strong, .picker-row small { display: block; }
.picker-row small { margin-top: 3px; color: var(--muted); }
.student-details { display: grid; gap: 12px; margin-top: 20px; }
.detail-row { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.detail-row span { color: var(--muted); }
.detail-row strong { text-align: right; }
.parent-card { border-radius: 14px; padding: 14px; background: #f6f8fb; }
.parent-card strong, .parent-card a { display: block; }
.parent-card a { margin-top: 5px; color: var(--blue); text-decoration: none; }
.upload-box { display: grid; justify-items: center; gap: 5px; margin-top: 20px; border: 1px dashed #b7c5dc; border-radius: 16px; padding: 28px; background: #f8faff; cursor: pointer; }
.upload-box span { color: var(--blue); font-size: 25px; }
.upload-box small { color: var(--muted); }
.import-result { margin-top: 14px; border-radius: 14px; padding: 14px; background: #f3f5f8; font-size: 12px; white-space: pre-wrap; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 26px; transform: translate(-50%, 18px); min-width: 260px; max-width: min(520px, calc(100vw - 30px)); border-radius: 13px; padding: 13px 17px; color: #fff; background: #172643; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #a83443; }
.mobile-nav { display: none; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 82px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .brand-row { justify-content: center; padding-inline: 0; }
  .brand-row > div:last-child, .nav-item:not(.active) b, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-item span { font-size: 20px; }
  .profile-mini, .sidebar-footer .icon-button { display: none; }
  .sidebar-footer { justify-content: center; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .login-shell { display: block; background: #fff; }
  .login-brand { min-height: 270px; padding: 36px 26px; justify-content: flex-start; gap: 22px; }
  .login-brand h1 { font-size: 48px; }
  .login-lead { max-width: 340px; font-size: 16px; }
  .login-panel { padding: 34px 24px 52px; }
  .auth-card h2 { font-size: 30px; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .workspace { padding: 0 15px 100px; }
  .topbar { min-height: 88px; }
  .top-profile span { display: none; }
  .welcome-card { min-height: 175px; padding: 28px 24px; }
  .welcome-symbol { display: none; }
  .action-grid { grid-template-columns: 1fr; gap: 10px; }
  .action-card { padding: 16px; }
  .dashboard-grid { gap: 12px; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar select { min-width: 0; width: 100%; }
  .student-table th:nth-child(3), .student-table td:nth-child(3) { display: none; }
  .student-table th, .student-table td { padding: 13px 15px; }
  .student-table th:nth-child(5), .student-table td:nth-child(5) { display: none; }
  .more-grid, .form-grid { grid-template-columns: 1fr; }
  .field.full, .form-grid.full { grid-column: 1; }
  .dialog-card { padding: 20px; }
  .mobile-nav { position: fixed; z-index: 20; left: 10px; right: 10px; bottom: 10px; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; border: 1px solid var(--line); border-radius: 19px; padding: 8px 6px; background: rgba(255,255,255,.96); box-shadow: 0 12px 36px rgba(18,42,80,.17); backdrop-filter: blur(15px); }
  .mobile-nav button { display: grid; justify-items: center; gap: 3px; border: 0; padding: 6px 2px; color: var(--muted); background: transparent; font-size: 18px; }
  .mobile-nav button small { font-size: 9px; }
  .mobile-nav button.active { color: var(--blue); }
  .mobile-nav .mobile-main { align-self: center; width: 48px; height: 48px; justify-self: center; place-items: center; border-radius: 16px; color: #fff; background: var(--blue); box-shadow: 0 8px 18px rgba(23,104,229,.28); font-size: 28px; }
}
