:root {
    --auth-primary: #174a7e;
    --auth-primary-strong: #10375f;
    --auth-accent: #f58220;
    --auth-surface: #ffffff;
    --auth-background: #f3f6fa;
    --auth-text: #182334;
    --auth-muted: #607087;
    --auth-border: #d9e1eb;
    --auth-focus: #1976d2;
    --auth-danger: #b42318;
    --auth-success: #087443;
    --auth-warning: #8a4b08;
    --auth-radius: 18px;
    --auth-shadow: 0 24px 70px rgba(24, 35, 52, 0.16);
}

*, *::before, *::after { box-sizing: border-box; }

html { min-width: 320px; background: var(--auth-background); }

body.auth-page {
    min-height: 100vh;
    margin: 0;
    color: var(--auth-text);
    background: var(--auth-background);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

button, input, select, textarea { font: inherit; }
button, a { touch-action: manipulation; }

.auth-skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 2000;
    padding: 10px 14px;
    color: #fff;
    background: var(--auth-primary-strong);
    border-radius: 8px;
    transform: translateY(-160%);
}
.auth-skip-link:focus { transform: translateY(0); }

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(420px, 0.88fr);
    min-height: 100vh;
}

.auth-story {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    color: #fff;
    background: #123f6c url("../img/students.jpg") center/cover no-repeat;
}
.auth-story__wash {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 80% 15%, rgba(245, 130, 32, 0.32), transparent 34%),
        linear-gradient(145deg, rgba(10, 45, 79, 0.97), rgba(23, 74, 126, 0.82));
}
.auth-story__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 760px;
    padding: clamp(32px, 6vw, 76px);
}

.auth-brand { display: inline-flex; align-items: center; gap: 13px; text-decoration: none; }
.auth-brand:hover { text-decoration: none; }
.auth-brand__mark {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    flex: 0 0 58px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,.14);
}
.auth-brand__mark img { display: block; width: 48px; height: 48px; object-fit: contain; }
.auth-brand strong, .auth-brand small { display: block; }
.auth-brand strong { font-size: 1.25rem; line-height: 1.2; }
.auth-brand small { margin-top: 3px; font-size: .82rem; }
.auth-brand--light { color: #fff; }
.auth-brand--light small { color: rgba(255,255,255,.78); }
.auth-brand--mobile { display: none; color: var(--auth-text); }
.auth-brand--mobile small { color: var(--auth-muted); }

.auth-story__message { margin: auto 0 44px; }
.auth-eyebrow {
    display: block;
    margin-bottom: 10px;
    color: var(--auth-accent);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.auth-story__message h1 {
    max-width: 650px;
    margin: 0;
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    line-height: 1.04;
    letter-spacing: -.045em;
}
.auth-story__message p { max-width: 610px; margin: 24px 0 0; color: rgba(255,255,255,.82); font-size: 1.08rem; }
.auth-benefits { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 0; padding: 0; list-style: none; color: rgba(255,255,255,.9); }
.auth-benefits span { display: inline-grid; width: 22px; height: 22px; margin-right: 7px; place-items: center; color: var(--auth-primary-strong); background: #fff; border-radius: 50%; font-weight: 900; }
.auth-benefits svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.4; }

.auth-panel { display: grid; min-height: 100vh; padding: 32px; place-items: center; background: var(--auth-surface); }
.auth-panel__inner { width: min(100%, 470px); }
.auth-heading { margin-bottom: 30px; }
.auth-heading h2 { margin: 0; font-size: clamp(1.85rem, 3vw, 2.45rem); line-height: 1.15; letter-spacing: -.03em; }
.auth-heading p { margin: 12px 0 0; color: var(--auth-muted); }

.auth-form { display: grid; gap: 20px; }
.auth-field { position: relative; min-width: 0; }
.auth-field label, .auth-fieldset legend { color: var(--auth-text); font-weight: 700; }
.auth-field label { display: block; margin-bottom: 7px; font-size: .92rem; }
.auth-field label span { color: var(--auth-muted); font-weight: 500; }
.auth-field input, .auth-field select, .auth-field textarea {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    color: var(--auth-text);
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.auth-field textarea { min-height: 74px; resize: vertical; }
.auth-field input:focus, .auth-field select:focus, .auth-field textarea:focus {
    border-color: var(--auth-focus);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, .18);
}
.auth-field small { display: block; margin-top: 6px; color: var(--auth-muted); font-size: .8rem; }
.auth-label-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.auth-label-row a { margin-bottom: 7px; color: var(--auth-primary); font-size: .84rem; font-weight: 700; }
.auth-password { position: relative; }
.auth-password input { padding-right: 67px; }
.auth-password__toggle {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 54px;
    min-height: 40px;
    color: var(--auth-primary);
    background: transparent;
    border: 0;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 800;
    cursor: pointer;
}

.auth-primary-button, .auth-secondary-button {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.auth-primary-button { color: #fff; background: var(--auth-primary); border: 1px solid var(--auth-primary); }
.auth-primary-button:hover { background: var(--auth-primary-strong); border-color: var(--auth-primary-strong); }
.auth-primary-button:disabled { cursor: wait; opacity: .62; }
.auth-secondary-button { width: 100%; color: var(--auth-primary); background: #fff; border: 1px solid #aebdce; }
.auth-secondary-button:hover { background: #f5f8fb; border-color: var(--auth-primary); }
.auth-primary-button:focus-visible, .auth-secondary-button:focus-visible, .auth-password__toggle:focus-visible, .auth-role-option:focus-within {
    outline: 3px solid rgba(25,118,210,.32);
    outline-offset: 2px;
}
.auth-primary-button--compact, .auth-secondary-button--compact { width: auto; min-width: 150px; }
.auth-divider { display: flex; align-items: center; gap: 14px; margin: 28px 0 18px; color: var(--auth-muted); font-size: .82rem; }
.auth-divider::before, .auth-divider::after { height: 1px; flex: 1; content: ""; background: var(--auth-border); }
.auth-approval-hint { margin: 12px 0 0; color: var(--auth-muted); font-size: .82rem; text-align: center; }

.auth-alert { margin-bottom: 20px; padding: 12px 14px; border-radius: 10px; font-size: .9rem; }
.auth-alert--error { color: var(--auth-danger); background: #fff0ee; border: 1px solid #f3b8b1; }
.auth-alert--success { color: var(--auth-success); background: #ecfdf3; border: 1px solid #9fe0bd; }
.auth-alert--info { color: var(--auth-primary-strong); background: #eef6ff; border: 1px solid #b7d5f5; }

.auth-registration-modal .modal-dialog { max-width: 1040px; }
.auth-registration-modal .modal-content {
    overflow: visible;
    border: 0;
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow);
}
.auth-modal-header { align-items: flex-start; padding: 25px 28px 20px; border-bottom: 1px solid var(--auth-border); }
.auth-modal-header h2 { margin: 0; font-size: 1.65rem; letter-spacing: -.02em; }
.auth-modal-header p { margin: 7px 0 0; color: var(--auth-muted); }
.auth-modal-close { width: 44px; height: 44px; margin: -5px -5px 0 12px; border-radius: 10px; }
.auth-modal-body {
    display: grid;
    gap: 24px;
    padding: 25px 28px 30px;
    background: #f8fafc;
}
.auth-modal-footer { gap: 10px; padding: 18px 28px; border-top-color: var(--auth-border); }
.auth-fieldset { margin: 0; padding: 22px; background: #fff; border: 1px solid var(--auth-border); border-radius: 14px; }
.auth-fieldset legend { width: auto; margin: 0 0 17px; padding: 0; font-size: 1rem; }
.auth-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.auth-field--wide { grid-column: 1 / -1; }

.auth-role-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.auth-role-option { position: relative; display: flex; min-height: 72px; align-items: center; padding: 13px; border: 1px solid var(--auth-border); border-radius: 11px; cursor: pointer; transition: border-color .2s ease, background-color .2s ease; }
.auth-role-option:hover { border-color: #91abc5; background: #f8fbff; }
.auth-role-option--selected { border-color: var(--auth-primary); background: #eef6ff; box-shadow: inset 0 0 0 1px var(--auth-primary); }
.auth-role-option input { width: 18px; height: 18px; margin: 0 10px 0 0; accent-color: var(--auth-primary); }
.auth-role-option strong, .auth-role-option small { display: block; }
.auth-role-option strong { font-size: .9rem; }
.auth-role-option small { margin-top: 2px; color: var(--auth-muted); font-size: .75rem; }
.auth-role-note { margin-top: 14px; padding: 11px 13px; color: var(--auth-warning); background: #fff7e8; border: 1px solid #f1cf91; border-radius: 9px; font-size: .84rem; }
.auth-role-note--student { color: var(--auth-success); background: #ecfdf3; border-color: #9fe0bd; }

.auth-school-field { z-index: 3; margin-bottom: 18px; }
.auth-school-suggestions { position: absolute; top: calc(100% - 21px); right: 0; left: 0; z-index: 1065; max-height: 280px; overflow-y: auto; padding: 6px; background: #fff; border: 1px solid var(--auth-border); border-radius: 10px; box-shadow: 0 16px 38px rgba(24,35,52,.16); }
.auth-school-option { display: block; width: 100%; min-height: 48px; padding: 9px 11px; text-align: left; background: #fff; border: 0; border-radius: 7px; cursor: pointer; }
.auth-school-option:hover, .auth-school-option[aria-selected="true"] { background: #eef6ff; }
.auth-school-option strong, .auth-school-option small { display: block; }
.auth-school-option small { margin: 2px 0 0; color: var(--auth-muted); }
.auth-school-empty { padding: 12px; color: var(--auth-muted); font-size: .86rem; }
.auth-message-region:empty { display: none; }

@media (max-width: 980px) {
    .auth-shell { grid-template-columns: minmax(0, 1fr) minmax(390px, .95fr); }
    .auth-story__content { padding: 38px; }
    .auth-story__message h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); }
    .auth-role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .auth-shell { display: block; }
    .auth-story { display: none; }
    .auth-panel { min-height: 100vh; padding: 28px 20px; }
    .auth-brand--mobile { display: inline-flex; margin-bottom: 45px; }
    .auth-form-grid { grid-template-columns: 1fr; }
    .auth-field--wide { grid-column: auto; }
    .auth-modal-header, .auth-modal-body, .auth-modal-footer { padding-right: 18px; padding-left: 18px; }
    .auth-modal-footer { flex-wrap: nowrap; }
    .auth-primary-button--compact, .auth-secondary-button--compact { min-width: 0; flex: 1; }
}

@media (max-width: 480px) {
    .auth-panel { padding: 22px 16px; }
    .auth-brand--mobile { margin-bottom: 34px; }
    .auth-role-grid { grid-template-columns: 1fr; }
    .auth-fieldset { padding: 17px; }
    .auth-registration-modal .modal-dialog { margin: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
