/* Table Styles */
.dataframe-wrapper { 
    display: flex; /* Use flexbox to manage inner container size */
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin-top: 8px;
    background: white;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}
/* Override AG Grid's transparent filter input backgrounds for both the floating row and the popup menu */
.ag-theme-alpine .ag-floating-filter input,
.ag-theme-alpine .ag-filter-body-wrapper input[type="text"] {
    background-color: white !important; /* !important is needed to override theme defaults */
}
/* Add a visible separator between AG Grid header columns */
.ag-theme-alpine .ag-header-cell {
    border-right: 1px solid #d1d5db; /* gray-300 */
}
/* Darker, stronger table text */
.ag-theme-alpine .ag-cell,
.ag-theme-alpine .ag-header-cell-label {
    color: #111827; /* gray-900 */
    font-weight: 400;
}
/* Compact AG Grid spacing */
.ag-theme-alpine {
    --ag-grid-size: 3px;
}
.grid-auth-banner {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 10px;
    margin: 6px 6px 0 6px;
}

/* Code & Log Styles */
.sql-code { background-color: #ffffff; color: #111827; padding: 12px; border-radius: 6px; font-family: monospace; overflow-x: auto; font-size: 0.8rem; border: 1px solid #e5e7eb; }

/* Markdown Styles */
.markdown-body ul { list-style-type: disc; padding-left: 1.5rem; margin-bottom: 0.5rem; }
.markdown-body ol { list-style-type: decimal; padding-left: 1.5rem; margin-bottom: 0.5rem; }
.markdown-body p { margin-bottom: 0.75rem; }
.markdown-body a { color: #4f46e5; text-decoration: underline; }
.markdown-body strong { color: #111827; font-weight: 700; }
.markdown-body code { background-color: #f3f4f6; padding: 2px 4px; border-radius: 4px; font-size: 0.9em; font-family: monospace; }
.markdown-body,
.markdown-body li,
.markdown-body blockquote,
.markdown-body pre,
.markdown-body code {
    line-height: 1.3;
}
.markdown-body p {
    line-height: 1.3;
}

/* Media sizing */
:root {
    --mol-base: 180px; /* single knob for molecule sizing/spacing */
    --mol-plot-width: 30vw;
    --plot-width: 60vw;
}
/* Plot sizing (as in 2ccf008) */
.plot-output {
    width: var(--plot-width);
    max-width: var(--plot-width);
    min-width: 0;
    margin: 0 auto;
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: 24px;
    position: static;
    z-index: auto;
    clear: both;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0;
    background: #ffffff;
    box-sizing: border-box;
    position: relative;
    aspect-ratio: auto;
}
.page-container {
    width: calc(100% - (2 * var(--page-side-padding)));
    max-width: var(--page-max-width);
    margin: 0 auto;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}
.plot-output img,
.plot-output iframe,
.plot-output .plotly-graph-div {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    display: block;
    min-height: 0;
    margin-bottom: 0;
}
.plot-output iframe,
.plot-output .plotly-graph-div {
    min-height: 0;
}
/* Ensure embedded Plotly graphs stretch to container */
.plot-output .js-plotly-plot,
.plot-output .plot-container {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    height: 100% !important;
    margin-bottom: 0 !important;
}
.plot-output .main-svg {
    width: 100% !important;
    height: 100% !important;
}
.plot-output svg {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    display: block;
}
.plot-body {
    width: 95%;
    height: 95%;
    margin: 2.5% auto 0 auto;
    box-sizing: border-box;
}
.plot-output img {
    object-fit: contain;
}
.plot-download {
    position: absolute;
    left: 8px;
    bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    z-index: 2;
}
.plot-download button {
    font-size: 12px;
    color: #1f2937;
}
.plot-resize-handle {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    border-radius: 3px;
    border: 1px solid rgba(17, 24, 39, 0.7);
    background:
        linear-gradient(135deg, transparent 55%, rgba(31, 41, 55, 0.45) 55%),
        linear-gradient(135deg, transparent 70%, rgba(31, 41, 55, 0.45) 70%),
        linear-gradient(135deg, transparent 85%, rgba(31, 41, 55, 0.45) 85%);
    background-size: 100% 100%;
    opacity: 0.7;
    transition: opacity 120ms ease;
    z-index: 2;
}
.plot-output:hover .plot-resize-handle {
    opacity: 1;
}
.ag-tooltip-custom {
    max-width: 520px;
    max-height: 520px;
    overflow: auto;
    background: #111827;
    color: #f9fafb;
    padding: 10px 12px;
    border-radius: 10px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
    font-size: 12px;
    line-height: 1.35;
    white-space: normal;
}
.ag-tooltip-line {
    margin-bottom: 6px;
}
.ag-tooltip-line:last-child {
    margin-bottom: 0;
}

.mol-output-single {
    width: auto;
    max-width: var(--mol-plot-width);
    min-width: 0;
    margin: 0 auto;
    margin-bottom: 24px;
    display: block;
    overflow: visible;
    position: static;
    z-index: auto;
    clear: both;
}
.mol-output-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 12px;
    width: 100%;
    max-width: 100%;
    --mol-grid-col-width: min(var(--mol-plot-width), calc((100% - 24px) / 3));
    overflow: visible;
    margin-bottom: 24px;
    padding-bottom: 8px;
    position: static;
    z-index: auto;
    clear: both;
}
.mol-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0 0 var(--mol-grid-col-width);
    width: var(--mol-grid-col-width);
    padding: 4px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    max-width: var(--mol-grid-col-width);
    margin: 0;
    overflow: visible;
}
.mol-cell .w-full {
    flex: 1 1 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mol-download {
    margin-top: auto;
    width: 100%;
    text-align: left;
    padding: 0 6px 6px 6px;
}
.mol-img {
    max-width: calc(var(--mol-base) * 1.0) !important;
    max-height: calc(var(--mol-base) * 1.0) !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block;
    margin: 0 auto;
}
.mol-output-single .mol-img {
    max-width: var(--mol-plot-width) !important;
    max-height: 30vh !important;
}
.mol-output-grid .mol-img {
    max-width: var(--mol-plot-width) !important;
    max-height: 30vh !important;
}
/* Constrain inline SVG molecules */
.mol-cell svg,
.mol-output-grid svg,
.mol-output-single svg {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block;
}
.mol-output-single svg {
    max-width: var(--mol-plot-width) !important;
    max-height: 30vh !important;
}
.mol-output-grid svg {
    max-width: var(--mol-plot-width) !important;
    max-height: 30vh !important;
}
.mol-output-single,
.mol-output-grid {
    max-width: 100%;
    overflow: visible;
}
.dataframe-wrapper {
    margin-top: 24px;
    position: static;
    z-index: auto;
    clear: both;
}
/* Wavy text effect for in-progress thought process */
.wavy-text {
    display: inline-block;
    animation: wavy-text 1.2s ease-in-out infinite;
    transform-origin: bottom center;
}
@keyframes wavy-text {
    0% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
    100% { transform: translateY(0); }
}
.thinking-dots {
    display: inline-flex;
    gap: 2px;
    margin-left: 2px;
}
.thinking-dot {
    animation: thinking-dot 1.2s infinite ease-in-out;
    opacity: 0.2;
}
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking-dot {
    0%, 80%, 100% { opacity: 0.2; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}


:root {
    --bg-page: #f5f7fa;
    --bg-surface: #ffffff;
    --bg-subtle: #f0f4f8;
    --text-primary: #16202a;
    --text-secondary: #4b5a6a;
    --text-muted: #6e7b88;
    --text-heading: #0f1b2d;
    --border-default: #d7e0e8;
    --accent-primary: #0b66c3;
    --accent-primary-soft: #e9f2fd;
    --success: #1e8e5a;
    --warning: #a56a00;
    --danger: #b42318;
    --radius-card: 10px;
    --radius-pill: 999px;
    --surface-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 6px 18px rgba(16, 24, 40, 0.06);
    --surface-shadow-soft: 0 1px 1px rgba(16, 24, 40, 0.05), 0 3px 10px rgba(16, 24, 40, 0.05);
    --page-max-width: 1320px;
    --page-side-padding: 36px;
    --font-body: "Avenir Next", "Segoe UI", "Source Sans 3", Tahoma, sans-serif;
    --font-heading: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    --font-mono: "IBM Plex Mono", "Cascadia Mono", Consolas, "Liberation Mono", Menlo, monospace;
    --measure-text: 74ch;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    color: var(--text-primary);
    background: var(--bg-page);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: 0.005em;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-full-width {
    width: 100%;
}

.icon-md {
    width: 20px;
    height: 20px;
}

.icon-sm {
    width: 16px;
    height: 16px;
}

.transition-transform {
    transition: transform 200ms ease;
}

.-rotate-90 {
    transform: rotate(-90deg);
}

.opacity-60 {
    opacity: 0.6;
}

.muted-link {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.muted-link-button {
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.status-text-success {
    font-size: 13px;
    font-weight: 700;
    color: var(--success);
}

.app-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: hidden;
}

.app-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.app-main-stack {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 0;
    width: calc(100% - (2 * var(--page-side-padding)));
    max-width: var(--page-max-width);
    margin: 0 auto;
    min-height: 0;
}

.print-container {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.app-header-shell {
    padding: 18px 0 0;
}

.app-header-card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    box-shadow: var(--surface-shadow);
    padding: 16px 20px 18px;
    box-sizing: border-box;
}

.app-header-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.app-brand {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.header-right-group {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
}

.app-title {
    margin: 0;
    font-family: var(--font-body);
    font-size: 30px;
    line-height: 1.05;
    letter-spacing: 0.005em;
    font-weight: 700;
    color: var(--text-heading);
}

.app-subtitle {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.35;
    color: var(--text-secondary);
}

.app-project-id {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.35;
    font-weight: 600;
    color: var(--text-muted);
}

.header-action-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.app-control-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--border-default);
    padding-top: 12px;
}

.toggle-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.toggle-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch-track {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background-color 120ms ease, box-shadow 120ms ease;
}

.toggle-switch-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #fff;
    transition: transform 120ms ease;
}

.toggle-switch-input:focus-visible + .toggle-switch-track {
    box-shadow: 0 0 0 3px rgba(11, 102, 195, 0.12);
}

.toggle-switch-input:checked + .toggle-switch-track {
    background: #22c55e;
}

.toggle-switch-input:checked + .toggle-switch-track::after {
    transform: translateX(20px);
}

.toggle-name {
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
}

.toggle-state {
    margin-left: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 120ms ease;
}

.toggle-state-on {
    color: var(--success);
}

.toggle-state-off {
    color: var(--text-muted);
}

.llm-segment-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.llm-pill {
    display: inline-flex;
    align-items: center;
}

.llm-pill-label {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 120ms ease;
    cursor: pointer;
}

.llm-pill-active {
    background: var(--accent-primary-soft);
    border-color: #b9d6f5;
    color: var(--accent-primary);
}

.auth-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ui-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all 120ms ease;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.ui-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.ui-btn-sm {
    height: 34px;
    padding: 0 13px;
    font-size: 12px;
}

.ui-btn-md {
    height: 36px;
    padding: 0 14px;
    font-size: 13px;
}

.ui-btn-primary {
    background: var(--accent-primary);
    border-color: #0a5aac;
    color: #fff;
}

.ui-btn-primary:hover:not(:disabled) {
    background: #095cb0;
}

.ui-btn-secondary {
    background: var(--bg-surface);
    border-color: var(--border-default);
    color: var(--text-secondary);
}

.ui-btn-secondary:hover:not(:disabled) {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.ui-btn-warning {
    background: #fff5e5;
    border-color: #f4d59f;
    color: var(--warning);
}

.ui-btn-danger {
    background: #fff1f3;
    border-color: #f3c5ce;
    color: var(--danger);
}

.chat-wrapper {
    display: flex;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    padding-top: 20px;
    padding-bottom: 18px;
    min-height: 280px;
    position: relative;
}

.chat-surface {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    box-shadow: var(--surface-shadow);
    width: 100%;
    height: 100%;
    padding: 24px;
    resize: none;
    box-sizing: border-box;
}

.upload-drop-overlay {
    position: absolute;
    top: 20px;
    right: 0;
    bottom: 18px;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #79aee3;
    border-radius: var(--radius-card);
    background: rgba(240, 247, 255, 0.86);
    box-shadow: inset 0 0 0 2px rgba(31, 115, 190, 0.08);
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
    z-index: 5;
}

.upload-drop-active .upload-drop-overlay {
    opacity: 1;
}

.upload-drop-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 18px 22px;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--surface-shadow-soft);
    text-align: center;
}

.upload-drop-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-heading);
}

.upload-drop-meta {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
}

.chat-scroll {
    overflow: auto;
}

.is-logged-out .chat-wrapper {
    height: auto !important;
    min-height: 0;
}

.is-logged-out .chat-surface {
    width: 100% !important;
    max-width: 100%;
    height: auto;
    min-height: 280px;
    resize: none;
}

.welcome-state {
    margin: 40px auto 12px;
    text-align: center;
    width: 100%;
    max-width: none;
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 24px 18px;
    box-sizing: border-box;
}

.welcome-media {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.welcome-image {
    width: auto;
    max-height: 180px;
}

.welcome-title {
    margin: 0;
    font-family: var(--font-body);
    font-size: 24px;
    font-weight: 600;
    line-height: 1.15;
    color: var(--text-heading);
}

.welcome-text {
    margin: 8px 0 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.chat-input-shell {
    flex: 0 0 auto;
    width: 100%;
    padding-bottom: 10px;
}

.chat-input-container {
    padding: 16px 0 0;
}

.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    background: var(--bg-surface);
    box-shadow: var(--surface-shadow);
    padding: 10px;
    box-sizing: border-box;
}

.icon-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
}

.chat-textarea {
    flex: 1;
    min-height: 42px;
    max-height: 140px;
    resize: none;
    border: 1px solid var(--border-default);
    border-radius: 12px;
    padding: 10px 14px;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.45;
    outline: none;
    color: var(--text-primary);
    background: #fff;
}

.chat-textarea:focus {
    border-color: #9ec4ec;
    box-shadow: 0 0 0 3px rgba(11, 102, 195, 0.1);
}

.send-btn {
    min-width: 84px;
    height: 40px;
    border-radius: 999px;
}

.message-row {
    display: flex;
    width: 100%;
    margin-bottom: 24px;
}

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

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

.message-card {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
    overflow: hidden;
    min-width: 0;
}

.message-card-user {
    background: var(--accent-primary-soft);
    max-width: min(78%, 780px);
}

.message-card-assistant {
    background: var(--bg-surface);
    width: 100%;
    border-left: 3px solid #c6d9ee;
    box-shadow: var(--surface-shadow-soft);
}

.upload-processing-card {
    margin-bottom: 14px;
}

.upload-processing-status {
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(100%, 560px);
    border: 1px solid #d6e1eb;
    border-left: 3px solid #6da6dc;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--surface-shadow-soft);
    padding: 11px 13px;
    box-sizing: border-box;
}

.upload-processing-spinner {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    border: 2px solid #dbe8f5;
    border-top-color: #1f73be;
    border-radius: 999px;
    animation: upload-processing-spin 0.8s linear infinite;
}

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

.upload-processing-text {
    min-width: 0;
}

.upload-processing-title {
    overflow: hidden;
    color: var(--text-heading);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-processing-stage {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
}

.upload-processing-status.is-complete {
    border-left-color: #679d7d;
}

.upload-processing-status.is-complete .upload-processing-spinner {
    animation: none;
    border-color: #679d7d;
    background: #679d7d;
    box-shadow: inset 0 0 0 4px #ffffff;
}

.upload-processing-status.is-error {
    border-left-color: #c75f5f;
}

.upload-processing-status.is-error .upload-processing-spinner {
    animation: none;
    border-color: #c75f5f;
    background: #c75f5f;
}

.response-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.response-section-card {
    border: 1px solid #d6e1eb;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    overflow: hidden;
}

.response-section-card-query {
    border-left: 4px solid #6da6dc;
}

.response-section-card-result {
    border-left: 4px solid #8db9a4;
}

.response-section-card-action {
    border-left: 4px solid #d0ab69;
}

.response-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #dde6ef;
    background: #f7fafe;
}

.response-section-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.response-section-title {
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 700;
    color: #34506a;
}

.response-section-meta {
    font-size: 12px;
    line-height: 1.25;
    font-weight: 600;
    color: #5f7284;
    text-align: right;
}

.response-section-actions {
    display: flex;
    justify-content: flex-end;
    min-width: 0;
}

.response-section-body {
    padding: 13px 14px 14px;
}

.response-section-body-prose {
    display: flex;
    justify-content: center;
    width: 100%;
}

.response-section-body-prose .prose-panel {
    width: min(100%, calc(var(--measure-text) + 2.75rem));
    margin: 0 auto;
    box-sizing: border-box;
}

.response-section-body .details-card:first-child {
    margin-top: 0;
}

.response-section-body .details-card:last-child {
    margin-bottom: 0;
}

.prompt-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    border-bottom: 0;
    background: transparent;
}

.prompt-tabs-btn,
.action-strip-header .ui-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    border: 1px solid #c8d9eb;
    background: #ffffff;
    color: #3a536d;
    border-radius: 999px;
    padding: 0 13px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    box-shadow: none;
    text-decoration: none;
    transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.prompt-tabs-btn:hover,
.action-strip-header .ui-btn:hover {
    background: #f4f8fc;
    border-color: #b9cee3;
    color: #3a536d;
}

.prompt-tabs-btn.is-active {
    background: #0b66c3;
    border-color: #0a5aac;
    color: #ffffff;
}

.prompt-tabs-header {
    align-items: center;
}

.prompt-tabs-header-left {
    flex: 1 1 auto;
    min-width: min(100%, 360px);
}

.prompt-tabs-header .prompt-tabs-nav {
    flex: 1 1 auto;
}

.prompt-tabs-header-note {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
}

.prompt-tabs-header-note strong {
    color: var(--text-primary);
    font-weight: 700;
}

.prompt-tabs-section[data-active-index=""] .prompt-tabs-body {
    display: none;
}

.prompt-tabs-panels {
    padding: 0;
    background: #ffffff;
}

.prompt-tabs-panel[hidden] {
    display: none !important;
}

.prompt-tabs-panel .sql-code {
    margin: 0;
}

.request-progress-card {
    border: 1px solid #c8d8e8;
    border-radius: 10px;
    background: linear-gradient(180deg, #f8fbff 0%, #f2f7fc 100%);
    box-shadow: var(--surface-shadow-soft);
    padding: 12px 14px;
    margin: 10px 2px 20px;
}

.request-progress-title {
    font-size: 12pt;
    letter-spacing: 0;
    text-transform: none;
    font-weight: 400;
    color: #385572;
}

.request-progress-subtitle {
    margin-top: 4px;
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #4b647d;
}

.request-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.python-progress-bar {
    margin-top: 10px;
}

.python-progress-bar.is-hidden {
    display: none;
}

.python-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 5px;
    font-size: 12px;
    line-height: 1.3;
    color: #4b647d;
}

.python-progress-count {
    font-variant-numeric: tabular-nums;
    color: #0b66c3;
    white-space: nowrap;
}

.python-progress-track {
    position: relative;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(11, 102, 195, 0.16);
}

.python-progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0b66c3 0%, #49a1ff 100%);
}

.python-progress-bar.is-indeterminate .python-progress-fill {
    position: absolute;
    width: 38%;
    animation: python-progress-slide 1.1s ease-in-out infinite;
}

@keyframes python-progress-slide {
    0% {
        transform: translateX(-110%);
    }
    100% {
        transform: translateX(280%);
    }
}

.request-progress-steps {
    display: grid;
    gap: 7px;
}

.request-progress-step {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #d5e1ec;
    border-radius: 8px;
    background: #fff;
    padding: 7px 10px;
    transition: border-color 100ms ease, background-color 100ms ease;
}

.request-progress-step-name {
    font-size: 13px;
    line-height: 1.3;
    font-weight: 600;
    color: #2f4861;
}

.request-progress-step-status {
    font-size: 12pt;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: #6a7f92;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.request-progress-step-status-label {
    white-space: nowrap;
}

.request-progress-meter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.request-progress-meter-count {
    min-width: 38px;
    text-align: right;
}

.request-progress-meter-bar {
    width: 72px;
    height: 6px;
    border-radius: 999px;
    background: rgba(11, 102, 195, 0.18);
    overflow: hidden;
}

.request-progress-meter-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0b66c3 0%, #49a1ff 100%);
}

.request-progress-step.is-active {
    border-color: #8eb9e4;
    background: #eef5fd;
}

.request-progress-step.is-active .request-progress-step-status {
    color: #0b66c3;
}

.request-progress-step.is-done {
    border-color: #9cc8b1;
    background: #edf8f2;
}

.request-progress-step.is-done .request-progress-step-status {
    color: #1e8e5a;
}

.request-progress-step.is-error {
    border-color: #efc2c9;
    background: #fff2f4;
}

.request-progress-step.is-error .request-progress-step-status {
    color: #b42318;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-subtle);
    padding: 8px 12px;
}

.section-spacing-sm {
    margin-top: 8px;
}

.section-spacing-md {
    margin-top: 10px;
}

.section-spacing-lg {
    margin-top: 12px;
}

.section-spacing-xl {
    margin-top: 16px;
}

.plot-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.plot-download-stack {
    width: 100%;
    padding-left: 8px;
    text-align: left;
}

.plot-frame {
    width: 100%;
    height: auto;
}

.plot-stack {
    display: flex;
    flex-direction: column;
}

.plot-stack-start {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.content-heading {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-heading);
}

.content-subtle {
    font-size: 13px;
    color: var(--text-secondary);
}

.content-emphasis-box {
    display: block;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    user-select: all;
}

.content-marker {
    font-size: 28px;
    line-height: 1;
}

.meta-notice {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
}

.message-label {
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
}

.message-toggle {
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.message-toggle:hover {
    background: #e5ecf4;
    color: var(--text-secondary);
}

.message-content {
    padding: 14px 16px;
    font-size: 14.5px;
    line-height: 1.62;
    color: var(--text-primary);
    min-width: 0;
}

.message-card-user .message-content {
    padding: 11px 14px;
    font-weight: 500;
}

.message-content .markdown-body {
    font-family: var(--font-body);
    max-width: var(--measure-text);
    color: var(--text-primary);
    font-size: 14.5px;
    line-height: 1.62;
}

.message-content .markdown-body p {
    margin: 0 0 0.85rem;
}

.message-content .markdown-body ul,
.message-content .markdown-body ol {
    margin: 0.35rem 0 0.9rem;
    padding-left: 1.35rem;
}

.message-content .markdown-body h1,
.message-content .markdown-body h2,
.message-content .markdown-body h3 {
    font-family: var(--font-heading);
    color: var(--text-heading);
    line-height: 1.2;
    margin: 0.5rem 0 0.65rem;
}

.message-content .markdown-body h1 { font-size: 24px; }
.message-content .markdown-body h2 { font-size: 21px; }
.message-content .markdown-body h3 { font-size: 18px; }

.message-content .markdown-body code {
    font-family: var(--font-mono);
    font-size: 0.87em;
    background: #eef3f8;
    border: 1px solid #d6e0ea;
    border-radius: 5px;
    padding: 0.1rem 0.32rem;
}

.message-content .markdown-body pre code {
    display: block;
    background: transparent;
    border: none;
    padding: 0;
    font-size: 12px;
    line-height: 1.55;
}

.message-content .markdown-body blockquote {
    border-left: 3px solid #c7d9ed;
    color: #4a637e;
    padding-left: 0.8rem;
    margin-left: 0;
}

.direct-prose {
    max-width: var(--measure-text);
}

.direct-prose .markdown-body > :first-child {
    margin-top: 0;
}

.direct-prose .markdown-body > :last-child {
    margin-bottom: 0;
}

.details-card {
    margin-top: 8px;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    background: #fcfdff;
    overflow: hidden;
}

.details-card > summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-primary);
    padding: 9px 11px;
    background: #f5f9ff;
    border-bottom: 1px solid var(--border-default);
    list-style: none;
}

.details-card > summary::-webkit-details-marker {
    display: none;
}

.sql-code {
    border: 1px solid var(--border-default);
    background: #f8fafc;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
    padding: 11px 13px;
}

.dataframe-wrapper {
    display: block;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    box-shadow: none;
    overflow: auto;
    background: var(--bg-surface);
}

.grid-frame {
    resize: vertical;
    overflow: auto;
    max-width: 100%;
    width: 100%;
}

.grid-frame-fill {
    width: 100%;
    height: 100%;
}

.table-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 4px;
    padding: 7px 9px;
    border: 1px solid #dbe5ef;
    border-radius: 10px;
    background: rgba(245, 247, 250, 0.95);
    backdrop-filter: blur(2px);
    position: sticky;
    top: 8px;
    z-index: 6;
}

.table-toolbar .ui-btn {
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
}

.inline-alert {
    border: 1px solid #f4d59f;
    border-radius: 8px;
    background: #fff7eb;
    color: #8f5d00;
    padding: 8px 10px;
    font-size: 13px;
    margin-top: 8px;
}

.inline-error {
    border: 1px solid #f3c5ce;
    border-radius: 8px;
    background: #fff1f3;
    color: #a31e31;
    padding: 10px 12px;
    font-size: 13px;
    margin-top: 8px;
}

.subtle-note {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
    margin-top: 8px;
}

.helper-block {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.45;
    color: #556577;
}

.helper-block-title {
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #34495d;
}

.helper-block p {
    margin: 0 0 4px;
}

.helper-block p:last-child {
    margin-bottom: 0;
}

.grid-meta {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    margin-top: 2px;
    margin-bottom: 2px;
}

.status-card {
    margin-top: 10px;
    border: 1px solid #dbe5ef;
    border-radius: 10px;
    background: #f8fbfe;
    padding: 12px 14px;
}

.response-section-body > .status-card:first-child {
    margin-top: 0;
}

.status-card-error {
    border-color: #efc7cd;
    background: #fff5f6;
}

.status-card-error .status-card-title {
    color: #8f2431;
}

.status-card-error .status-card-text,
.status-card-error .status-card-text strong {
    color: #7a2a33;
}

.app-startup-alert {
    margin-top: 14px;
}

.status-card-title {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
    color: #24384d;
}

.status-card-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: #506174;
}

.status-card-text strong {
    color: #1f3042;
}

.action-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    border: 1px solid #d6e1eb;
    border-radius: 10px;
    background: #f4f8fc;
}

.action-strip-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.action-strip-header .ui-btn {
    white-space: nowrap;
}

.stack-section {
    margin-top: 10px;
}

.stack-section:first-child {
    margin-top: 0;
}

.section-label {
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.note-block {
    margin-top: 10px;
}

.prose-panel {
    border: 1px solid #dbe6ef;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    padding: 16px 18px;
}

.prose-panel-primary {
    border-left: 4px solid #aac6b4;
}

.prose-panel .markdown-body {
    margin: 0;
}

.prose-panel .markdown-body > :first-child {
    margin-top: 0;
}

.prose-panel .markdown-body > :last-child {
    margin-bottom: 0;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.log-line {
    margin: 0;
    color: #607286;
}

.log-line-error {
    color: #b42318;
}

.reasoning-panel {
    width: 100%;
    border: 1px solid var(--border-default);
    border-radius: 10px;
    background: #fbfdff;
    box-shadow: var(--surface-shadow-soft);
    overflow: hidden;
}

.reasoning-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-default);
    background: #f4f8fc;
    color: #34495d;
    font-size: 13px;
    font-weight: 700;
}

.reasoning-panel-toggle {
    border: none;
    background: transparent;
    color: #6a7f92;
    border-radius: 8px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.reasoning-panel-toggle:hover {
    background: #e5ecf4;
    color: #41586f;
}

.reasoning-panel-body {
    margin: 0;
    padding: 12px;
    white-space: pre-wrap;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-primary);
}

.modal-shell {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
}

.modal-card {
    width: min(100%, 520px);
    border: 1px solid var(--border-default);
    border-radius: 16px;
    background: var(--bg-surface);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.18);
    padding: 20px;
}

.modal-card-compact {
    width: min(100%, 460px);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.modal-title {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--text-heading);
}

.modal-copy {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.modal-close {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
}

.modal-form {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.form-field {
    display: grid;
    gap: 5px;
}

.form-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    box-sizing: border-box;
    min-height: 40px;
    border: 1px solid var(--border-default);
    border-radius: 10px;
    background: #fff;
    padding: 9px 12px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-primary);
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.form-input:focus {
    border-color: #9ec4ec;
    box-shadow: 0 0 0 3px rgba(11, 102, 195, 0.1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.modal-actions-stack {
    flex-direction: column;
    align-items: stretch;
}

.smiles-link-modal-value {
    display: block;
    max-height: 140px;
    overflow: auto;
    border: 1px solid var(--border-default);
    border-radius: 10px;
    background: #f8fafc;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

.smiles-link-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    text-decoration: none;
}

.smiles-link-option-label {
    font-weight: 700;
}

.smiles-link-option-copy {
    font-size: 12px;
    color: var(--text-secondary);
}

.error-text {
    color: #a31e31;
    font-size: 13px;
    line-height: 1.4;
}

.ag-theme-alpine {
    --ag-font-family: var(--font-body);
    --ag-font-size: 13px;
    --ag-grid-size: 2px;
    --ag-header-height: 30px;
    --ag-row-height: 24px;
    --ag-header-foreground-color: #34495d;
    --ag-header-background-color: #f0f4f8;
    --ag-border-color: #d7e0e8;
    --ag-row-border-color: #e8edf3;
    --ag-odd-row-background-color: #ffffff;
    --ag-even-row-background-color: #fafdff;
    --ag-selected-row-background-color: #e9f2fd;
    --ag-cell-horizontal-padding: 10px;
    --ag-header-column-separator-display: block;
    --ag-header-column-separator-color: #d7e0e8;
}

.ag-theme-alpine .ag-header-cell-label {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.01em;
    color: #34495d;
}

.ag-theme-alpine .ag-header-cell-label-with-close {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.ag-theme-alpine .ag-header-close-btn {
    margin-left: auto;
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #6b7a89;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 120ms ease, color 120ms ease;
}

.ag-theme-alpine .ag-header-close-btn:hover:not(:disabled) {
    background: #e8edf3;
    color: #233446;
}

.ag-theme-alpine .ag-header-close-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.ag-theme-alpine .ag-header-cell-text {
    text-transform: none;
}

.ag-theme-alpine .ag-row-number-header,
.ag-theme-alpine .ag-row-number-cell {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.ag-theme-alpine .ag-row-number-cell {
    background: var(--surface-subtle);
    border-right: 1px solid var(--border-default);
    font-weight: 600;
}

.ag-theme-alpine .ag-cell {
    font-family: var(--font-body);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
}

.ag-theme-alpine .ag-floating-filter input,
.ag-theme-alpine .ag-filter-body-wrapper input[type="text"] {
    background-color: #fff !important;
    font-family: var(--font-body);
    font-size: 13px;
}

/* Keep numeric filter operator controls readable in compact theme mode. */
.ag-theme-alpine {
    --ag-list-item-height: 28px;
    --ag-widget-vertical-spacing: 8px;
}

.ag-theme-alpine .ag-simple-filter-body-wrapper > * {
    margin-bottom: 8px;
}

.ag-theme-alpine .ag-filter-condition {
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.ag-theme-alpine .ag-filter-condition-operator {
    min-height: 22px;
    height: auto;
    display: flex;
    align-items: center;
    line-height: 1.2;
}

.ag-theme-alpine .ag-filter-select .ag-picker-field-wrapper,
.ag-theme-alpine input[class^=ag-][type=number]:not(.ag-number-field-input-stepper) {
    min-height: 28px;
    line-height: 1.25;
}

.ag-theme-alpine .ag-select-list-item {
    min-height: 28px;
    display: flex;
    align-items: center;
    line-height: 1.3;
}

.markdown-body,
.markdown-body p,
.markdown-body li,
.markdown-body blockquote,
.markdown-body table,
.markdown-body th,
.markdown-body td {
    font-family: var(--font-body);
}

.markdown-body a {
    color: var(--accent-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.markdown-body strong {
    color: #10243a;
    font-weight: 700;
}

@media (max-width: 900px) {
    :root {
        --page-side-padding: 16px;
    }

    .app-brand {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right-group {
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
    }

    .app-control-bar {
        align-items: flex-start;
    }

    .toggle-group,
    .llm-segment-wrap,
    .auth-group {
        width: 100%;
    }

    .message-card-user {
        max-width: 92%;
    }

    .chat-surface {
        padding: 12px;
    }
}

@media (max-width: 640px) {
    :root {
        --mol-plot-width: 100%;
        --plot-width: 100%;
        --page-side-padding: 12px;
    }

    .app-header-shell {
        padding-top: 12px;
    }

    .app-header-card {
        padding: 14px;
    }

    .app-title {
        font-size: 24px;
    }

    .app-control-bar {
        gap: 10px;
    }

    .toggle-group {
        gap: 10px;
    }

    .toggle-item {
        width: 100%;
        justify-content: space-between;
    }

    .llm-segment-wrap {
        flex-wrap: wrap;
    }

    .chat-wrapper {
        height: auto;
        flex: 0 0 auto;
        padding-top: 14px;
        padding-bottom: 12px;
        min-height: 240px;
    }

    .upload-drop-overlay {
        top: 14px;
        bottom: 12px;
    }

    .upload-drop-panel {
        width: calc(100% - 48px);
        padding: 16px 14px;
        box-sizing: border-box;
    }

    .welcome-state {
        margin-top: 18px;
        padding: 18px 14px;
    }

    .welcome-image {
        max-height: 132px;
    }

    .welcome-title {
        font-size: 20px;
    }

    .chat-input-shell {
        padding-bottom: 8px;
    }

    .chat-input-shell .page-container {
        padding: 12px 0 0;
    }

    .chat-input-row {
        gap: 8px;
        padding: 8px;
    }

    .icon-btn,
    .send-btn {
        height: 38px;
    }

    .icon-btn {
        width: 38px;
        min-width: 38px;
    }

    .send-btn {
        min-width: 72px;
    }

    .chat-textarea {
        min-height: 38px;
        padding: 9px 12px;
    }

    .message-row {
        margin-bottom: 16px;
    }

    .message-content {
        padding: 12px;
    }

    .message-content .markdown-body {
        max-width: 100%;
    }

    .modal-shell {
        padding: 12px;
    }

    .modal-card {
        padding: 16px;
    }

    .modal-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
}

@media print {
    @page {
        margin: 0.5in;
    }

    html,
    body {
        margin: 0;
        background: #fff !important;
        color: #101828 !important;
    }

    .app-header-shell,
    .chat-input-shell,
    .message-toggle,
    .table-toolbar,
    .plot-resize-handle,
    .plot-download,
    .mol-download,
    .ag-header-cell-menu-button,
    .ag-floating-filter,
    .ag-floating-filter-body {
        display: none !important;
    }

    .print-container {
        display: block !important;
        margin: 0 !important;
    }

    .page-container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    #chat-wrapper {
        height: auto !important;
        padding: 0 !important;
    }

    #chat-box {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
        border: none !important;
        box-shadow: none !important;
        resize: none !important;
        background: #fff !important;
        padding: 0 !important;
    }

    .message-row {
        page-break-inside: avoid;
        margin-bottom: 14px;
    }

    /* Keep each prompt with the immediately following result section on print. */
    .message-row-user {
        break-after: avoid-page;
        page-break-after: avoid;
    }

    .message-row-assistant {
        break-before: avoid-page;
        page-break-before: avoid;
    }

    .message-card {
        border: 1px solid #d0d9e4 !important;
        border-radius: 8px !important;
        box-shadow: none !important;
    }

    .message-header {
        background: #f4f7fb !important;
    }

    .message-content {
        font-size: 11pt;
        line-height: 1.45;
    }

    .ag-theme-alpine {
        --ag-font-size: 9pt;
    }

    .ag-theme-alpine .ag-header {
        min-height: 30px !important;
    }
}
