/* Optional account and cross-device history sync. */

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.btn-account {
    min-height: 38px;
    max-width: 210px;
    padding: 0 12px;
    border: 1px solid #c8d6da;
    border-radius: 6px;
    background: #fff;
    color: #29434b;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.btn-account:hover,
.btn-account:focus-visible {
    border-color: #0d7d80;
    color: #0d7074;
    outline: none;
}

.btn-account.authenticated {
    background: #eaf7f7;
    border-color: #9dcfd0;
    color: #086c70;
}

.account-icon {
    width: 20px;
    height: 20px;
    border: 1px solid currentColor;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: 13px;
    line-height: 1;
}

.auth-modal[hidden] {
    display: none;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 2400;
    display: grid;
    place-items: center;
    padding: 20px;
}

.auth-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 34, 40, 0.54);
}

.auth-dialog {
    position: relative;
    width: min(620px, 100%);
    max-height: min(760px, calc(100vh - 40px));
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d7e1e4;
    border-radius: 8px;
    box-shadow: 0 22px 65px rgba(22, 46, 54, 0.24);
}

.auth-header {
    min-height: 82px;
    padding: 19px 24px 17px;
    border-bottom: 1px solid #e2eaec;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.auth-kicker {
    margin: 0 0 4px;
    color: #0d7d80;
    font-size: 11px;
    font-weight: 700;
}

.auth-header h2 {
    margin: 0;
    color: #162b32;
    font-size: 21px;
    line-height: 1.35;
}

.auth-close {
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    color: #62747a;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.auth-close:hover,
.auth-close:focus-visible {
    color: #0b6f73;
    outline: 2px solid #b9dddd;
    outline-offset: 1px;
}

.auth-form,
.auth-profile,
.auth-unavailable {
    padding: 22px 24px 24px;
}

.auth-intro,
.auth-anonymous-note,
.auth-unavailable p {
    margin: 0 0 18px;
    color: #62747a;
    font-size: 14px;
    line-height: 1.65;
}

.auth-field {
    display: block;
    margin-bottom: 16px;
    color: #263f47;
    font-size: 14px;
    font-weight: 650;
}

.auth-field > span:first-child {
    display: block;
    margin-bottom: 7px;
}

.auth-field input {
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid #cbd8dc;
    border-radius: 5px;
    background: #fff;
    color: #182d34;
    font: inherit;
    font-size: 16px;
}

.auth-field input:focus {
    border-color: #0d8588;
    outline: 2px solid rgba(13, 133, 136, 0.14);
}

.auth-field input[aria-invalid="true"] {
    border-color: #c84f4f;
}

.auth-phone-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.auth-code-button,
.auth-primary,
.auth-secondary {
    min-height: 44px;
    border-radius: 5px;
    padding: 9px 15px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.auth-code-button {
    border: 1px solid #0d7d80;
    background: #fff;
    color: #0b7477;
}

.auth-code-button:disabled,
.auth-primary:disabled {
    border-color: #ccd6d9;
    background: #edf1f2;
    color: #8a989d;
    cursor: not-allowed;
}

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

.auth-profile-grid .auth-field:last-child {
    grid-column: 1 / -1;
}

.auth-check {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: start;
    gap: 9px;
    margin: 13px 0;
    color: #40565d;
    font-size: 14px;
    line-height: 1.55;
    cursor: pointer;
}

.auth-check input[type="checkbox"] {
    appearance: auto;
    -webkit-appearance: checkbox;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: #0d7d80;
    opacity: 1;
    visibility: visible;
}

.auth-field-error {
    display: block;
    margin-top: 6px;
    color: #b63636;
    font-size: 12px;
    font-weight: 500;
}

.auth-field-error[hidden] {
    display: none;
}

.auth-consent-error {
    margin: -5px 0 8px 29px;
}

.auth-feedback {
    min-height: 22px;
    margin: 13px 0 8px;
    color: #b63636;
    font-size: 13px;
    line-height: 1.5;
}

.auth-feedback.success {
    color: #087269;
}

.auth-primary {
    width: 100%;
    border: 1px solid #0d7d80;
    background: #0d7d80;
    color: #fff;
}

.auth-primary:hover:not(:disabled),
.auth-primary:focus-visible:not(:disabled) {
    background: #086d70;
    outline: 2px solid rgba(13, 125, 128, 0.2);
    outline-offset: 1px;
}

.auth-secondary {
    border: 1px solid #c9d5d8;
    background: #fff;
    color: #445a61;
}

.auth-anonymous-note {
    margin: 12px 0 0;
    text-align: center;
    font-size: 12px;
}

.auth-unavailable {
    text-align: left;
}

.auth-unavailable strong {
    display: block;
    margin-bottom: 8px;
    color: #273f47;
    font-size: 18px;
}

.auth-account-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e2eaec;
}

.auth-account-summary p {
    margin: 3px 0 0;
    color: #687a80;
}

.auth-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e3f4f4;
    color: #0b777a;
    display: grid;
    place-items: center;
    font-size: 18px;
    font-weight: 800;
}

.auth-profile-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
}

.auth-logout {
    color: #a13d3d;
}

body.auth-modal-open {
    overflow: hidden;
}

@media (max-width: 720px) {
    .btn-account {
        width: 38px;
        padding: 0;
        justify-content: center;
    }

    .btn-account #accountLabel {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .auth-modal {
        align-items: end;
        padding: 0;
    }

    .auth-dialog {
        width: 100%;
        max-height: 92vh;
        border-radius: 8px 8px 0 0;
    }

    .auth-header,
    .auth-form,
    .auth-profile,
    .auth-unavailable {
        padding-left: 18px;
        padding-right: 18px;
    }

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

    .auth-profile-grid .auth-field:last-child {
        grid-column: auto;
    }

    .auth-profile-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 410px) {
    .auth-phone-row {
        grid-template-columns: 1fr;
    }

    .auth-code-button {
        width: 100%;
    }
}
