/* ═══════════════════════════════════════════════════════════════════════════════
   AI Chat Overlay — Full-Width Content Area Design
   ═══════════════════════════════════════════════════════════════════════════════
   The overlay fills the entire content area below the header bar.
   It squeezes when sidebars toggle and includes a vertical timeline sidebar.
*/

/* ── Chat Overlay Container ───────────────────────────────────────────────── */

#chat-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    z-index: 100;
    background: var(--bg-primary);
    display: none;
    flex-direction: row;
    overflow: hidden;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    animation: chatOverlayIn 0.3s ease;
}

#chat-overlay.active {
    display: flex;
}

#chat-overlay.is-hosting .chat-messages,
#chat-overlay.is-hosting .chat-input-area,
#chat-overlay.is-hosting .chat-navigator {
    display: none !important;
}

#chat-overlay.is-hosting .chat-main {
    position: relative;
}

#chat-overlay.is-hosting .chat-close-bar {
    position: relative;
    z-index: 6;
}

/* Info guide fills the overlay. History stays shut. */
#chat-overlay.is-hosting .chat-timeline,
#chat-overlay.is-hosting .chat-timeline:hover,
#chat-overlay.is-hosting .chat-timeline.is-expanded,
#chat-overlay.is-hosting .chat-timeline.mobile-open {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0;
    overflow: hidden;
    pointer-events: none;
    border: none;
    box-shadow: none;
}
#chat-overlay.is-hosting .chat-timeline:hover .timeline-expanded-content,
#chat-overlay.is-hosting .chat-timeline.is-expanded .timeline-expanded-content,
#chat-overlay.is-hosting .chat-timeline.mobile-open .timeline-expanded-content {
    display: none !important;
}
#chat-overlay.is-hosting .chat-mobile-header-actions {
    display: none !important;
}

/* Slide-down transition: input area starts near top, slides to bottom */
#chat-overlay.from-search .chat-main {
    animation: chatFromSearchIn 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

#chat-overlay.from-search .chat-input-area {
    animation: inputSlideDown 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes chatFromSearchIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes inputSlideDown {
    0% {
        transform: translateY(-70vh);
        opacity: 0.9;
    }
    60% {
        opacity: 1;
    }
    100% {
        transform: translateY(0);
    }
}

@keyframes chatOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Timeline Sidebar (Session History) ───────────────────────────────────── */

.chat-timeline {
    width: 64px;
    min-width: 64px;
    max-height: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 0 0;
    overflow: hidden;
    scrollbar-width: none;
    background: var(--bg-primary);
    position: relative;
    z-index: 20;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-sizing: border-box;
    
    /* Theme variables matching production Copilot mode */
    --tl-accent: #00f0ff;
    --tl-accent-rgb: 0, 240, 255;
    --tl-border: rgba(0, 240, 255, 0.12);
    --tl-bg: rgba(0, 240, 255, 0.02);
    --tl-node: rgba(0, 240, 255, 0.5);
    --tl-node-active: #00f0ff;
    --tl-line: rgba(0, 240, 255, 0.45);
    --tl-text: rgba(0, 240, 255, 0.6);
    --tl-text-dim: rgba(0, 240, 255, 0.3);
    --tl-text-bright: rgba(0, 240, 255, 0.85);
    --tl-separator: rgba(0, 240, 255, 0.08);
}
.chat-timeline::-webkit-scrollbar { display: none; }

/* On hover — expand to double the width space (440px).
   .is-expanded is set 50px to the right of the rail (rail position unchanged). */
.chat-timeline:hover,
.chat-timeline.is-expanded {
    width: 440px;
    min-width: 440px;
}

/* New session button (top) */
.timeline-new-btn {
    width: 64px;
    height: 34px;
    margin: 4px 0 8px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--tl-accent);
    cursor: pointer;
    flex-shrink: 0;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 400;
}
.timeline-new-mark {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 50%;
    background: var(--tl-bg);
    border: 1.5px solid var(--tl-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tl-accent);
}
.timeline-new-label { display: none; white-space: nowrap; color: var(--tl-text-bright); }
.chat-timeline:hover .timeline-new-btn,
.chat-timeline.is-expanded .timeline-new-btn,
.chat-timeline.mobile-open .timeline-new-btn {
    width: auto;
    justify-content: flex-start;
    margin: 8px 12px 10px;
    padding: 0 10px 0 6px;
}
.chat-timeline:hover .timeline-new-label,
.chat-timeline.is-expanded .timeline-new-label,
.chat-timeline.mobile-open .timeline-new-label { display: inline; }
.timeline-new-btn:disabled,
.timeline-new-btn:disabled:hover {
    opacity: 0.35;
    cursor: default;
    background: transparent;
}
.timeline-new-btn svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Collapsed View ── */
.timeline-collapsed-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 64px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    scrollbar-width: none;
    transition: opacity 200ms ease;
    opacity: 0.5;
    position: relative; /* relative for absolute continuous line */
}
.timeline-collapsed-content::-webkit-scrollbar { display: none; }
.chat-timeline:has(> #shell-tour-info-btn) .timeline-collapsed-content {
    min-height: 0;
}
.chat-timeline:hover .timeline-collapsed-content,
.chat-timeline.is-expanded .timeline-collapsed-content {
    display: none;
}
.timeline-collapsed-content:hover {
    opacity: 1;
}

/* Line runs through the session dots only, starting under the search icon. */
.timeline-collapsed-nodes {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    flex-shrink: 0;
}
.timeline-collapsed-nodes::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 14px;
    left: 50%;
    width: 1px;
    transform: translateX(-50%);
    /* Collapsed rail is at half opacity, so the stroke itself stays solid neon. */
    background: #00f0ff;
    box-shadow: 0 0 6px rgba(0, 240, 255, 0.85);
    z-index: 1;
    pointer-events: none;
}

.timeline-search-icon-collapsed {
    color: var(--tl-text-dim);
    margin: 8px auto 12px;
    flex-shrink: 0;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    background: var(--bg-primary);
    padding: 2px;
}

/* Collapsed Node — icon shows session origin (you / alert / strategy) */
.timeline-node {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-primary); /* masks the vertical line segment behind it */
    border: 1.5px solid var(--tl-node);
    color: var(--tl-node);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 2;
    margin: 8px 0;
}
.timeline-node svg {
    width: 10px;
    height: 10px;
    display: block;
}
.timeline-node:hover {
    background: var(--tl-accent);
    color: var(--bg-primary);
    border-color: var(--tl-accent);
    box-shadow: 0 0 8px rgba(var(--tl-accent-rgb), 0.5);
    transform: scale(1.08);
}
.timeline-node.active {
    background: var(--tl-node-active);
    border-color: var(--tl-node-active);
    color: var(--bg-primary);
    box-shadow: 0 0 8px rgba(var(--tl-accent-rgb), 0.6);
    width: 20px;
    height: 20px;
}
.timeline-node.active svg {
    width: 11px;
    height: 11px;
}
.timeline-node.starred {
    border-color: var(--tl-node-active);
    color: var(--tl-node-active);
    box-shadow: 0 0 6px rgba(var(--tl-accent-rgb), 0.4);
}

/* Collapsed Date separator */
.date-separator-collapsed {
    width: 20px;
    height: 28px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    background: var(--bg-primary);
    margin: 0 auto; /* center in 64px */
}
.date-separator-collapsed::after {
    content: '';
    width: 100%;
    height: 1px;
    background: var(--tl-separator);
}

/* ── Expanded View ── */
.timeline-expanded-content {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
    opacity: 0;
    transition: opacity 200ms ease;
}
.chat-timeline:hover .timeline-expanded-content,
.chat-timeline.is-expanded .timeline-expanded-content {
    display: flex;
    opacity: 1;
    flex: 1;
    min-height: 0;
    height: auto;
}

/* Search bar */
.timeline-search-bar {
    padding: 6px 10px;
    border-bottom: 1px solid var(--tl-border);
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}
.timeline-search-input-wrapper {
    position: relative;
    width: 100%;
}
.timeline-search-input-icon {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tl-text-dim);
    pointer-events: none;
}
.timeline-search-input-expanded {
    width: 100%;
    background: rgba(var(--tl-accent-rgb), 0.04);
    border: 1px solid rgba(var(--tl-accent-rgb), 0.12);
    border-radius: 6px;
    padding: 5px 8px 5px 28px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--tl-text-bright);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.timeline-search-input-expanded:focus {
    border-color: rgba(var(--tl-accent-rgb), 0.3);
}
.timeline-search-input-expanded::placeholder {
    color: var(--tl-text-dim);
}

/* Session list scroll area */
.timeline-session-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
    scrollbar-width: none;
}
.timeline-session-list::-webkit-scrollbar { display: none; }

/* Pinned Section */
.timeline-pinned-section {
    padding: 2px 0 6px;
    border-bottom: 1px solid var(--tl-separator);
}
.timeline-pinned-label {
    font-size: 11px;
    font-family: monospace;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tl-text-dim);
    padding: 8px 4px 4px 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Expanded Date separator */
.timeline-date-separator-expanded {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px 4px 24px;
}
.timeline-date-separator-line {
    flex: 1;
    height: 1px;
    background: var(--tl-separator);
}
.timeline-date-separator-text {
    font-size: 9px;
    font-family: monospace;
    color: var(--tl-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    font-weight: 600;
}

/* Session Row */
.timeline-session-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 0 24px;
    cursor: pointer;
    transition: background 0.15s ease;
    position: relative;
    min-height: 48px;
}
.timeline-session-row:hover {
    background: rgba(var(--tl-accent-rgb), 0.04);
}
.timeline-session-row.active {
    background: rgba(var(--tl-accent-rgb), 0.08);
}
.timeline-session-row.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 60%;
    background: var(--tl-accent);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 6px rgba(var(--tl-accent-rgb), 0.4);
}

/* Timeline Node Column in Row */
.timeline-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 22px;
    flex-shrink: 0;
    position: relative;
    align-self: stretch;
}
.timeline-col::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    background: var(--tl-line);
}
.timeline-session-row.last-row .timeline-col::before {
    bottom: 50%;
}
.timeline-row-node {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 1.5px solid var(--tl-node);
    color: var(--tl-node);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    position: relative;
    z-index: 1;
}
.timeline-row-node svg {
    width: 10px;
    height: 10px;
    display: block;
}
.timeline-session-row.active .timeline-row-node {
    background: var(--tl-node-active);
    border-color: var(--tl-node-active);
    color: var(--bg-primary);
    box-shadow: 0 0 6px rgba(var(--tl-accent-rgb), 0.5);
    width: 20px;
    height: 20px;
}
.timeline-session-row.active .timeline-row-node svg {
    width: 11px;
    height: 11px;
}

/* Session Info Text */
.timeline-session-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.timeline-session-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--tl-text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.timeline-session-time {
    font-size: 9px;
    font-family: monospace;
    color: var(--tl-text-dim);
}

/* Actions (Visible on Row Hover) */
.timeline-session-actions {
    display: none;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.timeline-session-row:hover .timeline-session-actions {
    display: flex;
}
.timeline-star-btn, .timeline-edit-btn, .timeline-delete-btn {
    padding: 3px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--tl-text-dim);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.timeline-star-btn:hover, .timeline-edit-btn:hover {
    color: var(--tl-accent);
    background: rgba(var(--tl-accent-rgb), 0.1);
}
.timeline-star-btn.active {
    color: var(--tl-accent) !important;
}

/* Delete button turns red on hover */
.timeline-delete-btn:hover {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Inline Edit Input */
.timeline-edit-form {
    width: 100%;
}
.timeline-edit-input {
    width: 100%;
    background: rgba(var(--tl-accent-rgb), 0.08);
    border: 1px solid rgba(var(--tl-accent-rgb), 0.25);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 13px;
    color: var(--tl-text-bright);
    outline: none;
    font-family: inherit;
}

/* Delete Confirmation State (Matches Investing Tools Style) */
.timeline-session-row.timeline-row-confirming {
    background: rgba(255, 80, 80, 0.08) !important;
}
.timeline-delete-confirm {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.timeline-confirm-yes, .timeline-confirm-no {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.15s ease;
}
.timeline-confirm-yes {
    background: rgba(255, 80, 80, 0.15);
    color: #ff5050;
}
.timeline-confirm-yes:hover {
    background: rgba(255, 80, 80, 0.3);
}
.timeline-confirm-divider {
    color: var(--tl-text-dim);
    opacity: 0.3;
    font-size: 11px;
}
.timeline-confirm-no {
    background: rgba(0, 240, 255, 0.08);
    color: var(--tl-accent);
}
.timeline-confirm-no:hover {
    background: rgba(0, 240, 255, 0.2);
}

/* ── Chat Main Area ───────────────────────────────────────────────────────── */

#chat-overlay .chat-main > .alert-notif-banner {
    flex-shrink: 0;
    width: 100%;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    height: 100%;
    overflow: hidden;
    box-sizing: border-box;
    padding-bottom: 15px;
    position: relative;
}

/* Close button */
.chat-close-bar {
    display: flex; align-items: center; justify-content: flex-end;
    padding: 6px 16px 0; flex-shrink: 0;
    position: relative;
    z-index: 4;
}
#chat-overlay.active:not(.is-docked):not(.is-hosting) .chat-close-btn {
    display: none;
}
#chat-overlay.active:not(.is-docked):not(.is-hosting) .chat-close-bar {
    padding-right: 8px;
}
.chat-close-btn {
    background: none; border: none;
    color: var(--text-muted, #6a7080); cursor: pointer;
    padding: 6px; border-radius: 6px; transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.chat-close-btn:hover {
    color: var(--text-primary, #e6e8ec);
    background: rgba(255, 255, 255, 0.06);
}
.chat-close-btn svg {
    width: 18px; height: 18px; stroke: currentColor;
    stroke-width: 2; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
}

/* ── Messages Area ────────────────────────────────────────────────────────── */

.chat-messages {
    flex: 1 1 0;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: none;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.chat-messages::-webkit-scrollbar { display: none; }

/* ── Empty State (Production Manawa Landing) ─────────────────────────────── */

.chat-empty-header {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 24px;
}

.chat-empty-logo-wrap {
    position: relative;
    margin-bottom: 12px;
}

.chat-empty-logo-glow {
    position: absolute;
    inset: 0;
    background: rgba(0, 240, 255, 0.2);
    filter: blur(48px);
    border-radius: 50%;
    transform: scale(1.5);
}

.chat-empty-logo {
    width: 96px;
    height: 96px;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 0 15px rgba(0, 240, 255, 0.4));
}

.chat-empty-heading {
    font-size: 42px;
    font-weight: 300;
    color: #fff;
    margin: 0;
    letter-spacing: -0.02em;
    line-height: 1.2;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.85);
}

.chat-empty-heading-accent {
    color: var(--neon-cyan, #00f0ff);
    font-weight: 500;
}

/* Empty State centering layouts */
.chat-main.is-empty #chat-messages {
    display: none !important;
}

.chat-main.is-empty .chat-input-area {
    flex: 1;
    display: grid;
    grid-template-rows: 1fr auto 1fr;
    height: 100%;
    align-items: center;
    justify-items: center;
    padding: 24px;
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
    pointer-events: none;
    background: transparent;
}

.chat-main.is-empty .chat-empty-header,
.chat-main.is-empty .chat-input-wrapper,
.chat-main.is-empty .chat-shortcuts,
.chat-main.is-empty #chat-suggested-actions-container,
.chat-main.is-empty .chat-input-usage {
    pointer-events: auto;
}

.chat-main.is-empty .chat-empty-header {
    grid-row: 1;
    align-self: end;
    display: flex;
    margin-bottom: 32px;
}

.chat-main.is-empty .chat-input-wrapper {
    grid-row: 2;
    align-self: center;
    width: 100%;
    position: relative;
}

.chat-main.is-empty .chat-input-box {
    width: 100%;
    margin-bottom: 0px;
}

.chat-main.is-empty .chat-shortcuts {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 10px;
    margin-bottom: 0;
    white-space: nowrap;
}

.chat-main.is-empty .chat-starter-wrap {
    display: none !important;
}

/* Rising question bubbles. They fill the empty column and pass behind the logo and the input. */
.chat-float-field {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow-x: hidden;
    overflow-y: auto;
    overflow-anchor: none;
    scrollbar-width: none;
}
.chat-float-field[hidden] { display: none !important; }
.chat-float-field::-webkit-scrollbar { display: none; }
.chat-float-track { min-height: 100%; overflow-anchor: none; }
.chat-float-spacer { width: 100%; pointer-events: none; }
.chat-float-set {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0 16px 4px;
}
.chat-float-bubble {
    appearance: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    column-gap: 4px;
    row-gap: 2px;
    width: fit-content;
    max-width: min(380px, 42%);
    box-sizing: border-box;
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid rgba(0, 240, 255, 0.32);
    background: rgba(5, 10, 20, 0.86);
    color: var(--text-primary, #e8eef2);
    font: inherit;
    font-size: 14px;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    user-select: none;
}
.chat-float-bubble:hover {
    border-color: rgba(0, 240, 255, 0.75);
    background: rgba(0, 40, 48, 0.82);
    color: #fff;
}
.chat-float-logo {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    object-fit: cover;
    flex: 0 0 auto;
}
.chat-float-icon {
    font-size: 15px;
    line-height: 1;
    flex: 0 0 auto;
}
.chat-float-bubble:hover .chat-float-move.gain { color: var(--gain); }
.chat-float-bubble:hover .chat-float-move.loss { color: var(--loss); }
/* Narrow overlay / phone: stacked chips — fixed radius, no skinny pills. */
.chat-float-set--thin {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 12px 8px;
}
.chat-float-set--thin .chat-float-bubble {
    margin-left: 0 !important;
    margin-top: 0 !important;
    width: auto;
    max-width: min(380px, 100%);
    min-width: min(260px, 100%);
    border-radius: 16px;
}
.chat-float-set--thin .chat-float-bubble.is-float-left { align-self: flex-start; }
.chat-float-set--thin .chat-float-bubble.is-float-center { align-self: center; }
.chat-float-set--thin .chat-float-bubble.is-float-right { align-self: flex-end; }
#chat-overlay.is-docked .chat-float-bubble {
    border-radius: 16px;
    max-width: min(380px, 100%);
    min-width: min(260px, 100%);
}
@media (max-width: 768px) {
    .chat-float-bubble {
        border-radius: 16px;
    }
}

.chat-main.is-empty .chat-starter-cards {
    margin-top: 0;
}

.chat-input-wrapper {
    width: 100%;
}

/* ── Starter Chips ────────────────────────────────────────────────────────── */

.chat-starters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 600px;
}

.chat-starter-chip {
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary, #9da3b0);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chat-starter-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    transform: translateY(-1px);
}

/* ── Message Bubble ───────────────────────────────────────────────────────── */

.chat-msg {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    animation: chat-msg-in 0.3s ease;
}

.chat-math-display {
    display: block;
    max-width: 100%;
    margin: 8px 0 14px;
    overflow-x: auto;
    overflow-y: hidden;
    text-align: center;
}

.chat-msg-bubble .katex {
    font-size: 1.05em;
    color: inherit;
}

.chat-msg-bubble .katex-display {
    margin: 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.chat-math-fallback {
    font-family: 'Times New Roman', Times, serif;
    font-style: italic;
}

.chat-math-display.chat-math-fallback {
    font-style: normal;
    font-size: 1.15em;
}

@keyframes chat-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg--user {
    align-items: flex-end;
}

.chat-msg--user .chat-msg-bubble {
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: 16px 16px 4px 16px;
    max-width: 85%;
    color: var(--neon-cyan, #00f0ff);
    box-shadow: 0 4px 12px rgba(0, 240, 255, 0.1);
    backdrop-filter: blur(4px);
    font-weight: 300;
}

.chat-msg--user .chat-msg-bubble.is-strategy-load {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.chat-msg-long {
    white-space: pre-wrap;
    width: 100%;
}

.chat-msg-long.is-clamped:not(.is-open) {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
}

.chat-msg-collapse {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 0;
    border: 0;
    background: none;
    color: rgba(0, 240, 255, 0.72);
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.2;
    cursor: pointer;
}

.chat-msg-collapse svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    flex: 0 0 auto;
    transition: transform 0.15s ease;
}

.chat-msg-collapse.is-open svg {
    transform: rotate(180deg);
}

.chat-msg-collapse:hover {
    color: var(--neon-cyan, #00f0ff);
}

.chat-st-mark {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: var(--accent-primary, #13707f);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.chat-msg-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

.chat-msg-copy-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(0, 240, 255, 0.15);
    background: none;
    color: rgba(0, 240, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0;
    flex-shrink: 0;
}

.chat-msg--user:hover .chat-msg-copy-btn {
    opacity: 1;
}

.chat-msg-copy-btn:hover {
    border-color: rgba(0, 240, 255, 0.35);
    background: rgba(0, 240, 255, 0.08);
    color: var(--neon-cyan, #00f0ff);
}

.chat-msg-copy-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.chat-msg-timestamp-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    margin-right: 8px;
}

.chat-msg-timestamp {
    font-size: 10px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: rgba(0, 240, 255, 0.4);
}

.chat-msg-copied-feedback {
    font-size: 10px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: var(--win, #00ff9d);
    animation: fadeIn 0.2s ease-out;
}

.chat-msg--assistant .chat-msg-bubble {
    background: none;
    border: none;
    border-radius: 0;
    max-width: 100%;
    color: #ffffff;
    font-family: var(--font-inter), var(--font-sans);
    font-size: 14px;
    font-weight: 300;
    line-height: 1.65;
}

.chat-msg--assistant .chat-msg-bubble p {
    color: #ffffff;
    font-weight: 300;
    margin-bottom: 12px;
}

.chat-msg--assistant .chat-msg-bubble strong {
    color: #ffffff;
    font-weight: 700;
    text-shadow: none;
}

.chat-msg--assistant .chat-msg-bubble h1,
.chat-msg--assistant .chat-msg-bubble h2,
.chat-msg--assistant .chat-msg-bubble h3,
.chat-msg--assistant .chat-msg-bubble h4,
.chat-msg--assistant .chat-msg-bubble h5,
.chat-msg--assistant .chat-msg-bubble h6 {
    color: #ffffff;
    text-shadow: none;
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 700;
}

.chat-msg--assistant .chat-msg-bubble ul,
.chat-msg--assistant .chat-msg-bubble ol {
    color: #ffffff;
    margin-bottom: 12px;
}

.chat-msg--assistant .chat-msg-bubble li {
    color: #ffffff;
    font-weight: 300;
}

.chat-msg--assistant .chat-msg-bubble li::marker {
    color: #ffffff;
}

.chat-msg--assistant .chat-msg-bubble a {
    color: #ffffff;
    text-decoration: underline;
}

.chat-msg--assistant .chat-msg-bubble code {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-msg--assistant .chat-msg-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: 6px;
    overflow: hidden;
}

.chat-msg--assistant .chat-msg-bubble th {
    background: rgba(0, 240, 255, 0.03);
    color: var(--neon-cyan, #00f0ff);
    font-weight: 700;
    font-size: 13px;
    text-transform: none;
    letter-spacing: normal;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.15);
    border-right: 1px solid rgba(0, 240, 255, 0.1);
    text-shadow: 0 0 4px rgba(0, 240, 255, 0.25);
}

.chat-msg--assistant .chat-msg-bubble th:last-child {
    border-right: none;
}

.chat-msg--assistant .chat-msg-bubble td {
    padding: 8px 14px;
    color: #e6e8ec;
    border-bottom: 1px solid rgba(0, 240, 255, 0.06);
    border-right: 1px solid rgba(0, 240, 255, 0.06);
}

.chat-msg--assistant .chat-msg-bubble td:last-child {
    border-right: none;
}

.chat-msg--assistant .chat-msg-bubble tr:last-child td {
    border-bottom: none;
}

.chat-msg--assistant .chat-msg-bubble tr:nth-child(even) {
    background: rgba(0, 240, 255, 0.01);
}

/* Terminal streaming block cursor */
.chat-msg--assistant.streaming .chat-msg-bubble::after {
    content: '';
    display: none;
}

@keyframes chat-cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ── Terminal Console Logs ── */
.chat-run-body {
    background: rgba(0, 240, 255, 0.01);
    border: 1px solid rgba(0, 240, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    font-family: 'Fira Code', 'SF Mono', Consolas, monospace;
    font-size: 11px;
    color: rgba(0, 240, 255, 0.85);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
    margin-bottom: 12px;
    box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.03);
    transition: max-height 0.3s ease, opacity 0.2s;
}

.chat-run-body.collapsed {
    max-height: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden;
    opacity: 0;
    margin-bottom: 0 !important;
}

.chat-terminal-line {
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
    font-weight: 300;
    animation: terminal-line-in 0.2s ease-out forwards;
}

.terminal-cursor {
    display: inline-block;
    color: var(--neon-cyan, #00f0ff);
    text-shadow: 0 0 5px rgba(0, 240, 255, 0.5);
    margin-right: 4px;
}

/* Only the last console line's cursor blinks while the run is active */
.chat-run-body.running .chat-terminal-line:last-of-type .terminal-cursor {
    animation: chat-cursor-blink 1s step-end infinite;
}

.chat-terminal-line.working-on-it {
    color: rgba(0, 240, 255, 0.6);
    word-break: normal;
    white-space: normal;
}
.chat-work-bots {
    display: inline-flex;
    align-items: flex-end;
    gap: 6px;
    height: 28px;
}
.chat-work-bot {
    display: inline-flex;
    line-height: 0;
}
.chat-run-body.running .chat-work-bot {
    animation: chat-work-bob 1.1s ease-in-out infinite;
}
.chat-work-eye {
    transform-box: fill-box;
    transform-origin: center;
}
.chat-run-body.running .chat-work-eye {
    animation: chat-work-blink 4s infinite;
}
@keyframes chat-work-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@keyframes chat-work-blink {
    0%, 90%, 100% { transform: scaleY(1); }
    94% { transform: scaleY(0.12); }
}

.chat-terminal-line.reasoning {
    color: rgba(0, 240, 255, 0.7);
}

.chat-terminal-line.tool-run {
    color: rgba(0, 240, 255, 0.85);
}

.chat-terminal-line.tool-answer-header {
    color: rgba(0, 240, 255, 0.6);
    margin-top: 4px;
}

.chat-terminal-result:empty {
    display: none;
}

.chat-terminal-result {
    font-family: inherit;
    font-size: 11px;
    color: rgba(0, 240, 255, 0.6);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 240, 255, 0.05);
    border-radius: 4px;
    padding: 8px 12px;
    margin: 2px 0 6px 0;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    animation: terminal-line-in 0.25s ease-out forwards;
    transform-origin: top;
}

@keyframes terminal-line-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-terminal-result::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.chat-terminal-result::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.15);
    border-radius: 3px;
}
.chat-terminal-result::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 240, 255, 0.3);
}

/* Pulsing/Blinking Running logo avatar */
.chat-run-avatar.running {
    animation: chat-logo-blink 1.5s ease-in-out infinite;
}

.chat-msg-bubble {
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-primary, #e6e8ec);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Markdown content inside assistant messages */
.chat-msg-bubble h1, .chat-msg-bubble h2, .chat-msg-bubble h3, .chat-msg-bubble h4, .chat-msg-bubble h5, .chat-msg-bubble h6 {
    margin: 14px 0 8px 0;
    font-weight: 600;
    color: var(--text-primary, #e6e8ec);
}

.chat-msg-bubble h1 { font-size: 17px; }
.chat-msg-bubble h2 { font-size: 16px; }
.chat-msg-bubble h3 { font-size: 15px; color: var(--neon-cyan, #00f0ff); }
.chat-msg-bubble h4 { font-size: 14.5px; }
.chat-msg-bubble h5 { font-size: 14px; }
.chat-msg-bubble h6 { font-size: 13.5px; }

.chat-msg-bubble p { margin: 6px 0; }

.chat-msg-bubble ul, .chat-msg-bubble ol {
    margin: 6px 0;
    padding-left: 20px;
}

.chat-msg-bubble li { margin: 3px 0; }

.chat-msg-bubble code {
    background: rgba(0, 240, 255, 0.06);
    border: 1px solid rgba(0, 240, 255, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: var(--neon-cyan, #00f0ff);
}

.chat-msg-bubble pre {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
}

.chat-msg-bubble pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-primary, #e6e8ec);
}

.chat-msg-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 12px;
}

.chat-msg-bubble th {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
    color: var(--text-muted, #6a7080);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
}

.chat-msg-bubble td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-secondary, #9da3b0);
}

.chat-msg-bubble strong { color: var(--text-primary, #e6e8ec); }

.chat-msg-bubble a {
    color: var(--neon-cyan, #00f0ff);
    text-decoration: none;
}

.chat-msg-bubble a:hover {
    text-decoration: underline;
}

/* ── Tool Card (Collapsible — matches production Manawa) ──────────────────── */

.chat-tool-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 6px;
    color: var(--neon-cyan, #00f0ff);
    overflow: hidden;
    animation: chat-msg-in 0.3s ease;
    transition: border-color 0.2s;
}

.chat-tool-card:hover {
    border-color: rgba(0, 240, 255, 0.4);
}

.chat-tool-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.chat-tool-card-header:hover {
    background: rgba(0, 240, 255, 0.03);
}

.chat-tool-card-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-tool-card-icon svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-tool-card-name {
    font-size: 11px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.chat-tool-card-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.chat-tool-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(0, 240, 255, 0.15);
    border-top-color: var(--neon-cyan, #00f0ff);
    border-radius: 50%;
    animation: chat-spin 0.8s linear infinite;
}

@keyframes chat-spin {
    to { transform: rotate(360deg); }
}

.chat-tool-check svg {
    width: 12px;
    height: 12px;
    stroke: var(--neon-cyan, #00f0ff);
    stroke-width: 2;
    fill: none;
}

.chat-tool-chevron {
    font-size: 9px;
    color: rgba(0, 240, 255, 0.4);
    transition: transform 0.2s;
}

.chat-tool-card.expanded .chat-tool-chevron {
    transform: rotate(90deg);
}

.chat-tool-card-args {
    padding: 0 10px 6px;
    margin-top: -4px;
    font-size: 10px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: rgba(0, 240, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-tool-card-body {
    display: none;
    border-top: 1px solid rgba(0, 240, 255, 0.1);
    padding: 8px 10px;
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: none;
}

.chat-tool-card-body::-webkit-scrollbar { display: none; }

.chat-tool-card.expanded .chat-tool-card-body {
    display: block;
}

.chat-tool-card-result {
    font-size: 10px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: rgba(0, 240, 255, 0.7);
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
}

/* ── Reasoning / Thinking Block (Collapsible) ─────────────────────────────── */

.chat-reasoning-block {
    background: rgba(0, 240, 255, 0.05);
    border-left: 2px solid rgba(0, 240, 255, 0.3);
    padding: 8px 12px;
    border-radius: 0 6px 6px 0;
    color: rgba(0, 240, 255, 0.8);
    animation: chat-msg-in 0.3s ease;
    transition: all 0.3s;
}

.chat-reasoning-header {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    opacity: 0.6;
    margin-bottom: 4px;
}

.chat-reasoning-header svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.chat-reasoning-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.chat-reasoning-chevron {
    font-size: 9px;
    color: rgba(0, 240, 255, 0.4);
    transition: transform 0.2s;
    margin-left: 2px;
}

.chat-reasoning-block.expanded .chat-reasoning-chevron {
    transform: rotate(90deg);
}

.chat-reasoning-content {
    font-size: 11px;
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 60px;
    overflow: hidden;
    transition: max-height 0.3s;
}

.chat-reasoning-block.expanded .chat-reasoning-content {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: none;
}

.chat-reasoning-block.expanded .chat-reasoning-content::-webkit-scrollbar { display: none; }

/* ── Thinking Indicator ───────────────────────────────────────────────────── */

.chat-thinking {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    animation: chat-msg-in 0.3s ease;
}

.chat-thinking-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
    animation: chat-logo-blink 1.5s ease-in-out infinite;
}

.chat-thinking-logo img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    opacity: 0.9;
}

.chat-thinking-text {
    font-size: 13px;
    color: var(--neon-cyan, #00f0ff);
    font-weight: 500;
    letter-spacing: 0.02em;
}

@keyframes chat-logo-blink {
    0%, 100% {
        opacity: 0.6;
        box-shadow: 0 0 8px rgba(0, 240, 255, 0.1);
        border-color: rgba(0, 240, 255, 0.1);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
        border-color: rgba(0, 240, 255, 0.4);
    }
}

/* ── Run Header (Manawa Avatar Row) ───────────────────────────────────────── */

.chat-run-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 12px;
    animation: chat-msg-in 0.5s ease;
}

.chat-run-header-toggle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: none;
    color: rgba(0, 240, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-run-header-toggle:hover {
    border-color: rgba(0, 240, 255, 0.3);
    background: rgba(0, 240, 255, 0.1);
    color: var(--neon-cyan, #00f0ff);
}

.chat-run-header-toggle svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    transition: transform 0.2s;
}

.chat-run-header-toggle.collapsed svg {
    transform: rotate(-90deg);
}

.chat-run-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
}

.chat-run-avatar img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    opacity: 0.9;
}

.chat-run-label {
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.chat-run-label-name {
    font-weight: 500;
    color: var(--neon-cyan, #00f0ff);
    font-size: 14px;
    letter-spacing: 0.03em;
}

.chat-run-label-badge {
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(0, 240, 255, 0.3);
    font-size: 10px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: rgba(0, 240, 255, 0.7);
    background: rgba(0, 240, 255, 0.05);
}

/* Collapsible run content transitions are handled in main definition */

/* ── Run Footer (Task Completed) ──────────────────────────────────────────── */

.chat-run-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 12px 0;
    margin-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    animation: chat-msg-in 0.7s ease;
    margin-bottom: 20px;
}

.chat-run-footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-run-footer-check {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
}

.chat-run-footer-check svg {
    width: 10px;
    height: 10px;
    stroke: #ffffff;
    stroke-width: 2.5;
    fill: none;
}

.chat-run-footer-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

.chat-run-footer-meta {
    font-size: 10px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: rgba(255, 255, 255, 0.35);
    margin-left: 4px;
}

.chat-run-footer-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    justify-self: center;
}

.chat-model-notice {
    margin: 8px 0 4px;
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.62);
}

.chat-think-harder.is-on {
    color: var(--neon-cyan, #00f0ff);
    cursor: default;
}

.chat-run-footer-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}

.chat-run-footer-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.chat-run-footer-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.chat-run-footer-btn .chat-footer-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translate(-50%, -8px);
    background: var(--bg-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 9px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.chat-run-footer-btn:hover .chat-footer-tooltip {
    opacity: 1;
    transform: translate(-50%, -4px);
}

.chat-run-footer-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    justify-self: end;
}

.chat-run-footer-right .chat-rating-label {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: -0.01em;
}

.chat-run-footer-stars {
    display: flex;
    align-items: center;
    gap: 2px;
}

.chat-footer-star {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.45);
    transition: transform 0.2s, color 0.15s;
}

.chat-footer-star:hover {
    transform: scale(1.25);
    color: #fbbf24;
}

.chat-footer-star.is-filled {
    color: #fbbf24;
}

.chat-footer-star svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    transition: fill 0.2s, color 0.2s, filter 0.2s;
}

/* ── Suggested Actions (Follow-Up Pills — matches production Manawa) ──────── */

#chat-suggested-actions-container {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.chat-suggested-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 4px 0 0;
    margin-bottom: 6px;
    flex-wrap: nowrap;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    animation: fadeInUp 0.3s ease-out;
}

.chat-suggested-label {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(0, 240, 255, 0.5);
    white-space: nowrap;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.chat-suggested-actions .chat-suggested-pill {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    justify-content: flex-start;
    overflow: hidden;
    transition: flex 0.2s ease, max-width 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.chat-suggested-actions .chat-suggested-pill > span {
    display: block;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Hover opens the full suggestion and pushes the other pills down to a stub. */
@media (hover: hover) and (pointer: fine) {
    .chat-suggested-actions:has(.chat-suggested-pill:hover) .chat-suggested-pill {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        max-width: none;
    }

    .chat-suggested-actions:has(.chat-suggested-pill:hover) .chat-suggested-pill:hover {
        flex: 0 0 auto;
        width: max-content;
        min-width: 0;
        max-width: calc(100% - 12rem);
    }
}

.chat-suggested-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 157, 0.25);
    background: rgba(0, 255, 157, 0.06);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chat-suggested-pill:hover {
    background: rgba(0, 255, 157, 0.15);
    border-color: rgba(0, 255, 157, 0.5);
}

.chat-suggested-pill svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    opacity: 0.6;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Sources + Learn more (built-from vs where to open next) ─────────────── */

.chat-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    padding: 10px 0 4px;
}

.chat-source-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: none;
    border: none;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
}

.chat-source-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.chat-source-link svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

.chat-learn-more {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 6px 0 8px;
}

.chat-learn-more-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.chat-learn-more-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-secondary, var(--text-muted));
    text-decoration: none;
}

.chat-learn-more-badge:hover {
    border-color: var(--gain);
    color: var(--text-primary);
    text-decoration: none;
}

.chat-place-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 2px;
    padding: 2px 8px 2px 3px;
    border: 1px solid var(--border);
    border-radius: 999px;
    vertical-align: middle;
    font-size: 12px;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}

.chat-place-chip:hover {
    border-color: var(--gain);
    text-decoration: none;
}

.chat-place-mark {
    position: relative;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.chat-place-logo {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-hover, #f3f4f6);
}

.chat-place-tab {
    position: absolute;
    right: -3px;
    top: -3px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.chat-place-tab svg {
    width: 8px;
    height: 8px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.chat-place-tab .bot-mark {
    width: 11px;
    height: 11px;
}

.chat-place-mark--solo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-place-mark--solo .chat-place-tab {
    position: static;
    width: 16px;
    height: 16px;
}

.chat-msg-bubble .chat-place-chip {
    margin-left: 6px;
}

/* Legacy purple chips — unused after source-row restyle */
.chat-source-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
}

/* ── Legacy Suggestion Chips (kept for backward compat) ───────────────────── */

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0 0 0;
}

.chat-suggestion-chip {
    padding: 6px 12px;
    background: rgba(0, 240, 255, 0.04);
    border: 1px solid rgba(0, 240, 255, 0.1);
    border-radius: 16px;
    font-size: 12px;
    color: var(--text-secondary, #9da3b0);
    cursor: pointer;
    transition: all 0.2s;
}

.chat-suggestion-chip:hover {
    background: rgba(0, 240, 255, 0.08);
    border-color: rgba(0, 240, 255, 0.2);
    color: var(--neon-cyan, #00f0ff);
}

/* ── Message Actions ──────────────────────────────────────────────────────── */

.chat-msg-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
    padding-top: 4px;
}

.chat-msg:hover .chat-msg-actions {
    opacity: 1;
}

.chat-msg-action {
    background: none;
    border: none;
    color: var(--text-muted, #6a7080);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.12s;
    display: flex;
    align-items: center;
    gap: 3px;
}

.chat-msg-action:hover {
    color: var(--text-primary, #e6e8ec);
    background: rgba(255, 255, 255, 0.06);
}

.chat-msg-action--active {
    color: var(--neon-cyan, #00f0ff);
}

/* ── Rating Stars ─────────────────────────────────────────────────────────── */

.chat-rating {
    display: flex;
    gap: 2px;
}

.chat-rating-star {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted, #6a7080);
    font-size: 14px;
    padding: 2px;
    transition: color 0.12s, transform 0.12s;
}

.chat-rating-star:hover {
    transform: scale(1.2);
}

.chat-rating-star.filled {
    color: #fbbf24;
}

/* ── Input Bar ────────────────────────────────────────────────────────────── */

.chat-input-area {
    padding: 16px 32px 0;
    background: transparent;
    flex-shrink: 0;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.chat-input-usage {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 11px;
    color: var(--text-muted, #6a7080);
}

.chat-usage-bar {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}

.chat-usage-fill {
    height: 100%;
    background: var(--neon-cyan, #00f0ff);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.chat-usage-fill.warning { background: #fbbf24; }
.chat-usage-fill.danger { background: #b05252; }

/* ── Manawa-style 2-Row Input Box ─────────────────────────────────────────── */

.chat-input-box {
    position: relative;
    background: rgba(5, 10, 20, 0.90);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 18px;
    padding: 12px 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 4px;
}

.chat-input-box:focus-within {
    border-color: rgba(0, 240, 255, 0.5);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.1);
}

.chat-input-box:hover {
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.15);
}

/* Clear button (X) — absolute top-right */
.chat-clear-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.05);
    border: none;
    color: rgba(0, 240, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    z-index: 10;
    flex-shrink: 0;
}

.chat-clear-btn:hover {
    background: rgba(0, 240, 255, 0.1);
    color: var(--neon-cyan, #00f0ff);
}

.chat-clear-btn svg {
    width: 11px;
    height: 11px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Row 1: Textarea */
.chat-input {
    width: 100%;
    background: none;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 15px;
    font-family: var(--font-sans);
    resize: none;
    min-height: 24px;
    max-height: 120px;
    line-height: 1.5;
    font-weight: 300;
    padding-right: 28px; /* space for clear btn */
    overflow-y: auto;
    scrollbar-width: none;
}

.chat-input::-webkit-scrollbar { display: none; }

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
    opacity: 1;
}

/* Row 2: Controls */
.chat-input-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 8px;
    min-height: 40px;
}

.chat-input-left,
.chat-input-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-mic-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-mic-btn[hidden] {
    display: none;
}

.chat-mic-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-mic-btn.is-listening {
    background: #c43b3b;
    color: #ffffff;
    animation: chat-mic-pulse 1.2s ease-in-out infinite;
}

.chat-file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

/* + button (file upload) */
.chat-plus-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-plus-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.chat-plus-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Manawa mode button (logo + dot) */
.chat-mode-btn {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    overflow: hidden;
}

.chat-mode-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.chat-mode-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.chat-mode-btn:hover .chat-mode-logo {
    opacity: 1;
}

.chat-mode-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ffffff;
    border: 1.5px solid rgba(5, 10, 20, 0.9);
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}

/* Send button */
.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ffffff;
    border: none;
    color: #050a14;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.chat-send-btn:hover {
    background: #e6e8ec;
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.15);
    transform: scale(1.04);
}

.chat-send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.chat-send-btn.is-stop {
    background: #c43b3b;
    color: #ffffff;
}

.chat-send-btn.is-stop svg {
    fill: currentColor;
    stroke: none;
}

.chat-send-btn.is-stop:hover {
    background: #a83232;
}

.chat-send-btn.is-voice {
    background: #ffffff;
    color: #111111;
    border-radius: 50%;
    box-shadow: none;
}

.chat-send-btn.is-voice:hover {
    background: #f2f2f2;
    color: #111111;
}

.chat-send-btn.is-voice svg {
    fill: currentColor;
    stroke: none;
}

@keyframes chat-mic-pulse {
    50% { box-shadow: 0 0 0 6px rgba(196, 59, 59, 0.28); }
}

.chat-send-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Keyboard Shortcuts ───────────────────────────────────────────────────── */

.chat-shortcuts {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 2px 0 0;
    font-size: 10px;
    color: var(--text-muted, #6a7080);
    opacity: 0.5;
}

.chat-shortcut kbd {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 10px;
    font-family: var(--font-sans);
    color: var(--text-muted, #6a7080);
}

/* ── Delete Animation ────────────────────────────────────────────────────── */

@keyframes chat-msg-out {
    from { opacity: 1; transform: translateX(0); max-height: 300px; }
    to { opacity: 0; transform: translateX(30px); max-height: 0; padding: 0; margin: 0; overflow: hidden; }
}

/* ── Chart Container ─────────────────────────────────────────────────────── */

.chat-chart-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    overflow: hidden;
}
.chat-chart-container.fin-row-chart,
.chat-chart-container.frc-embed {
    height: auto;
    overflow: visible;
    margin: 12px 0;
    background: var(--bg-card);
}

.chat-chart-container canvas {
    width: 100% !important;
}

.chat-chart-container table {
    width: 100%;
    font-size: 11px;
    border-collapse: collapse;
}

.chat-chart-container table th,
.chat-chart-container table td {
    padding: 4px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-secondary, #9da3b0);
}

.chat-chart-container table th {
    color: var(--text-muted, #6a7080);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 10px;
}

/* ── Action Button Hover Colors ──────────────────────────────────────────── */

.chat-msg-action[data-action="delete"]:hover { color: #b05252; }
.chat-msg-action[data-action="rerun"]:hover { color: var(--neon-cyan, #00f0ff); }
.chat-msg-action[data-action="export"]:hover { color: var(--neon-violet, #a855f7); }

/* ── Attachment Preview Strip ─────────────────────────────────────────────── */

.chat-attach-preview {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0 6px;
    max-height: 180px;
    overflow-y: auto;
    scrollbar-width: none;
}

.chat-attach-preview::-webkit-scrollbar { display: none; }

.chat-attach-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 10px;
    overflow: hidden;
    animation: chat-msg-in 0.2s ease;
    transition: opacity 0.15s;
}

.chat-attach-chip.uploading { opacity: 0.6; }

.chat-attach-chip:not(.file) {
    width: 64px;
    height: 64px;
    border: 1px solid rgba(0, 240, 255, 0.15);
    background: rgba(0, 0, 0, 0.3);
}

.chat-attach-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-attach-chip.file {
    padding: 6px 10px;
    background: rgba(0, 240, 255, 0.04);
    border: 1px solid rgba(0, 240, 255, 0.1);
    max-width: 220px;
}

.chat-attach-icon { font-size: 14px; flex-shrink: 0; }

.chat-attach-name {
    font-size: 11px;
    color: var(--text-secondary, #9da3b0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.chat-attach-size {
    font-size: 10px;
    color: var(--text-muted, #6a7080);
    flex-shrink: 0;
}

.chat-attach-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted, #6a7080);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.1s, color 0.1s;
}

.chat-attach-chip:hover .chat-attach-remove { opacity: 1; }
.chat-attach-remove:hover { color: #b05252; border-color: rgba(176, 82, 82, 0.4); }

.chat-attach-error {
    width: 100%;
    font-size: 12px;
    color: #b05252;
    padding: 4px 2px 2px;
}

.chat-attach-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 240, 255, 0.15);
    border-top-color: var(--neon-cyan, #00f0ff);
    border-radius: 50%;
    animation: chat-spin 0.8s linear infinite;
}

/* ── Drag-and-Drop Zone ──────────────────────────────────────────────────── */

.chat-drop-zone {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 10, 20, 0.92);
    border: 2px dashed rgba(0, 240, 255, 0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.chat-drop-zone.active {
    opacity: 1;
    pointer-events: auto;
}

.chat-drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--neon-cyan, #00f0ff);
    font-size: 16px;
    font-weight: 500;
}

.chat-drop-zone-content svg {
    color: var(--neon-cyan, #00f0ff);
    opacity: 0.6;
}

.chat-drop-hint {
    font-size: 12px;
    color: var(--text-muted, #6a7080);
    font-weight: 400;
}

/* ── Inline Attachments (in message bubbles) ─────────────────────────────── */

.chat-inline-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 0;
}

.chat-inline-attach-img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0, 240, 255, 0.12);
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}

.chat-inline-attach-img:hover {
    border-color: rgba(0, 240, 255, 0.35);
    transform: scale(1.04);
}

.chat-inline-attach-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-inline-attach-file {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(0, 240, 255, 0.03);
    border: 1px solid rgba(0, 240, 255, 0.08);
    border-radius: 8px;
    font-size: 11px;
    color: var(--text-muted, #6a7080);
}

/* ── Attach Button SVG ───────────────────────────────────────────────────── */

.chat-attach-btn {
    background: none;
    border: none;
    color: var(--text-muted, #6a7080);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.12s, transform 0.12s;
    flex-shrink: 0;
}

.chat-attach-btn:hover {
    color: var(--neon-cyan, #00f0ff);
    transform: rotate(-15deg);
}

/* ── Search-to-Chat Indicator ─────────────────────────────────────────────── */

#chat-open-btn,
#header-terminal-btn {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid rgba(45, 212, 191, 0.45);
    background: rgba(8, 14, 24, 0.92);
    color: #5eead4;
}

html[data-theme="light"] #chat-open-btn,
html[data-theme="light"] #header-terminal-btn {
    background: var(--bg-elevated, #fff);
    border-color: #0e7490;
    color: #0e7490;
}

.search-ai-hint {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--neon-cyan, #00f0ff);
    opacity: 0.7;
    pointer-events: none;
    animation: aiHintPulse 2s ease-in-out infinite;
}

.search-ai-hint.visible {
    display: flex;
}

.search-ai-hint svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

@keyframes aiHintPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ── Header Chat Button (+) ───────────────────────────────────────────────── */

#chat-open-btn {
    position: relative;
}

html[data-agent="open"] #chat-open-btn {
    display: none !important;
}

#chat-open-btn::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.2s;
    background: radial-gradient(circle, rgba(0, 240, 255, 0.15), transparent 70%);
}

#chat-open-btn:hover::after {
    opacity: 1;
}

/* ── Starter Suggestion Cards (empty state) ───────────────────────────────── */

.chat-starter-wrap {
    display: none;
}

.chat-starter-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    align-items: start;
    width: 100%;
    max-width: 820px;
    box-sizing: border-box;
}

.chat-starter-lane {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-starter-examples {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    margin-top: -1px;
    padding: 8px 10px 12px;
    background: rgba(0, 255, 112, 0.03);
    border: 1px dashed rgba(0, 255, 112, 0.28);
    border-top: 1px dashed rgba(0, 255, 112, 0.16);
    border-radius: 0 0 16px 16px;
    box-sizing: border-box;
}

.chat-starter-examples[hidden] {
    display: none;
}

.chat-starter-examples-head {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted, #6a7080);
    padding: 2px 4px 2px;
    opacity: 0.75;
}

.chat-starter-example {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: var(--text-secondary, #9da3b0);
    font: inherit;
    font-size: 12.5px;
    line-height: 1.4;
    white-space: normal;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chat-starter-example-mark {
    flex-shrink: 0;
    color: #00ff70;
    opacity: 0.45;
    font-size: 16px;
    line-height: 1.15;
    font-style: normal;
    font-weight: 600;
}

.chat-starter-example-text {
    font-style: italic;
    font-weight: 400;
}

.chat-starter-example:hover {
    background: rgba(0, 255, 112, 0.08);
    border-color: rgba(0, 255, 112, 0.35);
    border-style: solid;
    color: var(--text-primary, #e6e8ec);
}

.chat-starter-example:hover .chat-starter-example-mark {
    opacity: 0.8;
}

.chat-starter-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 24px 20px;
    background: rgba(5, 10, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, border-radius 0.15s ease;
    color: inherit;
    width: 100%;
    box-sizing: border-box;
}

.chat-starter-card:hover {
    background: rgba(0, 255, 112, 0.04);
    border-color: rgba(0, 255, 112, 0.25);
    box-shadow: 0 0 25px rgba(0, 255, 112, 0.08);
}

.chat-starter-lane.is-open .chat-starter-card {
    background: rgba(0, 255, 112, 0.04);
    border-color: rgba(0, 255, 112, 0.25);
    border-bottom-color: transparent;
    border-radius: 16px 16px 0 0;
    box-shadow: none;
}

.starter-card-icon {
    width: 28px;
    height: 28px;
    stroke: #00ff70;
    opacity: 0.9;
    flex-shrink: 0;
    transition: transform 0.2s;
    margin-bottom: 4px;
}

.chat-starter-card:hover .starter-card-icon {
    transform: scale(1.1);
}

.starter-card-text-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.starter-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #e6e8ec);
    line-height: 1.3;
}

.starter-card-desc {
    font-size: 12px;
    color: var(--text-muted, #6a7080);
    line-height: 1.5;
    opacity: 0.7;
}

/* Mobile-specific header actions on the top right */
.chat-mobile-header-actions {
    display: none;
}

.timeline-mobile-close-btn,
.chat-rail-mobile-header {
    display: none;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .chat-main {
        margin-left: 0px !important; /* no left margin since timeline is hidden on mobile closed state */
    }

    .chat-timeline {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 110;
        width: 0px; /* hidden by default on mobile */
        min-width: 0px;
        overflow: hidden;
        border-right: none;
        box-shadow: none;
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .chat-strategies {
        display: none;
    }

    .chat-timeline.mobile-open {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        min-width: 100vw !important;
        height: 100vh !important;
        max-height: none !important;
        z-index: 10000 !important;
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        background: var(--bg-primary);
        border: none;
        box-shadow: none;
        overflow: hidden;
    }

    .timeline-collapsed-content {
        display: none !important; /* no collapsed view elements shown on mobile */
    }

    /* Force expanded content to show when timeline is open on mobile */
    .chat-timeline.mobile-open .timeline-expanded-content {
        display: flex !important;
        flex: 1;
        min-height: 0;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    .chat-timeline:hover {
        width: 0px;
        min-width: 0px;
    }
    .chat-timeline:hover .timeline-new-label { display: none; }
    .chat-timeline.mobile-open .timeline-new-label,
    .chat-timeline.mobile-open:hover .timeline-new-label { display: inline; }
    
    .chat-timeline.mobile-open:hover {
        width: 100vw !important;
        min-width: 100vw !important;
    }

    .timeline-tooltip {
        display: none !important;
    }
    
    .chat-messages {
        padding: 12px 16px;
    }
    
    .chat-input-area {
        padding: 12px 16px 0;
    }

    .chat-starter-cards {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .chat-starter-card {
        flex-direction: row;
        align-items: center;
        text-align: left;
        padding: 12px 16px;
        gap: 16px;
    }

    .starter-card-text-wrap {
        align-items: flex-start;
        text-align: left;
        gap: 2px;
    }

    .starter-card-icon {
        margin-bottom: 0;
    }

    .chat-navigator {
        display: none !important;
    }

    .chat-close-bar {
        justify-content: space-between;
    }

    /* Show mobile-specific buttons */
    .chat-mobile-header-actions {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-right: 0;
    }
    
    .chat-mobile-btn {
        background: transparent;
        border: none;
        padding: 4px;
        color: var(--text-secondary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
    }
    
    .chat-mobile-btn:disabled,
    .chat-mobile-btn:disabled:hover {
        opacity: 0.35;
        cursor: default;
        color: var(--text-secondary);
    }

    .chat-close-btn {
        margin-left: auto;
        color: var(--text-secondary);
    }
    
    .chat-mobile-btn svg {
        width: 16px;
        height: 16px;
        stroke: currentColor;
        stroke-width: 2.5;
        fill: none;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .chat-rail-mobile-header {
        display: none;
    }

    .chat-timeline.mobile-open .chat-rail-mobile-header,
    .chat-strategies.mobile-open .chat-rail-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 64px;
        padding: 0 16px 0 24px;
        border-bottom: 1px solid var(--border);
        width: 100%;
        box-sizing: border-box;
        flex-shrink: 0;
        background: var(--bg-primary);
    }

    .chat-rail-mobile-title {
        font-size: 16px;
        font-weight: 600;
        color: var(--text-primary);
    }

    .timeline-mobile-close-btn {
        display: flex;
        position: static;
        z-index: 1;
        background: transparent;
        border: none;
        color: var(--text-secondary);
        cursor: pointer;
        padding: 8px;
        border-radius: 8px;
        align-items: center;
        justify-content: center;
    }
    
    .timeline-mobile-close-btn:hover {
        color: var(--text-primary);
        filter: none;
    }
    
    .timeline-mobile-close-btn svg {
        width: 16px;
        height: 16px;
        stroke: currentColor;
        stroke-width: 2.5;
        fill: none;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .chat-shortcuts,
    .chat-main.is-empty .chat-shortcuts {
        display: none;
    }

    .chat-run-footer {
        gap: 8px 10px;
    }

    .chat-run-footer-meta {
        display: none;
    }

    .chat-run-footer-right .chat-rating-label {
        display: none;
    }

    .chat-run-footer-right {
        gap: 0;
    }

    .chat-suggested-label {
        display: none;
    }

    .chat-suggested-actions {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        padding: 8px 0 0;
        box-sizing: border-box;
    }

    .chat-suggested-actions::-webkit-scrollbar {
        display: none;
    }

    .chat-suggested-actions .chat-suggested-pill,
    .chat-suggested-actions:has(.chat-suggested-pill:hover) .chat-suggested-pill,
    .chat-suggested-actions:has(.chat-suggested-pill:hover) .chat-suggested-pill:hover,
    .chat-suggestion-chip {
        flex: 0 0 78%;
        width: 78%;
        min-width: 78%;
        max-width: 78%;
        scroll-snap-align: start;
        scroll-snap-stop: always;
        box-sizing: border-box;
    }

    .chat-learn-more-label {
        flex: 1 0 100%;
    }

    /* Agent markdown tables: stack each row so no column is off-screen. */
    .chat-msg-bubble table.chat-md-table {
        display: block;
        width: 100%;
        max-width: 100%;
        border: none;
        overflow: visible;
    }

    .chat-msg-bubble table.chat-md-table thead,
    .chat-msg-bubble table.chat-md-table tr:first-child {
        display: none;
    }

    .chat-msg-bubble table.chat-md-table tr {
        display: block;
        margin: 0 0 10px;
        border: 1px solid rgba(0, 240, 255, 0.15);
        border-radius: 8px;
        overflow: hidden;
        background: rgba(0, 240, 255, 0.02);
    }

    .chat-msg-bubble table.chat-md-table tr:nth-child(even) {
        background: rgba(0, 240, 255, 0.02);
    }

    .chat-msg-bubble table.chat-md-table td,
    .chat-msg-bubble table.chat-md-table th {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
        width: 100%;
        box-sizing: border-box;
        border-right: none;
        border-bottom: 1px solid rgba(0, 240, 255, 0.08);
        padding: 8px 12px;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .chat-msg-bubble table.chat-md-table tr td:last-child,
    .chat-msg-bubble table.chat-md-table tr th:last-child {
        border-bottom: none;
    }

    .chat-msg-bubble table.chat-md-table td::before,
    .chat-msg-bubble table.chat-md-table th::before {
        content: attr(data-label);
        flex: 0 1 40%;
        min-width: 0;
        font-weight: 600;
        font-size: 11px;
        letter-spacing: 0.02em;
        color: var(--neon-cyan, #00f0ff);
        text-align: left;
    }
}

@media (max-width: 480px) {
    .chat-messages {
        padding: 10px 12px;
    }
    
    .chat-input-area {
        padding: 10px 12px;
    }
}

/* ── Header Chat Title ────────────────────────────────────────────────────── */

.header-chat-title {
    display: none;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.chat-title-brand {
    font-size: 18px;
    font-weight: 600;
    color: var(--neon-cyan, #00f0ff);
    letter-spacing: -0.01em;
}

.chat-title-version {
    font-size: 11px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: var(--neon-cyan, #00f0ff);
    border: 1px solid rgba(0, 240, 255, 0.25);
    padding: 2px 6px;
    border-radius: 6px;
    opacity: 0.8;
}

/* ── Floating Message Navigator (Right side scroll indicator) ── */

.chat-main {
    position: relative; /* ensure absolute positioning works for children */
}

.chat-navigator {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* right-align the chevrons and items */
    width: 240px;
    max-height: calc(100% - 120px); /* stay inside chat-main; do not cover close / composer */
    overflow: hidden;
    gap: 10px; /* default gap between arrows and lines track */
    z-index: 90;
    pointer-events: none;
    transition: gap 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-nav-arrow {
    pointer-events: auto;
    width: 30px; /* reduced by 25% from 40px */
    height: 16px; /* compact height to be directly next to first/last */
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(0, 240, 255, 0.4);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-nav-arrow:hover {
    color: #00f0ff;
    filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.8));
}

.chat-nav-arrow.disabled {
    opacity: 0.15;
    pointer-events: none;
}

.chat-nav-lines {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* right-align the wrapper column */
    gap: 0px; /* no gap between items, making the entire vertical track hoverable */
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    pointer-events: auto;
    transition: gap 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-nav-lines::-webkit-scrollbar { display: none; }

.chat-nav-item {
    pointer-events: auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    padding: 5px 0; /* default padding 5px top/bottom (10px visual space between lines) */
    cursor: pointer;
    position: relative;
    transition: padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-nav-line-wrapper {
    width: 30px; /* reduced by 25% from 40px */
    display: flex;
    justify-content: flex-start; /* both user and assistant start from the same left-most point */
    flex-shrink: 0;
}

.chat-nav-line {
    height: 1.5px; /* reduced thickness by 25% from 2px */
    background: rgba(0, 240, 255, 0.25);
    border-radius: 1px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left center; /* scale from the left start point */
}

.chat-nav-line.user {
    width: 15px; /* User query: 15px (reduced by 25% from 20px) */
}

.chat-nav-line.assistant {
    width: 30px; /* Assistant answer: 30px (reduced by 25% from 40px) */
}

.chat-nav-item:hover .chat-nav-line,
.chat-nav-item.active .chat-nav-line {
    background: #00f0ff;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.8);
    height: 2.25px; /* reduced hover thickness by 25% from 3px */
}

/* Inline tooltip text next to the line (no bubble container) */
.chat-nav-label {
    position: absolute;
    right: 42px; /* positioned left of the 30px line wrapper + gap/margin */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    opacity: 0;
    transform: translateX(8px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    text-align: right;
    white-space: nowrap;
}

.chat-nav-item:hover .chat-nav-label {
    opacity: 1;
    transform: translateX(0);
}

.chat-nav-label-author {
    font-weight: 700;
    color: #00f0ff;
    margin-bottom: 2px;
    text-transform: uppercase;
    font-size: 11px; /* increased name to 11px */
    letter-spacing: 0.05em;
    line-height: 1;
}

.chat-nav-label-text {
    color: rgba(255, 255, 255, 0.7);
    max-width: 165px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px; /* increased text to 13px */
    line-height: 1.2;
}

/* ── Light theme: chat overlay ────────────────────────────────────────────── */
html[data-theme="light"] .chat-timeline {
    --tl-accent: #0e7490;
    --tl-accent-rgb: 14, 116, 144;
    --tl-border: #d5dbe3;
    --tl-bg: #eef1f4;
    --tl-node: #0e7490;
    --tl-node-active: #0e7490;
    --tl-line: #cbd5e1;
    --tl-text: #374151;
    --tl-text-dim: #4b5563;
    --tl-text-bright: #111827;
    --tl-separator: #d5dbe3;
    background: #ffffff;
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 24px rgba(15, 23, 42, 0.08);
}

.chat-strategies {
    width: 64px;
    min-width: 64px;
    height: 100%;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
    box-sizing: border-box;
    background: var(--bg-primary);
    --tl-line: rgba(0, 240, 255, 0.85);
}
.chat-strategies::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 31.5px;
    width: 1px;
    background: var(--tl-line);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.7);
    pointer-events: none;
}
html[data-theme="light"] .chat-strategies {
    background: #ffffff;
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 24px rgba(15, 23, 42, 0.08);
    --tl-line: #cbd5e1;
}
html[data-theme="light"] .chat-strategies::before {
    box-shadow: none;
}
#chat-overlay.is-docked .chat-strategies,
#chat-overlay.is-hosting .chat-strategies {
    display: none !important;
}
@media (max-width: 768px) {
    .chat-strategies {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 110;
        width: 0;
        min-width: 0;
        overflow: hidden;
        display: block;
        border: none;
        box-shadow: none;
    }
    html[data-theme="light"] .chat-strategies {
        border-left: none;
        box-shadow: none;
    }
    .chat-strategies::before {
        display: none;
    }
    .chat-strategies.mobile-open {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        min-width: 100vw !important;
        height: 100vh !important;
        z-index: 10000 !important;
        display: flex !important;
        flex-direction: column;
        background: var(--bg-primary);
        border: none;
        box-shadow: none;
        overflow: hidden;
    }
}
html[data-theme="light"] .timeline-collapsed-content {
    opacity: 1;
}
html[data-theme="light"] .timeline-collapsed-nodes::before {
    background: var(--tl-line);
    box-shadow: none;
}
html[data-theme="light"] .timeline-search-icon-collapsed,
html[data-theme="light"] .timeline-node,
html[data-theme="light"] .date-separator-collapsed {
    background: #ffffff;
}
html[data-theme="light"] .timeline-node {
    border-color: #0e7490;
}
html[data-theme="light"] .timeline-session-name,
html[data-theme="light"] .timeline-date-separator-text {
    color: var(--tl-text-bright);
}
html[data-theme="light"] .timeline-session-time {
    color: #4b5563;
}
html[data-theme="light"] .chat-title-brand {
    color: #111827;
}
html[data-theme="light"] .chat-title-version {
    color: #111827;
    border-color: #94a3b8;
    background: #e5e7eb;
    opacity: 1;
    font-weight: 600;
}
html[data-theme="light"] .chat-empty-logo-wrap {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}
html[data-theme="light"] .chat-empty-logo {
    filter: brightness(0) saturate(100%) invert(22%) sepia(28%) saturate(1600%) hue-rotate(165deg) brightness(0.95);
    width: 96px;
    height: 96px;
}
html[data-theme="light"] .chat-empty-logo-glow {
    display: none;
}
html[data-theme="light"] .chat-msg-copy-btn {
    color: #6b7280;
    border-color: transparent;
    background: transparent;
    opacity: 1;
    box-shadow: none;
}
html[data-theme="light"] .chat-msg--user:hover .chat-msg-copy-btn,
html[data-theme="light"] .chat-msg-copy-btn:hover {
    opacity: 1;
    color: #111827;
    border-color: #d5dbe3;
    background: transparent;
}
html[data-theme="light"] .chat-msg-timestamp {
    color: #374151;
    font-size: 11px;
}
html[data-theme="light"] .chat-msg-copied-feedback {
    color: #047857;
}
html[data-theme="light"] .chat-navigator {
    background: var(--bg-primary);
    border: none;
    border-radius: 0;
    padding: 10px 8px;
    width: 48px;
    box-shadow: none;
}
html[data-theme="light"] .chat-navigator:hover {
    width: 240px;
    background: var(--bg-primary);
}
html[data-theme="light"] .chat-nav-arrow {
    color: #374151;
    background: transparent;
    border: none;
    border-radius: 6px;
}
html[data-theme="light"] .chat-nav-arrow:hover {
    color: #0e7490;
    filter: none;
    background: transparent;
}
html[data-theme="light"] .chat-nav-line {
    background: #64748b;
}
html[data-theme="light"] .chat-nav-label {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}
html[data-theme="light"] .chat-nav-label-text {
    color: #1f2937;
}
html[data-theme="light"] .chat-thinking-logo,
html[data-theme="light"] .chat-run-avatar {
    background: #0e7490;
    border-color: #0e7490;
    box-shadow: none;
}
html[data-theme="light"] .chat-thinking-logo img,
html[data-theme="light"] .chat-run-avatar img {
    filter: brightness(0) invert(1);
    opacity: 1;
}
html[data-theme="light"] .chat-run-header-toggle {
    color: #6b7280;
}
html[data-theme="light"] .chat-run-header-toggle:hover {
    color: #111827;
    background: #e8ecf0;
    border-color: #d5dbe3;
}
html[data-theme="light"] .chat-run-label-name {
    color: #111827;
}
html[data-theme="light"] .chat-run-label-badge {
    color: #374151;
    border-color: #d5dbe3;
    background: #eef1f4;
}
html[data-theme="light"] .chat-close-btn {
    color: #374151;
}
html[data-theme="light"] .chat-close-btn:hover {
    color: #111827;
    background: #e8ecf0;
}
html[data-theme="light"] .chat-mobile-btn,
html[data-theme="light"] .timeline-mobile-close-btn {
    color: #374151;
    filter: none;
}
html[data-theme="light"] .chat-mobile-btn:hover,
html[data-theme="light"] .timeline-mobile-close-btn:hover {
    color: #111827;
    filter: none;
}
html[data-theme="light"] #chat-open-btn {
    color: #374151;
    background: transparent;
}
html[data-theme="light"] .chat-empty-heading {
    color: var(--text-primary);
    text-shadow: 0 2px 16px rgba(255, 255, 255, 0.96);
}
html[data-theme="light"] .chat-float-bubble {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(14, 116, 144, 0.35);
    color: var(--text-primary);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}
html[data-theme="light"] .chat-float-bubble:hover {
    background: #ffffff;
    border-color: #0e7490;
    color: #0e7490;
}
html[data-theme="light"] .chat-float-bubble:hover .chat-float-move.gain { color: var(--gain); }
html[data-theme="light"] .chat-float-bubble:hover .chat-float-move.loss { color: var(--loss); }
html[data-theme="light"] .chat-empty-heading-accent {
    color: #0e7490;
}
html[data-theme="light"] .chat-input-box {
    background: var(--bg-elevated);
    border-color: var(--border);
    box-shadow: var(--glow-md);
}
html[data-theme="light"] .chat-input-box:focus-within {
    border-color: var(--border-active);
    box-shadow: var(--glow-md);
}
html[data-theme="light"] .chat-input {
    color: var(--text-primary);
}
html[data-theme="light"] .chat-input::placeholder {
    color: var(--text-muted);
}
html[data-theme="light"] .chat-input-controls {
    border-top-color: var(--border);
}
html[data-theme="light"] .chat-attach-chip:not(.file) {
    background: #e8ecf0;
    border-color: #d5dbe3;
}
html[data-theme="light"] .chat-attach-chip.file {
    background: #e8ecf0;
    border-color: #d5dbe3;
}
html[data-theme="light"] .chat-attach-name {
    color: #111827;
}
html[data-theme="light"] .chat-attach-error {
    color: #b05252;
}
html[data-theme="light"] .chat-plus-btn,
html[data-theme="light"] .chat-mode-btn {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text-secondary);
}
html[data-theme="light"] .chat-plus-btn:hover,
html[data-theme="light"] .chat-mode-btn:hover {
    background: var(--bg-input);
    border-color: var(--border-active);
    box-shadow: none;
    color: var(--text-primary);
}
html[data-theme="light"] .chat-clear-btn {
    background: var(--bg-hover);
    color: var(--text-muted);
}
html[data-theme="light"] .chat-send-btn {
    background: var(--neon-cyan);
    color: #ffffff;
    box-shadow: none;
}
html[data-theme="light"] .chat-send-btn:hover {
    background: #0c5f75;
    box-shadow: none;
}
html[data-theme="light"] .chat-mic-btn {
    color: #5c6370;
}
html[data-theme="light"] .chat-mic-btn.is-listening {
    background: #c43b3b;
    color: #ffffff;
}
html[data-theme="light"] .chat-send-btn.is-stop,
html[data-theme="light"] .chat-send-btn.is-stop:hover {
    background: #c43b3b;
    color: #ffffff;
}
html[data-theme="light"] .chat-send-btn.is-voice,
html[data-theme="light"] .chat-send-btn.is-voice:hover {
    background: #111111;
    color: #ffffff;
    box-shadow: none;
}
html[data-theme="light"] .chat-usage-bar {
    background: var(--bg-input);
}
html[data-theme="light"] .chat-shortcuts {
    color: var(--text-muted);
    opacity: 1;
}
html[data-theme="light"] .chat-shortcut kbd {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text-secondary);
}
html[data-theme="light"] .chat-starter-card {
    background: var(--bg-elevated);
    border-color: var(--border);
}
html[data-theme="light"] .chat-starter-card:hover,
html[data-theme="light"] .chat-starter-lane.is-open .chat-starter-card {
    background: var(--bg-hover);
    border-color: var(--border-active);
    box-shadow: none;
}
html[data-theme="light"] .chat-starter-examples {
    background: var(--bg-hover);
    border-color: var(--border-active);
    border-style: dashed;
}
html[data-theme="light"] .chat-starter-examples-head {
    color: var(--text-muted);
}
html[data-theme="light"] .chat-starter-example {
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border-color: var(--border);
}
html[data-theme="light"] .chat-starter-example-mark {
    color: #047857;
}
html[data-theme="light"] .chat-starter-example:hover {
    background: var(--bg-input);
    border-color: var(--border-active);
    color: var(--text-primary);
}
html[data-theme="light"] .starter-card-icon {
    stroke: #047857;
}
html[data-theme="light"] .starter-card-title {
    color: var(--text-primary);
}
html[data-theme="light"] .starter-card-desc {
    color: var(--text-muted);
    opacity: 1;
}
html[data-theme="light"] .chat-starter-chip {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text-secondary);
}
html[data-theme="light"] .chat-starter-chip:hover {
    background: var(--bg-input);
    border-color: var(--border-active);
    color: var(--text-primary);
}
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble,
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble p,
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble strong,
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble h1,
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble h2,
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble h3,
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble h4,
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble h5,
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble h6,
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble ul,
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble ol,
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble li,
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble a {
    color: var(--text-primary);
}
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble li::marker {
    color: var(--text-muted);
}
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble code {
    color: var(--text-primary);
    background: var(--bg-hover);
    border-color: var(--border);
}
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble td {
    color: var(--text-secondary);
}
html[data-theme="light"] .chat-msg--assistant .chat-msg-bubble th {
    color: var(--neon-cyan);
    text-shadow: none;
}
html[data-theme="light"] .chat-msg-bubble table.chat-md-table tr {
    border-color: var(--border);
    background: var(--bg-hover);
}
html[data-theme="light"] .chat-msg-bubble table.chat-md-table td,
html[data-theme="light"] .chat-msg-bubble table.chat-md-table th {
    border-bottom-color: var(--border);
}
html[data-theme="light"] .chat-msg-bubble table.chat-md-table td::before,
html[data-theme="light"] .chat-msg-bubble table.chat-md-table th::before {
    color: var(--neon-cyan);
}
html[data-theme="light"] .chat-msg--user .chat-msg-bubble {
    color: #111827;
    background: #ffffff;
    border-color: #d5dbe3;
    box-shadow: none;
}
html[data-theme="light"] .chat-msg-collapse,
html[data-theme="light"] .chat-msg-collapse:hover {
    color: #374151;
}
html[data-theme="light"] .chat-suggested-label {
    color: var(--neon-cyan);
}
html[data-theme="light"] .chat-suggested-pill {
    color: var(--text-primary);
    background: rgba(4, 120, 87, 0.08);
    border-color: rgba(4, 120, 87, 0.22);
}
html[data-theme="light"] .chat-model-notice {
    color: #4b5563;
}
html[data-theme="light"] .chat-think-harder.is-on {
    color: #0e7490;
}
html[data-theme="light"] .chat-run-footer-text,
html[data-theme="light"] .chat-run-footer-btn {
    color: #4b5563;
}
html[data-theme="light"] .chat-run-footer-right .chat-rating-label {
    color: #374151;
}
html[data-theme="light"] .chat-run-footer-meta {
    color: #4b5563;
}
html[data-theme="light"] .chat-footer-star {
    color: #4b5563;
}
html[data-theme="light"] .chat-footer-star:hover,
html[data-theme="light"] .chat-footer-star.is-filled {
    color: #d97706;
}
html[data-theme="light"] .chat-run-footer-btn:hover {
    color: var(--text-primary);
}
html[data-theme="light"] .chat-run-footer-check {
    background: var(--bg-hover);
    border-color: var(--border);
    box-shadow: none;
}
html[data-theme="light"] .chat-run-footer-check svg {
    stroke: var(--text-primary);
}
html[data-theme="light"] .chat-chart-container {
    background: var(--bg-chart);
    border-color: var(--border);
}
html[data-theme="light"] .chat-chart-container.fin-row-chart {
    background: var(--bg-card);
}
html[data-theme="light"] .chat-chart-container table th,
html[data-theme="light"] .chat-chart-container table td {
    border-bottom-color: var(--border);
    color: var(--text-secondary);
}
html[data-theme="light"] .chat-nav-label-author {
    color: #0e7490;
}
html[data-theme="light"] .chat-nav-label-text {
    color: #1f2937;
}
html[data-theme="light"] .chat-nav-item:hover .chat-nav-line,
html[data-theme="light"] .chat-nav-item.active .chat-nav-line {
    background: var(--neon-cyan);
    box-shadow: none;
}
html[data-theme="light"] .chat-run-body {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
    box-shadow: none;
}
html[data-theme="light"] .chat-terminal-line.working-on-it,
html[data-theme="light"] .chat-terminal-line.tool-answer-header {
    color: var(--text-secondary);
}
html[data-theme="light"] .chat-terminal-line.reasoning,
html[data-theme="light"] .chat-terminal-line.tool-run {
    color: var(--text-primary);
}
html[data-theme="light"] .terminal-cursor {
    color: var(--neon-cyan);
    text-shadow: none;
}
html[data-theme="light"] .chat-terminal-result {
    background: var(--bg-input);
    border-color: var(--border);
    color: var(--text-primary);
}
html[data-theme="light"] .chat-terminal-result::-webkit-scrollbar-thumb {
    background: #94a3b8;
}
html[data-theme="light"] .chat-tool-card {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}
html[data-theme="light"] .chat-tool-card:hover {
    border-color: var(--border-active);
}
html[data-theme="light"] .chat-tool-card-header:hover {
    background: var(--bg-hover);
}
html[data-theme="light"] .chat-tool-card-result,
html[data-theme="light"] .chat-tool-card-args {
    color: var(--text-primary);
    background: var(--bg-input);
}

/* Empty full agent: sliding index tape along the bottom. */
#chat-index-tape {
    display: none;
    position: absolute;
    left: 64px;
    right: 0;
    bottom: 0;
    z-index: 6;
    padding: 18px 0 12px;
    background: linear-gradient(to bottom, transparent, var(--bg-primary) 16px);
    pointer-events: none;
}

#chat-overlay.active:not(.is-docked):not(.is-hosting):has(.chat-main.is-empty) #chat-index-tape.is-ready {
    display: block;
}

#chat-overlay.active:not(.is-docked):not(.is-hosting):has(#chat-index-tape.is-ready) .chat-main.is-empty .chat-input-area {
    padding-bottom: 128px;
}

.chat-tape-wrap {
    overflow: hidden;
    pointer-events: auto;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 4%, #000 100%);
    mask-image: linear-gradient(to right, transparent 0%, #000 4%, #000 100%);
}

.chat-tape-track {
    display: flex;
    width: max-content;
    animation: chat-tape-scroll linear infinite;
}

.chat-tape-wrap:hover .chat-tape-track {
    animation-play-state: paused;
}

.chat-tape-track.is-still {
    animation: none;
}

@keyframes chat-tape-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.chat-tape-card {
    display: grid;
    grid-template-areas:
        "name pct"
        "price delta"
        "spark spark";
    grid-template-columns: 1fr auto;
    gap: 2px 8px;
    align-items: baseline;
    width: 210px;
    margin-right: 10px;
    flex-shrink: 0;
    padding: 10px 12px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-sans);
    text-align: left;
    cursor: pointer;
}

.chat-tape-card:hover {
    border-color: rgba(0, 240, 255, 0.2);
}

.chat-tape-name {
    grid-area: name;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-tape-fut {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    font-family: var(--font-mono, monospace);
    letter-spacing: 0.04em;
    line-height: 1.4;
    vertical-align: middle;
    background: rgba(251, 191, 36, 0.12);
    color: #f59e0b;
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.chat-tape-pct {
    grid-area: pct;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.chat-tape-price {
    grid-area: price;
    font-size: 13px;
    font-weight: 300;
}

.chat-tape-delta {
    grid-area: delta;
    font-size: 13px;
    font-weight: 400;
    white-space: nowrap;
}

.chat-tape-spark {
    grid-area: spark;
    align-self: end;
    width: 100%;
    height: 28px;
    margin-top: 2px;
}

.chat-tape-spark svg {
    width: 100%;
    height: 28px;
}

@media (prefers-reduced-motion: reduce) {
    .chat-tape-track { animation: none; }
    .chat-tape-wrap { overflow-x: auto; }
    .chat-work-bot, .chat-work-eye { animation: none; }
}

@media (max-width: 768px) {
    #chat-index-tape {
        left: 0;
        right: 0;
    }
}
