@font-face { font-family: Tajawal; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/Tajawal-Regular.ttf') format('truetype'); }
@font-face { font-family: Tajawal; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/Tajawal-Medium.ttf') format('truetype'); }
@font-face { font-family: Tajawal; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/Tajawal-Bold.ttf') format('truetype'); }
:root {
  color-scheme: light;
  --primary: #2563eb; --primary-dark: #1d4ed8; --canvas: #f8fafc; --card: #fff;
  --subtle: #f1f5f9; --border: #cbd5e1; --text: #0f172a; --secondary: #475569; --muted: #64748b;
  --success: #15803d; --warning: #b45309; --danger: #b91c1c; --calling: #7c3aed;
  --radius-md: 10px; --radius-lg: 16px; --shadow-card: 0 1px 3px #0f172a14;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--text); font: 400 16px/1.55 Tajawal, system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { min-width: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 31px; }
h2 { font-size: 20px; line-height: 27px; }
h3 { font-size: 16px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; }
button:disabled, .button.disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 3px; }
[hidden] { display: none !important; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-width: 0; }
.muted { color: var(--secondary); font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
small.muted { color: var(--muted); font-size: 12px; line-height: 16px; }
.card { padding: 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.card > .card { box-shadow: none; }
.notice { background: var(--subtle); padding: 16px; border-radius: 12px; }
.danger-notice { color: var(--danger); border-inline-start: 3px solid var(--danger); }
.page-heading { display: flex; flex-direction: column; gap: 8px; margin-block-end: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 12px 20px; border: 1px solid transparent; border-radius: var(--radius-md); font-size: 14px; line-height: 20px; text-align: center; text-decoration: none; overflow-wrap: anywhere; }
.button:hover { text-decoration: none; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--primary-dark); }
.button.secondary { background: #fff; color: var(--primary); border-color: var(--primary); }
.button.danger { background: var(--danger); color: #fff; }
.button.ghost { color: var(--primary); background: transparent; min-height: 44px; padding: 10px 12px; }
.button:disabled, .button.disabled { color: var(--secondary); background: #e2e8f0; border-color: #e2e8f0; }
.button[aria-busy=true]::before { content: '◌'; animation: spin 1s linear infinite; }
.text-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 14px; font-weight: 500; }
.field input:not([type=checkbox]), .field select, .field textarea { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; line-height: 1.5; }
.field input[type=checkbox] { align-self: flex-start; width: 24px; height: 24px; accent-color: var(--primary); }
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--primary); }
.field input:user-invalid, .field textarea:user-invalid { border-color: var(--danger); }
.field input[type=file] { background: var(--subtle); }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 12px; background: #fff; border-radius: 12px; }
.filter-bar .field { flex: 1 1 160px; }
.filter-bar .field:first-child { flex-basis: 220px; }
.filter-bar .button { flex: 0 0 auto; }
.preview-bar { background: #eaf1ff; border-bottom: 1px solid #c6d8fa; font-size: 12px; }
.preview-bar summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 38px; padding: 8px 24px; cursor: pointer; }
.preview-label { color: #1e40af; font-weight: 700; }
.preview-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 12px 24px 18px; }
.preview-controls .field { flex: 1 1 150px; max-width: 230px; }
.preview-controls .muted:last-child { flex: 1 0 100%; }
.topbar { min-height: 72px; padding: 12px 24px; border-bottom: 1px solid #e2e8f0; background: #fff; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; min-height: 44px; }
.brand-mark { display: grid; place-items: center; background: var(--primary); color: #fff; width: 36px; height: 36px; border-radius: 10px; }
.portal-layout { min-height: calc(100vh - 38px); }
.main-content { min-width: 0; padding: 32px; }
.main-content.parent { width: 390px; max-width: 100%; margin-inline: auto; padding: 24px; padding-block-end: 104px; }
.main-content.staff { max-width: 1280px; margin-inline: auto; }
.login-screen { padding-block-start: 80px; min-height: 760px; }
.login-screen h1 { font-size: 32px; line-height: 38px; }
.login-mark { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--primary); color: #fff; font-size: 32px; font-weight: 700; }
.login-screen .card { padding: 0; border: 0; box-shadow: none; background: transparent; }
.login-screen .field { background: #fff; border-radius: 12px; padding: 16px; }
.login-screen .field label { font-size: 12px; line-height: 16px; }
.login-screen .field input { padding: 0; border: 0; min-height: 30px; }
.login-screen .button { width: 100%; }
.staff .login-screen { padding-block-start: 0; max-width: 560px; min-height: 650px; }
.staff .login-mark { display: none; }
.staff .login-screen h1 { font-size: 24px; line-height: 31px; }
.staff .login-screen .card { padding: 24px; background: #fff; }
.staff .login-screen .field { background: var(--subtle); }
.staff .login-screen .field input { background: transparent; }
.otp-input { font-size: 24px !important; letter-spacing: .3em; text-align: center; font-weight: 700; }
.student-grid { display: grid; gap: 18px; }
.student-card { min-height: 250px; gap: 8px; align-items: flex-start; }
.student-card .button { margin-block-start: auto; min-width: 160px; }
.avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--primary); background: var(--subtle); font-size: 20px; font-weight: 700; }
.badge { display: inline-flex; align-items: center; gap: 6px; width: fit-content; border-radius: 999px; padding: 7px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--text); background: var(--subtle); }
.badge img { flex: 0 0 8px; }
.status-Calling { color: var(--calling); }
.status-Ready, .status-Delivered { color: var(--success); }
.status-StudentNotFound, .status-ParentNoShow, .status-DeliveryFailed, .status-Rejected { color: var(--danger); }
.status-title { font-size: 24px; line-height: 31px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.timeline li { display: grid; grid-template-columns: 20px minmax(0,1fr) auto; align-items: start; gap: 10px; color: var(--muted); font-size: 14px; }
.timeline li.complete { color: var(--success); }
.timeline li.current { color: var(--calling); font-weight: 700; }
.timeline-marker { font-size: 18px; line-height: 20px; }
.bottom-nav { display: grid; grid-template-columns: repeat(3,1fr); position: fixed; z-index: 20; inset-block-end: 0; inset-inline: 0; width: 390px; max-width: 100%; margin-inline: auto; padding: 8px 10px max(8px,env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--border); }
.bottom-nav a, .portal-nav a { min-height: 48px; display: flex; align-items: center; justify-content: center; padding: 10px; color: var(--secondary); font-size: 14px; }
.bottom-nav a.active, .portal-nav a.active { color: var(--primary); background: #eff6ff; border-radius: 8px; }
.portal-layout > .portal-nav { display: flex; justify-content: center; border-top: 1px solid var(--border); background: #fff; }
.admin-layout { display: grid; grid-template-columns: 260px minmax(0,1fr); min-height: calc(100vh - 38px); }
.sidebar { padding: 24px; background: #fff; display: flex; flex-direction: column; gap: 18px; }
.school-brand { color: var(--primary); font-size: 20px; line-height: 27px; }
.sidebar .portal-nav { display: flex; flex-direction: column; gap: 8px; }
.sidebar .portal-nav a { justify-content: flex-start; }
.sidebar > .button:last-child { margin-block-start: auto; }
.status-tabs { display: flex; flex-wrap: wrap; gap: 12px; }
.status-tabs .button { min-width: 150px; }
.queue-layout { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); gap: 18px; align-items: start; }
.queue-card { min-height: 148px; gap: 8px; }
.queue-card h2 { font-size: 16px; line-height: 25px; }
.queue-card .text-link { min-height: 24px; font-size: 12px; }
.selected-request { min-height: 490px; }
.detail-layout { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(0,1fr); gap: 18px; align-items: stretch; }
.staff .detail-layout > .card { min-height: 510px; padding: 20px; }
.detail-layout .button { width: 100%; }
.detail-layout .row .button { flex: 1 1 160px; width: auto; }
.two-columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.two-columns > .card { min-height: 390px; padding: 18px; }
.three-columns { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.three-columns > .card { min-height: 470px; }
.kpi-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 16px; }
.kpi { min-height: 130px; gap: 6px; }
.kpi-value { font-size: 32px; line-height: 38px; }
.chart { display: flex; flex-direction: column; gap: 18px; margin: 0; }
.chart dt { width: 54px; font-size: 14px; }
.chart dd { margin: 0; color: #fff; background: var(--primary); border-radius: 6px; padding: 4px 8px; text-align: end; }
.bar-21 { width: 45%; } .bar-36 { width: 72%; } .bar-13 { width: 30%; }
.table-scroll { overflow-x: auto; width: 100%; border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: start; }
th { background: var(--subtle); color: var(--secondary); font-size: 12px; font-weight: 500; }
th, td { padding: 12px 10px; border-bottom: 1px solid #e2e8f0; vertical-align: middle; overflow-wrap: anywhere; }
tr:nth-child(even) td { background: var(--canvas); }
td .row { flex-wrap: nowrap; }
td .row .button, td .text-link { white-space: nowrap; }
.state-panel { align-items: center; text-align: center; min-height: 320px; padding: 32px 24px; }
.state-icon { display: grid; place-items: center; font-size: 32px; color: var(--danger); background: #fef2f2; width: 64px; height: 64px; border-radius: 50%; }
.state-icon.loading { color: var(--primary); background: #eff6ff; animation: spin 1.2s linear infinite; }
.state-icon.empty { color: var(--muted); background: var(--subtle); }
.skeleton { height: 16px; border-radius: 8px; width: 100%; background: var(--subtle); animation: pulse 1.4s ease-in-out infinite; }
.camera-view { display: grid; place-items: center; min-height: 340px; padding: 24px; background: #0f172a; color: #fff; border-radius: 12px; }
.viewfinder { width: min(100%,240px); aspect-ratio: 1; border: 3px solid #fff; border-radius: 12px; padding: 12px; font-size: 14px; }
.dialog { width: min(100% - 32px,600px); max-height: min(85vh,850px); overflow-y: auto; padding: 24px; color: var(--text); background: #fff; border: 0; border-radius: 16px; box-shadow: 0 20px 80px #0f172a40; }
.dialog::backdrop { background: #0f172a80; }
.dialog .row > .button { flex: 1 1 120px; }
.toast { position: fixed; z-index: 100; inset-block-end: 90px; inset-inline: 16px; margin-inline: auto; width: fit-content; max-width: min(90%,620px); padding: 14px 20px; border-radius: 10px; background: #0f172a; color: #fff; box-shadow: 0 4px 20px #0003; }
.toast.error { background: var(--danger); }
.skip-link { position: fixed; z-index: 120; inset-block-start: 8px; inset-inline-start: 8px; padding: 10px 14px; border-radius: 8px; background: var(--text); color: #fff; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@keyframes pulse { 50% { opacity: .5; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width:768px) {
  .main-content.parent:not(:has(.login-screen)) { width: 760px; }
  .student-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .bottom-nav { position: static; width: 390px; margin-block: 16px 32px; border: 1px solid var(--border); border-radius: 12px; }
  .main-content.parent { padding-block-end: 24px; }
}
@media (max-width:1100px) {
  .admin-layout { grid-template-columns: 210px minmax(0,1fr); }
  .sidebar { padding: 18px; }
  .kpi-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .three-columns { grid-template-columns: 1fr; }
  .three-columns > .card { min-height: auto; }
}
@media (max-width:800px) {
  .admin-layout { display: flex; flex-direction: column; }
  .sidebar { gap: 8px; border-bottom: 1px solid var(--border); }
  .sidebar .portal-nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar .portal-nav a { flex: 1 1 140px; }
  .sidebar > .button:last-child { align-self: flex-start; }
  .main-content { padding: 24px; }
  .queue-layout, .detail-layout, .two-columns { grid-template-columns: 1fr; }
  .staff .detail-layout > .card, .selected-request, .two-columns > .card { min-height: auto; }
  .queue-list { order: -1; }
  .topbar { padding: 12px 16px; }
  .topbar .row > .muted { display: none; }
}
@media (max-width:480px) {
  .main-content:not(.parent) { padding: 16px; }
  .preview-bar summary { padding-inline: 16px; }
  .preview-controls { padding-inline: 16px; }
  .preview-bar summary > .muted { font-size: 12px; }
  .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filter-bar { padding: 10px; }
  .filter-bar .field { flex-basis: 100%; }
  .button { max-width: 100%; }
  table { min-width: 620px; }
  .login-screen { padding-block-start: 64px; }
}
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
.main-content:has(.login-screen) { max-width: 560px; margin-inline: auto; }
