.bos-auth-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 100050;
    display: flex;
    background: var(--bos-ma-popup-overlay, rgba(0, 0, 0, 0.55));
    backdrop-filter: blur(var(--bos-ma-popup-blur, 0px));
    animation: bos-auth-overlay-in var(--bos-ma-transition, 250ms) ease;
}

.bos-auth-popup-panel {
    max-width: 100%;
    max-height: 90dvh;
    overflow-y: auto;
    background: var(--bos-ma-popup-bg, #ffffff);
    color: var(--bos-ma-text, #111827);
    font-family: var(--bos-ma-font, var(--bos-font-system, var(--bos-font, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif))) !important;
    border: 1px solid var(--bos-ma-border, #e5e7eb);
    border-radius: var(--bos-ma-popup-radius, 16px);
    box-shadow: var(--bos-ma-popup-shadow, 0 20px 60px rgba(0, 0, 0, 0.18));
    padding: var(--bos-ma-popup-padding, 32px);
    position: relative;
    animation-duration: var(--bos-ma-transition, 250ms);
    animation-timing-function: ease;
    animation-fill-mode: both;
    animation-name: bos-auth-panel-up;
}

.bos-auth-popup-panel *,
.bos-auth-popup-panel *::before,
.bos-auth-popup-panel *::after,
.bos-auth-popup-overlay *,
.bos-auth-popup-overlay *::before,
.bos-auth-popup-overlay *::after {
    box-sizing: border-box;
}

.bos-auth-popup-panel button,
.bos-auth-popup-panel a,
.bos-auth-popup-panel input,
.bos-auth-popup-panel select,
.bos-auth-popup-panel textarea {
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
    background-image: none !important;
    font-family: inherit !important;
}

.bos-auth-popup-panel input:focus,
.bos-auth-popup-panel select:focus,
.bos-auth-popup-panel textarea:focus,
.bos-auth-popup-panel button:focus,
.bos-auth-popup-panel a:focus {
    outline: none !important;
    box-shadow: none !important;
}

.bos-auth-popup-panel input:focus,
.bos-auth-popup-panel select:focus,
.bos-auth-popup-panel textarea:focus {
    border-color: var(--bos-ma-primary, #111827) !important;
}

.bos-auth-popup-panel input:focus:not(:focus-visible),
.bos-auth-popup-panel select:focus:not(:focus-visible),
.bos-auth-popup-panel textarea:focus:not(:focus-visible),
.bos-auth-popup-panel button:focus:not(:focus-visible),
.bos-auth-popup-panel a:focus:not(:focus-visible) {
    outline: none !important;
    box-shadow: none !important;
}

.bos-auth-popup-panel input:focus:not(:focus-visible),
.bos-auth-popup-panel select:focus:not(:focus-visible),
.bos-auth-popup-panel textarea:focus:not(:focus-visible) {
    border-color: #d1d5db !important;
}

.bos-auth-popup-panel button:focus-visible,
.bos-auth-popup-panel a:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.bos-auth-close {
    position: absolute;
    top: 16px;
    inset-inline-end: 16px;
    inset-inline-start: auto;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border: none !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: #9ca3af !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
    outline: none !important;
    box-shadow: none !important;
    z-index: 20;
    line-height: 0;
    appearance: none !important;
    -webkit-appearance: none !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 0 !important;
}

.bos-auth-close:hover {
    background: #f3f4f6 !important;
    color: #111827 !important;
}

.bos-auth-close svg {
    display: block !important;
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    pointer-events: none;
}

.bos-auth-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.bos-auth-title {
    margin: 0;
    font-family: var(--bos-ma-font, var(--bos-font-system, var(--bos-font, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif))) !important;
    font-size: var(--bos-ma-popup-title-size, 20px);
    font-weight: var(--bos-ma-popup-title-weight, 700);
    color: var(--bos-ma-text, #111827);
}

.bos-auth-subtitle {
    margin: 0;
    color: var(--bos-ma-muted, #6b7280);
    font-size: var(--bos-ma-font-size-sm, 13px);
}

.bos-auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--bos-ma-border, #e5e7eb);
    margin-bottom: 24px;
    gap: 0;
}

.bos-auth-tabs .bos-auth-tab {
    flex: 1;
    min-height: 44px;
    padding: 10px 8px;
    text-align: center;
    border: none !important;
    background: transparent !important;
    color: #9ca3af;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 2px solid transparent !important;
    transition: color 0.15s ease, border-color 0.15s ease;
    outline: none;
    box-shadow: none !important;
    border-radius: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

.bos-auth-tabs .bos-auth-tab.is-active {
    color: var(--bos-ma-primary, #111827) !important;
    border-bottom-color: var(--bos-ma-primary, #111827) !important;
    background: transparent !important;
}

.bos-auth-tabs .bos-auth-tab:hover,
.bos-auth-tabs .bos-auth-tab:active,
.bos-auth-tabs .bos-auth-tab:focus {
    background: transparent !important;
    box-shadow: none !important;
}

.bos-auth-tabs .bos-auth-tab:hover:not(.is-active) {
    color: #374151;
}

.bos-auth-form {
    display: block;
    width: 100%;
}

.bos-auth-field-group {
    display: block;
    margin: 0 0 18px !important;
}

.bos-auth-popup-panel label:not(.bos-auth-field-group) {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0;
}

.bos-auth-popup-panel .bos-auth-field-group > .bos-ma-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.bos-auth-form > .bos-auth-field-group:last-of-type {
    margin-bottom: 0 !important;
}

.bos-auth-popup-panel input[type="text"],
.bos-auth-popup-panel input[type="email"],
.bos-auth-popup-panel input[type="password"],
.bos-auth-popup-panel input[type="number"],
.bos-auth-popup-panel input[type="tel"] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    height: 44px;
    padding: 0 14px;
    font-size: 15px;
    font-family: inherit;
    color: #111827;
    background: #ffffff !important;
    border: 1px solid #d1d5db !important;
    border-radius: 8px !important;
    transition: border-color 0.15s ease;
    appearance: none !important;
    -webkit-appearance: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.bos-auth-popup-panel input[type="number"]::-webkit-outer-spin-button,
.bos-auth-popup-panel input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.bos-auth-popup-panel input[type="number"] {
    -moz-appearance: textfield;
}

.bos-auth-popup-panel input:-webkit-autofill,
.bos-auth-popup-panel input:-webkit-autofill:hover,
.bos-auth-popup-panel input:-webkit-autofill:focus,
.bos-auth-popup-panel input:-webkit-autofill:active {
    -webkit-text-fill-color: #111827;
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    box-shadow: 0 0 0 1000px #ffffff inset !important;
    background: #ffffff !important;
    transition: background-color 9999s ease-out 0s;
}

.bos-auth-popup-panel input::placeholder {
    color: #9ca3af;
    font-size: 14px;
}

.bos-auth-inline-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.bos-auth-inline-row--start {
    justify-content: flex-start;
}

.bos-auth-password-wrap {
    position: relative;
}

.bos-auth-password-wrap .bos-ma-input {
    padding-inline-end: 46px !important;
}

.bos-auth-password-toggle {
    position: absolute;
    top: 50%;
    inset-inline-end: 12px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #9ca3af !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    outline: none !important;
    box-shadow: none !important;
    appearance: none;
    -webkit-appearance: none;
    z-index: 12;
    min-width: 20px;
    min-height: 20px;
}

.bos-auth-password-toggle:hover {
    color: #374151 !important;
}

.bos-auth-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    font-size: var(--bos-ma-font-size-sm, 13px);
    margin-bottom: 0;
}

.bos-auth-remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    margin-bottom: 4px;
    gap: 12px;
}

.bos-auth-remember-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border: 1px solid #d1d5db !important;
    border-radius: 4px !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    background: #ffffff !important;
    cursor: pointer;
    outline: none;
    box-shadow: none !important;
    margin: 0;
    position: relative;
    flex-shrink: 0;
}

.bos-auth-remember-row input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 1px;
    inset-inline-end: 4px;
    width: 5px;
    height: 9px;
    border-inline-start: 2px solid var(--bos-ma-primary, #111827);
    border-bottom: 2px solid var(--bos-ma-primary, #111827);
    transform: rotate(45deg);
    opacity: 0;
}

.bos-auth-remember-row input[type="checkbox"]:checked {
    border-color: var(--bos-ma-primary, #111827);
    background: #ffffff !important;
}

.bos-auth-remember-row input[type="checkbox"]:checked::after {
    opacity: 1;
}

.bos-auth-link-btn {
    min-height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    color: var(--bos-ma-primary, #111827) !important;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border-radius: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.bos-auth-link-btn:hover,
.bos-auth-link-btn:active,
.bos-auth-link-btn:focus,
.bos-auth-link-btn:focus-visible,
.bos-auth-link-btn:visited {
    background: transparent !important;
    background-color: transparent !important;
    color: var(--bos-ma-primary, #111827) !important;
    outline: none !important;
    box-shadow: none !important;
}

.bos-auth-link-btn:hover {
    text-decoration: underline;
}

.bos-auth-submit-btn {
    display: block;
    width: 100%;
    height: 46px;
    background: var(--bos-ma-btn-bg, var(--bos-ma-primary, #111827)) !important;
    background-color: var(--bos-ma-btn-bg, var(--bos-ma-primary, #111827)) !important;
    background-image: none !important;
    color: var(--bos-ma-btn-text, #ffffff) !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
    outline: none !important;
    box-shadow: none !important;
    margin-top: 20px;
    appearance: none !important;
    -webkit-appearance: none !important;
}

.bos-auth-form > .bos-auth-submit-btn {
    margin-top: 22px !important;
}

.bos-auth-form > .bos-auth-message,
.bos-auth-form > .bos-auth-error {
    margin-bottom: 12px;
}

.bos-auth-form > .bos-auth-remember-row {
    margin-top: 6px;
    margin-bottom: 14px;
}

.bos-auth-submit-btn:hover {
    opacity: 1 !important;
    background: var(--bos-ma-btn-bg, var(--bos-ma-primary, #111827)) !important;
    background-color: var(--bos-ma-btn-bg, var(--bos-ma-primary, #111827)) !important;
    background-image: none !important;
    color: var(--bos-ma-btn-text, #ffffff) !important;
}

.bos-auth-submit-btn:active,
.bos-auth-submit-btn:focus,
.bos-auth-submit-btn:focus-visible,
.bos-auth-submit-btn:focus:not(:focus-visible) {
    opacity: 1 !important;
    background: var(--bos-ma-btn-bg, var(--bos-ma-primary, #111827)) !important;
    background-color: var(--bos-ma-btn-bg, var(--bos-ma-primary, #111827)) !important;
    background-image: none !important;
    color: var(--bos-ma-btn-text, #ffffff) !important;
    outline: none !important;
    box-shadow: none !important;
}

.bos-auth-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bos-auth-message {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--bos-ma-border, #e5e7eb);
    background: #f9fafb;
    color: var(--bos-ma-text, #111827);
    font-size: var(--bos-ma-font-size-sm, 13px);
}

.bos-auth-message.is-error {
    border-color: rgba(220, 38, 38, 0.18);
    background: rgba(220, 38, 38, 0.06);
    color: #991b1b;
}

.bos-auth-message.is-success {
    border-color: rgba(16, 185, 129, 0.22);
    background: rgba(16, 185, 129, 0.08);
    color: #065f46;
}

.bos-auth-error {
    font-size: 13px;
    color: #ef4444;
    margin-top: 6px;
    display: block;
}

.bos-auth-result-card {
    margin-top: 8px;
    padding: 16px;
    border: 1px solid var(--bos-ma-border, #e5e7eb);
    border-radius: 12px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bos-auth-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    color: var(--bos-ma-muted, #6b7280);
    font-size: var(--bos-ma-font-size-sm, 13px);
}

.bos-auth-result-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bos-auth-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bos-auth-result-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    flex-shrink: 0;
}

.bos-auth-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bos-auth-result-main {
    min-width: 0;
    flex: 1;
}

.bos-auth-result-name {
    font-weight: 600;
    color: var(--bos-ma-text, #111827);
}

.bos-auth-result-sub {
    color: var(--bos-ma-muted, #6b7280);
    font-size: var(--bos-ma-font-size-sm, 13px);
}

.bos-auth-strength {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    margin-bottom: 4px;
}

.bos-auth-strength-bar {
    flex: 1;
    height: 4px;
    border-radius: 999px;
    background: var(--bos-ma-border, #e5e7eb);
}

.bos-auth-strength-bar.s1,
.bos-auth-strength-bar.is-active.s1 {
    background: #ef4444;
}

.bos-auth-strength-bar.is-active.s2 {
    background: #f97316;
}

.bos-auth-strength-bar.is-active.s3 {
    background: #eab308;
}

.bos-auth-strength-bar.is-active.s4 {
    background: #22c55e;
}

.bos-auth-strength-label {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-top: 4px;
    margin-bottom: 12px;
}

@keyframes bos-auth-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bos-auth-panel-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bos-auth-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bos-auth-panel-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bos-auth-panel-scale {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.bos-auth-popup-panel[data-popup-animation="fade"] {
    animation-name: bos-auth-panel-fade;
}

.bos-auth-popup-panel[data-popup-animation="scale"] {
    animation-name: bos-auth-panel-scale;
}

.bos-auth-popup-panel[data-popup-animation="slide_up"] {
    animation-name: bos-auth-panel-up;
}

@media (min-width: 768px) {
    .bos-auth-popup-overlay {
        align-items: center;
        justify-content: center;
        padding: 20px;
    }

    .bos-auth-popup-panel {
        width: min(var(--bos-ma-popup-width, 420px), calc(100vw - 40px));
        max-height: 90dvh;
        overflow-y: auto;
        border-radius: var(--bos-ma-popup-radius, 16px);
        padding: calc(var(--bos-ma-popup-padding, 32px) + 8px) var(--bos-ma-popup-padding, 32px) var(--bos-ma-popup-padding, 32px);
        box-shadow: var(--bos-ma-popup-shadow, 0 20px 60px rgba(0, 0, 0, 0.18));
        animation: bos-auth-up 0.25s ease;
    }

    .bos-auth-popup-panel::before {
        content: '';
        display: none;
    }

    .bos-auth-field-group {
        margin-bottom: 18px !important;
    }

    .bos-auth-popup-panel input[type='text'],
    .bos-auth-popup-panel input[type='email'],
    .bos-auth-popup-panel input[type='password'] {
        height: 44px;
        font-size: 15px;
    }

    .bos-auth-submit-btn {
        height: 46px;
        font-size: 15px;
        margin-top: 20px;
    }
}

@media (max-width: 767px) {
    .bos-auth-popup-overlay {
        align-items: center;
        justify-content: center;
        padding: 16px;
    }

    .bos-auth-popup-panel {
        width: min(calc(100vw - 32px), var(--bos-ma-popup-width, 420px));
        max-height: 90dvh;
        padding: 28px 20px 24px;
        border-radius: var(--bos-ma-popup-radius, 16px);
        animation-name: bos-auth-panel-up;
    }

    .bos-auth-popup-panel::before {
        display: none;
    }

    .bos-auth-popup-panel input,
    .bos-auth-popup-panel select,
    .bos-auth-popup-panel textarea {
        font-size: max(16px, var(--bos-ma-input-font-size, 15px));
    }

    .bos-auth-remember-row {
        flex-direction: column;
        align-items: stretch;
        margin-top: 8px;
        margin-bottom: 6px;
    }

    .bos-auth-tab {
        font-size: 13px;
    }

    .bos-auth-field-group {
        margin-bottom: 16px !important;
    }

    .bos-auth-form > .bos-auth-submit-btn {
        margin-top: 20px !important;
    }
}
