/* =============================================================
   COGNILUMIN — DESIGN SYSTEM
   ============================================================= */

/* ===== Base & Theme Variables ===== */
:root {
    --bg: #0a0c10;
    --card-bg: #111317;
    --text: #eef2ff;
    --text-secondary: #a1a9bb;
    --primary: #3b82f6;
    --primary-soft: rgba(59,130,246,0.12);
    --accent: #8b5cf6;
    --border: #2a2e3a;
    --shadow: 0 8px 24px rgba(0,0,0,0.5);
    --input-bg: #181b22;
    --button-text: #ffffff;
    --radius: 12px;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --sidebar-width: 280px;
}

[data-theme="light"] {
    --bg: #f7f9fc;
    --card-bg: #ffffff;
    --text: #1a202c;
    --text-secondary: #4a5568;
    --primary: #2563eb;
    --primary-soft: rgba(37,99,235,0.08);
    --accent: #7c3aed;
    --border: #e2e8f0;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
    --input-bg: #f0f2f5;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s, color 0.2s;
}

/* Main Container (used by non-chat pages) */
.container {
    max-width: 700px;
    width: 100%;
    padding: 0 1.5rem;
    margin: 4rem auto;
    flex: 1;
    text-align: center;
}

/* ===== Typography ===== */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subhead {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2.5rem;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Header & Nav (original site header) ===== */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.8rem 1.5rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg);
    backdrop-filter: blur(12px);
    z-index: 50;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.logo-bulb {
    font-size: 1.4rem;
    line-height: 1;
}

.toolbar-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

.tool-link {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}
.tool-link:hover, .tool-link.active {
    color: var(--primary);
}

.tool-link-primary {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}
.tool-link-primary:hover {
    color: var(--primary);
}

.toolbar-secondary {
    display: flex;
    gap: 1rem;
}

/* Theme Toggle */
#themeToggle {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 2.8rem;
    height: 2.8rem;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    color: var(--text);
}

#themeToggle:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun { display: none; }

/* ===== Textarea (generic, used by Illuminator, etc.) ===== */
textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--input-bg);
    color: var(--text);
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--font-sans);
    line-height: 1.5;
    box-shadow: var(--shadow);
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* ===== Primary Buttons ===== */
.glow-button, .primary-button, .action-button, .tool-cta, .hero-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: var(--shadow);
    text-decoration: none;
}
.glow-button:hover, .primary-button:hover, .action-button:hover, .tool-cta:hover, .hero-btn-primary:hover {
    background: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59,130,246,0.2);
}

/* ===== Loading ===== */
#loading {
    margin-top: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    color: var(--text-secondary);
}
.loader {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Output Card (Illuminator) ===== */
.output-card {
    margin-top: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.8rem;
    text-align: left;
    box-shadow: var(--shadow);
    position: relative;
    animation: fadeInUp 0.3s ease;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#explanation {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
}

/* Output actions – Copy & Share buttons */
.output-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 2;
}

.action-btn {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}
.action-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary);
}

/* ===== Footer ===== */
footer {
    width: 100%;
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg);
}
.footer-nav { display: flex; gap: 1rem; }
.footer-nav a { color: var(--text-secondary); text-decoration: none; transition: color 0.2s; }
.footer-nav a:hover { color: var(--primary); }

.hidden { display: none !important; }

/* ===== Mind Visualizer Specific ===== */
#mindCanvas {
    display: block;
    margin: 2rem auto;
    border-radius: 8px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.mind-action-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text);
    transition: all 0.2s;
}
.mind-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg);
}

#mindInterpretation {
    margin-top: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
    text-align: left;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

#mindError {
    margin-top: 1rem;
    color: #ef4444;
    font-size: 0.875rem;
    font-weight: 500;
}

#journeySection {
    margin-top: 3rem;
    text-align: left;
}
.journey-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}
.snapshot-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: flex-start;
}
.snapshot-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 120px;
}
.snapshot-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(59,130,246,0.1);
}
.snapshot-card img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 0.4rem;
}
.snapshot-date { font-size: 0.7rem; color: var(--text-secondary); }
.snapshot-mood { font-size: 0.8rem; font-weight: 500; color: var(--text); }
.clear-journey {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--primary);
    cursor: pointer;
    background: none;
    border: none;
    text-decoration: underline;
}

/* ===== Agent Mind Specific ===== */
.trace-container {
    max-width: 700px;
    margin: 0 auto;
    text-align: left;
    padding: 1rem 0;
}
.trace-step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}
.trace-step.visible { opacity: 1; transform: translateY(0); }

.step-number {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-right: 0.75rem;
    box-shadow: 0 0 8px rgba(59,130,246,0.3);
}
.step-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow);
    flex: 1;
    font-size: 0.9rem;
}

.step-action {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    margin-right: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.step-action.search { background: #4ecdc4; }
.step-action.read   { background: var(--primary); }
.step-action.analyze { background: #ffb347; }
.step-action.synthesize { background: #e056a0; }
.step-action.conclude { background: #2ecc71; }
.step-result {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-top: 0.3rem;
}

/* ===== Error ===== */
#error {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #fee2e2;
    color: #b91c1c;
    border-radius: 0.8rem;
    font-weight: 500;
    border: 1px solid #fecaca;
}
[data-theme="dark"] #error {
    background: #3b1f1f;
    color: #fca5a5;
    border-color: #5a2e2e;
}

/* ===== Utility ===== */
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
    h1 { font-size: 2rem; }
    .glow-button, .primary-button { padding: 0.75rem 1.5rem; font-size: 0.85rem; }
    .header-bar { flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
    .toolbar-right { align-items: center; }
    .toolbar-secondary { flex-wrap: wrap; justify-content: center; }
}

/* =============================================================
   DEEPSEEK CHAT INTERFACE (fully intact, using the same variables)
   ============================================================= */

/* Main chat wrapper */
.app-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    min-height: 0;
    position: relative;
}

/* Chat area */
.chat-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 1rem 0.8rem;
    min-height: 0;
}

/* Header inside chat */
.chat-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

/* Updated modern sidebar-toggle-btn */
.sidebar-toggle-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-right: 0.75rem;
    padding: 0;
}

.sidebar-toggle-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary);
    transform: scale(1.05);
}

.chat-title {
    font-size: 1.2rem;
    font-weight: 500;
}

/* Sidebar (fixed, slides from left) */
.chat-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    max-width: 80vw;
    height: 100%;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: 2px 0 8px rgba(0,0,0,0.2);
}
.chat-sidebar.open {
    transform: translateX(0);
}

/* Sidebar content */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.new-chat-btn {
    flex: 1;
    background: var(--primary);
    border: none;
    border-radius: 2rem;
    padding: 0.7rem 1rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: 0.2s;
    margin-right: 0.5rem;
}
.new-chat-btn:hover {
    background: #2563eb;
}
.close-sidebar-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.close-sidebar-btn:hover {
    background: var(--card-bg);
    color: var(--text);
}
.history-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin: 1rem 0 0.8rem 0;
}
.history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}


/* History item */
.history-item {
    padding: 0.7rem;
    border-radius: 0.8rem;
    cursor: pointer;
    background: transparent;
    transition: 0.2s;
    border: 1px solid transparent;
    font-size: 0.85rem;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text);
}
.history-item:hover {
    background: var(--input-bg);
    border-color: var(--border);
}
.history-item.active {
    background: var(--primary);
    color: white;
}
.history-item .history-info {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.history-title-text {
    font-weight: 500;
    margin-bottom: 0.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-date {
    font-size: 0.65rem;
    opacity: 0.6;
}
.history-menu-btn {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0.3rem;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 4px;
}
.history-item:hover .history-menu-btn {
    opacity: 0.7;
}
.history-menu-btn:hover {
    opacity: 1 !important;
    background: rgba(255,255,255,0.1);
}
/* Floating menu */
.history-menu-popup {
    position: fixed;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    min-width: 120px;
    overflow: hidden;
}
.history-menu-popup button {
    background: transparent;
    border: none;
    padding: 0.6rem 1rem;
    text-align: left;
    cursor: pointer;
    color: var(--text);
    font-size: 0.8rem;
    transition: background 0.1s;
}
.history-menu-popup button:hover {
    background: var(--primary);
    color: white;
}

/* Message bubbles, input area */
.messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    gap: 1rem;
    padding-right: 0.3rem;
    scroll-behavior: smooth;
    min-height: 0;
}
.messages-container.empty .welcome-card {
    margin: auto 0;
}
.message {
    display: flex;
    gap: 0.8rem;
    animation: fadeSlideUp 0.25s ease-out;
}
.message.user {
    justify-content: flex-end;
}
.message.assistant {
    justify-content: flex-start;
}
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.message.user .message-avatar {
    background: var(--primary);
    order: 2;
    color: white;
}
.message-bubble {
    max-width: 80%;
    padding: 0.8rem 1.1rem;
    border-radius: 1.4rem;
    font-size: 0.95rem;
    line-height: 1.5;
    background: var(--input-bg);
    color: var(--text);
    word-break: break-word;
}
.message.assistant .message-bubble {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-top-left-radius: 0.3rem;
}
.message.user .message-bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 0.3rem;
}
.bubble-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.4rem;
    font-size: 0.65rem;
    opacity: 0.6;
}
.copy-message-btn {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 0.65rem;
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--card-bg);
    padding: 0.6rem 1rem;
    border-radius: 2rem;
    width: fit-content;
    border: 1px solid var(--border);
}
.typing-dot {
    width: 7px;
    height: 7px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
    0%, 60%, 100% { transform: scale(0.6); opacity: 0.4; }
    30% { transform: scale(1); opacity: 1; }
}
.input-area {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    padding: 0.4rem 0.8rem;
    margin-top: 0.8rem;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}
.input-area textarea {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.7rem 0.2rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--text);
    resize: none;
    outline: none;
    max-height: 120px;
    box-shadow: none;
}
.input-area textarea::placeholder {
    color: var(--text-secondary);
}
.send-btn {
    background: var(--primary);
    border: none;
    border-radius: 2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
}
.action-toolbar {
    display: flex;
    gap: 0.8rem;
    margin-top: 0.6rem;
    justify-content: flex-end;
}
.clear-chat-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 40px;
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
}
.error-message {
    font-size: 0.75rem;
    padding: 0.4rem;
    text-align: center;
    transition: 0.2s;
}
.error-message.error {
    color: #f87171;
}
.error-message.success {
    color: #4ade80;
}

/* Welcome card */
.welcome-card {
    text-align: center;
    background: linear-gradient(145deg, var(--card-bg), var(--input-bg));
    border-radius: 1.5rem;
    padding: 2.5rem 2rem;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.05);
}
.welcome-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.3;
    pointer-events: none;
}
.xai-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 1rem;
    display: inline-block;
    position: relative;
}
.prompt-container {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1.8rem;
    position: relative;
}
.prompt-pill {
    font-size: 0.85rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    width: fit-content;
    margin-inline: auto;
    padding: 0.6rem 1.4rem;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}
.prompt-pill:hover {
    border-color: var(--accent);
    color: var(--text);
    transform: translateY(-1px);
}


/* ===== New header classes ===== */
.header-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    justify-content: center;
}
.nav-link {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--primary-soft); }
.nav-link.active { color: var(--primary); background: var(--primary-soft); }
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.theme-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.theme-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.mobile-menu-btn:hover { color: var(--text); border-color: var(--primary); }
.mobile-nav {
    position: fixed;
    top: 58px;
    left: 0; right: 0;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 190;
    box-shadow: var(--shadow);
}
.mobile-nav[hidden] { display: none; }
.mobile-nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}
.mobile-nav-link:hover { color: var(--text); background: var(--primary-soft); }
.mobile-nav-link.active { color: var(--primary); background: var(--primary-soft); }
.chat-title-label {
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.history-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    font-weight: 600;
    font-family: var(--font-mono);
}
.input-wrapper { flex-shrink: 0; }

/* ===== Footer ===== */
.system-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--bg);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 1.5rem;
}
.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 0;
}
.footer-brand-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.footer-logo-link {
    display: inline-block;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.2s;
}
.footer-logo-link:hover { opacity: 1; }
.footer-tagline {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.65;
}
.footer-col h4 {
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.65rem;
    margin-bottom: 1rem;
    letter-spacing: 0.12em;
    font-weight: 600;
}
.footer-nav {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.footer-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.75rem;
    display: inline-block;
}
.footer-nav a::before { content: "> "; opacity: 0.4; }
.footer-nav a:hover { color: var(--primary); }
.diagnostic-panel {
    border-top: 1px dashed var(--border);
    margin-top: 2rem;
    padding-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.68rem;
    color: var(--text-secondary);
}
.sys-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.status-dot {
    width: 7px;
    height: 7px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(34,197,94,0.55);
    animation: statusPulse 2.4s infinite;
    flex-shrink: 0;
}
@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}
.footer-copy { color: var(--text-secondary); }

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 768px) {
    .header-nav { display: none; }
    .mobile-menu-btn { display: flex; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .chat-layout { padding: 0.6rem; }
    .message-bubble { max-width: 85%; padding: 0.6rem 0.9rem; font-size: 0.9rem; }
    .sidebar-toggle-btn { width: 36px; height: 36px; font-size: 20px; }
}