:root {
    --red: #b40014;
    --red-dark: #86000f;
    --ink: #15171c;
    --muted: #68707c;
    --line: #dde2ea;
    --soft: #f5f7fa;
    --green: #17803a;
    --white: #fff;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    color: var(--ink);
    background: #f1f3f6;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}

a {
    color: inherit;
}

.top {
    background: linear-gradient(135deg, #101217 0%, #242830 58%, var(--red-dark) 100%);
    color: var(--white);
    border-bottom: 5px solid var(--red);
}

.top-inner,
.wrap {
    width: min(1120px, calc(100% - 28px));
    margin: 0 auto;
}

.top-inner {
    padding: 28px 0 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    font-weight: 800;
    font-size: 30px;
    letter-spacing: 0;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    background: var(--red);
    border-radius: 6px;
    font-weight: 900;
}

h1 {
    max-width: 760px;
    margin: 0 0 12px;
    font-size: clamp(30px, 5vw, 56px);
    line-height: 1.02;
    letter-spacing: 0;
    text-transform: uppercase;
}

.lead {
    max-width: 740px;
    margin: 0;
    color: #eef1f5;
    font-size: 18px;
}

.facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 22px;
}

.fact {
    min-height: 94px;
    padding: 14px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 8px;
}

.fact strong {
    display: block;
    color: #fff;
    font-size: 24px;
    line-height: 1.1;
}

.fact span {
    display: block;
    margin-top: 6px;
    color: #e5e9f0;
    font-size: 14px;
}

.wrap {
    padding: 24px 0 46px;
}

.notice {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--red);
    background: #fff;
    border-radius: 8px;
}

.notice.success {
    border-left-color: var(--green);
}

.notice.error {
    border-left-color: var(--red);
}

.notice ul {
    margin: 8px 0 0 20px;
    padding: 0;
}

.autosave-alert {
    padding: 12px 14px;
    border: 1px solid #f0a9b2;
    border-left: 5px solid var(--red);
    border-radius: 8px;
    background: #fff5f6;
    color: var(--red);
    font-size: 14px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.client-errors[hidden] {
    display: none;
}

.page-form form,
.admin-login form {
    display: grid;
    gap: 16px;
}

.section,
.resume-panel,
.list-panel,
.stat,
.admin-login {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.section {
    padding: 18px;
}

.wizard-ready .form-step {
    display: none;
}

.wizard-ready .form-step.is-active {
    display: block;
}

.wizard-nav {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.wizard-nav .btn {
    min-width: 150px;
}

.section h2 {
    margin: 0 0 14px;
    font-size: 22px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field {
    display: grid;
    gap: 7px;
}

.field.full {
    grid-column: 1 / -1;
}

label,
.label {
    font-weight: 700;
}

.hint,
.muted {
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="search"],
textarea,
select,
.file-input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #cbd3df;
    border-radius: 6px;
    color: var(--ink);
    background: #fff;
    font: inherit;
}

.file-input {
    padding: 9px;
}

.photo-cache {
    display: inline-grid;
    grid-template-columns: 56px minmax(0, 180px) auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    background: #f8fafc;
    max-width: 100%;
}

.photo-cache img {
    width: 56px !important;
    height: 56px !important;
    max-width: 56px !important;
    max-height: 56px !important;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #cbd3df;
    background: #fff;
}

.photo-cache strong,
.photo-cache span {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
}

.photo-cache span,
.photo-cache div span {
    display: none;
}

.mini-btn {
    min-height: 34px;
    padding: 7px 10px;
    background: #252b34;
    font-size: 13px;
    width: max-content !important;
    min-width: 0;
    max-width: max-content;
    justify-self: start;
    white-space: nowrap;
}

textarea {
    min-height: 98px;
    resize: vertical;
}

.choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.choice {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    min-height: 46px;
    padding: 10px;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    background: var(--soft);
    font-weight: 600;
}

.choice input {
    margin-top: 3px;
    flex: 0 0 auto;
}

.choice span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.field.has-error input,
.field.has-error textarea,
.field.has-error select,
.privacy.has-error,
.choices.has-error .choice {
    border-color: var(--red);
    background: #fff5f6;
}

.field.has-error label,
.field.has-error .label,
.privacy.has-error {
    color: var(--red);
}

.field-error-message {
    display: grid;
    gap: 3px;
    margin-top: 2px;
    padding: 10px 12px;
    border: 1px solid #f0a9b2;
    border-left: 4px solid var(--red);
    border-radius: 8px;
    background: #fff5f6;
    color: var(--red);
    font-size: 14px;
}

.field-error-message strong {
    font-size: 15px;
}

.field-error-message span {
    color: #7a0010;
}

.process {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.step {
    padding: 12px;
    border-radius: 8px;
    background: #fff7f8;
    border: 1px solid #f0c7cd;
    font-size: 14px;
    font-weight: 700;
}

.step b {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-right: 5px;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
}

.submit-row {
    display: grid;
    gap: 12px;
}

.submit-consent {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
}

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    background: var(--red);
    color: #fff;
    padding: 11px 16px;
    font-weight: 800;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover,
button:hover {
    background: var(--red-dark);
}

.btn:disabled,
button:disabled {
    background: #9aa3af;
    cursor: wait;
    opacity: 0.8;
}

.btn.secondary,
button.secondary {
    background: #252b34;
}

.privacy {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    color: #333943;
    font-weight: 600;
}

.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.admin-shell {
    width: min(1380px, calc(100% - 24px));
    margin: 0 auto;
    padding: 22px 0 42px;
}

.admin-login {
    width: min(420px, calc(100% - 24px));
    margin: 90px auto;
    padding: 22px;
}

.admin-login h1,
.admin-title h1 {
    margin: 0 0 8px;
    font-size: 30px;
    text-transform: none;
}

.admin-topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.inline-form {
    margin: 0;
}

.result-ready {
    margin-top: 8px;
}

.spacer-sm {
    height: 10px;
}

.mt-12 {
    margin-top: 12px;
}

.error {
    margin: 10px 0;
    color: var(--red);
    font-weight: 700;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.stat {
    padding: 14px;
}

.stat strong {
    display: block;
    font-size: 28px;
    line-height: 1;
}

.stat span {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
}

.admin-layout {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.list-panel {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    overflow: auto;
    padding: 12px;
}

.list-panel h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

.candidate-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.candidate-card {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
}

.candidate-card.active {
    border-color: var(--red);
    box-shadow: 0 0 0 2px rgba(180, 0, 20, .08);
}

.candidate-card:hover {
    background: #fff8f9;
}

.candidate-card strong,
.candidate-card span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.candidate-thumb,
.resume-photo,
.avatar-placeholder {
    background: #edf1f6;
    border: 1px solid #d5dde8;
}

.candidate-thumb,
.avatar-placeholder.small {
    width: 56px;
    height: 56px;
    border-radius: 8px;
}

.candidate-thumb,
.resume-photo {
    object-fit: cover;
}

.avatar-placeholder {
    display: grid;
    place-items: center;
    color: var(--red);
    font-weight: 900;
}

.resume-panel {
    overflow: hidden;
}

.resume-head {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    gap: 18px;
    padding: 18px;
    background: linear-gradient(135deg, #fff 0%, #f6f8fb 62%, #fff2f4 100%);
    border-bottom: 1px solid var(--line);
}

.resume-photo,
.avatar-placeholder.large {
    width: 168px;
    height: 208px;
    border-radius: 8px;
}

.avatar-placeholder.large {
    font-size: 48px;
}

.resume-name {
    margin: 0 0 8px;
    font-size: clamp(26px, 4vw, 42px);
    line-height: 1.05;
    text-transform: none;
}

.resume-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.resume-meta span,
.tag {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    max-width: 100%;
    padding: 5px 8px;
    border-radius: 999px;
    background: #eef2f7;
    border: 1px solid #d7dee9;
    font-size: 13px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.status-complete {
    background: #e9f8ee;
    color: #13652f;
}

.status-partial {
    background: #e9f8ee;
    color: #13652f;
}

.missing-list {
    margin: 8px 0 0 18px;
    padding: 0;
    color: var(--muted);
}

.resume-body {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.resume-section {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.resume-section h3 {
    margin: 0 0 10px;
    font-size: 18px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.info-item {
    min-width: 0;
}

.info-item dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.info-item dd {
    margin: 3px 0 0;
    overflow-wrap: anywhere;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.text-block {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.empty-state {
    padding: 26px;
    text-align: center;
    color: var(--muted);
}

@media (max-width: 960px) {
    .facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .admin-layout {
        grid-template-columns: 1fr;
    }
    .list-panel {
        position: static;
        max-height: none;
    }
}

@media (max-width: 720px) {
    .top-inner,
    .wrap,
    .admin-shell {
        width: min(100% - 18px, 1120px);
    }
    .top-inner {
        padding: 20px 0 18px;
    }
    .brand {
        font-size: 25px;
        margin-bottom: 14px;
    }
    .brand-mark {
        width: 36px;
        height: 36px;
    }
    h1 {
        font-size: 33px;
    }
    .lead {
        font-size: 16px;
    }
    .grid,
    .choices,
    .process,
    .stats,
    .info-grid {
        grid-template-columns: 1fr;
    }
    .section {
        padding: 14px;
    }
    .fact {
        min-height: auto;
    }
    .submit-row,
    .admin-topbar,
    .admin-actions,
    .wizard-nav {
        align-items: stretch;
        flex-direction: column;
    }
    .btn,
    button {
        width: 100%;
    }
    .resume-head {
        grid-template-columns: 1fr;
    }
    .resume-photo,
    .avatar-placeholder.large {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 5;
        max-height: 420px;
    }
}

@media (max-width: 430px) {
    h1 {
        font-size: 30px;
    }
    .photo-cache {
        grid-template-columns: 48px minmax(0, 1fr);
        width: 100%;
    }
    .photo-cache img {
        width: 48px !important;
        height: 48px !important;
        max-width: 48px !important;
        max-height: 48px !important;
    }
    .candidate-card {
        grid-template-columns: 48px minmax(0, 1fr);
    }
    .candidate-thumb,
    .avatar-placeholder.small {
        width: 48px;
        height: 48px;
    }
}
