/* ==========================================================================
   Company auth — реєстрація, вхід, відновлення пароля, кабінет
   ТЗ п.5, п.17.1, п.17.2
   ========================================================================== */

.auth-page {
    max-width: 1160px;
    margin: 0 auto;
    padding: 48px 20px 72px;
}

.auth-card {
    display: grid;
    grid-template-columns: 1fr;
    max-width: 560px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid rgba(17, 24, 39, .08);
    border-radius: 20px;
    box-shadow: 0 10px 34px rgba(17, 24, 39, .06);
    overflow: hidden;
}

.auth-card--wide {
    max-width: 1040px;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
}

.auth-main {
    padding: 40px;
    min-width: 0;
}

/* ---------- Заголовки ---------- */

.auth-title {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.25;
    font-weight: 700;
    color: #111827;
}

.auth-subtitle {
    margin: 0 0 28px;
    font-size: 15px;
    line-height: 1.6;
    color: #6b7280;
}

.auth-legend {
    margin: 28px 0 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #9ca3af;
}

.auth-legend:first-of-type {
    margin-top: 0;
}

/* ---------- Форма ---------- */

.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
    min-width: 0;
}

.auth-field label {
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.auth-req {
    color: #dc2626;
}

.auth-opt {
    font-weight: 400;
    color: #9ca3af;
}

.auth-field input,
.auth-select-wrap select {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 15px;
    color: #111827;
    background: #fff;
    border: 1px solid rgba(17, 24, 39, .16);
    border-radius: 10px;
    transition: border-color .15s ease, box-shadow .15s ease;
    appearance: none;
}

.auth-field input:focus,
.auth-select-wrap select:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, .08);
}

.auth-field input[aria-invalid="true"],
.auth-select-wrap select[aria-invalid="true"] {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .08);
}

.auth-field input::placeholder {
    color: #b6bcc7;
}

.auth-select-wrap {
    position: relative;
}

.auth-select-wrap select {
    padding-right: 40px;
    cursor: pointer;
}

.auth-select-wrap svg {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    pointer-events: none;
    color: #6b7280;
}

/* ---------- Список із пошуком (js/searchable-select.js) ---------- */

.ss-wrap .ss-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.ss-trigger {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 40px 12px 14px;
    font-family: inherit;
    font-size: 15px;
    line-height: normal;
    text-align: left;
    color: #111827;
    background: #fff;
    border: 1px solid rgba(17, 24, 39, .16);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.ss-trigger:focus-visible,
.ss-wrap.is-open .ss-trigger {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, .08);
}

.ss-trigger.is-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .08);
}

.ss-trigger.is-placeholder .ss-value {
    color: #9ca3af;
}

.ss-value {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ss-wrap.is-open svg {
    transform: translateY(-50%) rotate(180deg);
}

.ss-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 50;
    padding: 8px;
    background: #fff;
    border: 1px solid rgba(17, 24, 39, .12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(17, 24, 39, .12);
}

.ss-panel[hidden] {
    display: none;
}

.auth-field .ss-search {
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 8px;
}

.ss-list {
    max-height: 240px;
    margin: 6px 0 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.ss-option {
    padding: 9px 12px;
    font-size: 14px;
    color: #111827;
    border-radius: 6px;
    cursor: pointer;
}

.ss-option.is-active {
    background: #f3f4f6;
}

.ss-option[aria-selected="true"] {
    font-weight: 600;
}

.ss-empty {
    padding: 10px 12px;
    font-size: 14px;
    color: #9ca3af;
}

.auth-hint {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: #9ca3af;
}

/* ---------- Чекбокси і згоди ---------- */

.auth-consents {
    margin: 20px 0 4px;
    padding: 18px;
    background: #f9fafb;
    border: 1px solid rgba(17, 24, 39, .06);
    border-radius: 12px;
}

.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    line-height: 1.55;
    color: #374151;
    cursor: pointer;
}

.auth-check + .auth-check {
    margin-top: 14px;
}

.auth-check input[type="checkbox"] {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin: 1px 0 0;
    accent-color: #111827;
    cursor: pointer;
}

.auth-check a {
    color: #111827;
    text-decoration: underline;
}

.auth-check-note {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    font-style: normal;
    color: #9ca3af;
}

.auth-check--inline {
    margin: 0;
    font-size: 13px;
}

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 4px 0 8px;
    flex-wrap: wrap;
}

/* ---------- Дії ---------- */

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

.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 26px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.auth-alt {
    margin: 16px 0 0;
    font-size: 14px;
    color: #6b7280;
}

.auth-alt a,
.auth-link {
    color: #111827;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(17, 24, 39, .25);
}

.auth-alt a:hover,
.auth-link:hover {
    border-bottom-color: #111827;
}

.auth-link--button {
    padding: 0;
    font-family: inherit;
    font-size: 14px;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(17, 24, 39, .25);
    cursor: pointer;
}

.auth-logout {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid rgba(17, 24, 39, .08);
}

/* ---------- Повідомлення ---------- */

.auth-alert {
    margin-bottom: 22px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.55;
    border-radius: 12px;
}

.auth-alert ul {
    margin: 6px 0 0;
    padding-left: 20px;
}

.auth-alert li + li {
    margin-top: 4px;
}

.auth-alert-title {
    margin: 0;
    font-weight: 600;
}

.auth-alert--error {
    color: #b91c1c;
    background: rgba(239, 68, 68, .07);
    border: 1px solid rgba(239, 68, 68, .22);
}

.auth-alert--ok {
    color: #15803d;
    background: rgba(34, 197, 94, .08);
    border: 1px solid rgba(34, 197, 94, .22);
}

.auth-alert--info {
    color: #1e40af;
    background: rgba(59, 130, 246, .07);
    border: 1px solid rgba(59, 130, 246, .22);
}

/* ---------- Профіль компанії (ТЗ п.5.2) ---------- */

/* Мультивибір країн: нативний select, без JS-залежностей (рішення D2). */
.auth-multiselect {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    font-family: inherit;
    font-size: 15px;
    color: #111827;
    background: #fff;
    border: 1px solid rgba(17, 24, 39, .16);
    border-radius: 10px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-multiselect:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, .08);
}

.auth-multiselect[aria-invalid="true"] {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .08);
}

.auth-multiselect option {
    padding: 4px 6px;
    border-radius: 4px;
}

/* Email у профілі — тільки для читання: це логін. */
.auth-field input:disabled {
    color: #6b7280;
    background: #f3f4f6;
    cursor: not-allowed;
}

.auth-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    color: #111827;
    background: #fff;
    border: 1px solid rgba(17, 24, 39, .16);
    border-radius: 10px;
    resize: vertical;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-field textarea:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, .08);
}

.auth-field textarea[aria-invalid="true"] {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .08);
}

/* ---------- Права колонка ---------- */

.auth-aside {
    padding: 40px 32px;
    background: #0f172a;
    color: #e5e7eb;
}

.auth-aside-title {
    margin: 0 0 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #93a1b8;
}

.auth-steps {
    margin: 0 0 28px;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.6;
}

.auth-steps li + li {
    margin-top: 10px;
}

.auth-disclaimer {
    padding: 16px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 12px;
}

.auth-disclaimer-title {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #fbbf24;
}

.auth-disclaimer p {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.6;
    color: #b9c2d0;
}

/* ---------- Кабінет ---------- */

.auth-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin: 0 0 28px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
}

.auth-summary dt {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #9ca3af;
}

.auth-summary dd {
    margin: 4px 0 0;
    font-size: 15px;
    color: #111827;
}

.auth-placeholder {
    padding: 28px;
    text-align: center;
    background: #f9fafb;
    border: 1px dashed rgba(17, 24, 39, .16);
    border-radius: 14px;
}

.auth-placeholder-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.auth-placeholder p {
    margin: 0 0 18px;
    font-size: 14px;
    color: #6b7280;
}

/* ---------- Адаптив ---------- */

@media (max-width: 900px) {
    .auth-card--wide {
        grid-template-columns: 1fr;
    }

    .auth-aside {
        order: 2;
    }
}

@media (max-width: 560px) {
    .auth-page {
        padding: 28px 14px 48px;
    }

    .auth-main {
        padding: 28px 22px;
    }

    .auth-aside {
        padding: 28px 22px;
    }

    .auth-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .auth-title {
        font-size: 23px;
    }

    .auth-submit {
        width: 100%;
    }
}
