/* Analysis Panel — GeoTown
   Uses --gt-* tokens from style.css */

/* === Panel Shell === */
.simple-analysis-panel {
    position: fixed;
    top: 44px;
    right: 0;
    bottom: 0;
    width: 420px;
    min-width: 320px;
    max-width: 560px;
    height: auto;
    z-index: 800;
    display: none;
    font-family: var(--gt-font);
    -webkit-font-smoothing: antialiased;
    contain: layout style;
}

.simple-analysis-panel::before {
    content: '';
    position: absolute;
    left: -4px; top: 0; bottom: 0;
    width: 8px;
    cursor: ew-resize;
    z-index: 10;
}
.simple-analysis-panel:hover::before,
.simple-analysis-panel.resizing::before {
    background: rgba(45, 106, 79, 0.2);
}

/* Remove centered-state and moving-to-side — panel always on right */
.simple-analysis-panel.centered-state {
    top: 44px; left: auto; right: 0; bottom: 0;
    transform: none;
    width: 420px;
    height: auto;
}

.simple-analysis-panel.moving-to-side {
    transition: none;
}

.simple-analysis-panel.visible {
    display: block;
}

/* === Panel Container === */
.panel-container {
    background: var(--gt-surface);
    border-left: 1px solid var(--gt-border);
    border-radius: 0;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}
[data-theme="light"] .panel-container {
    background: var(--gt-surface);
}

/* === Minimized State === */
.simple-analysis-panel.minimized .panel-content,
.simple-analysis-panel.minimized .panel-tabs { display: none; }

/* Restore tab */
.panel-restore-tab {
    position: fixed;
    right: 0; top: 50%;
    transform: translateY(-50%);
    width: 28px; height: 56px;
    border: 1px solid var(--gt-border);
    border-right: none;
    border-radius: var(--gt-radius) 0 0 var(--gt-radius);
    background: var(--gt-surface);
    color: var(--gt-text-muted);
    cursor: pointer;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px;
    font-size: 12px;
    z-index: 900;
    opacity: 0; pointer-events: none;
    transition: opacity 150ms ease;
}
.panel-restore-tab.visible { opacity: 1; pointer-events: auto; }
.panel-restore-tab:hover { color: var(--gt-green-light); }
.panel-restore-tab .restore-label {
    font-size: 7px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; writing-mode: vertical-rl;
}

/* === Header === */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-bottom: 1px solid var(--gt-border);
    flex-shrink: 0;
    min-height: 34px;
}

.panel-header-left {
    display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
}

.panel-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--gt-text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0;
}

/* Tab pills (Analysis / Ask AI) */
.panel-tab-pills {
    display: flex; align-items: center; gap: 1px;
    background: transparent;
    padding: 0;
}

.tab-pill {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 3px 8px;
    border-radius: var(--gt-radius-sm);
    border: none;
    background: transparent;
    color: var(--gt-text-muted);
    font-size: 0.6875rem; font-weight: 500;
    cursor: pointer;
    transition: color 100ms ease;
    white-space: nowrap;
}
.tab-pill:hover { color: var(--gt-text-secondary); }

.tab-pill.active {
    color: var(--gt-text);
    font-weight: 600;
}

.tab-pill i { font-size: 9px; opacity: 0.5; }
.tab-pill.active i { opacity: 1; color: var(--gt-green); }

/* AI tab — same style, no special color */
.tab-pill--ai { }
.tab-pill--ai.active { color: var(--gt-text); }

/* AI status dot — hidden */
.tab-ai-dot { display: none; }

/* Ask ELI shortcut */
.ask-eli-shortcut { margin-top: 6px; }
.ask-eli-shortcut-btn {
    width: 100%; display: flex; align-items: center; gap: 6px;
    padding: 6px 10px; border-radius: var(--gt-radius-sm);
    border: 1px solid var(--gt-border); cursor: pointer;
    background: transparent;
    color: var(--gt-text-secondary);
    font-size: 0.6875rem; font-weight: 500; font-family: var(--gt-font);
    transition: border-color 100ms ease, color 100ms ease; text-align: left;
}
.ask-eli-shortcut-btn:hover { border-color: var(--gt-green); color: var(--gt-text); }
.eli-shortcut-dot { display: none; }
.eli-shortcut-arrow { margin-left: auto; font-size: 9px; opacity: 0.4; }

/* Header action buttons */
.panel-header-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

.panel-action-btn, .panel-close-btn {
    width: 26px; height: 26px;
    border: none; border-radius: var(--gt-radius-sm);
    background: transparent;
    color: var(--gt-text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px;
    transition: color 100ms ease, background 100ms ease;
}
.panel-action-btn:hover { background: var(--gt-overlay-active); color: var(--gt-text-secondary); }
.panel-close-btn:hover { background: rgba(139,58,58,0.1); color: var(--gt-error); }
[data-theme="light"] .panel-action-btn:hover { background: rgba(0,0,0,0.04); }

/* === Tabs (icon tabs below header) === */
.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--gt-border);
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    padding: 6px 4px;
    border: none;
    background: transparent;
    color: var(--gt-text-muted);
    font-size: 0.6875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    position: relative;
    font-family: var(--gt-font);
    transition: color 100ms ease;
    user-select: none;
}
.tab-btn i { font-size: 0.875rem; }
.tab-btn .tab-label { font-size: 0.625rem; }
.tab-btn:hover { color: var(--gt-text-secondary); }

.tab-btn.active { color: var(--gt-green); }
.tab-btn.active i { color: var(--gt-green); }
.tab-btn.active .tab-label { font-weight: 600; }
.tab-btn.active::after {
    content: '';
    position: absolute; bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 24px; height: 2px;
    background: var(--gt-green);
    border-radius: 1px;
}

/* === Panel Content === */
.panel-content {
    padding: 0;
    overflow-y: auto;
    scrollbar-gutter: stable;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.panel-content::-webkit-scrollbar { width: 4px; }
.panel-content::-webkit-scrollbar-track { background: transparent; }
.panel-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
[data-theme="light"] .panel-content { scrollbar-color: rgba(0,0,0,0.1) transparent; }
[data-theme="light"] .panel-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); }

/* === Tab Content === */
.tab-content { display: none; height: 100%; overflow: hidden; position: relative; }
.tab-content.active { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
#conversationContent { display: none; flex-direction: column; height: 100%; }
#conversationContent.active { display: flex; height: 100%; padding: 0; }
#documentationContent.active { display: block !important; height: 100%; padding: 12px; overflow-y: auto; }
.tab-content#currentContent.active { overflow-y: auto; }

/* === Analysis Results === */
.analysis-results {
    padding: 6px;
    display: flex; flex-direction: column; gap: 4px;
}

#analysisResults {
    margin: 6px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    overflow: hidden;
    display: flex; flex-direction: column;
}
[data-theme="light"] #analysisResults {
    background: rgba(0,0,0,0.02);
    border-color: rgba(0,0,0,0.06);
}

/* Result cards */
.result-card {
    background: transparent;
    border: none; border-radius: 0;
    box-shadow: none; margin: 0;
    overflow: hidden;
}
.result-card + .result-card,
.result-card + .ai-suggestions-section,
.ai-suggestions-section + .result-card {
    border-top: 1px solid rgba(255,255,255,0.05);
}
[data-theme="light"] .result-card + .result-card,
[data-theme="light"] .result-card + .ai-suggestions-section,
[data-theme="light"] .ai-suggestions-section + .result-card {
    border-top-color: rgba(0,0,0,0.05);
}

/* Card header — quiet label */
.card-header {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 10px;
    font-size: 9px; font-weight: 700;
    color: var(--gt-text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.card-header i { font-size: 9px; }
[data-theme="light"] .card-header {
    color: var(--gt-text-muted);
    background: rgba(0,0,0,0.02);
    border-bottom-color: rgba(0,0,0,0.04);
}

/* Card content */
.card-content { padding: 8px 10px; line-height: 1.5; }

/* === Quick Result (qr-*) Summary === */
.summary-card .card-content { padding: 0; }
.qr-root { padding: 10px 12px; }
.qr-header { margin-bottom: 10px; }
.qr-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.qr-icon-box {
    width: 34px; height: 34px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 15px;
}
.qr-title-text { flex: 1; min-width: 0; }
.qr-name {
    font-size: 13px; font-weight: 700;
    color: var(--gt-text);
    letter-spacing: -0.01em; line-height: 1.2;
}
[data-theme="light"] .qr-name { color: var(--gt-text); }
.qr-date {
    font-size: 10px; color: var(--gt-text-muted);
    margin-top: 2px; font-variant-numeric: tabular-nums;
    display: flex; align-items: center; gap: 4px;
}
.qr-date i { font-size: 8px; opacity: 0.6; }

/* Status badge */
.qr-status {
    display: flex; align-items: center; gap: 7px;
    padding: 6px 10px; border-radius: 4px;
    border-left: 3px solid;
}
.qr-status-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
    animation: dotPulse 2s ease-in-out infinite;
}
.qr-status-label { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }

/* Key metric — the big number */
.qr-key-metric {
    text-align: center;
    padding: 8px 0 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
[data-theme="light"] .qr-key-metric { border-bottom-color: rgba(0,0,0,0.05); }
.qr-key-value {
    font-size: 32px; font-weight: 800;
    font-family: var(--gt-mono);
    line-height: 1; font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.qr-key-suffix { font-size: 16px; font-weight: 600; opacity: 0.5; }
.qr-key-label {
    font-size: 10px; font-weight: 600;
    color: var(--gt-text-muted);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-top: 4px;
}

/* Scale bar — instrument gauge */
.qr-scale-bar {
    margin-top: 8px;
    padding: 0 4px;
}
.qr-scale-track {
    height: 6px;
    border-radius: 3px;
    position: relative;
    overflow: visible;
}
.qr-scale-needle {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 12px;
    background: var(--gt-text);
    border-radius: 1px;
    transform: translateX(-50%);
    box-shadow: 0 0 4px rgba(0,0,0,0.4);
}
[data-theme="light"] .qr-scale-needle {
    background: var(--gt-text);
    box-shadow: 0 0 4px rgba(0,0,0,0.2);
}
.qr-scale-labels {
    position: relative;
    height: 14px;
    margin-top: 2px;
}
.qr-scale-labels span {
    position: absolute;
    transform: translateX(-50%);
    font-size: 8px;
    font-family: var(--gt-mono);
    color: var(--gt-text-muted);
    font-variant-numeric: tabular-nums;
}

/* Cloud cover */
.qr-cloud-bar { display: flex; align-items: center; gap: 6px; padding: 4px 0; margin-bottom: 4px; }
.qr-cloud-icon { font-size: 10px; color: var(--gt-text-muted); width: 14px; text-align: center; }
.qr-cloud-track { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.06); overflow: hidden; }
[data-theme="light"] .qr-cloud-track { background: rgba(0,0,0,0.06); }
.qr-cloud-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.qr-cloud-pct { font-size: 9px; font-weight: 600; min-width: 52px; text-align: right; }
.qr-cloud-warning {
    font-size: 9px; color: var(--gt-warning);
    background: rgba(188,108,37,0.08);
    border-radius: 4px; padding: 4px 8px; margin-bottom: 6px;
    display: flex; align-items: flex-start; gap: 5px; line-height: 1.4;
}
.qr-cloud-warning i { margin-top: 1px; flex-shrink: 0; }

/* Metric pills */
.qr-metrics { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.qr-metric {
    display: flex; flex-direction: column; align-items: center;
    background: rgba(255,255,255,0.04);
    border-radius: 4px; padding: 4px 8px; min-width: 52px;
}
[data-theme="light"] .qr-metric { background: rgba(0,0,0,0.03); }
.qr-metric-label {
    font-size: 8px; font-weight: 600;
    color: var(--gt-text-muted);
    letter-spacing: 0.04em; text-transform: uppercase;
}
.qr-metric-value {
    font-size: 11px; font-weight: 700;
    color: var(--gt-text); margin-top: 1px;
    font-family: var(--gt-mono);
    font-variant-numeric: tabular-nums;
}

/* Breakdown bar */
.qr-breakdown { margin-top: 6px; }
.qr-breakdown-label {
    font-size: 9px; color: var(--gt-text-muted);
    font-weight: 600; margin-bottom: 3px;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.qr-breakdown-bar {
    display: flex; height: 4px; border-radius: 2px; overflow: hidden;
    background: rgba(255,255,255,0.06);
}
[data-theme="light"] .qr-breakdown-bar { background: rgba(0,0,0,0.06); }
.qr-breakdown-legend {
    display: flex; justify-content: space-between;
    font-size: 9px; color: var(--gt-text-muted); margin-top: 2px;
}

/* Detail text */
.qr-detail {
    font-size: 11px; color: var(--gt-text-secondary);
    margin-top: 6px; line-height: 1.5;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.05);
}
[data-theme="light"] .qr-detail { border-top-color: rgba(0,0,0,0.05); }

/* === Analysis Sections (legacy) === */
.analysis-section {
    margin-bottom: 6px; padding: 10px;
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
}
[data-theme="light"] .analysis-section { background: rgba(0,0,0,0.02); }

.analysis-section h3 {
    margin: 0 0 8px; font-size: 10px; font-weight: 600;
    color: var(--gt-text-muted);
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    letter-spacing: 0.06em; text-transform: uppercase;
}
[data-theme="light"] .analysis-section h3 { border-bottom-color: rgba(0,0,0,0.06); }
.analysis-section h3::after {
    content: ''; position: absolute; bottom: -1px; left: 0;
    width: 20px; height: 2px;
    background: var(--gt-green); border-radius: 1px;
}

.analysis-section h4 {
    margin: 8px 0 4px; font-size: 10px; font-weight: 600;
    color: var(--gt-text-secondary);
    display: flex; align-items: center; gap: 5px;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.analysis-section h4 i { color: var(--gt-green); font-size: 0.85rem; }

/* Metrics (legacy) */
.metric {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
[data-theme="light"] .metric { border-bottom-color: rgba(0,0,0,0.04); }
.metric:last-child { border-bottom: none; }
.metric .label {
    font-weight: 500; color: var(--gt-text-secondary);
    font-size: 12px; letter-spacing: -0.01em;
}
.metric .value {
    font-weight: 600; color: var(--gt-text);
    font-family: var(--gt-mono); font-size: 12px;
}

.summary {
    background: rgba(255,255,255,0.03); padding: 8px;
    border-radius: 6px; margin-bottom: 6px;
    font-size: 13px; line-height: 1.5; color: var(--gt-text-secondary);
}
[data-theme="light"] .summary { background: rgba(0,0,0,0.02); }

.findings { margin: 0; padding-left: 16px; }
.findings li { margin-bottom: 6px; line-height: 1.4; color: var(--gt-text-secondary); font-size: 12px; }

.confidence {
    margin-top: 10px; padding: 6px 10px;
    background: rgba(45,106,79,0.1); border-radius: 4px;
    font-size: 12px; font-weight: 600; color: var(--gt-green);
    font-family: var(--gt-mono); font-variant-numeric: tabular-nums;
    text-align: center;
}

/* Utility: monospace for data */
.gt-mono { font-family: var(--gt-mono); font-variant-numeric: tabular-nums; }

/* === Metrics Grid (agent results) === */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 4px;
}
.metric-item {
    padding: 6px 8px;
    background: rgba(255,255,255,0.04);
    border-radius: 4px; text-align: center;
}
[data-theme="light"] .metric-item { background: rgba(0,0,0,0.03); }
.metric-item.primary { border-top: 2px solid var(--gt-green); }
.metric-label {
    font-size: 8px; font-weight: 600;
    color: var(--gt-text-muted);
    letter-spacing: 0.05em; text-transform: uppercase;
    margin-bottom: 1px;
}
.metric-value {
    font-size: 13px; font-weight: 700;
    color: var(--gt-text);
    font-family: var(--gt-mono);
    font-variant-numeric: tabular-nums;
}

/* === Loading === */
.loading::before {
    content: ''; position: absolute; top: 0; left: -100%;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--gt-green), transparent);
    animation: loadingShimmer 2s ease-in-out infinite;
}
@keyframes loadingShimmer {
    0% { left: -100%; } 100% { left: 100%; }
}

.spinner {
    width: 32px; height: 32px;
    margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center;
}
.spinner::before {
    content: ''; position: absolute;
    width: 32px; height: 32px; border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--gt-green);
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-core { display: none; }

.loading-text {
    font-size: 12px; color: var(--gt-text-muted);
    font-weight: 500;
}

/* Loading state */
.analysis-loading-state {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 24px 16px; text-align: center; gap: 8px;
}
.loading-icon-ring { width: 40px; height: 40px; margin-bottom: 4px; }
.loading-label { font-size: 13px; font-weight: 600; color: var(--gt-text); }
.loading-sublabel { font-size: 11px; color: var(--gt-text-muted); }
.loading-progress-track {
    width: 180px; height: 2px;
    background: rgba(255,255,255,0.08);
    border-radius: 1px; overflow: hidden; margin-top: 4px;
}
[data-theme="light"] .loading-progress-track { background: rgba(0,0,0,0.06); }
.loading-progress-fill {
    height: 100%;
    background: var(--gt-green);
    border-radius: 1px;
    animation: loadSlide 1.5s ease-in-out infinite;
}
@keyframes loadSlide {
    0%   { transform: translateX(-100%) scaleX(0.5); }
    50%  { transform: translateX(0%) scaleX(0.6); }
    100% { transform: translateX(100%) scaleX(0.5); }
}

/* === Pipeline Loading === */
.pipeline-loading { align-items: flex-start; padding: 16px; gap: 0; }
.pipeline-header {
    font-size: 13px; font-weight: 700; color: var(--gt-text);
    margin-bottom: 16px; width: 100%; text-align: center;
}
.pipeline-steps { display: flex; flex-direction: column; width: 100%; gap: 0; }
.pipeline-step { display: flex; align-items: flex-start; gap: 10px; }
.step-indicator { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 26px; }
.step-dot {
    width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease; z-index: 1;
    position: relative;
}
.step-line { width: 2px; height: 20px; background: var(--gt-border); transition: background 0.3s ease; overflow: hidden; position: relative; }
.step-text { font-size: 12px; line-height: 26px; transition: color 0.3s ease; }

/* Pipeline states */
.pipeline-step.pending .step-dot {
    background: var(--gt-surface-raised); color: var(--gt-text-muted);
    border: 2px solid var(--gt-border);
}
.pipeline-step.pending .step-text { color: var(--gt-text-muted); }

.pipeline-step.active .step-dot {
    background: var(--gt-green); color: #fff;
    border: 2px solid transparent;
    box-shadow: 0 0 0 3px rgba(45,106,79,0.2);
    animation: pulseDot 1.5s ease-in-out infinite;
}
.pipeline-step.active .step-dot::after {
    content: ''; position: absolute; inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--gt-green);
    animation: spin 1s linear infinite;
}
.pipeline-step.active .step-text { color: var(--gt-text); font-weight: 600; }
.pipeline-step.active .step-line {
    background: linear-gradient(180deg, var(--gt-green), var(--gt-border));
}

.pipeline-step.done .step-dot {
    background: var(--gt-green-light); color: #fff;
    border: 2px solid var(--gt-green-light); box-shadow: none; animation: none;
}
.pipeline-step.done .step-dot::after { display: none; }
.pipeline-step.done .step-text { color: var(--gt-text-secondary); font-weight: 400; }
.pipeline-step.done .step-line { background: var(--gt-green-light); }
.pipeline-step.done .step-dot i::before { content: "\f00c"; }

@keyframes pulseDot {
    0%, 100% { box-shadow: 0 0 0 3px rgba(45,106,79,0.2); }
    50% { box-shadow: 0 0 0 8px rgba(45,106,79,0.05); }
}

/* Pipeline footer */
.pipeline-footer {
    width: 100%; margin-top: 16px; padding-top: 12px;
    border-top: 1px solid var(--gt-border);
    display: flex; flex-direction: column; gap: 8px;
}
.pipeline-tip { display: flex; flex-direction: column; gap: 3px; min-height: 40px; }
.tip-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gt-earth); }
.tip-text { font-size: 11px; line-height: 1.5; color: var(--gt-text-secondary); transition: opacity 0.2s ease; }
.tip-text.tip-fade-out { opacity: 0; }
.pipeline-timer { font-size: 10px; color: var(--gt-text-muted); display: flex; align-items: center; gap: 4px; }

/* === Actions Card === */
.actions-card {
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex; flex-direction: column; gap: 6px;
}
[data-theme="light"] .actions-card { border-top-color: rgba(0,0,0,0.05); }

.actions-share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.action-btn {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 10px; border-radius: 6px;
    font-size: 12px; font-weight: 600; cursor: pointer;
    border: none; transition: background 150ms ease;
    white-space: nowrap;
}
.action-btn--share { background: var(--gt-green); color: #fff; }
.action-btn--share:hover { background: var(--gt-green-muted); }
.action-btn--card { background: rgba(45,106,79,0.1); color: var(--gt-green-light); }
.action-btn--card:hover { background: rgba(45,106,79,0.18); }
[data-theme="light"] .action-btn--card { color: var(--gt-green); }

.actions-export-row { display: flex; gap: 4px; }
.action-btn-sm {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px;
    padding: 6px 8px; border-radius: 4px; font-size: 10px; font-weight: 600;
    cursor: pointer; transition: background 150ms ease;
    border: 1px solid; background: transparent;
}
.action-btn--pdf { border-color: rgba(193,18,31,0.15); color: var(--gt-error); }
.action-btn--csv { border-color: rgba(45,106,79,0.15); color: var(--gt-green); }
.action-btn--tiff { border-color: rgba(69,123,157,0.15); color: var(--gt-ocean-light); }
.action-btn--pdf:hover { background: rgba(193,18,31,0.06); }
.action-btn--csv:hover { background: rgba(45,106,79,0.06); }
.action-btn--tiff:hover { background: rgba(69,123,157,0.06); }

.actions-watch-row { display: flex; }
.watch-row-inner { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.watch-row-hint { font-size: 10px; color: var(--gt-text-muted); text-align: center; }
.action-btn-watch {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
    padding: 7px 10px; border-radius: 6px; font-size: 11px; font-weight: 600;
    cursor: pointer; border: 1px solid rgba(45,106,79,0.2);
    background: rgba(45,106,79,0.06); color: var(--gt-green);
    transition: background 150ms ease;
}
.action-btn-watch:hover { background: rgba(45,106,79,0.12); }
.action-btn-watch--active { opacity: 0.6; cursor: default; }

/* Overlay toggle */
.overlay-toggle-bar {
    padding: 4px 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex; justify-content: center; gap: 6px;
}
[data-theme="light"] .overlay-toggle-bar { border-top-color: rgba(0,0,0,0.05); }
.overlay-toggle-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 4px;
    border: 1px solid rgba(45,106,79,0.2);
    background: transparent; color: var(--gt-green-light);
    font-size: 10px; font-weight: 500; cursor: pointer;
    transition: background 150ms ease;
}
.overlay-toggle-btn:hover { background: rgba(45,106,79,0.08); }
.overlay-toggle-btn.active { background: rgba(45,106,79,0.12); border-color: var(--gt-green); }
[data-theme="light"] .overlay-toggle-btn { color: var(--gt-green); }

/* === AI Interpretation === */
.ai-interpretation-card { background: transparent; border: none; }
.ai-card-header {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
[data-theme="light"] .ai-card-header { background: rgba(0,0,0,0.02); border-bottom-color: rgba(0,0,0,0.04); }
.ai-header-left {
    display: flex; align-items: center; gap: 5px;
    font-size: 9px; font-weight: 700; color: var(--gt-text-muted);
    letter-spacing: 0.08em; text-transform: uppercase;
}
.ai-spark-icon { font-size: 11px; color: var(--gt-green-light); }
[data-theme="light"] .ai-spark-icon { color: var(--gt-green); }

.ai-confidence-badge {
    font-size: 9px; font-weight: 600; padding: 2px 7px;
    border-radius: 4px; letter-spacing: 0.02em; border: 1px solid;
}
.ai-confidence-badge.conf-high { background: rgba(45,106,79,0.1); color: var(--gt-green-light); border-color: rgba(45,106,79,0.2); }
.ai-confidence-badge.conf-medium { background: rgba(188,108,37,0.1); color: var(--gt-earth); border-color: rgba(188,108,37,0.2); }
.ai-confidence-badge.conf-low { background: rgba(193,18,31,0.1); color: #f87171; border-color: rgba(193,18,31,0.2); }
[data-theme="light"] .ai-confidence-badge.conf-high { color: var(--gt-green); }
[data-theme="light"] .ai-confidence-badge.conf-medium { color: var(--gt-earth-dark); }
[data-theme="light"] .ai-confidence-badge.conf-low { color: var(--gt-error); }

#aiInterpretationContent { padding: 10px 12px; }
.ai-summary { font-size: 11px; line-height: 1.6; color: var(--gt-text-secondary); }
[data-theme="light"] .ai-summary { color: var(--gt-text-secondary); }
.ai-detailed-section {
    margin-top: 6px; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 6px;
}
[data-theme="light"] .ai-detailed-section { border-top-color: rgba(0,0,0,0.05); }
.ai-detailed-toggle {
    font-size: 10px; font-weight: 600; color: var(--gt-green-light);
    cursor: pointer; list-style: none;
    display: flex; align-items: center; gap: 4px; user-select: none;
}
[data-theme="light"] .ai-detailed-toggle { color: var(--gt-green); }
.ai-detailed-toggle::-webkit-details-marker { display: none; }
.ai-detail-chevron { margin-left: auto; font-size: 8px; transition: transform 0.15s ease; opacity: 0.5; }
details[open] .ai-detail-chevron { transform: rotate(180deg); }
.ai-detailed-body { font-size: 10px; line-height: 1.6; color: var(--gt-text-muted); padding: 6px 0 2px; }
[data-theme="light"] .ai-detailed-body { color: var(--gt-text-secondary); }

.ai-concerns { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.ai-concern-item {
    font-size: 10px; color: var(--gt-earth);
    background: rgba(188,108,37,0.06);
    border-radius: 4px; padding: 4px 8px;
    display: flex; align-items: flex-start; gap: 5px; line-height: 1.5;
}
.ai-concern-item i { margin-top: 1px; flex-shrink: 0; font-size: 9px; }
[data-theme="light"] .ai-concern-item { color: var(--gt-earth-dark); background: rgba(188,108,37,0.05); }

/* Confidence badges */
.confidence-badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: 4px;
    font-size: 10px; font-weight: 600; border: 1px solid;
}
.confidence-badge.high { background: rgba(45,106,79,0.1); color: var(--gt-green-light); border-color: rgba(45,106,79,0.2); }
.confidence-badge.medium { background: rgba(188,108,37,0.1); color: var(--gt-earth); border-color: rgba(188,108,37,0.2); }
.confidence-badge.low { background: rgba(193,18,31,0.1); color: #f87171; border-color: rgba(193,18,31,0.2); }

/* === Suggestions === */
.ai-suggestions-section {
    border-top: 1px solid rgba(255,255,255,0.05);
    padding: 8px 12px;
    display: flex; flex-direction: column; gap: 5px;
}
[data-theme="light"] .ai-suggestions-section { border-top-color: rgba(0,0,0,0.05); }
.suggestions-label {
    font-size: 9px; font-weight: 700;
    color: var(--gt-text-muted);
    text-transform: uppercase; letter-spacing: 0.08em;
    display: flex; align-items: center; gap: 4px;
}
.suggestions-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.suggestion-chip {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 3px 8px; border-radius: 4px;
    font-size: 10px; font-weight: 500; cursor: pointer;
    background: rgba(45,106,79,0.08); color: var(--gt-green-light);
    transition: background 150ms ease;
    white-space: nowrap; user-select: none;
}
.suggestion-chip:hover { background: rgba(45,106,79,0.15); }
[data-theme="light"] .suggestion-chip { background: rgba(45,106,79,0.06); color: var(--gt-green); }
[data-theme="light"] .suggestion-chip:hover { background: rgba(45,106,79,0.1); }

/* Suggestion tooltip */
.suggestion-chip[title]:hover::after {
    content: attr(title);
    position: absolute; bottom: calc(100% + 6px); left: 50%;
    transform: translateX(-50%);
    background: var(--gt-surface-raised); color: var(--gt-text);
    font-size: 10px; font-weight: 400;
    padding: 4px 8px; border-radius: 4px;
    white-space: normal; max-width: 200px; text-align: center;
    z-index: 9999; pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15); line-height: 1.4;
}

/* === Chat Interface === */
.modern-chat-layout {
    display: flex; flex-direction: column; height: 100%; width: 100%; overflow: hidden;
}
.chat-messages-area {
    flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0;
}
.chat-messages-area::-webkit-scrollbar { width: 3px; }
.chat-messages-area::-webkit-scrollbar-track { background: transparent; }
.chat-messages-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
[data-theme="light"] .chat-messages-area::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); }

.chat-messages {
    flex: 1; overflow-y: auto;
    padding: 12px 10px 6px;
    display: flex; flex-direction: column; gap: 10px;
    scroll-behavior: smooth; min-height: 0;
}
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
.chat-messages-area .chat-messages { min-height: auto; padding: 10px 10px 6px; }

/* Welcome */
.chat-welcome { display: flex; justify-content: flex-start; padding: 20px 8px 10px; }
.welcome-bubble {
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 10px; max-width: 100%; text-align: left;
}
.welcome-bubble .bot-avatar {
    width: 28px; height: 28px;
    background: var(--gt-green); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 11px; flex-shrink: 0;
}
.welcome-content {
    background: transparent; border: none; padding: 0;
    color: var(--gt-text-secondary); line-height: 1.6;
}
.welcome-content p { margin: 0; font-size: 13px; }
.welcome-content p + p { margin-top: 3px; color: var(--gt-text-muted); font-size: 12px; }
[data-theme="light"] .welcome-content { color: var(--gt-text-secondary); }

/* Welcome chips */
.welcome-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.welcome-chip {
    font-size: 11px; padding: 5px 10px; border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: var(--gt-text-muted); cursor: pointer;
    transition: background 150ms ease; font-family: inherit;
}
.welcome-chip:hover { background: rgba(45,106,79,0.1); color: var(--gt-green-light); }
[data-theme="light"] .welcome-chip { border-color: rgba(0,0,0,0.08); background: rgba(0,0,0,0.03); color: var(--gt-text-secondary); }
[data-theme="light"] .welcome-chip:hover { background: rgba(45,106,79,0.06); color: var(--gt-green); }

/* Message rows */
.chat-message {
    display: flex; align-items: flex-end; gap: 6px; width: 100%;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.chat-message.user-message { flex-direction: row-reverse; }
.chat-message.assistant-message { flex-direction: row; }

/* Avatars */
.user-avatar, .bot-avatar {
    width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; flex-shrink: 0; margin-bottom: 2px;
}
.user-avatar { background: var(--gt-ocean); color: #fff; }
.bot-avatar { background: var(--gt-green); color: #fff; }
.chat-message.user-message .user-avatar { display: none; }
.chat-message .bot-avatar { align-self: flex-start; margin-top: 2px; }

/* Bubbles */
.message-bubble { word-wrap: break-word; position: relative; max-width: 100%; }
.user-bubble {
    background: rgba(45,106,79,0.2);
    color: var(--gt-text); border-radius: 12px;
    padding: 7px 12px; font-size: 13px; line-height: 1.5;
}
[data-theme="light"] .user-bubble { background: rgba(45,106,79,0.1); color: var(--gt-text); }

.bot-bubble {
    background: transparent; color: var(--gt-text-secondary);
    border: none; padding: 2px 0;
    font-size: 13px; line-height: 1.6; max-width: 100%;
}
[data-theme="light"] .bot-bubble { color: var(--gt-text-secondary); }

.message-content {
    font-size: inherit; line-height: inherit;
    word-break: break-word; background: transparent;
    border: none; padding: 0; max-width: 100%;
}
.message-content p { margin: 0 0 4px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content strong { font-weight: 600; }
.message-content code.inline-code {
    font-family: var(--gt-mono); font-size: 0.88em;
    background: rgba(255,255,255,0.06); padding: 1px 4px; border-radius: 3px;
}
[data-theme="light"] .message-content code.inline-code { background: rgba(0,0,0,0.05); }

.message-time {
    font-size: 9px; margin-top: 2px;
    color: var(--gt-text-muted); opacity: 0;
    transition: opacity 150ms ease; text-align: right;
}
.message-bubble:hover .message-time { opacity: 1; }

/* Copy button */
.chat-msg-actions {
    position: absolute; top: -4px; right: 0;
    opacity: 0; transition: opacity 150ms ease;
    display: flex; gap: 3px; z-index: 2;
}
.chat-message:hover .chat-msg-actions { opacity: 1; }
.chat-msg-copy {
    width: 24px; height: 24px; border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.08);
    background: var(--gt-surface-raised);
    color: var(--gt-text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; transition: color 150ms ease;
}
.chat-msg-copy:hover { color: var(--gt-green-light); }
[data-theme="light"] .chat-msg-copy { background: var(--gt-surface-raised); border-color: rgba(0,0,0,0.08); }
[data-theme="light"] .chat-msg-copy:hover { color: var(--gt-green); }

/* Typing indicator */
.typing-indicator { display: flex; align-items: flex-end; gap: 6px; padding: 4px 0; }
.typing-bubble { display: flex; align-items: flex-end; gap: 6px; }
.typing-dots {
    background: rgba(255,255,255,0.04);
    border-radius: 8px; padding: 8px 12px;
    display: flex; align-items: center; gap: 4px;
}
.typing-dots span {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--gt-green-light);
    animation: typingBounce 1.3s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}
[data-theme="light"] .typing-dots { background: rgba(0,0,0,0.03); }
.typing-text { color: var(--gt-text-muted); font-size: 12px; font-weight: 500; font-style: italic; }

/* === Chat Input === */
.modern-chat-input {
    flex-shrink: 0;
    display: flex; align-items: flex-end; gap: 6px;
    padding: 8px 10px 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
[data-theme="light"] .modern-chat-input { border-top-color: rgba(0,0,0,0.06); }

.new-chat-btn {
    width: 30px; height: 30px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: var(--gt-text-muted);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 12px; flex-shrink: 0;
    transition: color 150ms ease, background 150ms ease;
}
.new-chat-btn:hover { background: rgba(45,106,79,0.15); color: var(--gt-green-light); }
[data-theme="light"] .new-chat-btn { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); color: var(--gt-text-muted); }

.input-field-container {
    flex: 1; display: flex; align-items: flex-end; gap: 6px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; padding: 5px 8px 5px 12px;
    transition: border-color 150ms ease;
}
.input-field-container:focus-within { border-color: var(--gt-green); }
[data-theme="light"] .input-field-container { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); }
[data-theme="light"] .input-field-container:focus-within { border-color: var(--gt-green); }

.input-field-container textarea {
    flex: 1; border: none; outline: none;
    background: transparent; resize: none;
    font-size: 13px; line-height: 1.5;
    color: var(--gt-text); font-family: inherit;
    min-height: 20px; max-height: 100px;
    padding: 3px 0; overflow-y: auto;
}
.input-field-container textarea::placeholder { color: var(--gt-text-muted); font-size: 12px; }
[data-theme="light"] .input-field-container textarea { color: var(--gt-text); }

.input-field-container .send-btn {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--gt-green); color: #fff;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; flex-shrink: 0;
    transition: background 150ms ease;
}
.input-field-container .send-btn:hover { background: var(--gt-green-muted); }
.input-field-container .send-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* Legacy chat input */
.chat-input-container {
    padding: 12px 16px;
    background: var(--gt-surface);
    border-top: 1px solid var(--gt-border);
    display: flex; align-items: flex-end; gap: 10px;
}
.chat-input-wrapper {
    display: flex; align-items: flex-end; gap: 10px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; padding: 6px 10px 6px 14px;
    transition: border-color 150ms ease; flex: 1;
}
.chat-input-wrapper:focus-within { border-color: var(--gt-green); }
[data-theme="light"] .chat-input-wrapper { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); }
.chat-input-wrapper textarea {
    flex: 1; border: none; outline: none;
    background: transparent; resize: none;
    font-size: 12px; line-height: 1.4;
    color: var(--gt-text); font-family: inherit;
    min-height: 18px; max-height: 100px; padding: 3px 0;
}
.chat-input-wrapper textarea::placeholder { color: var(--gt-text-muted); }
.send-btn {
    width: 28px; height: 28px;
    background: var(--gt-green); border: none; border-radius: 50%;
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; flex-shrink: 0;
    transition: background 150ms ease;
}
.send-btn:hover { background: var(--gt-green-muted); }

/* AI Suggestion Chips (chat) */
.ai-suggestions { padding: 8px 12px 4px; }
.ai-suggestions-label { font-size: 10px; color: var(--gt-text-muted); margin-bottom: 6px; font-weight: 500; }
.ai-suggestions-label i { margin-right: 4px; color: var(--gt-earth); }
.ai-suggestions-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ai-chip {
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
    color: var(--gt-text-secondary); font-size: 10px; padding: 4px 8px;
    border-radius: 4px; cursor: pointer; font-family: inherit;
    transition: background 150ms ease;
}
.ai-chip:hover { background: var(--gt-green); color: #fff; border-color: var(--gt-green); }
[data-theme="light"] .ai-chip { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.06); color: var(--gt-text-secondary); }
[data-theme="light"] .ai-chip:hover { background: var(--gt-green); color: #fff; }

/* Inline code in chat */
.inline-code {
    background: rgba(45,106,79,0.1); color: var(--gt-green-light);
    padding: 1px 5px; border-radius: 3px;
    font-family: var(--gt-mono); font-size: 11px;
}
.user-bubble .inline-code { background: rgba(255,255,255,0.15); color: var(--gt-text); }
.bot-bubble .inline-code { background: rgba(45,106,79,0.08); color: var(--gt-green); }

/* AI Chat (inline Q&A in results) */
.ai-chat-card { border-top: 1px solid rgba(255,255,255,0.05); background: transparent; }
[data-theme="light"] .ai-chat-card { border-top-color: rgba(0,0,0,0.05); }
.ai-chat-header {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 6px 12px; font-size: 9px; font-weight: 700;
    color: var(--gt-text-muted); letter-spacing: 0.08em; text-transform: uppercase;
    cursor: pointer; user-select: none;
    background: rgba(255,255,255,0.02);
    transition: background 150ms ease;
}
.ai-chat-header:hover { background: rgba(255,255,255,0.04); }
[data-theme="light"] .ai-chat-header { background: rgba(0,0,0,0.02); }
[data-theme="light"] .ai-chat-header:hover { background: rgba(0,0,0,0.03); }
.ai-chat-chevron { font-size: 9px; color: var(--gt-text-muted); transition: transform 0.15s ease; }

.ai-chat-body { border-top: 1px solid rgba(255,255,255,0.04); display: flex; flex-direction: column; }
.ai-chat-thread {
    max-height: 180px; overflow-y: auto;
    padding: 8px 10px; display: flex; flex-direction: column; gap: 5px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.chat-msg { max-width: 88%; padding: 5px 9px; border-radius: 6px; font-size: 11px; line-height: 1.5; }
.chat-msg-user { align-self: flex-end; background: var(--gt-green); color: #fff; }
.chat-msg-ai {
    align-self: flex-start;
    background: rgba(255,255,255,0.05); color: var(--gt-text-secondary);
}
[data-theme="light"] .chat-msg-ai { background: rgba(0,0,0,0.03); color: var(--gt-text-secondary); }

.chat-thinking { display: flex; align-items: center; gap: 3px; padding: 2px 0; }
.chat-thinking span {
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--gt-text-muted);
    animation: typingBounce 1.1s ease-in-out infinite;
}
.chat-thinking span:nth-child(2) { animation-delay: 0.18s; }
.chat-thinking span:nth-child(3) { animation-delay: 0.36s; }

.ai-chat-input-row {
    display: flex; align-items: center; gap: 5px;
    padding: 6px 8px;
    border-top: 1px solid rgba(255,255,255,0.04);
}
.ai-chat-input {
    flex: 1; border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px; padding: 5px 10px;
    font-size: 11px; outline: none;
    background: rgba(255,255,255,0.04); color: var(--gt-text);
    font-family: inherit;
    transition: border-color 150ms ease;
}
.ai-chat-input::placeholder { color: var(--gt-text-muted); }
.ai-chat-input:focus { border-color: var(--gt-green); }
[data-theme="light"] .ai-chat-input { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); }
[data-theme="light"] .ai-chat-input:focus { border-color: var(--gt-green); }

.ai-chat-send {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--gt-green); color: #fff;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; flex-shrink: 0;
    transition: background 150ms ease;
}
.ai-chat-send:hover { background: var(--gt-green-muted); }

/* === Welcome State === */
.analysis-welcome {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 36px 20px; text-align: center;
    color: var(--gt-text-muted); height: 100%;
}
.analysis-welcome h3 {
    margin: 8px 0 4px; font-size: 13px; font-weight: 600;
    color: var(--gt-text-secondary);
}
.analysis-welcome p {
    margin: 0; font-size: 11px; line-height: 1.5;
    color: var(--gt-text-muted); max-width: 240px;
}

/* === Viz Container === */
.viz-container {
    min-height: 160px;
    background: rgba(255,255,255,0.02);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
}
[data-theme="light"] .viz-container { background: rgba(0,0,0,0.02); }
.chart-placeholder { text-align: center; color: var(--gt-text-muted); }
.chart-placeholder i { font-size: 20px; margin-bottom: 4px; display: block; }
.chart-placeholder p { font-size: 10px; margin: 0; }

/* === Help/Docs === */
.minimal-help-container { padding: 16px; display: flex !important; flex-direction: column; gap: 16px; }
.help-welcome { text-align: center; margin-bottom: 4px; }
.help-welcome h3 { font-size: 16px; font-weight: 600; color: var(--gt-text); margin: 0 0 6px; }
.help-welcome p { font-size: 13px; color: var(--gt-text-secondary); margin: 0; line-height: 1.5; }
[data-theme="dark"] .help-welcome h3 { color: var(--gt-text); }

.ask-section { flex: 1; }
.ask-input-container { display: flex; gap: 10px; }
.ask-input-container textarea {
    flex: 1; border: 1px solid var(--gt-border); border-radius: 6px;
    padding: 10px; font-size: 13px; color: var(--gt-text);
    background: var(--gt-surface-raised); resize: vertical;
    min-height: 60px; font-family: inherit; line-height: 1.4;
}
.ask-input-container textarea:focus { outline: none; border-color: var(--gt-green); }
.ask-btn {
    background: var(--gt-green); color: #fff; border: none;
    border-radius: 6px; padding: 10px 14px; font-size: 13px; font-weight: 500;
    cursor: pointer; display: flex; align-items: center; gap: 5px;
    flex-shrink: 0; height: fit-content;
    transition: background 150ms ease;
}
.ask-btn:hover { background: var(--gt-green-muted); }

.quick-topics { text-align: center; }
.quick-topics p { font-size: 12px; color: var(--gt-text-muted); margin: 0 0 8px; }
.topic-buttons { display: flex !important; flex-wrap: wrap; gap: 6px; justify-content: center; }
.topic-btn {
    background: var(--gt-surface-raised); border: 1px solid var(--gt-border);
    color: var(--gt-text-secondary); padding: 6px 12px; border-radius: 4px;
    font-size: 12px; font-weight: 500; cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}
.topic-btn:hover { background: var(--gt-green); color: #fff; border-color: var(--gt-green); }

.response-area { background: var(--gt-surface-raised); border: 1px solid var(--gt-border); border-radius: 6px; position: relative; margin-top: 12px; }
.response-content { padding: 12px; line-height: 1.6; color: var(--gt-text-secondary); font-size: 13px; }

/* Doc response styling */
.modern-doc-response { line-height: 1.6; font-size: 13px; color: var(--gt-text-secondary); }
[data-theme="dark"] .modern-doc-response { color: var(--gt-text-secondary); }
.doc-h1 {
    font-size: 16px; font-weight: 700; margin: 16px 0 10px;
    padding: 8px 12px; background: var(--gt-green); color: #fff;
    border-radius: 4px; display: flex; align-items: center; gap: 6px;
}
.doc-h2 {
    font-size: 14px; font-weight: 600; color: var(--gt-text); margin: 14px 0 8px;
    padding-bottom: 6px; border-bottom: 2px solid var(--gt-green);
    display: flex; align-items: center; gap: 6px;
}
.doc-h3 { font-size: 13px; font-weight: 600; color: var(--gt-text-secondary); margin: 12px 0 6px; }
.doc-h1 i { color: #fff; }
.doc-h2 i { color: var(--gt-green); }
.doc-paragraph { margin: 8px 0; line-height: 1.6; color: var(--gt-text-secondary); }
.doc-bold { font-weight: 600; color: var(--gt-text); }

.doc-list { margin: 10px 0; padding-left: 0; list-style: none; }
.doc-list-item {
    position: relative; padding: 5px 0 5px 24px; margin: 3px 0; line-height: 1.5;
}
.doc-list-item::before {
    content: ''; position: absolute; left: 8px; top: 12px;
    width: 5px; height: 5px; background: var(--gt-green); border-radius: 50%;
}

.doc-step {
    display: flex; align-items: flex-start; gap: 10px; margin: 12px 0;
    padding: 12px; background: var(--gt-surface-raised); border-radius: 6px;
    border-left: 3px solid var(--gt-green);
}
.step-number {
    width: 24px; height: 24px; background: var(--gt-green); color: #fff;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 12px; flex-shrink: 0;
}
.step-content { flex: 1; line-height: 1.5; color: var(--gt-text-secondary); }

.doc-callout { margin: 12px 0; padding: 10px; border-radius: 6px; display: flex; align-items: flex-start; gap: 8px; border-left: 3px solid; }
.doc-callout.important { background: rgba(193,18,31,0.05); border-color: var(--gt-error); }
.doc-callout.tip { background: rgba(45,106,79,0.05); border-color: var(--gt-green); }
.doc-callout.note { background: rgba(69,123,157,0.05); border-color: var(--gt-ocean-light); }
.doc-callout.warning { background: rgba(188,108,37,0.05); border-color: var(--gt-warning); }
.callout-icon {
    width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; flex-shrink: 0;
}
.doc-callout.important .callout-icon { background: var(--gt-error); color: #fff; }
.doc-callout.tip .callout-icon { background: var(--gt-green); color: #fff; }
.doc-callout.note .callout-icon { background: var(--gt-ocean-light); color: #fff; }
.doc-callout.warning .callout-icon { background: var(--gt-warning); color: #fff; }
.callout-content { flex: 1; line-height: 1.5; color: var(--gt-text-secondary); }

.doc-code-block { margin: 12px 0; border-radius: 6px; overflow: hidden; background: #1b1b1e; border: 1px solid var(--gt-border); }
.code-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; background: #151518; font-size: 11px; color: var(--gt-text-muted); }
.code-header i { margin-right: 5px; color: var(--gt-green); }
.language-label { font-weight: 500; font-family: var(--gt-mono); }
.copy-code-btn { background: var(--gt-surface-raised); border: none; color: var(--gt-text-muted); padding: 3px 6px; border-radius: 3px; font-size: 10px; cursor: pointer; }
.copy-code-btn:hover { color: var(--gt-text); }
.code-content { padding: 12px; margin: 0; overflow-x: auto; background: #1b1b1e; color: var(--gt-text); font-family: var(--gt-mono); font-size: 12px; line-height: 1.5; }
.doc-inline-code { background: var(--gt-surface-raised); color: var(--gt-earth); padding: 1px 5px; border-radius: 3px; font-family: var(--gt-mono); font-size: 11px; }
.doc-link { color: var(--gt-green); text-decoration: none; font-weight: 500; display: inline-flex; align-items: center; gap: 3px; }
.doc-link:hover { text-decoration: underline; }

.doc-table-container { margin: 12px 0; overflow-x: auto; border-radius: 6px; border: 1px solid var(--gt-border); }
.doc-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.doc-table th { background: var(--gt-surface-raised); color: var(--gt-text); font-weight: 600; padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--gt-border); }
.doc-table td { padding: 8px 12px; border-bottom: 1px solid var(--gt-border); color: var(--gt-text-secondary); }
.doc-table tr:hover { background: rgba(255,255,255,0.02); }
[data-theme="light"] .doc-table tr:hover { background: rgba(0,0,0,0.02); }

.doc-loading { display: flex; align-items: center; gap: 6px; padding: 16px; color: var(--gt-text-muted); }
.doc-loading i { color: var(--gt-green); }
.doc-error { display: flex; align-items: center; gap: 6px; padding: 12px; background: rgba(193,18,31,0.05); color: var(--gt-error); border-radius: 4px; }

/* === Message Count Badge === */
.message-count {
    background: var(--gt-green); color: #fff;
    font-size: 9px; font-weight: 700;
    padding: 1px 5px; border-radius: 8px;
    min-width: 16px; height: 16px;
    text-align: center; display: none;
    align-items: center; justify-content: center;
}
.message-count.visible { display: flex; }

/* === Map Layer Actions === */
.map-layer-actions {
    position: absolute; bottom: 60px; right: 320px; z-index: 10;
    background: var(--gt-surface);
    border-radius: 8px; padding: 6px;
    border: 1px solid var(--gt-border);
    box-shadow: var(--gt-shadow);
}
.action-divider, .action-header { display: none; }
.action-buttons { display: flex; gap: 8px; align-items: center; }
.view-on-map-btn { color: var(--gt-green); }
.view-on-map-btn:hover { background: rgba(45,106,79,0.08); color: var(--gt-green); }
.export-layer-btn { color: var(--gt-green-light); }
.export-layer-btn:hover { background: rgba(82,183,136,0.08); }

/* === Notification === */
.notification { font-family: var(--gt-font); animation: slideRight 0.2s ease; }
@keyframes slideRight { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* === Conversation Controls === */
.conversation-controls {
    display: flex; gap: 8px; padding: 10px 12px;
    background: var(--gt-surface); border-top: 1px solid var(--gt-border);
    flex-shrink: 0;
}
.conversation-control-btn {
    flex: 1; padding: 8px 12px;
    border: 1px solid var(--gt-border);
    border-radius: 4px;
    background: var(--gt-surface-raised);
    color: var(--gt-text-secondary);
    font-size: 12px; font-weight: 500; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: color 150ms ease, background 150ms ease;
    font-family: var(--gt-font);
}
.conversation-control-btn:hover { color: var(--gt-green); border-color: var(--gt-green); }

/* === Return Visit Popup === */
.return-visit-popup .leaflet-popup-content-wrapper {
    background: var(--gt-surface); color: var(--gt-text);
    border-radius: 8px; border: 1px solid var(--gt-border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.return-visit-popup .leaflet-popup-tip { background: var(--gt-surface); }
[data-theme="light"] .return-visit-popup .leaflet-popup-content-wrapper {
    background: var(--gt-surface-raised); border-color: var(--gt-border);
}

/* === Focus States === */
.control-btn:focus-visible, .tab-btn:focus-visible, .conversation-control-btn:focus-visible {
    outline: 2px solid var(--gt-green); outline-offset: 2px;
}

/* Selection */
.panel-container ::selection { background: rgba(45,106,79,0.2); }

/* Scroll behavior */
.panel-content, .analysis-content, .conversation-history { scroll-behavior: smooth; }
.analysis-content { flex: 1; overflow-y: auto; padding: 16px; }
#summaryContent { padding: 0; }

/* Analysis content message styling */
.analysis-content .message-time, .result-card .message-time {
    font-size: 9px; opacity: 0.6; margin-left: 6px; font-weight: 500; font-family: var(--gt-mono);
}
.analysis-content .message-content, .result-card .message-content {
    line-height: 1.6; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; margin-top: 6px;
}

/* Documentation sections */
.documentation-sections { display: flex; flex-direction: column; gap: 12px; padding: 12px; max-height: 500px; overflow-y: auto; }
.doc-section { background: var(--gt-surface-raised); border-radius: 6px; padding: 12px; border: 1px solid var(--gt-border); }
.doc-section h4 { margin: 0 0 8px; color: var(--gt-green); font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.quick-help-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.doc-btn {
    background: var(--gt-green); color: #fff; border: none;
    border-radius: 4px; padding: 8px 10px; font-size: 12px; font-weight: 500;
    cursor: pointer; display: flex; align-items: center; gap: 6px; text-align: left;
    transition: background 150ms ease;
}
.doc-btn:hover { background: var(--gt-green-muted); }

/* === Responsive === */
@media (max-width: 1200px) { .simple-analysis-panel { width: 360px; } }
@media (max-width: 1024px) { .simple-analysis-panel { width: 340px; min-width: 300px; top: 70px; } }

@media (max-width: 768px) {
    .simple-analysis-panel { right: 8px; left: 8px; width: auto; top: 58px; height: calc(100vh - 110px); z-index: 900; }
    .simple-analysis-panel.minimized { width: 200px; height: auto; left: auto; }
    .simple-analysis-panel.centered-state { top: 50%; left: 8px; right: 8px; transform: translateY(-50%); width: auto; height: min(70vh, 500px); }
    #analysisResults { margin: 4px; }
    .metrics-grid { grid-template-columns: 1fr 1fr; }
    .conversation-controls { flex-direction: column; }
    .quick-help-buttons { grid-template-columns: 1fr; }
    .action-buttons { flex-direction: column; }
    .action-btn { min-width: unset; width: 100%; }
}

@media (max-width: 640px) {
    .simple-analysis-panel { right: 4px; left: 4px; top: 50px; height: calc(100vh - 140px); z-index: 950; }
}

@media (max-width: 480px) {
    .simple-analysis-panel { right: 2px; left: 2px; top: 46px; height: calc(100vh - 130px); }
    .tab-btn i { display: none; }
}

@media (max-width: 375px) {
    .simple-analysis-panel { top: 42px; height: calc(100vh - 120px); }
}

/* Touch targets */
@media (pointer: coarse) {
    .control-btn { min-width: 32px; min-height: 32px; }
    .tab-btn { min-height: 36px; }
    .action-btn { min-height: 36px; }
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .simple-analysis-panel { -webkit-overflow-scrolling: touch; }
    .control-btn, .tab-btn { -webkit-tap-highlight-color: transparent; }
    .panel-header, .panel-tabs, .control-btn, .tab-btn { user-select: none; }
    .panel-content, .analysis-content, .conversation-history { user-select: text; }
}

/* Landscape */
@media (max-height: 500px) and (orientation: landscape) {
    .simple-analysis-panel { height: calc(100vh - 60px); top: 30px; }
}

/* High contrast */
@media (prefers-contrast: high) {
    .panel-container { border: 2px solid var(--gt-text) !important; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print */
@media print {
    .simple-analysis-panel { position: static !important; width: 100% !important; height: auto !important; }
    .panel-container { background: #fff !important; box-shadow: none !important; border: 1px solid #000 !important; }
    .control-btn, .conversation-controls { display: none !important; }
}
