:root {
    --ink: #0b2b3d;
    --muted: #60717a;
    --paper: #f5f8fa;
    --surface: #ffffff;
    --line: #d8e3e9;
    --brand: #0d78ad;
    --brand-bright: #1a92ce;
    --brand-dark: #063e5c;
    --brand-soft: #e5f4fb;
    --gold: #926900;
    --gold-bright: #fac017;
    --danger: #a73535;
    --danger-soft: #fff0ee;
    --success: #0d6f9e;
    --shadow: 0 24px 70px rgba(8, 48, 70, 0.14);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--paper);
    font-family: "Cairo", Tahoma, Arial, sans-serif;
    line-height: 1.7;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(circle at 15% 0%, rgba(250, 192, 23, 0.16), transparent 28rem),
        linear-gradient(145deg, #fbfaf4 0%, #edf7fb 100%);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.22;
    background-image: linear-gradient(rgba(26, 146, 206, 0.08) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(26, 146, 206, 0.08) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, black, transparent 72%);
}

a { color: var(--brand); }
button, input { font: inherit; }
button { cursor: pointer; }

.site-shell,
.admin-shell {
    width: min(1160px, calc(100% - 32px));
    margin: 0 auto;
}

.site-shell { padding: 28px 0 20px; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: min(260px, 70vw);
    height: auto;
}

.lookup-card {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    min-height: 610px;
    margin-top: 38px;
    overflow: hidden;
    border: 1px solid rgba(16, 35, 29, 0.1);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.lookup-intro {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(38px, 6vw, 72px);
    color: white;
    background: var(--brand-dark);
    isolation: isolate;
}

.lookup-intro::before {
    content: "";
    position: absolute;
    width: 340px;
    height: 340px;
    left: -120px;
    bottom: -150px;
    z-index: -1;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 50%;
    box-shadow: 0 0 0 48px rgba(255,255,255,.035), 0 0 0 96px rgba(255,255,255,.025);
}

.lookup-intro .eyebrow { color: var(--gold-bright); }

.eyebrow {
    display: inline-block;
    width: fit-content;
    margin-bottom: 14px;
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.lookup-intro h1 {
    margin: 0;
    font-size: clamp(2.25rem, 5vw, 4rem);
    line-height: 1.25;
    letter-spacing: -0.04em;
}

.lookup-intro h1 em { color: var(--gold-bright); font-style: normal; }
.lookup-intro > p { max-width: 38ch; margin: 22px 0 28px; color: #d8e4df; }

.trust-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: #eef6f3;
    font-size: 0.9rem;
}

.trust-list span {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-left: 7px;
    border: 1px solid rgba(250, 192, 23, .55);
    border-radius: 50%;
    color: var(--gold-bright);
    font-size: 0.72rem;
}

.lookup-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(28px, 6vw, 70px);
}

.lookup-form,
.admin-form { display: grid; gap: 12px; }

label,
legend { font-weight: 700; }

.input-wrap { position: relative; }

input[type="text"],
input[type="password"] {
    width: 100%;
    min-height: 54px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    outline: 0;
    color: var(--ink);
    background: #fbfcfb;
    transition: border-color .18s ease, box-shadow .18s ease;
}

input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(26, 146, 206, 0.14);
}

.input-wrap input { direction: ltr; padding-left: 48px; letter-spacing: .12em; text-align: right; }
.input-icon { position: absolute; left: 17px; top: 50%; translate: 0 -50%; color: var(--brand); font-weight: 800; }
.lookup-form small, .mode-option small, .file-picker small { color: var(--muted); }

.primary-button,
.schedule-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 54px;
    margin-top: 8px;
    border: 0;
    border-radius: var(--radius-sm);
    color: white;
    background: var(--brand);
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(13, 120, 173, 0.24);
    transition: background .18s ease, transform .18s ease;
}

.primary-button:hover,
.schedule-button:hover { background: var(--brand-dark); transform: translateY(-1px); }
.primary-button:focus-visible,
.schedule-button:focus-visible,
.text-button:focus-visible,
a:focus-visible { outline: 3px solid rgba(250, 192, 23, .7); outline-offset: 3px; }

.notice {
    margin-top: 18px;
    padding: 12px 15px;
    border-right: 4px solid currentColor;
    border-radius: var(--radius-sm);
    font-size: .9rem;
}
.notice.error { color: #8b2a2a; background: var(--danger-soft); }
.notice.success { color: var(--success); background: var(--brand-soft); }

.student-result,
.import-report {
    margin-top: 20px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fbfcfb;
}

.result-heading { display: flex; align-items: center; gap: 12px; }
.result-heading small { color: var(--muted); }
.result-heading h2 { margin: 1px 0 0; font-size: 1.25rem; }
.result-check { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; color: white; background: var(--brand); font-weight: 800; }

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin: 20px 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--line);
}
.details-grid div { padding: 11px 13px; background: white; }
.details-grid dt { color: var(--muted); font-size: .75rem; }
.details-grid dd { margin: 2px 0 0; font-weight: 700; }

.notes { padding: 13px 15px; border-right: 3px solid var(--gold); background: #fffaf0; }
.notes p { margin: 4px 0 0; }
.schedule-button { width: 100%; }
.schedule-missing { margin: 15px 0 0; color: var(--muted); text-align: center; }

.site-shell > footer { padding: 22px 0 0; color: var(--muted); font-size: .8rem; text-align: center; }
.site-shell > footer a { color: inherit; }

.admin-shell { padding: 24px 0 60px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.text-button { padding: 9px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: white; }
.text-button:hover { border-color: var(--brand); color: var(--brand); }

.login-card {
    width: min(460px, 100%);
    margin: 9vh auto 0;
    padding: clamp(28px, 6vw, 48px);
    border: 1px solid var(--line);
    border-top: 4px solid var(--brand);
    border-radius: var(--radius-md);
    background: white;
    box-shadow: var(--shadow);
}
.login-card h1 { margin: 0; font-size: 2rem; }
.login-card > p { margin-top: 4px; color: var(--muted); }
.admin-form { margin-top: 22px; }
.back-link { display: block; margin-top: 20px; color: var(--muted); font-size: .85rem; text-align: center; }

.admin-content { margin-top: 52px; }
.admin-title-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.admin-title-row h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.7rem); }
.count-card { min-width: 150px; padding: 14px 18px; border-right: 4px solid var(--gold); background: white; box-shadow: 0 8px 24px rgba(16,35,29,.06); }
.count-card strong, .count-card span { display: block; }
.count-card strong { color: var(--brand); font-size: 1.6rem; }
.count-card span { color: var(--muted); font-size: .78rem; }

.upload-card,
.import-report { padding: clamp(22px, 4vw, 38px); border: 1px solid var(--line); border-radius: var(--radius-md); background: white; box-shadow: 0 12px 36px rgba(16,35,29,.07); }
.import-report { margin: 0 0 20px; }
.form-section { display: flex; align-items: start; gap: 12px; }
.form-section h2 { margin: 0; font-size: 1.18rem; }
.form-section p { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.step-number { display: inline-grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; color: white; background: var(--brand); font-size: .8rem; }

.file-picker {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 18px 0 10px;
    padding: 20px;
    border: 1px dashed #aebdb7;
    border-radius: var(--radius-sm);
    background: #f8fbf9;
    cursor: pointer;
}
.file-picker:hover { border-color: var(--brand); background: var(--brand-soft); }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-picker strong, .file-picker small { display: block; }
.file-icon { display: grid; place-items: center; width: 50px; height: 44px; border-radius: 6px; color: white; background: var(--brand-dark); font-size: .72rem; font-weight: 800; }
.sample-link { display: inline-block; margin-bottom: 28px; font-size: .85rem; font-weight: 700; }

.mode-selector { display: grid; gap: 10px; margin: 0; padding: 25px 0 0; border: 0; border-top: 1px solid var(--line); }
.mode-selector legend { width: 100%; padding: 0 0 14px; }
.mode-selector legend .step-number { margin-left: 8px; }
.mode-option { position: relative; display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.mode-option.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px rgba(26,146,206,.1); }
.mode-option input { accent-color: var(--brand); }
.mode-option span { flex: 1; }
.mode-option strong, .mode-option small { display: block; }
.mode-option em { padding: 4px 8px; border-radius: 999px; color: var(--brand-dark); background: white; font-size: .7rem; font-style: normal; }
.danger-option.selected { border-color: var(--danger); background: var(--danger-soft); box-shadow: 0 0 0 2px rgba(167,53,53,.08); }

.replace-confirmation { margin-top: 15px; padding: 16px; border: 1px solid #e7b7b1; border-radius: var(--radius-sm); background: var(--danger-soft); }
.replace-confirmation[hidden] { display: none; }
.replace-confirmation p { margin: 4px 0 12px; font-size: .88rem; }
.upload-card > .primary-button { width: 100%; margin-top: 22px; }

.report-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 20px; }
.report-grid div { padding: 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: white; text-align: center; }
.report-grid strong, .report-grid span { display: block; }
.report-grid strong { color: var(--brand); font-size: 1.45rem; }
.report-grid span { color: var(--muted); font-size: .74rem; }
.import-report details { margin-top: 16px; color: var(--danger); font-size: .85rem; }
.import-report summary { cursor: pointer; font-weight: 700; }

@media (max-width: 800px) {
    .lookup-card { grid-template-columns: 1fr; margin-top: 24px; }
    .lookup-intro { min-height: 390px; }
    .lookup-panel { padding-block: 38px; }
    .admin-content { margin-top: 36px; }
}

@media (max-width: 560px) {
    .site-shell, .admin-shell { width: min(100% - 20px, 1160px); }
    .site-shell { padding-top: 16px; }
    .lookup-card { border-radius: var(--radius-md); }
    .lookup-intro { min-height: 335px; padding: 30px 24px; }
    .lookup-panel { padding: 28px 20px; }
    .details-grid, .report-grid { grid-template-columns: 1fr 1fr; }
    .admin-header { align-items: flex-start; }
    .admin-title-row { align-items: stretch; flex-direction: column; }
    .count-card { width: 100%; }
    .mode-option { align-items: flex-start; }
    .mode-option em { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
