/* Hyze shared features — styles for hyze-features.js (desktop + mobile). */

:root {
    --hz-surface: #18181b;
    --hz-surface-2: #222226;
    --hz-surface-3: #2c2c31;
    --hz-line: rgba(255, 255, 255, 0.10);
    --hz-text: #f4f4f5;
    --hz-muted: #a1a1aa;
    --hz-accent: #4dabf7;
    --hz-danger: #f87171;
    --hz-radius: 14px;
    --hz-code-bg: #0f0f12;
    --hz-code-head: #1a1a1f;
}

.light-mode {
    --hz-surface: #ffffff;
    --hz-surface-2: #f4f4f5;
    --hz-surface-3: #e9e9ec;
    --hz-line: rgba(0, 0, 0, 0.10);
    --hz-text: #18181b;
    --hz-muted: #52525b;
    --hz-accent: #1c7ed6;
    --hz-code-bg: #f7f7f8;
    --hz-code-head: #ececef;
}

/* ===== Code blocks ===== */
.hz-code {
    margin: 12px 0;
    border: 1px solid var(--hz-line);
    border-radius: var(--hz-radius);
    background: var(--hz-code-bg);
    overflow: hidden;
    max-width: 100%;
}

.hz-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px 6px 14px;
    background: var(--hz-code-head);
    border-bottom: 1px solid var(--hz-line);
    min-height: 38px;
}

.hz-code-lang {
    font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--hz-muted);
    text-transform: lowercase;
}

.hz-code-actions { display: flex; gap: 4px; }

.hz-code-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--hz-muted);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    zoom: 1;
}

.hz-code-btn:hover { background: var(--hz-surface-3); color: var(--hz-text); }
.hz-code-btn.copied { color: #34d399; }
.hz-code-btn i { font-size: 12px; }

.message-content .hz-code pre,
.hz-code pre {
    margin: 0 !important;
    padding: 14px 16px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 13px;
    line-height: 1.6;
    box-shadow: none !important;
}

.hz-code pre code,
.hz-code pre code.hljs {
    display: block;
    padding: 0 !important;
    background: transparent !important;
    font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
    font-size: 13px !important;
    white-space: pre;
    tab-size: 4;
}

.hz-code pre::-webkit-scrollbar { height: 8px; }
.hz-code pre::-webkit-scrollbar-thumb { background: var(--hz-surface-3); border-radius: 8px; }

@media (max-width: 600px) {
    .hz-code-btn span { display: none; }
    .hz-code-btn { padding: 6px 9px; }
}

/* ===== Links ===== */
.hz-link-favicon {
    width: 14px !important;
    height: 14px !important;
    margin: 0 4px 0 0 !important;
    border-radius: 3px !important;
    vertical-align: -2px;
    display: inline !important;
    max-height: none !important;
}

.message .message-content a {
    color: var(--hz-accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
    word-break: break-word;
    -webkit-touch-callout: default;
    cursor: pointer;
}

/* ===== Shared widget chrome ===== */
.hz-widget {
    margin: 10px 0;
    padding: 16px;
    border: 1px solid var(--hz-line);
    border-radius: 18px;
    background: var(--hz-surface);
    color: var(--hz-text);
    max-width: 460px;
}

.hz-widget-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--hz-muted);
}

.hz-widget-loading,
.hz-widget-error {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--hz-surface-2);
    color: var(--hz-muted);
    font-size: 14px;
}

.hz-widget-error { color: var(--hz-danger); }

.hz-chip-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--hz-line);
    border-radius: 999px;
    background: var(--hz-surface-2);
    color: var(--hz-text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    zoom: 1;
}

.hz-chip-btn:hover { background: var(--hz-surface-3); }

.hz-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--hz-muted);
    font-size: 15px;
    cursor: pointer;
    zoom: 1;
}

.hz-icon-btn:hover { background: var(--hz-surface-3); color: var(--hz-text); }

/* Weather */
.hz-weather-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hz-weather-temp { font-size: 46px; font-weight: 600; line-height: 1.1; margin: 4px 0; }
.hz-weather-temp span { font-size: 20px; font-weight: 500; color: var(--hz-muted); margin-left: 2px; }
.hz-weather-cond { font-size: 14px; color: var(--hz-muted); }
.hz-weather-icon { font-size: 46px; line-height: 1; }
.hz-weather-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr) auto;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--hz-line);
    align-items: center;
}
.hz-weather-stats div { display: flex; flex-direction: column; gap: 2px; }
.hz-weather-stats span { font-size: 11px; color: var(--hz-muted); }
.hz-weather-stats strong { font-size: 14px; font-weight: 600; }
.hz-unit-toggle {
    border: 1px solid var(--hz-line);
    background: var(--hz-surface-2);
    color: var(--hz-text);
    border-radius: 999px;
    padding: 6px 10px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

/* Time */
.hz-time-clock { font-size: 36px; font-weight: 600; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.hz-time-date { font-size: 13px; color: var(--hz-muted); }

/* Stocks */
.hz-stock { padding: 0; overflow: hidden; max-width: 640px; }
.hz-stock-header { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px 10px; }
.hz-stock-name { font-weight: 600; font-size: 16px; }
.hz-stock-ticker { font-size: 12px; color: var(--hz-muted); font-family: 'Geist Mono', ui-monospace, monospace; }
.hz-stock-frame { height: 360px; border-top: 1px solid var(--hz-line); }
.hz-stock-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.message .message-content a.hz-stock-link,
.hz-stock-link {
    display: block;
    padding: 10px 16px;
    font-size: 12px;
    color: var(--hz-muted);
    text-decoration: none;
    border-top: 1px solid var(--hz-line);
}

/* Desktop TradingView iframe (replaces the blocked script embed) */
.stock-chart-root iframe.hz-tv-frame { width: 100%; height: 100%; border: 0; display: block; }

/* Graph */
.hz-graph { max-width: 640px; }
.hz-graph-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.hz-graph-canvas { position: relative; height: 280px; }

/* ===== HackAI image generation ===== */
.hz-imagegen { margin: 10px 0; width: min(520px, calc(100vw - 48px)); max-width: 100%; }
.message.bot .message-content:has(.hz-imagegen) { width: min(540px, 100%); max-width: 100%; }
.hz-imagegen-frame {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--hz-line);
    background: var(--hz-surface-2);
}
.hz-imagegen-frame img {
    display: block;
    width: 100%;
    height: auto;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    cursor: zoom-in;
}
.hz-imagegen-frame.is-loading {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hz-imagegen-frame.is-loading span {
    position: relative;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--hz-text);
    opacity: 0.75;
}
.hz-imagegen-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.07) 40%, transparent 60%);
    background-size: 200% 100%;
    animation: hz-shimmer 1.6s linear infinite;
}
.light-mode .hz-imagegen-shimmer { background-image: linear-gradient(110deg, transparent 20%, rgba(0, 0, 0, 0.06) 40%, transparent 60%); }
@keyframes hz-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .hz-imagegen-shimmer { animation: none; } }
.hz-imagegen-meta { margin-top: 8px; font-size: 13px; color: var(--hz-muted); }
.hz-imagegen.is-tall { width: min(360px, calc(100vw - 48px)); }

/* Round, dark see-through download button on the image */
.hz-imagegen-dl {
    position: absolute; right: 10px; bottom: 10px;
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    color: #fff; font-size: 15px; cursor: pointer; zoom: 1;
    transition: background-color .15s ease, transform .15s ease;
}
.hz-imagegen-dl:hover { background: rgba(0, 0, 0, 0.65); transform: scale(1.05); }
.hz-imagegen-dl:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Note left in place of an image after a reload */
.hz-imagegen-note {
    display: inline-flex; align-items: center; gap: 8px; margin-top: 4px;
    padding: 8px 12px; border-radius: 12px; font-size: 13px;
    color: var(--hz-muted); background: var(--hz-surface-2); border: 1px solid var(--hz-line);
}

/* Full-screen image preview */
.hz-image-preview {
    position: fixed; inset: 0; z-index: 100003;
    display: none; align-items: center; justify-content: center;
    padding: 56px 16px 96px;
    background: rgba(0, 0, 0, 0.88);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.hz-image-preview.open { display: flex; }
.hz-image-preview img {
    max-width: 100%; max-height: 100%; width: auto; height: auto;
    object-fit: contain; border-radius: 12px; display: block;
}
.hz-image-preview-dl {
    position: absolute; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
    padding: 11px 26px; border-radius: 999px; zoom: 1;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    color: #fff; font: 600 15px 'Geist', system-ui, sans-serif; cursor: pointer;
}
.hz-image-preview-dl:hover { background: rgba(255, 255, 255, 0.14); }
.hz-image-preview-close {
    position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px;
    width: 40px; height: 40px; border-radius: 50%; zoom: 1;
    border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(0, 0, 0, 0.45);
    color: #fff; font-size: 17px; cursor: pointer;
}

/* ===== Research report card (in chat) ===== */
.hz-report-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 0;
    padding: 12px 14px;
    border: 1px solid var(--hz-line);
    border-radius: 16px;
    background: var(--hz-surface);
    max-width: 520px;
}
.hz-report-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hz-surface-3);
    color: var(--hz-accent);
    font-size: 17px;
}
.hz-report-info { flex: 1; min-width: 0; }
.hz-report-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--hz-text); }
.hz-report-sub { font-size: 12px; color: var(--hz-muted); margin-top: 2px; }
.hz-report-card.is-loading .hz-report-sub { animation: hz-pulse 1.4s ease-in-out infinite; }
@keyframes hz-pulse { 50% { opacity: 0.45; } }
.hz-report-favs { display: flex; gap: 4px; margin-top: 6px; }
.hz-report-favs img {
    width: 16px !important;
    height: 16px !important;
    border-radius: 4px !important;
    margin: 0 !important;
    background: var(--hz-surface-2);
}

/* ===== Research canvas (document panel) ===== */
.hz-canvas { position: fixed; inset: 0; z-index: 9000; pointer-events: none; }
.hz-canvas-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.hz-canvas-sheet {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(760px, 100%);
    display: flex;
    flex-direction: column;
    background: var(--hz-surface);
    color: var(--hz-text);
    border-left: 1px solid var(--hz-line);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.35);
    transform: translateX(100%);
    transition: transform 0.25s ease;
}
.hz-canvas.open { pointer-events: auto; }
.hz-canvas.open .hz-canvas-backdrop { opacity: 1; }
.hz-canvas.open .hz-canvas-sheet { transform: none; }

.hz-canvas-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px 10px 18px;
    padding-top: max(10px, env(safe-area-inset-top, 0px));
    border-bottom: 1px solid var(--hz-line);
    background: var(--hz-surface);
}
.hz-canvas-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-weight: 600;
    font-size: 15px;
}
.hz-canvas-title i { color: var(--hz-accent); }
.hz-canvas-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hz-canvas-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.hz-canvas-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--hz-surface-2);
    padding: 24px 16px max(40px, env(safe-area-inset-bottom, 0px));
}
.hz-canvas-doc {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 44px;
    background: var(--hz-surface);
    border: 1px solid var(--hz-line);
    border-radius: 14px;
    font-family: 'Geist', 'Poppins', system-ui, sans-serif;
    font-size: 15.5px;
    line-height: 1.75;
    color: var(--hz-text);
}
.hz-canvas-status:empty { display: none; }
.hz-canvas-status { margin-bottom: 16px; }
.hz-canvas-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--hz-surface-2);
    color: var(--hz-muted);
    font-size: 12px;
}
.hz-canvas-body h1 { font-size: 28px; line-height: 1.25; margin: 0 0 18px; font-weight: 650; }
.hz-canvas-body h2 { font-size: 20px; margin: 28px 0 10px; font-weight: 600; }
.hz-canvas-body h3 { font-size: 17px; margin: 20px 0 8px; font-weight: 600; }
.hz-canvas-body p { margin: 0 0 14px; }
.hz-canvas-body ul, .hz-canvas-body ol { margin: 0 0 14px 22px; }
.hz-canvas-body li { margin: 4px 0; }
.hz-canvas-body blockquote { margin: 0 0 14px; padding-left: 14px; border-left: 3px solid var(--hz-line); color: var(--hz-muted); }
.hz-canvas-body a { color: var(--hz-accent); text-decoration: none; overflow-wrap: anywhere; }
.hz-canvas-body a:hover { text-decoration: underline; }
.hz-canvas-body table { border-collapse: collapse; margin: 0 0 14px; width: 100%; font-size: 14px; }
.hz-canvas-body th, .hz-canvas-body td { border: 1px solid var(--hz-line); padding: 6px 10px; text-align: left; }

.hz-canvas-sources-title { font-size: 18px; margin: 32px 0 12px; padding-top: 20px; border-top: 1px solid var(--hz-line); font-weight: 600; }
.hz-source-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hz-source-list a {
    display: grid;
    grid-template-columns: 20px 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--hz-line);
    border-radius: 12px;
    text-decoration: none;
    color: var(--hz-text);
    background: var(--hz-surface-2);
}
.hz-source-list a:hover { border-color: var(--hz-accent); }
.hz-source-list img { grid-row: span 2; width: 20px; height: 20px; border-radius: 4px; margin-top: 2px; }
.hz-source-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hz-source-host { font-size: 12px; color: var(--hz-muted); }

body.hz-canvas-open { overflow: hidden; }

@media (max-width: 700px) {
    .hz-canvas-sheet { width: 100%; border-left: 0; }
    .hz-canvas-scroll { padding: 0; background: var(--hz-surface); }
    .hz-canvas-doc { border: 0; border-radius: 0; padding: 22px 18px 40px; font-size: 15px; }
    .hz-canvas-body h1 { font-size: 23px; }
    .hz-canvas-actions .hz-chip-btn { padding: 6px 10px; }
}

/* ===== AI Lockdown (uses the banned screen's look) ===== */
.banned-screen.hz-lockdown-screen { z-index: 100000; background: #000 !important; }
body:not(.light-mode) .banned-screen { background: #000 !important; }
body.hz-locked { overflow: hidden; }

/* In-chat abuse warning */
.hz-abuse-warning {
    display: flex; align-items: flex-start; gap: 12px;
    margin-top: 12px; padding: 14px 16px; max-width: 460px;
    border-radius: 14px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.45);
    font-family: 'Geist', 'Poppins', system-ui, sans-serif;
}
.hz-warn-icon {
    flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(239, 68, 68, 0.16); color: #f87171; font-size: 15px;
}
.hz-warn-body { min-width: 0; }
.hz-warn-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; font-weight: 650; color: #f87171;
}
.hz-warn-dots { display: inline-flex; gap: 4px; }
.hz-warn-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(239, 68, 68, 0.25); }
.hz-warn-dot.on { background: #ef4444; }
.hz-warn-text { margin-top: 3px; font-size: 13px; line-height: 1.5; color: #fca5a5; }
.light-mode .hz-abuse-warning { background: #fef2f2; border-color: #fca5a5; }
.light-mode .hz-warn-title, .light-mode .hz-warn-icon { color: #dc2626; }
.light-mode .hz-warn-text { color: #991b1b; }

/* Wide widgets and code shouldn't shrink to their content inside a bot bubble. */
.message.bot .message-content:has(> .chart-widget),
.message.bot .message-content:has(.hz-graph),
.message.bot .message-content:has(.hz-stock) {
    width: 100%;
    max-width: 720px;
}
.message.bot .message-content .chart-widget { width: 100%; max-width: 640px; }
.message.bot .message-content:has(.hz-code) { max-width: 100%; }
.hz-code { min-width: min(100%, 420px); }

/* Chat composer uses Geist (typed text + placeholder) on desktop and mobile. */
.chat-input,
.chat-input::placeholder,
#chatInput,
#chatInput::placeholder {
    font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif !important;
}

/* ===== One palette for every widget (desktop + mobile) =====
   Neutral cards that match the app's greys, one blue accent, no glows or gradients. */
.weather-card,
.weather-card.sunny,
.weather-card.rainy,
.weather-card.snowy,
.stock-widget,
.chart-widget,
.time-widget,
.hz-widget,
.hz-report-card {
    background: var(--hz-surface) !important;
    border: 1px solid var(--hz-line) !important;
    box-shadow: none !important;
    color: var(--hz-text) !important;
}

/* Weather (desktop) */
.weather-card { border-radius: 18px; transition: none; }
.weather-card .weather-location,
.weather-card .temperature,
.weather-card .temp-range,
.weather-card .temp-range span,
.weather-card .weather-description { color: var(--hz-text) !important; }
.weather-card .temp-unit,
.weather-card .temp-range { color: var(--hz-muted) !important; opacity: 1; }
.weather-card .weather-description { color: var(--hz-muted) !important; opacity: 1; }
.weather-card .unit-toggle { background: var(--hz-surface-2) !important; border: 1px solid var(--hz-line); }
.weather-card .unit-toggle span { color: var(--hz-muted) !important; }
.weather-card .unit-toggle span.active { background: var(--hz-surface-3) !important; color: var(--hz-text) !important; }

/* Stocks + charts (desktop) */
.stock-chart-shell,
.chart-canvas-shell {
    background: var(--hz-surface-2) !important;
    border: 1px solid var(--hz-line) !important;
}
.stock-widget-name,
.chart-widget-title { color: var(--hz-text) !important; }
.stock-widget-ticker,
.chart-widget-type { color: var(--hz-muted) !important; }
.chart-download-btn,
body:not(.light-mode) .chart-download-btn {
    background: var(--hz-surface-2) !important;
    border: 1px solid var(--hz-line) !important;
    color: var(--hz-text) !important;
    border-radius: 999px !important;
}
.chart-download-btn:hover,
body:not(.light-mode) .chart-download-btn:hover { background: var(--hz-surface-3) !important; }

/* Time (desktop) */
.time-widget-card,
.time-divider { background: var(--hz-surface-2) !important; border-color: var(--hz-line) !important; }
.time-divider { background: var(--hz-line) !important; }
.time-widget-dot { background: var(--hz-accent) !important; }
.time-city,
.time-value { color: var(--hz-text) !important; }
.time-widget-label,
.time-country,
.time-meta-key,
.time-meta-val,
.time-source { color: var(--hz-muted) !important; }
.time-ampm { color: var(--hz-accent) !important; }
.time-tz-badge {
    background: var(--hz-surface-3) !important;
    border: 1px solid var(--hz-line) !important;
    color: var(--hz-text) !important;
}

/* ===== Widgets: minimal =====
   One quiet card, no inner boxes, no glows. Type does the work; one accent colour. */
.hzw,
.hzw.hz-widget,
.stock-widget.hzw,
.chart-widget.hzw {
    position: relative;
    width: 100%;
    max-width: 380px;
    margin: 6px 0 10px;
    padding: 20px 22px;
    border-radius: 20px;
    border: 1px solid var(--hz-line) !important;
    background: var(--hz-surface) !important;
    box-shadow: none !important;
    color: var(--hz-text) !important;
    font-family: 'Geist', 'Poppins', system-ui, sans-serif;
    overflow: hidden;
}

/* The bubble around a widget disappears so the card stands on its own. */
.message.bot .message-content:has(.hzw) {
    width: 100%;
    max-width: 400px;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding-left: 0;
    padding-right: 0;
}
.message.bot .message-content:has(.hzw-graph),
.message.bot .message-content:has(.chart-widget.hzw),
.message.bot .message-content:has(.hzw-stock) { max-width: 680px; }

.hzw-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hzw-label {
    font-size: 13px; font-weight: 500; color: var(--hz-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hzw-mono { font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--hz-text); }
.hzw-muted { font-size: 13px; color: var(--hz-muted); line-height: 1.5; }
.hzw-small-icon { font-size: 13px; }
.hzw-meta {
    display: flex; flex-wrap: wrap; gap: 4px 14px;
    margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hz-line);
    font-size: 12px; color: var(--hz-muted); font-variant-numeric: tabular-nums;
}
.hzw-meta-split { justify-content: space-between; border-top: 0; padding-top: 0; margin-top: 8px; }
.hzw-meta-split + .hzw-meta { margin-top: 12px; }

.hzw-unit,
.hzw-ghost-btn {
    border: 0; background: transparent; color: var(--hz-muted);
    font: inherit; font-size: 12px; font-weight: 600;
    padding: 4px 8px; margin: -4px -8px -4px 0; border-radius: 8px;
    cursor: pointer; transition: color .15s, background .15s; zoom: 1;
}
.hzw-unit:hover,
.hzw-ghost-btn:hover { color: var(--hz-text); background: var(--hz-surface-2); }

/* Icon tints (kept soft) */
.hzw-tone-sun { color: #fbbf24; }
.hzw-tone-night { color: #a5b4fc; }
.hzw-tone-cloud { color: #a1a1aa; }
.hzw-tone-rain { color: #60a5fa; }
.hzw-tone-snow { color: #bae6fd; }
.hzw-tone-storm { color: #c4b5fd; }
.light-mode .hzw-tone-sun { color: #d97706; }
.light-mode .hzw-tone-night { color: #6366f1; }
.light-mode .hzw-tone-cloud { color: #71717a; }
.light-mode .hzw-tone-rain { color: #2563eb; }
.light-mode .hzw-tone-snow { color: #0284c7; }

/* --- Weather --- */
.hzw-hero { margin: 6px 0 2px; align-items: flex-end; }
.hzw-temp { font-size: 60px; font-weight: 400; line-height: 1; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; }
.hzw-hero-icon { font-size: 34px; margin-bottom: 8px; }
.hzw-hours {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-top: 18px;
}
.hzw-hour { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hzw-hour span { font-size: 11px; color: var(--hz-muted); }
.hzw-hour i { font-size: 14px; }
.hzw-hour strong { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* --- Time --- */
.hzw-clock { display: flex; align-items: baseline; gap: 6px; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.hzw-hm { font-size: 54px; font-weight: 400; letter-spacing: -0.04em; line-height: 1; }
.hzw-ss { font-size: 18px; color: var(--hz-muted); }
.hzw-ampm { font-size: 14px; font-weight: 500; color: var(--hz-muted); }
.hzw-dayline { position: relative; height: 3px; margin-top: 18px; border-radius: 999px; background: var(--hz-surface-3); }
.hzw-daylight { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: rgba(251, 191, 36, 0.55); }
.light-mode .hzw-daylight { background: rgba(217, 119, 6, 0.45); }
.hzw-now {
    position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
    border-radius: 50%; background: var(--hz-text); box-shadow: 0 0 0 3px var(--hz-surface);
}

/* --- Stocks: just the chart --- */
.hzw.hzw-stock,
.stock-widget.hzw.hzw-stock {
    max-width: 680px;
    padding: 0;
    height: 360px;
}
.hzw-stock iframe { width: 100%; height: 100%; border: 0; display: block; }
.stock-widget.hzw .stock-chart-shell {
    height: 100% !important; min-height: 0 !important;
    border: 0 !important; border-radius: 0 !important;
    background: transparent !important;
}
.message.stock-message .message-actions { display: none !important; }

/* --- Graph --- */
.hzw.hzw-graph,
.chart-widget.hzw { max-width: 680px; padding: 18px 18px 12px; }
.hzw-graph .hzw-row,
.chart-widget.hzw .hzw-row { margin: 0 4px 10px; }
.hzw-graph .hzw-ghost-btn,
.chart-widget.hzw .hzw-ghost-btn { opacity: 0; }
.hzw-graph:hover .hzw-ghost-btn,
.chart-widget.hzw:hover .hzw-ghost-btn,
.hzw-ghost-btn:focus-visible { opacity: 1; }
@media (hover: none) { .hzw-graph .hzw-ghost-btn, .chart-widget.hzw .hzw-ghost-btn { opacity: 1; } }
.hzw-graph-canvas,
.chart-widget.hzw .chart-canvas-shell {
    position: relative; height: 280px; min-height: 0 !important;
    padding: 0 !important; border: 0 !important; border-radius: 0 !important;
    background: transparent !important;
}
.chart-widget.hzw .chart-canvas-shell canvas { height: 100% !important; }

/* Loading state */
.hz-widget-loading {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: 16px;
    background: var(--hz-surface); border: 1px solid var(--hz-line);
}
.hz-widget-loading::before {
    content: "";
    width: 7px; height: 7px; border-radius: 50%; background: var(--hz-muted);
    animation: hz-pulse 1.2s ease-in-out infinite;
}

@media (max-width: 520px) {
    .hzw, .hzw.hz-widget, .chart-widget.hzw { padding: 18px; }
    .hzw-temp { font-size: 52px; }
    .hzw-hm { font-size: 46px; }
    .hzw.hzw-stock, .stock-widget.hzw.hzw-stock { padding: 0; height: 300px; }
    .hzw-graph-canvas, .chart-widget.hzw .chart-canvas-shell { height: 230px; }
}

/* Near-black widget cards in dark mode (light mode stays white). */
:root:not(.light-mode) body:not(.light-mode) {
    --hz-surface: #0a0a0b;
    --hz-surface-2: #141416;
    --hz-surface-3: #1f1f22;
    --hz-line: rgba(255, 255, 255, 0.08);
}

/* Weather card a bit longer. */
.hzw.hzw-weather { max-width: 480px; padding: 24px 26px; }
.message.bot .message-content:has(.hzw-weather) { max-width: 500px; }
.hzw-weather .hzw-hours { margin-top: 22px; }
.hzw-weather .hzw-meta { margin-top: 18px; padding-top: 16px; }
.hzw-time .hzw-dayline { margin-bottom: 4px; }

/* ===== Custom scrollbars (chat, report panel, code) ===== */
#chatMessages,
#chatArea,
.hz-canvas-scroll,
.hz-code pre {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.light-mode #chatMessages,
.light-mode #chatArea,
.light-mode .hz-canvas-scroll,
.light-mode .hz-code pre { scrollbar-color: rgba(0, 0, 0, 0.18) transparent; }

#chatMessages::-webkit-scrollbar,
#chatArea::-webkit-scrollbar,
.hz-canvas-scroll::-webkit-scrollbar { width: 10px; }
.hz-code pre::-webkit-scrollbar { height: 10px; }
#chatMessages::-webkit-scrollbar-track,
#chatArea::-webkit-scrollbar-track,
.hz-canvas-scroll::-webkit-scrollbar-track,
.hz-code pre::-webkit-scrollbar-track { background: transparent; }
#chatMessages::-webkit-scrollbar-thumb,
#chatArea::-webkit-scrollbar-thumb,
.hz-canvas-scroll::-webkit-scrollbar-thumb,
.hz-code pre::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: padding-box;
}
#chatMessages::-webkit-scrollbar-thumb:hover,
#chatArea::-webkit-scrollbar-thumb:hover,
.hz-canvas-scroll::-webkit-scrollbar-thumb:hover,
.hz-code pre::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.28); }
.light-mode #chatMessages::-webkit-scrollbar-thumb,
.light-mode #chatArea::-webkit-scrollbar-thumb,
.light-mode .hz-canvas-scroll::-webkit-scrollbar-thumb,
.light-mode .hz-code pre::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.16); }
.light-mode #chatMessages::-webkit-scrollbar-thumb:hover,
.light-mode #chatArea::-webkit-scrollbar-thumb:hover,
.light-mode .hz-canvas-scroll::-webkit-scrollbar-thumb:hover,
.light-mode .hz-code pre::-webkit-scrollbar-thumb:hover { background-color: rgba(0, 0, 0, 0.3); }
#chatMessages::-webkit-scrollbar-button,
#chatArea::-webkit-scrollbar-button,
.hz-canvas-scroll::-webkit-scrollbar-button { display: none; height: 0; }

/* ===== Research panel v2 ===== */
:root { --hz-canvas-w: clamp(440px, 46vw, 780px); }

.hz-canvas-sheet {
    background: var(--hz-surface);
    border-left: 1px solid var(--hz-line);
    box-shadow: none;
}
.hz-canvas-toolbar {
    padding: 12px 14px 12px 22px;
    background: var(--hz-surface);
    border-bottom: 1px solid var(--hz-line);
}
.hz-canvas-title { gap: 12px; }
.hz-canvas-title > i {
    width: 32px; height: 32px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--hz-surface-2); color: var(--hz-accent); font-size: 14px; flex: 0 0 auto;
}
.hz-canvas-titles { display: flex; flex-direction: column; min-width: 0; }
.hz-canvas-titles #hzCanvasTitle { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hz-canvas-sub { font-size: 12px; font-weight: 400; color: var(--hz-muted); }
.hz-canvas-sub.is-writing::before {
    content: "";
    display: inline-block; width: 6px; height: 6px; margin: 0 6px 1px 0; border-radius: 50%;
    background: var(--hz-accent); vertical-align: middle;
    animation: hz-pulse 1.1s ease-in-out infinite;
}
.hz-canvas-actions { gap: 4px; }
.hz-canvas-actions .hz-chip-btn {
    background: transparent; border-color: transparent; color: var(--hz-muted);
    padding: 6px 10px; border-radius: 10px; font-size: 12.5px;
}
.hz-canvas-actions .hz-chip-btn:hover,
.hz-canvas-actions .hz-icon-btn:hover { background: var(--hz-surface-2); color: var(--hz-text); }

.hz-canvas-scroll {
    background: var(--hz-surface);
    padding: 8px 0 max(48px, env(safe-area-inset-bottom, 0px));
}
.hz-canvas-doc {
    max-width: 700px;
    padding: 28px 48px 40px;
    background: transparent;
    border: 0;
    border-radius: 0;
    font-size: 15.5px;
    line-height: 1.78;
}
.hz-canvas-body h1 { font-size: 30px; letter-spacing: -0.02em; margin-bottom: 22px; }
.hz-canvas-body h2 { font-size: 19px; letter-spacing: -0.01em; margin-top: 34px; }
.hz-canvas-body p, .hz-canvas-body li { color: var(--hz-text); opacity: 0.92; }
.hz-canvas-body strong { opacity: 1; font-weight: 600; }
.hz-canvas-body a {
    color: var(--hz-text);
    text-decoration: none;
    padding: 1px 7px 1px 5px;
    border-radius: 999px;
    background: var(--hz-surface-2);
    border: 1px solid var(--hz-line);
    font-size: 12.5px;
    white-space: nowrap;
    vertical-align: 1px;
}
.hz-canvas-body a:hover { border-color: var(--hz-accent); text-decoration: none; }
.hz-canvas-body a .hz-link-favicon { width: 12px !important; height: 12px !important; vertical-align: -1px; }
.hz-canvas-sources-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--hz-muted); font-weight: 600; }
.hz-source-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.hz-source-list a { background: var(--hz-surface-2); border-radius: 14px; }

/* Desktop: dock the panel on the right and squeeze the chat beside it. */
@media (min-width: 900px) {
    .hz-canvas { left: auto; width: var(--hz-canvas-w); }
    .hz-canvas-backdrop { display: none; }
    .hz-canvas-sheet { width: 100%; }
    body.hz-canvas-open { overflow: auto; }
    .chat-section { transition: margin-right 0.25s ease; }
    body.hz-canvas-open .chat-section { margin-right: var(--hz-canvas-w); }
    body.hz-canvas-open .chat-input-container { width: calc(100% - 48px) !important; max-width: 860px; }
}

@media (max-width: 700px) {
    .hz-canvas-doc { padding: 20px 20px 40px; }
    .hz-canvas-body h1 { font-size: 24px; }
    .hz-canvas-actions .hz-chip-btn { padding: 6px 8px; }
}

/* Research report icon: white, no box, larger (panel header + chat card). */
.hz-canvas-title > i,
.hz-report-icon {
    width: auto !important;
    height: auto !important;
    background: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    color: var(--hz-text) !important;
    font-size: 22px !important;
}
.hz-report-icon { font-size: 26px !important; padding: 0 4px; }
.hz-report-icon i { color: inherit; }

/* ===== Research report steps (chat card) ===== */
.hz-report-card.hz-report-card-steps {
    display: block;
    /* Fixed width (not 100% of a shrink-to-fit bubble) so the card is full size from the first step. */
    width: min(520px, calc(100vw - 48px));
    max-width: 100%;
    padding: 16px 18px;
    border-radius: 20px;
}
.hz-report-head { display: flex; align-items: center; gap: 12px; }
.hz-report-card-steps.is-loading .hz-report-sub { animation: none; }

.hz-steps {
    list-style: none;
    margin: 14px 0 0;
    padding: 14px 0 0;
    border-top: 1px solid var(--hz-line);
}
.hz-steps.is-collapsed { display: none; }
.hz-step {
    position: relative;
    display: flex;
    gap: 12px;
    padding-bottom: 14px;
}
.hz-step:last-child { padding-bottom: 0; }
/* connector line between dots */
.hz-step:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 20px;
    bottom: 2px;
    width: 1px;
    background: var(--hz-line);
}
.hz-step-dot {
    position: relative;
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin-top: 1px;
    border-radius: 50%;
    border: 1.5px solid var(--hz-line);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    background: var(--hz-surface);
}
.hz-step.is-done .hz-step-dot { border-color: transparent; background: #22c55e; color: #fff; }
.hz-step.is-error .hz-step-dot { border-color: transparent; background: var(--hz-danger); color: #fff; }
.hz-step.is-active .hz-step-dot { border-color: var(--hz-text); }
.hz-step.is-active .hz-step-dot::after {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--hz-text);
    animation: hz-pulse 1s ease-in-out infinite;
}
.hz-step-body { flex: 1; min-width: 0; }
.hz-step-label {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--hz-text);
    line-height: 1.35;
}
.hz-step.is-active .hz-step-label span:first-child {
    background: linear-gradient(90deg, var(--hz-muted) 0%, var(--hz-text) 50%, var(--hz-muted) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: hz-shimmer 1.8s linear infinite;
}
.hz-step-time { font-size: 11.5px; font-weight: 400; color: var(--hz-muted); font-variant-numeric: tabular-nums; }
.hz-step-detail { margin-top: 4px; font-size: 12.5px; color: var(--hz-muted); line-height: 1.45; }

.hz-step-queries { display: flex; flex-wrap: wrap; gap: 6px; }
.hz-step-queries span {
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--hz-line);
    background: var(--hz-surface-2);
    font-size: 11.5px;
    color: var(--hz-text);
}
.hz-step-sources { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.message .message-content .hz-step-sources a,
.hz-step-sources a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px 3px 6px;
    border-radius: 999px;
    border: 1px solid var(--hz-line);
    background: var(--hz-surface-2);
    font-size: 11.5px;
    color: var(--hz-text);
    text-decoration: none;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hz-step-sources a:hover { border-color: var(--hz-muted); }
.hz-step-sources img { width: 12px !important; height: 12px !important; margin: 0 !important; border-radius: 3px !important; flex: 0 0 auto; }
.hz-step-sources span { font-size: 11.5px; color: var(--hz-muted); }

.hz-steps-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--hz-muted);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    zoom: 1;
}
.hz-steps-toggle:hover { color: var(--hz-text); }
.hz-steps-toggle i { font-size: 10px; }

@media (prefers-reduced-motion: reduce) {
    .hz-step.is-active .hz-step-label span:first-child { animation: none; color: var(--hz-text); background: none; }
    .hz-step.is-active .hz-step-dot::after { animation: none; }
}

/* Send button: white arrow icon, so the dark-mode button is a dark circle (light mode stays black). */
body:not(.light-mode) #sendButton,
body:not(.light-mode) #sendBtn {
    background: #2f2f33 !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
body:not(.light-mode) #sendButton:hover:not(:disabled),
body:not(.light-mode) #sendBtn:hover:not(:disabled) { background: #3d3d42 !important; }
#sendButton .fa-arrow-up,
#sendBtn .fa-arrow-up { font-size: 15px; }

/* Send button turns white with a dark arrow once there's something to send.
   Desktop: the app enables the button when there's text/attachments.
   Mobile: the textarea's placeholder disappears once text is typed. */
body:not(.light-mode) #sendButton:not(:disabled),
body:not(.light-mode) .input-wrapper:has(#chatInput:not(:placeholder-shown)) #sendBtn,
body:not(.light-mode) #sendBtn.hz-has-text {
    background: #ffffff !important;
    border-color: #ffffff;
}
body:not(.light-mode) #sendButton:not(:disabled):hover { background: #e4e4e7 !important; }
body:not(.light-mode) #sendButton:not(:disabled) i,
body:not(.light-mode) .input-wrapper:has(#chatInput:not(:placeholder-shown)) #sendBtn i,
body:not(.light-mode) #sendBtn.hz-has-text i { color: #0a0a0b !important; }
#sendButton, #sendBtn, #sendButton i, #sendBtn i { transition: background-color .15s ease, color .15s ease, border-color .15s ease; }

/* Slash command menu hint (e.g. "/report  Research report on a topic") */
.slash-command-item { display: flex; align-items: baseline; gap: 10px; }
.slash-command-hint { font-size: 12px; color: var(--hz-muted); }
.slash-command-menu { min-width: 290px; }
.slash-command-hint { white-space: nowrap; }


/* ===== Code canvas ===== */
.hz-code-canvas .hz-canvas-sheet { display: flex; flex-direction: column; }
.hz-code-tabs {
    display: inline-flex; padding: 3px; gap: 2px; margin-right: 6px;
    border-radius: 10px; background: var(--hz-surface-2); border: 1px solid var(--hz-line);
}
.hz-code-tabs button {
    border: 0; background: transparent; color: var(--hz-muted);
    font: inherit; font-size: 12.5px; font-weight: 500;
    padding: 5px 12px; border-radius: 8px; cursor: pointer; zoom: 1;
}
.hz-code-tabs button.on { background: var(--hz-surface-3); color: var(--hz-text); }
.hz-code-tabs button[hidden] { display: none; }

.hz-code-view {
    flex: 1; overflow: auto; -webkit-overflow-scrolling: touch;
    background: var(--hz-surface);
    scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.hz-code-view::-webkit-scrollbar { width: 10px; height: 10px; }
.hz-code-view::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
.hz-code-view::-webkit-scrollbar-track { background: transparent; }
.hz-code-view[hidden], .hz-code-preview[hidden] { display: none !important; }
.hz-code-pre {
    margin: 0; padding: 14px 0 60px; min-width: max-content;
    font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px; line-height: 1.65; background: transparent !important;
}
.hz-code-pre code { display: block; background: transparent !important; padding: 0 !important; }
.hz-code-line { display: flex; padding-right: 24px; transition: background-color 1.2s ease; }
.hz-ln {
    flex: 0 0 auto; width: 52px; padding-right: 16px; text-align: right;
    color: var(--hz-muted); opacity: 0.5; user-select: none;
}
.hz-lc { white-space: pre; color: var(--hz-text); }
.hz-code-line.is-changed { background: rgba(52, 211, 153, 0.12); box-shadow: inset 3px 0 0 #34d399; }
.hz-code-line.is-changed .hz-ln { color: #34d399; opacity: 1; }

.hz-code-preview { flex: 1; background: #ffffff; }
.hz-code-preview iframe { width: 100%; height: 100%; border: 0; display: block; background: #ffffff; }

/* Code card in the chat */
.hz-code-card .hz-report-head { gap: 10px; }
.hz-code-card .hz-chip-btn { flex: 0 0 auto; }
.hz-code-ver {
    display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 6px;
    background: var(--hz-surface-2); border: 1px solid var(--hz-line);
    font-size: 11px; font-weight: 500; color: var(--hz-muted); vertical-align: 1px;
}

@media (max-width: 700px) {
    .hz-code-tabs button { padding: 5px 9px; }
    .hz-code-canvas .hz-canvas-actions .hz-icon-btn[data-copy] { display: none; }
    .hz-ln { width: 40px; padding-right: 10px; }
    .hz-code-pre { font-size: 12px; }
}

/* °F / °C slider switch on the weather widget */
.hzw-seg {
    position: relative; display: inline-flex; padding: 2px; border-radius: 999px;
    background: var(--hz-surface-2); border: 1px solid var(--hz-line);
}
.hzw-seg button {
    position: relative; z-index: 1; border: 0; background: transparent; cursor: pointer; zoom: 1;
    width: 34px; padding: 3px 0; border-radius: 999px;
    font: inherit; font-size: 11.5px; font-weight: 600; color: var(--hz-muted);
    transition: color .2s ease;
}
.hzw-seg-thumb {
    position: absolute; top: 2px; left: 2px; width: 34px; height: calc(100% - 4px);
    border-radius: 999px; background: var(--hz-text);
    transition: transform .2s ease;
}
.hzw-seg[data-unit="C"] .hzw-seg-thumb { transform: translateX(34px); }
.hzw-seg[data-unit="F"] button[data-u="F"],
.hzw-seg[data-unit="C"] button[data-u="C"] { color: var(--hz-surface); }
@media (prefers-reduced-motion: reduce) { .hzw-seg-thumb, .hzw-seg button { transition: none; } }

/* Stocks widget: small corner radius so TradingView's own edges aren't cropped */
.hzw.hzw-stock,
.stock-widget.hzw.hzw-stock { border-radius: 14px; }
/* TradingView draws its own 1px border; push it just outside the card so only ours shows. */
.hzw-stock iframe,
.stock-chart-root iframe.hz-tv-frame {
    width: calc(100% + 6px) !important;
    height: calc(100% + 6px) !important;
    margin: -3px !important;
    max-width: none !important;
}

/* "from your photo" tag on image cards made from an uploaded photo */
.hz-imagegen-ref {
    display: inline-flex; align-items: center; gap: 5px; margin-left: 6px;
    padding: 1px 8px; border-radius: 999px; font-size: 11px;
    background: var(--hz-surface-2); border: 1px solid var(--hz-line); color: var(--hz-muted);
}

/* ===== Crisis help card ===== */
.hz-crisis {
    margin: 12px 0 4px; padding: 16px; border-radius: 16px; max-width: 460px;
    background: rgba(52, 211, 153, 0.07); border: 1px solid rgba(52, 211, 153, 0.35);
    font-family: 'Geist', 'Poppins', system-ui, sans-serif;
}
.hz-crisis-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.hz-crisis-head > i { color: #34d399; font-size: 18px; margin-top: 2px; }
.hz-crisis-head strong { display: block; font-size: 15px; color: var(--hz-text); }
.hz-crisis-head span { display: block; font-size: 13px; color: var(--hz-muted); margin-top: 2px; }
.hz-crisis-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hz-crisis-btn {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 9px 16px;
    border-radius: 999px; font-size: 14px; font-weight: 600; text-decoration: none !important;
    color: var(--hz-text) !important; background: var(--hz-surface-2); border: 1px solid var(--hz-line);
}
.hz-crisis-btn:hover { background: var(--hz-surface-3); }
.hz-crisis-btn.hz-crisis-primary { background: #34d399; border-color: #34d399; color: #04130d !important; }
.hz-crisis-btn.hz-crisis-primary:hover { background: #2fc28c; }
.hz-crisis-intl {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
    font-size: 13px; color: var(--hz-text) !important; text-decoration: underline;
}
.hz-crisis-note { margin-top: 8px; font-size: 12px; color: var(--hz-muted); }
@media (max-width: 480px) { .hz-crisis-btn { flex: 1 1 auto; justify-content: center; } }

/* The chat bubble around a report/code card is as wide as the card from the start. */
.message.bot .message-content:has(.hz-report-card-steps) { width: min(560px, 100%); max-width: 100%; }

/* ===== Sidebar: solid black in dark mode ===== */
body:not(.light-mode) { --sidebar-bg: #000000; }
body:not(.light-mode) .sidebar,
body:not(.light-mode) .sidebar.expanded { background: #000000 !important; }

/* ===== Chat input: translucent glass (mobile only; desktop keeps its solid input) ===== */
body:not(.light-mode) .input-wrapper {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
}
body.light-mode .input-wrapper {
    background: rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
}
/* The mobile text box itself has no fill, so the glass shows through. */
.input-wrapper textarea { background: transparent !important; background-color: transparent !important; }

/* Mobile welcome greeting (replaces the logo): still text, like desktop's */
.hz-mobile-greeting {
    margin: 0; padding: 0 24px; text-align: center;
    font-family: 'Geist', system-ui, sans-serif; font-size: 32px; font-weight: 700;
    letter-spacing: -0.6px; line-height: 1.15;
    color: var(--text-primary, #fff);
    animation: none; transition: none;
}

/* Mobile loader: "HyzeAI" wordmark with a small spinner at the bottom (same as desktop) */
.hz-loading-wordmark {
    font-family: 'Geist', system-ui, sans-serif;
    font-size: clamp(44px, 12vw, 60px); font-weight: 700;
    letter-spacing: -0.03em; line-height: 1.1;
    color: var(--text-primary, #fff); user-select: none;
}
.hz-loading-circle {
    position: absolute; left: 50%; margin-left: -11px;
    bottom: calc(48px + env(safe-area-inset-bottom, 0px));
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid var(--border-color, rgba(255, 255, 255, 0.18));
    border-top-color: var(--text-primary, #fff);
    animation: hz-loader-spin 0.8s linear infinite;
}
@keyframes hz-loader-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .hz-loading-circle { animation: none; } }

/* ===== Mobile settings: softer, rounder ===== */
.settings-page .settings-profile { border-radius: 24px; }
.settings-page .settings-item,
.settings-page .settings-expandable { border-radius: 20px; }
.settings-page .settings-item-icon { border-radius: 50%; }
.settings-page .theme-buttons { gap: 10px; }
.settings-page .theme-mode-btn { border-radius: 999px; padding: 14px; }
.settings-page .settings-btn { border-radius: 999px; }
.settings-page .settings-expandable-content textarea,
.settings-page .settings-expandable-content input { border-radius: 14px !important; }
body:not(.light-mode) .settings-page .settings-profile,
body:not(.light-mode) .settings-page .settings-item,
body:not(.light-mode) .settings-page .settings-expandable,
body:not(.light-mode) .settings-page .settings-expandable-header,
body:not(.light-mode) .settings-page .theme-mode-btn:not(.active) { background: #0c0c0d; }

/* Attached image previews inside the chat input (where the attachment chip was), up to 2 */
.hz-image-tray { display: flex; align-items: center; gap: 10px; flex-shrink: 0; padding: 0 4px; }
.hz-image-tray[hidden] { display: none !important; }
.hz-tray-item { position: relative; width: 40px; height: 40px; flex: 0 0 auto; }
.hz-tray-item img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.85);
}
.light-mode .hz-tray-item img { border-color: rgba(0, 0, 0, 0.7); }
/* Same small red X as the old chip */
.hz-tray-x {
    position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; padding: 0; zoom: 1;
    background: #de3a3a; border: 2px solid var(--bg-primary, #000);
    color: #fff; font-size: 8px; cursor: pointer; z-index: 2; transition: transform 0.2s;
}
.hz-tray-x:hover { transform: scale(1.2); }
.hz-extra-thumb { margin-left: 6px; }
