/* ── AlpaTrade — merged app skin (light parchment + forest) ───────────
   Ported from PEHero's design system. Same tokens, same class names so
   feature modules can target them. Rebranded wording to AlpaTrade. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    color-scheme: light;
    --bg:        #F7F6F1;
    --bg-elev:   #FFFFFF;
    --bg-raise:  #EFEDE4;
    --ink:       #14231B;
    --ink-muted: #415046;
    --ink-dim:   #7A867E;
    --line:      #E3DFD2;
    --line-br:   #CFC8B4;
    --accent:    #1F5D43;
    --accent-dim:#CFE5DA;
    --accent-deep:#164a35;
    --red:       #B83A3A;
    --green:     #1F6B45;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--ink);
    overflow: hidden;
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
a { color: var(--accent); }

/* ── App grid ── */
.app {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: 100vh;
    height: 100dvh; /* account for mobile browser chrome so the composer stays visible */
    padding-right: 420px;
    transition: padding-right .3s ease;
}
.app.pane-closed { padding-right: 0; }

/* ── Topbar / brand ── */
.left-header {
    padding: .9rem 1.1rem;
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: .65rem;
}
.brand-link { display: flex; align-items: center; color: var(--ink); text-decoration: none; font-weight: 700; gap: .5rem; letter-spacing: -.01em; }
.brand-mark { display: inline-flex; align-items: center; }
.tile-mark { width: 1.45rem; height: 1.45rem; display: block; border-radius: 6px; }
.auth-card .auth-brand .tile-mark { width: 1.7rem; height: 1.7rem; }
.brand-name { font-size: .98rem; }
.brand-badge { font-size: .6rem; font-weight: 600; color: var(--accent); background: var(--accent-dim); padding: .15rem .45rem; border-radius: 4px; letter-spacing: .08em; text-transform: uppercase; }
.brand-version { font-size: .58rem; color: var(--ink-dim); font-family: var(--font-mono); margin-left: .3rem; }

/* ── Left pane ── */
.left-pane {
    background: var(--bg-elev);
    border-right: 1px solid var(--line);
    display: flex; flex-direction: column;
    overflow: hidden;
    z-index: 200;
}
.left-body { flex: 1; overflow-y: auto; padding: .75rem .7rem; scrollbar-width: thin; }
.left-hr { border: none; border-top: 1px solid var(--line); margin: .9rem 0 .6rem; }
.section-label {
    font-size: .62rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .14em; color: var(--ink-dim); padding: 0 .4rem; display: block; margin-bottom: .35rem;
}

/* New-chat button */
.new-chat-btn {
    width: 100%; padding: .55rem; background: var(--accent); color: var(--bg);
    border: none; border-radius: .5rem; font-weight: 600; cursor: pointer; font-size: .78rem;
    margin-bottom: .75rem; text-decoration: none; display: block; text-align: center;
    font-family: var(--font-body);
}
.new-chat-btn:hover { background: var(--ink); }

/* Session history */
.session-list { display: flex; flex-direction: column; gap: .2rem; }
.sessions-empty { font-size: .72rem; color: var(--ink-dim); padding: .4rem; }
.chat-history-item {
    display: flex; align-items: center; gap: .45rem; padding: .35rem .5rem;
    background: transparent; border: none; color: var(--ink-muted); text-align: left;
    font-size: .74rem; cursor: pointer; border-radius: .4rem; transition: background .15s, color .15s;
    width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none;
}
.chat-history-item:hover { background: var(--bg-raise); color: var(--ink); }
.chat-history-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.chat-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line-br); flex-shrink: 0; }
.chat-dot.active { background: var(--accent); }
.chat-session-title { overflow: hidden; text-overflow: ellipsis; }

/* ── Left command menu (collapsible groups) ── */
.agent-browser { display: flex; flex-direction: column; gap: .25rem; }
.cat-toggle {
    display: flex; align-items: center; gap: .45rem;
    width: 100%; padding: .4rem .5rem; background: transparent; border: none; color: var(--ink);
    font-size: .76rem; font-weight: 600; cursor: pointer; border-radius: .4rem;
    transition: background .15s; font-family: var(--font-body);
}
.cat-toggle:hover { background: var(--bg-raise); }
.cat-icon { color: var(--accent); width: 1rem; }
.cat-name { flex: 1; text-align: left; }
.cat-count { color: var(--ink-dim); font-size: .68rem; font-weight: 400; }
.cat-arrow { color: var(--ink-dim); font-size: .62rem; transition: transform .2s; }
details.agent-group > summary { list-style: none; cursor: pointer; }
details.agent-group > summary::-webkit-details-marker { display: none; }
details.agent-group[open] .cat-arrow { transform: rotate(90deg); }

.agent-list { display: none; padding: .1rem .3rem .35rem 1rem; }
details.agent-group[open] .agent-list { display: flex; flex-direction: column; gap: .1rem; }

.agent-item {
    display: flex; align-items: center; gap: .45rem; padding: .3rem .4rem;
    background: transparent; border: none; color: var(--ink-muted); font-size: .7rem;
    cursor: pointer; border-radius: .35rem; text-align: left; width: 100%;
    transition: background .15s, color .15s; text-decoration: none; font-family: var(--font-body);
}
.agent-item:hover { background: var(--bg-raise); color: var(--ink); }
.agent-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.aitem-icon { color: var(--accent); width: .9rem; flex-shrink: 0; }
.aitem-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aitem-prefix { color: var(--ink-dim); font-family: var(--font-mono); font-size: .62rem; }

/* Left footer (auth) */
.left-footer { padding: .6rem .9rem; border-top: 1px solid var(--line); background: var(--bg-elev); }
.sign-in-btn, .signed-in-bar {
    width: 100%; padding: .4rem; background: transparent; border: 1px solid var(--line-br);
    border-radius: .45rem; color: var(--ink-muted); cursor: pointer; font-size: .72rem;
    display: flex; align-items: center; gap: .4rem; justify-content: center; font-family: var(--font-body);
}
.sign-in-btn:hover { border-color: var(--accent); color: var(--accent); }
.user-mark { color: var(--accent); }
.user-email { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--ink); }
.profile-link { font-size: .62rem; padding: .15rem .4rem; background: transparent; border: 1px solid var(--line-br); border-radius: .3rem; color: var(--ink-dim); cursor: pointer; text-decoration: none; }
.profile-link:hover { color: var(--accent); border-color: var(--accent); }
.sign-out-btn { font-size: .62rem; padding: .15rem .4rem; background: transparent; border: 1px solid var(--line-br); border-radius: .3rem; color: var(--ink-dim); cursor: pointer; }
.sign-out-btn:hover { color: var(--red); border-color: var(--red); }

/* ── Auth pages / overlay ── */
.signin-overlay { display: none; position: fixed; inset: 0; z-index: 500; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); align-items: center; justify-content: center; }
.signin-overlay.visible { display: flex; }
.signin-box { background: var(--bg-elev); border: 1px solid var(--line); border-radius: .75rem; padding: 1.6rem; width: 380px; }
.signin-box h3 { color: var(--ink); font-size: 1.05rem; margin-bottom: .3rem; }
.signin-sub { color: var(--ink-dim); font-size: .78rem; margin-bottom: 1rem; }
.signin-box input { width: 100%; padding: .55rem .75rem; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: .45rem; font-size: .85rem; margin-bottom: .6rem; box-sizing: border-box; font-family: var(--font-body); }
.signin-box input:focus { outline: none; border-color: var(--accent); }

/* Standalone auth page card (full-screen /login, /profile) */
.auth-page { display: flex; align-items: center; justify-content: center; height: 100vh; background: var(--bg); }
.auth-card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: .9rem; padding: 2rem; width: min(420px, 92%); box-shadow: 0 6px 30px rgba(0,0,0,.06); }
.auth-card h2 { color: var(--ink); font-size: 1.3rem; margin-bottom: .3rem; }
.auth-card .auth-brand { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.1rem; font-weight: 700; color: var(--ink); }
.auth-card label { display: block; font-size: .72rem; color: var(--ink-muted); font-weight: 600; margin-bottom: .3rem; }
.auth-card input { width: 100%; padding: .55rem .75rem; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: .45rem; font-size: .85rem; margin-bottom: .8rem; font-family: var(--font-body); }
.auth-card input:focus { outline: none; border-color: var(--accent); }

.auth-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.auth-tab { flex: 1; padding: .5rem; background: none; border: none; color: var(--ink-dim); font-size: .85rem; cursor: pointer; border-bottom: 2px solid transparent; font-family: var(--font-body); }
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.auth-primary-btn { padding: .55rem 1.2rem; background: var(--accent); color: var(--bg); border: none; border-radius: .45rem; font-weight: 600; cursor: pointer; font-size: .85rem; font-family: var(--font-body); }
.auth-primary-btn:hover { background: var(--ink); }
.auth-cancel-btn { padding: .55rem 1.2rem; background: var(--bg); color: var(--ink-dim); border: 1px solid var(--line); border-radius: .45rem; cursor: pointer; font-size: .85rem; margin-left: .5rem; font-family: var(--font-body); }
.auth-btn-row { display: flex; align-items: center; margin-top: .6rem; }
.auth-error { color: var(--red); font-size: .75rem; margin-bottom: .4rem; min-height: 1em; }
.auth-success { color: var(--green); font-size: .75rem; margin-bottom: .4rem; min-height: 1em; }
.auth-msg { font-size: .8rem; margin-bottom: .4rem; min-height: 1em; }
.forgot-link { font-size: .72rem; color: var(--ink-dim); display: block; margin-bottom: .6rem; }
.forgot-link:hover { color: var(--ink); }

/* Google OAuth button */
.google-btn { display: flex; align-items: center; justify-content: center; width: 100%; padding: .55rem; background: #fff; border: 1px solid var(--line); border-radius: .45rem; text-decoration: none; color: var(--ink); font-size: .85rem; cursor: pointer; margin-bottom: .6rem; font-family: var(--font-body); }
.google-btn:hover { background: #f8f9fa; }
.google-btn-icon { display: flex; margin-right: .5rem; }
.google-btn-text { font-weight: 500; }
.google-divider { display: flex; align-items: center; margin: .6rem 0; }
.google-divider-line { flex: 1; height: 1px; background: var(--line); }
.google-divider-text { padding: 0 .75rem; font-size: .72rem; color: var(--ink-dim); }

/* API-key management (profile/keys) */
.keys-form { display: flex; flex-direction: column; gap: .6rem; }
.keys-row { display: flex; flex-direction: column; gap: .25rem; }
.keys-row label { font-size: .72rem; font-weight: 600; color: var(--ink-muted); }
.keys-hint { font-size: .66rem; color: var(--ink-dim); font-family: var(--font-mono); }

/* ── Center pane ── */
.center-pane { display: flex; flex-direction: column; overflow: hidden; position: relative; background: var(--bg); }
.chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .6rem 1.1rem; background: var(--bg-elev); border-bottom: 1px solid var(--line);
    min-height: 2.75rem; gap: .5rem; flex-shrink: 0;
}
.chat-header-left { display: flex; align-items: center; gap: .55rem; }
.chat-header-title { font-size: .9rem; font-weight: 600; color: var(--ink); }
.chat-header-dot { color: var(--ink-dim); }
.chat-header-agent { color: var(--accent); font-size: .78rem; font-weight: 500; }
.chat-header-right { display: flex; align-items: center; gap: .4rem; }
.mobile-menu-btn { display: none; padding: .3rem .5rem; background: transparent; border: 1px solid var(--line); border-radius: .4rem; color: var(--ink); font-size: 1.1rem; cursor: pointer; }

.news-toggle-btn {
    padding: .3rem .7rem; background: transparent; border: 1px solid var(--line-br); border-radius: .45rem;
    color: var(--ink-muted); font-size: .72rem; cursor: pointer; transition: all .15s; font-family: var(--font-body);
}
.news-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.news-toggle-btn.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* Voice mic button (chat header) */
.voice-btn {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    align-self: flex-end; width: 2.7rem; height: 2.7rem; padding: 0; background: var(--bg-elev);
    border: 1px solid var(--line-br); border-radius: .6rem; color: var(--accent);
    cursor: pointer; transition: all .15s;
}
.voice-btn:hover { background: var(--accent-dim); border-color: var(--accent); }
.voice-btn.recording, .voice-btn.active { background: #DC2626; color: #fff; border-color: #DC2626; }

/* ── Voice mode indicator — animated waveform bar (shown above the composer) ── */
.voice-panel {
    display: flex; align-items: center; gap: .8rem;
    margin: 0 1.1rem .55rem; padding: .55rem .9rem;
    border: 1px solid var(--line); border-radius: .7rem; background: var(--bg-elev);
    animation: voiceIn .22s ease;
}
@keyframes voiceIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.voice-panel[data-state="listening"] { border-color: #2563EB; box-shadow: 0 0 0 1px rgba(37,99,235,.15); }
.voice-wave { display: inline-flex; align-items: center; gap: 3px; height: 22px; flex-shrink: 0; }
.voice-wave i { width: 3px; height: 6px; border-radius: 3px; background: #9CA3AF; }
.voice-panel[data-state="listening"] .voice-wave i,
.voice-panel[data-state="speaking"]  .voice-wave i,
.voice-panel[data-state="thinking"]  .voice-wave i { animation: voiceBounce 1s ease-in-out infinite; }
.voice-wave i:nth-child(1) { animation-delay: 0s; }
.voice-wave i:nth-child(2) { animation-delay: .12s; }
.voice-wave i:nth-child(3) { animation-delay: .24s; }
.voice-wave i:nth-child(4) { animation-delay: .36s; }
.voice-wave i:nth-child(5) { animation-delay: .48s; }
@keyframes voiceBounce { 0%, 100% { height: 6px; } 50% { height: 22px; } }
.voice-panel[data-state="listening"] .voice-wave i { background: #2563EB; }
.voice-panel[data-state="speaking"]  .voice-wave i { background: var(--accent); }
.voice-panel[data-state="thinking"]  .voice-wave i { background: #F59E0B; }
.voice-panel[data-state="error"]     .voice-wave i { background: #DC2626; }
.voice-status { flex: 1; font-size: .82rem; color: var(--ink); font-weight: 500; }
.voice-stop { padding: .35rem .85rem; font-size: .75rem; font-weight: 600; color: #fff;
    background: var(--ink); border: none; border-radius: .5rem; cursor: pointer; }
.voice-stop:hover { background: var(--accent); }

/* Chat action buttons (copy, share) */
.chat-action-btn {
    padding: .25rem .6rem; font-size: .7rem; font-family: var(--font-body);
    color: var(--ink-muted); background: transparent; border: 1px solid var(--line);
    border-radius: .35rem; cursor: pointer; transition: all .15s;
}
.chat-action-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Messages area */
.messages { flex: 1; overflow-y: auto; padding: 1.1rem 1.5rem; display: flex; flex-direction: column; gap: 1.05rem; }
.msg { display: flex; flex-direction: column; max-width: 78%; }
.msg-user { align-self: flex-end; }
.msg-assistant { align-self: flex-start; }
.msg-agent { display: flex; align-items: center; gap: .35rem; font-size: .62rem; color: var(--ink-dim); margin-bottom: .3rem; padding-left: .1rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .12em; }
.msg-agent-icon { color: var(--accent); }
.msg-bubble {
    padding: .75rem 1rem; border-radius: .85rem;
    font-size: .88rem; line-height: 1.55; color: var(--ink); white-space: pre-wrap; overflow-x: auto;
}
.msg-user .msg-bubble { background: var(--accent); color: var(--bg); border-bottom-right-radius: .25rem; }
.msg-assistant .msg-bubble { background: var(--bg-elev); border: 1px solid var(--line); border-bottom-left-radius: .25rem; }
.msg-tool .msg-bubble { background: var(--bg-raise); border: 1px dashed var(--line-br); font-family: var(--font-mono); font-size: .72rem; color: var(--ink-muted); }

.msg-bubble pre { background: var(--bg); border: 1px solid var(--line); border-radius: .4rem; padding: .6rem; overflow-x: auto; font-size: .72rem; margin: .4rem 0; font-family: var(--font-mono); }
.msg-bubble code { font-family: var(--font-mono); }
.msg-bubble ul { padding-left: 1.1rem; margin: .35rem 0; }
.msg-bubble li { margin-bottom: .25rem; }
.msg-bubble strong { color: var(--accent); }
.msg-bubble h2, .msg-bubble h3, .msg-bubble h4 { margin: .6rem 0 .25rem; font-weight: 600; }
.msg-bubble h2 { font-size: 1rem; }
.msg-bubble h3 { font-size: .9rem; }
.msg-bubble h4 { font-size: .82rem; }

/* Welcome hero */
.welcome-hero { position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%); width: min(720px, 85%); text-align: center; pointer-events: none; }
.welcome-hero .suggestions { pointer-events: auto; }
.center-pane:has(#messages:not(:empty)) #welcome-hero { display: none; }
.hero-mark { color: var(--accent); font-size: 2.3rem; }
.welcome-title { color: var(--ink); font-size: 2rem; font-weight: 600; letter-spacing: -.025em; margin-top: .2rem; }
.welcome-sub { color: var(--ink-muted); font-size: .9rem; margin-top: .5rem; }

/* Suggestion chips / cards */
.suggestions { display: flex; flex-wrap: wrap; gap: .55rem; justify-content: center; margin-top: 1.8rem; }
.suggestion-chip { display: flex; align-items: center; gap: .45rem; padding: .45rem .75rem; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 2rem; color: var(--ink-muted); font-size: .76rem; font-family: var(--font-mono); cursor: pointer; transition: all .15s; }
.suggestion-chip:hover { border-color: var(--accent); color: var(--accent); }
.sugg-icon { color: var(--accent); }

/* Chat composer */
.chat-form { display: flex; gap: .5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--line); background: var(--bg-elev); }
.chat-textarea {
    flex: 1; padding: .7rem .9rem; background: var(--bg); border: 1px solid var(--line);
    border-radius: .6rem; color: var(--ink); font-size: .85rem; font-family: var(--font-body);
    resize: none; line-height: 1.4; max-height: 12rem; outline: none;
}
.chat-textarea:focus { border-color: var(--accent); }
.chat-send { padding: .65rem 1.1rem; background: var(--accent); color: var(--bg); border: none; border-radius: .6rem; font-weight: 600; cursor: pointer; font-family: var(--font-body); }
.chat-send:hover { background: var(--ink); }
.chat-send:disabled { opacity: .5; cursor: wait; }

/* Suggestion cards BELOW the composer (Gemini-style) */
.sample-cards { padding: .4rem 1.1rem 1rem; background: var(--bg-elev); border-top: 1px solid var(--line); }
.sample-cards-label { display: inline-block; font-size: .62rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-dim); margin-bottom: .5rem; padding-left: .15rem; }
.sample-cards-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.sample-card {
    background: var(--bg); border: 1px solid var(--line); color: var(--ink-muted);
    padding: .5rem .8rem; border-radius: 10px; font-size: .72rem; font-family: var(--font-mono);
    cursor: pointer; max-width: 380px; text-align: left; line-height: 1.35; transition: all .15s;
}
.sample-card:hover { border-color: var(--accent); color: var(--accent); background: var(--bg-raise); }
.sample-card-text { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Streaming / thinking indicators */
.streaming::after { content: "▊"; color: var(--accent); animation: blink 1s steps(2) infinite; margin-left: .15rem; }
@keyframes blink { to { opacity: 0; } }
.thinking-indicator {
    display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .75rem;
    background: var(--bg-raise); border: 1px dashed var(--line-br); border-radius: 999px;
    font-size: .72rem; color: var(--ink-muted); font-family: var(--font-mono);
    margin-bottom: .35rem; align-self: flex-start;
}
.thinking-indicator .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
.thinking-indicator code { background: var(--bg); padding: .05rem .35rem; border-radius: 4px; color: var(--accent); font-size: .7rem; }
.thinking-indicator .secs { color: var(--ink-dim); }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }

/* ── Right pane (NEWS only) ── */
.right-pane {
    position: fixed; top: 0; bottom: 0; right: -440px; width: 420px;
    background: var(--bg-elev); border-left: 1px solid var(--line);
    z-index: 150; display: flex; flex-direction: column; transition: right .3s ease;
}
.right-pane.open { right: 0; }
.right-header { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1.05rem; border-bottom: 1px solid var(--line); background: var(--bg-elev); }
.right-header-left { display: flex; flex-direction: column; }
.right-title { color: var(--ink); font-size: .92rem; font-weight: 600; }
.right-subtitle { color: var(--ink-dim); font-size: .68rem; margin-top: .1rem; font-family: var(--font-mono); }
.right-close { background: transparent; border: 1px solid var(--line); color: var(--ink-dim); border-radius: .4rem; padding: .15rem .5rem; cursor: pointer; }
.right-close:hover { color: var(--accent); border-color: var(--accent); }
.right-body { flex: 1; overflow-y: auto; padding: .75rem; }

/* News loading / empty state */
.news-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; padding: 3rem 2rem; color: var(--ink-dim); }
.news-loading-icon { font-size: 2.2rem; color: var(--accent); opacity: .6; margin-bottom: .9rem; animation: pulse 1.2s ease-in-out infinite; }
.news-loading-text { color: var(--ink-dim); font-size: .78rem; }
.news-empty { color: var(--ink-dim); font-size: .78rem; text-align: center; padding: 2rem; }

/* News feed items */
.news-body { display: flex; flex-direction: column; gap: .1rem; }
.news-item {
    display: block; padding: .7rem .75rem; border-radius: .5rem;
    text-decoration: none; color: var(--ink); transition: background .15s;
    border-bottom: 1px solid var(--line);
}
.news-item:hover { background: var(--bg-raise); }
.news-item:last-child { border-bottom: none; }
.news-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .25rem; }
.news-source {
    font-size: .6rem; font-weight: 700; font-family: var(--font-mono);
    text-transform: uppercase; letter-spacing: .1em; color: var(--accent);
    background: var(--accent-dim); padding: .1rem .4rem; border-radius: .2rem;
}
.news-time { font-size: .6rem; color: var(--ink-dim); font-family: var(--font-mono); }
.news-item-title { font-size: .78rem; font-weight: 600; line-height: 1.35; color: var(--ink); margin-bottom: .2rem; }
.news-item-summary { font-size: .68rem; color: var(--ink-muted); line-height: 1.4; }

/* ── Generic content / command-output styles ── */
.content { padding: 1.25rem 1.75rem; overflow-y: auto; }
.content h1 { font-size: 1.4rem; font-weight: 600; color: var(--ink); margin-bottom: .3rem; letter-spacing: -.02em; }
.content h2 { font-size: 1.05rem; font-weight: 600; color: var(--ink); margin: 1.1rem 0 .4rem; }
.content h3 { font-size: .9rem; font-weight: 600; color: var(--ink-muted); margin: .8rem 0 .3rem; }
.content p { font-size: .85rem; line-height: 1.55; color: var(--ink-muted); margin-bottom: .5rem; }
.content pre { background: var(--bg-elev); border: 1px solid var(--line); border-radius: .5rem; padding: .8rem; overflow-x: auto; font-family: var(--font-mono); font-size: .74rem; color: var(--ink); }
.content code { font-family: var(--font-mono); font-size: .8rem; color: var(--accent); }

/* Metric / stat tiles for command outputs */
.stat-row { display: flex; flex-wrap: wrap; gap: .75rem; margin: .75rem 0; }
.stat-tile { flex: 1 1 140px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: .6rem; padding: .75rem .9rem; }
.stat-tile .stat-label { font-size: .6rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-dim); font-family: var(--font-mono); }
.stat-tile .stat-value { font-size: 1.35rem; font-weight: 600; color: var(--ink); margin-top: .2rem; font-family: var(--font-mono); }
.stat-tile .stat-value.pos { color: var(--green); }
.stat-tile .stat-value.neg { color: var(--red); }

/* ── Shared table styles (chat bubbles + command output) ── */
.at-table, .artifact-table, .pe-table, .msg-bubble table, .content table {
    width: 100%; border-collapse: collapse; font-size: .8rem; margin: .5rem 0;
    border: 1px solid var(--line); border-radius: .4rem; overflow: hidden;
}
.at-table th, .artifact-table th, .pe-table th, .msg-bubble th, .content th,
.at-table thead th, .artifact-table thead th, .content thead th {
    background: var(--ink); color: var(--bg); font-weight: 600; font-size: .72rem;
    text-transform: uppercase; letter-spacing: .03em; text-align: left; padding: .4rem .6rem; border: 1px solid var(--line);
}
.at-table td, .artifact-table td, .pe-table td, .msg-bubble td, .content td {
    text-align: left; padding: .4rem .6rem; border: 1px solid var(--line); font-family: var(--font-mono); font-size: .74rem;
}
.at-table tbody tr:nth-child(even) td, .artifact-table tbody tr:nth-child(even) td,
.content tbody tr:nth-child(even) td, .msg-bubble tbody tr:nth-child(even) td { background: var(--bg); }
.at-table tbody tr:hover td, .artifact-table tbody tr:hover td,
.content tbody tr:hover td, .msg-bubble tbody tr:hover td { background: var(--accent-dim); }
td.num, th.num { text-align: right; }
td.pos { color: var(--green); }
td.neg { color: var(--red); }

/* Table toolbar (CSV export etc.) */
.table-toolbar { display: flex; gap: .35rem; justify-content: flex-end; margin-bottom: .25rem; }
.table-action-btn { padding: .2rem .5rem; font-size: .7rem; font-family: var(--font-body); color: var(--accent); background: var(--accent-dim); border: 1px solid var(--line); border-radius: .25rem; cursor: pointer; transition: all .15s; }
.table-action-btn:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.table-see-more { display: block; margin: .4rem auto 0; padding: .3rem .9rem; background: var(--bg-raise); border: 1px solid var(--line); border-radius: .4rem; color: var(--accent); font-size: .72rem; font-weight: 600; cursor: pointer; font-family: var(--font-mono); transition: all .15s; }
.table-see-more:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* Inline artifacts + tool call log */
.artifact-inline { background: var(--bg); border: 1px solid var(--line); border-radius: .55rem; padding: .75rem .85rem; margin-top: .5rem; overflow-x: auto; }
.artifact-inline-title { color: var(--ink); font-size: .8rem; font-weight: 600; margin-bottom: .15rem; }
.artifact-inline-sub { color: var(--ink-dim); font-size: .68rem; font-family: var(--font-mono); margin-bottom: .5rem; }
.chart-container { margin-top: .5rem; border-radius: .4rem; overflow: hidden; min-height: 300px; }
.tool-log { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-dim); margin-top: .35rem; padding-left: .8rem; border-left: 2px solid var(--line-br); }
.tool-log .tool-step { margin-bottom: .2rem; }
.tool-log .tool-name { color: var(--accent); }

/* HTMX indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: flex; }

/* Left overlay (mobile) */
.left-overlay { display: none; position: fixed; inset: 0; z-index: 199; background: rgba(0,0,0,.4); backdrop-filter: blur(2px); }
.left-overlay.visible { display: block; }

/* ── Responsive ── */
@media (max-width: 1280px) {
    .welcome-hero .suggestions { display: none; }
    .welcome-hero { top: 38%; }
}
@media (max-width: 960px) {
    .app { padding-right: 0; grid-template-columns: 1fr; }
    .left-pane { position: fixed; left: -320px; top: 0; bottom: 0; width: 300px; transition: left .3s ease; }
    .left-pane.open { left: 0; }
    .mobile-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
    .right-pane { width: 92vw; right: -95vw; }
    .right-pane.open { right: 0; }
    .welcome-hero .suggestions { display: none; }
    /* Keep the prompt cards visible below the composer on mobile (compact). */
    .sample-cards { padding: .4rem .6rem .7rem; max-height: 33vh; overflow-y: auto; }
    .sample-cards-row { gap: .4rem; }
    .sample-card { font-size: .72rem; }
    .welcome-hero { top: 26%; }
    .welcome-title { font-size: 1.4rem; }
    .welcome-sub { font-size: .78rem; }
    .hero-mark { font-size: 1.6rem; }
    .chat-header { padding: .45rem .6rem; min-height: 2.2rem; gap: .3rem; }
    .chat-header-title { font-size: .78rem; }
    .chat-header-agent { font-size: .68rem; }
    .chat-form { padding: .5rem .6rem; }
    .chat-textarea { font-size: .85rem; padding: .5rem .7rem; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-br); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
