/* erpdev — ChatGPT-style Dark Theme */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2128;
    --bg-sidebar: #0d1117;
    --bg-input: #1c2128;
    --bg-msg-user: #1c2128;
    --bg-msg-assistant: transparent;
    --bg-code: #161b22;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
    --border: #30363d;
    --border-light: #21262d;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ===== SECTIONS ===== */
.section { display: none; min-height: 100vh; }
.section.active { display: block; }

/* ===== BUTTONS ===== */
.btn-primary {
    background: var(--accent); color: white; border: none;
    padding: 0.75rem 1.5rem; border-radius: var(--radius-sm);
    font-size: 0.95rem; cursor: pointer; font-weight: 500;
    transition: all 0.2s; display: inline-flex; align-items: center; gap: 0.5rem;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.btn-lg { padding: 1rem 2rem; font-size: 1.05rem; border-radius: var(--radius); }

.btn-outline {
    background: transparent; color: var(--text-primary); border: 1px solid var(--border);
    padding: 0.75rem 1.5rem; border-radius: var(--radius-sm);
    font-size: 0.95rem; cursor: pointer; font-weight: 500; transition: all 0.2s;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-outline.btn-lg { padding: 1rem 2rem; font-size: 1.05rem; border-radius: var(--radius); }

.btn-google {
    background: white; color: #333; border: 1px solid #ddd;
    padding: 0.75rem 1.5rem; border-radius: var(--radius-sm);
    font-size: 0.95rem; cursor: pointer; width: 100%; font-weight: 500;
    display: flex; align-items: center; justify-content: center; gap: 0.75rem;
    transition: background 0.2s;
}
.btn-google:hover { background: #f5f5f5; }

.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.9rem; }
.btn-link:hover { text-decoration: underline; }

.btn-back {
    background: transparent; color: var(--text-secondary); border: 1px solid var(--border);
    padding: 0.5rem 1rem; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 0.9rem; transition: all 0.2s;
}
.btn-back:hover { color: var(--text-primary); border-color: var(--text-secondary); }

.btn-danger {
    background: var(--danger); color: white; border: none;
    padding: 0.5rem 1rem; border-radius: var(--radius-sm); cursor: pointer;
}
.btn-danger:hover { opacity: 0.9; }

/* ===== LANDING ===== */
#landing-section { padding: 0; }

.landing-nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 3rem; background: rgba(13, 17, 23, 0.95);
    backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.nav-brand { font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; }
.brand-icon { font-size: 1.4rem; }
.nav-links { display: flex; gap: 1.25rem; align-items: center; }
.nav-links a { color: var(--text-secondary); text-decoration: none; font-size: 0.9rem; }
.nav-links a:hover { color: var(--text-primary); text-decoration: none; }
.nav-links .btn-outline { padding: 0.5rem 1rem; font-size: 0.85rem; }
.nav-links .btn-primary { padding: 0.5rem 1rem; font-size: 0.85rem; }

.hero {
    text-align: center; padding: 6rem 2rem 4rem;
    background: radial-gradient(ellipse at top, var(--accent-glow), transparent 60%);
}
.hero h1 { font-size: 3rem; font-weight: 700; line-height: 1.2; margin-bottom: 1.5rem; }
.gradient-text {
    background: linear-gradient(135deg, var(--accent), #a78bfa, #f472b6);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-sub { color: var(--text-secondary); font-size: 1.15rem; max-width: 640px; margin: 0 auto 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* Demo */
.demo-section { padding: 4rem 3rem; text-align: center; }
.demo-section h2 { font-size: 1.8rem; margin-bottom: 2rem; }
.demo-examples { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; max-width: 960px; margin: 0 auto; }
.example-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem; text-align: left;
    cursor: pointer; transition: all 0.25s;
}
.example-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1); }
.example-icon { font-size: 1.5rem; display: block; margin-bottom: 0.5rem; }
.example-card strong { display: block; margin-bottom: 0.4rem; font-size: 0.95rem; }
.example-card p { color: var(--text-secondary); font-size: 0.85rem; margin: 0; line-height: 1.4; }

/* Features */
.features-section { padding: 4rem 3rem; background: var(--bg-secondary); }
.features-section h2 { text-align: center; font-size: 1.8rem; margin-bottom: 2.5rem; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; max-width: 960px; margin: 0 auto; }
.feature-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.75rem;
}
.feature-icon { font-size: 2rem; display: block; margin-bottom: 0.75rem; }
.feature-card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-secondary); font-size: 0.9rem; }

/* Pricing */
.pricing-section { padding: 4rem 3rem; text-align: center; }
.pricing-section h2 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.pricing-sub { color: var(--text-secondary); margin-bottom: 2.5rem; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; max-width: 900px; margin: 0 auto; }
.price-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 2rem; position: relative;
    transition: transform 0.2s;
}
.price-card:hover { transform: translateY(-4px); }
.price-card.featured { border-color: var(--accent); box-shadow: 0 0 24px rgba(99, 102, 241, 0.15); }
.badge-popular {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: white; padding: 0.25rem 1rem;
    border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}
.price-card h4 { font-size: 1.25rem; margin-bottom: 0.25rem; }
.price { font-size: 2.2rem; font-weight: 700; margin: 0.75rem 0; }
.price span { font-size: 1rem; font-weight: 400; color: var(--text-secondary); }
.price-card ul { list-style: none; margin: 1.5rem 0; text-align: left; }
.price-card li { padding: 0.35rem 0; color: var(--text-secondary); font-size: 0.9rem; }
.price-card .btn-primary, .price-card .btn-outline { width: 100%; justify-content: center; }

.landing-footer { padding: 2rem 3rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; border-top: 1px solid var(--border); }
.landing-footer a { color: var(--text-secondary); }

/* ===== AUTH ===== */
#login-section, #register-section {
    display: none; min-height: 100vh;
    background: var(--bg-primary);
    align-items: center; justify-content: center; padding: 2rem;
}
#login-section.active, #register-section.active { display: flex; }

.auth-card {
    width: 100%; max-width: 400px; background: var(--bg-card);
    padding: 2.5rem; border-radius: var(--radius); box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.auth-brand { text-align: center; font-size: 1.2rem; margin-bottom: 1.5rem; cursor: pointer; }
.auth-card h2 { margin-bottom: 1.5rem; text-align: center; font-size: 1.4rem; }
.auth-card input {
    width: 100%; padding: 0.8rem 1rem; margin-bottom: 0.75rem;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary); font-size: 0.95rem;
    transition: border-color 0.2s;
}
.auth-card input:focus { outline: none; border-color: var(--accent); }
.auth-card button[type="submit"] { width: 100%; margin-top: 0.5rem; }
.divider { text-align: center; margin: 1.5rem 0; color: var(--text-muted); position: relative; }
.divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.divider span { background: var(--bg-card); padding: 0 1rem; position: relative; z-index: 1; font-size: 0.85rem; }
.auth-link { text-align: center; margin-top: 1.25rem; color: var(--text-secondary); font-size: 0.9rem; }
.auth-link a { color: var(--accent); }

/* ===== APP LAYOUT (Sidebar + Chat) ===== */
#app-section.active { display: flex; }

.app-layout { display: flex; width: 100%; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
    width: 260px; min-width: 260px; background: var(--bg-sidebar);
    border-right: 1px solid var(--border); display: flex; flex-direction: column;
    height: 100vh; overflow: hidden;
}
.sidebar-header { padding: 1rem; border-bottom: 1px solid var(--border); }
.btn-new-chat {
    width: 100%; padding: 0.65rem; background: transparent;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-primary); font-size: 0.9rem; cursor: pointer;
    transition: all 0.2s;
}
.btn-new-chat:hover { background: var(--bg-card); border-color: var(--text-secondary); }

.session-list { flex: 1; overflow-y: auto; padding: 0.5rem; }
.session-list::-webkit-scrollbar { width: 4px; }
.session-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.session-group-label {
    padding: 0.5rem 0.75rem; font-size: 0.75rem; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
}
.session-item {
    display: flex; align-items: center; padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm); cursor: pointer; transition: background 0.15s;
    margin-bottom: 1px;
}
.session-item:hover { background: var(--bg-card); }
.session-item.active { background: var(--bg-card); }
.session-title {
    flex: 1; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; color: var(--text-primary);
}
.session-delete {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.1rem; cursor: pointer; opacity: 0; transition: opacity 0.15s;
    padding: 0 0.25rem;
}
.session-item:hover .session-delete { opacity: 1; }
.session-delete:hover { color: var(--danger); }
.no-sessions { color: var(--text-muted); font-size: 0.85rem; padding: 1rem 0.75rem; }

.sidebar-footer {
    padding: 0.75rem 1rem; border-top: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 0.5rem;
}
.user-info-sidebar { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.sidebar-actions { display: flex; gap: 0.25rem; }
.sidebar-actions button {
    background: transparent; border: 1px solid var(--border);
    border-radius: 6px; padding: 0.35rem 0.5rem; cursor: pointer;
    font-size: 0.85rem; transition: background 0.15s;
}
.sidebar-actions button:hover { background: var(--bg-card); }

.plan-badge {
    font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.5rem;
    border-radius: 10px; text-transform: uppercase; letter-spacing: 0.03em;
}
.plan-free { background: var(--border); color: var(--text-secondary); }
.plan-basic { background: rgba(99, 102, 241, 0.2); color: var(--accent-hover); }
.plan-premium { background: rgba(244, 114, 182, 0.2); color: #f472b6; }

/* ===== CHAT MAIN ===== */
.chat-main {
    flex: 1; display: flex; flex-direction: column; height: 100vh;
    overflow: hidden; position: relative;
}

/* Welcome screen */
.chat-welcome {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; padding: 2rem;
}
.chat-welcome h2 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.chat-welcome > p { color: var(--text-secondary); margin-bottom: 2rem; }

.welcome-examples {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem; max-width: 600px; width: 100%;
}
.welcome-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 1rem; cursor: pointer;
    transition: all 0.2s; text-align: left;
}
.welcome-card:hover { border-color: var(--accent); background: var(--bg-secondary); }
.welcome-card strong { display: block; font-size: 0.85rem; margin-bottom: 0.35rem; }
.welcome-card span { color: var(--text-secondary); font-size: 0.8rem; line-height: 1.3; }

.daily-limit-info {
    margin-top: 1.5rem; padding: 0.75rem 1.25rem; background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25); border-radius: var(--radius-sm);
    font-size: 0.85rem; color: var(--text-secondary);
}
.daily-limit-info strong { color: var(--accent-hover); }

/* Messages */
.chat-messages {
    flex: 1; overflow-y: auto; display: flex; flex-direction: column;
    padding: 0; scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }

.chat-msg {
    display: flex; gap: 1rem; padding: 1.25rem 2rem;
    max-width: 100%; animation: msgIn 0.2s ease;
}
.chat-msg.user { background: var(--bg-msg-user); }
.chat-msg.assistant { background: var(--bg-msg-assistant); }

.msg-avatar {
    width: 32px; height: 32px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0; margin-top: 2px;
    background: var(--bg-card); border: 1px solid var(--border);
}
.msg-body { flex: 1; min-width: 0; }
.msg-content { font-size: 0.95rem; line-height: 1.7; overflow-wrap: break-word; }
.msg-content p { margin-bottom: 0.6rem; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content h2, .msg-content h3, .msg-content h4 {
    margin: 1rem 0 0.5rem; font-weight: 600;
}
.msg-content h2 { font-size: 1.2rem; }
.msg-content h3 { font-size: 1.1rem; }
.msg-content h4 { font-size: 1rem; }
.msg-content ul, .msg-content ol { padding-left: 1.5rem; margin-bottom: 0.6rem; }
.msg-content li { margin-bottom: 0.25rem; }
.msg-content strong { color: var(--text-primary); font-weight: 600; }
.msg-content em { color: var(--text-secondary); }

/* Code blocks */
.msg-content pre.code-block {
    background: var(--bg-code); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 1rem; margin: 0.75rem 0;
    overflow-x: auto; position: relative;
}
.msg-content pre.code-block code {
    font-family: var(--font-mono); font-size: 0.85rem;
    line-height: 1.6; color: var(--text-primary); white-space: pre;
}
.code-lang {
    position: absolute; top: 0.5rem; right: 0.5rem;
    font-size: 0.7rem; color: var(--text-muted);
    font-family: var(--font-mono); text-transform: uppercase;
}
.copy-btn {
    position: absolute; top: 0.5rem; right: 0.5rem;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary); padding: 0.2rem 0.5rem;
    border-radius: 4px; font-size: 0.72rem; cursor: pointer;
    transition: all 0.15s; opacity: 0;
}
pre.code-block:hover .copy-btn { opacity: 1; }
pre.code-block:hover .code-lang { opacity: 0; }
.copy-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }

.msg-content .inline-code {
    background: var(--bg-code); border: 1px solid var(--border);
    padding: 0.15rem 0.4rem; border-radius: 4px;
    font-family: var(--font-mono); font-size: 0.85em; color: #e18ad0;
}

/* Tables in messages */
.msg-content .md-table {
    width: 100%; border-collapse: collapse; margin: 0.75rem 0;
    font-size: 0.88rem;
}
.msg-content .md-table td {
    padding: 0.5rem 0.75rem; border: 1px solid var(--border);
}
.msg-content .md-table tr:nth-child(odd) { background: var(--bg-code); }

/* Typing indicator */
.typing-dots { display: flex; gap: 4px; padding: 0.5rem 0; }
.typing-dots span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted); animation: blink 1.4s infinite both;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

.loading-messages { padding: 2rem; text-align: center; color: var(--text-muted); }

.chat-upgrade-cta {
    display: flex; justify-content: center; padding: 1rem 0;
    animation: msgIn 0.3s ease;
}
.chat-upgrade-cta .btn {
    font-size: 1.1rem; padding: 0.75rem 2rem; border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff; border: none; cursor: pointer; font-weight: 600;
    box-shadow: 0 4px 12px rgba(99,102,241,0.3); transition: transform 0.2s, box-shadow 0.2s;
}
.chat-upgrade-cta .btn:hover {
    transform: translateY(-2px); box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}

@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== CHAT INPUT ===== */
.chat-input-area { padding: 0.75rem 1.5rem 1rem; background: var(--bg-primary); }
.chat-input-container {
    display: flex; align-items: flex-end; gap: 0.5rem;
    max-width: 768px; margin: 0 auto;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0.5rem 0.75rem;
    transition: border-color 0.2s;
}
.chat-input-container:focus-within { border-color: var(--accent); }

#chat-input {
    flex: 1; background: transparent; border: none; color: var(--text-primary);
    font-size: 0.95rem; font-family: inherit; line-height: 1.5;
    resize: none; outline: none; max-height: 200px; min-height: 24px;
    padding: 0.35rem 0;
}
#chat-input::placeholder { color: var(--text-muted); }

.btn-audio, .btn-send {
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; padding: 0.4rem; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; flex-shrink: 0;
}
.btn-audio:hover, .btn-send:hover { color: var(--text-primary); background: var(--bg-card); }
.btn-send:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-audio.recording { color: var(--danger); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.input-footer {
    text-align: center; font-size: 0.72rem; color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ===== IMPERSONATION ===== */
.impersonation-banner {
    background: rgba(210, 153, 34, 0.15); border-bottom: 1px solid var(--warning);
    color: var(--warning); padding: 0.5rem 1.5rem;
    display: flex; align-items: center; justify-content: center; gap: 0.75rem;
    font-size: 0.85rem; font-weight: 500;
}
.impersonation-banner button {
    padding: 0.25rem 0.75rem; background: var(--warning); color: #000;
    border: none; border-radius: 4px; cursor: pointer; font-size: 0.8rem;
}

/* ===== ACCOUNT ===== */
#account-section.active { display: flex; }
#account-section {
    align-items: flex-start; justify-content: center; padding: 2rem;
    background: var(--bg-primary);
}
.account-container { width: 100%; max-width: 820px; }
.account-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.account-header h2 { flex: 1; }
.account-cards { display: flex; flex-direction: column; gap: 1.25rem; }

.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem;
}
.card h3 { margin-bottom: 1rem; font-size: 1.05rem; }
.card p { margin-bottom: 0.4rem; color: var(--text-secondary); font-size: 0.9rem; }
.card p strong { color: var(--text-primary); }

/* Plan comparison cards (account page) */
.plans-comparison {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
}
.plan-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem; position: relative;
    display: flex; flex-direction: column; transition: transform 0.2s;
}
.plan-card:hover { transform: translateY(-2px); }
.plan-card.featured { border-color: var(--accent); box-shadow: 0 0 20px rgba(99, 102, 241, 0.12); }
.plan-card .badge-popular {
    position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: white; padding: 0.2rem 0.75rem;
    border-radius: 20px; font-size: 0.7rem; font-weight: 600; white-space: nowrap;
}
.plan-card-header { margin-bottom: 0.75rem; }
.plan-card-header h4 { font-size: 1rem; margin-bottom: 0.25rem; color: var(--text-primary); }
.plan-price { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.plan-price span { font-size: 0.8rem; font-weight: 400; color: var(--text-secondary); }
.plan-features { list-style: none; margin: 0 0 1rem; padding: 0; flex: 1; }
.plan-features li {
    padding: 0.3rem 0; font-size: 0.82rem; color: var(--text-secondary); line-height: 1.4;
}
.plan-features li strong { color: var(--text-primary); }
.plan-features .feature-disabled { opacity: 0.45; }
.plan-card .btn-primary, .plan-card .btn-outline {
    width: 100%; text-align: center; justify-content: center;
    padding: 0.6rem; font-size: 0.85rem; margin-top: auto;
}
.plan-card .btn-outline {
    background: transparent; border: 1px solid var(--border); color: var(--text-secondary);
    border-radius: var(--radius-sm); cursor: default; opacity: 0.6;
}
.btn-premium {
    background: linear-gradient(135deg, var(--accent), #a855f7) !important;
}
.btn-premium:hover {
    background: linear-gradient(135deg, var(--accent-hover), #9333ea) !important;
}
.btn-danger-sm {
    background: transparent; border: 1px solid #ef4444; color: #ef4444;
    padding: 0.4rem 1rem; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 0.8rem; transition: all 0.15s; margin-top: 0.5rem;
}
.btn-danger-sm:hover { background: rgba(239, 68, 68, 0.1); }
.sub-status-text { font-size: 0.8rem; color: var(--text-muted); margin-left: 0.5rem; }

/* Credits description */
.credits-desc { font-size: 0.8rem; color: var(--text-muted); margin: 0.25rem 0 0.75rem; line-height: 1.4; }

/* Credit pack cards */
.credits-packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-top: 0.5rem; }
.credit-pack {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem 0.75rem; text-align: center;
    cursor: pointer; transition: all 0.2s; position: relative;
}
.credit-pack:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1); }
.credit-pack.pack-best { border-color: var(--accent); }
.pack-tag {
    position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: white; padding: 0.1rem 0.6rem;
    border-radius: 10px; font-size: 0.65rem; font-weight: 600; white-space: nowrap;
}
.pack-amount { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.pack-label { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.pack-price { font-size: 1rem; font-weight: 600; color: var(--accent); }
.pack-unit { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.15rem; }

@media (max-width: 768px) {
    .plans-comparison { grid-template-columns: 1fr; }
    .credits-packs { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
    .credits-packs { grid-template-columns: 1fr; }
}

/* ===== ADMIN ===== */
#admin-section.active { display: flex; }
#admin-section {
    align-items: flex-start; justify-content: center; padding: 2rem;
    background: var(--bg-primary);
}
.admin-container { width: 100%; max-width: 960px; }
.admin-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.admin-header h2 { flex: 1; }

.admin-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.tab {
    padding: 0.5rem 1.25rem; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer;
    font-size: 0.9rem; transition: all 0.2s;
}
.tab:hover { color: var(--text-primary); }
.tab.active { background: var(--accent); color: white; border-color: var(--accent); }

.admin-panel {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem;
}

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.stat-card {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 1.25rem; text-align: center;
}
.stat-card h4 { color: var(--text-muted); font-size: 0.8rem; font-weight: 500; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card span { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }

.admin-search { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.admin-search input, .admin-search select {
    padding: 0.5rem 0.75rem; background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-primary); font-size: 0.9rem;
}
.admin-search input { flex: 1; min-width: 200px; }
.admin-search button {
    padding: 0.5rem 1rem; background: var(--accent); color: white;
    border: none; border-radius: 6px; cursor: pointer;
}

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; }

#admin-query-input {
    width: 100%; padding: 0.75rem; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-primary); font-family: var(--font-mono);
    font-size: 0.85rem; margin-bottom: 0.75rem; resize: vertical;
}
#admin-queries button {
    padding: 0.5rem 1.25rem; background: var(--accent); color: white;
    border: none; border-radius: var(--radius-sm); cursor: pointer; margin-bottom: 1rem;
}
#admin-query-result {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 1rem; max-height: 400px;
    overflow: auto; font-family: var(--font-mono); font-size: 0.8rem;
    color: var(--text-secondary); white-space: pre-wrap;
}

/* ===== TOAST ===== */
#toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; max-width: 360px; }
.toast {
    background: var(--bg-card); color: var(--text-primary); padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm); margin-bottom: 0.5rem; box-shadow: var(--shadow);
    border-left: 4px solid var(--accent); animation: slideIn 0.3s ease;
    font-size: 0.9rem;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
.toast.fade-out { animation: slideOut 0.3s ease forwards; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .landing-nav { padding: 0.75rem 1.25rem; }
    .nav-links a:not(.btn-outline):not(.btn-primary) { display: none; }
    .hero h1 { font-size: 2rem; }
    .hero-sub { font-size: 1rem; }
    .hero-actions { flex-direction: column; align-items: center; }
    .demo-examples { grid-template-columns: 1fr 1fr; }
    .features-grid, .pricing-grid { grid-template-columns: 1fr; }
    .features-section, .demo-section, .pricing-section { padding: 2.5rem 1.5rem; }

    .sidebar { display: none; } /* TODO: hamburger toggle */
    .app-layout { flex-direction: column; }

    .chat-msg { padding: 1rem; }
    .welcome-examples { grid-template-columns: 1fr; }
    .chat-input-area { padding: 0.5rem 0.75rem 0.75rem; }
    .chat-input-container { max-width: 100%; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-search { flex-direction: column; }
}