﻿/* =============================================================================
   RDDSquare — Main Styles
   ============================================================================= */

/* ── Design tokens ──────────────────────────────────────────────────────────── */

:root {
    --rdd-navy: #0d2240;
    --rdd-blue: #0d5ea6;
    --rdd-blue-light: #4da6ff;
    --rdd-accent: #f0a500;
    --rdd-bg: #f4f6f9;
    --rdd-surface: #ffffff;
    --rdd-border: #dde3ee;
    --rdd-text: #111827;
    --rdd-text-muted: #5a6a80;
    --rdd-user-bg: #0d5ea6;
    --rdd-user-text: #ffffff;
    --rdd-assistant-bg: #f0f4fb;
    --rdd-radius: 12px;
    --rdd-radius-sm: 6px;
    --rdd-nav-h: 52px;
    --rdd-panel-w: 50vw; /* default side panel width — half the screen */
}

.dark-theme {
    --rdd-bg: #070f1c;
    --rdd-surface: #0f1e30;
    --rdd-border: #1e3050;
    --rdd-text: #e2eaf4;
    --rdd-text-muted: #7a94b0;
    --rdd-user-bg: #1a4a8a;
    --rdd-user-text: #ddeeff;
    --rdd-assistant-bg: #111e2e;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--rdd-bg);
    color: var(--rdd-text);
    overflow: hidden;
}

/* ── Top nav ────────────────────────────────────────────────────────────────── */

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--rdd-nav-h);
    background: var(--rdd-navy);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.top-nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-nav-title {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
}

.top-nav-sub {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.55);
    line-height: 1.2;
}

.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.75);
    font-size: 0.8rem;
    white-space: nowrap;
}

.nav-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

    .nav-icon-btn:hover {
        background: rgba(255,255,255,0.16);
        color: #ffffff;
    }

    .nav-icon-btn.active {
        background: rgba(77,166,255,0.2);
        border-color: rgba(77,166,255,0.5);
        color: #4da6ff;
    }

/* ── App body — chat + side panel ───────────────────────────────────────────── */

.app-body {
    display: flex;
    /* Nav offset via PADDING, never margin: a margin-top here collapses
       through body (first in-flow child, no border/padding to block it),
       shifting the whole page down by the nav height inside the
       overflow-hidden html — which clips the input bar by exactly 52px.
       box-sizing is declared explicitly so the padding stays inside the
       height even if the universal reset is absent (stale cached CSS).
       dvh tracks browser-chrome resizing; vh is the older-engine
       fallback. */
    box-sizing: border-box;
    height: 100vh;
    height: 100dvh;
    padding-top: var(--rdd-nav-h);
    overflow: hidden;
}

/* ── Chat wrapper ───────────────────────────────────────────────────────────── */

.chat-wrapper {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

/* ── Welcome (empty state) ──────────────────────────────────────────────────
   Shown in the chat area until the first question; c.js adds .collapsed on
   send and removes it on "New chat". The example chips keep .quick-prompt,
   which c.js wires to sendMessage(data-prompt). */

.welcome {
    max-width: 1100px;
    margin: 4px auto 8px;
    padding: 8px 4px 4px;
}

    .welcome.collapsed {
        display: none;
    }

.welcome-title {
    margin: 0 0 6px;
    font-size: 1.45rem;
    font-weight: 650;
    color: var(--rdd-text);
}

/* W28-CL59. One line under the title, so the cards and their buttons fit above the question box. */
.welcome-sub {
    margin: 0 0 12px;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--rdd-text-muted);
}

/* W28-CL59. At most three cards a row, fewer when the chat column is narrow (side panel open, small window):
   the grid is sized by its own width, not the window's, and by no count of cards. */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, max(220px, (100% - 20px) / 3)), 1fr));
    gap: 10px;
}

.tool-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px;
    background: var(--rdd-surface);
    border: 1px solid var(--rdd-border);
    border-radius: var(--rdd-radius);
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .tool-card:hover {
        border-color: var(--rdd-blue-light);
        box-shadow: 0 2px 10px rgba(13, 34, 64, 0.08);
    }

.tool-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .tool-card-head calcite-icon {
        color: var(--rdd-blue);
        flex-shrink: 0;
    }

    .tool-card-head h3 {
        margin: 0;
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--rdd-text);
    }

.tool-card p {
    margin: 0;
    font-size: 0.83rem;
    line-height: 1.45;
    color: var(--rdd-text-muted);
    flex: 1 1 auto;
    /* W28-CL59. At most two lines: the buttons stay in view. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tool-card-asks {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.quick-prompt {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--rdd-border);
    background: var(--rdd-bg);
    color: var(--rdd-blue);
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
}

    .quick-prompt:hover {
        border-color: var(--rdd-blue-light);
        background: rgba(77, 166, 255, 0.12);
    }

.welcome-foot {
    margin: 10px 0 0;
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--rdd-text-muted);
}

    .welcome-foot a {
        color: var(--rdd-blue);
    }

.dark-theme .tool-card-head calcite-icon,
.dark-theme .quick-prompt,
.dark-theme .welcome-foot a {
    color: var(--rdd-blue-light);
}

/* ── Chat panel ─────────────────────────────────────────────────────────────── */

.chat-panel {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

#chatOutput {
    flex: 1 1 0;
    overflow-y: auto;
    padding: 16px 24px 8px;
    scroll-behavior: smooth;
    min-height: 0;
}

.chat-log-inner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /*    max-width: 860px;*/
    margin: 0 auto;
}

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

.msg-row {
    display: flex;
    margin: 6px 0;
}

    .msg-row.user {
        justify-content: flex-end;
    }

.msg {
    max-width: 72%;
    padding: 10px 16px;
    border-radius: var(--rdd-radius);
    font-size: 0.94rem;
    line-height: 1.55;
    word-break: break-word;
}

    .msg.user {
        background: var(--rdd-user-bg);
        color: var(--rdd-user-text);
        border-bottom-right-radius: 4px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    .msg.assistant {
        background: var(--rdd-surface);
        color: var(--rdd-text);
        border: 1px solid var(--rdd-border);
        border-bottom-left-radius: 4px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
        max-width: 100%;
        width: 100%;
    }

        .msg.assistant p {
            margin: 0 0 8px;
            white-space: normal;
        }

.assistant-body {
    width: 100%;
}

/* ── Assistant blocks ───────────────────────────────────────────────────────── */

.assistant-block {
    border-radius: var(--rdd-radius-sm);
    padding: 10px 14px;
    margin: 8px 0;
    font-size: 0.91rem;
    line-height: 1.55;
}

.summary-block {
    background: #eef5ff;
    border-left: 3px solid var(--rdd-blue);
}

.bottomline-block {
    background: #edfaf4;
    border-left: 3px solid #16a34a;
}

.dark-theme .summary-block {
    background: #0d1f38;
    border-left-color: var(--rdd-blue-light);
}

.dark-theme .bottomline-block {
    background: #0a2018;
    border-left-color: #4ade80;
}

.assistant-block-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.6;
    margin-bottom: 6px;
}

.assistant-block-body p {
    margin: 0 0 8px;
}

.assistant-block-body ul {
    margin: 4px 0 8px 18px;
    padding: 0;
    list-style: disc;
}

.assistant-block-body li {
    margin: 3px 0;
    line-height: 1.45;
}

/* ── Sources ────────────────────────────────────────────────────────────────── */

.sources-block {
    margin: 8px 0 4px;
    font-size: 0.82rem;
    color: var(--rdd-text-muted);
    border-top: 1px solid var(--rdd-border);
    padding-top: 8px;
}

.sources-title {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.sources-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.source-item {
    margin-bottom: 3px;
}

.source-header {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 2px 0;
}

    .source-header:hover {
        color: var(--rdd-blue);
    }

.source-toggle {
    font-size: 9px;
    opacity: 0.5;
    width: 12px;
    flex-shrink: 0;
}

.source-details {
    padding: 4px 0 4px 17px;
    font-size: 0.8rem;
    color: var(--rdd-text-muted);
}

/* ── Feedback (thumbs up/down + comment) ────────────────────────────────────── */

.feedback {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--rdd-border);
    font-size: 0.82rem;
    color: var(--rdd-text-muted);
}

.feedback-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.feedback-prompt {
    font-size: 0.78rem;
    margin-right: 2px;
}

.feedback-btn {
    cursor: pointer;
    border: 1px solid var(--rdd-border);
    background: var(--rdd-surface);
    color: var(--rdd-text);
    border-radius: var(--rdd-radius-sm);
    padding: 2px 8px;
    line-height: 1.2;
    font-size: 0.95rem;
    transition: border-color 0.15s, background 0.15s, transform 0.05s;
}

    .feedback-btn:hover:not(:disabled) {
        border-color: var(--rdd-blue);
    }

    .feedback-btn:active:not(:disabled) {
        transform: translateY(1px);
    }

    .feedback-btn.selected {
        border-color: var(--rdd-blue);
        background: var(--rdd-blue);
        color: #fff;
    }

    .feedback-btn:disabled {
        cursor: default;
        opacity: 0.7;
    }

.feedback-confirm {
    display: none;
    color: var(--rdd-blue);
    font-weight: 600;
    font-size: 0.8rem;
}

.dark-theme .feedback-confirm {
    color: var(--rdd-blue-light);
}

.feedback.submitted .feedback-confirm {
    display: inline;
}

/* ── Follow-up suggestion chips ─────────────────────────────────────────────── */
/* Built from theme variables so .dark-theme (which overrides those variables)
   restyles them automatically. Kinds — ask (default), refine, clarify — differ
   only by accent so backgrounds stay theme-driven. Mirrors .feedback-btn's
   border/hover/active/disabled conventions. */

.followups {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

    .followups.chosen {
        opacity: 0.6;
    }

.followup-chip {
    cursor: pointer;
    border: 1px solid var(--rdd-border);
    background: var(--rdd-assistant-bg);
    color: var(--rdd-text);
    border-radius: 16px;
    padding: 6px 12px;
    line-height: 1.2;
    font-size: 0.82rem;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s, transform 0.05s;
}

    .followup-chip:hover:not(:disabled) {
        border-color: var(--rdd-blue);
    }

    .followup-chip:active:not(:disabled) {
        transform: translateY(1px);
    }

    .followup-chip:disabled {
        cursor: default;
        opacity: 0.55;
    }

    /* Accents — border/text only; background stays theme-driven. */
    .followup-chip.followup-refine {
        border-color: var(--rdd-blue);
        color: var(--rdd-blue);
    }

    .followup-chip.followup-clarify {
        border-color: var(--rdd-accent);
    }

.dark-theme .followup-chip.followup-refine {
    color: var(--rdd-blue-light);
}

.feedback-comment {
    margin-top: 8px;
}

.feedback-text {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 40px;
    color: var(--rdd-text);
    background: var(--rdd-surface);
    border: 1px solid var(--rdd-border);
    border-radius: var(--rdd-radius-sm);
    padding: 6px 8px;
    font: inherit;
    font-size: 0.85rem;
}

    .feedback-text:focus {
        outline: none;
        border-color: var(--rdd-blue);
    }

    .feedback-text:disabled {
        opacity: 0.7;
    }

.feedback-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.feedback-send {
    cursor: pointer;
    border: none;
    background: var(--rdd-blue);
    color: #fff;
    border-radius: var(--rdd-radius-sm);
    padding: 4px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    transition: opacity 0.15s;
}

    .feedback-send:hover:not(:disabled) {
        opacity: 0.9;
    }

    .feedback-send:disabled {
        cursor: default;
        opacity: 0.55;
    }

.feedback-status {
    font-size: 0.78rem;
    color: var(--rdd-text-muted);
}

    .feedback-status.feedback-error {
        color: #c0392b;
    }

.dark-theme .feedback-status.feedback-error {
    color: #ff8a80;
}

/* ── Typing indicator ───────────────────────────────────────────────────────── */

.typing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 24px;
    font-size: 0.82rem;
    color: var(--rdd-text-muted);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

    .typing-dots span {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--rdd-blue);
        animation: rdd-bounce 1.2s infinite;
        opacity: 0.6;
    }

        .typing-dots span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-dots span:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes rdd-bounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    40% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* ── Progress spinner ───────────────────────────────────────────────────────── */

.assistant-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 0.84rem;
    color: var(--rdd-text-muted);
}

    .assistant-progress::before {
        content: "";
        width: 14px;
        height: 14px;
        border: 2px solid var(--rdd-blue);
        border-top-color: transparent;
        border-radius: 50%;
        animation: rdd-spin 0.8s linear infinite;
        flex-shrink: 0;
    }

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

/* ── Input bar ──────────────────────────────────────────────────────────────── */

.input-bar {
    padding: 12px 20px 16px;
    border-top: 1px solid var(--rdd-border);
    background: var(--rdd-surface);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
    flex-shrink: 0;
}

.dark-theme .input-bar {
    box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
}

/* Resizable multi-line input */
.input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.rdd-textarea {
    flex: 1 1 auto;
    resize: vertical; /* user drag handle (vertical only) */
    min-height: 100px; /* w28w: room for a long question (was 46px, one line) */
    max-height: 260px;
    height: 100px;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--rdd-text);
    background: var(--rdd-surface);
    border: 1px solid var(--rdd-border);
    border-radius: var(--rdd-radius);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

    .rdd-textarea::placeholder {
        color: var(--rdd-text-muted);
    }

    .rdd-textarea:focus {
        border-color: var(--rdd-blue-light);
    }

    .rdd-textarea:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

.rdd-send-btn {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: var(--rdd-blue);
    border: none;
    border-radius: var(--rdd-radius);
    cursor: pointer;
    transition: background 0.15s ease;
}

    .rdd-send-btn:hover {
        background: var(--rdd-blue-light);
    }

    .rdd-send-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* ── Side panel ─────────────────────────────────────────────────────────────── */

.side-panel {
    position: relative;
    width: var(--rdd-panel-w);
    min-width: 300px;
    max-width: 70vw;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--rdd-border);
    background: var(--rdd-surface);
    transition: width 0.25s ease, opacity 0.25s ease;
    overflow: hidden;
    flex-shrink: 0;
}

    .side-panel.collapsed {
        width: 0;
        min-width: 0;
        border-left: none;
        opacity: 0;
        pointer-events: none;
    }

/* Left drag handle — resize panel width */
.side-panel-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.15s;
}

    .side-panel-handle:hover,
    .side-panel-handle.dragging {
        background: var(--rdd-blue-light);
        opacity: 0.5;
    }

/* ── Panel sections — map and chart stacked vertically ───────────────────────── */

.panel-section {
    display: flex;
    flex-direction: column;
    flex: 1 1 50%;
    min-height: 80px;
    overflow: hidden;
}

    .panel-section.section-collapsed .panel-map-container,
    .panel-section.section-collapsed .panel-chart-container {
        display: none;
    }

    .panel-section.section-collapsed .panel-section-header {
        border-bottom: none;
    }

.panel-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px 6px 14px;
    background: #f8f9fb;
    border-bottom: 1px solid var(--rdd-border);
    flex-shrink: 0;
    min-height: 36px;
}

.dark-theme .panel-section-header {
    background: #111e2e;
    border-color: var(--rdd-border);
}

.panel-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--rdd-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-section-status {
    font-size: 0.72rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--rdd-text-muted);
    opacity: 0.8;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel-section-actions {
    display: flex;
    gap: 4px;
}

.panel-section-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--rdd-text-muted);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

    .panel-section-btn:hover {
        background: var(--rdd-border);
        color: var(--rdd-text);
    }

    /* w28z25: a toggle that is on (the feature table shown); one with nothing to act on. */
    .panel-section-btn.active {
        background: var(--rdd-blue);
        color: #ffffff;
    }

    .panel-section-btn:disabled {
        opacity: 0.35;
        cursor: default;
        background: transparent;
    }

/* Horizontal divider — drag to resize map vs chart height */
.panel-divider {
    height: 5px;
    flex-shrink: 0;
    background: var(--rdd-border);
    cursor: row-resize;
    transition: background 0.15s;
}

    .panel-divider:hover,
    .panel-divider.dragging {
        background: var(--rdd-blue-light);
    }

/* ── Highlighted values in answers ─────────────────────────────────────
   <strong class="answer-value"> wraps dollar amounts and percentages,
   emitted by appendHighlighted() in c.js. font-weight 600 rather than the
   default 700: the answers are dense with figures, and full bold turns a
   fee breakdown into a wall of black. Slightly heavier + slightly darker
   reads as emphasis without shouting. */
.assistant-body strong.answer-value,
.assistant-block-body strong.answer-value {
    font-weight: 600;
    color: var(--answer-value-color, #0b4f79);
}

html.dark strong.answer-value,
body.dark strong.answer-value {
    --answer-value-color: #7cc0e8;
}

/* w28b (from P4). Ids in an answer linked to the map: hover = highlight on the map,
   click = select (zoom, popup); a feature hovered on the map marks its id here. */
.msg.assistant .map-link { cursor: pointer; border-bottom: 1px dotted currentColor; }
.msg.assistant .map-link:hover,
.msg.assistant .map-link.hot { font-weight: 700; }
.msg.assistant .map-link.hot { background: rgba(0, 255, 255, .25); border-radius: 2px; border-bottom-style: solid; }
.msg.assistant li.map-hot { background: rgba(0, 255, 255, .12); box-shadow: inset 3px 0 0 #00a7b5; }
.msg.assistant .select-miss { color: #8a5a00; font-size: .92em; margin-top: .5em; }

/* w28d. What else the map can do: one line under the chips. */
.msg.assistant .map-options { margin-top: .4em; font-size: .9em; color: #4b5563; line-height: 1.6; }
.msg.assistant .map-options-kind { font-weight: 600; }
.msg.assistant .map-options-layer { font-weight: 700; }
.msg.assistant .map-option { color: inherit; text-decoration: underline dotted; cursor: pointer; }
.msg.assistant .map-option:hover { color: #00a7b5; }
/* W28-CL65. One group per kind: "Label by: [Choose… (n)]"; groups wrap whole. */
.msg.assistant .map-options-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.msg.assistant .map-options-row .map-options-layer { flex-basis: 100%; }   /* a layer's heading on its own line, above its groups */
.msg.assistant .map-options-line { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.msg.assistant .map-option-list { font: inherit; font-size: .95em; color: var(--rdd-text, inherit); background: var(--rdd-surface, #fff);
    border: 1px solid var(--rdd-border); border-radius: 6px; padding: 2px 6px; max-width: 18em; cursor: pointer; }
.msg.assistant .map-option-list:focus-visible { outline: 2px solid #00a7b5; outline-offset: 1px; }
.dark-theme .msg.assistant .map-option-list { color-scheme: dark; }
/* w28f. Map chips at full strength (they read as disabled when dashed and grey). */
.followup-chip.followup-map, .followup-chip.followup-map-change, .followup-chip.followup-map-data, .followup-chip.followup-chart-change { border-color: var(--rdd-blue); color: var(--rdd-blue); }
.dark-theme .followup-chip.followup-map, .dark-theme .followup-chip.followup-map-change, .dark-theme .followup-chip.followup-map-data { color: var(--rdd-blue-light); }

/* w28f. One order for every answer: answer + Read as, map/chart link, On this map,
   follow-ups, sources and data (folded), Was this helpful? */
.msg.assistant .answer-slot:empty { display: none; }
.msg.assistant .read-as { margin: .5em 0 0; font-size: .85rem; color: var(--rdd-text-muted); }
.msg.assistant .read-as-label { font-weight: 600; }
.msg.assistant .slot-visual { margin-top: .6em; }
.msg.assistant .onmap-box { margin-top: .7em; padding: .5em .75em .6em; border: 1px solid var(--rdd-border); border-radius: 8px; }
.msg.assistant .onmap-title { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--rdd-text-muted); }
.msg.assistant .onmap-box .followups { margin-top: .4em; }
.msg.assistant .onmap-box .map-options { color: var(--rdd-text-muted); }
.msg.assistant .answer-more { margin-top: .7em; font-size: .85rem; }
.msg.assistant .answer-more > summary { cursor: pointer; color: var(--rdd-text-muted); font-weight: 600; }
.msg.assistant .answer-more > .sources-block { border-top: 0; padding-top: 4px; }
.msg.assistant .slot-feedback { margin-top: .6em; }

/* ── W28-CL85/CL86/CL90. The row of choices under the latest answer: one row of chips; a chip opens its choices ── */
.tb-inline { margin: 10px 0 2px; font-size: 13px; }
.tb-inline[hidden] { display: none; }
.tb-intro { margin: 0 0 6px; font-size: 13px; color: var(--rdd-text-muted); }
.tb-labels { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; }
.tb-labels-head { font-weight: 600; color: var(--rdd-text-muted); }
.tb-labels-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tb-labels-kind { margin-right: 2px; color: var(--rdd-text-muted); }
.tb-mini {
    min-height: 28px; padding: 0 9px; border: 1px solid var(--rdd-border); border-radius: 6px;
    background: var(--rdd-surface); color: var(--rdd-text); font: inherit; cursor: pointer;
}
.tb-mini:hover { border-color: var(--rdd-blue); background: var(--rdd-assistant-bg); }
.tb-mini:focus-visible { outline: 2px solid var(--rdd-blue-light); outline-offset: 1px; }
.tb-mini.is-current { border-color: var(--rdd-blue); background: var(--rdd-assistant-bg); color: var(--rdd-blue); font-weight: 600; }
.dark-theme .tb-mini.is-current { color: var(--rdd-blue-light); }
.tb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tb-chip {
    display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px;
    border: 1px solid var(--rdd-border); border-radius: 999px; background: var(--rdd-surface);
    color: var(--rdd-text); font: inherit; cursor: pointer;
}
.tb-chip:hover, .tb-chip[aria-expanded="true"] { border-color: var(--rdd-blue); background: var(--rdd-assistant-bg); }
.tb-chip:focus-visible, .tb-pop-item:focus-visible { outline: 2px solid var(--rdd-blue-light); outline-offset: 1px; }
.tb-chip-value { color: var(--rdd-text-muted); }
.tb-chip-value:empty { display: none; }
.tb-mark { color: #9a4a06; }
.dark-theme .tb-mark { color: #f0b46a; }
.tb-caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--rdd-text-muted); }
.tb-pop {
    position: fixed; z-index: 1000; min-width: 200px; max-width: 320px; overflow: auto; font-size: 13px;
    padding: 6px; background: var(--rdd-surface); border: 1px solid var(--rdd-border); border-radius: 10px;
    box-shadow: 0 10px 28px rgba(13, 34, 64, .18);
}
.tb-pop-head { padding: 8px 8px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--rdd-text-muted); }
.tb-pop-group { padding: 6px 8px 2px; font-size: 12px; color: var(--rdd-text-muted); }
.tb-pop-list { display: flex; flex-direction: column; }
.tb-pop-row { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 4px 4px; }
.tb-pop-item {
    min-height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent;
    color: var(--rdd-text); font: inherit; text-align: left; cursor: pointer;
}
.tb-pop-row .tb-pop-item { border: 1px solid var(--rdd-border); }
.tb-pop-item:hover { background: var(--rdd-assistant-bg); }
.tb-pop-item.is-current { background: var(--rdd-assistant-bg); color: var(--rdd-blue); font-weight: 600; }
.dark-theme .tb-pop-item.is-current { color: var(--rdd-blue-light); }

/* A look change picked on a toolbar: no question bubble, its answer one short line. */
.msg-row.quiet-turn .msg.assistant { background: transparent; border: 0; box-shadow: none; padding: 2px 4px; font-size: 13px; color: var(--rdd-text-muted); }
.msg-row.quiet-turn .slot-followups, .msg-row.quiet-turn .slot-more, .msg-row.quiet-turn .slot-feedback, .msg-row.quiet-turn .read-as { display: none; }

/* W28-CL95. A restyle's full answer: what changed, on top of the answer it restyles. */
.restyle-note { margin: 0 0 8px; padding: 6px 10px; border-left: 3px solid var(--rdd-blue); background: var(--rdd-assistant-bg); border-radius: 0 6px 6px 0; }
.restyle-note p { margin: 0; }

/* W28-CL96. A pick applied in place: the rows wait while it is applied; then a short status in the row. */
.tb-inline.tb-busy { opacity: .6; pointer-events: none; }
.tb-status { margin: 0 0 6px; font-size: 13px; color: var(--rdd-blue); transition: opacity .5s; }
.dark-theme .tb-status { color: var(--rdd-blue-light); }
.tb-status.tb-status-gone { opacity: 0; }
