/* ============================================
   SheetAI — Clean Modern CSS
   ============================================ */

:root {
    --bg-body: #f8f9fb;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f3f4f8;
    --bg-hover: #f0f1f5;
    --bg-active: #eef0ff;
    --text-primary: #1a1d2e;
    --text-secondary: #5f6680;
    --text-muted: #9ca3b8;
    --text-inverse: #ffffff;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: rgba(99, 102, 241, 0.08);
    --accent-ring: rgba(99, 102, 241, 0.25);
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.08);
    --green-border: rgba(34, 197, 94, 0.2);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.06);
    --red-border: rgba(239, 68, 68, 0.2);
    --orange: #f59e0b;
    --border: #e5e7eb;
    --border-light: #f0f1f5;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --sidebar-w: 240px;
    --topbar-h: 60px;
    --transition: 200ms ease;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { height: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100%;
    display: flex;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    z-index: 50;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all var(--transition);
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
}

.nav-item.active svg { stroke: var(--accent); }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
}

.data-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.indicator-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.indicator-dot.offline { background: #d1d5db; }
.indicator-dot.online {
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
    animation: dotPulse 2s ease infinite;
}

@keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,0.15); }
    50% { box-shadow: 0 0 0 5px rgba(34,197,94,0.08); }
}

.indicator-label { font-weight: 500; }

/* ===== MAIN AREA ===== */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    flex-shrink: 0;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    padding: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
}

.sidebar-toggle:hover { background: var(--bg-hover); }

.topbar-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-title h1 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    padding: 3px 10px;
    border-radius: 20px;
}

/* ===== CONTENT ===== */
.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
}

.section { display: none; }
.section.active { display: block; }

/* ===== SOURCE TABS ===== */
.source-tabs {
    display: flex;
    gap: 6px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    max-width: 360px;
}

.source-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: 7px;
    transition: all var(--transition);
}

.source-tab:hover { color: var(--text-primary); }

.source-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-xs);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== UPLOAD AREA ===== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-card);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
}

.upload-area.drag-over { transform: scale(1.005); }

.upload-area-inner {
    padding: 48px 24px;
    text-align: center;
}

.upload-icon-wrap {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border-radius: 50%;
    color: var(--accent);
    transition: all var(--transition);
}

.upload-area:hover .upload-icon-wrap {
    background: var(--accent-light);
    transform: translateY(-2px);
}

.upload-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.upload-link {
    color: var(--accent);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.upload-formats {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.format-tag {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 3px 10px;
    border-radius: 5px;
    font-family: 'JetBrains Mono', monospace;
}

/* ===== GOOGLE CARD ===== */
.google-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.field-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition);
}

.field-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
    background: var(--bg-card);
}

.field-hint {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.field-hint em { color: var(--text-secondary); font-style: normal; font-weight: 500; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--transition);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ===== STATUS BAR ===== */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    border-radius: var(--radius);
    margin-top: 20px;
    margin-bottom: 20px;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot-live {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    animation: dotPulse 2s ease infinite;
}

.status-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--green);
}

.status-right {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 50%;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== PREVIEW ===== */
.preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-top: 20px;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
}

.preview-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.preview-table-wrap {
    overflow-x: auto;
    max-height: 320px;
    overflow-y: auto;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.preview-table th {
    background: var(--bg-input);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 16px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.preview-table td {
    padding: 9px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-table tr:hover td {
    background: var(--bg-hover);
}

/* ===== QUERY CARD ===== */
.query-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
}

.query-top { margin-bottom: 12px; }

.query-field-wrap {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.query-field {
    flex: 1;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    transition: all var(--transition);
    line-height: 1.5;
}

.query-field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
    background: var(--bg-card);
}

.query-field::placeholder {
    color: var(--text-muted);
    font-size: 13px;
}

.btn-send {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
    transform: translateY(-1px);
}

.btn-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-send .loader-icon { display: none; }
.btn-send.loading .send-icon { display: none; }
.btn-send.loading .loader-icon { display: block; }

/* ===== QUICK ACTIONS ===== */
.quick-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.quick-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-right: 2px;
}

.quick-btn {
    padding: 5px 12px;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}

.quick-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: rgba(99,102,241,0.2);
}

/* ===== RESULTS ===== */
.results-area { margin-top: 0; }

.result-text-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    line-height: 1.8;
    font-size: 14px;
    margin-bottom: 20px;
}

.result-text-card h1, .result-text-card h2, .result-text-card h3 {
    color: var(--text-primary);
    font-weight: 700;
    margin: 20px 0 8px;
}

.result-text-card h1:first-child,
.result-text-card h2:first-child,
.result-text-card h3:first-child { margin-top: 0; }

.result-text-card h1 { font-size: 20px; }
.result-text-card h2 { font-size: 17px; }
.result-text-card h3 { font-size: 15px; }

.result-text-card p { margin-bottom: 10px; color: var(--text-primary); }
.result-text-card ul, .result-text-card ol { margin: 8px 0 8px 20px; }
.result-text-card li { margin-bottom: 4px; color: var(--text-secondary); }
.result-text-card strong { color: var(--accent); font-weight: 600; }
.result-text-card em { color: var(--orange); font-style: normal; }

.result-text-card code {
    background: var(--bg-input);
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
}

.result-text-card pre {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    overflow-x: auto;
    margin: 12px 0;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
}

.result-text-card table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 13px;
}

.result-text-card table th,
.result-text-card table td {
    padding: 9px 14px;
    border: 1px solid var(--border);
    text-align: left;
}

.result-text-card table th {
    background: var(--bg-input);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ===== CHARTS ===== */
.result-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
    text-align: center;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    max-height: 380px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 14px;
    margin-top: 12px;
    line-height: 1.6;
}

/* ===== HISTORY ===== */
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.history-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.history-item:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.history-query {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.history-time {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: 16px;
    font-family: 'JetBrains Mono', monospace;
}

/* ===== LOADING ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(248, 249, 251, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
}

.loading-card {
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 40px;
    box-shadow: var(--shadow-lg);
}

.loading-spinner { margin-bottom: 14px; }

.loading-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ===== TOASTS ===== */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease;
    max-width: 380px;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-success {
    background: var(--bg-card);
    border: 1px solid var(--green-border);
    color: var(--green);
}

.toast-error {
    background: var(--bg-card);
    border: 1px solid var(--red-border);
    color: var(--red);
}

.toast-info {
    background: var(--bg-card);
    border: 1px solid rgba(99,102,241,0.2);
    color: var(--accent);
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-8px); }
}

/* ===== UTILITIES ===== */
.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
        z-index: 100;
    }

    .sidebar.open { transform: translateX(0); }

    .sidebar-toggle { display: block; }

    .main-area { width: 100%; }

    .content-scroll { padding: 20px 16px; }

    .result-charts { grid-template-columns: 1fr; }

    .source-tabs { max-width: 100%; }

    .input-row { flex-direction: column; }

    .status-bar { flex-direction: column; gap: 8px; }
    .status-right { max-width: 100%; text-align: left; }
}

@media (max-width: 500px) {
    .upload-area-inner { padding: 32px 16px; }
    .topbar { padding: 0 16px; }
    .query-card { padding: 16px; }
    .result-text-card { padding: 18px; }
}

/* ---- Sheet Selector Tabs ---- */
.sheet-selector-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #f8f9fc;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow-x: auto;
}
.sheet-selector-label {
    font-size: 13px;
    font-weight: 600;
    color: #5f6680;
    white-space: nowrap;
}
.sheet-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}
.sheet-tab {
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #5f6680;
    font-size: 12px;
    font-family: Inter, sans-serif;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.sheet-tab:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #f0f0ff;
}
.sheet-tab.active {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}
.result-sheet-badge {
    display: inline-block;
    padding: 4px 12px;
    margin-bottom: 12px;
    background: #f0f0ff;
    color: #6366f1;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}
.history-sheet {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 6px;
    background: #f0f0ff;
    color: #6366f1;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

/* ---- Model Selector Section ---- */
.sidebar-section {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
}
.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.model-select {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}
.model-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.model-select:hover {
    border-color: var(--accent);
}
.model-price-hint {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 5px;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -0.2px;
}

/* ---- Cost Display ---- */
.cost-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
    transition: all 0.3s ease;
}
.cost-display.cost-updated {
    animation: costPulse 0.6s ease;
}
@keyframes costPulse {
    0% { background: transparent; }
    30% { background: rgba(99,102,241,0.06); }
    100% { background: transparent; }
}
.cost-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cost-icon {
    flex-shrink: 0;
    color: var(--accent);
}
.cost-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.cost-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -0.3px;
}
.cost-requests {
    font-size: 11px;
    color: var(--text-muted);
    padding-left: 26px;
    font-family: 'JetBrains Mono', monospace;
}

/* ---- Result Usage Badge ---- */
.result-usage-badge {
    display: inline-block;
    padding: 4px 12px;
    margin-bottom: 12px;
    margin-left: 6px;
    background: var(--bg-input);
    color: var(--text-muted);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
}

/* ---- History meta row ---- */
.history-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.history-model {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-input);
    color: var(--text-muted);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
}
.history-cost {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(99,102,241,0.06);
    color: var(--accent);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}
