:root {
    --bg-primary: #EAF1F8;
    --bg-secondary: #EEF4FA;
    --bg-tertiary: #E6EDF6;
    --bg-elevated: #F7FAFD;
    --bg-hover: #DDE7F2;
    --border-color: #D4DFEC;
    --border-subtle: #DCE6F2;
    --text-primary: #102033;
    --text-secondary: #5B6B80;
    --text-muted: #7A8BA3;
    --accent: #2563EB;
    --accent-hover: #1D4ED8;
    --accent-glow: rgba(37, 99, 235, 0.1);
    --accent-gradient: linear-gradient(135deg, #2563EB, #3B82F6);
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.1);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.06);
    --transition: 0.2s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

body.app-body { overflow: hidden; }

body.tool-page-body { overflow-y: auto; overflow-x: hidden; }

.app-shell {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 240px;
    background: #E3EBF5;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 8px rgba(37, 99, 235, 0.3));
}

.logo-text {
    font-size: 17px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.3px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.nav-section-label {
    padding: 16px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    margin: 1px 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent-hover);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 11px;
    color: var(--text-muted);
}

.logout-btn {
    padding: 6px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
}

.logout-btn:hover {
    background: rgba(248, 113, 113, 0.1);
    border-color: var(--danger);
    color: var(--danger);
    transform: none;
    box-shadow: none;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.app-shell.fullscreen-mode .sidebar {
    display: none;
}

.app-shell.fullscreen-mode .main-content {
    width: 100%;
}

#login.panel.active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: var(--bg-primary);
    overflow-y: auto;
}


.panel {
    display: none;
    height: 100%;
    flex-direction: column;
}

.panel.active {
    display: flex;
}

.panel-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.panel-title-group h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    margin-bottom: 2px;
}

.panel-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

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

.provider-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.5);
}

.provider-badge.offline .badge-dot {
    background: var(--danger);
    box-shadow: 0 0 6px rgba(248, 113, 113, 0.5);
}

.btn-icon {
    padding: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}
.btn-wallet-refresh {
    opacity: 0.5;
    padding: 6px;
    border: none;
    background: transparent;
}
.btn-wallet-refresh:hover {
    opacity: 1;
    background: transparent;
}

.chat-wrapper, .chat-layout-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 12px;
    opacity: 0.7;
    padding: 40px 0;
}

.chat-welcome h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-welcome p {
    font-size: 14px;
    color: var(--text-muted);
}

.welcome-icon {
    opacity: 0.8;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.chat-message {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    max-width: 75%;
    font-size: 14px;
    line-height: 1.55;
    animation: msgIn 0.25s ease;
    word-wrap: break-word;
}

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

.chat-message.user {
    background: var(--accent);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-message.system {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--danger);
    text-align: center;
    max-width: 100%;
    font-size: 13px;
}

.chat-composer {
    padding: 16px 28px 20px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.composer-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px 4px 4px 16px;
    transition: border-color var(--transition);
}

.composer-inner:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.composer-inner input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    padding: 10px 0;
    outline: none;
    width: 100%;
    margin: 0;
}

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

.composer-actions {
    display: flex;
    gap: 4px;
}

.btn-send, .btn-stream {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.btn-send {
    background: var(--accent);
    color: white;
}

.btn-send:hover {
    background: var(--accent-hover);
    transform: none;
    box-shadow: 0 0 12px var(--accent-glow);
}

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

.btn-stream:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

.request-id-inline {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.config-banner {
    margin: 16px 28px 0;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: var(--warning);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-card {
    max-width: 420px;
    margin: 32px auto;
    padding: 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.auth-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    padding: 6px 10px;
    margin: -8px 0 12px -10px;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
}
.auth-back-btn:hover {
    color: var(--accent);
    background: var(--accent-glow);
}
.auth-back-btn svg { flex-shrink: 0; }

.auth-mode-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    padding: 8px 14px;
    background: var(--accent-glow);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: var(--radius-sm);
    width: fit-content;
}

.badge-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.badge-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-hover);
    font-family: 'JetBrains Mono', monospace;
}

.auth-tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.auth-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.auth-tab.active {
    background: var(--accent);
    color: #fff;
}

.auth-tab:hover:not(.active) {
    background: var(--bg-elevated);
}

.auth-switch-link {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
}

.auth-switch-link a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
}

.auth-switch-link a:hover {
    text-decoration: underline;
}

.auth-shared-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 8px;
    background: var(--accent-glow);
    border-radius: var(--radius-sm);
}

.auth-feedback {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
    margin: 2px 0 4px;
    animation: authFeedbackIn 0.25s ease;
}

.auth-feedback.feedback-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #dc2626;
}

.auth-feedback.feedback-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #16a34a;
}

.auth-feedback.feedback-info {
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.2);
    color: var(--accent);
}

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

[data-theme="dark"] .auth-feedback.feedback-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

[data-theme="dark"] .auth-feedback.feedback-success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

[data-theme="dark"] .auth-feedback.feedback-info {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
}

.captcha-container {
    display: flex;
    justify-content: center;
    margin: 4px 0;
}

.verify-email-icon {
    text-align: center;
    font-size: 48px;
    margin-bottom: 8px;
}

.verify-email-title {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.verify-email-desc {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 16px;
    line-height: 1.5;
}

.dev-code-banner {
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 8px;
}

.dev-code-banner strong {
    color: var(--text-primary);
    font-size: 16px;
    letter-spacing: 3px;
    font-family: monospace;
}

.verify-resend-area {
    text-align: center;
    margin-top: 8px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    padding: 4px 8px;
}

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

.btn-link:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    text-decoration: none;
}

.resend-cooldown {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 8px;
}

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

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth), background var(--transition-smooth);
    margin: 0;
    font-family: inherit;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px rgba(37, 99, 235, 0.06);
    background: var(--bg-elevated);
}

.input-group textarea {
    min-height: 90px;
    resize: vertical;
}

.auth-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.btn-primary {
    padding: 10px 22px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35), 0 0 40px rgba(37, 99, 235, 0.1);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
    filter: brightness(0.95);
}

.btn-primary:disabled, .btn-primary.auth-loading {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
    filter: none;
}

.btn-secondary {
    padding: 10px 22px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

.btn-small {
    padding: 6px 14px;
    font-size: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-small:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

.media-card {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    overflow-y: auto;
}

.result-area {
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-height: 60px;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 28px 28px;
    overflow-y: auto;
}

.media-card .result-area {
    margin: 0;
}

.wallet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 20px 28px;
}

.stat-card {
    padding: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.stat-card.accent {
    border-color: rgba(37, 99, 235, 0.3);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.04));
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.wallet-content {
    padding-top: 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.wallet-shared-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 28px 20px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--accent-glow), rgba(124, 58, 237, 0.04));
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.wallet-shared-banner svg { flex-shrink: 0; color: var(--accent); }

.wallet-cards-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 0 28px 20px;
}

.wallet-card {
    padding: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
}
.wallet-card-accent {
    border-color: rgba(37, 99, 235, 0.3);
    background: linear-gradient(135deg, var(--accent-glow), rgba(37, 99, 235, 0.04));
}
.wallet-card-icon { margin-bottom: 8px; color: var(--text-muted); }
.wallet-card-accent .wallet-card-icon { color: var(--accent); }
.wallet-card-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.wallet-card-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.wallet-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 0 28px 20px;
}
.wallet-detail-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}
.wallet-detail-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
}
.wallet-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}
.wallet-detail-row:last-child { border-bottom: none; }
.wallet-detail-label { font-size: 13px; color: var(--text-secondary); }
.wallet-detail-value { font-size: 13px; font-weight: 600; color: var(--text-primary); }

.wallet-usage-progress-section {
    padding: 0 28px 20px;
}
.wallet-usage-progress-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.wallet-usage-bar-container {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
}
.wallet-usage-bar {
    width: 100%;
    height: 14px;
    background: var(--bg-secondary);
    border-radius: 7px;
    overflow: hidden;
}
.wallet-usage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #6366f1);
    border-radius: 7px;
    transition: width 0.6s ease;
    min-width: 0;
}
.wallet-usage-bar-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.wallet-plans-full-section {
    padding: 0 28px 20px;
}
.wallet-plans-full-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.wallet-plans-intro {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 16px;
    line-height: 1.5;
}

.wallet-credits-full-section {
    padding: 0 28px 20px;
}
.wallet-credits-full-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
}
.wallet-credits-explainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}
.wallet-credits-explainer-card {
    display: flex;
    gap: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}
.wallet-credits-explainer-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-glow);
    border-radius: 10px;
    color: var(--accent);
}
.wallet-credits-explainer-card strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.wallet-credits-explainer-card p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.wallet-transactions-section { padding: 0 28px 20px; }
.wallet-transactions-area {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    min-height: 60px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    font-family: 'JetBrains Mono', monospace;
}
.wallet-empty-state {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-family: var(--font-sans);
}

.admin-subtabs {
    display: flex;
    gap: 4px;
    padding: 4px 28px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}
.admin-subtab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s, border-color 0.2s;
}
.admin-subtab:hover { color: var(--text-primary); }
.admin-subtab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.admin-sub-panel { display: none; }
.admin-sub-panel.active { display: block; }

.admin-billing-entry {
    text-align: center;
    padding: 40px 28px;
}
.admin-billing-entry-icon {
    margin-bottom: 16px;
    color: #7c3aed;
}
.admin-billing-entry h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.admin-billing-entry p {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto 24px;
    line-height: 1.6;
}
.admin-billing-launch-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}
.admin-billing-launch-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px 12px;
}

.section-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 20px 28px;
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.action-card:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.15);
}

.action-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.action-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.setup-panel {
    padding: 0 28px 28px;
}

.setup-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 24px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.setup-table th,
.setup-table td {
    padding: 11px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
}

.setup-table th {
    background: var(--bg-elevated);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.status-ok {
    color: var(--success);
    font-weight: 600;
}

.status-missing {
    color: var(--danger);
    font-weight: 600;
}

.muted-text {
    font-size: 13px;
    color: var(--text-muted);
    padding: 12px 28px 0;
}

.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    max-width: 400px;
    z-index: 1000;
    display: none;
}

.error-box {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: var(--radius-md);
    padding: 14px 40px 14px 16px;
    color: var(--danger);
    font-size: 13px;
    line-height: 1.5;
    backdrop-filter: blur(12px);
    animation: slideIn 0.3s ease;
    position: relative;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.error-box strong {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    background: rgba(248, 113, 113, 0.15);
    padding: 2px 6px;
    border-radius: 3px;
}

.error-box button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    color: var(--danger);
    padding: 4px 8px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    opacity: 0.7;
}

.error-box button:hover {
    opacity: 1;
    transform: none;
    box-shadow: none;
}

.nav-section-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}
.nav-toggle-arrow {
    transition: transform 0.2s;
    opacity: 0.5;
}
.nav-section-toggle.collapsed .nav-toggle-arrow {
    transform: rotate(-90deg);
}
.nav-group-create {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.nav-group-collapsed {
    max-height: 0;
}

.mp-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #D4DFEC;
    background: #FFFFFF;
    color: #5B6B80;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.mp-chip:hover {
    border-color: #2563EB;
    color: #2563EB;
}
.mp-chip.active {
    background: #DBEAFE;
    border-color: #2563EB;
    color: #2563EB;
    font-weight: 600;
}

.agent-chip {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #D4DFEC;
    background: #FFFFFF;
    color: #5B6B80;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.agent-chip:hover {
    border-color: #2563EB;
    color: #2563EB;
    background: #EEF2FF;
}

.neo-agent-thinking {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-style: italic;
}
.neo-agent-thinking::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(166, 11, 227, 0.2);
    border-top-color: rgba(166, 11, 227, 0.7);
    border-radius: 50%;
    animation: neoAgentSpin 0.8s linear infinite;
}
@keyframes neoAgentSpin {
    to { transform: rotate(360deg); }
}

.chat-message.assistant .msg-content h3,
.chat-message.assistant .msg-content h4 {
    margin: 12px 0 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.chat-message.assistant .msg-content ul {
    margin: 6px 0;
    padding-left: 20px;
}
.chat-message.assistant .msg-content li {
    margin: 3px 0;
}
.chat-message.assistant .msg-content code {
    background: rgba(37, 99, 235, 0.08);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 13px;
}
.chat-message.assistant .msg-content pre {
    background: var(--bg-secondary, #f1f5f9);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 13px;
}
.chat-message.assistant .msg-content pre code {
    background: none;
    padding: 0;
}

.intro-overlay, .transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.intro-overlay video, .transition-overlay video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.transition-overlay {
    z-index: 99998;
    animation: fadeIn 0.15s ease;
}

.panel-accent-marketplace { background: #F8FAFD; }
.panel-accent-dashboard { background: #F2F6FB; }
.panel-accent-agent { background: #F5F7FF; }
.panel-accent-category { background: #F4F8FC; }

#image.panel { background: linear-gradient(180deg, #F8F5FF 0%, #F4F0FC 100%); }
#image.panel .panel-header { background: #F8F5FF; }
#video.panel { background: linear-gradient(180deg, #F0F6FF 0%, #EBF2FC 100%); }
#video.panel .panel-header { background: #F0F6FF; }
#audio.panel { background: linear-gradient(180deg, #F0FBF6 0%, #ECFAF2 100%); }
#audio.panel .panel-header { background: #F0FBF6; }
#models.panel { background: #F3F6FA; }
#models.panel .panel-header { background: #F3F6FA; }
#wallet.panel .panel-header { background: #F5F8FC; }
#history.panel .panel-header { background: #F5F8FC; }

.neo-agent-cta {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    background: linear-gradient(135deg, #2563EB, #3B82F6);
    color: #FFFFFF;
    border: none;
    border-radius: 48px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35), 0 0 0 0 rgba(37, 99, 235, 0.3);
    transition: box-shadow 0.3s ease;
    animation: neoAgentFloat 4s ease-in-out infinite, neoAgentBreath 3s ease-in-out infinite;
}
.neo-agent-cta:hover {
    box-shadow: 0 6px 28px rgba(37, 99, 235, 0.45);
    animation: none;
    transform: translateY(-2px);
}
.neo-agent-cta svg {
    flex-shrink: 0;
}

@keyframes neoAgentFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes neoAgentBreath {
    0%, 100% { box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3), 0 0 0 0 rgba(37, 99, 235, 0.12); }
    50% { box-shadow: 0 4px 24px rgba(37, 99, 235, 0.4), 0 0 0 6px rgba(37, 99, 235, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .neo-agent-cta {
        animation: none;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}


.demo-banner {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    margin: 0 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--warning);
}

.demo-banner span:first-child {
    font-weight: 700;
    white-space: nowrap;
}

.composer-provider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
    margin-bottom: 6px;
}

.composer-provider-row select {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 5px 10px;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.composer-provider-row select:focus {
    border-color: var(--accent);
}

.btn-diag {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 5px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.btn-diag:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.diagnostics-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    font-size: 12px;
    line-height: 1.6;
}

.diag-content div {
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.diag-content strong {
    color: var(--text-primary);
}

.demo-badge {
    display: inline-block;
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.msg-content {
    display: inline;
}

.provider-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

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

.provider-card.provider-configured {
    border-color: rgba(52, 211, 153, 0.3);
}

.provider-card.provider-missing {
    border-color: rgba(251, 191, 36, 0.3);
}

.provider-card-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.provider-card-status {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.provider-configured .provider-card-status {
    color: var(--success);
}

.provider-missing .provider-card-status {
    color: var(--warning);
}

.provider-card-missing {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-family: monospace;
}

.provider-test-result {
    margin-top: 8px;
    font-size: 12px;
}

.btn-small {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-small:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.toast-message {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    z-index: 10000;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.media-params-row {
    display: flex;
    gap: 12px;
}

.input-group-small {
    flex: 1;
}

.input-group-small input,
.input-group-small select {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: var(--transition);
}

.input-group-small input:focus,
.input-group-small select:focus {
    border-color: var(--accent);
    outline: none;
}

.video-polling-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.video-polling-status .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.catalog-section {
    margin-bottom: 24px;
}

.catalog-section h3 {
    font-size: 14px;
    color: var(--accent);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.catalog-tool-card {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.catalog-tool-card.available {
    border-color: rgba(37, 99, 235, 0.3);
}

.catalog-tool-card .tool-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.catalog-tool-card .tool-meta {
    font-size: 11px;
    color: var(--text-secondary);
}

.catalog-tool-card .tool-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
}

.tool-badge.active {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.tool-badge.inactive {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.tool-count-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(37, 99, 235, 0.15);
    color: var(--accent);
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

.tool-count-badge:empty {
    display: none;
}

.nav-count-badge {
    margin-left: auto;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(37, 99, 235, 0.2);
    color: var(--accent);
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
}

.nav-count-badge:empty {
    display: none;
}

.model-hint-banner {
    padding: 10px 16px;
    margin: 0 16px 8px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.model-hint-banner.hint-i2v {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.25);
    color: var(--accent);
}
.model-hint-banner.hint-v2v {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--error);
}

.video-image-section {
    padding: 12px;
    margin-bottom: 12px;
    border: 1px dashed rgba(37, 99, 235, 0.3);
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.05);
}
.video-image-section label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
}
.video-image-preview {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}
.video-image-preview img {
    max-width: 180px;
    max-height: 120px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}
.video-image-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.video-image-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.or-divider {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.6;
}
.btn-danger {
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--error) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.return-banner {
    padding: 12px 16px;
    margin: 0 16px 8px;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.25);
    font-size: 13px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}
.return-banner .btn-small {
    margin-left: auto;
}

.error-card {
    padding: 16px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    margin-top: 12px;
}
.error-card h4 {
    margin: 0 0 6px;
    color: var(--error);
    font-size: 14px;
}
.error-card p {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--text-secondary);
}
.error-card .error-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.error-card .error-actions a,
.error-card .error-actions button {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: background 0.15s;
}
.error-card .error-actions a:hover,
.error-card .error-actions button:hover {
    background: var(--bg-tertiary);
}
.error-card .error-actions .btn-billing {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.3);
}
.error-card .request-id {
    margin-top: 8px;
    font-size: 11px;
    opacity: 0.5;
}

.schema-render-container { position: relative; }
.schema-render-container .static-form { transition: opacity 0.2s; }
.schema-render-container .static-form.hidden { display: none; }
.schema-render-container .schema-form-wrap { display: none; }
.schema-render-container .schema-form-wrap.active { display: block; }

.tool-full-link {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
    color: var(--accent); text-decoration: none; margin-top: 10px; padding: 6px 14px;
    background: rgba(37, 99, 235, 0.1); border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 6px;
}
.tool-full-link:hover { background: rgba(37, 99, 235, 0.2); text-decoration: none; }

.schema-field { margin-bottom: 14px; }
.schema-field label { display: block; font-size: 13px; color: var(--text-primary); margin-bottom: 6px; font-weight: 500; }
.schema-field input, .schema-field textarea, .schema-field select {
    width: 100%; background: var(--bg-primary); border: 1px solid var(--border-color); color: var(--text-primary);
    padding: 10px 14px; border-radius: 8px; font-size: 13px; box-sizing: border-box;
    transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth), background var(--transition-smooth);
}
.schema-field input:focus, .schema-field textarea:focus, .schema-field select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow); background: rgba(37, 99, 235, 0.03);
}
.schema-field textarea { min-height: 80px; resize: vertical; font-family: inherit; }
.schema-field input[type="range"] { padding: 4px 0; }
.schema-field .range-value { font-size: 12px; color: var(--accent); margin-left: 8px; font-weight: 600; }
.schema-field input[type="checkbox"] { width: auto; margin-right: 6px; }
.schema-field input[type="file"] { padding: 8px; }
.schema-section { margin-bottom: 16px; }
.schema-section h3 {
    font-size: 13px; color: var(--text-secondary); margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color); padding-bottom: 6px;
}
.schema-actions { display: flex; gap: 10px; margin-top: 20px; }
.schema-actions button {
    padding: 11px 28px; border-radius: 8px; font-size: 14px; cursor: pointer; border: none;
    font-weight: 600; transition: all var(--transition-smooth);
}
.schema-actions .btn-primary { background: var(--accent-gradient); color: white; }
.schema-actions .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35); filter: brightness(1.1); }
.schema-actions .btn-primary:active { transform: translateY(0); }
.schema-actions .btn-secondary { background: var(--bg-elevated); border: 1px solid var(--border-color); color: var(--text-primary); }
.schema-actions .btn-secondary:hover { border-color: var(--accent); background: var(--bg-hover); }
.schema-output-area {
    margin-top: 20px; background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 20px; min-height: 80px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.15);
}
.schema-output-area h4 { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.schema-output-content { color: var(--text-primary); font-size: 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.schema-output-content img { max-width: 100%; border-radius: 8px; margin-top: 8px; }
.schema-output-content video { max-width: 100%; border-radius: 8px; margin-top: 8px; }
.schema-output-content audio { width: 100%; margin-top: 8px; }
.spinner-small { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border-color); border-top-color: var(--accent); border-radius: 50%; animation: spin-small 0.8s linear infinite; }
@keyframes spin-small { to { transform: rotate(360deg); } }

.schema-form-inner { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 10px; padding: 20px; }
.preview-panel {
    background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 10px;
    padding: 20px; display: flex; align-items: center; justify-content: center;
    min-height: 200px; color: var(--text-secondary); font-size: 14px;
}

.theme-generic .schema-form-inner { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 10px; padding: 20px; }

.theme-kling_like { display: grid; grid-template-columns: 380px 1fr; gap: 20px; }
.theme-kling_like .schema-form-inner {
    background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; padding: 20px;
}
.theme-kling_like .schema-section h3 {
    font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-color);
}
.theme-kling_like .schema-output-area, .theme-kling_like .preview-panel {
    background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 12px; min-height: 300px;
}
.theme-kling_like .btn-primary { background: var(--accent); border-radius: 8px; }

.theme-gemini_like .schema-form-inner {
    background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 16px; padding: 24px;
}
.theme-gemini_like .schema-section {
    background: rgba(255,255,255,0.02); border-radius: 12px; padding: 16px; margin-bottom: 16px;
}
.theme-gemini_like .schema-section h3 {
    font-size: 15px; color: var(--text-secondary); margin-bottom: 14px; font-weight: 400; border: none;
}
.theme-gemini_like .btn-primary { background: #4285f4; border-radius: 24px; padding: 12px 32px; }
.theme-gemini_like .schema-output-area { background: var(--bg-primary); border-radius: 16px; }

.theme-sora_like .schema-form-inner {
    background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 8px; padding: 20px;
}
.theme-sora_like .schema-section {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px;
}
.theme-sora_like .schema-section h3 {
    grid-column: 1 / -1; font-size: 13px; color: var(--text-secondary); text-transform: uppercase;
    letter-spacing: 1px; margin-bottom: 4px; border-bottom: 1px solid var(--border-color); padding-bottom: 6px;
}
.theme-sora_like .btn-primary { background: var(--bg-elevated); border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-primary); }
.theme-sora_like .btn-primary:hover { background: var(--bg-hover); }
.theme-sora_like .schema-output-area { background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 8px; min-height: 200px; }

.theme-suno_like .schema-form-inner {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid rgba(37, 99, 235, 0.15); border-radius: 12px; padding: 24px;
}
.theme-suno_like .schema-section h3 {
    font-size: 14px; color: var(--accent-hover); margin-bottom: 12px; font-weight: 600;
    border-bottom: 1px solid rgba(37, 99, 235, 0.12); padding-bottom: 8px;
}
.theme-suno_like .btn-primary { background: linear-gradient(135deg, #2563EB, #3B82F6); border-radius: 8px; }
.theme-suno_like .schema-output-area { background: var(--bg-primary); border: 1px solid rgba(37, 99, 235, 0.12); border-radius: 12px; }

/* Layout variants for inline schema */
.layout-sidebar_params .schema-form-inner {
    background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 10px; padding: 20px;
}
.layout-two_column .schema-form-inner {
    background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 10px; padding: 20px;
}
.layout-chat_like .schema-form-inner {
    background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 10px; padding: 16px;
}
.layout-wizard .schema-form-inner {
    background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; padding: 24px;
    max-width: 700px; margin: 0 auto;
}

/* Minimax-like theme */
.theme-minimax_like .schema-form-inner {
    background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 10px; padding: 20px;
}
.theme-minimax_like .schema-section h3 {
    font-size: 13px; color: var(--text-muted); margin-bottom: 10px;
}
.theme-minimax_like .btn-primary { background: #3b82f6; border-radius: 8px; }

/* Runway-like theme */
.theme-runway_like .schema-form-inner {
    background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 8px; padding: 20px;
}
.theme-runway_like .schema-section h3 {
    font-size: 14px; color: #9ca3af; font-weight: 400; margin-bottom: 12px;
}
.theme-runway_like .btn-primary { background: #2563EB; border-radius: 6px; }

.schema-error-banner {
    background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px; padding: 12px 16px; margin-bottom: 12px;
    color: #f87171; font-size: 13px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.schema-error-banner .error-msg { flex: 1; min-width: 200px; }
.schema-error-banner .error-actions { display: flex; gap: 8px; }
.schema-error-banner button {
    padding: 4px 12px; border-radius: 6px; font-size: 12px; cursor: pointer;
    border: 1px solid rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.15); color: #f87171;
}
.schema-error-banner button:hover { background: rgba(239, 68, 68, 0.25); }
.schema-error-banner a {
    color: var(--accent); font-size: 12px; text-decoration: none;
}
.schema-error-banner a:hover { text-decoration: underline; }

.schema-chip {
    font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500;
    white-space: nowrap;
}
.schema-chip.on {
    background: rgba(74, 222, 128, 0.15); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.3);
}
.schema-chip.off {
    background: rgba(239, 68, 68, 0.1); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.25);
}

.chat-layout-grid {
    display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden;
}
.chat-main-col {
    display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden;
}
.chat-schema-col { display: none; }

.chat-panel-root.theme-gemini_like .chat-layout-grid {
    display: grid; grid-template-columns: 320px 1fr; gap: 0; height: 100%;
}
.chat-panel-root.theme-gemini_like .chat-schema-col {
    display: block !important; position: sticky; top: 0;
    max-height: calc(100vh - 140px); overflow-y: auto;
    padding: 16px; border-right: 1px solid var(--border-color);
    background: var(--bg-tertiary); border-radius: 0;
}
.chat-panel-root.theme-gemini_like .chat-schema-col .schema-form-inner {
    background: transparent; border: none; padding: 0;
}
.chat-panel-root.theme-gemini_like .chat-schema-col .schema-section {
    background: var(--bg-elevated); border-radius: 12px; padding: 14px; margin-bottom: 14px;
    border: 1px solid var(--border-color);
}
.chat-panel-root.theme-gemini_like .chat-schema-col .schema-section h3 {
    font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px;
    margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border-color);
}
.chat-panel-root.theme-gemini_like .chat-schema-col .schema-field label { font-size: 12px; }
.chat-panel-root.theme-gemini_like .chat-schema-col .schema-field input,
.chat-panel-root.theme-gemini_like .chat-schema-col .schema-field select {
    padding: 6px 10px; font-size: 12px; background: var(--bg-elevated);
    border: 1px solid var(--border-color);
}
.chat-panel-root.theme-gemini_like .chat-schema-col .schema-actions { display: none; }
.chat-panel-root.theme-gemini_like .chat-schema-col .schema-output-area { display: none; }
.chat-panel-root.theme-gemini_like .chat-schema-col .tool-full-link { font-size: 10px; }
.chat-panel-root.theme-gemini_like .chat-main-col { grid-column: 2; }

.chat-panel-root.theme-generic .chat-layout-grid {
    display: grid; grid-template-columns: 240px 1fr; gap: 0; height: 100%;
}
.chat-panel-root.theme-generic .chat-schema-col {
    display: block !important; border-right: 1px solid var(--border-color);
    padding: 14px; overflow-y: auto; background: var(--bg-secondary);
}
.chat-panel-root.theme-generic .chat-schema-col .schema-form-inner {
    background: transparent; border: none; padding: 0;
}
.chat-panel-root.theme-generic .chat-schema-col .schema-section {
    background: var(--bg-elevated); border-radius: 10px; padding: 12px; margin-bottom: 12px;
    border: 1px solid var(--border-color);
}
.chat-panel-root.theme-generic .chat-schema-col .schema-actions { display: none; }
.chat-panel-root.theme-generic .chat-schema-col .schema-output-area { display: none; }
.chat-panel-root.theme-generic .chat-schema-col .tool-full-link { font-size: 10px; }
.chat-panel-root.theme-generic .chat-main-col { grid-column: 2; }

.profile-top-bar {
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.profile-top-bar > * {
    pointer-events: auto;
}

.profile-credits-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--accent-glow);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 20px;
    padding: 5px 12px 5px 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.profile-credits-badge:hover {
    background: rgba(37, 99, 235, 0.15);
    border-color: var(--accent);
}

.profile-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-elevated);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    position: relative;
}
.profile-btn:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.profile-btn-avatar {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    text-transform: uppercase;
}

/* ============================================================
   Auth-trigger pill (guest state only). Pure visual upgrade —
   replaces the old "?" circle with an unmistakable Sign In /
   Create Account CTA. The existing onclick still opens the
   profile dropdown (which contains the auth tabs); auth flow,
   handlers, routes, API and state management are unchanged.
   When the user logs in, JS writes their initial into
   #profileBtnAvatar; an inline mirror script flips
   data-auth-state to "user" and the rules below collapse the
   pill back to the original 36x36 circle.
   ============================================================ */
.profile-btn-icon,
.profile-btn-cta { display: none; }

.profile-btn[data-auth-state="guest"] {
    width: auto;
    height: auto;
    min-height: 40px;
    border-radius: 999px;
    padding: 7px 16px 7px 12px;
    gap: 9px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    color: #fff;
    box-shadow:
        0 6px 18px rgba(37, 99, 235, 0.32),
        0 0 0 0 rgba(124, 58, 237, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
    animation: profileBtnPulse 2.6s ease-out infinite;
}
.profile-btn[data-auth-state="guest"] .profile-btn-avatar { display: none; }
.profile-btn[data-auth-state="guest"] .profile-btn-icon,
.profile-btn[data-auth-state="guest"] .profile-btn-cta { display: inline-flex; }

.profile-btn[data-auth-state="guest"] .profile-btn-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
}
.profile-btn[data-auth-state="guest"] .profile-btn-cta {
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
    gap: 1px;
}
.profile-btn[data-auth-state="guest"] .profile-btn-cta-line {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.1px;
    color: #fff;
    white-space: nowrap;
}
.profile-btn[data-auth-state="guest"] .profile-btn-cta-sep {
    opacity: 0.55;
    font-weight: 500;
}
.profile-btn[data-auth-state="guest"] .profile-btn-cta-sub {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.96);
    letter-spacing: 0.15px;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.profile-btn[data-auth-state="guest"]:hover {
    border-color: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
    box-shadow:
        0 10px 24px rgba(37, 99, 235, 0.42),
        0 0 0 4px rgba(124, 58, 237, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.24);
    animation-play-state: paused;
}
.profile-btn[data-auth-state="guest"]:active {
    transform: translateY(0) scale(0.97);
    transition: transform 0.08s ease;
}
.profile-btn[data-auth-state="guest"]:focus-visible {
    outline: 3px solid rgba(124, 58, 237, 0.55);
    outline-offset: 2px;
}

/* Optional brand variant (purple/pink) — opt-in via data-brand="academy" */
.profile-btn[data-auth-state="guest"][data-brand="academy"] {
    background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
    box-shadow:
        0 6px 18px rgba(236, 72, 153, 0.32),
        0 0 0 0 rgba(139, 92, 246, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.profile-btn[data-auth-state="guest"][data-brand="academy"]:hover {
    box-shadow:
        0 10px 24px rgba(236, 72, 153, 0.42),
        0 0 0 4px rgba(139, 92, 246, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

@keyframes profileBtnPulse {
    0%   { box-shadow: 0 6px 18px rgba(37, 99, 235, 0.32), 0 0 0 0 rgba(124, 58, 237, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
    70%  { box-shadow: 0 6px 18px rgba(37, 99, 235, 0.32), 0 0 0 10px rgba(124, 58, 237, 0.00), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
    100% { box-shadow: 0 6px 18px rgba(37, 99, 235, 0.32), 0 0 0 0 rgba(124, 58, 237, 0.00), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
}
@media (prefers-reduced-motion: reduce) {
    .profile-btn[data-auth-state="guest"] { animation: none; }
}

.profile-dropdown {
    position: fixed;
    top: 54px;
    right: 16px;
    width: 320px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    overflow: hidden;
    animation: profileDdFadeIn 0.15s ease;
}
@keyframes profileDdFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.profile-dd-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent-glow), transparent);
    border-bottom: 1px solid var(--border-subtle);
}
.profile-dd-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}
.profile-dd-identity {
    min-width: 0;
    flex: 1;
}
.profile-dd-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-dd-email {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-dd-shared-badge {
    margin-top: 4px;
    font-size: 10.5px;
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 0.2px;
}

.profile-dd-section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
}
.profile-dd-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.profile-dd-wallet {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 8px;
}
.profile-dd-wallet-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
}
.profile-dd-wallet-label {
    font-size: 12.5px;
    color: var(--text-secondary);
}
.profile-dd-wallet-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.profile-dd-wallet-shared {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}

.profile-dd-link {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.profile-dd-link:hover {
    background: var(--bg-hover);
    color: var(--accent);
}
.profile-dd-password-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0 8px;
    font-size: 13px;
    color: var(--text-secondary);
}
.profile-dd-password-dots {
    color: var(--text-muted);
    letter-spacing: 2px;
}

.profile-dd-admin-section {
    background: var(--accent-glow);
}
.profile-dd-admin-section .profile-dd-section-title {
    color: var(--accent);
}

.profile-dd-footer {
    padding: 8px 16px 12px;
}
.profile-dd-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(220, 38, 38, 0.04);
    color: var(--danger);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.profile-dd-logout:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: var(--danger);
}

.profile-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.profile-modal {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 400px;
    max-width: 92vw;
    animation: profileDdFadeIn 0.2s ease;
}
.profile-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}
.profile-modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.profile-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.profile-modal-close:hover { color: var(--text-primary); }
.profile-modal-body {
    padding: 16px 20px;
}
.profile-modal-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding: 8px 10px;
    background: var(--accent-glow);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(37, 99, 235, 0.1);
}
.profile-form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.profile-form-input {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13.5px;
    outline: none;
    box-sizing: border-box;
}
.profile-form-input:focus { border-color: var(--accent); }
.profile-form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: -4px;
}
.profile-form-message {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
}
.profile-form-message.success {
    background: rgba(22, 163, 74, 0.08);
    color: var(--success);
    border: 1px solid rgba(22, 163, 74, 0.2);
}
.profile-form-message.error {
    background: rgba(220, 38, 38, 0.06);
    color: var(--danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
}
.profile-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-subtle);
}
.profile-modal-btn-cancel {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}
.profile-modal-btn-cancel:hover { background: var(--bg-hover); }
.profile-modal-btn-save {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.profile-modal-btn-save:hover { opacity: 0.9; }
.profile-modal-btn-save:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 768px) {
    .profile-top-bar { top: 8px; right: 8px; position: fixed; }
    .profile-credits-badge { padding: 4px 8px 4px 6px; font-size: 11px; }
    .profile-dropdown { width: calc(100vw - 76px); right: 8px; top: 50px; }
    .profile-btn { width: 32px; height: 32px; }
    .profile-btn-avatar { font-size: 12px; }
    /* Guest CTA pill keeps comfortable tap target on mobile but trims
       to fit the corner without overlapping the navbar / hamburger. */
    .profile-btn[data-auth-state="guest"] {
        width: auto;
        height: auto;
        min-height: 38px;
        padding: 6px 12px 6px 8px;
        gap: 7px;
    }
    .profile-btn[data-auth-state="guest"] .profile-btn-icon { width: 24px; height: 24px; }
    .profile-btn[data-auth-state="guest"] .profile-btn-icon svg { width: 16px; height: 16px; }
    .profile-btn[data-auth-state="guest"] .profile-btn-cta-line { font-size: 12.5px; }
    .profile-btn[data-auth-state="guest"] .profile-btn-cta-sub { display: none; }
}
@media (max-width: 380px) {
    /* Very narrow phones: collapse to icon + short label only. */
    .profile-btn[data-auth-state="guest"] .profile-btn-cta-line .profile-btn-cta-sep,
    .profile-btn[data-auth-state="guest"] .profile-btn-cta-line span:last-child { display: none; }
}

.panel-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.panel-back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

#account.panel .panel-header { background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary)); }
#wallet.panel .panel-header { background: var(--bg-secondary); }

.account-content {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.account-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px 24px;
}

.account-identity-section {
    background: linear-gradient(135deg, var(--accent-glow), rgba(99, 102, 241, 0.04));
    border-color: rgba(37, 99, 235, 0.15);
}

.account-identity-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.account-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.2);
}

.account-identity-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.account-display-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.account-email {
    font-size: 14px;
    color: var(--text-secondary);
}

.account-shared-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--accent);
    margin-top: 4px;
    font-weight: 500;
}

.account-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
.account-section-title svg {
    color: var(--accent);
    flex-shrink: 0;
}

.account-wallet-summary {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 14px;
}

.account-wallet-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.account-wallet-row:last-child { border-bottom: none; }

.account-wallet-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.account-wallet-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.account-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    margin-top: 8px;
}
.account-action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}
.account-action-btn svg:first-child { color: var(--accent); flex-shrink: 0; }
.account-action-btn svg:last-child { margin-left: auto; color: var(--text-muted); }

.account-password-row {
    margin-bottom: 6px;
}

.account-password-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.account-password-dots {
    color: var(--text-muted);
    letter-spacing: 2px;
}

.account-password-shared-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.account-session-section {
    background: transparent;
    border: none;
    padding: 0;
}

.account-logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 18px;
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(220, 38, 38, 0.04);
    color: var(--danger, #dc2626);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.account-logout-btn:hover {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.4);
}

.account-prefs-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.account-prefs-item {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 180px;
}
.account-prefs-label {
    font-size: 14px;
    color: var(--text-muted);
    white-space: nowrap;
}
.account-prefs-control {
    display: inline-flex;
    align-items: center;
}
.account-prefs-shared-hint {
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.7;
    margin-top: 4px;
}

.account-return-section {
    border-color: var(--accent-dim, rgba(59, 130, 246, 0.2));
    background: rgba(59, 130, 246, 0.04);
}
.account-return-btn {
    color: var(--accent) !important;
    font-weight: 600;
}
.account-return-btn svg:first-child { color: var(--accent) !important; }

.wallet-return-section {
    margin-bottom: 16px;
}

.account-admin-section {
    border-color: rgba(147, 51, 234, 0.15);
    background: rgba(147, 51, 234, 0.03);
}
.account-admin-section .account-section-title svg { color: rgba(147, 51, 234, 0.8); }

@media (max-width: 768px) {
    .account-content { padding: 16px; }
    .account-identity-card { flex-direction: column; text-align: center; }
    .account-avatar { width: 56px; height: 56px; font-size: 22px; }
    .account-identity-info { align-items: center; }
}

.panel-header-left-back {
    flex-direction: row;
    align-items: center;
    gap: 16px;
}
.panel-header-left-back .panel-back-btn {
    order: -1;
    flex-shrink: 0;
}

.wallet-plan-explainer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.wallet-plan-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.wallet-plan-detail:last-of-type { border-bottom: none; }
.wallet-plan-detail-label {
    font-size: 13px;
    color: var(--text-secondary);
}
.wallet-plan-detail-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.wallet-plan-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
}

.wallet-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.wallet-plan-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    transition: border-color 0.2s;
}
.wallet-plan-card:hover { border-color: var(--accent); }
.wallet-plan-current { border-color: var(--accent); background: var(--accent-glow); }
.wallet-plan-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.wallet-plan-card-header h4 { margin: 0; font-size: 15px; font-weight: 600; }
.wallet-plan-badge {
    font-size: 11px;
    font-weight: 600;
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
}
.wallet-plan-card-price { margin-bottom: 8px; }
.wallet-plan-price-amount { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.wallet-plan-price-period { font-size: 13px; color: var(--text-secondary); }
.wallet-plan-card-credits { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.wallet-plan-card-overage { font-size: 12px; color: var(--text-muted); }

.wallet-tx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.wallet-tx-table th {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
}
.wallet-tx-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
.wallet-tx-debit { color: var(--error, #e53e3e); font-weight: 600; }
.wallet-tx-credit { color: var(--success, #38a169); font-weight: 600; }
.wallet-tx-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.wallet-tx-ok { background: rgba(56, 161, 105, 0.1); color: var(--success, #38a169); }
.wallet-tx-pending { background: rgba(214, 158, 46, 0.1); color: #d69e2e; }
.wallet-tx-more { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 8px; }

.simple-pricing-header { margin-bottom: 20px; }
.simple-pricing-header h3 { margin-bottom: 6px; }
.simple-pricing-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.simple-pricing-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.simple-pricing-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}
.simple-pricing-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.simple-pricing-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
}
.simple-pricing-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}
.simple-pricing-unit {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}
.simple-pricing-hint {
    font-size: 11px;
    color: var(--text-muted);
}
.simple-pricing-preview {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}
.simple-pricing-preview h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.simple-pricing-preview-table {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.simple-pricing-preview-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
    color: var(--text-primary);
}
.simple-pricing-preview-row:last-child { border-bottom: none; }
.simple-pricing-preview-header {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.academy-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.academy-plan-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.15s ease;
}
.academy-plan-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}
.academy-plan-inactive {
    opacity: 0.55;
}
.academy-plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.academy-plan-header h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}
.academy-plan-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    cursor: pointer;
}
.academy-plan-toggle input { opacity: 0; width: 0; height: 0; }
.academy-plan-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border-color);
    border-radius: 12px;
    transition: 0.3s;
}
.academy-plan-toggle-slider::before {
    content: '';
    position: absolute;
    left: 2px;
    bottom: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
.academy-plan-toggle input:checked + .academy-plan-toggle-slider {
    background: var(--accent);
}
.academy-plan-toggle input:checked + .academy-plan-toggle-slider::before {
    transform: translateX(18px);
}
.academy-plan-price {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 14px;
}
.academy-plan-price span {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
}
.academy-plan-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.academy-plan-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.academy-plan-field label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

@media (max-width: 768px) {
    .simple-pricing-form { grid-template-columns: 1fr; }
    .academy-plans-grid { grid-template-columns: 1fr; }
}

.nav-empty-hint {
    padding: 6px 14px;
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

.nav-item-mini {
    padding: 5px 12px !important;
    font-size: 12px !important;
    gap: 8px !important;
}

.nav-item-mini .nav-icon {
    width: 14px;
    height: 14px;
}

.nav-group-favorites,
.nav-group-recent {
    transition: max-height 0.3s ease;
}

.nav-group-collapsed.nav-group-favorites,
.nav-group-collapsed.nav-group-recent {
    max-height: 0;
    overflow: hidden;
}

.mp-card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    align-items: center;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.2s;
}

.mp-card:hover .mp-card-actions {
    opacity: 1;
}

.mp-card-fav {
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    padding: 0;
}

.mp-card-fav:hover {
    background: rgba(255,255,255,1);
    transform: scale(1.1);
}

.mp-card-fav.active {
    opacity: 1 !important;
}

.mp-card:hover .mp-card-fav.active,
.mp-card-fav.active {
    opacity: 1;
}

.mp-card-compare {
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(4px);
    color: var(--text-secondary);
}

.mp-card-compare.active {
    background: var(--accent);
    color: #fff;
}

.compare-check {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 1.5px solid currentColor;
    border-radius: 3px;
    text-align: center;
    line-height: 14px;
    font-size: 10px;
}

.mp-card-compare.active .compare-check {
    background: #fff;
    color: var(--accent);
    border-color: #fff;
}

.compare-toggle-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.compare-toggle-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.compare-toggle-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.compare-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(37,99,235,0.06);
    border: 1px solid rgba(37,99,235,0.15);
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--text-primary);
}

.compare-bar-btn {
    padding: 6px 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.compare-bar-clear {
    padding: 6px 12px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-secondary);
}

.welcome-workspace {
    padding: 40px 32px;
    max-width: 900px;
    margin: 0 auto;
    overflow-y: auto;
    height: 100%;
}

.welcome-workspace-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 32px;
}

.welcome-workspace-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.welcome-workspace-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.welcome-templates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.welcome-template-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.welcome-template-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(37,99,235,0.08);
    transform: translateY(-2px);
}

.welcome-tpl-icon {
    font-size: 28px;
    line-height: 1;
}

.welcome-tpl-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.welcome-section {
    margin-bottom: 24px;
}

.welcome-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 14px;
}

.welcome-popular-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.welcome-tool-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s;
}

.welcome-tool-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(37,99,235,0.08);
    transform: translateY(-2px);
}

.welcome-tool-preview {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-tool-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 8px 10px 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.welcome-tool-cat {
    font-size: 10px;
    color: var(--text-muted);
    padding: 0 10px 8px;
    text-transform: uppercase;
    font-weight: 500;
}

.btn-back-compare {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.mobile-menu-toggle.active svg line:nth-child(1) {
    transform: rotate(45deg) translate(5px, -3px);
    transform-origin: center;
}
.mobile-menu-toggle.active svg line:nth-child(2) {
    opacity: 0;
}
.mobile-menu-toggle.active svg line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, 3px);
    transform-origin: center;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        width: 240px;
        z-index: 100;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    .sidebar.sidebar-open {
        left: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }

    .sidebar.sidebar-open ~ .mobile-overlay {
        display: block;
    }

    .logo-text, .nav-item span, .nav-section-label, .user-details {
        display: flex;
    }

    .nav-item {
        justify-content: flex-start;
        padding: 9px 12px;
    }

    .sidebar-logo {
        justify-content: flex-start;
        padding: 20px 18px;
    }

    .sidebar-footer {
        justify-content: flex-start;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .app-shell {
        flex-direction: column;
    }

    .profile-top-bar {
        padding-right: 12px;
        padding-left: 48px;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
        padding: 14px 16px !important;
    }

    .category-content {
        padding: 14px 16px !important;
    }

    .mp-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
        gap: 10px !important;
    }

    .chat-layout-grid {
        flex-direction: column !important;
    }

    .chat-schema-col {
        max-width: 100% !important;
        width: 100% !important;
    }

    .welcome-templates {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .welcome-popular-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }

    .welcome-workspace {
        padding: 24px 16px;
    }

    .welcome-workspace-header {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .comparison-grid {
        font-size: 12px !important;
    }

    .mp-card-actions {
        opacity: 1;
    }

    .admin-grid { grid-template-columns: 1fr; }
    .wallet-grid { grid-template-columns: 1fr; }
    .wallet-cards-row { grid-template-columns: 1fr; }
    .wallet-details-grid { grid-template-columns: 1fr; }
    .admin-subtabs { overflow-x: auto; }
    .admin-subtab { white-space: nowrap; font-size: 12px; padding: 8px 12px; }
    .nav-group-create { max-height: none; }
    .nav-toggle-arrow { display: none; }
}

@media (max-width: 480px) {
    .welcome-templates {
        grid-template-columns: repeat(2, 1fr);
    }

    .welcome-popular-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .mp-grid {
        grid-template-columns: 1fr !important;
    }

    .compare-bar {
        flex-direction: column;
        gap: 8px;
    }

    .welcome-workspace-header h2 {
        font-size: 20px;
    }
}
