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

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-tertiary: #1a1a25;
    --bg-input: #141420;
    --border: #2a2a3a;
    --border-focus: #7c3aed;
    --text-primary: #e8e8ed;
    --text-secondary: #8888a0;
    --text-muted: #555;
    --accent: #7c3aed;
    --accent-light: #a78bfa;
    --user-bubble: #7c3aed;
    --assistant-bubble: #1e1e2e;
    --danger: #ef4444;
    --success: #22c55e;
    --radius: 14px;
    --nav-width: 220px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-text-size-adjust: 100%;
    color-scheme: dark;
}

/* ── Nav Sidebar ─────────────────────────────────────── */
.nav-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--nav-width);
    background: #08080e;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease, width 0.25s ease;
}
.nav-sidebar.open { transform: translateX(0); }

.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    display: none;
}
.nav-overlay.show { display: block; }

/* Universal hamburger (injected by nav.php, visible on mobile when nav is closed) */
.nav-hamburger {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 98;
    background: var(--bg-secondary, #141422);
    border: 1px solid var(--border, #23233a);
    border-radius: 6px;
    color: var(--text-secondary, #aaa);
    padding: 6px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s;
}
.nav-hamburger:hover { color: #fff; border-color: var(--accent, #7c3aed); }
.nav-hamburger.hidden { display: none !important; }

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1rem 0.75rem;
}
.brand-mark {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: white;
    flex-shrink: 0;
}
.brand-text {
    font-size: 1.05rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s;
}
.nav-collapse-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}
.nav-collapse-btn:hover { background: var(--bg-tertiary); color: var(--text-secondary); }

.nav-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.5rem 0.6rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.15s;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
}
.nav-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-item.active { background: rgba(124,58,237,0.12); color: var(--accent-light); }
.nav-item.active svg { stroke: var(--accent-light); }
.nav-item svg { flex-shrink: 0; }
.nav-label { transition: opacity 0.2s; }

.nav-footer {
    padding: 0.5rem 0.6rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-user-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}

.nav-user-card {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
}
.nav-user-card:hover { background: var(--bg-tertiary); }
.nav-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}
.nav-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.nav-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: opacity 0.2s;
}
.nav-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-user-role {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.nav-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    flex-shrink: 0;
    transition: all 0.15s;
}
.nav-settings-btn:hover { background: var(--bg-tertiary); color: var(--text-secondary); }
.nav-signout { color: var(--text-muted); }
.nav-signout:hover { color: var(--danger); }

/* ── Nav Collapsed State (desktop) ──────────────────── */
.nav-sidebar.collapsed {
    width: 52px;
}
.nav-sidebar.collapsed .brand-text,
.nav-sidebar.collapsed .nav-label,
.nav-sidebar.collapsed .nav-user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}
.nav-sidebar.collapsed .nav-brand {
    padding: 1rem 0.6rem 0.75rem;
    justify-content: center;
}
.nav-sidebar.collapsed .brand-mark { display: none; }
.nav-sidebar.collapsed .nav-collapse-btn {
    margin-left: 0;
}
.nav-sidebar.collapsed .nav-collapse-btn svg {
    transform: rotate(180deg);
}
.nav-sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.55rem;
}
.nav-sidebar.collapsed .nav-item[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: 56px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    white-space: nowrap;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    pointer-events: none;
}
.nav-sidebar.collapsed .nav-item {
    position: relative;
}
.nav-sidebar.collapsed .nav-items {
    padding: 0.5rem 0.4rem;
}
.nav-sidebar.collapsed .nav-footer {
    padding: 0.5rem 0.4rem;
}
.nav-sidebar.collapsed .nav-user-row {
    flex-direction: column;
    gap: 2px;
}
.nav-sidebar.collapsed .nav-user-card {
    padding: 0.4rem;
    justify-content: center;
}
.nav-sidebar.collapsed .nav-settings-btn {
    width: 28px;
    height: 28px;
}
.nav-sidebar.collapsed .nav-signout {
    justify-content: center;
    padding: 0.55rem;
}

/* ── Topbar ──────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    min-height: 52px;
    flex-shrink: 0;
}
.topbar-title {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.connection-status { display: flex; align-items: center; }
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--danger);
    transition: background 0.3s;
}
.status-dot.connected { background: var(--success); }

/* ── Buttons ─────────────────────────────────────────── */
.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.btn-icon:hover { background: var(--bg-tertiary); }

/* ── Main Layout ─────────────────────────────────────── */
.main {
    display: flex;
    flex-direction: column;
    height: 100dvh;
}

/* ── Messages ────────────────────────────────────────── */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    scroll-behavior: smooth;
}

.welcome-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    gap: 1rem;
    opacity: 0.7;
}
.welcome-msg h2 { font-size: 1.3rem; font-weight: 600; }
.welcome-msg p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 300px;
}

/* ── Message Wrapper ─────────────────────────────────── */
.msg {
    display: flex;
    margin-bottom: 0.25rem;
    animation: fadeIn 0.2s ease;
    position: relative;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.msg.user { justify-content: flex-end; }
.msg.assistant { justify-content: flex-start; }

.msg-inner {
    max-width: 85%;
    display: flex;
    flex-direction: column;
}

.msg-bubble {
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    font-size: 0.92rem;
    line-height: 1.55;
    word-break: break-word;
    position: relative;
}
.msg.user .msg-bubble {
    background: var(--user-bubble);
    color: white;
    border-bottom-right-radius: 4px;
}
.msg.assistant .msg-bubble {
    background: var(--assistant-bubble);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}

.msg-timestamp {
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 2px 4px 0;
    opacity: 0.7;
}
.msg.user .msg-timestamp { text-align: right; }
.msg.assistant .msg-timestamp { text-align: left; }

/* Excluded from context indicator */
.msg.excluded .msg-bubble {
    opacity: 0.5;
}
.msg.excluded .msg-bubble::after {
    content: 'excluded from context';
    position: absolute;
    top: -8px;
    right: 8px;
    font-size: 0.58rem;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* ── Markdown in Bubbles ─────────────────────────────── */
.msg-bubble .md-content {
    white-space: normal;
}
.msg-bubble .md-content p { margin: 0 0 0.5em; }
.msg-bubble .md-content p:last-child { margin-bottom: 0; }
.msg-bubble .md-content h1,
.msg-bubble .md-content h2,
.msg-bubble .md-content h3,
.msg-bubble .md-content h4,
.msg-bubble .md-content h5,
.msg-bubble .md-content h6 {
    margin: 0.75em 0 0.35em;
    line-height: 1.3;
}
.msg-bubble .md-content h1:first-child,
.msg-bubble .md-content h2:first-child,
.msg-bubble .md-content h3:first-child { margin-top: 0; }
.msg-bubble .md-content h1 { font-size: 1.25em; }
.msg-bubble .md-content h2 { font-size: 1.15em; }
.msg-bubble .md-content h3 { font-size: 1.05em; }
.msg-bubble .md-content h4 { font-size: 1em; }

.msg-bubble .md-content strong { font-weight: 700; }
.msg-bubble .md-content em { font-style: italic; }
.msg-bubble .md-content del { text-decoration: line-through; opacity: 0.7; }

.msg-bubble .md-content a {
    color: var(--accent-light);
    text-decoration: underline;
    text-decoration-color: rgba(167,139,250,0.4);
}
.msg.user .msg-bubble .md-content a { color: #e0d0ff; }

.msg-bubble .md-content ul,
.msg-bubble .md-content ol {
    margin: 0.4em 0;
    padding-left: 1.5em;
}
.msg-bubble .md-content li { margin-bottom: 0.2em; }

.msg-bubble .md-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 0.5em 0;
    padding: 0.3em 0.75em;
    background: rgba(124,58,237,0.06);
    border-radius: 0 6px 6px 0;
    color: var(--text-secondary);
}
.msg.user .msg-bubble .md-content blockquote {
    border-left-color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
}

.msg-bubble .md-content table {
    border-collapse: collapse;
    margin: 0.5em 0;
    font-size: 0.85em;
    width: 100%;
}
.msg-bubble .md-content th,
.msg-bubble .md-content td {
    border: 1px solid var(--border);
    padding: 0.35em 0.6em;
    text-align: left;
}
.msg-bubble .md-content th {
    background: rgba(255,255,255,0.04);
    font-weight: 600;
}

.msg-bubble .md-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.75em 0;
}

.msg-bubble code {
    background: rgba(0,0,0,0.3);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}
.msg-bubble pre {
    background: rgba(0,0,0,0.4);
    padding: 0.75rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5rem 0;
    font-size: 0.82rem;
    position: relative;
}
.msg-bubble pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}
.msg.user .msg-bubble code { background: rgba(0,0,0,0.2); }
.msg.user .msg-bubble pre { background: rgba(0,0,0,0.25); }

.msg-bubble .md-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 0.4em 0;
}

/* ── Floating Message Actions ────────────────────────── */
.msg-actions {
    position: fixed;
    display: none;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    z-index: 50;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    transition: top 0.1s ease, left 0.1s ease;
}
.msg-actions.visible {
    display: flex;
}
.msg:hover .msg-bubble {
    box-shadow: 0 0 0 1px rgba(124,58,237,0.15);
}
.msg-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 28px;
    background: none;
    border: none;
    border-radius: 5px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.12s;
}
.msg-action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.msg-action-btn[data-action="delete"]:hover {
    background: rgba(239,68,68,0.12);
    color: var(--danger);
}
.msg-action-btn[data-action="exclude"]:hover {
    background: rgba(124,58,237,0.12);
    color: var(--accent-light);
}

/* ── Typing Indicator ────────────────────────────────── */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 0.5rem 0;
}
.typing-indicator span {
    width: 6px; height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ── Stream Bubble ───────────────────────────────────── */
.stream-bubble { max-width: 85%; }

.stream-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.45rem;
    margin-bottom: 0.45rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 0.72rem;
    color: var(--text-muted);
}
.stream-status.done { border-bottom-color: rgba(255,255,255,0.04); }
.stream-model {
    color: var(--accent-light);
    font-weight: 600;
    letter-spacing: 0.02em;
}
.stream-timer {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
}
.stream-status:not(.done) .stream-timer::after {
    content: '';
    display: inline-block;
    width: 4px; height: 4px;
    background: var(--accent);
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
    animation: pulse-dot 1.5s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* ── Stream Body (interleaved flow container) ────────── */
.stream-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.stream-body:empty { display: none; }
.msg-bubble .stream-status { margin-bottom: 0; }

/* ── Tool Indicators ─────────────────────────────────── */

.tool-indicator {
    display: flex;
    flex-direction: column;
    padding: 0.3rem 0.55rem;
    background: rgba(124, 58, 237, 0.06);
    border: 1px solid rgba(124, 58, 237, 0.12);
    border-radius: 6px;
    font-size: 0.73rem;
    line-height: 1.4;
    animation: tool-in 0.2s ease;
    cursor: pointer;
}
.tool-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
@keyframes tool-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.tool-indicator.success {
    background: rgba(34, 197, 94, 0.06);
    border-color: rgba(34, 197, 94, 0.12);
}
.tool-indicator.failed {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.15);
}
.tool-icon { font-size: 0.8rem; flex-shrink: 0; line-height: 1; }
.tool-label { color: var(--text-secondary); font-weight: 600; flex-shrink: 0; }
.tool-detail {
    color: var(--text-muted);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.68rem;
}
.tool-spinner {
    flex-shrink: 0;
    width: 10px; height: 10px;
    border: 1.5px solid var(--accent-light);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tool-result {
    flex-shrink: 0;
    font-size: 0.65rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    white-space: nowrap;
}
.tool-indicator.success .tool-result { color: var(--success); }
.tool-indicator.failed .tool-result { color: var(--danger); }
.tool-indicator.success .tool-label { color: var(--success); }
.tool-indicator.failed .tool-label { color: var(--danger); }
.tool-args, .tool-result-body {
    margin-top: 0.3rem;
    max-height: 300px;
    overflow: auto;
    border-top: 1px solid rgba(124, 58, 237, 0.1);
    padding-top: 0.3rem;
}
.tool-args.collapsed, .tool-result-body.collapsed {
    display: none;
}
.tool-args pre, .tool-result-body pre {
    margin: 0;
    font-size: 0.65rem;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: var(--text-muted);
    white-space: pre-wrap;
}
.media-preview {
    margin: 0.5rem 0;
    text-align: center;
}
.media-preview img, .media-preview video {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    word-break: break-all;
    line-height: 1.5;
}

/* ── Thinking Block ──────────────────────────────────── */
.thinking-block {
    padding: 0.4rem 0.55rem;
    background: rgba(167, 139, 250, 0.05);
    border: 1px solid rgba(167, 139, 250, 0.12);
    border-radius: 6px;
    font-size: 0.73rem;
    animation: tool-in 0.2s ease;
}
.thinking-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--accent-light);
    font-weight: 600;
    font-size: 0.72rem;
    margin-bottom: 0.25rem;
    cursor: pointer;
}
.thinking-block.done .thinking-header { color: var(--text-muted); }
.thinking-icon {
    display: inline-block;
    width: 10px; height: 10px;
    border: 1.5px solid var(--accent-light);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.thinking-icon.done {
    animation: none;
    border: none;
    width: auto; height: auto;
}
.thinking-icon.done::before {
    content: '\2713';
    color: var(--text-muted);
    font-size: 0.75rem;
}
.thinking-content {
    color: var(--text-muted);
    font-size: 0.68rem;
    line-height: 1.45;
    white-space: pre-wrap;
    max-height: 80px;
    overflow-y: auto;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}
.thinking-content.collapsed {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin: 0;
}
/* Clicking the thinking header toggles .collapsed via JS */

.stream-body .stream-text {
    word-break: break-word;
}

/* Blinking cursor injected via JS at end of last element during streaming */
.stream-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--accent-light);
    animation: blink-cursor 0.8s step-end infinite;
    margin-left: 2px;
    vertical-align: text-bottom;
    border-radius: 1px;
}
@keyframes blink-cursor { 50% { opacity: 0; } }

/* ── Toolbar ─────────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    overflow: visible;
    position: relative;
}
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}
.toolbar-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    user-select: none;
}
.toolbar-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.78rem;
    padding: 0.3rem 0.5rem;
    outline: none;
    cursor: pointer;
    max-width: 220px;
    transition: border-color 0.2s;
}
.toolbar-select:focus { border-color: var(--accent); }
.toolbar-select option { background: var(--bg-secondary); color: var(--text-primary); }
.toolbar-select optgroup { background: var(--bg-secondary); color: var(--text-secondary); }

/* ── Context Toggle ──────────────────────────────────── */
.context-toggle {
    transition: all 0.2s;
}
.context-toggle.active {
    border-color: rgba(34,197,94,0.4);
    color: var(--success);
    background: rgba(34,197,94,0.08);
}
.context-toggle.active svg { stroke: var(--success); }
.context-toggle:not(.active) {
    color: var(--text-muted);
    border-color: var(--border);
}
.context-toggle:not(.active) svg { stroke: var(--text-muted); }
@media (max-width: 767px) {
    .context-label { display: none; }
}

/* ── Chat History Dropdown ───────────────────────────── */
.chat-history-wrap {
    position: relative;
}
.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 0.35rem 0.55rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    height: 32px;
}
.toolbar-btn:hover { border-color: var(--accent); color: var(--text-primary); background: rgba(124,58,237,0.06); }
.toolbar-btn .chevron { transition: transform 0.2s; }
.chat-history-wrap.open .toolbar-btn .chevron { transform: rotate(180deg); }
.chat-history-wrap.open .toolbar-btn { border-color: var(--accent); color: var(--accent-light); }

.history-popover {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    width: 320px;
    max-height: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.4), 0 8px 32px rgba(0,0,0,0.3);
    display: none;
    flex-direction: column;
    z-index: 110;
    overflow: hidden;
}
.chat-history-wrap.open .history-popover { display: flex; }

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(0,0,0,0.1);
}
.history-new-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: 1px dashed rgba(124,58,237,0.4);
    border-radius: 6px;
    color: var(--accent-light);
    font-size: 0.75rem;
    padding: 0.3rem 0.55rem;
    cursor: pointer;
    transition: all 0.15s;
}
.history-new-btn:hover { border-color: var(--accent); border-style: solid; background: rgba(124,58,237,0.1); }

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.35rem;
}
.history-list:empty::after {
    content: 'No chats yet';
    display: block;
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.6rem;
    margin-bottom: 1px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: background 0.12s;
    white-space: nowrap;
    overflow: hidden;
}
.session-item:hover { background: var(--bg-tertiary); }
.session-item.active { background: rgba(124,58,237,0.1); color: var(--accent-light); }
.session-item .title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.session-item .delete-btn {
    opacity: 0;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.75rem;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.session-item:hover .delete-btn { opacity: 1; }

/* ── Input Area ──────────────────────────────────────── */
.input-area {
    padding: 0.5rem 1rem;
    padding-bottom: calc(0.5rem + var(--safe-bottom));
    background: var(--bg-secondary);
    flex-shrink: 0;
}
.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.65rem;
    transition: border-color 0.2s;
}
.input-wrapper:focus-within { border-color: var(--accent); }

textarea {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.92rem;
    font-family: inherit;
    resize: none;
    outline: none;
    min-height: 60px;
    max-height: 160px;
    line-height: 1.45;
    padding: 0.3rem 0;
}
textarea::placeholder { color: var(--text-muted); }

.send-btn {
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: white;
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.send-btn:disabled { opacity: 0.35; cursor: default; }
.send-btn:not(:disabled):hover { opacity: 0.85; }

/* ── System Log Panel ────────────────────────────────── */
.log-toggle-btn { position: relative; }
.log-toggle-btn.has-new::after {
    content: '';
    position: absolute;
    top: 4px; right: 4px;
    width: 6px; height: 6px;
    background: var(--accent);
    border-radius: 50%;
}

.log-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 520px;
    max-width: 100vw;
    background: #08080d;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 110;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}
.log-panel.open { transform: translateX(0); }

.log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.75rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
    flex-shrink: 0;
}
.log-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}
.log-badge {
    font-size: 0.65rem;
    background: var(--accent);
    color: white;
    border-radius: 8px;
    padding: 1px 5px;
    display: none;
}
.log-badge.show { display: inline; }

.log-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.log-filter-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    padding: 3px 5px;
    outline: none;
    cursor: pointer;
}
.log-filter-select option { background: var(--bg-secondary); }
.log-ctrl-btn { padding: 4px; color: var(--text-muted); }
.log-ctrl-btn:hover { color: var(--text-secondary); }

.log-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.35rem 0;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.72rem;
    line-height: 1.55;
}

.log-line {
    padding: 1px 0.75rem;
    display: flex;
    gap: 0.5rem;
    white-space: pre-wrap;
    word-break: break-all;
    border-left: 2px solid transparent;
    transition: background 0.1s;
}
.log-line:hover { background: rgba(255,255,255,0.02); }
.log-line .log-ts { color: #555; flex-shrink: 0; min-width: 60px; }
.log-line .log-lvl { flex-shrink: 0; min-width: 52px; font-weight: 700; text-transform: uppercase; }
.log-line .log-cat { color: var(--accent-light); flex-shrink: 0; min-width: 56px; }
.log-line .log-src { color: #555; flex-shrink: 0; font-size: 0.62rem; min-width: 38px; }
.log-line .log-msg { color: #c8c8d0; flex: 1; min-width: 0; }

.log-line.lvl-INFO .log-lvl  { color: #3b82f6; }
.log-line.lvl-WARN .log-lvl  { color: #f59e0b; }
.log-line.lvl-WARN           { border-left-color: #f59e0b33; }
.log-line.lvl-ERROR .log-lvl { color: #ef4444; }
.log-line.lvl-ERROR          { border-left-color: #ef444466; background: rgba(239,68,68,0.04); }
.log-line.lvl-SECURITY .log-lvl { color: #f43f5e; }
.log-line.lvl-SECURITY       { border-left-color: #f43f5e66; background: rgba(244,63,94,0.04); }
.log-line.lvl-DEBUG .log-lvl { color: #666; }
.log-line.lvl-DEBUG .log-msg { color: #777; }

.log-line[data-src="bridge"] .log-src { color: #22d3ee; }
.log-line[data-src="apache"] .log-src { color: #a78bfa; }
.log-line[data-src="error"] .log-src  { color: #fb7185; }

.log-block-btn {
    flex-shrink: 0;
    padding: 1px 7px;
    font-size: 0.62rem;
    font-weight: 600;
    font-family: inherit;
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    line-height: 1.5;
    white-space: nowrap;
    align-self: center;
}
.log-line:hover .log-block-btn { opacity: 1; }
.log-block-btn:hover { background: rgba(239, 68, 68, 0.25); border-color: rgba(239, 68, 68, 0.5); }
.log-block-btn:disabled { cursor: default; opacity: 1; }
.log-block-btn.blocked { background: rgba(239, 68, 68, 0.2); color: #ef4444; border-color: #ef4444; opacity: 1; }

/* ── Toolbar Spacer ──────────────────────────────────── */
.toolbar-spacer { flex: 1; min-width: 0; }

/* ── Notes Popover (Additional Instructions) ────────── */
.notes-wrap { position: relative; }
.notes-toggle.has-active {
    border-color: rgba(124,58,237,0.5);
    color: var(--accent-light);
    background: rgba(124,58,237,0.1);
}
.notes-toggle.has-active svg { stroke: var(--accent-light); }
.notes-badge {
    display: none;
    font-size: 0.58rem;
    font-weight: 700;
    background: var(--accent);
    color: white;
    border-radius: 10px;
    padding: 0 5px;
    min-width: 16px;
    text-align: center;
    line-height: 16px;
    height: 16px;
}
.notes-badge.show { display: inline-flex; align-items: center; justify-content: center; }

.notes-popover {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: 360px;
    max-height: 420px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.4), 0 8px 32px rgba(0,0,0,0.3);
    z-index: 110;
    overflow: hidden;
    flex-direction: column;
}
.notes-wrap.open .notes-popover { display: flex; }
.notes-wrap.open .toolbar-btn { border-color: var(--accent); color: var(--accent-light); background: rgba(124,58,237,0.08); }

.notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(0,0,0,0.1);
}
.notes-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: 1px dashed rgba(124,58,237,0.4);
    border-radius: 6px;
    color: var(--accent-light);
    cursor: pointer;
    transition: all 0.15s;
}
.notes-add-btn:hover { border-color: var(--accent); border-style: solid; background: rgba(124,58,237,0.1); }

.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.4rem;
    min-height: 48px;
    max-height: 280px;
}
.notes-list:empty::after {
    content: 'No instructions yet \2014 click + to add one';
    display: block;
    text-align: center;
    padding: 1.5rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.note-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    transition: background 0.12s;
    margin-bottom: 2px;
}
.note-item:hover { background: var(--bg-tertiary); }
.note-item.disabled { opacity: 0.4; }

.note-toggle {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    margin-top: 1px;
    transition: all 0.15s;
    padding: 0;
    color: transparent;
}
.note-toggle:hover { border-color: var(--accent); background: rgba(124,58,237,0.08); }
.note-item:not(.disabled) .note-toggle {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.note-text {
    flex: 1;
    font-size: 0.78rem;
    color: var(--text-primary);
    line-height: 1.45;
    min-width: 0;
    word-break: break-word;
    cursor: default;
}
.note-item.disabled .note-text {
    color: var(--text-muted);
    text-decoration: line-through;
    text-decoration-color: rgba(85,85,85,0.4);
}

.note-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}
.note-item:hover .note-actions { opacity: 1; }

.note-edit,
.note-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.note-edit:hover { color: var(--accent-light); background: rgba(124,58,237,0.1); }
.note-delete:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

.note-edit-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
}
.note-edit-input {
    flex: 1;
    min-width: 0;
    background: var(--bg-input);
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.78rem;
    padding: 0.3rem 0.5rem;
    outline: none;
    font-family: inherit;
    height: 30px;
}
.note-edit-save,
.note-edit-cancel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}
.note-edit-save {
    background: var(--accent);
    color: white;
}
.note-edit-save:hover { background: #9333ea; }
.note-edit-cancel {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}
.note-edit-cancel:hover { color: var(--text-primary); background: rgba(255,255,255,0.08); }
.note-item.editing { background: var(--bg-tertiary); }

.notes-input-row {
    display: flex;
    gap: 0.4rem;
    padding: 0.55rem 0.65rem;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
    align-items: center;
}
.notes-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.78rem;
    padding: 0.4rem 0.55rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
    height: 34px;
}
.notes-input:focus { border-color: var(--accent); }
.notes-input::placeholder { color: var(--text-muted); }
.notes-save-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}
.notes-save-btn:hover { background: #9333ea; }

.notes-footer {
    padding: 0.4rem 0.8rem;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.05);
}
.notes-hint {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.4;
}

/* ── Settings Popover ───────────────────────────────── */
.settings-wrap { position: relative; }
.settings-btn { padding: 0.35rem; }
.settings-popover {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    width: 290px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.4), 0 8px 32px rgba(0,0,0,0.3);
    z-index: 110;
    overflow: hidden;
}
.settings-wrap.open .settings-popover { display: block; }
.settings-wrap.open .toolbar-btn { border-color: var(--accent); color: var(--accent-light); background: rgba(124,58,237,0.08); }

.settings-header {
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(0,0,0,0.1);
}
.settings-row {
    padding: 0.6rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.settings-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    user-select: none;
    flex-shrink: 0;
}
.settings-row .toolbar-select {
    flex: 1;
    min-width: 0;
}

/* ── Toggle Switch ──────────────────────────────────── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    margin-left: auto;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 14px;
    height: 14px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.25s;
}
.toggle-switch input:checked + .toggle-slider {
    background: rgba(124, 58, 237, 0.25);
    border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
    background: var(--accent-light);
}

/* ── Desktop Layout ──────────────────────────────────── */
@media (min-width: 768px) {
    .nav-sidebar { transform: translateX(0); }
    .nav-overlay { display: none !important; }
    .nav-hamburger { display: none !important; }
    .main { margin-left: var(--nav-width); transition: margin-left 0.25s ease; }
    body.nav-collapsed .main { margin-left: 52px; }
    #openNav { display: none; }
    .msg-inner { max-width: 70%; }
    .stream-bubble { max-width: 75%; }
}

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 767px) {
    /* Discord page: content full width, no nav offset (both navs off-canvas) */
    body.page-discord .discord-layout {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .main {
        margin-left: 0 !important;
        width: 100%;
        min-width: 0;
        max-width: 100vw;
    }
    .messages {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .nav-collapse-btn { display: none; }
    .nav-hamburger { display: flex; }
    .nav-hamburger.hidden { display: none !important; }
    .nav-sidebar.collapsed { width: var(--nav-width); }
    .nav-sidebar.collapsed .brand-text,
    .nav-sidebar.collapsed .nav-label,
    .nav-sidebar.collapsed .nav-user-info { opacity: 1; width: auto; pointer-events: auto; }
    .toolbar {
        gap: 0.35rem;
        padding: 0.35rem 0.5rem;
    }
    .toolbar-btn {
        padding: 0.3rem 0.45rem;
        font-size: 0.72rem;
        height: 30px;
    }
    .toolbar-btn svg { width: 14px; height: 14px; }
    .history-btn-label { display: none; }
    .notes-btn-label { display: none; }

    .msg-inner { max-width: 100%; }
    .stream-bubble { max-width: 100%; }

    .history-popover {
        position: fixed;
        left: 0.75rem;
        right: 0.75rem;
        bottom: 80px;
        width: auto;
        max-height: 60vh;
    }
    .notes-popover {
        position: fixed;
        left: 0.75rem;
        right: 0.75rem;
        bottom: 80px;
        width: auto;
        max-height: 60vh;
        transform: none;
    }
    .settings-popover {
        position: fixed;
        left: 0.75rem;
        right: 0.75rem;
        bottom: 80px;
        width: auto;
    }

    .note-actions { opacity: 1; }

    .log-panel { width: 100vw; }
    .log-line .log-ts { display: none; }
    .log-line .log-src { display: none; }
    .log-block-btn { opacity: 1; }
}

/* ── Shared Buttons ─────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    white-space: nowrap;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #6d28d9);
    color: white;
}
.btn-danger {
    background: rgba(239,68,68,0.15);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.3);
}
.btn-ghost {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text-primary); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.78rem; }

/* ── Shared Modal ───────────────────────────────────── */
.av-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: av-modal-fade-in 0.15s ease;
}
@keyframes av-modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.av-modal {
    width: 100%;
    max-width: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    animation: av-modal-slide-in 0.2s ease;
}
@keyframes av-modal-slide-in {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.av-modal-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.65rem;
    color: var(--text-primary);
}
.av-modal-body {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    word-break: break-word;
}
.av-modal-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}
.av-modal-input:focus { border-color: var(--accent); }
.av-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
.av-modal-actions .btn { min-width: 80px; justify-content: center; }

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
