/* ==========================================================================
   Public pages: login, student registration, success, invalid link.
   Uses the same brand tokens as theme.css but no app shell.
   ========================================================================== */

:root {
    --brand: #1B3A9C;
    --brand-dark: #142C78;
    --brand-darker: #0E1F57;
    --brand-soft: #EEF2FF;
    --brand-ring: rgba(27, 58, 156, .16);
    --accent: #F58A1F;
    --accent-dark: #DB7310;
    --accent-soft: #FFF4E6;
    --sun: #FDB813;
    --success: #16a34a;
    --danger: #dc2626;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --subtle: #94a3b8;
    --line: #e5e9f2;
    --page: #f6f8fc;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--ink-2);
    background: var(--page);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
a { color: var(--brand); }

/* ---------- Shared form controls ---------- */
.pub-field { margin-bottom: 16px; }
.pub-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.pub-label .req { color: var(--danger); }
.pub-input-wrap { position: relative; }
.pub-input-wrap .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--subtle); font-size: 14px; pointer-events: none; }
.pub-input, .pub-input-wrap input, .pub-input-wrap select {
    width: 100%;
    min-height: 46px;
    padding: 11px 13px 11px 40px;
    font: inherit;
    font-size: 15px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #d5dbe6;
    border-radius: 9px;
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
    -webkit-appearance: none;
}
.pub-input-wrap select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 13px center;
    background-size: 14px 10px;
    padding-right: 36px;
}
.pub-input-wrap input::placeholder { color: var(--subtle); }
.pub-input-wrap input:hover, .pub-input-wrap select:hover { border-color: #b8c4d4; }
.pub-input-wrap input:focus, .pub-input-wrap select:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.pub-input-wrap input:focus + .ico, .pub-input-wrap .ico.focus { color: var(--brand); }
.pub-input-wrap .is-invalid, .pub-input-wrap .input-validation-error { border-color: var(--danger); }
.field-error { display: block; color: var(--danger); font-size: 12px; margin-top: 5px; }
.field-error:empty { display: none; }

.pub-btn {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 9px;
    font: inherit;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    background: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, box-shadow .15s, transform .1s;
}
.pub-btn:hover { background: var(--brand-dark); box-shadow: 0 6px 18px rgba(27, 58, 156, .25); color: #fff; }
.pub-btn:active { transform: translateY(1px); }
.pub-btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--brand-ring); }
.pub-btn:disabled { opacity: .75; cursor: progress; }
.pub-btn.accent { background: var(--accent); box-shadow: 0 4px 14px rgba(245, 138, 31, .3); }
.pub-btn.accent:hover { background: var(--accent-dark); box-shadow: 0 6px 18px rgba(245, 138, 31, .38); }

.pub-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: 9px;
    padding: 11px 14px;
    font-size: 14px;
    margin-bottom: 18px;
}
.pub-alert i { margin-top: 2px; }

/* ---------- Login ---------- */
.login-page { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.login-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 60%, var(--brand-darker) 100%);
    color: #fff;
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.login-hero::after {
    content: '';
    position: absolute;
    right: -140px;
    bottom: -140px;
    width: 460px;
    height: 460px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(253, 184, 19, .85) 0%, rgba(245, 138, 31, .55) 40%, rgba(245, 138, 31, 0) 70%);
    pointer-events: none;
}
.login-hero .logo-card { background: #fff; border-radius: 14px; padding: 10px 14px; width: 210px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); position: relative; z-index: 1; }
.login-hero .logo-card img { width: 100%; height: auto; display: block; }
.login-hero .hero-copy { position: relative; z-index: 1; max-width: 460px; }
.login-hero h1 { font-size: 40px; line-height: 1.12; font-weight: 800; letter-spacing: -.035em; margin: 0 0 14px; color: #fff; }
.login-hero h1 span { color: var(--sun); }
.login-hero p { font-size: 16px; line-height: 1.6; opacity: .85; margin: 0 0 26px; }
.login-hero .features { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; font-size: 14px; }
.login-hero .features div { display: flex; align-items: center; gap: 10px; opacity: .92; }
.login-hero .features i { width: 30px; height: 30px; border-radius: 8px; background: rgba(255, 255, 255, .12); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; color: var(--sun); flex-shrink: 0; }
.login-hero .hero-foot { position: relative; z-index: 1; font-size: 12px; opacity: .6; }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.login-card { width: 100%; max-width: 380px; }
.login-card .mobile-logo { display: none; width: 170px; margin: 0 auto 24px; }
.login-card h2 { font-size: 26px; font-weight: 800; color: var(--ink); letter-spacing: -.03em; margin: 0 0 6px; }
.login-card .lead { color: var(--muted); margin: 0 0 28px; font-size: 14px; }
.login-card .foot { margin-top: 28px; text-align: center; color: var(--subtle); font-size: 12px; }

@media (max-width: 900px) {
    .login-page { grid-template-columns: 1fr; }
    .login-hero { display: none; }
    .login-panel { min-height: 100vh; background: linear-gradient(180deg, #fff 0%, var(--page) 100%); border-top: 4px solid var(--accent); }
    .login-card .mobile-logo { display: block; }
    .login-card h2, .login-card .lead { text-align: center; }
}

/* ---------- Registration ---------- */
.reg-page { min-height: 100vh; display: flex; flex-direction: column; }
.reg-header { background: #fff; border-bottom: 4px solid var(--accent); text-align: center; padding: 20px 16px 18px; }
.reg-header img { width: 150px; height: auto; display: block; margin: 0 auto 8px; }
.reg-header h1 { font-size: 22px; font-weight: 800; color: var(--ink); margin: 0; letter-spacing: -.02em; }
.reg-header p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.reg-body { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 20px 16px 32px; }
.school-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    padding: 11px 14px;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 16px;
}
.school-chip i { font-size: 16px; }
.school-chip small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.reg-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .05); padding: 22px 20px; }
.reg-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-dark); margin: 6px 0 12px; display: flex; align-items: center; gap: 10px; }
.reg-section::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.reg-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 600px) {
    .reg-grid { grid-template-columns: 1fr 1fr; }
    .reg-grid .span-2 { grid-column: span 2; }
    .reg-card { padding: 28px; }
}
.privacy-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.5; }
.privacy-note i { color: var(--success); margin-top: 2px; }
.reg-footer { text-align: center; padding: 16px; color: var(--subtle); font-size: 12px; }
.reg-footer a { color: var(--muted); font-weight: 600; text-decoration: none; }

/* ---------- Result pages (success / invalid) ---------- */
.result-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; border-top: 4px solid var(--accent); }
.result-card { width: 100%; max-width: 480px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 32px rgba(15, 23, 42, .08); padding: 28px 24px; text-align: center; }
.result-card .logo { width: 130px; height: auto; margin: 0 auto 18px; display: block; }
.result-icon { width: 68px; height: 68px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 28px; margin-bottom: 14px; }
.result-icon.ok { background: #dcfce7; color: var(--success); box-shadow: 0 0 0 8px #f0fdf4; }
.result-icon.warn { background: #fef3c7; color: #d97706; box-shadow: 0 0 0 8px #fffbeb; }
.result-card h2 { font-size: 22px; font-weight: 800; color: var(--ink); margin: 0 0 6px; letter-spacing: -.02em; }
.result-card .sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; line-height: 1.6; }
.result-card .school-chip { justify-content: center; }
.reg-id { display: inline-flex; align-items: center; gap: 8px; background: var(--accent-soft); color: #b45309; border: 1px dashed #fdba74; border-radius: 10px; padding: 9px 16px; font-weight: 800; font-size: 16px; letter-spacing: .02em; margin-bottom: 18px; }
.detail-box { text-align: left; background: var(--page); border: 1px solid var(--line); border-radius: 12px; padding: 6px 14px; margin-bottom: 14px; }
.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.detail-row:last-child { border-bottom: 0; }
.detail-row .label { color: var(--muted); display: flex; align-items: center; gap: 8px; }
.detail-row .label i { width: 14px; text-align: center; color: var(--subtle); }
.detail-row .value { color: var(--ink); font-weight: 600; text-align: right; }
.result-card .hint { font-size: 12px; color: var(--subtle); margin: 0 0 18px; }

/* ---------- Employee portal picker (/select-portal) ---------- */
.portal-card { max-width: 420px; }
.portal-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.portal-form { margin: 0; }
.portal-item { width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; cursor: pointer; font: inherit; color: var(--ink); transition: border-color .12s, box-shadow .12s, transform .12s; }
.portal-item:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgba(27, 58, 156, .12); transform: translateY(-1px); }
.portal-item:focus-visible { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.portal-item:disabled { opacity: .7; cursor: progress; transform: none; }
.portal-item.current { border-color: var(--brand); background: var(--brand-soft); }
.portal-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.portal-item.current .portal-icon { background: var(--brand); color: #fff; }
.portal-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.portal-city { font-weight: 700; font-size: 15px; }
.portal-manager { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.portal-go { color: var(--subtle); font-size: 13px; }
.portal-badge { font-size: 11px; font-weight: 700; color: var(--brand); background: #fff; border: 1px solid var(--brand); border-radius: 999px; padding: 2px 9px; }
.portal-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 16px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 13px; }
.portal-empty i { font-size: 26px; color: var(--subtle); margin-bottom: 4px; }
.portal-empty strong { color: var(--ink); font-size: 15px; }
.portal-signout { margin-top: 18px; text-align: center; }
.portal-signout button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.portal-signout button:hover { color: var(--danger); }
