@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600;700&family=Sora:wght@500;700;800&display=swap');

:root {
    --bg: #f3f5f7;
    --panel: #ffffff;
    --panel-soft: #f7fafb;
    --ink: #122430;
    --muted: #5d6f79;
    --line: #d3dee4;
    --line-strong: #a6bac4;
    --primary: #0d8486;
    --primary-dark: #07676d;
    --accent: #ef9232;
    --danger-bg: #fff0e8;
    --danger-ink: #9c4018;
    --success: #19875a;
    --shadow: 0 18px 44px rgba(18, 38, 52, 0.1);
    --radius: 18px;
    --sidebar-width: 292px;
    --header-height: 72px;
    --modal-gap: 20px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at 15% 20%, #d9eff3 0%, transparent 50%),
                radial-gradient(circle at 85% 10%, #f9e8d7 0%, transparent 44%),
                radial-gradient(circle at 50% 100%, #e4ecf5 0%, transparent 40%),
                var(--bg);
    line-height: 1.5;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(18, 38, 52, 0.05) 0.55px, transparent 0.55px);
    background-size: 3px 3px;
    opacity: 0.12;
    z-index: 0;
}

body.modal-open {
    overflow: hidden;
}

.orb {
    position: fixed;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    filter: blur(56px);
    opacity: 0.28;
    pointer-events: none;
    z-index: 0;
}

.orb-left {
    top: -100px;
    left: -70px;
    background: #8dc9d3;
}

.orb-right {
    top: 12px;
    right: -84px;
    background: #f3b078;
}

.app-shell {
    position: relative;
    z-index: 2;
    min-height: 100vh;
}

.chat-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 42;
    padding: 18px 16px;
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 16px;
    border-right: 1px solid rgba(106, 132, 145, 0.25);
    background: rgba(244, 248, 250, 0.94);
    backdrop-filter: blur(16px);
    transform: translateX(-110%);
    transition: transform 220ms ease;
}

.sidebar-brand {
    display: grid;
    gap: 4px;
}

.sidebar-actions {
    display: grid;
    gap: 8px;
}

.sidebar-section {
    min-height: 0;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 10px;
}

.sidebar-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sidebar-section-head h2 {
    margin: 0;
    font-size: 0.95rem;
    font-family: 'Sora', sans-serif;
}

.sidebar-sessions {
    overflow: auto;
    padding-right: 4px;
    display: grid;
    gap: 8px;
    align-content: start;
}

.sidebar-session {
    display: grid;
    gap: 2px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 10px;
    text-decoration: none;
    color: inherit;
    background: #fff;
    transition: border-color 160ms ease, transform 160ms ease;
}

.sidebar-session strong {
    font-size: 0.9rem;
}

.sidebar-session span {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: capitalize;
}

.sidebar-current-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    border-radius: 999px;
    padding: 2px 9px;
    border: 1px solid #9cd3b7;
    background: #e7f8ee;
    color: #1f6b45;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: lowercase;
}

.sidebar-session:hover,
.sidebar-session.active {
    border-color: #91bac8;
    transform: translateY(-1px);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 38;
    background: rgba(9, 22, 30, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

body.sidebar-open .chat-sidebar {
    transform: translateX(0);
}

body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(106, 132, 145, 0.24);
    background: rgba(243, 245, 247, 0.82);
}

.header-start {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 10px;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
}

.icon-button:hover {
    border-color: #8bb2c0;
}

.brand {
    text-decoration: none;
    color: var(--ink);
    font-weight: 800;
    font-family: 'Sora', sans-serif;
    letter-spacing: 0.06em;
    font-size: 1.04rem;
}

.brand-stack {
    display: grid;
    gap: 2px;
}

.brand-kicker {
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 14px;
}

.ghost-button {
    border: 0;
    background: transparent;
    color: var(--primary-dark);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.ghost-button:hover {
    text-decoration: underline;
}

.ghost-button:disabled {
    opacity: 0.5;
    cursor: wait;
}

.signin-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.signin-panel {
    width: min(520px, 92vw);
    display: grid;
    gap: 14px;
}

.page-wrap {
    position: relative;
    z-index: 2;
    width: min(1060px, 92vw);
    margin: 30px auto 56px;
    display: grid;
    gap: 18px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    position: relative;
    overflow: clip;
}

body.status-page .app-shell {
    height: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr;
}

body.status-page .page-wrap {
    margin: 12px auto;
    height: calc(100dvh - var(--header-height));
    overflow: hidden;
}

body.status-page .chat-panel-fixed {
    position: relative;
    bottom: auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
}

.panel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.45);
}

.hero-panel h1,
.panel h1 {
    margin-top: 4px;
    margin-bottom: 8px;
    font-family: 'Sora', sans-serif;
    font-size: clamp(1.45rem, 1.1rem + 1.2vw, 2rem);
    line-height: 1.2;
}

.panel h2 {
    margin: 0 0 8px;
    font-family: 'Sora', sans-serif;
    font-size: 1.15rem;
}

.eyebrow {
    margin: 0;
    color: var(--primary-dark);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.subtle {
    margin: 0;
    color: var(--muted);
}

.primary-btn {
    border: 0;
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #15a1a4);
    transition: transform 180ms ease, box-shadow 180ms ease;
    box-shadow: 0 10px 22px rgba(13, 132, 134, 0.3);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-btn:hover {
    transform: translateY(-1px);
}

.primary-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ghost-link {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 600;
}

.ghost-link:hover {
    text-decoration: underline;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    gap: 10px;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.75rem;
    border: 1px solid var(--line);
    background: #f6f7f4;
    color: #2b3a40;
}

.session-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.session-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    text-decoration: none;
    color: inherit;
    background: linear-gradient(180deg, #ffffff, #fbfdff);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.session-card:hover {
    border-color: #9fc4d2;
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(19, 47, 62, 0.08);
}

.session-main,
.session-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cap-grid {
    margin-top: 16px;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.cap-card {
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 16px;
    background: linear-gradient(160deg, #ffffff 0%, #f3f9fc 100%);
    display: grid;
    gap: 12px;
}

.form-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-grid label {
    display: grid;
    gap: 6px;
    font-weight: 600;
    font-size: 0.95rem;
}

.form-grid input,
.form-grid textarea {
    width: 100%;
    border: 1px solid #b6c2be;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    color: inherit;
    background: #fff;
}

.form-grid input:focus,
.form-grid textarea:focus {
    border-color: var(--primary);
    outline: 2px solid rgba(15, 138, 119, 0.18);
    outline-offset: 1px;
}

.form-grid textarea {
    resize: vertical;
    min-height: 180px;
}

.span-2 {
    grid-column: span 2;
}

.action-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.hidden {
    display: none !important;
}

.success-text {
    color: var(--success);
    font-weight: 700;
}

.error-stack {
    margin: 12px 0;
    display: grid;
    gap: 10px;
}

.error-card {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #f4c9b8;
    background: var(--danger-bg);
    color: var(--danger-ink);
}

.compact-list {
    margin: 0;
    padding-left: 18px;
}

.compact-list li {
    margin: 4px 0;
}

.review-grid {
    margin-top: 14px;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.review-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 14px;
}

.review-card dl {
    margin: 0;
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 6px 10px;
}

.review-card dt {
    color: var(--muted);
    font-weight: 700;
}

.review-card dd {
    margin: 0;
}

.review-api-card {
    margin-top: 12px;
}

.review-actions {
    margin-top: 14px;
}

.command-center {
    display: grid;
    gap: 12px;
}

.modal-trigger {
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    padding: 10px 14px;
    background: #fff;
}

.modal-shell {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: start center;
    padding: calc(var(--header-height) + var(--modal-gap)) var(--modal-gap) var(--modal-gap);
    --modal-shift: 0px;
    transition: padding 260ms ease;
}

.modal-shell.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 22, 29, 0.52);
}

body.sidebar-open .modal-shell {
    --modal-shift: calc(var(--sidebar-width) / 2);
}

.modal-card {
    position: relative;
    z-index: 1;
    width: min(980px, calc(100vw - 40px));
    max-height: calc(100vh - var(--header-height) - (var(--modal-gap) * 2));
    border-radius: 16px;
    border: 1px solid var(--line-strong);
    background: #f8fcff;
    box-shadow: 0 24px 60px rgba(17, 35, 46, 0.28);
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    transform: translateX(var(--modal-shift));
    transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-wide {
    width: min(1100px, calc(100vw - 40px));
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
}

.modal-head h2 {
    margin: 0;
    font-size: 1rem;
}

.modal-body {
    overflow: auto;
    padding: 14px;
    display: grid;
    gap: 12px;
}

.modal-inner-panel {
    margin: 0;
}

.status-shell {
    display: grid;
    gap: 14px;
}

.status-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}

.poll-badge {
    display: grid;
    gap: 6px;
    justify-items: end;
}

.poll-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    font-size: 0.78rem;
    font-weight: 700;
    background: #eef5f8;
}

.poll-chip::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #f29e50;
    box-shadow: 0 0 0 0 rgba(242, 158, 80, 0.5);
}

.poll-chip[data-active="true"]::before {
    background: var(--success);
    animation: pollPulse 1.4s ease-out infinite;
}

@keyframes pollPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(25, 135, 90, 0.45);
    }
    100% {
        box-shadow: 0 0 0 9px rgba(25, 135, 90, 0);
    }
}

.status-head {
    margin-top: 2px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.kpi-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-tile {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff, #f4f9fc);
    padding: 12px;
    display: grid;
    gap: 4px;
}

.kpi-tile span {
    color: var(--muted);
    font-size: 0.82rem;
}

.kpi-tile strong {
    font-family: 'Sora', sans-serif;
    font-size: 1.46rem;
    line-height: 1;
}

.summary-card {
    background: var(--panel-soft);
}

.summary-dl {
    margin: 0;
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 8px 12px;
}

.summary-dl dt {
    color: var(--muted);
    font-weight: 700;
}

.summary-dl dd {
    margin: 0;
    font-weight: 600;
}

.summary-failures {
    margin-top: 12px;
    border-top: 1px dashed var(--line);
    padding-top: 10px;
}

.summary-failures h3 {
    margin: 0 0 8px;
    font-size: 0.95rem;
}

.summary-failures ul {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
}

.summary-failures li {
    display: grid;
    gap: 2px;
}

.summary-failures span {
    color: var(--muted);
    font-size: 0.83rem;
}

.timeline {
    margin-top: 12px;
    display: grid;
    gap: 10px;
}

.timeline-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    background: #fff;
    display: grid;
    gap: 6px;
    position: relative;
}

.timeline-rich .timeline-item {
    padding-left: 18px;
}

.timeline-rich .timeline-item::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 16px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #8aa7b5;
}

.timeline-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.timeline-meta strong {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.step-seq {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border: 1px solid var(--line);
    background: #f3f8fa;
    color: #28424f;
}

.timeline-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 5px 10px;
    border: 1px solid var(--line);
    background: #f6f9fa;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #8ea5b0;
    flex: 0 0 12px;
}

.timeline-status-running .status-indicator {
    background: transparent;
    border: 2px solid rgba(13, 132, 134, 0.28);
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

.timeline-status-completed .status-indicator {
    background: var(--success);
}

.timeline-status-partial .status-indicator,
.timeline-status-completed_with_warnings .status-indicator {
    background: var(--accent);
}

.timeline-status-failed .status-indicator {
    background: #ce673f;
}

.timeline-status-accepted .status-indicator,
.timeline-status-queued .status-indicator {
    background: #4e8fa4;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.timeline-running {
    border-color: #8fbeb6;
}

.timeline-accepted,
.timeline-queued {
    border-color: #9abed0;
}

.timeline-accepted::before,
.timeline-queued::before {
    background: #4e8fa4;
}

.timeline-running::before {
    background: var(--primary);
}

.timeline-completed {
    border-color: #a7d2bf;
}

.timeline-completed::before {
    background: var(--success);
}

.timeline-partial,
.timeline-completed_with_warnings {
    border-color: #f2c593;
}

.timeline-partial::before,
.timeline-completed_with_warnings::before {
    background: var(--accent);
}

.timeline-failed {
    border-color: #f2b4a0;
}

.timeline-failed::before {
    background: #ce673f;
}

.timeline-details {
    margin: 0;
    border-radius: 8px;
    border: 1px solid #dce4df;
    background: #f8faf8;
    padding: 8px;
    white-space: pre-wrap;
    word-break: break-word;
}

.resource-list {
    margin-top: 8px;
    display: grid;
    gap: 12px;
}

.resource-group {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 12px;
    display: grid;
    gap: 10px;
}

.resource-group > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.resource-group h3 {
    margin: 0;
    text-transform: capitalize;
    font-size: 0.94rem;
}

.resource-chip-list {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.resource-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff, #f4f9fc);
    padding: 10px 12px;
    display: grid;
    gap: 4px;
}

.edit-grid {
    margin-top: 12px;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.edit-apis-form {
    grid-column: span 2;
}

.edit-grid h3,
.edit-history-wrap h3 {
    margin: 0 0 8px;
}

.edit-grid label {
    display: grid;
    gap: 6px;
    font-weight: 600;
    margin-bottom: 8px;
}

.edit-grid input,
.edit-grid textarea,
.context-chat-form textarea {
    border: 1px solid #b6c2be;
    border-radius: 10px;
    padding: 9px 11px;
    font: inherit;
    color: inherit;
    width: 100%;
    background: #fff;
}

.context-chat-form textarea {
    min-height: 44px;
    max-height: 160px;
    resize: vertical;
}

.checkbox-row {
    grid-template-columns: 20px 1fr;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.edit-history-wrap {
    margin-top: 12px;
}

.form-feedback {
    margin: 8px 0 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 0.92rem;
    line-height: 1.4;
    background: #f7fbfd;
    color: var(--muted);
}

.feedback-info {
    border-color: #b8cad3;
    background: #f2f8fc;
    color: #28566f;
}

.feedback-success {
    border-color: #9ccfaf;
    background: #ecf9f1;
    color: #1f6b45;
}

.feedback-warning {
    border-color: #e7c286;
    background: #fff8eb;
    color: #8f5a10;
}

.feedback-error {
    border-color: #e2b0a1;
    background: #fff1ec;
    color: #9c4018;
}

.api-suggestions-panel {
    margin-top: 10px;
    border: 1px solid #d8c79c;
    border-radius: 12px;
    padding: 12px;
    background: linear-gradient(180deg, #fffdf7, #fff7e8);
    display: grid;
    gap: 10px;
}

.api-suggestions-panel h4 {
    margin: 0;
    font-size: 0.96rem;
}

.api-suggestions-list {
    display: grid;
    gap: 10px;
}

.api-suggestion-item {
    border: 1px solid #e2d6b6;
    border-radius: 10px;
    padding: 10px;
    background: #fff;
    display: grid;
    gap: 8px;
}

.api-suggestion-item h5 {
    margin: 0;
    font-size: 0.92rem;
}

.api-suggestion-item ul {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 6px;
}

.api-suggestion-item li {
    display: grid;
    gap: 2px;
    font-size: 0.88rem;
}

.api-suggestions-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-panel {
    background: linear-gradient(180deg, #ffffff, #f5fafc);
}

.chat-tab-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.tab-actions-wrap {
    position: relative;
}

.chat-tab-menu-btn {
    min-width: 40px;
    letter-spacing: 0.09em;
    font-size: 1rem;
}

.tab-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 30px rgba(17, 37, 49, 0.18);
    padding: 8px;
    display: grid;
    gap: 6px;
    min-width: 210px;
    z-index: 8;
}

.tab-menu-item {
    border: 1px solid transparent;
    background: #f6fafc;
    border-radius: 8px;
    padding: 9px 10px;
    text-align: left;
    cursor: pointer;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
}

.tab-menu-item:hover {
    border-color: #9abecd;
    background: #edf6fb;
}

.chat-panel-fixed {
    position: sticky;
    bottom: 10px;
    z-index: 6;
    min-height: calc(100vh - 190px);
    display: grid;
    grid-template-rows: auto auto auto 1fr auto auto;
    gap: 10px;
}

.chat-log {
    margin-top: 10px;
    display: grid;
    gap: 8px;
    max-height: min(46vh, 520px);
    min-height: 280px;
    overflow: auto;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    align-content: start;
    align-items: start;
    grid-auto-rows: max-content;
    padding-right: 4px;
}

.chat-bubble {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff;
    display: grid;
    gap: 5px;
    width: fit-content;
    max-width: min(82%, 760px);
    justify-self: start;
}

.chat-bubble-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.chat-bubble strong {
    text-transform: capitalize;
    font-size: 0.83rem;
    color: #24414f;
}

.chat-bubble-head span {
    color: var(--muted);
    font-size: 0.77rem;
}

.chat-bubble p {
    margin: 0;
    white-space: pre-wrap;
}

.chat-body {
    display: grid;
    gap: 6px;
}

.chat-body p {
    margin: 0;
    white-space: pre-wrap;
}

.chat-body ul {
    margin: 0;
    padding-left: 18px;
}

.chat-body li {
    margin: 0;
}

.current-value-pill {
    background: #f4f8fb;
}

.chat-user {
    border-color: #9dc7d2;
    background: #eaf6fb;
    justify-self: end;
}

.chat-typing {
    border-style: dashed;
    opacity: 0.92;
}

.typing-dots {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #588296;
    opacity: 0.35;
    animation: typing-pulse 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.16s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes typing-pulse {
    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.3;
    }
    40% {
        transform: translateY(-2px);
        opacity: 1;
    }
}

.chat-assistant {
    border-color: #d0dde3;
    background: #ffffff;
    justify-self: start;
}

.context-chat-form {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.job-pill-completed {
    border-color: #a7d2bf;
    background: #edf9f1;
}

.job-pill-completed_with_warnings {
    border-color: #f2c593;
    background: #fff8ec;
}

.job-pill-failed {
    border-color: #f2b4a0;
    background: #fff0eb;
}

.job-pill-running,
.job-pill-queued {
    border-color: #8fbeb6;
    background: #ebf7f5;
}

.error-text {
    color: var(--danger-ink);
    font-weight: 700;
}

code,
.pre {
    font-family: 'IBM Plex Mono', monospace;
}

@media (max-width: 820px) {
    .chat-sidebar {
        width: min(88vw, 320px);
    }

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

    .header-actions .ghost-link {
        display: none;
    }

    .page-wrap {
        width: min(96vw, 980px);
    }

    .chat-panel-fixed {
        position: relative;
        bottom: auto;
        min-height: auto;
    }

    body.status-page .app-shell {
        height: auto;
    }

    body.status-page .page-wrap {
        margin: 20px auto 44px;
        height: auto;
        overflow: visible;
    }

    body.status-page .chat-panel-fixed {
        height: auto;
        max-height: none;
    }

    .modal-shell {
        padding: 12px;
        --modal-shift: 0px;
    }

    body.sidebar-open .modal-shell {
        --modal-shift: 0px;
        padding: 12px;
    }

    .modal-card {
        max-height: calc(100vh - 24px);
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .review-grid {
        grid-template-columns: 1fr;
    }

    .status-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .poll-badge {
        justify-items: start;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .summary-dl {
        grid-template-columns: 1fr;
    }

    .edit-grid {
        grid-template-columns: 1fr;
    }

    .edit-apis-form {
        grid-column: auto;
    }

    .context-chat-form {
        grid-template-columns: 1fr;
    }

    .chat-user,
    .chat-assistant {
        margin-left: 0;
        margin-right: 0;
    }

    .review-card dl {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }

    .action-row {
        flex-wrap: wrap;
    }
}

@media (min-width: 821px) {
    body.status-page:not(.modal-open) {
        overflow: hidden;
    }
}

@media (min-width: 1100px) {
    .app-shell {
        padding-left: 0;
        transition: padding-left 220ms ease;
    }

    body.sidebar-open .app-shell {
        padding-left: var(--sidebar-width);
    }

    .sidebar-backdrop {
        display: none;
    }

    .app-header {
        padding-left: 28px;
        padding-right: 28px;
    }
}
