/* ===========================================================================
   AI Chat (/chat) — Genie-style conversational analytics
   Dark theme, glassy bubbles, gradient AI accents (accent3 = #a06bff).
   Companion page to assets/chat.css references in src/pages/chat.py.
   =========================================================================== */

.chat-page {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    /* Fill the viewport below the app header so the input bar can sit at the
       bottom while the message list scrolls independently. */
    height: calc(100vh - 96px);
    min-height: 540px;
    padding: 0 16px 8px;
    box-sizing: border-box;
}

/* --------------------------------------------------------------------------- */
/* Header                                                                       */
/* --------------------------------------------------------------------------- */
.chat-header {
    flex: 0 0 auto;
    padding: 18px 4px 14px;
    border-bottom: 1px solid var(--border-color, #232830);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chat-header-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.05rem;
    color: #fff;
    background: linear-gradient(135deg, rgba(var(--accent3-rgb), 1) 0%, rgba(var(--accent-rgb), 1) 100%);
    box-shadow: 0 6px 18px rgba(var(--accent3-rgb), 0.35);
    flex: 0 0 auto;
}

.chat-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary, #e8eaed);
}

.chat-subtitle {
    margin: 2px 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary, #9ba1ad);
}

/* --------------------------------------------------------------------------- */
/* Roster upload control                                                         */
/* --------------------------------------------------------------------------- */
.chat-roster {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex: 0 1 auto;
    min-width: 0;
}

.chat-roster-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chat-roster-help {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.chat-roster-help-toggle {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.72rem;
    color: var(--text-secondary, #9ba1ad);
    text-decoration: underline;
    cursor: pointer;
}

.chat-roster-help-toggle:hover {
    color: var(--accent3-color, #a06bff);
}

.chat-roster-help-text {
    font-size: 0.72rem;
    color: var(--text-secondary, #9ba1ad);
    max-width: 320px;
    text-align: right;
    line-height: 1.4;
}

.chat-roster-upload {
    cursor: pointer;
    user-select: none;
}

.chat-roster-upload > span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent3-color, #a06bff);
    border: 1px solid rgba(var(--accent3-rgb), 0.45);
    background: rgba(var(--accent3-rgb), 0.10);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.chat-roster-upload:hover > span {
    background: rgba(var(--accent3-rgb), 0.18);
    border-color: rgba(var(--accent3-rgb), 0.7);
}

/* Inline roster-upload prompt rendered inside an assistant message */
.chat-artifact--roster-prompt {
    margin-top: 10px;
}

.chat-roster-upload--inline {
    display: inline-block;
}

.chat-roster-status {
    font-size: 0.8rem;
    color: var(--text-secondary, #9ba1ad);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.chat-roster-status:empty {
    display: none;
}

.chat-roster-clear {
    display: none;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #232830);
    background: transparent;
    color: var(--text-secondary, #9ba1ad);
    cursor: pointer;
    font-size: 0.8rem;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.chat-roster-clear:hover {
    color: var(--danger-color, #e15759);
    border-color: rgba(var(--danger-rgb, 225, 87, 89), 0.6);
}

.chat-roster:has(.chat-roster-status:not(:empty)) .chat-roster-clear {
    display: inline-flex;
}

@media (max-width: 640px) {
    .chat-roster-status { max-width: 160px; }
}

/* --------------------------------------------------------------------------- */
/* Message list                                                                 */
/* --------------------------------------------------------------------------- */
.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 18px 4px 8px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--text-secondary-rgb), 0.35) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(var(--text-secondary-rgb), 0.30);
    border-radius: 8px;
}

.chat-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    animation: chat-fade-in 0.25s ease both;
}

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

.chat-row--assistant {
    justify-content: flex-start;
}

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

/* AI avatar */
.chat-avatar {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #fff;
    margin-top: 2px;
    background: linear-gradient(135deg, rgba(var(--accent3-rgb), 1) 0%, rgba(var(--accent-rgb), 1) 100%);
    box-shadow: 0 4px 12px rgba(var(--accent3-rgb), 0.30);
}

/* Bubbles */
.chat-bubble {
    border-radius: 16px;
    padding: 12px 16px;
    font-size: 0.95rem;
    line-height: 1.55;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.chat-bubble--user {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.95) 0%, rgba(var(--accent3-rgb), 0.92) 100%);
    color: #fff;
    border-bottom-right-radius: 6px;
    max-width: 78%;
    box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.25);
}

.chat-bubble--assistant {
    background: rgba(var(--card-bg-rgb), 0.92);
    border: 1px solid var(--border-color, #232830);
    color: var(--text-primary, #e8eaed);
    border-bottom-left-radius: 6px;
    /* Assistant answers can carry wide tables/charts. */
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 46px);
}

/* Markdown content inside assistant bubble */
.chat-markdown p {
    margin: 0 0 10px;
}

.chat-markdown p:last-child {
    margin-bottom: 0;
}

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

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

.chat-markdown strong {
    color: #fff;
    font-weight: 600;
}

.chat-markdown a {
    color: var(--accent2-color, #22d3ee);
    text-decoration: none;
}

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

.chat-markdown code {
    background: rgba(var(--text-secondary-rgb), 0.18);
    padding: 1px 5px;
    border-radius: 5px;
    font-size: 0.85em;
}

/* Typing indicator */
.chat-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 2px;
}

.chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent3-color, #a06bff);
    opacity: 0.45;
    animation: chat-typing-bounce 1.2s infinite ease-in-out;
}

.chat-typing span:nth-child(2) { animation-delay: 0.18s; }
.chat-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes chat-typing-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
    40%           { transform: translateY(-5px); opacity: 1; }
}

/* Thinking indicator (staged, intent-aware "what the agent is doing") */
.chat-bubble--thinking {
    padding: 11px 15px;
}

.chat-thinking {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 210px;
}

.chat-thinking-orb {
    position: relative;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.72rem;
    background: linear-gradient(135deg, rgba(var(--accent3-rgb), 1) 0%, rgba(var(--accent-rgb), 1) 100%);
    animation: chat-thinking-pulse 1.8s infinite ease-in-out;
}

/* Rotating gradient ring around the orb */
.chat-thinking-orb::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
        rgba(var(--accent3-rgb), 0) 0deg,
        rgba(var(--accent3-rgb), 0.9) 140deg,
        rgba(var(--accent-rgb), 0.95) 230deg,
        rgba(var(--accent3-rgb), 0) 360deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
    animation: chat-thinking-spin 1.1s linear infinite;
}

.chat-thinking-orb i {
    position: relative;
    z-index: 1;
}

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

@keyframes chat-thinking-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent3-rgb), 0.40); }
    50%      { box-shadow: 0 0 0 7px rgba(var(--accent3-rgb), 0); }
}

.chat-thinking-body {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    flex: 1 1 auto;
}

/* Stacked stage labels — exactly one fades in at a time, on a loop */
.chat-thinking-stages {
    position: relative;
    height: 1.2rem;
    min-width: 150px;
}

.chat-thinking-stage {
    position: absolute;
    left: 0;
    top: 0;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    background: linear-gradient(90deg,
        rgba(var(--text-secondary-rgb), 0.85) 0%,
        var(--text-primary, #e8eaed) 45%,
        rgba(var(--text-secondary-rgb), 0.85) 90%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
    animation:
        chat-thinking-cycle 8s infinite both,
        chat-thinking-shimmer 2.4s linear infinite;
}

@keyframes chat-thinking-cycle {
    0%   { opacity: 0; transform: translateY(5px); }
    3%   { opacity: 1; transform: translateY(0); }
    22%  { opacity: 1; transform: translateY(0); }
    25%  { opacity: 0; transform: translateY(-5px); }
    100% { opacity: 0; transform: translateY(-5px); }
}

@keyframes chat-thinking-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Indeterminate progress shimmer */
.chat-thinking-bar {
    position: relative;
    height: 3px;
    width: 100%;
    max-width: 220px;
    border-radius: 999px;
    background: rgba(var(--text-secondary-rgb), 0.16);
    overflow: hidden;
}

.chat-thinking-bar-fill {
    position: absolute;
    top: 0;
    left: -40%;
    height: 100%;
    width: 40%;
    border-radius: 999px;
    background: linear-gradient(90deg,
        rgba(var(--accent-rgb), 0.15) 0%,
        rgba(var(--accent3-rgb), 1) 50%,
        rgba(var(--accent-rgb), 0.15) 100%);
    animation: chat-thinking-slide 1.5s infinite ease-in-out;
}

@keyframes chat-thinking-slide {
    0%   { left: -40%; }
    100% { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .chat-thinking-orb,
    .chat-thinking-orb::before,
    .chat-thinking-bar-fill {
        animation: none;
    }
    .chat-thinking-bar-fill { left: 0; width: 100%; opacity: 0.7; }
    .chat-thinking-stage { animation: none; }
    .chat-thinking-stage:first-child { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------- */
/* Artifacts (tables / charts / query panel)                                    */
/* --------------------------------------------------------------------------- */
.chat-artifact {
    margin-top: 14px;
    background: rgba(var(--card-bg-rgb), 0.55);
    border: 1px solid var(--border-color, #232830);
    border-radius: 12px;
    padding: 12px;
    overflow: hidden;
}

.chat-artifact:first-child {
    margin-top: 0;
}

.chat-artifact-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, #e8eaed);
    margin-bottom: 10px;
    padding-left: 2px;
}

.chat-figure {
    width: 100%;
}

/* Ag-Grid sizing inside chat */
.chat-grid {
    width: 100%;
    --ag-font-size: 13px;
    --ag-grid-size: 5px;
    --ag-row-height: 36px;
    --ag-header-height: 38px;
}

/* Full Explorer grid reused inside chat: allow horizontal scroll for the
   broad column set rather than squeezing every column to fit. */
.chat-explorer-grid {
    min-height: 360px;
}

/* Vertically center cell values. Heat-shaded numeric columns (e.g. Avg Pctl
   Score) otherwise render bottom-aligned and clipped because they rely on
   AG Grid's line-height centering, which breaks under the mobile transform
   zoom-out. Flex centering is robust regardless of row height / scale.
   Preserve each column's horizontal alignment. */
.chat-explorer-grid .ag-cell {
    display: flex;
    align-items: center;
}

.chat-explorer-grid .ag-cell.ag-right-aligned-cell {
    justify-content: flex-end;
}

.chat-artifact-empty {
    padding: 12px 14px;
    color: var(--text-secondary, #9ba1ad);
    font-size: 0.85rem;
}

/* Query-used disclosure */
.chat-query-panel {
    margin-top: 10px;
    font-size: 0.82rem;
}

.chat-query-panel > summary {
    cursor: pointer;
    color: var(--text-secondary, #9ba1ad);
    list-style: none;
    user-select: none;
    padding: 4px 2px;
    transition: color 0.15s ease;
}

.chat-query-panel > summary:hover {
    color: var(--accent3-color, #a06bff);
}

.chat-query-panel > summary::-webkit-details-marker {
    display: none;
}

.chat-q-body {
    margin-top: 8px;
    padding: 10px 12px;
    background: rgba(var(--dark-bg-rgb, 11, 13, 17), 0.5);
    border: 1px solid var(--border-color, #232830);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-q-row {
    display: flex;
    gap: 6px;
}

.chat-q-key {
    color: var(--text-secondary, #9ba1ad);
    min-width: 84px;
}

.chat-q-val {
    color: var(--text-primary, #e8eaed);
    font-weight: 500;
}

/* Backend / offline note */
.chat-backend-note {
    margin-top: 12px;
    font-size: 0.78rem;
    color: var(--text-secondary, #9ba1ad);
    display: flex;
    align-items: center;
    opacity: 0.85;
}

/* Deep-link action chips */
.chat-artifact--links {
    background: transparent;
    border: none;
    padding: 4px 0 0;
}

.chat-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-link-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary, #e8eaed);
    text-decoration: none;
    background: rgba(var(--card-bg-rgb), 0.9);
    border: 1px solid var(--border-color, #232830);
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.chat-link-chip:hover {
    transform: translateY(-1px);
    text-decoration: none;
    border-color: rgba(var(--accent-rgb), 0.7);
    background: rgba(var(--accent-rgb), 0.12);
}

.chat-link-chip-icon {
    font-size: 0.8rem;
    color: var(--accent-color, #6b8aff);
}

/* Distinct accents per destination */
.chat-link-chip--profile .chat-link-chip-icon { color: var(--accent2-color, #22d3ee); }
.chat-link-chip--profile:hover {
    border-color: rgba(var(--accent2-rgb), 0.7);
    background: rgba(var(--accent2-rgb), 0.12);
}
.chat-link-chip--trends .chat-link-chip-icon { color: var(--accent3-color, #a06bff); }
.chat-link-chip--trends:hover {
    border-color: rgba(var(--accent3-rgb), 0.7);
    background: rgba(var(--accent3-rgb), 0.12);
}
.chat-link-chip--explorer .chat-link-chip-icon { color: var(--accent-color, #6b8aff); }

/* --------------------------------------------------------------------------- */
/* Grid interaction hint (under chat Explorer grids)                            */
/* --------------------------------------------------------------------------- */
.chat-grid-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-secondary, #9ba1ad);
    background: rgba(var(--accent3-rgb), 0.07);
    border: 1px solid rgba(var(--accent3-rgb), 0.22);
}

.chat-grid-hint-icon {
    margin-top: 2px;
    font-size: 0.82rem;
    color: var(--accent3-color, #a06bff);
    flex: 0 0 auto;
}

.chat-grid-hint-emoji {
    font-style: normal;
}

/* --------------------------------------------------------------------------- */
/* Dynamic follow-up suggestion chips                                           */
/* --------------------------------------------------------------------------- */
.chat-followups {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(var(--text-secondary-rgb, 155, 161, 173), 0.14);
}

.chat-followups-label {
    display: flex;
    align-items: center;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary, #9ba1ad);
    margin-bottom: 9px;
    opacity: 0.85;
}

.chat-followups-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-followup-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.83rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    color: var(--text-primary, #e8eaed);
    background: rgba(var(--card-bg-rgb), 0.9);
    border: 1px solid var(--border-color, #232830);
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.chat-followup-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(var(--accent-rgb), 0.7);
    background: rgba(var(--accent-rgb), 0.12);
}

.chat-followup-chip-text {
    line-height: 1.3;
}

.chat-followup-chip-icon {
    font-size: 0.72rem;
    opacity: 0.55;
    color: var(--accent-color, #6b8aff);
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.chat-followup-chip:hover .chat-followup-chip-icon {
    opacity: 1;
    transform: translateX(2px);
}

/* --------------------------------------------------------------------------- */
/* Empty state                                                                  */
/* --------------------------------------------------------------------------- */
.chat-empty {
    margin: auto;
    text-align: center;
    max-width: 620px;
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chat-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    margin-bottom: 18px;
    background: linear-gradient(135deg, rgba(var(--accent3-rgb), 1) 0%, rgba(var(--accent-rgb), 1) 100%);
    box-shadow: 0 10px 30px rgba(var(--accent3-rgb), 0.35);
}

.chat-empty-title {
    margin: 0 0 8px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary, #e8eaed);
}

.chat-empty-sub {
    margin: 0 0 22px;
    font-size: 0.95rem;
    color: var(--text-secondary, #9ba1ad);
    line-height: 1.5;
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.chat-suggestion-chip {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 0.875rem;
    color: var(--text-primary, #e8eaed);
    text-decoration: none;
    background: rgba(var(--card-bg-rgb), 0.85);
    border: 1px solid var(--border-color, #232830);
    transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.chat-suggestion-chip:hover {
    border-color: rgba(var(--accent3-rgb), 0.7);
    background: rgba(var(--accent3-rgb), 0.12);
    transform: translateY(-2px);
    text-decoration: none;
}

/* --------------------------------------------------------------------------- */
/* Input bar                                                                    */
/* --------------------------------------------------------------------------- */
.chat-input-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px 8px 8px 18px;
    border-radius: 16px;
    background: rgba(var(--card-bg-rgb), 0.92);
    border: 1px solid var(--border-color, #232830);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chat-input-bar:focus-within {
    border-color: rgba(var(--accent3-rgb), 0.65);
    box-shadow: 0 0 0 3px rgba(var(--accent3-rgb), 0.18), 0 6px 22px rgba(0, 0, 0, 0.35);
}

.chat-input {
    flex: 1 1 auto;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary, #e8eaed);
    font-size: 0.98rem;
    padding: 10px 0;
    min-width: 0;
}

.chat-input::placeholder {
    color: var(--text-secondary, #9ba1ad);
}

.chat-send-btn {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    color: #fff;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(var(--accent3-rgb), 1) 0%, rgba(var(--accent-rgb), 1) 100%);
    box-shadow: 0 4px 14px rgba(var(--accent3-rgb), 0.35);
    transition: transform 0.12s ease, filter 0.12s ease;
}

.chat-send-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.chat-send-btn:active {
    transform: translateY(0);
}

.chat-disclaimer {
    flex: 0 0 auto;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-secondary, #9ba1ad);
    opacity: 0.7;
    padding: 8px 0 2px;
}

/* --------------------------------------------------------------------------- */
/* Homepage "The Guru" minimal ask widget                                       */
/* --------------------------------------------------------------------------- */
.guru-hero {
    position: relative;
    border-radius: 18px;
    padding: 30px 28px;
    border: 1px solid rgba(var(--accent3-rgb), 0.16);
    background:
        radial-gradient(120% 160% at 50% -30%, rgba(var(--accent3-rgb), 0.07) 0%, transparent 60%),
        rgba(var(--card-bg-rgb), 0.45);
}

.guru-hero-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.guru-hero-title {
    margin: 0 0 16px;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--text-primary, #e8eaed);
}

.guru-hero-name {
    background: linear-gradient(90deg, rgba(var(--accent3-rgb), 1) 0%, rgba(var(--accent2-rgb), 1) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--accent3-color, #a06bff);
}

/* Ask input — transparent shell with a soft gradient border */
.guru-hero-ask {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 640px;
    padding: 9px 9px 9px 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    background:
        linear-gradient(rgba(var(--dark-bg-2-rgb, 14, 17, 23), 0.55),
                        rgba(var(--dark-bg-2-rgb, 14, 17, 23), 0.55)) padding-box,
        linear-gradient(95deg,
                        rgba(var(--accent3-rgb), 0.50) 0%,
                        rgba(var(--accent2-rgb), 0.40) 50%,
                        rgba(var(--accent-rgb), 0.50) 100%) border-box;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22);
    transition: box-shadow 0.18s ease;
}

.guru-hero-ask:focus-within {
    box-shadow: 0 0 0 3px rgba(var(--accent3-rgb), 0.16),
                0 8px 26px rgba(0, 0, 0, 0.28);
}

.guru-hero-ask-icon {
    color: var(--text-secondary, #9ba1ad);
    font-size: 0.95rem;
    flex: 0 0 auto;
}

.guru-hero-input {
    flex: 1 1 auto;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary, #e8eaed);
    font-size: 0.98rem;
    padding: 11px 2px;
    min-width: 0;
}

.guru-hero-input::placeholder {
    color: var(--text-secondary, #9ba1ad);
    opacity: 0.85;
}

/* Circular send button inside the field */
.guru-hero-go-btn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 11px;
    border: none;
    cursor: pointer;
    color: #fff;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(var(--accent3-rgb), 1) 0%, rgba(var(--accent-rgb), 1) 100%);
    box-shadow: 0 4px 14px rgba(var(--accent3-rgb), 0.40);
    transition: transform 0.12s ease, filter 0.12s ease;
}

.guru-hero-go-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

/* Row holding the ask pill (the roster-upload control sits on its own row below) */
.guru-hero-ask-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

/* Roster upload control — sits centered below the ask input */
.guru-hero-roster {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
    margin-top: 12px;
}

/* Match the height/feel of the ask pill's send button area */
.guru-hero-roster-upload > span {
    padding: 10px 16px;
    font-size: 0.84rem;
    border-radius: 12px;
}

/* Status + helper line shown beneath the ask row */
.guru-hero-roster-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 14px;
    margin-top: 10px;
    width: 100%;
}

.guru-hero-roster-status {
    max-width: 420px;
}

.guru-hero-roster-meta .chat-roster-help-text {
    flex-basis: 100%;
    text-align: center;
    max-width: 520px;
    margin: 0 auto;
}

/* Reveal the clear button once a roster status is present */
.guru-hero-roster:has(~ .guru-hero-roster-meta .chat-roster-status:not(:empty)) .chat-roster-clear {
    display: inline-flex;
}

/* Quick-start sample question chips under the hero input */
.guru-hero-samples {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
    width: 100%;
}

.guru-hero-sample {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.82rem;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    color: var(--text-secondary, #9ba1ad);
    border: 1px solid rgba(var(--accent3-rgb), 0.22);
    background: rgba(var(--dark-bg-2-rgb, 14, 17, 23), 0.45);
    transition: color 0.16s ease, border-color 0.16s ease,
                background 0.16s ease, transform 0.12s ease;
}

.guru-hero-sample:hover {
    color: var(--text-primary, #e8eaed);
    border-color: rgba(var(--accent3-rgb), 0.5);
    background: rgba(var(--accent3-rgb), 0.12);
    transform: translateY(-1px);
}

/* --------------------------------------------------------------------------- */
/* Responsive                                                                   */
/* --------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .chat-page {
        height: calc(100vh - 72px);
        padding: 0 10px 6px;
    }

    .chat-bubble--user {
        max-width: 88%;
    }

    .chat-bubble--assistant {
        max-width: calc(100% - 44px);
    }

    .chat-title {
        font-size: 1.15rem;
    }

    .guru-hero {
        padding: 24px 16px;
    }

    .guru-hero-title {
        font-size: 1.3rem;
    }

    /* Stack the ask pill and roster-upload control on small screens. */
    .guru-hero-roster {
        justify-content: center;
        width: 100%;
    }

    .guru-hero-roster-upload {
        flex: 1 1 auto;
    }

    .guru-hero-roster-upload > span {
        justify-content: center;
        width: 100%;
    }

    /* Hide the quick-start sample questions on small screens. */
    .guru-hero-samples {
        display: none;
    }

    /* Tighten artifact chrome so charts/tables get more usable width. */
    .chat-artifact {
        padding: 8px;
        border-radius: 10px;
    }

    .chat-artifact-title {
        font-size: 0.82rem;
        margin-bottom: 6px;
    }

    /* Compact the data grid and let it scroll horizontally instead of
       squeezing every metric column to an unreadable width. */
    .chat-grid {
        --ag-font-size: 11px;
        --ag-grid-size: 4px;
        --ag-row-height: 30px;
        --ag-header-height: 32px;
    }

    /* Reused full Player Explorer grid: phones can't fit the broad column set
       at full size (you can barely see one column past the pinned name). Mirror
       the Player Explorer page's mobile "zoom-out": keep the container at its
       normal box, but scale the AG Grid internals down so several columns fit
       at once. The grid keeps its own (scaled) horizontal scroll. */
    .chat-explorer-grid {
        overflow: hidden;
    }

    .chat-explorer-grid .ag-root-wrapper {
        transform: scale(0.55);
        transform-origin: top left;
        width: calc(100% / 0.55);
        height: calc(100% / 0.55);
    }

    .chat-explorer-grid.ag-theme-alpine-dark .ag-header-cell {
        font-size: 0.66rem;
    }

    .chat-explorer-grid.ag-theme-alpine-dark .ag-cell {
        font-size: 0.78rem;
    }

    /* Smaller headshot + tighter spacing in the player-name cell. */
    .chat-explorer-grid .pe-player-name-link + img,
    .chat-explorer-grid img.w-6.h-6 {
        width: 20px !important;
        height: 20px !important;
        margin-right: 6px !important;
    }

    /* Drop the page-size selector — no room for it on a phone. */
    .chat-explorer-grid .ag-paging-panel .ag-paging-page-size {
        display: none;
    }

    /* Plotly is re-laid-out clientside for phones; keep the container fluid. */
    .chat-figure,
    .chat-figure .js-plotly-plot,
    .chat-figure .plot-container {
        width: 100% !important;
    }
}
