.auth-status,
.auth {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.auth-link-button,
.auth-pill-button,
.auth-loading-pill,
.auth-feedback-btn,
.auth-avatar-btn,
.auth-menu-item,
.auth-secondary-action,
.auth-link-card,
.auth-mood-button {
    border: none;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.auth-link-button {
    min-height: 40px;
    padding: 0 2px;
    background: transparent;
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 600;
}

.auth-link-button:hover {
    color: #0071e3;
}

.auth-pill-button,
.auth-feedback-btn,
.auth-secondary-action,
.auth-primary-action-inline {
    min-height: 42px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.92);
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.auth-pill-button:hover,
.auth-feedback-btn:hover,
.auth-secondary-action:hover,
.auth-primary-action-inline:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

.auth-pill-button {
    background: #1d1d1f;
    color: #fff;
    border-color: #1d1d1f;
}

.auth-loading-pill {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.82);
    color: #475569;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.auth-account {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-menu {
    position: relative;
}

.auth-avatar-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.auth-avatar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

.auth-avatar {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    background: #f0f5ff;
    color: #1d4ed8;
    font-size: 16px;
    font-weight: 800;
}

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

.auth-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 188px;
    padding: 10px;
    display: grid;
    gap: 4px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
}

.auth-menu.is-open .auth-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.auth-dropdown-user {
    padding: 10px 12px 12px;
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 800;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    margin-bottom: 4px;
}

.auth-menu-item {
    min-height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    background: transparent;
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 600;
}

.auth-menu-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.auth-menu-item:hover {
    background: #f5f7fb;
}

.auth-menu-item.is-danger {
    color: #1d1d1f;
}

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

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

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(248, 250, 252, 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.auth-dialog {
    position: relative;
    width: min(560px, 100%);
    max-height: min(820px, 88vh);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 22px;
    overflow: hidden;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.16);
    animation: authDialogIn 0.22s ease both;
}

.auth-dialog-main {
    position: relative;
    max-height: min(820px, 88vh);
    padding: 28px;
    overflow-y: auto;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

.auth-login-visual {
    display: none;
}

.auth-modal[data-mode="login"] .auth-dialog,
.auth-modal[data-mode="register"] .auth-dialog {
    width: min(1160px, calc(100vw - 48px));
    min-height: min(760px, calc(100vh - 48px));
    display: grid;
    grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
    border: none;
    border-radius: 0;
    background: #fff;
    box-shadow: 0 32px 90px rgba(15, 23, 42, 0.18);
}

.auth-modal[data-mode="login"] .auth-dialog-main,
.auth-modal[data-mode="register"] .auth-dialog-main {
    max-height: min(760px, calc(100vh - 48px));
    padding: clamp(42px, 7vw, 96px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-modal[data-mode="register"] .auth-dialog-main {
    justify-content: flex-start;
}

.auth-login-visual {
    position: relative;
    min-height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background:
        radial-gradient(circle at 30% 18%, rgba(96, 165, 250, 0.46) 0 0, transparent 28%),
        linear-gradient(145deg, #1e3a8a 0%, #2563eb 46%, #0f172a 100%);
    color: #fff;
}

.auth-modal[data-mode="login"] .auth-login-visual,
.auth-modal[data-mode="register"] .auth-login-visual {
    display: flex;
}

.auth-login-visual::before {
    content: "";
    position: absolute;
    width: 76%;
    aspect-ratio: 1;
    left: 7%;
    top: 24%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    z-index: 1;
}

.auth-login-visual::after {
    content: "";
    position: absolute;
    inset: auto 8% 13% 16%;
    height: 116px;
    border-radius: 30px;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0.24));
    transform: skewX(-11deg);
    pointer-events: none;
    z-index: 1;
}

.auth-login-brand-tile,
.auth-login-preview,
.auth-login-copy {
    position: absolute;
    z-index: 1;
}

.auth-login-brand-tile {
    top: 18%;
    left: 50%;
    width: 96px;
    height: 96px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.22);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
    transform: translateX(-50%);
    z-index: 3;
}

.auth-login-brand-tile img {
    width: 58px;
    height: 58px;
    display: block;
}

.auth-login-preview {
    left: 6%;
    right: 5%;
    top: 28%;
    aspect-ratio: 1.42;
    border-radius: 0;
    display: grid;
    place-items: center;
    overflow: visible;
    background: transparent;
    box-shadow: none;
    opacity: 0.95;
    z-index: 2;
}

.auth-login-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    filter: drop-shadow(0 24px 42px rgba(15, 23, 42, 0.22));
}

.auth-login-copy {
    left: 50%;
    bottom: 8%;
    width: min(320px, 76%);
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: translateX(-50%);
    text-align: center;
    z-index: 3;
}

.auth-login-copy strong {
    display: block;
    color: #fff;
    font-size: clamp(34px, 4vw, 48px);
    line-height: 1.16;
    font-weight: 900;
    text-shadow: 0 12px 32px rgba(15, 23, 42, 0.34);
}

.auth-login-copy span {
    display: block;
    margin-top: 14px;
    color: rgba(255, 255, 255, 0.74);
    font-size: 14px;
    line-height: 1.7;
    font-weight: 700;
}

.auth-dialog-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    font-size: 26px;
    line-height: 1;
    transform: rotate(45deg);
}

.auth-dialog-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.auth-dialog-head {
    padding-right: 32px;
}

.auth-dialog-kicker {
    margin-bottom: 8px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-dialog h2 {
    margin: 0;
    color: #0f172a;
    font-size: 32px;
    line-height: 1.1;
}

.auth-dialog-head p:last-child {
    margin-top: 10px;
    color: #667085;
    line-height: 1.65;
}

.auth-message {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #fff2f2;
    color: #b42318;
    font-size: 14px;
    line-height: 1.6;
}

.auth-message[data-tone="success"] {
    background: #ecfdf3;
    color: #027a48;
}

.auth-dialog-body {
    margin-top: 22px;
}

.auth-mode-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.auth-mode-tabs button {
    min-height: 56px;
    border: none;
    border-radius: 14px;
    background: #fff;
    color: #4b5563;
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    font-weight: 800;
}

.auth-mode-tabs button:hover,
.auth-mode-tabs button.is-active {
    background: #eef5ff;
    color: #0071e3;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-form label,
.auth-feedback-field {
    display: grid;
    gap: 8px;
    color: #344054;
    font-size: 14px;
    font-weight: 700;
}

.auth-form input,
.auth-form textarea,
.auth-feedback-field textarea {
    width: 100%;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 16px;
    padding: 14px 15px;
    background: #fff;
    color: #0f172a;
    font: inherit;
    outline: none;
}

.auth-form input {
    min-height: 48px;
}

.auth-form textarea,
.auth-feedback-field textarea {
    resize: vertical;
    min-height: 136px;
}

.auth-form input:focus,
.auth-form textarea:focus,
.auth-feedback-field textarea:focus {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

.auth-primary-action {
    width: 100%;
    min-height: 48px;
    border: none;
    border-radius: 14px;
    background: #111827;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
}

.auth-modal[data-mode="login"] .auth-primary-action,
.auth-modal[data-mode="register"] .auth-primary-action {
    min-height: 58px;
    border-radius: 14px;
    background: linear-gradient(180deg, #2f72ff 0%, #1f5eea 100%);
    box-shadow: 0 18px 42px rgba(37, 99, 235, 0.24);
}

.auth-primary-link,
.auth-secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
}

.auth-primary-action:disabled,
.auth-secondary-action:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.auth-primary-action-inline {
    width: auto;
    min-width: 116px;
    background: linear-gradient(180deg, #2f72ff 0%, #1f5eea 100%);
    border: none;
    color: #fff;
}

.auth-switch {
    margin: 0;
    text-align: center;
    color: #667085;
    font-size: 14px;
}

.auth-switch button {
    border: none;
    background: transparent;
    color: #1d4ed8;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.auth-form-compact {
    margin-top: 18px;
}

.auth-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.auth-profile-shell {
    display: grid;
    gap: 20px;
}

.auth-profile-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(240, 249, 255, 0.9) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.auth-profile-avatar-shell {
    width: 72px;
    height: 72px;
    font-size: 24px;
}

.auth-profile-copy {
    min-width: 0;
}

.auth-profile-copy strong {
    display: block;
    color: #0f172a;
    font-size: 22px;
    line-height: 1.2;
}

.auth-profile-copy p {
    margin-top: 6px;
    color: #667085;
    line-height: 1.6;
}

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

.auth-profile-meta-item {
    padding: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: #f8fafc;
}

.auth-profile-meta-item span {
    display: block;
    color: #64748b;
    font-size: 13px;
}

.auth-profile-meta-item strong {
    display: block;
    margin-top: 8px;
    color: #0f172a;
    font-size: 16px;
    line-height: 1.45;
}

.auth-purchase-dialog {
    width: min(520px, 100%);
    max-height: min(820px, 88vh);
    padding: 28px;
    overflow-y: auto;
}

.auth-purchase-actions {
    margin-top: 24px;
    display: grid;
    gap: 12px;
}

.auth-orders-empty,
.auth-order-item {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: #f8fafc;
}

.auth-orders-empty {
    padding: 18px;
    color: #64748b;
    line-height: 1.7;
}

.auth-orders-list {
    display: grid;
    gap: 12px;
}

.auth-order-item {
    padding: 16px;
}

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

.auth-order-head strong {
    color: #0f172a;
    font-size: 16px;
}

.auth-order-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #fff7ed;
    color: #c2410c;
    font-size: 12px;
    font-weight: 800;
}

.auth-order-status[data-status="paid"] {
    background: #ecfdf3;
    color: #027a48;
}

.auth-order-status[data-status="cancelled"] {
    background: #f1f5f9;
    color: #64748b;
}

.auth-order-meta {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.auth-order-meta div {
    min-width: 0;
}

.auth-order-meta dt {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.auth-order-meta dd {
    margin-top: 5px;
    color: #0f172a;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.auth-feedback-form {
    display: grid;
    gap: 18px;
}

.auth-feedback-field {
    position: relative;
}

.auth-feedback-count {
    justify-self: end;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
}

.auth-feedback-tip {
    color: #667085;
    font-size: 14px;
    line-height: 1.6;
}

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

.auth-mood-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-mood-button {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #fff;
    color: #1f2937;
    font-size: 20px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.auth-mood-button:hover,
.auth-mood-button.is-selected {
    border-color: #1d4ed8;
    background: #eff6ff;
    color: #1d4ed8;
}

.auth-feedback-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding-top: 18px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.auth-link-card {
    min-height: 56px;
    padding: 0 18px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    color: #1d1d1f;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.auth-link-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.1);
}

.auth-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 1200;
    max-width: min(420px, calc(100vw - 32px));
    padding: 13px 18px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
    transform: translate(-50%, 16px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.auth-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.auth-toast[data-tone="warning"] {
    background: rgba(180, 83, 9, 0.95);
}

.auth-toast[data-tone="error"] {
    background: rgba(180, 35, 24, 0.95);
}

.auth-toast[data-tone="success"] {
    background: rgba(2, 122, 72, 0.95);
}

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

@keyframes authDialogIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 900px) {
    .topbar-actions {
        gap: 12px;
    }

    .auth-account {
        gap: 10px;
    }

    .auth-feedback-btn {
        padding: 0 14px;
    }
}

@media (max-width: 700px) {
    .auth-status,
    .auth {
        width: fit-content;
        justify-content: flex-start;
    }

    .auth-dialog {
        width: min(100%, 560px);
        max-height: calc(100vh - 180px);
        border-radius: 20px;
    }

    .auth-dialog-main,
    .auth-purchase-dialog {
        padding: 22px;
    }

    .auth-modal[data-mode="login"] .auth-dialog,
    .auth-modal[data-mode="register"] .auth-dialog {
        width: min(100%, 560px);
        min-height: auto;
        max-height: calc(100vh - 48px);
        grid-template-columns: 1fr;
        border-radius: 22px;
    }

    .auth-modal[data-mode="login"] .auth-dialog-main,
    .auth-modal[data-mode="register"] .auth-dialog-main {
        max-height: calc(100vh - 48px);
        padding: 28px 22px;
    }

    .auth-modal[data-mode="login"] .auth-login-visual,
    .auth-modal[data-mode="register"] .auth-login-visual {
        display: none;
    }

    .auth-dialog h2 {
        font-size: 28px;
    }

    .auth-feedback-row,
    .auth-form-actions {
        justify-content: stretch;
    }

    .auth-form-actions > button,
    .auth-feedback-row .auth-form-actions {
        width: 100%;
    }

    .auth-secondary-action,
    .auth-primary-action-inline {
        flex: 1;
    }

    .auth-profile-meta,
    .auth-feedback-links,
    .auth-order-meta {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .auth-account {
        width: 100%;
        justify-content: flex-end;
    }

    .auth-mood-group {
        width: 100%;
        justify-content: flex-start;
    }

    .auth-mood-button {
        width: 52px;
        height: 52px;
    }

    .auth-dropdown {
        right: 0;
        min-width: 170px;
    }
}
