/* ============================================
   AI Amazon Image Generator 鈥?Design System
   ============================================ */

:root {
    /* Background */
    --bg-root: #fafbfe;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #f8fafc;
    --bg-overlay: rgba(15, 23, 42, 0.45);

    /* Accent - Premium Brand Blue Palette */
    --accent: #0f172a;
    --accent-light: #334155;
    --accent-dark: #000000;
    --accent-glow: rgba(15, 23, 42, 0.05);
    --accent-gradient: #0f172a;
    --accent-gradient-hover: #1e293b;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-accent: #0f172a;

    /* Borders */
    --border: rgba(15, 23, 42, 0.08);
    --border-hover: rgba(15, 23, 42, 0.15);
    --border-active: #0f172a;

    /* Status */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Misc */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-card: 0 4px 12px rgba(15, 23, 42, 0.03), 0 1px 3px rgba(15, 23, 42, 0.02);
    --shadow-glow: 0 2px 8px rgba(15, 23, 42, 0.06);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    --panel-width: 420px;
    --header-height: 64px;
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-root);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.08);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.16);
}

/* ============================================
   Header
   ============================================ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.08));
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-credit-widget {
    display: none;
}

.account-cluster {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

.account-cluster .membership-header-btn,
.account-cluster #loginBtn,
.account-cluster .user-profile {
    min-height: 36px;
}

.account-cluster .membership-header-btn {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    border-right: 0;
}

.account-cluster #loginBtn,
.account-cluster .user-profile {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.btn-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}
.btn-header:hover {
    background: var(--bg-card);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* ============================================
   Main Layout
   ============================================ */
.app-body {
    display: flex;
    height: calc(100vh - var(--header-height));
}

.main {
    display: flex;
    flex: 1;
    min-width: 0;
}

/* ============================================
   Sidebar Navigation
   ============================================ */
.sidebar {
    width: 72px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 4px;
    overflow-y: auto;
}

.sidebar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 60px;
    padding: 10px 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-muted);
    position: relative;
}
.sidebar-item:hover {
    color: var(--text-secondary);
    background: rgba(15, 23, 42, 0.03);
}
.sidebar-item.active {
    color: var(--accent-light);
    background: var(--accent-glow);
}
.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent-gradient);
}

.sidebar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.sidebar-item.active .sidebar-icon {
    filter: none;
}

.sidebar-item span {
    font-size: 0.65rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

/* ============================================
   Left Panel
   ============================================ */
.panel-left {
    width: var(--panel-width);
    flex-shrink: 0;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.section {
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition);
}
.section:hover {
    border-color: var(--border-hover);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.section-title h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.tooltip-trigger {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    cursor: help;
    position: relative;
}
.tooltip-trigger:hover {
    color: var(--text-secondary);
}

/* ============================================
   Upload Area
   ============================================ */
.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 20px;
    border: 2px dashed rgba(15, 23, 42, 0.12);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.02);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}
.upload-area:hover {
    border-color: var(--accent);
    background: rgba(79, 70, 229, 0.04);
}
.upload-area.drag-over {
    border-color: var(--accent-light);
    background: rgba(79, 70, 229, 0.08);
    transform: scale(1.01);
}

.upload-icon {
    color: var(--text-muted);
    margin-bottom: 10px;
    transition: var(--transition);
}
.upload-area:hover .upload-icon {
    color: var(--accent);
    transform: translateY(-2px);
}

.upload-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.upload-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}
.upload-preview:empty {
    margin-top: 0;
}

.preview-item {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    animation: fadeInScale 0.3s ease;
    cursor: zoom-in;
}
.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
}
.preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    border: none;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}
.preview-item:hover .preview-remove {
    opacity: 1;
}

/* Apparel model reference */
.model-reference-section[hidden] {
    display: none;
}
.template-reference-section[hidden],
#moduleSelectionSection[hidden] {
    display: none;
}
.model-reference-section .model-source-tabs,
.model-reference-section #modelAiPanel {
    display: none !important;
}
.model-source-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.03);
}
.model-source-tab {
    min-height: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.model-source-tab:hover {
    color: var(--text-secondary);
}
.model-source-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}
.model-source-panel[hidden] {
    display: none;
}
.model-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 132px;
    padding: 18px 14px;
    border: 1.5px dashed rgba(15, 23, 42, 0.16);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.02);
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
}
.model-upload-area:hover,
.model-upload-area.drag-over {
    border-color: var(--accent);
    background: rgba(79, 70, 229, 0.05);
}
.model-upload-area .upload-icon {
    margin-bottom: 6px;
}
.model-upload-area .upload-text {
    font-size: 0.82rem;
}
.model-upload-area .upload-hint {
    font-size: 0.7rem;
}
.model-reference-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}
.model-reference-preview:empty {
    display: none;
}
.model-reference-card {
    position: relative;
    width: 78px;
    height: 96px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    cursor: zoom-in;
}
.model-reference-card img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    cursor: zoom-in;
}
.model-reference-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}
.model-reference-meta {
    min-width: 0;
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.5;
}
.model-reference-meta strong {
    display: block;
    margin-bottom: 2px;
    color: var(--text-primary);
    font-size: 0.78rem;
}
.model-generate-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: 36px;
    margin-top: 10px;
    border: 1px solid rgba(0, 102, 204, 0.16);
    border-radius: var(--radius-sm);
    background: rgba(0, 102, 204, 0.06);
    color: var(--accent);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.model-generate-button:hover {
    border-color: var(--accent);
    background: rgba(0, 102, 204, 0.1);
}
.model-generate-button:disabled {
    opacity: 0.6;
    cursor: wait;
}
.model-reference-status {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.45;
}
.preview-remove:hover {
    background: var(--error);
}

/* Product-kit showcase for the empty results state. */
.kit-showcase {
    grid-column: 1 / -1;
    width: min(1080px, 100%);
    margin: 0 auto;
    padding: 30px 20px 42px;
}
.kit-showcase-heading {
    margin: 4px auto 26px;
    text-align: center;
}
.kit-showcase-heading h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: clamp(1.6rem, 3vw, 2.35rem);
    font-weight: 800;
    letter-spacing: -0.025em;
}
.kit-showcase-heading p {
    margin: 10px 0 0;
    color: var(--text-secondary);
    font-size: 0.98rem;
    line-height: 1.6;
}
.kit-showcase-heading em {
    color: #2563eb;
    font-style: normal;
}
.kit-showcase-board {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) 48px minmax(300px, 0.95fr);
    align-items: center;
    gap: 14px;
    padding: 26px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}
.kit-main-tile,
.kit-side-tile {
    position: relative;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}
.kit-main-tile {
    min-height: 430px;
}
.kit-showcase-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    transition: transform 0.25s ease;
}
.kit-showcase-image:hover {
    transform: scale(1.025);
}
.kit-main-tile .kit-showcase-image {
    position: absolute;
    inset: 0;
    object-fit: contain;
    padding: 34px 46px 26px;
    background: var(--bg-card);
}
.kit-tile-label {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 1;
    padding: 7px 12px;
    color: #334155;
    background: rgba(248, 250, 252, 0.94);
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 650;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}
.kit-tile-caption {
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 1;
    padding: 5px 9px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.7rem;
}
.kit-flow-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 40px;
    color: #64748b;
}
.kit-flow-arrow span {
    position: relative;
    display: block;
    width: 32px;
    height: 2px;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.2), #64748b 72%);
    border-radius: 1px;
}
.kit-flow-arrow span::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 9px;
    height: 9px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: translateY(-50%) rotate(45deg);
    transform-origin: center;
}
.kit-side-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.kit-side-tile {
    aspect-ratio: 1 / 1;
}
.kit-side-tile .kit-showcase-image {
    opacity: 0.94;
}
.kit-side-tile:nth-child(1) .kit-showcase-image {
    object-position: 48% 30%;
}
.kit-side-tile:nth-child(2) .kit-showcase-image {
    object-position: 65% 38%;
}
.kit-side-tile:nth-child(3) .kit-showcase-image {
    object-position: 38% 65%;
}
.kit-side-tile:nth-child(4) .kit-showcase-image {
    object-position: 70% 72%;
}
@media (max-width: 900px) {
    .kit-showcase {
        padding-left: 0;
        padding-right: 0;
    }
    .kit-showcase-board {
        grid-template-columns: minmax(0, 1fr) 32px minmax(260px, 0.95fr);
        padding: 18px;
    }
    .kit-main-tile {
        min-height: 350px;
    }
}
@media (max-width: 680px) {
    .kit-showcase {
        padding-top: 18px;
    }
    .kit-showcase-heading h2 {
        font-size: 1.55rem;
    }
    .kit-showcase-heading p {
        font-size: 0.82rem;
    }
    .kit-showcase-board {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 14px;
    }
    .kit-main-tile {
        min-height: 300px;
    }
    .kit-flow-arrow {
        justify-self: center;
        width: 32px;
        height: 32px;
        transform: rotate(90deg);
    }
}

/* Inline Alipay QR payment */
.membership-payment-panel[hidden] {
    display: none;
}
.membership-payment-panel {
    display: grid;
    grid-template-columns: 176px minmax(0, 1fr);
    gap: 24px;
    align-items: center;
    margin-top: 14px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #111827;
    color: #fff;
}
.membership-payment-qr-wrap {
    position: relative;
    display: grid;
    place-items: center;
    width: 176px;
    height: 176px;
    padding: 8px;
    border-radius: 10px;
    background: var(--bg-card);
}
.membership-payment-qr {
    display: block;
    width: 160px;
    height: 160px;
    image-rendering: pixelated;
}
.membership-payment-qr:not([src]),
.membership-payment-qr[src=""] {
    display: none;
}
.membership-payment-qr-loading {
    color: #64748b;
    font-size: 0.72rem;
    text-align: center;
    white-space: nowrap;
}
.membership-payment-qr-loading[hidden] {
    display: none;
}
.membership-payment-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}
.membership-payment-title {
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.35;
}
.membership-payment-title strong {
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0;
}
.membership-payment-method {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 12px;
    color: #f8fafc;
}
.alipay-logo-image {
    display: block;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    object-fit: cover;
    clip-path: inset(0 round 7px);
}
.membership-payment-method-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.membership-payment-method-copy strong {
    color: #f8fafc;
    font-size: 0.84rem;
    font-weight: 650;
    line-height: 1.35;
}
.membership-payment-method-copy span {
    color: #94a3b8;
    font-size: 0.68rem;
    line-height: 1.4;
}
.membership-payment-hint,
.membership-payment-status {
    margin: 0;
    color: #94a3b8;
    font-size: 0.68rem;
    line-height: 1.5;
}
.membership-payment-status-row {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 20px;
    margin-bottom: 5px;
}
.membership-payment-status-dot {
    width: 6px;
    height: 6px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.12);
}
.membership-payment-status {
    color: #bfdbfe;
    font-weight: 600;
}

/* ============================================
   Settings
   ============================================ */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.generation-settings-section .section-title {
    margin-bottom: 16px;
}

.platform-settings-grid {
    grid-template-columns: 1.15fr 1fr 1fr;
    align-items: start;
    gap: 10px;
    margin-bottom: 16px;
}

.select-field {
    min-width: 0;
}

.select-field > label {
    display: block;
    margin: 0 0 7px;
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.2;
}

.platform-settings-grid .select-wrapper {
    height: 42px;
}

.platform-settings-grid .custom-select-container,
.platform-settings-grid .custom-select-trigger {
    height: 42px;
    min-height: 42px;
}

.platform-settings-grid .custom-select-trigger {
    padding: 0 32px 0 12px;
    border-radius: 8px;
    background: var(--bg-card);
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1;
}

.platform-settings-grid .custom-select-trigger > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.platform-settings-grid .select-field:first-child .custom-select-options {
    min-width: 190px;
}

.product-name-grid {
    grid-template-columns: 1fr;
}

.product-name-grid {
    margin-bottom: 0;
}

.input-field {
    min-width: 0;
}

.input-field > label {
    display: block;
    margin-bottom: 7px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
}

.required-mark {
    color: var(--error);
    font-weight: 700;
}

.settings-text-input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.84rem;
    transition: var(--transition);
}

.settings-text-input::placeholder {
    color: var(--text-muted);
}

.settings-text-input:hover {
    border-color: var(--border-hover);
}

.settings-text-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-hint {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.4;
}

.select-wrapper {
    position: relative;
}
.select-wrapper.full-width {
    width: 100%;
}

.select-wrapper select {
    width: 100%;
    padding: 9px 28px 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}
.select-wrapper select:hover {
    border-color: var(--border-hover);
}
.select-wrapper select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.select-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* ============================================
   Selling Points
   ============================================ */
.btn-ai {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1px solid rgba(0, 102, 204, 0.15);
    border-radius: 20px;
    background: rgba(0, 102, 204, 0.05);
    color: var(--accent);
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-ai:hover {
    background: rgba(0, 102, 204, 0.1);
    border-color: var(--accent);
    transform: translateY(-1px);
}
.btn-ai:active {
    transform: translateY(0);
}
.btn-ai.loading {
    pointer-events: none;
    opacity: 0.7;
}

.textarea-wrapper textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: var(--transition);
    min-height: 110px;
}
.textarea-wrapper textarea::placeholder {
    color: var(--text-muted);
    font-size: 0.8rem;
}
.textarea-wrapper textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ============================================
   Module Grid
   ============================================ */
.module-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.module-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}
.module-item input[type="checkbox"] {
    display: none;
}
.module-item:hover {
    border-color: var(--border-hover);
    background: rgba(15, 23, 42, 0.02);
}
.module-item.active {
    border-color: var(--accent);
    background: rgba(0, 102, 204, 0.05);
}

.module-check {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1.5px solid var(--border-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
    color: transparent;
}
.module-item.active .module-check {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.25);
}

.module-info strong {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}
.module-info small {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.2;
}
.module-item.active .module-info small {
    color: var(--text-secondary);
}
.generation-cost-hint {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.5;
}
.generation-cost-hint strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ============================================
   Generate Action Area
   ============================================ */
.generate-action-area {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    width: min(720px, calc(100% - 156px));
    max-width: 720px;
}

.size-selector-badge {
    flex: 1 1 350px;
    min-width: 0;
}

.generate-ratio-select {
    height: 52px;
    width: 100%;
}
.generate-ratio-select .custom-select-trigger {
    border: 1px solid var(--border) !important;
    background: var(--bg-card) !important;
    padding: 8px 28px 8px 12px !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.02) !important;
    transition: var(--transition);
    height: 52px !important;
    box-sizing: border-box;
}
.generate-ratio-select .custom-select-trigger:hover {
    border-color: var(--accent) !important;
}
.generate-ratio-select .custom-select-trigger span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.btn-generate-main {
    flex: 0 0 250px;
    height: 52px;
    padding: 0 30px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}
.btn-generate-main:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
    filter: brightness(1.1);
}
.btn-generate-main:active {
    transform: translateY(0);
}
.btn-generate-main:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-generate-text,
.btn-generate-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   Right Panel
   ============================================ */
.panel-right {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    background: var(--bg-primary);
    position: relative;
    overflow-x: hidden;
}
.panel-right::before {
    display: none;
}
.panel-right > * {
    position: relative;
    z-index: 1;
}

.results-header {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(500px, 560px);
    align-items: start;
    gap: 20px 32px;
    margin-bottom: 24px;
    z-index: 10;
}

.results-header-text {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
}

.results-header-actions {
    display: flex;
    grid-column: 2;
    grid-row: 1;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    width: 100%;
}

.results-header-actions .generate-action-area {
    width: 100%;
    max-width: none;
}

.results-export-actions {
    display: flex;
    flex: 0 0 auto;
    align-self: flex-end;
    flex-direction: row;
    gap: 8px;
    width: 280px;
}

@media (min-width: 681px) and (max-width: 1350px) {
    .results-header {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }
    .results-header-text,
    .results-header-actions {
        grid-column: 1;
        grid-row: auto;
    }
    .results-header-actions {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        gap: 20px;
    }
    .results-header-actions .generate-action-area {
        width: min(720px, calc(100% - 300px));
        max-width: 720px;
    }
}

.results-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}
.results-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}
.results-header p em {
    color: var(--accent-light);
    font-style: normal;
    text-decoration: underline;
    text-decoration-color: rgba(0, 122, 255, 0.3);
    text-underline-offset: 3px;
}

.btn-download-all {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.results-export-actions .btn-download-all {
    justify-content: center;
    width: 100%;
    min-height: 42px;
}
.btn-preview-all {
    background: var(--bg-card);
    color: var(--text-primary);
}
.btn-download-all:hover {
    background: var(--bg-card);
    border-color: var(--accent);
    color: var(--accent-light);
}

/* ============================================
   Progress Bar
   ============================================ */
.progress-bar-container {
    margin-bottom: 24px;
    animation: fadeIn 0.3s ease;
}

.progress-bar-track {
    width: 100%;
    height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    width: 0%;
    transition: width 0.5s ease;
    position: relative;
}
.progress-bar-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
    animation: shimmer 1.5s infinite;
}

.progress-label {
    display: block;
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ============================================
   Results Grid
   ============================================ */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
}
.empty-illustration {
    position: relative;
    margin-bottom: 24px;
    color: var(--text-muted);
}
.empty-orb {
    display: none;
}
.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.empty-state p {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 320px;
}

/* Result Cards */
.result-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: var(--transition);
    animation: fadeInUp 0.5s ease;
}
.result-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card), 0 0 20px rgba(79, 70, 229, 0.06);
    border-color: var(--border-hover);
}

.result-card-image {
    width: 100%;
    aspect-ratio: var(--card-ratio, 1);
    overflow: hidden;
    position: relative;
    background: var(--bg-input);
}
.result-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.result-card:hover .result-card-image img {
    transform: scale(1.03);
}

.result-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
    opacity: 0;
    transition: var(--transition);
    display: flex;
    align-items: flex-end;
    padding: 16px;
    gap: 8px;
    flex-wrap: wrap;
    cursor: zoom-in;
}
.result-card:hover .result-card-overlay {
    opacity: 1;
}

.btn-card {
    padding: 7px 14px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    color: white;
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    white-space: nowrap;
    transition: var(--transition);
}
.btn-card:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
}
.btn-card.primary {
    background: var(--accent);
    border-color: var(--accent);
}
.btn-card.primary:hover {
    background: var(--accent-light);
}

.btn-card.action-edit {
    background: rgba(255, 255, 255, 0.14);
}

.btn-card.action-regenerate {
    background: rgba(15, 23, 42, 0.72);
}

.result-card-footer {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.result-card-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}
.result-card-badge {
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(79, 70, 229, 0.08);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 500;
}

/* Skeleton Loading Card */
.skeleton-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    animation: fadeIn 0.3s ease;
}
.skeleton-image {
    width: 100%;
    aspect-ratio: var(--card-ratio, 1);
    background: #f6f8fb;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Premium Skeleton Styles */
.premium-skeleton {
    border-color: rgba(15, 23, 42, 0.06);
    box-shadow: none;
}
.premium-skeleton .skeleton-image {
    background: #f6f8fb;
    position: relative;
    overflow: hidden;
}
.premium-skeleton .skeleton-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.design-loader {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 12px;
    margin-bottom: 4px;
}
.design-loader span {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #152238;
    animation: loaderDots 1.2s infinite ease-in-out;
}
.design-loader span:nth-child(2) { animation-delay: 0.14s; }
.design-loader span:nth-child(3) {
    width: 6px;
    height: 6px;
    animation-delay: 0.28s;
}

.premium-skeleton .skeleton-text {
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0;
    color: #526078;
    text-transform: uppercase;
}
.premium-skeleton .skeleton-subtext {
    font-size: 0.84rem;
    font-weight: 600;
    color: #94a3b8;
}
@keyframes loaderDots {
    0%, 60%, 100% { transform: translateY(0) scale(0.72); opacity: 0.35; }
    30% { transform: translateY(-2px) scale(1); opacity: 1; }
}
.rendering-footer-spacer {
    min-height: 43px;
    background: #f6f8fb;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 480px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.modal-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.input-with-toggle {
    position: relative;
}
.input-with-toggle input {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}
.input-with-toggle input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-with-toggle input::placeholder {
    color: var(--text-muted);
}

.toggle-visibility {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.toggle-visibility:hover {
    color: var(--text-secondary);
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.image-edit-dialog {
    max-width: 540px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 20px 64px rgba(15, 23, 42, 0.22);
}

.image-edit-header {
    align-items: flex-start;
}

.image-edit-header h2 {
    margin: 0;
    font-size: 1.08rem;
}

.image-edit-header p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.image-edit-body {
    gap: 18px;
}

.image-edit-reference {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-input);
}

.image-edit-reference img {
    width: 88px;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 5px;
    background: #f3f5f8;
}

.image-edit-reference div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.image-edit-reference strong {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.image-edit-reference span {
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.5;
}

.image-edit-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 600;
}

.image-edit-field textarea {
    display: block;
    width: 100%;
    min-height: 126px;
    resize: vertical;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 7px;
    outline: none;
    background: var(--bg-input);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.86rem;
    line-height: 1.65;
    letter-spacing: 0;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.image-edit-field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.image-edit-field textarea::placeholder {
    color: var(--text-muted);
}

.image-edit-field small {
    display: block;
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.5;
}

.image-edit-submit {
    min-width: 108px;
    background: var(--accent);
}

.image-edit-cost {
    margin-right: auto;
    color: var(--text-muted);
    font-size: 0.74rem;
    line-height: 1.4;
}

.image-edit-submit:disabled {
    cursor: wait;
    opacity: 0.65;
    transform: none;
    box-shadow: none;
}

.btn-primary, .btn-secondary {
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    border: none;
    background: var(--accent-gradient);
    color: var(--bg-root);
}
.btn-primary:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
}
.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    top: 12px;
    right: var(--toast-anchor-right, 300px);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

.toast-container:empty {
    display: none;
}

@media (max-width: 680px) {
    .toast-container {
        top: 124px;
        right: 12px;
        left: 12px;
        align-items: stretch;
    }
}

.toast {
    --toast-accent: #2563eb;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 9px 12px;
    border-radius: 5px;
    background: var(--bg-card);
    border: 1px solid #dfe5ec;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.07);
    animation: toastIn 0.18s ease-out;
    pointer-events: auto;
    max-width: min(360px, calc(100vw - 48px));
}
.toast.success {
    --toast-accent: #059669;
}
.toast.error {
    --toast-accent: #dc2626;
}
.toast.info {
    --toast-accent: #2563eb;
}
.toast.removing {
    animation: toastOut 0.16s ease forwards;
}
.toast.repeated {
    animation: toastRepeat 0.2s ease;
}

.toast-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--toast-accent);
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
}

.toast-message {
    min-width: 0;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 680px) {
    .toast {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes skeleton-pulse {
    to { background-position-x: -200%; }
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes shimmer {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-4px);
    }
}

@keyframes toastRepeat {
    50% { transform: translateY(2px); }
}

@media (prefers-reduced-motion: reduce) {
    .toast,
    .toast.removing,
    .toast.repeated {
        animation-duration: 0.01ms;
    }
}

/* ============================================
   Error State for Result Card
   ============================================ */
.result-card-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-input);
    color: var(--text-muted);
    text-align: center;
    padding: 24px;
    gap: 8px;
}
.result-card-error .error-icon {
    font-size: 2rem;
    opacity: 0.5;
}
.result-card-error .error-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.result-card-error .btn-retry {
    margin-top: 8px;
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--accent-light);
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}
.result-card-error .btn-retry:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .app-body {
        flex-direction: column;
        overflow-y: auto;
        height: auto;
    }
    .sidebar {
        flex-direction: row;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 8px 12px;
        overflow-x: auto;
    }
    .sidebar-item {
        width: auto;
        flex-direction: row;
        padding: 8px 14px;
        gap: 6px;
    }
    .sidebar-item.active::before {
        left: 8px;
        right: 8px;
        top: auto;
        bottom: 0;
        width: auto;
        height: 3px;
        border-radius: 3px 3px 0 0;
    }
    .main {
        flex-direction: column;
    }
    .panel-left {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: none;
        overflow: visible;
    }
    .panel-right {
        overflow: visible;
    }
    body {
        overflow-y: auto;
        height: auto;
    }
}

/* Prompt Card Editor */
.prompt-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.prompt-editor-container {
    flex: 1;
    width: 100%;
    aspect-ratio: 1;
    position: relative;
    padding: 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}
.prompt-editor-container textarea {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8rem;
    line-height: 1.5;
    padding: 10px;
    resize: none;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}
.prompt-editor-container textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.prompt-card .result-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
}
.btn-render-single {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    color: white;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-render-single:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}
.prompt-badge {
    position: absolute;
    top: 18px;
    right: 18px;
    padding: 4px 10px;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 0.68rem;
    border-radius: 20px;
    pointer-events: none;
    font-weight: 600;
}

/* ============================================
   Image Lightbox Modal
   ============================================ */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.lightbox-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    object-fit: contain;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.lightbox-overlay.open .lightbox-img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.lightbox-close:hover {
    background: rgba(255,255,255,0.25);
    transform: rotate(90deg);
}

body.stitched-preview-open {
    overflow: hidden;
}
.stitched-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.68);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}
.stitched-preview-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.stitched-preview-dialog {
    display: flex;
    flex-direction: column;
    width: min(920px, calc(100vw - 48px));
    height: min(860px, calc(100dvh - 48px));
    overflow: hidden;
    border: 1px solid #d9e0ea;
    border-radius: 8px;
    background: #eef1f5;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
    transform: translateY(8px);
    transition: transform 0.18s ease;
}
.stitched-preview-overlay.open .stitched-preview-dialog {
    transform: translateY(0);
}
.stitched-preview-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 12px 16px 12px 20px;
    border-bottom: 1px solid #d9e0ea;
    background: var(--bg-card);
}
.stitched-preview-header h2 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 700;
}
.stitched-preview-header p {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.72rem;
}
.stitched-preview-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}
.stitched-preview-close:hover,
.stitched-preview-close:focus-visible {
    background: #f1f5f9;
    color: var(--text-primary);
    outline: none;
}
.stitched-preview-scroll {
    flex: 1 1 auto;
    min-height: 0;
    padding: 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.stitched-preview-canvas {
    width: min(720px, 100%);
    margin: 0 auto;
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.14);
}
.stitched-preview-canvas img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    border: 0;
}

/* Make result cards clickable */
.result-card-image img {
    cursor: zoom-in;
}

@media (max-width: 600px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    .app-body,
    .main,
    .panel-left,
    .panel-right {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    .sidebar {
        max-width: 100vw;
    }
    .settings-grid {
        grid-template-columns: 1fr;
    }
    .module-grid {
        grid-template-columns: 1fr;
    }
    .results-grid {
        grid-template-columns: 1fr;
    }
    .header {
        padding: 0 16px;
        gap: 8px;
    }
    .logo-text > span,
    .btn-header > span {
        display: none;
    }
    .header-right {
        flex-shrink: 0;
    }
    .btn-header {
        width: 36px;
        height: 36px;
        padding: 0;
        justify-content: center;
    }
    .sidebar-item {
        flex: 0 0 auto;
    }
    .panel-left {
        padding: 16px;
    }
    .panel-right {
        padding: 20px 16px;
    }
    .results-header,
    .results-header-actions,
    .generate-action-area {
        width: 100%;
    }
    .results-header {
        flex-direction: column;
        gap: 16px;
    }
    .results-header-actions {
        flex-direction: column;
        align-items: stretch !important;
        gap: 8px !important;
    }
    .generate-action-area {
        gap: 8px;
    }
    .generate-ratio-select,
    .btn-generate-main {
        flex: 1;
        min-width: 0;
    }
    .btn-generate-main {
        padding: 0 14px;
        white-space: nowrap;
    }
}

/* User Profile Header */
.user-profile {
    display: flex;
    position: relative;
    align-items: center;
    padding: 0;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.account-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 5px 10px;
    border: 0;
    border-radius: inherit;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.account-menu-trigger:hover,
.account-menu-trigger:focus-visible {
    background: var(--bg-secondary);
    outline: none;
}
.account-menu-chevron {
    color: var(--text-muted);
    transition: transform 0.18s ease;
}
.user-profile.menu-open .account-menu-chevron {
    transform: rotate(180deg);
}
.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}
.user-phone {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}
.account-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 132px;
    padding: 5px;
    border: 1px solid #dce3ec;
    border-radius: 8px;
    background: var(--bg-card);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
    z-index: 220;
}
.account-menu[hidden] {
    display: none;
}
.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 550;
    cursor: pointer;
    transition: var(--transition);
}
.btn-logout:hover {
    background: #fff1f2;
    color: var(--error);
}

/* ============================================
   Auth Modal 鈥?Premium Design
   ============================================ */

/* Overlay */
.auth-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.auth-modal-overlay.open {
    display: flex !important;
    opacity: 1;
}

/* Modal container */
.auth-modal {
    width: 100%;
    max-width: 420px;
    margin: 20px;
    background: var(--bg-card);
    border-radius: 24px;
    box-shadow:
        0 24px 80px rgba(15, 23, 42, 0.18),
        0 8px 24px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.auth-modal-overlay.open .auth-modal {
    transform: translateY(0) scale(1);
}

/* Decorative orbs */
.auth-modal-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(50px);
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}
.auth-modal-orb-1 {
    width: 200px;
    height: 200px;
    top: -80px;
    right: -60px;
    background: linear-gradient(135deg, #6366f1, #a78bfa);
    animation: orbFloat1 6s ease-in-out infinite;
}
.auth-modal-orb-2 {
    width: 150px;
    height: 150px;
    bottom: -50px;
    left: -40px;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    animation: orbFloat2 8s ease-in-out infinite;
}
@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-15px, 10px) scale(1.1); }
}
@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(10px, -12px) scale(1.15); }
}

/* Close button */
.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 20;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: none;
    background: rgba(241, 245, 249, 0.8);
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}
.auth-modal-close:hover {
    background: rgba(241, 245, 249, 1);
    color: #0f172a;
    transform: rotate(90deg);
}

/* Header with branding */
.auth-modal-header {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 32px 32px 20px;
}
.auth-modal-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
.auth-modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}
.auth-modal-subtitle {
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 400;
}

/* Tabs */
.auth-tabs-wrapper {
    display: flex;
    position: relative;
    z-index: 10;
    margin: 0 32px;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}
.auth-tabs-wrapper .auth-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
    user-select: none;
    border: none;
    background: transparent;
}
.auth-tabs-wrapper .auth-tab::after {
    display: none; /* Override any inherited ::after styles */
}
.auth-tabs-wrapper .auth-tab.active {
    color: #0f172a;
    background: var(--bg-card);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
}
.auth-tabs-wrapper .auth-tab:not(.active):hover {
    color: #475569;
    background: rgba(255, 255, 255, 0.5);
}
.auth-tab-slider {
    display: none; /* We use background-based indicator instead */
}

/* Form body */
.auth-form-body {
    position: relative;
    z-index: 10;
    padding: 24px 32px 8px;
}

/* Tab content */
.auth-tab-content {
    display: none;
    animation: authFadeIn 0.35s ease;
}
.auth-tab-content.active {
    display: block;
}
@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Input groups */
.auth-input-group {
    margin-bottom: 18px;
}
.auth-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}
.auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.auth-label-row .auth-label {
    margin-bottom: 0;
}
.auth-forgot-link,
.auth-back-link {
    border: 0;
    padding: 0;
    background: transparent;
    color: #64748b;
    font: inherit;
    cursor: pointer;
}
.auth-forgot-link {
    font-size: 0.78rem;
}
.auth-forgot-link:hover,
.auth-back-link:hover {
    color: #0f172a;
}
.auth-reset-heading {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr) 86px;
    align-items: center;
    margin: -2px 0 20px;
}
.auth-reset-heading > div {
    grid-column: 2;
    text-align: center;
}
.auth-reset-heading h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
    line-height: 1.5;
}
.auth-reset-heading p {
    margin: 2px 0 0;
    color: #94a3b8;
    font-size: 0.75rem;
}
.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    justify-self: start;
    font-size: 0.78rem;
}

/* Input wrapper with icon */
.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.auth-input-icon {
    position: absolute;
    left: 14px;
    z-index: 2;
    color: #94a3b8;
    display: flex;
    align-items: center;
    transition: color 0.2s ease;
    pointer-events: none;
}
.auth-input-wrapper:focus-within .auth-input-icon {
    color: #6366f1;
}

.auth-input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.92rem;
    font-family: inherit;
    background: var(--bg-secondary);
    color: #0f172a;
    outline: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}
.auth-input::placeholder {
    color: #cbd5e1;
}
.auth-input:focus {
    border-color: #6366f1;
    background: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}
.auth-input:hover:not(:focus) {
    border-color: #cbd5e1;
}

/* Input hint */
.auth-input-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Input row (for code + sms button) */
.auth-input-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

/* Password toggle */
.auth-pwd-toggle {
    position: absolute;
    right: 12px;
    z-index: 2;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s ease;
}
.auth-pwd-toggle:hover {
    color: #475569;
}

/* SMS button */
.auth-sms-btn {
    padding: 0 18px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s ease;
    font-family: inherit;
    min-width: 110px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.auth-sms-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}
.auth-sms-btn:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Submit button */
.auth-submit-btn {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    color: #ffffff;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
    margin-top: 4px;
    position: relative;
    overflow: hidden;
}
.auth-submit-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}
.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #4f46e5, #4338ca);
}
.auth-submit-btn:hover::before {
    opacity: 1;
}
.auth-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.auth-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Button text & loading */
.auth-btn-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.auth-btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.auth-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: authSpin 0.6s linear infinite;
}
@keyframes authSpin {
    to { transform: rotate(360deg); }
}

/* Switch text */
.auth-switch-text {
    text-align: center;
    margin: 18px 0 0;
    font-size: 0.82rem;
    color: #94a3b8;
}
.auth-switch-link {
    color: #6366f1;
    cursor: pointer;
    font-weight: 600;
    transition: color 0.2s;
    position: relative;
}
.auth-switch-link:hover {
    color: #4f46e5;
}
.auth-switch-link::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: #6366f1;
    transition: width 0.25s ease;
}
.auth-switch-link:hover::after {
    width: 100%;
}

/* Footer */
.auth-modal-footer {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 12px 32px 24px;
}
.auth-modal-footer p {
    font-size: 0.72rem;
    color: #cbd5e1;
}
.auth-modal-footer a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
}
.auth-modal-footer a:hover {
    color: #6366f1;
}

/* Error shake animation */
@keyframes authShake {
    0%, 100% { transform: translateX(0); }
    10%, 50%, 90% { transform: translateX(-4px); }
    30%, 70% { transform: translateX(4px); }
}
.auth-input.error {
    border-color: #ef4444 !important;
    animation: authShake 0.4s ease;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .auth-modal {
        margin: 12px;
        border-radius: 20px;
    }
    .auth-modal-header {
        padding: 24px 24px 16px;
    }
    .auth-tabs-wrapper {
        margin: 0 24px;
    }
    .auth-form-body {
        padding: 20px 24px 8px;
    }
    .auth-modal-footer {
        padding: 12px 24px 20px;
    }
}

/* Restore the previous membership layout after the latest design experiment. */
.membership-shell-modal {
    width: min(1120px, calc(100% - 32px));
    max-height: calc(100vh - 32px);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.06);
}
.membership-shell-modal .membership-modal-header {
    padding: 18px 24px;
}
.membership-shell-modal .membership-modal-header h2 {
    font-size: 1.25rem;
    letter-spacing: 0;
}
.membership-shell-modal .membership-subtitle {
    margin-top: 6px;
    font-size: 0.85rem;
}
.membership-shell-modal .membership-modal-main {
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 600px;
    max-height: calc(100vh - 104px);
}
.membership-shell-modal .membership-body {
    max-height: calc(100vh - 104px);
    padding: 24px 28px 28px;
}
.membership-shell-modal .membership-account-row {
    padding-bottom: 18px;
}
.membership-shell-modal .membership-account-avatar {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
    font-size: 1rem;
}
.membership-shell-modal .membership-account-info strong {
    font-size: 0.93rem;
}
.membership-shell-modal .membership-account-credit strong {
    font-size: 1.05rem;
}
.membership-shell-modal .membership-summary {
    gap: 12px;
    margin-top: 18px;
}
.membership-shell-modal .membership-summary > div {
    min-height: unset;
    justify-content: initial;
    padding: 14px 16px;
}
.membership-shell-modal .membership-summary strong {
    font-size: 1.15rem;
}
.membership-shell-modal .membership-section {
    margin-top: 20px;
}
.membership-shell-modal .membership-section-heading {
    margin-bottom: 12px;
}
.membership-shell-modal .membership-section-heading h3 {
    font-size: 1rem;
}
.membership-shell-modal .membership-section-heading span {
    font-size: 0.78rem;
}
.membership-shell-modal .membership-plan-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.membership-shell-modal .membership-plan-card {
    min-height: unset;
    padding: 16px;
}
.membership-shell-modal .membership-plan-top {
    font-size: 0.8rem;
}
.membership-shell-modal .membership-price {
    margin-top: 15px;
    font-size: 1.45rem;
}
.membership-shell-modal .membership-price small {
    font-size: 0.75rem;
}
.membership-shell-modal .membership-plan-card p {
    min-height: 38px;
    margin: 8px 0 16px;
    font-size: 0.82rem;
}
.membership-shell-modal .membership-action,
.membership-shell-modal .credit-action {
    padding: 9px 10px;
    font-size: 0.82rem;
}
.membership-shell-modal .credit-package-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.membership-shell-modal .membership-note {
    margin-top: 20px;
    padding: 10px 12px;
    font-size: 0.78rem;
}
.membership-shell-modal .membership-order-preview {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 18px;
    margin-top: 18px;
    padding: 15px 16px;
}
.membership-shell-modal .membership-order-copy strong {
    font-size: 0.88rem;
}
.membership-shell-modal .membership-order-amount {
    font-size: 1.05rem;
}
.membership-shell-modal .membership-order-button {
    min-width: 132px;
    padding: 9px 12px;
    font-size: 0.78rem;
}
@media (max-width: 880px) {
    .membership-shell-modal .membership-modal-main {
        grid-template-columns: 210px minmax(0, 1fr);
    }
}
@media (max-width: 760px) {
    .membership-shell-modal .membership-plan-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 680px) {
    .membership-shell-modal {
        width: min(560px, calc(100% - 20px));
        max-height: calc(100vh - 20px);
    }
    .membership-shell-modal .membership-modal-main {
        display: block;
        max-height: calc(100vh - 90px);
        overflow: auto;
    }
    .membership-shell-modal .membership-benefits {
        padding: 18px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .membership-shell-modal .membership-body {
        max-height: none;
        padding: 18px;
        overflow: visible;
    }
    .membership-shell-modal .membership-order-preview {
        grid-template-columns: 1fr auto;
    }
    .membership-shell-modal .membership-order-button {
        grid-column: 1 / -1;
        width: 100%;
    }
}
@media (max-width: 560px) {
    .membership-shell-modal .membership-summary,
    .membership-shell-modal .credit-package-grid,
    .membership-shell-modal .membership-plan-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Membership center
   ============================================ */
.membership-header-btn {
    color: var(--text-secondary);
}
.membership-header-btn:hover {
    color: var(--text-primary);
}
.membership-modal {
    width: min(900px, calc(100% - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.06);
}
.membership-modal-header {
    align-items: flex-start;
    padding: 24px 28px 18px;
}
.membership-modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}
.membership-subtitle {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.membership-body {
    padding: 0 28px 28px;
}
.membership-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.membership-summary > div {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.membership-summary span,
.membership-section-heading span {
    color: var(--text-muted);
    font-size: 0.78rem;
}
.membership-summary strong {
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 700;
}
.membership-section {
    margin-top: 24px;
}
.membership-section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.membership-section-heading h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
}
.membership-plan-grid,
.credit-package-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.credit-package-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.membership-plan-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.membership-plan-card.featured {
    border-color: #93c5fd;
    box-shadow: inset 0 2px 0 #2563eb;
}
.membership-plan-card.max-plan {
    background: var(--bg-secondary);
}
.membership-plan-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 22px;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.membership-badge {
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: 0.04em;
}
.membership-price {
    margin-top: 15px;
    color: var(--text-primary);
    font-size: 1.45rem;
    font-weight: 700;
    white-space: nowrap;
}
.membership-price small {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}
.membership-plan-card p {
    min-height: 38px;
    margin: 8px 0 16px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
}
.membership-action,
.credit-action {
    width: 100%;
    margin-top: auto;
    padding: 9px 10px;
    color: #fff;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.membership-action:hover,
.credit-action:hover {
    background: var(--accent-light);
    border-color: var(--accent-light);
}
.membership-note {
    margin: 20px 0 0;
    padding: 10px 12px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-left: 3px solid #94a3b8;
    font-size: 0.78rem;
    line-height: 1.5;
}
@media (max-width: 760px) {
    .membership-plan-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 560px) {
    .membership-modal-header,
    .membership-body {
        padding-left: 18px;
        padding-right: 18px;
    }
    .membership-summary,
    .credit-package-grid,
    .membership-plan-grid {
        grid-template-columns: 1fr;
    }
}

/* Membership center: split workspace layout */
.membership-shell-modal {
    width: min(1120px, calc(100% - 32px));
    max-height: calc(100vh - 32px);
    overflow: hidden;
}
.membership-shell-modal .membership-modal-header {
    padding: 18px 24px;
    background: var(--bg-card);
}
.membership-modal-main {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 600px;
    max-height: calc(100vh - 104px);
}
.membership-benefits {
    display: flex;
    flex-direction: column;
    padding: 28px 24px 24px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
}
.membership-benefit-kicker {
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.membership-benefits h3 {
    margin: 12px 0 10px;
    color: var(--text-primary);
    font-size: 1.55rem;
    line-height: 1.3;
    letter-spacing: 0;
}
.membership-benefit-lead {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.6;
}
.membership-benefit-list {
    display: grid;
    gap: 17px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
}
.membership-benefit-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.benefit-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    color: #0f766e;
    background: #ccfbf1;
    border: 1px solid #99f6e4;
    border-radius: 50%;
    font-size: 0.9rem;
}
.membership-benefit-list strong,
.membership-benefit-list small {
    display: block;
}
.membership-benefit-list strong {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 650;
}
.membership-benefit-list small {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.74rem;
    line-height: 1.4;
}
.membership-signup-bonus {
    display: grid;
    gap: 4px;
    margin-top: auto;
    padding: 12px;
    background: #ecfeff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius-sm);
}
.membership-signup-bonus strong {
    color: #075985;
    font-size: 0.78rem;
}
.membership-signup-bonus span {
    color: #0369a1;
    font-size: 0.72rem;
}
.membership-shell-modal .membership-body {
    min-width: 0;
    max-height: calc(100vh - 104px);
    overflow: auto;
    padding: 24px 28px 28px;
}
.membership-account-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.membership-account-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    color: #075985;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    border-radius: 50%;
    font-weight: 700;
}
.membership-account-info {
    display: grid;
    gap: 4px;
    min-width: 0;
}
.membership-account-info strong {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.93rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.membership-account-info span,
.membership-account-credit span {
    color: var(--text-muted);
    font-size: 0.76rem;
}
.membership-account-credit {
    display: grid;
    gap: 3px;
    margin-left: auto;
    text-align: right;
}
.membership-account-credit strong {
    color: var(--text-primary);
    font-size: 1.05rem;
}
.membership-shell-modal .membership-summary {
    margin-top: 18px;
}
.membership-view-switch {
    display: flex;
    gap: 4px;
    margin-top: 22px;
    padding: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.membership-view-tab {
    flex: 1;
    min-height: 34px;
    padding: 7px 12px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    font: inherit;
    font-size: 0.84rem;
    cursor: pointer;
}
.membership-view-tab:hover {
    color: var(--text-primary);
}
.membership-view-tab.active {
    color: var(--text-primary);
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.07);
}
.membership-view-panel[hidden] {
    display: none;
}
.membership-shell-modal .membership-section {
    margin-top: 20px;
}
.membership-shell-modal .membership-plan-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.membership-shell-modal .credit-package-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.membership-action.selected,
.credit-action.selected {
    color: var(--text-primary);
    background: #e0f2fe;
    border-color: #38bdf8;
}
.membership-order-preview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 18px;
    margin-top: 18px;
    padding: 15px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.membership-order-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}
.membership-order-copy > span {
    color: var(--text-muted);
    font-size: 0.74rem;
}
.membership-order-copy strong {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.88rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.membership-order-copy small {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.membership-order-amount {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 700;
    white-space: nowrap;
}
.membership-order-button {
    min-width: 132px;
    padding: 9px 12px;
    color: #fff;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}
.membership-order-button:hover:not(:disabled) {
    background: var(--accent-light);
    border-color: var(--accent-light);
}
.membership-order-button:disabled {
    color: #94a3b8;
    background: #e2e8f0;
    border-color: #cbd5e1;
    cursor: not-allowed;
}
@media (max-width: 880px) {
    .membership-modal-main {
        grid-template-columns: 210px minmax(0, 1fr);
    }
    .membership-shell-modal .membership-plan-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 680px) {
    .membership-shell-modal {
        width: min(560px, calc(100% - 20px));
        max-height: calc(100vh - 20px);
    }
    .membership-modal-main {
        display: block;
        max-height: calc(100vh - 90px);
        overflow: auto;
    }
    .membership-benefits {
        padding: 18px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .membership-benefits h3 {
        margin-top: 8px;
        font-size: 1.25rem;
    }
    .membership-benefit-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin-top: 18px;
    }
    .membership-benefit-list li:nth-child(n + 3) {
        display: none;
    }
    .membership-signup-bonus {
        margin-top: 18px;
    }
    .membership-shell-modal .membership-body {
        max-height: none;
        padding: 18px;
        overflow: visible;
    }
    .membership-order-preview {
        grid-template-columns: 1fr auto;
    }
    .membership-order-button {
        grid-column: 1 / -1;
        width: 100%;
    }
}
@media (max-width: 440px) {
    .membership-shell-modal .membership-plan-grid,
    .membership-shell-modal .credit-package-grid,
    .membership-benefit-list {
        grid-template-columns: 1fr;
    }
    .membership-benefit-list li:nth-child(n + 3) {
        display: flex;
    }
    .membership-account-credit {
        display: none;
    }
}

/* Membership center: utility navigation refinement */
.membership-nav {
    background: var(--bg-secondary);
}
.membership-nav h3 {
    margin-bottom: 8px;
    font-size: 1.32rem;
}
.membership-nav .membership-benefit-list {
    display: grid;
    gap: 6px;
    margin-top: 24px;
}
.membership-nav-item {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 10px;
    padding: 11px 10px;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    text-align: left;
    font: inherit;
    cursor: pointer;
}
.membership-nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-card);
    border-color: var(--border);
}
.membership-nav-item.active {
    color: var(--text-primary);
    background: var(--bg-card);
    border-color: #cbd5e1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.membership-nav-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    color: #334155;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: 0.76rem;
    font-weight: 700;
}
.membership-nav-item strong,
.membership-nav-item small {
    display: block;
}
.membership-nav-item strong {
    font-size: 0.84rem;
    font-weight: 650;
}
.membership-nav-item small {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.72rem;
}
.membership-nav .membership-signup-bonus {
    margin-top: auto;
}
.membership-nav .membership-signup-bonus strong {
    font-size: 0.76rem;
}
.membership-nav .membership-signup-bonus span {
    font-size: 0.7rem;
}

/* Membership center: larger editorial layout */
.membership-shell-modal {
    width: min(1380px, calc(100% - 36px));
    max-height: calc(100vh - 36px);
    border-radius: 18px;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22), 0 8px 24px rgba(15, 23, 42, 0.08);
}
.membership-shell-modal .membership-modal-header {
    padding: 25px 34px 23px;
}
.membership-shell-modal .membership-modal-header h2 {
    font-size: 1.45rem;
    letter-spacing: -0.01em;
}
.membership-shell-modal .membership-subtitle {
    margin-top: 8px;
    font-size: 0.9rem;
}
.membership-shell-modal .membership-modal-main {
    grid-template-columns: 340px minmax(0, 1fr);
    min-height: 650px;
    max-height: calc(100vh - 112px);
}
.membership-shell-modal .membership-nav {
    padding: 42px 30px 30px;
}
.membership-shell-modal .membership-nav h3 {
    margin-top: 16px;
    font-size: 1.72rem;
    line-height: 1.25;
}
.membership-shell-modal .membership-benefit-lead {
    max-width: 230px;
    font-size: 0.88rem;
    line-height: 1.65;
}
.membership-benefit-brief {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 24px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.membership-benefit-brief div {
    display: grid;
    gap: 3px;
}
.membership-benefit-brief strong {
    color: var(--text-primary);
    font-size: 1.28rem;
    line-height: 1;
}
.membership-benefit-brief span {
    color: var(--text-muted);
    font-size: 0.72rem;
}
.membership-shell-modal .membership-nav .membership-benefit-list {
    margin-top: 28px;
    gap: 8px;
}
.membership-shell-modal .membership-nav-item {
    min-height: 58px;
    padding: 13px 12px;
}
.membership-shell-modal .membership-nav-mark {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
}
.membership-shell-modal .membership-body {
    padding: 34px 40px 36px;
}
.membership-shell-modal .membership-account-row {
    padding-bottom: 22px;
}
.membership-shell-modal .membership-account-avatar {
    flex-basis: 48px;
    width: 48px;
    height: 48px;
    font-size: 1.02rem;
}
.membership-shell-modal .membership-account-info strong {
    font-size: 1.04rem;
}
.membership-shell-modal .membership-account-credit strong {
    font-size: 1.28rem;
}
.membership-shell-modal .membership-summary {
    gap: 16px;
    margin-top: 24px;
}
.membership-shell-modal .membership-summary > div {
    min-height: 92px;
    justify-content: center;
    padding: 16px 18px;
}
.membership-shell-modal .membership-summary strong {
    font-size: 1.3rem;
}
.membership-shell-modal .membership-section {
    margin-top: 30px;
}
.membership-shell-modal .membership-section-heading {
    margin-bottom: 16px;
}
.membership-shell-modal .membership-section-heading h3 {
    font-size: 1.18rem;
}
.membership-shell-modal .membership-section-heading span {
    font-size: 0.82rem;
}
.membership-shell-modal .membership-plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.membership-shell-modal .membership-plan-card {
    min-height: 268px;
    padding: 22px;
}
.membership-shell-modal .membership-plan-top {
    font-size: 0.86rem;
}
.membership-shell-modal .membership-price {
    margin-top: 28px;
    font-size: 2rem;
}
.membership-shell-modal .membership-price small {
    font-size: 0.9rem;
}
.membership-shell-modal .membership-plan-card p {
    min-height: 44px;
    margin-top: 12px;
    font-size: 0.9rem;
}
.membership-shell-modal .membership-action,
.membership-shell-modal .credit-action {
    padding: 11px 12px;
    font-size: 0.86rem;
}
.membership-shell-modal .credit-package-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.membership-shell-modal .membership-note {
    margin-top: 26px;
    padding: 13px 15px;
    font-size: 0.82rem;
}
.membership-shell-modal .membership-order-preview {
    margin-top: 22px;
    padding: 19px 20px;
    gap: 24px;
}
.membership-shell-modal .membership-order-copy strong {
    font-size: 0.98rem;
}
.membership-shell-modal .membership-order-amount {
    font-size: 1.28rem;
}
.membership-shell-modal .membership-order-button {
    min-width: 164px;
    padding: 11px 14px;
    font-size: 0.84rem;
}
@media (max-width: 980px) {
    .membership-shell-modal .membership-modal-main {
        grid-template-columns: 290px minmax(0, 1fr);
    }
    .membership-shell-modal .membership-body {
        padding-left: 26px;
        padding-right: 26px;
    }
}
@media (max-width: 680px) {
    .membership-shell-modal {
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
    }
    .membership-shell-modal .membership-modal-header {
        padding: 18px 20px;
    }
    .membership-shell-modal .membership-modal-main {
        display: block;
        max-height: calc(100vh - 86px);
        overflow: auto;
    }
    .membership-shell-modal .membership-nav {
        padding: 22px 20px 20px;
    }
    .membership-shell-modal .membership-nav h3 {
        margin-top: 10px;
        font-size: 1.35rem;
    }
    .membership-benefit-brief {
        max-width: 280px;
        margin-top: 16px;
    }
    .membership-shell-modal .membership-nav .membership-benefit-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        margin-top: 18px;
    }
    .membership-shell-modal .membership-nav-item {
        min-height: 54px;
        padding: 9px 8px;
    }
    .membership-shell-modal .membership-nav-item small {
        display: none;
    }
    .membership-shell-modal .membership-nav-mark {
        flex-basis: 28px;
        width: 28px;
        height: 28px;
    }
    .membership-shell-modal .membership-body {
        max-height: none;
        padding: 22px 20px 24px;
        overflow: visible;
    }
    .membership-shell-modal .membership-plan-grid,
    .membership-shell-modal .credit-package-grid {
        grid-template-columns: 1fr;
    }
    .membership-shell-modal .membership-plan-card {
        min-height: 230px;
    }
}

/* ============================================
   Auth Modal - Match the application workspace
   ============================================ */
.toast-container {
    z-index: 11000;
}
.toast.auth-toast {
    min-width: 260px;
}
.auth-modal-overlay {
    background: rgba(15, 23, 42, 0.46);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.auth-modal {
    max-width: 400px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.06);
}
.auth-modal::before {
    display: none;
}
.auth-modal-orb {
    display: none !important;
}
.auth-modal-close {
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-muted);
    backdrop-filter: none;
}
.auth-modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    transform: none;
}
.auth-modal-header {
    padding: 30px 32px 18px;
}
.auth-modal-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: #eff6ff;
    box-shadow: none;
}
.auth-modal-title {
    font-size: 1.2rem;
    color: var(--text-primary);
    letter-spacing: 0;
}
.auth-modal-subtitle {
    color: var(--text-muted);
}
.auth-tabs-wrapper {
    margin: 0 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    padding: 3px;
    gap: 3px;
}
.auth-tabs-wrapper .auth-tab {
    border-radius: 5px;
    color: var(--text-muted);
}
.auth-tabs-wrapper .auth-tab.active {
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.auth-form-body {
    padding: 22px 32px 8px;
}
.auth-label {
    color: var(--text-secondary);
    letter-spacing: 0;
}
.auth-input {
    padding-top: 11px;
    padding-bottom: 11px;
    border: 1px solid #dbe3ee;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
}
.auth-input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}
.auth-input-wrapper:focus-within .auth-input-icon {
    color: #0284c7;
}
.auth-submit-btn,
.auth-sms-btn {
    border-radius: var(--radius-sm);
    background: var(--accent);
    box-shadow: none;
}
.auth-submit-btn:hover,
.auth-sms-btn:hover:not(:disabled) {
    background: var(--accent-light);
    box-shadow: none;
    transform: none;
}
.auth-submit-btn::before {
    display: none;
}
.auth-switch-link {
    color: #0284c7;
}
.auth-switch-link:hover {
    color: #0369a1;
}
.auth-switch-link::after {
    background: #0284c7;
}
.auth-modal-footer {
    padding: 12px 32px 22px;
    border-top: 1px solid var(--border);
}
.auth-inline-message {
    display: none;
    margin: 16px 32px 0;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    line-height: 1.45;
}
.auth-inline-message.error {
    display: block;
    color: #b42318;
    border-color: #fecaca;
    background: #fff1f2;
}
.auth-inline-message.success {
    display: block;
    color: #047857;
    border-color: #a7f3d0;
    background: #ecfdf5;
}

@media (max-width: 480px) {
    .auth-modal-header,
    .auth-form-body,
    .auth-modal-footer {
        padding-left: 24px;
        padding-right: 24px;
    }
    .auth-tabs-wrapper,
    .auth-inline-message {
        margin-left: 24px;
        margin-right: 24px;
    }
}

/* Final rollback overrides for the latest membership sizing experiment. */
.membership-shell-modal {
    width: min(1120px, calc(100% - 32px));
    max-height: calc(100vh - 32px);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.06);
}
.membership-shell-modal .membership-modal-header { padding: 18px 24px; }
.membership-shell-modal .membership-modal-header h2 { font-size: 1.25rem; letter-spacing: 0; }
.membership-shell-modal .membership-subtitle { margin-top: 6px; font-size: 0.85rem; }
.membership-shell-modal .membership-modal-main { grid-template-columns: 260px minmax(0, 1fr); min-height: 600px; max-height: calc(100vh - 104px); }
.membership-shell-modal .membership-body { max-height: calc(100vh - 104px); padding: 24px 28px 28px; }
.membership-shell-modal .membership-account-row { padding-bottom: 18px; }
.membership-shell-modal .membership-account-avatar { flex-basis: 42px; width: 42px; height: 42px; font-size: 1rem; }
.membership-shell-modal .membership-account-info strong { font-size: 0.93rem; }
.membership-shell-modal .membership-account-credit strong { font-size: 1.05rem; }
.membership-shell-modal .membership-summary { gap: 12px; margin-top: 18px; }
.membership-shell-modal .membership-summary > div { min-height: unset; justify-content: initial; padding: 14px 16px; }
.membership-shell-modal .membership-summary strong { font-size: 1.15rem; }
.membership-shell-modal .membership-section { margin-top: 20px; }
.membership-shell-modal .membership-section-heading { margin-bottom: 12px; }
.membership-shell-modal .membership-section-heading h3 { font-size: 1rem; }
.membership-shell-modal .membership-section-heading span { font-size: 0.78rem; }
.membership-shell-modal .membership-plan-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.membership-shell-modal .membership-plan-card { min-height: unset; padding: 16px; }
.membership-shell-modal .membership-plan-top { font-size: 0.8rem; }
.membership-shell-modal .membership-price { margin-top: 15px; font-size: 1.45rem; }
.membership-shell-modal .membership-price small { font-size: 0.75rem; }
.membership-shell-modal .membership-plan-card p { min-height: 38px; margin: 8px 0 16px; font-size: 0.82rem; }
.membership-shell-modal .membership-action,
.membership-shell-modal .credit-action { padding: 9px 10px; font-size: 0.82rem; }
.membership-shell-modal .credit-package-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.membership-shell-modal .membership-note { margin-top: 20px; padding: 10px 12px; font-size: 0.78rem; }
.membership-shell-modal .membership-order-preview { grid-template-columns: minmax(0, 1fr) auto auto; gap: 18px; margin-top: 18px; padding: 15px 16px; }
.membership-shell-modal .membership-order-copy strong { font-size: 0.88rem; }
.membership-shell-modal .membership-order-amount { font-size: 1.05rem; }
.membership-shell-modal .membership-order-button { min-width: 132px; padding: 9px 12px; font-size: 0.78rem; }
@media (max-width: 880px) {
    .membership-shell-modal .membership-modal-main { grid-template-columns: 210px minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .membership-shell-modal .membership-plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
    .membership-shell-modal { width: min(560px, calc(100% - 20px)); max-height: calc(100vh - 20px); }
    .membership-shell-modal .membership-modal-main { display: block; max-height: calc(100vh - 90px); overflow: auto; }
    .membership-shell-modal .membership-benefits { padding: 18px; border-right: 0; border-bottom: 1px solid var(--border); }
    .membership-shell-modal .membership-body { max-height: none; padding: 18px; overflow: visible; }
    .membership-shell-modal .membership-order-preview { grid-template-columns: 1fr auto; }
    .membership-shell-modal .membership-order-button { grid-column: 1 / -1; width: 100%; }
}
@media (max-width: 560px) {
    .membership-shell-modal .membership-summary,
    .membership-shell-modal .credit-package-grid,
    .membership-shell-modal .membership-plan-grid { grid-template-columns: 1fr; }
}

/* Compact membership modal: keep the workspace visible behind it. */
.membership-shell-modal {
    width: min(960px, calc(100% - 36px)) !important;
    max-height: min(780px, calc(100vh - 36px)) !important;
}
.membership-shell-modal .membership-modal-header {
    padding: 18px 24px 16px !important;
}
.membership-shell-modal .membership-modal-main {
    grid-template-columns: 220px minmax(0, 1fr) !important;
    min-height: 0 !important;
    max-height: calc(min(780px, 100vh - 36px) - 78px) !important;
}
.membership-shell-modal .membership-benefits {
    padding: 24px 18px 20px !important;
}
.membership-shell-modal .membership-benefits h3 {
    margin-top: 10px;
    font-size: 1.28rem;
}
.membership-shell-modal .membership-benefit-lead {
    font-size: 0.78rem;
    line-height: 1.5;
}
.membership-shell-modal .membership-benefit-list {
    gap: 12px;
    margin-top: 20px;
}
.membership-shell-modal .membership-benefit-list li {
    gap: 8px;
}
.membership-shell-modal .benefit-icon {
    flex-basis: 26px;
    width: 26px;
    height: 26px;
    font-size: 0.78rem;
}
.membership-shell-modal .membership-benefit-list strong {
    font-size: 0.78rem;
}
.membership-shell-modal .membership-benefit-list small {
    font-size: 0.68rem;
}
.membership-shell-modal .membership-signup-bonus {
    padding: 10px;
}
.membership-shell-modal .membership-body {
    max-height: calc(min(780px, 100vh - 36px) - 78px) !important;
    padding: 22px 24px 24px !important;
    overflow: auto;
}
.membership-shell-modal .membership-account-row {
    padding-bottom: 14px;
}
.membership-shell-modal .membership-account-avatar {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
}
.membership-shell-modal .membership-account-info strong {
    font-size: 0.86rem;
}
.membership-shell-modal .membership-account-info span,
.membership-shell-modal .membership-account-credit span {
    font-size: 0.7rem;
}
.membership-shell-modal .membership-account-credit strong {
    font-size: 1rem;
}
.membership-shell-modal .membership-summary {
    gap: 8px;
    margin-top: 14px;
}
.membership-shell-modal .membership-summary > div {
    min-height: 64px;
    padding: 10px 12px;
    gap: 4px;
}
.membership-shell-modal .membership-summary span {
    font-size: 0.7rem;
}
.membership-shell-modal .membership-summary strong {
    font-size: 1rem;
}
.membership-shell-modal .membership-view-switch {
    margin-top: 14px;
}
.membership-shell-modal .membership-section {
    margin-top: 16px;
}
.membership-shell-modal .membership-section-heading {
    margin-bottom: 10px;
}
.membership-shell-modal .membership-section-heading h3 {
    font-size: 0.95rem;
}
.membership-shell-modal .membership-section-heading span {
    font-size: 0.7rem;
}
.membership-shell-modal .membership-plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
}
.membership-shell-modal .membership-plan-card {
    min-height: 178px !important;
    padding: 14px;
}
.membership-shell-modal .membership-plan-top {
    font-size: 0.72rem;
}
.membership-shell-modal .membership-price {
    margin-top: 15px;
    font-size: 1.34rem;
}
.membership-shell-modal .membership-price small {
    font-size: 0.68rem;
}
.membership-shell-modal .membership-plan-card p {
    min-height: 28px;
    margin: 7px 0 10px;
    font-size: 0.72rem;
}
.membership-shell-modal .membership-action,
.membership-shell-modal .credit-action {
    padding: 8px 9px;
    font-size: 0.7rem;
}
.membership-shell-modal .credit-package-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px;
}
.membership-shell-modal .membership-note {
    margin-top: 14px;
    padding: 8px 10px;
    font-size: 0.7rem;
}
.membership-shell-modal .membership-order-preview {
    gap: 12px;
    margin-top: 14px;
    padding: 12px;
}
.membership-shell-modal .membership-order-copy > span,
.membership-shell-modal .membership-order-copy small {
    font-size: 0.68rem;
}
.membership-shell-modal .membership-order-copy strong {
    font-size: 0.78rem;
}
.membership-shell-modal .membership-order-amount {
    font-size: 0.9rem;
}
.membership-shell-modal .membership-order-button {
    min-width: 120px;
    padding: 8px 9px;
    font-size: 0.7rem;
}
@media (max-width: 680px) {
    .membership-shell-modal {
        width: calc(100% - 20px) !important;
        max-height: calc(100vh - 20px) !important;
    }
    .membership-shell-modal .membership-modal-main {
        display: block;
        max-height: calc(100vh - 82px) !important;
        overflow: auto;
    }
    .membership-shell-modal .membership-body {
        max-height: none !important;
        overflow: visible;
    }
    .membership-shell-modal .membership-plan-grid,
    .membership-shell-modal .credit-package-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Premium utility pass for the membership center. */
.membership-shell-modal {
    width: min(900px, calc(100% - 40px)) !important;
    max-height: min(700px, calc(100vh - 40px)) !important;
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.18), 0 6px 18px rgba(15, 23, 42, 0.06);
}
.membership-shell-modal .membership-modal-header {
    padding: 20px 26px 17px !important;
    border-bottom: 1px solid #e8edf3;
}
.membership-shell-modal .membership-modal-header h2 {
    font-size: 1.2rem;
    font-weight: 750;
}
.membership-shell-modal .membership-subtitle {
    margin-top: 5px;
    color: #94a3b8;
    font-size: 0.78rem;
}
.membership-shell-modal .membership-modal-main {
    grid-template-columns: 218px minmax(0, 1fr) !important;
    min-height: 0 !important;
    max-height: calc(min(700px, 100vh - 40px) - 72px) !important;
}
.membership-shell-modal .membership-benefits {
    padding: 24px 18px 18px !important;
    background: #f7f9fc;
    border-right: 1px solid #e8edf3;
}
.membership-shell-modal .membership-benefit-kicker {
    color: #64748b;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
}
.membership-shell-modal .membership-benefits h3 {
    margin: 11px 0 8px;
    color: #0f172a;
    font-size: 1.3rem;
    line-height: 1.28;
}
.membership-shell-modal .membership-benefit-lead {
    max-width: 170px;
    color: #64748b;
    font-size: 0.72rem;
    line-height: 1.55;
}
.membership-shell-modal .membership-benefit-list {
    gap: 10px;
    margin-top: 22px;
}
.membership-shell-modal .membership-benefit-list li {
    gap: 8px;
}
.membership-shell-modal .benefit-icon {
    flex-basis: 24px;
    width: 24px;
    height: 24px;
    color: #475569;
    background: var(--bg-card);
    border-color: #cbd5e1;
    font-size: 0.68rem;
}
.membership-shell-modal .membership-benefit-list strong {
    color: #334155;
    font-size: 0.73rem;
}
.membership-shell-modal .membership-benefit-list small {
    margin-top: 2px;
    color: #94a3b8;
    font-size: 0.64rem;
}
.membership-shell-modal .membership-signup-bonus {
    padding: 10px;
    background: var(--bg-card);
    border-color: #dbe3ee;
}
.membership-shell-modal .membership-signup-bonus strong {
    color: #334155;
    font-size: 0.68rem;
}
.membership-shell-modal .membership-signup-bonus span {
    color: #94a3b8;
    font-size: 0.64rem;
}
.membership-shell-modal .membership-body {
    max-height: calc(min(700px, 100vh - 40px) - 72px) !important;
    padding: 20px 24px 22px !important;
    background: var(--bg-card);
    overflow: auto;
}
.membership-shell-modal .membership-account-row {
    padding-bottom: 14px;
    border-bottom-color: #e8edf3;
}
.membership-shell-modal .membership-account-avatar {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
    color: #334155;
    background: #f1f5f9;
    border-color: #dbe3ee;
    font-size: 0.86rem;
}
.membership-shell-modal .membership-account-info strong {
    color: #0f172a;
    font-size: 0.84rem;
}
.membership-shell-modal .membership-account-info span,
.membership-shell-modal .membership-account-credit span {
    color: #94a3b8;
    font-size: 0.66rem;
}
.membership-shell-modal .membership-account-credit strong {
    color: #0f172a;
    font-size: 1rem;
}
.membership-shell-modal .membership-summary {
    gap: 8px;
    margin-top: 14px;
}
.membership-shell-modal .membership-summary > div {
    min-height: 58px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-color: #e8edf3;
    border-radius: 8px;
}
.membership-shell-modal .membership-summary span {
    color: #94a3b8;
    font-size: 0.66rem;
}
.membership-shell-modal .membership-summary strong {
    margin-top: 3px;
    color: #0f172a;
    font-size: 0.98rem;
}
.membership-shell-modal .membership-view-switch {
    margin-top: 14px;
    padding: 3px;
    background: var(--bg-secondary);
    border-color: #e8edf3;
}
.membership-shell-modal .membership-view-tab {
    min-height: 31px;
    color: #94a3b8;
    font-size: 0.76rem;
}
.membership-shell-modal .membership-view-tab.active {
    color: #0f172a;
    border-color: #dbe3ee;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.membership-shell-modal .membership-credit-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    padding: 11px 13px;
    color: #7c2d12;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
}
.membership-shell-modal .membership-credit-notice[hidden] {
    display: none;
}
.membership-credit-notice-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    color: #c2410c;
    background: #ffedd5;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 750;
}
.membership-credit-notice strong,
.membership-credit-notice p {
    display: block;
    margin: 0;
}
.membership-credit-notice strong {
    font-size: 0.78rem;
}
.membership-credit-notice p {
    margin-top: 2px;
    color: #9a3412;
    font-size: 0.72rem;
    line-height: 1.5;
}
.membership-shell-modal .membership-section {
    margin-top: 17px;
}
.membership-shell-modal .membership-section-heading {
    margin-bottom: 10px;
}
.membership-shell-modal .membership-section-heading h3 {
    color: #0f172a;
    font-size: 0.96rem;
}
.membership-shell-modal .membership-section-heading span {
    color: #94a3b8;
    font-size: 0.68rem;
}
.membership-shell-modal .membership-plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
}
.membership-shell-modal .membership-plan-card {
    min-height: 164px !important;
    padding: 14px;
    background: var(--bg-card);
    border-color: #e2e8f0;
    border-radius: 9px;
}
.membership-shell-modal .membership-plan-card.featured {
    border-color: #94a3b8;
    box-shadow: inset 0 2px 0 #0f172a;
}
.membership-shell-modal .membership-plan-card.max-plan {
    background: var(--bg-secondary);
}
.membership-shell-modal .membership-plan-top {
    color: #94a3b8;
    font-size: 0.7rem;
}
.membership-shell-modal .membership-badge {
    color: #334155;
    letter-spacing: 0.06em;
}
.membership-shell-modal .membership-price {
    margin-top: 15px;
    color: #0f172a;
    font-size: 1.32rem;
}
.membership-shell-modal .membership-price small {
    color: #94a3b8;
    font-size: 0.68rem;
}
.membership-shell-modal .membership-plan-card p {
    min-height: 24px;
    margin: 7px 0 10px;
    color: #64748b;
    font-size: 0.7rem;
}
.membership-shell-modal .membership-action,
.membership-shell-modal .credit-action {
    padding: 8px 9px;
    color: #fff;
    background: #172033;
    border-color: #172033;
    border-radius: 6px;
    font-size: 0.7rem;
}
.membership-shell-modal .membership-action:hover,
.membership-shell-modal .credit-action:hover {
    background: #334155;
    border-color: #334155;
}
.membership-shell-modal .membership-action.selected,
.membership-shell-modal .credit-action.selected {
    color: #0f172a;
    background: #e2e8f0;
    border-color: #94a3b8;
}
.membership-shell-modal .membership-note {
    margin-top: 14px;
    padding: 8px 10px;
    color: #94a3b8;
    background: var(--bg-secondary);
    border-left-color: #cbd5e1;
    font-size: 0.66rem;
}
.membership-shell-modal .membership-order-preview {
    gap: 12px;
    margin-top: 14px;
    padding: 12px;
    background: var(--bg-secondary);
    border-color: #e8edf3;
    border-radius: 8px;
}
.membership-shell-modal .membership-order-copy > span,
.membership-shell-modal .membership-order-copy small {
    color: #94a3b8;
    font-size: 0.64rem;
}
.membership-shell-modal .membership-order-copy strong {
    color: #334155;
    font-size: 0.76rem;
}
.membership-shell-modal .membership-order-amount {
    color: #0f172a;
    font-size: 0.9rem;
}
.membership-shell-modal .membership-order-button {
    min-width: 120px;
    padding: 8px 9px;
    border-radius: 6px;
    font-size: 0.7rem;
}
@media (max-width: 680px) {
    .membership-shell-modal {
        width: calc(100% - 20px) !important;
        max-height: calc(100vh - 20px) !important;
    }
    .membership-shell-modal .membership-modal-main {
        max-height: calc(100vh - 76px) !important;
    }
    .membership-shell-modal .membership-benefits {
        padding: 18px !important;
    }
    .membership-shell-modal .membership-body {
        max-height: none !important;
        padding: 18px !important;
    }
}

/* The membership body now starts directly with the plan switch. */
@media (min-width: 681px) {
    .membership-shell-modal .membership-body {
        padding-top: 14px !important;
    }
}
.membership-shell-modal .membership-view-switch {
    margin-top: 0;
}

/* Sidebar credit entry */
.sidebar-credit-widget {
    flex-shrink: 0;
    width: 60px;
    margin-top: auto;
    padding: 8px 4px 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-card);
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
    transition: var(--transition);
}
.sidebar-credit-widget:hover {
    border-color: var(--accent-light);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}
.sidebar-credit-balance {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}
.sidebar-credit-mark {
    color: var(--accent);
    font-size: 0.82rem;
}
.sidebar-credit-balance strong {
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 700;
}
.sidebar-credit-action {
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.membership-shell-modal .membership-plan-card.selected {
    border-color: #94a3b8;
    box-shadow: inset 0 2px 0 #0f172a;
}
@media (max-width: 1024px) {
    .sidebar-credit-widget {
        width: auto;
        min-width: 64px;
        margin-top: 0;
        margin-left: auto;
        padding: 7px 9px;
    }
}

/* Keep the membership sidebar copy compact and aligned at desktop widths. */
.membership-shell-modal .membership-modal-main {
    grid-template-columns: 240px minmax(0, 1fr) !important;
}
.membership-shell-modal .membership-benefits {
    padding-left: 22px !important;
    padding-right: 22px !important;
}
.membership-shell-modal .membership-benefits h3 {
    font-size: 1.22rem;
    line-height: 1.25;
    white-space: nowrap;
}
.membership-shell-modal .membership-benefit-lead {
    max-width: 205px;
}

/* Full-width generation feedback with a continuously moving activity cue. */
.progress-bar-container {
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 20px;
    padding: 11px 14px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: var(--bg-card);
}
.progress-bar-track {
    position: relative;
    height: 4px;
    overflow: hidden;
    background: #eef2f6;
    border-radius: 2px;
}
.progress-bar-fill {
    background: linear-gradient(90deg, #1e293b 0%, #475569 50%, #1e293b 100%);
    background-size: 180% 100%;
    border-radius: 2px;
    transition: width 0.45s ease;
}
.progress-bar-fill::after {
    display: none;
}
.progress-bar-container.is-active .progress-bar-fill {
    animation: progressFillFlow 1.4s linear infinite;
}
.progress-bar-container.is-active .progress-bar-track::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -18%;
    width: 18%;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, rgba(71, 85, 105, 0.48), transparent);
    animation: progressTrackSweep 1.65s ease-in-out infinite;
}
.progress-label {
    margin-top: 7px;
    color: #64748b;
    font-size: 0.75rem;
}
@keyframes progressFillFlow {
    from { background-position: 100% 0; }
    to { background-position: -80% 0; }
}
@keyframes progressTrackSweep {
    from { transform: translateX(0); }
    to { transform: translateX(660%); }
}

@media (prefers-reduced-motion: reduce) {
    .progress-bar-container.is-active .progress-bar-fill,
    .progress-bar-container.is-active .progress-bar-track::after {
        animation: none;
    }
}

.result-card-error .error-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #f1c7c7;
    border-radius: 50%;
    color: #b42318;
    background: #fff7f6;
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 1;
}
.result-card-error .error-title {
    color: #334155;
    font-size: 0.82rem;
}
.result-card-error .error-text {
    max-width: 100%;
    color: #64748b;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.result-card-error .btn-retry {
    color: #334155;
    background: var(--bg-card);
}
.result-card-error .btn-retry:hover {
    color: #0f172a;
    background: var(--bg-secondary);
    border-color: #94a3b8;
}

/* Membership plans: clear comparison and selection hierarchy. */
.membership-shell-modal .membership-plan-grid {
    gap: 12px;
}
.membership-shell-modal .membership-plan-grid .membership-plan-card {
    position: relative;
    min-height: 178px !important;
    padding: 18px 20px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid #dfe5ed;
    border-radius: 8px;
    box-shadow: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.membership-shell-modal .membership-plan-grid .membership-plan-card.max-plan {
    background: var(--bg-card);
}
.membership-shell-modal .membership-plan-grid .membership-plan-card:hover {
    border-color: #aab5c4;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}
.membership-shell-modal .membership-plan-grid .membership-plan-card.selected,
.membership-shell-modal .membership-plan-grid .membership-plan-card.featured {
    border-color: #172033;
    box-shadow: 0 0 0 1px #172033, 0 10px 26px rgba(15, 23, 42, 0.08);
}
.membership-shell-modal .membership-plan-grid .membership-plan-top {
    justify-content: flex-start;
    gap: 9px;
    min-height: 24px;
    padding-right: 28px;
    color: #7c899d;
    font-size: 0.72rem;
}
.membership-shell-modal .membership-plan-grid .membership-badge {
    color: #172033;
    font-size: 0.74rem;
    font-weight: 750;
    letter-spacing: 0;
}
.membership-shell-modal .membership-plan-term {
    margin-left: auto;
    color: #8b98ab;
    font-weight: 500;
}
.membership-shell-modal .membership-plan-saving {
    padding: 3px 7px;
    color: #875f19;
    background: #fff8e8;
    border: 1px solid #f0dfb8;
    border-radius: 5px;
    font-size: 0.64rem;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
}
.membership-shell-modal .membership-plan-selection {
    position: absolute;
    top: 17px;
    right: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #fff;
    background: #172033;
    border-radius: 50%;
    font-size: 0.68rem;
    font-weight: 700;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.16s ease, transform 0.16s ease;
}
.membership-shell-modal .membership-plan-card.selected .membership-plan-selection,
.membership-shell-modal .membership-plan-card.featured .membership-plan-selection {
    opacity: 1;
    transform: scale(1);
}
.membership-shell-modal .membership-plan-card.selected .membership-plan-term,
.membership-shell-modal .membership-plan-card.featured .membership-plan-term {
    visibility: hidden;
}
.membership-shell-modal .membership-plan-grid .membership-price {
    margin-top: 16px;
    color: #101828;
    font-size: 1.62rem;
    font-weight: 750;
    line-height: 1.12;
}
.membership-shell-modal .membership-plan-grid .membership-price small {
    margin-left: 2px;
    color: #8b98ab;
    font-size: 0.7rem;
    font-weight: 500;
}
.membership-shell-modal .membership-plan-grid .membership-plan-card p {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 22px;
    margin: 9px 0 14px;
    color: #5e6d82;
    font-size: 0.72rem;
    line-height: 1.4;
}
.membership-shell-modal .membership-plan-equivalent {
    color: #8b98ab;
    white-space: nowrap;
}
.membership-shell-modal .membership-plan-grid .membership-action {
    min-height: 36px;
    padding: 8px 12px;
    color: #334155;
    background: var(--bg-card);
    border: 1px solid #c7d0dc;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 650;
}
.membership-shell-modal .membership-plan-grid .membership-action:hover {
    color: #172033;
    background: #f7f9fc;
    border-color: #8f9cad;
}
.membership-shell-modal .membership-plan-grid .membership-action.selected {
    color: #fff;
    background: #172033;
    border-color: #172033;
}
.membership-shell-modal .membership-plan-grid .membership-action.selected:hover {
    background: #253148;
    border-color: #253148;
}
@media (max-width: 680px) {
    .membership-shell-modal .membership-plan-grid .membership-plan-card {
        min-height: 170px !important;
        padding: 16px;
    }
    .membership-shell-modal .membership-plan-selection {
        top: 15px;
        right: 15px;
    }
    .membership-shell-modal .membership-plan-saving {
        display: none;
    }
    .membership-shell-modal .membership-plan-grid .membership-plan-card p {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .membership-shell-modal .membership-plan-grid .membership-plan-card,
    .membership-shell-modal .membership-plan-selection {
        transition: none;
    }
}

/* Mobile commercial workspace: one focused step per screen. */
.mobile-workspace-switch,
.mobile-action-dock {
    display: none;
}

@media (max-width: 680px) {
    :root {
        --mobile-header-height: 60px;
        --mobile-mode-height: 62px;
        --mobile-workspace-height: 50px;
        --mobile-dock-height: 78px;
    }

    html,
    body {
        width: 100%;
        height: 100%;
        max-width: 100%;
        overflow: hidden;
        overscroll-behavior: none;
    }

    /* iOS Safari zooms the viewport when a focused form control is below 16px. */
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not([type="hidden"]),
    textarea,
    select,
    [contenteditable="true"] {
        font-size: 16px !important;
    }

    .header {
        height: var(--mobile-header-height);
        min-height: var(--mobile-header-height);
        padding: 0 12px;
        gap: 10px;
    }
    .header-left,
    .logo {
        min-width: 0;
    }
    .header-left {
        flex: 1;
    }
    .logo {
        gap: 8px;
    }
    .logo-icon img {
        width: 27px;
        height: 27px;
    }
    .logo-text {
        display: inline-flex;
        align-items: baseline;
        gap: 5px;
        max-width: none;
        overflow: visible;
        font-size: 0.94rem;
        letter-spacing: 0;
        white-space: nowrap;
    }
    .logo-text > span {
        display: inline !important;
        font-size: 0.72rem !important;
        font-weight: 400 !important;
        opacity: 0.72 !important;
    }
    .btn-header:not(.membership-header-btn) > span,
    .user-phone {
        display: none;
    }
    .header-right {
        gap: 7px;
    }
    .header-credit-widget {
        display: grid;
        grid-template-columns: auto auto;
        grid-template-rows: auto auto;
        align-content: center;
        justify-content: center;
        column-gap: 3px;
        width: 56px;
        height: 40px;
        min-width: 56px;
        padding: 3px 5px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--bg-card);
        color: #172033;
        font: inherit;
        cursor: pointer;
        touch-action: manipulation;
    }
    .header-credit-widget:active {
        background: #f1f5f9;
    }
    .header-credit-mark {
        align-self: center;
        color: #172033;
        font-size: 0.62rem;
        line-height: 1;
    }
    .header-credit-value {
        max-width: 38px;
        overflow: hidden;
        font-size: 0.68rem;
        font-weight: 750;
        line-height: 1;
        text-overflow: ellipsis;
    }
    .header-credit-label {
        grid-column: 1 / -1;
        margin-top: 2px;
        color: #64748b;
        font-size: 0.55rem;
        font-weight: 650;
        line-height: 1;
    }
    .btn-header,
    .user-profile {
        width: 40px;
        height: 40px;
        min-width: 40px;
        padding: 0;
        justify-content: center;
        border-radius: 8px;
    }
    .membership-header-btn {
        width: auto;
        min-width: 68px;
        padding: 0 7px;
        gap: 4px;
    }
    .membership-header-btn > span {
        display: inline;
        font-size: 0.68rem;
        font-weight: 600;
        white-space: nowrap;
    }
    .membership-header-btn svg {
        width: 15px;
        height: 15px;
    }
    .user-profile {
        gap: 0;
        position: relative;
        overflow: visible;
    }
    .account-menu-trigger {
        justify-content: center;
        width: 38px;
        height: 38px;
        min-height: 38px;
        padding: 0;
    }
    .user-avatar {
        width: 28px;
        height: 28px;
    }
    .account-menu-chevron {
        display: none;
    }
    .account-menu {
        top: calc(100% + 7px);
        right: -1px;
        min-width: 120px;
    }
    .btn-logout {
        position: static;
        justify-content: flex-start;
        height: auto;
        padding: 9px 10px;
        border: 0;
        border-radius: 6px;
        box-shadow: none;
        font-size: 0.72rem;
    }

    .app-body {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: calc(100dvh - var(--mobile-header-height));
        min-height: 0;
        overflow: hidden;
    }
    .sidebar {
        display: flex;
        flex: 0 0 var(--mobile-mode-height);
        flex-direction: row;
        align-items: stretch;
        width: 100%;
        height: var(--mobile-mode-height);
        max-width: 100%;
        padding: 3px 8px;
        gap: 4px;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        scrollbar-width: none;
        transition: flex-basis 0.2s ease, height 0.2s ease, padding 0.2s ease,
            border-color 0.2s ease, opacity 0.16s ease, transform 0.2s ease;
    }
    .app-body.mobile-mode-nav-hidden .sidebar {
        flex-basis: 0;
        height: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-bottom-color: transparent;
        opacity: 0;
        transform: translateY(-8px);
        pointer-events: none;
    }
    .sidebar::-webkit-scrollbar {
        display: none;
    }
    .sidebar-item {
        /* Fill the mobile nav row instead of capping each tab at 88px. */
        flex: 1 1 66px;
        width: auto;
        min-width: 66px;
        max-width: none;
        height: 55px;
        padding: 4px 6px 5px;
        gap: 1px;
        border-radius: 7px;
        touch-action: manipulation;
    }
    .sidebar-icon {
        width: 28px;
        height: 28px;
    }
    .sidebar-icon svg {
        width: 20px;
        height: 20px;
    }
    .sidebar-item span {
        font-size: 0.62rem;
        line-height: 1.2;
        letter-spacing: 0;
    }
    .sidebar-item.active::before {
        left: 12px;
        right: 12px;
        top: auto;
        bottom: 0;
        width: auto;
        height: 2px;
        border-radius: 2px 2px 0 0;
    }
    .sidebar-credit-widget {
        display: none;
    }
    .sidebar-credit-widget:active {
        transform: translateY(0);
        background: #f1f5f9;
    }
    .sidebar-credit-balance {
        gap: 3px;
    }
    .sidebar-credit-mark {
        color: #172033;
        font-size: 0.68rem;
    }
    .sidebar-credit-balance strong {
        max-width: 39px;
        overflow: hidden;
        color: #172033;
        font-size: 0.72rem;
        font-weight: 750;
        text-overflow: ellipsis;
    }
    .sidebar-credit-action {
        color: #64748b;
        font-size: 0.59rem;
        font-weight: 650;
    }

    .main {
        position: relative;
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        width: 100%;
        min-width: 0;
        min-height: 0;
        overflow: hidden;
    }
    .mobile-workspace-switch {
        display: grid;
        flex: 0 0 var(--mobile-workspace-height);
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
        height: var(--mobile-workspace-height);
        padding: 5px 10px;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        z-index: 40;
    }
    .mobile-workspace-tab {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        min-width: 0;
        min-height: 40px;
        padding: 0 12px;
        border: 0;
        border-radius: 6px;
        background: transparent;
        color: #7b8798;
        font: inherit;
        font-size: 0.78rem;
        font-weight: 650;
        cursor: pointer;
        outline: none;
        touch-action: manipulation;
    }
    .mobile-workspace-tab.active {
        color: #172033;
        background: #f1f4f8;
    }
    .mobile-workspace-tab.active::after {
        content: '';
        position: absolute;
        right: 24px;
        bottom: 2px;
        left: 24px;
        height: 2px;
        border-radius: 2px;
        background: #172033;
    }
    .mobile-workspace-tab:focus-visible {
        box-shadow: inset 0 0 0 2px #8a98aa;
    }
    .mobile-result-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 20px;
        height: 20px;
        padding: 0 5px;
        border-radius: 10px;
        color: #fff;
        background: #172033;
        font-size: 0.66rem;
        line-height: 1;
    }
    .mobile-result-count[hidden] {
        display: none;
    }

    .panel-left,
    .panel-right {
        flex: 1 1 0;
        width: 100%;
        min-width: 0;
        min-height: 0;
        max-width: 100%;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto !important;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .panel-left::-webkit-scrollbar,
    .panel-right::-webkit-scrollbar {
        display: none;
    }
    .main.mobile-view-settings .panel-right,
    .main.mobile-view-results .panel-left {
        display: none;
    }
    .panel-left {
        padding: 10px 10px calc(var(--mobile-dock-height) + env(safe-area-inset-bottom) + 14px);
        gap: 8px;
        background: #f5f7fa;
        border-right: 0;
        border-bottom: 0;
    }
    .panel-right {
        padding: 15px 12px calc(var(--mobile-dock-height) + env(safe-area-inset-bottom) + 14px);
        background: var(--bg-card);
    }

    .panel-left > .section {
        margin: 0;
        padding: 14px;
        border-radius: 8px;
        box-shadow: none;
    }
    .section:hover {
        border-color: var(--border);
    }
    .section-title {
        min-height: 28px;
        margin-bottom: 10px;
    }
    .section-title h2 {
        font-size: 0.92rem;
    }
    .tooltip-trigger {
        width: 30px;
        height: 30px;
    }
    .upload-area {
        min-height: 150px;
        padding: 20px 14px;
        border-radius: 7px;
    }
    .upload-icon {
        margin-bottom: 7px;
    }
    .upload-icon svg {
        width: 30px;
        height: 30px;
    }
    .upload-text {
        font-size: 0.84rem;
    }
    .upload-hint {
        font-size: 0.68rem;
        line-height: 1.45;
    }
    .upload-preview {
        gap: 8px;
        margin-top: 10px;
    }
    .preview-item {
        width: 72px;
        height: 72px;
    }
    .preview-remove {
        width: 26px;
        height: 26px;
        opacity: 1;
    }
    .model-upload-area {
        min-height: 118px;
        padding: 16px 12px;
    }

    .settings-grid.platform-settings-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 7px;
    }
    .settings-grid.product-name-grid {
        grid-template-columns: 1fr !important;
    }
    .select-wrapper,
    .settings-text-input {
        min-width: 0;
    }
    .platform-settings-grid .select-wrapper,
    .platform-settings-grid select {
        height: 44px;
        min-height: 44px;
    }
    .platform-settings-grid select {
        padding-right: 24px;
        padding-left: 10px;
        font-size: 0.74rem;
    }
    .settings-text-input {
        min-height: 46px;
        font-size: 0.84rem !important;
        line-height: 1.4;
    }
    #coreKeywords,
    #modelPrompt {
        font-size: 0.84rem !important;
    }
    .settings-text-input::placeholder {
        font-size: 0.84rem;
    }
    .input-field label {
        font-size: 0.76rem;
    }
    .textarea-wrapper textarea {
        min-height: 148px;
        padding: 11px;
        font-size: 0.82rem !important;
        line-height: 1.6;
    }
    .textarea-wrapper textarea::placeholder {
        font-size: 0.8rem;
    }
    .btn-ai {
        min-height: 34px;
        padding: 0 10px;
    }
    .module-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 7px;
    }
    .module-item {
        min-width: 0;
        min-height: 72px;
        padding: 9px;
        gap: 8px;
        border-radius: 7px;
    }
    .module-check {
        flex: 0 0 24px;
        width: 24px;
        height: 24px;
    }
    .module-info {
        min-width: 0;
    }
    .module-info strong {
        font-size: 0.74rem;
        line-height: 1.35;
    }
    .module-info small {
        display: -webkit-box;
        overflow: hidden;
        font-size: 0.62rem;
        line-height: 1.35;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }
    .generation-cost-hint {
        padding-top: 10px;
        font-size: 0.66rem;
        line-height: 1.45;
    }

    .results-header {
        display: block;
        width: 100%;
        margin-bottom: 12px;
    }
    .results-header h1 {
        font-size: 1.15rem;
        line-height: 1.35;
        letter-spacing: 0;
    }
    .results-header p {
        margin-top: 5px;
        font-size: 0.72rem;
        line-height: 1.55;
    }
    .results-header-actions {
        display: flex !important;
        flex-direction: column;
        align-items: stretch !important;
        width: 100%;
        margin-top: 11px;
        gap: 8px !important;
    }
    .generate-action-area {
        display: none;
    }
    .generate-action-area #generateBtn {
        display: none;
    }
    .size-selector-badge,
    .generate-ratio-select {
        width: 100%;
    }
    .generate-ratio-select,
    .generate-ratio-select select {
        min-height: 42px;
    }
    .results-header-actions > div:last-child {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px !important;
    }
    .results-export-actions {
        width: 100%;
        flex-basis: auto;
    }
    #downloadAllBtn {
        order: 1;
    }
    #previewAllBtn {
        order: 2;
    }
    .btn-download-all {
        justify-content: center;
        min-width: 0;
        min-height: 40px;
        padding: 8px 10px;
        font-size: 0.7rem;
    }
    .progress-bar-container {
        position: relative;
        top: auto;
        width: 100%;
        margin: 0 0 12px;
        padding: 10px 11px;
        border-radius: 7px;
        z-index: auto;
    }
    .progress-label {
        font-size: 0.68rem;
        line-height: 1.45;
    }
    .results-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 12px;
    }
    .result-card,
    .skeleton-card,
    .prompt-card {
        border-radius: 8px;
    }
    .result-card:hover {
        transform: none;
        box-shadow: none;
        border-color: var(--border);
    }
    .result-card-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(15, 23, 42, 0.68), transparent 42%);
        pointer-events: none;
    }
    .result-card-overlay button,
    .result-card-overlay a {
        pointer-events: auto;
    }
    .result-card-overlay {
        padding: 12px;
        gap: 6px;
    }
    .btn-card {
        min-height: 34px;
        padding: 7px 10px;
        font-size: 0.72rem;
    }
    .empty-state {
        min-height: 300px;
        padding: 48px 18px;
    }
    .empty-illustration {
        margin-bottom: 14px;
        transform: scale(0.8);
    }

    .kit-showcase {
        padding: 8px 0 18px;
    }
    .kit-showcase-heading {
        margin: 2px auto 14px;
    }
    .kit-showcase-heading h2 {
        font-size: 1.3rem;
        letter-spacing: 0;
    }
    .kit-showcase-heading p {
        margin-top: 6px;
        padding: 0 8px;
        font-size: 0.7rem;
        line-height: 1.5;
    }
    .kit-showcase-board {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
        border-radius: 8px;
        box-shadow: none;
    }
    .kit-main-tile {
        min-height: 224px;
        border-radius: 7px;
    }
    .kit-flow-arrow {
        display: none;
    }
    .kit-side-grid {
        gap: 8px;
    }
    .kit-side-tile {
        border-radius: 7px;
    }
    .kit-tile-label {
        padding: 5px 8px;
        font-size: 0.58rem;
    }

    .mobile-action-dock {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: center;
        gap: 8px;
        min-height: calc(var(--mobile-dock-height) + env(safe-area-inset-bottom));
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.97);
        border-top: 1px solid #dce3ec;
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
        z-index: 80;
    }
    .mobile-size-selector {
        position: relative;
        min-width: 0;
        height: 48px;
    }
    .mobile-size-selector select {
        display: none !important;
    }
    .mobile-size-trigger {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
        height: 100%;
        min-width: 0;
        padding: 0 11px;
        overflow: hidden;
        border: 1px solid #cfd7e3;
        border-radius: 7px;
        background: var(--bg-card);
        color: #172033;
        font-family: inherit;
        font-size: 0.72rem;
        font-weight: 600;
        outline: none;
        cursor: pointer;
    }
    .mobile-size-trigger > span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-size-trigger:focus-visible,
    .mobile-size-selector.open .mobile-size-trigger {
        border-color: #172033;
        box-shadow: 0 0 0 2px rgba(23, 32, 51, 0.1);
    }
    .mobile-size-arrow {
        flex: 0 0 auto;
        color: #7f8ca0;
        pointer-events: none;
        transition: transform 0.18s ease;
    }
    .mobile-size-selector.open .mobile-size-arrow {
        transform: rotate(180deg);
    }
    .mobile-size-menu {
        position: absolute;
        right: 0;
        bottom: calc(100% + 8px);
        left: 0;
        max-height: min(248px, 42vh);
        padding: 5px;
        overflow-y: auto;
        border: 1px solid #d5dde8;
        border-radius: 8px;
        background: var(--bg-card);
        box-shadow: 0 -12px 30px rgba(15, 23, 42, 0.14);
        z-index: 140;
    }
    .mobile-size-menu[hidden] {
        display: none;
    }
    .mobile-size-option {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 39px;
        padding: 7px 9px;
        border: 0;
        border-radius: 6px;
        background: transparent;
        color: #475569;
        font: inherit;
        font-size: 0.7rem;
        text-align: left;
        cursor: pointer;
    }
    .mobile-size-option:hover,
    .mobile-size-option.selected {
        background: #f1f5f9;
        color: #172033;
    }
    .mobile-size-option.selected {
        font-weight: 700;
    }
    .mobile-generate-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        min-height: 48px;
        padding: 0 9px;
        overflow: hidden;
        border: 1px solid #172033;
        border-radius: 7px;
        background: #172033;
        color: #fff;
        font: inherit;
        font-size: 0.72rem;
        font-weight: 700;
        cursor: pointer;
        touch-action: manipulation;
    }
    .mobile-generate-content,
    .mobile-generate-loading {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-width: 0;
    }
    .mobile-generate-content svg {
        width: 16px;
        height: 16px;
        flex: 0 0 auto;
    }
    .mobile-generate-content[hidden],
    .mobile-generate-loading[hidden] {
        display: none;
    }
    .mobile-generate-content span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-generate-button:disabled {
        border-color: #7b8494;
        background: #7b8494;
        cursor: wait;
    }

    .toast-container {
        top: auto !important;
        right: 12px;
        bottom: calc(var(--mobile-dock-height) + env(safe-area-inset-bottom) + 12px);
        left: 12px;
        width: auto;
        max-width: none;
    }
    .toast {
        width: 100%;
        max-width: none;
        min-height: 50px;
        padding: 10px 12px;
        border-radius: 8px;
    }

    .lightbox-overlay {
        width: 100%;
        height: 100dvh;
        padding: 52px 8px 16px;
        background: rgba(4, 8, 15, 0.94);
        backdrop-filter: none;
        touch-action: pinch-zoom;
    }
    .lightbox-img {
        max-width: 100%;
        max-height: calc(100dvh - 76px);
        border-radius: 7px;
    }
    .lightbox-close {
        top: max(8px, env(safe-area-inset-top));
        right: 8px;
        width: 40px;
        height: 40px;
        border-radius: 7px;
        background: rgba(255, 255, 255, 0.14);
    }
    .stitched-preview-overlay {
        padding: 0;
    }
    .stitched-preview-dialog {
        width: 100%;
        height: 100dvh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    .stitched-preview-header {
        min-height: calc(58px + env(safe-area-inset-top));
        padding: calc(8px + env(safe-area-inset-top)) 10px 8px 14px;
    }
    .stitched-preview-scroll {
        padding: 8px;
    }
    .stitched-preview-canvas {
        width: 100%;
        box-shadow: none;
    }

    .modal-overlay,
    .auth-modal-overlay {
        align-items: flex-end;
        padding: 8px 8px 0;
    }
    .modal:not(.membership-modal),
    .auth-modal {
        width: 100%;
        max-width: 100%;
        max-height: calc(100dvh - 8px);
        margin: 0;
        overflow-y: auto;
        border-radius: 12px 12px 0 0;
    }
    .image-edit-dialog {
        overflow: hidden !important;
    }
    .image-edit-header,
    .image-edit-body,
    .image-edit-footer {
        padding-right: 18px;
        padding-left: 18px;
    }
    .image-edit-reference {
        grid-template-columns: 68px minmax(0, 1fr);
    }
    .image-edit-reference img {
        width: 68px;
    }
    .image-edit-field textarea {
        min-height: 118px;
        font-size: 1rem;
    }
    .image-edit-footer .btn-primary,
    .image-edit-footer .btn-secondary {
        min-height: 44px;
    }
    .image-edit-cost {
        width: 100%;
        margin: 0 0 2px;
    }
    .auth-modal {
        transform: translateY(24px);
    }
    .auth-modal-overlay.open .auth-modal {
        transform: translateY(0);
    }
    .auth-modal-orb {
        display: none;
    }
    .auth-modal-header {
        padding: 24px 20px 16px;
    }
    .auth-tabs-wrapper,
    .auth-inline-message {
        margin-right: 20px;
        margin-left: 20px;
    }
    .auth-form-body,
    .auth-modal-footer {
        padding-right: 20px;
        padding-left: 20px;
    }
    .auth-input,
    .auth-submit-btn,
    .auth-tab {
        min-height: 46px;
    }

    .membership-shell-modal {
        width: 100% !important;
        max-width: 100% !important;
        max-height: calc(100dvh - 8px) !important;
        margin: 0;
        border-radius: 12px 12px 0 0 !important;
    }
    .membership-shell-modal .membership-modal-header {
        position: sticky;
        top: 0;
        padding: 15px 16px 12px !important;
        background: rgba(255, 255, 255, 0.98);
        z-index: 20;
    }
    .membership-shell-modal .membership-modal-header h2 {
        font-size: 1.05rem;
    }
    .membership-shell-modal .membership-subtitle {
        margin-top: 3px;
        font-size: 0.7rem;
    }
    .membership-shell-modal .membership-modal-main {
        display: block !important;
        max-height: calc(100dvh - 70px) !important;
        overflow-y: auto !important;
    }
    .membership-shell-modal .membership-benefits {
        display: none;
    }
    .membership-shell-modal .membership-body {
        max-height: none !important;
        padding: 12px 12px calc(18px + env(safe-area-inset-bottom)) !important;
        overflow: visible !important;
    }
    .membership-shell-modal .membership-view-switch {
        position: sticky;
        top: 0;
        gap: 3px;
        padding: 3px;
        background: #f3f6f9;
        z-index: 12;
    }
    .membership-shell-modal .membership-view-tab {
        min-height: 42px;
        padding: 0 6px;
        font-size: 0.7rem;
    }
    .membership-shell-modal .membership-section {
        margin-top: 14px;
    }
    .membership-shell-modal .membership-section-heading {
        align-items: flex-start;
        gap: 6px;
    }
    .membership-shell-modal .membership-section-heading h3 {
        font-size: 0.9rem;
    }
    .membership-shell-modal .membership-section-heading span {
        max-width: 48%;
        font-size: 0.64rem;
        line-height: 1.4;
        text-align: right;
    }
    .membership-shell-modal .membership-plan-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px;
    }
    .membership-shell-modal .membership-plan-grid .membership-plan-card {
        min-height: 164px !important;
        padding: 13px 12px;
    }
    .membership-shell-modal .membership-plan-grid .membership-price {
        margin-top: 12px;
        font-size: 1.28rem;
    }
    .membership-shell-modal .membership-plan-grid .membership-plan-card p {
        min-height: 38px;
        margin: 7px 0 10px;
        font-size: 0.66rem;
    }
    .membership-shell-modal .membership-plan-grid .membership-action {
        min-height: 38px;
        font-size: 0.66rem;
    }
    .membership-shell-modal .credit-package-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(205px, 1fr)) !important;
        gap: 8px;
        padding-bottom: 5px;
        overflow-x: auto;
        scroll-snap-type: x proximity;
    }
    .membership-shell-modal .credit-package-grid .credit-card {
        min-height: 152px;
        scroll-snap-align: start;
    }
    .membership-payment-panel {
        grid-template-columns: 140px minmax(0, 1fr);
        justify-items: stretch;
        gap: 14px;
        padding: 14px;
        text-align: left;
    }
    .membership-payment-qr-wrap {
        width: 140px;
        height: 140px;
    }
    .membership-payment-qr {
        width: 126px;
        height: 126px;
    }
    .membership-payment-title strong {
        font-size: 1.35rem;
    }
    .membership-payment-method {
        margin: 10px 0 8px;
    }
    .membership-payment-method-copy span,
    .membership-payment-hint {
        display: none;
    }
}

@media (max-width: 359px) {
    .sidebar-item {
        flex-basis: 62px;
        min-width: 62px;
    }
    .module-grid {
        grid-template-columns: 1fr !important;
    }
    .membership-payment-panel {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }
}

@media (max-width: 680px) and (max-height: 620px) {
    :root {
        --mobile-mode-height: 54px;
        --mobile-dock-height: 68px;
    }
    .sidebar-item {
        height: 47px;
        flex-direction: row;
    }
    .sidebar-icon {
        width: 24px;
        height: 24px;
    }
    .sidebar-credit-widget {
        height: 46px;
    }
    .mobile-action-dock {
        padding-top: 7px;
        padding-bottom: calc(7px + env(safe-area-inset-bottom));
    }
    .mobile-generate-button {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-generate-button,
    .mobile-workspace-tab,
    .auth-modal {
        transition: none;
    }
}

/* ============================================
   Console Showcase Preview (Empty State)
   ============================================ */

.empty-state {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
}

.showcase-intro {
    padding: 28px 32px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.showcase-intro-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

.showcase-intro h3 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.showcase-intro h3 em {
    font-style: normal;
    color: #2563eb;
}

.showcase-intro p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.showcase-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    padding: 24px 32px 28px;
    flex: 1;
    background: var(--bg-secondary);
}

.showcase-main-col {
    display: flex;
    flex-direction: column;
}

.showcase-img-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.showcase-img-card:hover {
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

.showcase-main-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.showcase-main-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    min-height: 260px;
}

.showcase-thumb-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 1rem;
}

.showcase-thumb-grid .showcase-img-card {
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.showcase-thumb-grid .showcase-img-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.showcase-thumb-grid .showcase-img-card:hover img {
    transform: scale(1.05);
}

.showcase-label {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: var(--text-primary);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    z-index: 2;
    letter-spacing: 0.2px;
}

.showcase-arrow-badge {
    position: absolute;
    right: 14px;
    bottom: 14px;
    width: 36px;
    height: 36px;
    background: var(--text-primary);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

/* When results are present, hide the showcase and show normal grid */
.results-grid:has(.result-item) .empty-state {
    display: none;
}

@media (max-width: 900px) {
    .showcase-layout {
        grid-template-columns: 1fr;
        padding: 16px 16px 20px;
    }
    .showcase-intro {
        padding: 16px 16px 14px;
    }
    .showcase-main-card {
        min-height: 200px;
    }
    .showcase-main-card img {
        min-height: 200px;
    }
}


