/* ══════════════════════════════════════
   THEME TOKENS
══════════════════════════════════════ */
[data-theme="dark"] {
    --bg:           #080810;
    --surface:      #10101a;
    --surface-2:    #171724;
    --surface-3:    #1e1e2e;
    --border:       rgba(255,255,255,0.09);
    --border-hover: rgba(255,255,255,0.18);
    --accent:       #7c6af7;
    --accent-dim:   rgba(124,106,247,0.18);
    --accent-glow:  rgba(124,106,247,0.4);
    --text-primary:   #eeeef5;
    --text-secondary: #9898b0;
    --text-muted:     #52526a;
    --grid-line: rgba(124,106,247,0.03);
    --topbar-bg: rgba(8,8,16,0.88);
    --input-bg: #10101a;
    --scrollbar: rgba(255,255,255,0.1);
    --chip-bg: #17172a;
}
[data-theme="light"] {
    --bg:           #f4f4f8;
    --surface:      #ffffff;
    --surface-2:    #f0f0f5;
    --surface-3:    #e8e8f0;
    --border:       rgba(0,0,0,0.08);
    --border-hover: rgba(0,0,0,0.15);
    --accent:       #6055e8;
    --accent-dim:   rgba(96,85,232,0.1);
    --accent-glow:  rgba(96,85,232,0.25);
    --text-primary:   #111120;
    --text-secondary: #4a4a6a;
    --text-muted:     #9898b8;
    --grid-line: rgba(96,85,232,0.035);
    --topbar-bg: rgba(244,244,248,0.92);
    --input-bg: #ffffff;
    --scrollbar: rgba(0,0,0,0.1);
    --chip-bg: #f8f8fc;
}

/* ── Base ── */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
    font-family: 'Geist', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: background 0.25s, color 0.25s;
}

body::before {
    content: '';
    position: fixed; inset: 0;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none; z-index: 0;
}
[data-theme="dark"] body::after {
    content: '';
    position: fixed;
    top: -200px; left: 50%;
    transform: translateX(-50%);
    width: 700px; height: 380px;
    background: radial-gradient(ellipse, rgba(124,106,247,0.1) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
}

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
#sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 256px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 100;
    transition: background 0.25s, border-color 0.25s, transform 0.28s cubic-bezier(.4,0,.2,1);
}

.sidebar-logo {
    padding: 8px 20px 8px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
}
.logo-icon {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: white; flex-shrink: 0;
    box-shadow: 0 0 14px var(--accent-glow);
}
.sidebar-logo span { font-size: 15.5px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
.sidebar-logo span em { font-style: normal; color: var(--accent); }

/* Logo image (replaces icon + text) */
.logo-img {
    height: 28px;
    width: auto;
    object-fit: contain;
    display: block;
}
.sidebar-logo .logo-img {
    height: 50px;
}
.auth-logo .logo-img {
    height: 32px;
}
.pricing-logo .logo-img {
    height: 50px;
}

/* ── Quick-Action Icon Buttons ── */
.sidebar-quick-actions {
    display: flex;
    gap: 6px;
    padding: 10px 12px 0px;
    justify-content: center;
}

.sidebar-quick-lbl {
    display: flex;
    gap: 6px;
    padding: 0px 12px 6px;
    justify-content: space-evenly;
}

.sidebar-quick-lbltxt {
    color: rgb(252, 252, 252); 
    font-size: .7rem; 
    text-align: center; 
    padding-top: 2px;
}
.quick-action-btn {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    color: white;
    font-size: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
    position: relative;
    text-decoration: none;
    font-family: 'Geist', sans-serif;
    margin: 0px 8px;
    box-shadow: 0 0 28px var(--accent-glow);
}
.quick-action-btn:hover {
    background: var(--accent-dim);
    border-color: rgba(124,106,247,0.4);
    color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124,106,247,0.15);
}
.quick-action-btn:active {
    transform: translateY(0);
}
/* Tooltip for quick-action buttons */
.quick-action-btn[title] {
    position: relative;
}
.quick-action-btn::after {
    content: attr(title);
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%) scale(0.92);
    background: var(--surface-3);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
    z-index: 10;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.quick-action-btn:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.new-chat-btn {
    margin: 12px;
    padding: 1px 14px;
    background: var(--accent-dim);
    border: 1px solid rgba(124,106,247,0.28);
    border-radius: 9px;
    font-size: 13.5px; font-weight: 600;
    color: var(--accent); cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: all 0.15s; font-family: 'Geist', sans-serif;
}
.new-chat-btn:hover { background: rgba(124,106,247,0.25); }

.sidebar-section { padding: 1px 12px 8px; }
.sidebar-label {
    font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.09em;
    color: var(--text-muted); padding: 0 6px; margin-bottom: 5px;
}
.sidebar-btn {
    width: 100%; display: flex; align-items: center; gap: 9px;
    padding: 1px 12px; border-radius: 8px;
    font-size: 13.5px; font-weight: 500;
    color: var(--text-secondary); cursor: pointer;
    transition: all 0.15s; border: none; background: transparent;
    text-align: left; font-family: 'Geist', sans-serif;
}
.sidebar-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.sidebar-btn.active { background: var(--accent-dim); color: var(--accent); }
.sidebar-btn i { width: 16px; text-align: center; font-size: 12.5px; opacity: 0.85; }

.sidebar-divider { height: 1px; background: var(--border); margin: 8px 12px; }

/* ── Conversation History ── */
.sidebar-history-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.history-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 2px;
}
.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

.history-item {
    display: flex !important;
    align-items: flex-start !important;
    gap: 9px;
    padding: 8px 12px !important;
    width: 100%;
}
.history-item-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.history-title {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.history-item.active .history-title,
.history-item:hover .history-title {
    color: var(--text-primary);
}
.history-meta {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 1px;
}
.history-empty {
    padding: 14px 12px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.history-empty i {
    font-size: 11px;
    color: var(--accent);
}

/* History item loading state */
.history-item.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}
.history-item.loading::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: histSpin 0.6s linear infinite;
}
@keyframes histSpin { to { transform: translateY(-50%) rotate(360deg); } }

/* Conversation loading overlay in chat area */
.conversation-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    gap: 14px;
    animation: fadeIn 0.2s ease-out;
}
.conversation-loading span {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}
.convo-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: convoSpin 0.7s linear infinite;
}
@keyframes convoSpin { to { transform: rotate(360deg); } }

.sidebar-footer {
    margin-top: auto;
    padding: 1px 12px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 8px;
}

/* Theme toggle */
.theme-toggle {
    margin-left: auto;
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-secondary); font-size: 13px;
    transition: all 0.15s; flex-shrink: 0;
}
.theme-toggle:hover { background: var(--surface-3); color: var(--text-primary); }

.user-chip { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.user-avatar {
    width: 29px; height: 29px;
    background: linear-gradient(135deg, #6055e8, #a78bfa);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: white; flex-shrink: 0; font-weight: 700;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-plan { font-size: 11px; color: var(--text-muted); }

/* ── User Avatar Dropdown ── */
.user-chip-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
}
.user-chip-clickable {
    cursor: pointer;
    border-radius: 8px;
    padding: 4px 6px;
    transition: background 0.15s;
}
.user-chip-clickable:hover {
    background: var(--surface-2);
}

.user-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    padding: 5px;
    z-index: 150;
    min-width: 190px;
    animation: userDropIn 0.18s ease-out;
}
.user-dropdown.open {
    display: block;
}
@keyframes userDropIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: none;
    border-radius: 8px;
    font-family: 'Geist', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.12s;
    text-align: left;
    text-decoration: none;
}
.user-dropdown-item:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}
.user-dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 12px;
    opacity: 0.8;
}
.user-dropdown-upgrade {
    color: #a78bfa;
}
.user-dropdown-upgrade:hover {
    background: rgba(167,139,250,0.1);
    color: #a78bfa;
}
.user-dropdown-upgrade i {
    color: #a78bfa;
    opacity: 1;
}
.user-dropdown-logout {
    color: #f87171;
}
.user-dropdown-logout:hover {
    background: rgba(239,68,68,0.08);
    color: #ef4444;
}
.user-dropdown-logout i {
    color: #f87171;
    opacity: 1;
}
.user-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 8px;
}

/* Sidebar policy links */
.sidebar-policy-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px 10px;
    flex-wrap: wrap;
}
.sidebar-policy-links a {
    font-size: 10.5px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}
.sidebar-policy-links a:hover {
    color: var(--accent);
}
.sidebar-policy-links span {
    color: var(--text-muted);
    font-size: 10px;
    opacity: 0.5;
}

/* Mobile overlay */
#sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
    backdrop-filter: blur(2px);
}

/* ══════════════════════════════════════
   MAIN
══════════════════════════════════════ */
#main {
    margin-left: 256px;
    flex: 1; display: flex; flex-direction: column;
    position: relative; z-index: 1; min-height: 100vh;
    transition: margin-left 0.28s cubic-bezier(.4,0,.2,1);
}

/* ══════════════════════════════════════
   TOPBAR
══════════════════════════════════════ */
#topbar {
    position: sticky; top: 0;
    background: var(--topbar-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex; align-items: center; justify-content: space-between;
    z-index: 40; transition: background 0.25s, border-color 0.25s;
    gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title {
    font-size: 14px; font-weight: 600;
    color: var(--text-secondary);
    display: flex; align-items: center; gap: 8px;
}
.topbar-title i { color: var(--accent); font-size: 13px; }

/* Hamburger – hidden on desktop */
#menu-toggle {
    display: none;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 8px; width: 36px; height: 36px;
    align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-secondary); font-size: 15px;
    flex-shrink: 0; transition: all 0.15s;
}
#menu-toggle:hover { background: var(--surface-3); color: var(--text-primary); }

.status-pill {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 20px; padding: 5px 12px 5px 8px;
    font-size: 12px; font-weight: 500; color: var(--text-secondary);
    white-space: nowrap;
}
.status-dot {
    width: 7px; height: 7px; background: #22c55e;
    border-radius: 50%; box-shadow: 0 0 5px #22c55e;
    animation: pdot 2s infinite;
}
@keyframes pdot { 0%,100%{opacity:1}50%{opacity:0.4} }

/* ══════════════════════════════════════
   CHAT AREA
══════════════════════════════════════ */
#chat-area {
    flex: 1; display: flex; flex-direction: column;
    max-width: 820px; width: 100%;
    margin: 0 auto; padding: 28px 24px 0;
}

#scroll-area {
    flex: 1; overflow-y: auto; scroll-behavior: smooth;
    padding-bottom: 8px;
}
#scroll-area::-webkit-scrollbar { width: 5px; }
#scroll-area::-webkit-scrollbar-track { background: transparent; }
#scroll-area::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 4px; }

/* ══════════════════════════════════════
   WELCOME SCREEN
══════════════════════════════════════ */
#welcome-screen {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 56px 0 20px; text-align: center;
}
.welcome-avatar {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: white; margin-bottom: 20px;
    box-shadow: 0 0 28px var(--accent-glow);
}
.welcome-title { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; color: var(--text-primary); margin-bottom: 10px; }
.welcome-sub { font-size: 15px; color: var(--text-secondary); max-width: 400px; line-height: 1.65; margin-bottom: 36px; }

.suggestion-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 560px; }
.suggestion-chip {
    background: var(--chip-bg); border: 1px solid var(--border);
    border-radius: 12px; padding: 14px 16px;
    text-align: left; cursor: pointer; transition: all 0.15s;
    display: flex; align-items: flex-start; gap: 10px;
}
.suggestion-chip:hover { border-color: var(--accent); background: var(--accent-dim); }
.chip-icon {
    width: 30px; height: 30px; background: var(--surface-3);
    border-radius: 7px; display: flex; align-items: center; justify-content: center;
    font-size: 13px; color: var(--accent); flex-shrink: 0;
}
.chip-text strong { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.chip-text span { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }

/* ══════════════════════════════════════
   MESSAGES
══════════════════════════════════════ */
#messages-container { display: flex; flex-direction: column; }

.message-row {
    display: flex; gap: 14px;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
    animation: msgIn 0.28s ease-out;
}
.message-row:last-child { border-bottom: none; }
@keyframes msgIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }

.msg-avatar {
    width: 34px; height: 34px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0; margin-top: 2px;
}
.msg-avatar.user { background: var(--surface-3); border: 1px solid var(--border); color: var(--text-secondary); }
.msg-avatar.assistant { background: linear-gradient(135deg, var(--accent), #a78bfa); color: white; box-shadow: 0 0 10px var(--accent-glow); }

.msg-content { flex: 1; min-width: 0; }
.msg-sender { font-size: 11.5px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.04em; text-transform: uppercase; }
.msg-text { font-size: 14.5px; line-height: 1.65; color: var(--text-secondary); }

/* Loading bubble */
#loading-bubble { display: none; align-items: flex-start; gap: 14px; padding: 18px 0; }
.typing-dots { display: flex; gap: 5px; align-items: center; padding: 6px 0; }
.typing-dots span {
    width: 6px; height: 6px; background: var(--accent);
    border-radius: 50%; animation: bdot 1.4s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bdot { 0%,80%,100%{transform:scale(0.75);opacity:0.35} 40%{transform:scale(1.15);opacity:1} }
.loading-status { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ══════════════════════════════════════
   RESULT CARD
══════════════════════════════════════ */
.result-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden; margin-top: 12px;
    max-width: 50%;
}

/* Preview with floating buttons */
.preview-wrap { position: relative; background: var(--surface-2); padding: 14px; }
.preview-wrap img {
    width: 100%; height: auto; border-radius: 9px; display: block;
    cursor: zoom-in; transition: opacity 0.15s;
}
.preview-wrap img:hover { opacity: 0.92; }
.preview-actions {
    position: absolute; top: 0px; right: 40px; display: flex; gap: 7px;
}
.preview-fab {
    padding: 0px 2px; border-radius: 20px;
    font-size: 11px; font-weight: 700;
    display: flex; align-items: center; gap: 5px;
    cursor: pointer; transition: all 0.15s; border: none;
    backdrop-filter: blur(12px); font-family: 'Geist', sans-serif;
}
.preview-fab.dl { background: rgba(22,155,71,0.99); color: #e8e8ff; border: 1px solid rgba(255,255,255,0.12); }
.preview-fab.dl:hover { background: rgba(24,171,78,0.99); }
.preview-fab.edit { background: rgba(124,106,247,0.8); color: #fff; border: 1px solid rgba(167,139,250,0.4); }
.preview-fab.edit:hover { background: rgba(124,106,247,1); box-shadow: 0 0 12px rgba(124,106,247,0.5); }
.preview-fab.pdf { background: rgba(220,38,38,0.72); color: #fff; border: 1px solid rgba(239,68,68,0.25); }
.preview-fab.pdf:hover { background: rgba(220,38,38,0.88); box-shadow: 0 0 10px rgba(220,38,38,0.4); }

/* Error */
.error-bubble {
    background: rgba(239,68,68,0.07); border: 1px solid rgba(239,68,68,0.18);
    border-radius: 10px; padding: 14px 16px; margin-top: 8px;
    display: flex; align-items: flex-start; gap: 10px;
}
.error-bubble i { color: #ef4444; margin-top: 1px; font-size: 14px; }
.error-bubble p { font-size: 14px; color: #fca5a5; line-height: 1.5; }
.error-reset {
    margin-top: 10px; padding: 6px 14px;
    background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2);
    border-radius: 7px; font-size: 12.5px; font-weight: 600; color: #f87171;
    cursor: pointer; transition: all 0.15s; font-family: 'Geist', sans-serif;
}
.error-reset:hover { background: rgba(239,68,68,0.18); }

/* ══════════════════════════════════════
   INPUT AREA
══════════════════════════════════════ */
#input-area {
    position: sticky; bottom: 0;
    background: linear-gradient(transparent, var(--bg) 28%);
    padding: 14px 0 22px; z-index: 30;
}
.input-shell {
    background: var(--input-bg);
    border: 1px solid var(--border); border-radius: 14px;
    transition: border-color 0.2s, box-shadow 0.2s; overflow: hidden;
}
.input-shell:focus-within {
    border-color: rgba(124,106,247,0.45);
    box-shadow: 0 0 0 3px var(--accent-dim), 0 6px 24px rgba(0,0,0,0.3);
}

.input-top-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px 1px; border-bottom: 1px solid var(--border); gap: 1px 10px;
    flex-wrap: wrap;
}

.mode-pills { display: flex; gap: 3px; background: var(--surface-2); padding: 3px; border-radius: 8px; }
.mode-pill {
    padding: 4px 11px; border-radius: 6px;
    font-size: 12px; font-weight: 600; cursor: pointer;
    transition: all 0.15s; color: var(--text-muted);
    border: none; background: transparent;
    display: flex; align-items: center; gap: 5px;
    font-family: 'Geist', sans-serif;
}
.mode-pill.active { background: var(--surface-3); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.mode-pill:hover:not(.active) { color: var(--text-secondary); }
.mode-pill i { font-size: 10px; }

.size-pills { display: flex; gap: 3px; }
.size-pill {
    padding: 4px 11px; border-radius: 6px;
    font-size: 12px; font-weight: 600; cursor: pointer;
    transition: all 0.15s; color: var(--text-muted);
    border: 1px solid transparent; background: transparent;
    display: flex; align-items: center; gap: 5px;
    font-family: 'Geist', sans-serif;
}
.size-pill.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(124,106,247,0.28); }
.size-pill:hover:not(.active) { color: var(--text-secondary); border-color: var(--border); }
.size-pill i { font-size: 10px; }

.input-fields { padding: 9px 14px 6px; display: flex; flex-direction: column; gap: 5px; }
.field-row { display: flex; align-items: flex-start; gap: 8px; }
.field-label {
    font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-muted); padding-top: 8px;
    white-space: nowrap; width: 50px; flex-shrink: 0;
}
.chat-textarea {
    flex: 1; background: transparent; border: none; outline: none;
    resize: none; font-family: 'Geist', sans-serif;
    font-size: 13px; color: var(--text-primary);
    line-height: 1; padding: 6px 0; min-height: 34px; max-height: 120px;
}
.chat-textarea::placeholder { color: var(--text-muted); }
.req-input {
    flex: 1; background: transparent; border: none; outline: none;
    font-family: 'Geist', sans-serif;
    font-size: 13px; color: var(--text-secondary); padding: 6px 0;
}
.req-input::placeholder { color: var(--text-muted); font-size: 12.5px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 0; }

.input-bottom-bar { display: flex; align-items: center; justify-content: space-between; padding: 6px 14px 1px; }
.mode-hint { font-size: 11.5px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.mode-hint i { color: var(--accent); font-size: 10px; }

.send-btn {
    width: 34px; height: 34px; background: var(--accent);
    border: none; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s; color: white; font-size: 14px;
    box-shadow: 0 2px 8px var(--accent-glow); flex-shrink: 0;
}
.send-btn:hover { background: #8b7af8; transform: scale(1.06); }
.send-btn:disabled { opacity: 0.38; cursor: not-allowed; transform: none; }

/* ══════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════ */
#lightbox {
    display: none; position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.88); backdrop-filter: blur(6px);
    align-items: center; justify-content: center; cursor: zoom-out;
}
#lightbox.open { display: flex; animation: lbIn 0.22s ease-out; }
@keyframes lbIn { from{opacity:0;transform:scale(0.94)} to{opacity:1;transform:scale(1)} }
#lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 12px; box-shadow: 0 24px 80px rgba(0,0,0,0.7); cursor: default; }
#lightbox-close {
    position: absolute; top: 20px; right: 24px;
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.18);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 16px; cursor: pointer; transition: background 0.15s;
}
#lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* Lightbox action buttons */
.lightbox-actions {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 210;
}
.lightbox-fab {
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    backdrop-filter: blur(12px);
    font-family: 'Geist', sans-serif;
    white-space: nowrap;
}
.lightbox-fab.edit {
    background: rgba(124,106,247,0.8);
    color: #fff;
    border: 1px solid rgba(167,139,250,0.4);
}
.lightbox-fab.edit:hover {
    background: rgba(124,106,247,1);
    box-shadow: 0 0 12px rgba(124,106,247,0.5);
}
.lightbox-fab.dl {
    background: rgba(15,107,14,0.92);
    color: #e8e8ff;
    border: 1px solid rgba(255,255,255,0.12);
}
.lightbox-fab.dl:hover {
    background: rgba(20,131,19,0.92);
}
.lightbox-fab.pdf {
    background: rgba(220,38,38,0.7);
    color: #fff;
    border: 1px solid rgba(239,68,68,0.3);
}
.lightbox-fab.pdf:hover {
    background: rgba(220,38,38,0.9);
    box-shadow: 0 0 12px rgba(220,38,38,0.4);
}

@keyframes fadeIn { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:translateY(0)} }
.animate-fade-in { animation: fadeIn 0.35s ease-out forwards; }

/* ══════════════════════════════════════
   AUTH PAGES
══════════════════════════════════════ */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
    position: relative;
    z-index: 1;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 32px;
    animation: fadeIn 0.35s ease-out forwards;
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    justify-content: center;
}
.auth-logo span {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.auth-logo span em {
    font-style: normal;
    color: var(--accent);
}

.auth-icon-circle {
    width: 56px;
    height: 56px;
    background: var(--accent-dim);
    border: 1px solid rgba(124,106,247,0.28);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--accent);
    margin: 0 auto 18px;
}

.auth-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 24px;
}

.auth-error {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 9px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #fca5a5;
    display: flex;
    align-items: center;
    gap: 8px;
}
.auth-error:empty { display: none; }
.auth-error i { color: #ef4444; flex-shrink: 0; }
.auth-error ul { list-style: none; padding: 0; margin: 0; }
.auth-error ul li { margin-bottom: 2px; }

.auth-field {
    margin-bottom: 16px;
}

.auth-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.auth-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-input-wrap:focus-within {
    border-color: rgba(124,106,247,0.5);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.auth-input-wrap i {
    color: var(--text-muted);
    font-size: 13px;
    flex-shrink: 0;
}

.auth-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Geist', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    padding: 12px 0;
}
.auth-input::placeholder { color: var(--text-muted); }

.otp-input-wrap { justify-content: center; }
.otp-input {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.3em;
    font-family: 'Geist Mono', monospace;
    max-width: 200px;
}

.auth-field-error {
    display: block;
    font-size: 12px;
    color: #f87171;
    margin-top: 4px;
    min-height: 0;
}
.auth-field-error:empty { display: none; }

.auth-btn {
    width: 100%;
    padding: 12px 20px;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    font-family: 'Geist', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
    box-shadow: 0 2px 12px var(--accent-glow);
    margin-top: 4px;
}
.auth-btn:hover {
    background: #8b7af8;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}
.auth-btn:active { transform: translateY(0); }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 20px 0;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.auth-divider span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 20px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: 'Geist', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.google-btn:hover {
    background: var(--surface-3);
    border-color: var(--border-hover);
}

.auth-footer-text {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 20px;
}

.auth-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.auth-link:hover { text-decoration: underline; }

/* ══════════════════════════════════════
   AUTH MODAL
══════════════════════════════════════ */
.auth-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 220;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}
.auth-modal-overlay.open {
    display: flex;
    animation: editModalIn 0.22s ease-out;
}
.auth-modal {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    margin: 20px;
    max-height: 90vh;
    overflow-y: auto;
}
.auth-screen { display: none; }
.auth-screen.active { display: block; }

.auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.auth-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.auth-modal-title i { color: var(--accent); font-size: 14px; }
.auth-modal-close-btn {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-secondary); font-size: 13px;
    transition: all 0.15s;
}
.auth-modal-close-btn:hover { background: var(--surface-3); color: var(--text-primary); }

.auth-modal-body { padding: 20px 22px; }

.auth-modal-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}
.auth-modal-desc strong { color: var(--accent); font-weight: 600; }

.auth-modal-field { margin-bottom: 14px; }

.auth-modal-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.auth-modal-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-modal-input-wrap:focus-within {
    border-color: rgba(124,106,247,0.5);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.auth-modal-input-wrap i { color: var(--text-muted); font-size: 13px; flex-shrink: 0; }

.auth-modal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Geist', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    padding: 11px 0;
}
.auth-modal-input::placeholder { color: var(--text-muted); }

.otp-input-style { justify-content: center; }
.otp-code-input {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.3em;
    font-family: 'Geist Mono', monospace;
    max-width: 200px;
}

.auth-modal-btn {
    width: 100%;
    padding: 11px 20px;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    font-family: 'Geist', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
    box-shadow: 0 2px 12px var(--accent-glow);
    margin-top: 4px;
}
.auth-modal-btn:hover { background: #8b7af8; transform: translateY(-1px); }
.auth-modal-btn:active { transform: translateY(0); }
.auth-modal-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.auth-modal-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 18px 0;
}
.auth-modal-divider::before,
.auth-modal-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.auth-modal-divider span {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.auth-modal-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 20px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: 'Geist', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.auth-modal-google-btn:hover { background: var(--surface-3); border-color: var(--border-hover); }

.auth-modal-footer-text {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 18px;
}

.auth-modal-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}
.auth-modal-link:hover { text-decoration: underline; }

.auth-modal-error {
    display: none;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 9px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #fca5a5;
    align-items: center;
    gap: 8px;
}

/* ══════════════════════════════════════
   AI EDIT MODAL
══════════════════════════════════════ */
.edit-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 210;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
}
.edit-modal-overlay.open {
    display: flex;
    animation: editModalIn 0.22s ease-out;
}
@keyframes editModalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.edit-modal {
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    margin: 20px;
}

.edit-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.edit-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.edit-modal-title i {
    color: var(--accent);
    font-size: 14px;
}
.edit-modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.15s;
}
.edit-modal-close-btn:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

.edit-modal-body {
    padding: 20px 22px;
}
.edit-modal-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.5;
}
.edit-prompt-textarea {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-family: 'Geist', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    resize: vertical;
    min-height: 80px;
    max-height: 200px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.edit-prompt-textarea::placeholder {
    color: var(--text-muted);
}
.edit-prompt-textarea:focus {
    border-color: rgba(124,106,247,0.5);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.edit-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--border);
}
.edit-cancel-btn {
    padding: 9px 18px;
    border-radius: 9px;
    font-family: 'Geist', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-2);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
}
.edit-cancel-btn:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}
.edit-submit-btn {
    padding: 9px 20px;
    border-radius: 9px;
    font-family: 'Geist', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    color: white;
    background: var(--accent);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.15s;
    box-shadow: 0 2px 8px var(--accent-glow);
}
.edit-submit-btn:hover {
    background: #8b7af8;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
}
.edit-submit-btn:active {
    transform: translateY(0);
}

/* ══════════════════════════════════════
   PROJECTS SIDEBAR
══════════════════════════════════════ */
.sidebar-projects-section {
    padding: 10px 12px 4px;
}
.sidebar-label-btn {
    width: 22px;
    height: 22px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.sidebar-label-btn:hover {
    background: var(--surface-3);
    color: var(--accent);
    border-color: var(--accent);
}
.projects-list {
    max-height: 200px;
    overflow-y: auto;
}
.projects-list::-webkit-scrollbar { width: 4px; }
.projects-list::-webkit-scrollbar-track { background: transparent; }
.projects-list::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

.project-item {
    margin-bottom: 2px;
}
.project-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 12.5px;
    color: var(--text-secondary);
}
.project-item-header:hover {
    background: var(--surface-2);
}
.project-toggle-btn {
    width: 16px;
    height: 16px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s;
    padding: 0;
}
.project-toggle-btn:hover { color: var(--text-primary); }
.project-icon {
    font-size: 11px;
    color: var(--accent);
    flex-shrink: 0;
}
.project-name {
    flex: 1;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.project-count {
    font-size: 10px;
    background: var(--surface-3);
    color: var(--text-muted);
    padding: 1px 6px;
    border-radius: 10px;
    flex-shrink: 0;
    font-weight: 600;
}
.project-menu-btn {
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: all 0.15s;
}
.project-item-header:hover .project-menu-btn { opacity: 1; }
.project-menu-btn:hover { background: var(--surface-3); color: var(--text-primary); }

.project-convos {
    padding-left: 22px;
}
.project-convo-item {
    padding: 4px 10px !important;
    font-size: 12px !important;
}
.project-convo-item .history-title {
    font-size: 11.5px;
}

/* Context Menu */
.project-context-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    padding: 4px;
    z-index: 300;
    min-width: 160px;
    animation: editModalIn 0.15s ease-out;
}
.context-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    border-radius: 7px;
    font-family: 'Geist', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.12s;
    text-align: left;
}
.context-btn:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}
.context-btn i {
    width: 14px;
    text-align: center;
    font-size: 11px;
}
.context-btn-danger {
    color: #f87171;
}
.context-btn-danger:hover {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
}

/* ══════════════════════════════════════
   BILLING HISTORY (Pricing Page)
══════════════════════════════════════ */
.billing-history-section {
    padding: 0 0 40px;
}
.billing-history-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    max-width: 700px;
    margin: 0 auto;
    overflow: hidden;
}
.billing-history-empty {
    padding: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}
.billing-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.billing-history-table th {
    background: var(--surface-2);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.billing-history-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}
.billing-history-table tr:last-child td { border-bottom: none; }
.billing-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.billing-status-succeeded { background: rgba(34,197,94,0.1); color: #22c55e; }
.billing-status-pending { background: rgba(245,158,11,0.1); color: #f59e0b; }
.billing-status-failed { background: rgba(239,68,68,0.1); color: #ef4444; }

/* ══════════════════════════════════════
   RESPONSIVE — TABLET  (≤ 900px)
══════════════════════════════════════ */
@media (max-width: 900px) {
    #sidebar {
        transform: translateX(-100%);
        width: 260px;
    }
    #sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 40px rgba(0,0,0,0.4);
    }
    #sidebar-overlay.open { display: block; }

    #main { margin-left: 0; }

    #menu-toggle { display: flex; }

    #topbar { padding: 12px 16px; }

    #chat-area { padding: 20px 16px 0; }

    .suggestion-grid { grid-template-columns: 1fr; max-width: 100%; }
    .welcome-title { font-size: 24px; }
    .welcome-sub { font-size: 14px; }
}

/* ══════════════════════════════════════
   RESPONSIVE — MOBILE  (≤ 520px)
══════════════════════════════════════ */
@media (max-width: 520px) {
    #topbar { padding: 10px 14px; }
    .topbar-title { font-size: 13px; }
    .status-pill { display: none; }

    #chat-area { padding: 14px 12px 0; }

    .welcome-avatar { width: 50px; height: 50px; font-size: 22px; }
    .welcome-title { font-size: 21px; }
    .welcome-sub { font-size: 13.5px; }
    .suggestion-grid { gap: 8px; }
    .suggestion-chip { padding: 11px 12px; }

    .msg-avatar { width: 28px; height: 28px; font-size: 12px; }
    .msg-text { font-size: 13.5px; }

    .input-top-bar { padding: 7px 12px; gap: 6px; }
    .mode-pill { padding: 3px 8px; font-size: 11.5px; }
    .size-pill { padding: 3px 8px; font-size: 11.5px; }
    .size-pill span { display: none; }
    .size-pill i { font-size: 11px; }

    .chat-textarea { font-size: 14px; }
    .field-label { font-size: 10px; width: 42px; }

    .preview-fab { padding: 6px 10px; font-size: 11px; }
    .result-card { max-width: 85%; }

    .lightbox-actions { gap: 5px; flex-wrap: wrap; justify-content: center; }
    .lightbox-fab { padding: 6px 12px; font-size: 11.5px; }

    .auth-container { padding: 16px; }
    .auth-card { padding: 28px 20px; }
    .auth-title { font-size: 20px; }
}

/* ══════════════════════════════════════
   SIDEBAR CREDITS
══════════════════════════════════════ */
.sidebar-credits {
    padding: 1px 12px;
    margin: 0 0 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.credits-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.credits-label i { color: #f59e0b; font-size: 12px; }
.credits-bar {
    width: 100%;
    height: 5px;
    background: var(--surface-3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}
.credits-bar-fill {
    height: 100%;
    background: #a78bfa;
    border-radius: 3px;
    transition: width 0.5s ease, background 0.3s;
}
.credits-plan-name {
    font-size: 10.5px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ══════════════════════════════════════
   NO CREDITS BANNER
══════════════════════════════════════ */
.no-credits-banner {
    padding: 18px 0;
}
.no-credits-content {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(245,158,11,0.08);
    border: 1px solid rgba(245,158,11,0.2);
    border-radius: 12px;
    padding: 16px 20px;
    position: relative;
}
.no-credits-content > i {
    font-size: 24px;
    color: #f59e0b;
    flex-shrink: 0;
}
.no-credits-content > div {
    flex: 1;
}
.no-credits-content strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.no-credits-content p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}
.no-credits-btn {
    flex-shrink: 0;
    padding: 8px 18px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Geist', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    box-shadow: 0 2px 8px var(--accent-glow);
    white-space: nowrap;
}
.no-credits-btn:hover { background: #8b7af8; transform: translateY(-1px); }
.no-credits-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    border-radius: 4px;
}
.no-credits-close:hover { color: var(--text-primary); background: var(--surface-3); }

/* ══════════════════════════════════════
   PRICING PAGE
══════════════════════════════════════ */
.pricing-page {
    min-height: 100vh;
    position: relative;
    z-index: 1;
    padding: 0 24px;
    max-width: 1200px;
    margin: 0 auto;
}
.pricing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}
.pricing-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.pricing-logo i {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: white;
    box-shadow: 0 0 14px var(--accent-glow);
}
.pricing-logo span { font-size: 15.5px; font-weight: 700; color: var(--text-primary); }
.pricing-logo span em { font-style: normal; color: var(--accent); }

.pricing-nav-btn {
    padding: 8px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.15s;
}
.pricing-nav-btn:hover { background: var(--surface-3); color: var(--text-primary); }

.pricing-hero {
    text-align: center;
    padding: 48px 0 36px;
}
.pricing-title {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.pricing-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto 28px;
    line-height: 1.6;
}

/* Billing Toggle */
.billing-toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 6px 20px;
}
.billing-label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.billing-label.billing-active { color: var(--text-primary); }
.billing-badge {
    background: #22c55e;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 24px;
    transition: all 0.3s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 4px var(--accent-glow);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Plan Cards */
.pricing-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}
.plan-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
    transition: all 0.2s;
    position: relative;
}
.plan-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.plan-popular {
    border-color: rgba(124,106,247,0.4);
    box-shadow: 0 0 0 1px rgba(124,106,247,0.15), 0 8px 32px rgba(124,106,247,0.1);
}
.plan-popular:hover {
    border-color: rgba(124,106,247,0.6);
    box-shadow: 0 0 0 1px rgba(124,106,247,0.25), 0 12px 40px rgba(124,106,247,0.15);
}
.plan-current {
    border-color: rgba(34,197,94,0.4);
}
.plan-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.plan-header { margin-bottom: 20px; }
.plan-name {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 6px;
}
.plan-tagline {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}
.plan-price {
    display: flex;
    align-items: baseline;
    gap: 2px;
}
.price-amount {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}
.price-period {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}
.plan-annual-note, .plan-monthly-note {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
}
.plan-tax-note {
    font-size: 10.5px;
    color: var(--text-muted);
    font-style: italic;
}

/* Plan features */
.plan-features {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    flex: 1;
}
.plan-features li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.plan-features li i {
    color: #22c55e;
    font-size: 11px;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

.plan-footer-note {
    font-size: 11.5px;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 18px;
    line-height: 1.4;
}

/* Plan buttons */
.plan-btn {
    width: 100%;
    padding: 11px 20px;
    border-radius: 10px;
    font-family: 'Geist', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.plan-btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    box-shadow: 0 2px 12px var(--accent-glow);
}
.plan-btn-primary:hover {
    background: #8b7af8;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}
.plan-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.plan-btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.plan-btn-outline:hover {
    background: var(--surface-2);
    border-color: var(--border-hover);
    color: var(--text-primary);
}
.plan-btn-current {
    background: rgba(34,197,94,0.1);
    color: #22c55e;
    border: 1px solid rgba(34,197,94,0.3);
}

/* Pricing Notes */
.pricing-notes {
    text-align: center;
    padding: 0 0 40px;
}
.pricing-notes p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.8;
}

/* Comparison Table */
.comparison-section {
    padding: 20px 0 40px;
}
.comparison-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 28px;
    letter-spacing: -0.02em;
}
.comparison-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.comparison-table th,
.comparison-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    white-space: nowrap;
}
.comparison-table th {
    background: var(--surface-2);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}
.comparison-table td { color: var(--text-secondary); }
.comparison-table tr:last-child td { border-bottom: none; }
.feature-name {
    text-align: left !important;
    font-weight: 600;
    color: var(--text-primary) !important;
}
.highlight-col {
    background: rgba(124,106,247,0.04);
}
.comp-badge {
    background: var(--accent);
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
    font-weight: 700;
    text-transform: uppercase;
}
.text-green { color: #22c55e !important; }
.text-red { color: #ef4444 !important; }
.text-muted { color: var(--text-muted) !important; }

/* Current Plan Section */
.current-plan-section {
    padding: 0 0 40px;
}
.current-plan-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    max-width: 500px;
    margin: 0 auto;
}
.current-plan-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.current-plan-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}
.current-plan-status {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.status-active {
    background: rgba(34,197,94,0.1);
    color: #22c55e;
    border: 1px solid rgba(34,197,94,0.3);
}
.status-inactive {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.3);
}
.current-plan-credits { margin-bottom: 16px; }
.credit-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.credit-reset-date {
    font-size: 11.5px;
    color: var(--text-muted);
}
.credit-bar {
    width: 100%;
    height: 8px;
    background: var(--surface-3);
    border-radius: 4px;
    overflow: hidden;
}
.credit-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #a78bfa);
    border-radius: 4px;
    transition: width 0.5s ease;
}
.cancel-sub-btn {
    padding: 9px 18px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 9px;
    font-family: 'Geist', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #f87171;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.cancel-sub-btn:hover {
    background: rgba(239,68,68,0.15);
}

/* Payment Result Pages */
.payment-result-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    z-index: 1;
}
.payment-result-card {
    text-align: center;
    max-width: 440px;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 48px 36px;
    animation: fadeIn 0.35s ease-out forwards;
}
.result-icon {
    font-size: 56px;
    margin-bottom: 24px;
}
.success-icon { color: #22c55e; }
.cancel-icon { color: #ef4444; }
.payment-result-card h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}
.payment-result-card p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 28px;
}
.result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.result-btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-family: 'Geist', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
}
.result-btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 12px var(--accent-glow);
}
.result-btn-primary:hover {
    background: #8b7af8;
    transform: translateY(-1px);
}
.result-btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.result-btn-outline:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

/* Pricing Footer */
.pricing-footer {
    text-align: center;
    padding: 24px 0;
    border-top: 1px solid var(--border);
}
.pricing-footer p {
    font-size: 12px;
    color: var(--text-muted);
}

/* Pricing page responsive */
@media (max-width: 900px) {
    .pricing-cards {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
    .pricing-title { font-size: 28px; }
    .pricing-subtitle { font-size: 14px; }
}

@media (max-width: 520px) {
    .pricing-page { padding: 0 14px; }
    .pricing-cards {
        grid-template-columns: 1fr;
    }
    .pricing-title { font-size: 24px; }
    .plan-card { padding: 22px 18px; }
    .price-amount { font-size: 1.8rem; }
    .comparison-table th,
    .comparison-table td {
        padding: 10px 10px;
        font-size: 11.5px;
    }
    .no-credits-content {
        flex-direction: column;
        text-align: center;
    }
}

/* ══════════════════════════════════════
   POLICY PAGES
══════════════════════════════════════ */
.policy-page {
    min-height: 100vh;
    position: relative;
    z-index: 1;
    padding: 0 24px;
    max-width: 820px;
    margin: 0 auto;
}
.policy-content {
    padding: 36px 0 48px;
    animation: fadeIn 0.35s ease-out forwards;
}
.policy-title {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.policy-date {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-style: italic;
}
.policy-content h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 32px;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}
.policy-content h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 20px;
    margin-bottom: 8px;
}
.policy-content p {
    font-size: 14.5px;
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 14px;
}
.policy-content a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.policy-content a:hover {
    text-decoration: underline;
}
.policy-footer {
    text-align: center;
    padding: 24px 0;
    border-top: 1px solid var(--border);
}
.policy-footer p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 10px;
}
.policy-footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.policy-footer-links a {
    font-size: 12.5px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}
.policy-footer-links a:hover {
    color: var(--accent);
}
.policy-footer-links span {
    color: var(--text-muted);
    font-size: 12px;
}

@media (max-width: 520px) {
    .policy-page { padding: 0 14px; }
    .policy-title { font-size: 24px; }
    .policy-content h2 { font-size: 16px; }
    .policy-content p { font-size: 13.5px; }
}

/* ══════════════════════════════════════
   MEATBALL MENU (Conversation History)
══════════════════════════════════════ */
.history-item {
    position: relative;
}
.history-meatball-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    flex-shrink: 0;
    opacity: 0;
    transition: all 0.15s;
    z-index: 2;
    padding: 0;
}
.history-item:hover .history-meatball-btn,
.history-meatball-btn.active {
    opacity: 1;
}
.history-meatball-btn:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}
.history-meatball-btn.active {
    background: var(--surface-3);
    color: var(--accent);
}

/* Conversation context menu — enhanced for meatball */
.convo-context-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    padding: 4px;
    z-index: 300;
    min-width: 180px;
    animation: editModalIn 0.15s ease-out;
    position: fixed;
}
.convo-context-menu .context-menu-label {
    padding: 6px 12px;
    font-size: 10.5px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.convo-context-menu .context-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 6px;
}
.convo-context-menu .context-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    border-radius: 7px;
    font-family: 'Geist', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.12s;
    text-align: left;
}
.convo-context-menu .context-btn:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}
.convo-context-menu .context-btn i {
    width: 14px;
    text-align: center;
    font-size: 11px;
}
.convo-context-menu .context-submenu {
    padding-left: 6px;
}
.convo-context-menu .context-submenu .context-btn {
    font-size: 12.5px;
    padding: 6px 12px;
}
.convo-context-menu .context-submenu .context-btn i {
    font-size: 10px;
}

/* ══════════════════════════════════════
   INLINE PROMPT MODAL
══════════════════════════════════════ */
.prompt-modal-dialog {
    max-width: 420px;
}

/* ═══════════════════════════════════════
   MULTI-PAGE DOCUMENT
═══════════════════════════════════════ */

/* New Doc Button (sidebar) */
.new-doc-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: calc(100% - 24px);
    margin: 4px 12px 8px;
    padding: 1px 16px;
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Geist', sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.new-doc-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(167, 139, 250, 0.06);
}
.new-doc-btn i {
    font-size: 14px;
}

/* Multi-page header in messages */
.multipage-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 20px 24px;
    gap: 8px;
}
.multipage-header-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    margin-bottom: 8px;
}
.multipage-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}
.multipage-header p {
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
    max-width: 420px;
}

/* Slide count control */
.slide-count-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}
.slide-count-select {
    flex: 1;
    max-width: 160px;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-primary);
    font-family: 'Geist', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, background 0.25s, color 0.25s;
}
.slide-count-select option {
    background: var(--surface-2);
    color: var(--text-primary);
}
[data-theme="dark"] .slide-count-select {
    color-scheme: dark;
}
[data-theme="light"] .slide-count-select {
    color-scheme: light;
}
.slide-count-select:focus {
    border-color: var(--accent);
}

/* Multi-page status */
.mp-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--surface-2);
    font-size: 13.5px;
    color: var(--text-secondary);
}
.mp-status-text {
    flex: 1;
}

/* Slide header */
.slide-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.slide-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.slide-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Slide versions horizontal scroller */
.slide-versions-scroller {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 0 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    flex: 1;
    min-width: 0;
}
.slide-versions-scroller::-webkit-scrollbar {
    height: 6px;
}
.slide-versions-scroller::-webkit-scrollbar-track {
    background: transparent;
}
.slide-versions-scroller::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Slide version card */
.slide-version-card {
    position: relative;
    flex: 0 0 auto;
    min-width: 300px;
    max-width: 600px;
    scroll-snap-align: start;
    border-radius: 12px;
    border: 2px solid transparent;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.slide-version-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.15);
}
.slide-version-card .preview-wrap {
    border-radius: 10px;
    overflow: hidden;
}
.slide-version-card .preview-wrap img {
    width: 100%;
    display: block;
    cursor: pointer;
}

/* Slide selection tick */
.slide-select-tick {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    color: rgba(255,255,255,0.5);
    font-size: 12px;
}
.slide-select-tick:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0,0,0,0.5);
}
.slide-select-tick.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    border: white solid 1px;
}

/* Slide scroller wrapper with nav arrows */
.slide-scroller-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
}
.slide-nav-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
    z-index: 5;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.slide-nav-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    transform: scale(1.08);
    box-shadow: 0 4px 14px var(--accent-glow);
}
.slide-nav-btn:active {
    transform: scale(0.95);
}
.slide-nav-btn.hidden {
    opacity: 0;
    pointer-events: none;
}
.slide-nav-left {
    margin-right: 6px;
}
.slide-nav-right {
    margin-left: 6px;
}

/* Slide edit loading indicator (enhanced) */
.slide-edit-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    margin-top: 6px;
    border-radius: 8px;
    background: var(--surface-2);
    font-size: 13px;
    color: var(--text-muted);
}

/* Slide editing overlay — prominent visual feedback */
.slide-editing-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    animation: slideOverlayIn 0.3s ease-out;
}
@keyframes slideOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.slide-editing-overlay .slide-edit-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: slideEditSpin 0.7s linear infinite;
}
@keyframes slideEditSpin {
    to { transform: rotate(360deg); }
}
.slide-editing-overlay .slide-edit-label {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.slide-editing-overlay .slide-edit-sublabel {
    color: rgba(255,255,255,0.7);
    font-size: 11px;
    font-weight: 400;
}

/* Pulse glow on the slide card being edited */
.mp-slide-card.editing {
    animation: slideEditPulse 1.8s ease-in-out infinite;
}
@keyframes slideEditPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124,106,247,0); }
    50% { box-shadow: 0 0 0 6px rgba(124,106,247,0.25); }
}

/* Combined PDF button */
.combined-pdf-wrap {
    display: flex;
    justify-content: center;
    padding: 20px 0 40px;
}
.combined-pdf-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 32px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    color: #fff;
    font-family: 'Geist', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}
.combined-pdf-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}
.combined-pdf-btn i {
    font-size: 18px;
    margin-right: 6px;
}
.combined-pdf-count {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.85;
}

/* Slides stacked container */
.mp-slides-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 16px;
    max-width: 700px;
    margin: 0 auto;
}
.mp-slide-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Multi-page mode input area adjustments */
#input-area.multipage-mode .slide-count-wrap {
    display: flex;
}

/* ══════════════════════════════════════════════════════
   READY STYLES — Gallery Page
   ══════════════════════════════════════════════════════ */

/* Ready Styles sidebar button accent */
.ready-styles-btn {
    border-color: rgba(167,139,250,0.3) !important;
    color: var(--text-muted) !important;
}
.ready-styles-btn:hover {
    border-color: rgba(167,139,250,0.6) !important;
    background: rgba(167,139,250,0.1) !important;
    color: #a78bfa !important;
}
.ready-styles-btn i {
    color: #a78bfa;
}

/* Page container */
.rs-page {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
}

/* Header */
.rs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--sidebar-bg);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.rs-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.rs-back-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--hover);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
}
.rs-back-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.rs-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.rs-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #a78bfa, #6366f1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
}
.rs-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}
.rs-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}
.rs-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.rs-credits-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    background: rgba(167,139,250,0.1);
    border: 1px solid rgba(167,139,250,0.3);
    color: #a78bfa;
    font-size: 13px;
    font-weight: 600;
}
.rs-login-btn {
    padding: 8px 16px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: opacity 0.2s;
}
.rs-login-btn:hover { opacity: 0.9; }

/* Filter bar */
.rs-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--sidebar-bg);
    gap: 16px;
    flex-wrap: wrap;
}
.rs-filter-scroll {
    display: ruby;
    gap: 8px;
    overflow-x: auto;
    flex: 1;
    padding: 4px 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.rs-filter-scroll::-webkit-scrollbar { display: none; }
.rs-filter-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.rs-filter-chip:hover {
    border-color: var(--accent);
    color: var(--text);
}
.rs-filter-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.rs-tier-legend {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}
.rs-tier-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 12px;
}
.rs-tier-badge.basic {
    color: #10b981;
    background: rgba(16,185,129,0.1);
}
.rs-tier-badge.standard {
    color: #f59e0b;
    background: rgba(245,158,11,0.1);
}
.rs-tier-badge.premium {
    color: #a78bfa;
    background: rgba(167,139,250,0.1);
}

/* Search & Toolbar */
.rs-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.rs-search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.rs-search-wrap:focus-within {
    border-color: rgba(124,106,247,0.5);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.rs-search-icon {
    color: var(--text-muted);
    font-size: 13px;
    flex-shrink: 0;
}
.rs-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Geist', sans-serif;
    font-size: 13.5px;
    color: var(--text-primary);
    padding: 9px 0;
}
.rs-search-input::placeholder { color: var(--text-muted); }
.rs-search-clear {
    width: 22px;
    height: 22px;
    border: none;
    background: var(--surface-3);
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.rs-search-clear:hover { background: var(--accent); color: #fff; }
.rs-toolbar-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.rs-aspect-filter {
    display: flex;
    gap: 4px;
    background: var(--surface-2);
    border-radius: 8px;
    padding: 3px;
}
.rs-aspect-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Geist', sans-serif;
}
.rs-aspect-chip.active {
    background: var(--surface-3);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.rs-aspect-chip:hover:not(.active) { color: var(--text-secondary); }
.rs-aspect-chip svg { display: block; }

/* Results count bar */
.rs-results-bar {
    padding: 8px 24px;
    font-size: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

/* Card meta row (category + aspect) */
.rs-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2px;
}
.rs-card-aspect {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--surface-3);
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

/* Gallery grid */
.rs-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    padding: 20px 24px;
    flex: 1;
}

/* Style card */
.rs-card {
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--sidebar-bg);
    overflow: hidden;
    transition: all 0.25s;
    cursor: pointer;
}
.rs-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}
.rs-card.rs-locked {
    opacity: 0.7;
}
.rs-card.rs-locked:hover {
    border-color: var(--border);
    transform: none;
    box-shadow: none;
}
.rs-card-img-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--hover);
}
.rs-card-img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s;
}
.rs-card:hover .rs-card-img {
    transform: scale(1.02);
}
.rs-card-placeholder {
    width: 100%;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 48px;
    opacity: 0.3;
}
.rs-card-tier-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(8px);
}
.rs-card-tier-badge.basic {
    background: rgba(16,185,129,0.9);
    color: #fff;
}
.rs-card-tier-badge.standard {
    background: rgba(245,158,11,0.9);
    color: #fff;
}
.rs-card-tier-badge.premium {
    background: rgba(167,139,250,0.9);
    color: #fff;
}

/* "Use This Style" floating button */
.rs-use-btn {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 20px;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    transition: all 0.25s;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(99,102,241,0.4);
    z-index: 5;
}
.rs-use-btn i { margin-right: 6px; }
.rs-card:hover .rs-use-btn {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
/* Preview button (view larger) */
.rs-preview-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    color: #fff;
    border: none;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}
.rs-card:hover .rs-preview-btn { opacity: 1; }
.rs-preview-btn:hover { background: var(--accent); }

/* Ready Styles Lightbox */
.rs-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.rs-lightbox.open { display: flex; }
.rs-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    cursor: default;
}
.rs-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.rs-lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* Lock overlay for tier-restricted styles */
.rs-card-lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.25s;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}
.rs-card-lock-overlay i { font-size: 24px; }
.rs-card.rs-locked:hover .rs-card-lock-overlay { opacity: 1; }

/* Card info */
.rs-card-info {
    padding: 12px 16px;
}
.rs-card-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}
.rs-card-category {
    font-size: 12px;
    color: var(--text-muted);
}

/* Loading & Empty states */
.rs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-muted);
    font-size: 14px;
}
.rs-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: rs-spin 0.8s linear infinite;
}
.rs-spinner.large {
    width: 48px;
    height: 48px;
    border-width: 4px;
}
@keyframes rs-spin {
    to { transform: rotate(360deg); }
}
.rs-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    color: var(--text-muted);
    gap: 12px;
}
.rs-empty i {
    font-size: 48px;
    opacity: 0.3;
}
.rs-empty p { margin: 0; font-size: 16px; }
.rs-empty-hint { font-size: 13px; opacity: 0.7; }

/* Style prompt modal tweaks */
.style-prompt-dialog {
    max-width: 520px;
}
.style-preview-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--hover);
    border-radius: 12px;
    margin-bottom: 16px;
}
.style-preview-mini img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}
.style-preview-name {
    font-weight: 600;
    font-size: 15px;
}
.style-prompt-modes {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.style-prompt-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(16,185,129,0.1);
    color: #10b981;
    font-size: 12px;
    margin-bottom: 12px;
}

/* Generating overlay */
.style-generating-card {
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 400px;
}
.style-generating-card h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}
.style-generating-card p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

/* Shake animation for empty input */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.shake { animation: shake 0.4s ease-in-out; }

/* Responsive */
@media (max-width: 768px) {
    .rs-gallery {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
        padding: 12px 16px;
    }
    .rs-header { padding: 12px 16px; }
    .rs-filter-bar { padding: 8px 16px; }
    .rs-toolbar { padding: 10px 16px; flex-direction: column; align-items: stretch; }
    .rs-search-wrap { max-width: none; }
    .rs-toolbar-filters { justify-content: space-between; }
    .rs-results-bar { padding: 6px 16px; }
    .rs-title { font-size: 18px; }
    .rs-tier-legend { display: none; }
    .rs-use-btn {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
        font-size: 12px;
        padding: 8px 14px;
    }
    .rs-preview-btn { opacity: 1; }
}

/* ══════════════════════════════════════
   SETTINGS PAGE
══════════════════════════════════════ */
.settings-page {
    min-height: 100vh;
    position: relative;
    z-index: 1;
    padding: 0 24px;
    max-width: 720px;
    margin: 0 auto;
}
.settings-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}
.settings-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.settings-header-title h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.settings-logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}
.settings-back-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    flex-shrink: 0;
}
.settings-back-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.settings-section {
    margin-bottom: 32px;
}
.settings-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.settings-section-header i {
    color: var(--accent);
    font-size: 16px;
}
.settings-section-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}
.settings-section-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--accent-dim);
    color: var(--accent);
    margin-left: auto;
}

.settings-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
}

/* Profile */
.profile-info-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
.profile-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #6055e8, #a78bfa);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    font-weight: 700;
    flex-shrink: 0;
}
.profile-details {
    flex: 1;
    min-width: 0;
}
.profile-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}
.profile-email {
    font-size: 13px;
    color: var(--text-muted);
}
.profile-plan-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(124,106,247,0.3);
}

/* Upgrade CTA */
.settings-upgrade-card {
    border-color: rgba(124,106,247,0.2);
}
.upgrade-cta {
    display: flex;
    align-items: center;
    gap: 20px;
}
.upgrade-cta-icon {
    width: 56px;
    height: 56px;
    background: var(--accent-dim);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--accent);
    flex-shrink: 0;
}
.upgrade-cta-text {
    flex: 1;
}
.upgrade-cta-text h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.upgrade-cta-text p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}
.upgrade-cta-plans {
    margin-top: 6px !important;
    font-size: 12px !important;
    color: var(--text-muted) !important;
}
.upgrade-cta-btn {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: 'Geist', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.15s;
    box-shadow: 0 2px 12px var(--accent-glow);
    white-space: nowrap;
    flex-shrink: 0;
}
.upgrade-cta-btn:hover {
    background: #8b7af8;
    transform: translateY(-1px);
}

/* Brand Kit List */
.brandkit-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.brandkit-loading, .brandkit-error {
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}
.brandkit-empty {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
}
.brandkit-empty i {
    font-size: 32px;
    opacity: 0.3;
    margin-bottom: 10px;
    display: block;
}
.brandkit-empty p {
    font-size: 13px;
    margin: 0;
}

.brandkit-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.15s;
}
.brandkit-card:hover {
    border-color: var(--border-hover);
}
.brandkit-card-colors {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.brandkit-swatch {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid var(--border);
}
.brandkit-card-info {
    flex: 1;
    min-width: 0;
}
.brandkit-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.brandkit-card-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}
.brandkit-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.brandkit-edit-btn, .brandkit-delete-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.brandkit-edit-btn:hover {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: rgba(124,106,247,0.3);
}
.brandkit-delete-btn:hover {
    background: rgba(239,68,68,0.08);
    color: #ef4444;
    border-color: rgba(239,68,68,0.2);
}

.create-brandkit-btn {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Geist', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
    margin-top: 10px;
}
.create-brandkit-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

/* Brand Kit Modal */
.brandkit-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 220;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}
.brandkit-modal-overlay.active {
    display: flex;
    animation: editModalIn 0.22s ease-out;
}
.brandkit-modal {
    width: 100%;
    max-width: 520px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    margin: 20px;
    max-height: 90vh;
    overflow-y: auto;
}
.brandkit-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.brandkit-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.brandkit-modal-title i { color: var(--accent); font-size: 14px; }
.brandkit-modal-close-btn {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-secondary); font-size: 13px;
    transition: all 0.15s;
}
.brandkit-modal-close-btn:hover { background: var(--surface-3); color: var(--text-primary); }

.brandkit-modal-body { padding: 20px 22px; }
.brandkit-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--border);
}

.brandkit-field { margin-bottom: 16px; }
.brandkit-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 12px;
}
.brandkit-input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    font-family: 'Geist', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.brandkit-input:focus {
    border-color: rgba(124,106,247,0.5);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.brandkit-input::placeholder { color: var(--text-muted); }

.brandkit-colors-row {
    /* display: flex; */
    gap: 12px;
    margin-bottom: 12px;
}
.brandkit-color-field {
    flex: 1;
}
.brandkit-color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.brandkit-color-picker {
    width: 40px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
    background: var(--surface-2);
}
.brandkit-color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.brandkit-color-picker::-webkit-color-swatch { border: none; border-radius: 5px; }
.brandkit-hex-input {
    flex: 1;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 10px;
    font-family: 'Geist Mono', monospace;
    font-size: 12px;
    color: var(--text-primary);
    outline: none;
    min-width: 0;
}
.brandkit-hex-input:focus {
    border-color: rgba(124,106,247,0.5);
}

.brandkit-color-preview {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}
.brandkit-preview-swatch {
    flex: 1;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Logo section */
.brandkit-logo-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.brandkit-logo-area {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.brandkit-logo-preview {
    width: 80px;
    height: 80px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 24px;
    flex-shrink: 0;
    overflow: hidden;
}
.brandkit-logo-preview span {
    font-size: 9px;
    text-align: center;
}
.brandkit-logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.brandkit-logo-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.brandkit-logo-upload-btn {
    padding: 8px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Geist', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}
.brandkit-logo-upload-btn:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}
.brandkit-logo-remove-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 8px;
    font-family: 'Geist', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #f87171;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s;
}
.brandkit-logo-remove-btn:hover {
    background: rgba(239,68,68,0.08);
}
.brandkit-logo-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
}

.brandkit-cancel-btn {
    padding: 9px 18px;
    border-radius: 9px;
    font-family: 'Geist', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-2);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
}
.brandkit-cancel-btn:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}
.brandkit-save-btn {
    padding: 9px 20px;
    border-radius: 9px;
    font-family: 'Geist', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    color: white;
    background: var(--accent);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.15s;
    box-shadow: 0 2px 8px var(--accent-glow);
}
.brandkit-save-btn:hover {
    background: #8b7af8;
    transform: translateY(-1px);
}
.brandkit-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Brand Kit Dropdown in Style Input */
.brandkit-select-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.brandkit-select {
    padding: 5px 10px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-primary);
    font-family: 'Geist', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, background 0.25s, color 0.25s;
    max-width: 160px;
}
.brandkit-select option {
    background: var(--surface-2);
    color: var(--text-primary);
}
[data-theme="dark"] .brandkit-select { color-scheme: dark; }
[data-theme="light"] .brandkit-select { color-scheme: light; }
.brandkit-select:focus { border-color: var(--accent); }

.brandkit-logo-check {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
}
.brandkit-logo-check input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* Settings responsive */
@media (max-width: 520px) {
    .settings-page { padding: 0 14px; }
    .settings-header-title h1 { font-size: 18px; }
    .upgrade-cta { flex-direction: column; text-align: center; }
    .brandkit-colors-row { flex-direction: column; gap: 10px; }
    .brandkit-logo-area { flex-direction: column; }
}
