@font-face { font-family:"Raleway"; font-style:normal; font-weight:300; font-display:swap; src:url("/fonts/Raleway-Light.woff2") format("woff2"); }
@font-face { font-family:"Raleway"; font-style:normal; font-weight:400; font-display:swap; src:url("/fonts/Raleway-Regular.woff2") format("woff2"); }
@font-face { font-family:"Raleway"; font-style:normal; font-weight:500; font-display:swap; src:url("/fonts/Raleway-Medium.woff2") format("woff2"); }
@font-face { font-family:"Raleway"; font-style:normal; font-weight:600; font-display:swap; src:url("/fonts/Raleway-SemiBold.woff2") format("woff2"); }
@font-face { font-family:"Raleway"; font-style:normal; font-weight:700; font-display:swap; src:url("/fonts/Raleway-Bold.woff2") format("woff2"); }
@font-face { font-family:"Raleway"; font-style:normal; font-weight:800; font-display:swap; src:url("/fonts/Raleway-ExtraBold.woff2") format("woff2"); }

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

:root {
    --brand-red: #ED131C;
    --brand-red-hover: #C50F17;
    --brand-red-tint: #FEE5E6;

    --primary: #ED131C;
    --primary-hover: #C50F17;
    --success: #16746E;
    --danger: #ED131C;
    --warning: #8E6700;
    --muted: #B6BAC4;
    --bg: #F7F9FD;
    --card-bg: #FFFFFF;
    --text: #1C1C1C;
    --text-secondary: #87898F;
    --border: #E6E8ED;
    --radius: 12px;
    --radius-card: 16px;
    --font-sans: "Raleway", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

html { overflow-x: hidden; }
body {
    font-family: var(--font-sans);
    font-feature-settings: "kern" 1, "liga" 1, "lnum" 1;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    max-width: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header__logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.header__nav {
    display: flex;
    gap: 16px;
    align-items: center;
}

.nav__link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.nav__link {
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background 0.12s ease, color 0.12s ease;
}
.nav__link:hover {
    color: var(--primary);
}

.nav__link--active,
.nav__link[aria-current="page"] {
    color: var(--brand-red);
    background: var(--brand-red-tint);
    font-weight: 700;
}

.nav__user {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

.main {
    flex: 1;
    padding: 32px 0;
}

.hero {
    text-align: center;
    padding: 80px 0;
}

.hero h1 {
    font-size: 36px;
    margin-bottom: 16px;
}

.hero p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.hero__actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.hero__staff-login {
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}
.hero__staff-login a {
    color: var(--text-secondary);
    text-decoration: none;
}
.hero__staff-login a:hover {
    color: var(--brand-red);
    text-decoration: underline;
    text-underline-offset: 0.25em;
}

.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.btn--primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn--primary:hover {
    background: var(--primary-hover);
}

.btn--outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn--outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn--danger {
    background: var(--danger);
    color: #fff;
}

.btn--success {
    background: var(--success);
    color: #fff;
}

.btn--link {
    background: none;
    color: var(--primary);
    border: none;
    padding: 10px 0;
}

.btn--small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn--muted {
    background: var(--muted);
    color: #fff;
    cursor: not-allowed;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form {
    max-width: 800px;
}

.form-page {
    max-width: 600px;
    margin: 0 auto;
}

.form-page h1 {
    margin-bottom: 24px;
}

.form__group {
    margin-bottom: 16px;
    flex: 1;
}

.form__group--sm {
    flex: 0 1 13rem;
}

.form__row {
    display: flex;
    gap: 16px;
}

.form__label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form__input,
.form__select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text);
}

.form__input:focus,
.form__select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(237, 19, 28, 0.18);
}

.form__actions {
    margin-top: 24px;
    display: flex;
    gap: 16px;
    align-items: center;
}

.form--inline .form__row {
    align-items: flex-end;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert--error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert--info {
    background: #eff6ff;
    color: var(--primary);
    border: 1px solid #bfdbfe;
}

.alert--success {
    background: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.alert ul {
    margin-left: 20px;
}

.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tbody tr:hover {
    background: #f1f5f9;
}

.table a {
    color: var(--primary);
    text-decoration: none;
}

.table a:hover {
    text-decoration: underline;
}

.status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status--registered { background: #dbeafe; color: #1e40af; }
.status--testing { background: #fef3c7; color: #92400e; }
.status--completed { background: #e0e7ff; color: #3730a3; }
.status--passed { background: #dcfce7; color: #166534; }
.status--failed { background: #fee2e2; color: #991b1b; }
.status--pending { background: #f3f4f6; color: #6b7280; }

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge--success { background: #dcfce7; color: #166534; }
.badge--danger { background: #fee2e2; color: #991b1b; }
.badge--muted { background: #f3f4f6; color: #9ca3af; }

.tests-page h1 {
    margin-bottom: 16px;
}

.applicant-info {
    padding: 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.tests-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.test-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.test-card__content h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.test-card__content p {
    font-size: 13px;
    color: var(--text-secondary);
}

.toolbar {
    margin-bottom: 20px;
}

.toolbar--bottom {
    margin-top: 20px;
    margin-bottom: 0;
}

.search-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.search-form .form__input {
    width: 300px;
}

.question-card {
    padding: 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 8px;
}

.question__text {
    font-size: 14px;
    margin-bottom: 10px;
}

.question__options {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.question__options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}

.question__options--yesno {
    gap: 24px;
}

.test-info {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #eff6ff;
    border-radius: var(--radius);
    border: 1px solid #bfdbfe;
    font-size: 14px;
}

.test-actions {
    margin-top: 24px;
}

.toulouse-controls {
    margin-bottom: 16px;
}

.toulouse-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.samples-label { font-size: 14px; color: var(--text-secondary); }
.samples { display: flex; gap: 8px; }

.toulouse-line {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 16px 0;
    padding: 8px 0;
}

.tp-sq {
    position: relative;
    width: 34px;
    height: 34px;
    border: 1px solid var(--text);
    flex-shrink: 0;
    background: var(--card-bg);
    cursor: pointer;
}
.tp-sq--sample {
    border-color: var(--brand-red);
    cursor: default;
}

.tp-svg {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}
.tp-svg path { fill: var(--text); }
.tp-sq--sample .tp-svg path { fill: var(--brand-red); }

.tp-zone {
    position: absolute;
    left: 0; right: 0;
    height: 50%;
    z-index: 2;
}
.tp-zone--up  { top: 0; }
.tp-zone--low { bottom: 0; }

.tp-sq--matched { background: #dcfce7; border-color: #16a34a; }
.tp-sq--matched::after {
    content: "";
    position: absolute;
    left: 50%; top: 8%;
    width: 2px; height: 84%;
    transform: translateX(-50%);
    background: #16a34a;
    z-index: 1;
}
.tp-sq--nomatch { background: #fee2e2; border-color: var(--brand-red); }
.tp-sq--nomatch::after {
    content: "";
    position: absolute;
    left: 8%; bottom: 10%;
    width: 84%; height: 2px;
    background: var(--brand-red);
    z-index: 1;
}

/* Памятка управления */
.tp-hint {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 13px;
}
.tp-hint__item {
    padding: 6px 12px;
    border-radius: var(--radius);
    border: 1px solid transparent;
}
.tp-hint__item--up  { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.tp-hint__item--low { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

.timer {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin: 12px 0;
    text-align: center;
}

.dashboard-page h1 {
    margin-bottom: 24px;
}

.applicant-card h1 {
    margin-bottom: 8px;
}

.card__header {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
}

.card__header h1 {
    flex: 1;
}

.card__info {
    padding: 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    font-size: 14px;
}

.card__info p {
    margin-bottom: 6px;
}

.card__results {
    margin-bottom: 24px;
}

.card__results h2 {
    margin-bottom: 16px;
}

.result-card {
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.result-card h3 {
    font-size: 15px;
    margin-bottom: 12px;
}

.result-data p {
    margin-bottom: 6px;
}

.edited-note {
    color: var(--warning);
    font-size: 12px;
}

.card__audit h2 {
    margin-bottom: 16px;
}

.admin-page h1 {
    margin-bottom: 24px;
}

.card--add-user,
.card--users-list {
    padding: 24px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.card--add-user h2,
.card--users-list h2 {
    margin-bottom: 16px;
}

.mascot {
    position: fixed;
    right: clamp(12px, 3vw, 40px);
    bottom: clamp(12px, 3vw, 32px);
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.mascot__bubble {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(11, 13, 18, 0.10);
    position: relative;
    white-space: nowrap;
    animation: mascot-bubble 3.6s ease-in-out infinite;
}
.mascot__bubble::after {
    content: "";
    position: absolute;
    left: 50%; bottom: -7px;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: var(--card-bg);
    filter: drop-shadow(0 1px 0 var(--border));
}
.mascot__img {
    width: clamp(110px, 14vw, 180px);
    height: auto;
    transform-origin: 50% 100%;
    animation: mascot-idle 3.2s ease-in-out infinite,
               mascot-peek 7s ease-in-out infinite;
    filter: drop-shadow(0 10px 14px rgba(11, 13, 18, 0.18));
}
@keyframes mascot-idle {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-6px) scale(1.015); }
}
@keyframes mascot-peek {
    0%, 72%, 100% { rotate: 0deg; }
    80%           { rotate: -7deg; }
    88%           { rotate: 4deg; }
    94%           { rotate: 0deg; }
}
@keyframes mascot-bubble {
    0%, 100% { transform: translateY(0); opacity: 0.92; }
    50%      { transform: translateY(-3px); opacity: 1; }
}
/* На мобильном носорог остаётся, но меньше и без облачка (чтобы не переполнять экран) */
@media (max-width: 600px) {
    .mascot { bottom: 8px; right: 8px; gap: 0; }
    .mascot__bubble { display: none; }
    .mascot__img { width: 84px; }
}
@media (prefers-reduced-motion: reduce) {
    .mascot__img, .mascot__bubble { animation: none; }
}

/* Ненавязчивый таймер сессии абитуриента */
.session-timer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    padding: 2px 8px;
    border-radius: var(--radius-pill, 999px);
    background: var(--bg);
}
.session-timer__time { font-weight: 600; }

/* Сообщение по истечении времени */
.session-expired {
    position: fixed; inset: 0; z-index: 1000;
    display: grid; place-items: center;
    background: rgba(11, 13, 18, 0.55);
}
.session-expired[hidden] { display: none; }
.session-expired__box {
    background: var(--card-bg); color: var(--text);
    padding: 24px 32px; border-radius: var(--radius-card, 16px);
    font-size: 18px; font-weight: 600; text-align: center;
    max-width: 90vw; box-shadow: 0 10px 40px rgba(11, 13, 18, 0.25);
}

/* Экран завершения первого этапа */
.stage-complete {
    max-width: 640px;
    margin: 60px auto;
    text-align: center;
    padding: 40px 24px;
}
.stage-complete h1 {
    font-size: 32px;
    margin-bottom: 12px;
    color: var(--brand-red);
}
.stage-complete p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}
.stage-complete .btn { font-size: 16px; padding: 12px 28px; }
.stage-complete__hint {
    margin-top: 20px;
    font-size: 14px !important;
    color: var(--text-secondary);
}

.password-field { position: relative; }
.password-field .form__input { padding-right: 42px; }
.password-toggle {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    width: 32px; height: 32px;
    display: grid; place-items: center;
    background: none; border: 0; cursor: pointer;
    color: var(--text-secondary); border-radius: 8px;
}
.password-toggle:hover { color: var(--text); }
.password-toggle .icon { width: 20px; height: 20px; }
.password-toggle.is-on { color: var(--brand-red); }

.login-links {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}
.login-links a { color: var(--primary); text-decoration: none; }
.login-links a:hover { text-decoration: underline; }

.brand, .brand:hover { display: inline-flex; align-items: center; text-decoration: none; color: var(--text); }
.brand-logo { block-size: 2rem; inline-size: auto; object-fit: contain; display: block; }
@media (max-width: 768px) { .brand-logo { block-size: 1.6rem; } }

.icon {
    display: inline-block; width: 1em; height: 1em; vertical-align: -0.15em;
    fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}
.num { font-variant-numeric: tabular-nums lining-nums; }

.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 20px 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.footer { padding: 36px 0 18px; }
.footer__inner {
    max-width: 1280px; margin: 0 auto; padding: 0 24px;
}
.footer-title {
    font-size: 26px; font-weight: 800; color: var(--text);
    margin: 0 0 22px;
}
.footer-cols {
    display: grid;
    grid-template-columns: 1.8fr 1fr 1fr 1fr;
    gap: 28px;
}
.footer-col__label {
    font-size: 13px; color: var(--text-secondary);
    margin-bottom: 14px;
}

.footer-addr { margin-bottom: 14px; font-size: 13px; line-height: 1.4; }
.footer-addr__name {
    display: flex; align-items: flex-end; gap: 5px;
    color: var(--text); font-weight: 600; margin-bottom: 4px;
}
.footer-addr__line { color: var(--text-secondary); }
.metro {
    width: 18px; height: 10px; flex-shrink: 0;
    color: var(--brand-red);
    margin-bottom: 5px;
}

.footer-phone {
    color: var(--text); text-decoration: none; font-weight: 700; font-size: 17px;
    display: block; margin-bottom: 10px;
}
.footer-phone:hover { color: var(--brand-red); }

.footer-schedule { font-size: 15px; color: var(--text-secondary); margin: 0; }
.footer-schedule .num { color: var(--text); font-weight: 700; }

.footer-apps {
    display: flex; flex-direction: column; gap: 8px; margin-top: 18px;
}
.footer-apps a {
    color: var(--text-secondary); text-decoration: none;
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 14px; transition: color 0.12s ease;
}
.footer-apps a:hover { color: var(--brand-red); }
.footer-apps .icon { font-size: 18px; }

.footer-bottom {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex-wrap: wrap; margin-top: 26px; padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-secondary);
}
.footer-bottom__policy { color: var(--text-secondary); text-decoration: none; }
.footer-bottom__policy:hover { color: var(--text); text-decoration: underline; text-underline-offset: 0.25em; }

@media (max-width: 900px) {
    .footer-cols { grid-template-columns: 1fr 1fr; gap: 24px; }
}
@media (max-width: 560px) {
    .footer-cols { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 768px) {
    .form__row {
        flex-direction: column;
        gap: 0;
    }

    .search-form {
        flex-direction: column;
    }

    .search-form .form__input {
        width: 100%;
    }

    .card__header {
        flex-direction: column;
        align-items: flex-start;
    }
}
