* {
    box-sizing: border-box;
}

:root {
    --bg: #faf9f7;
    --bg-2: #f6f4f1;
    --panel: rgba(255, 255, 255, 0.65);
    --panel-border: rgba(255, 255, 255, 0.4);
    --text: #252525;
    --muted: #6a6a6a;
    --soft-muted: #aaabae;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    --radius: 14px;
    --accent: #ffb3ab;
    --accent-hover: #ffc7c1;
}

body.accent-coral { --accent: #ffb3ab; --accent-hover: #ffc7c1; }
body.accent-mint { --accent: #b4f4d8; --accent-hover: #ccf7e4; }
body.accent-lavender { --accent: #d9c6ff; --accent-hover: #e6d9ff; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Inter", "SF Pro Display", "Segoe UI Variable", "Helvetica Neue", "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, var(--bg), var(--bg-2));
    color: var(--text);
    letter-spacing: 0.01em;
}

.page-container {
    max-width: 1400px;
    margin: 12px auto 24px;
    padding: 0 16px;
}

.background {
    position: fixed;
    inset: 0;
    background: transparent;
    pointer-events: none;
    z-index: 0;
}

#app {
    position: relative;
    z-index: 1;
    max-width: 100%;
    margin: 20px auto 32px;
    padding: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

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

.glyph {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,255,255,0.7));
    display: grid;
    place-items: center;
    color: #2d2d2d;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow);
}

.brand-text .title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.brand-text .subtitle {
    color: var(--muted);
    font-size: 13px;
}

.badge {
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--panel-border);
    font-size: 13px;
    letter-spacing: 0.3px;
    color: var(--text);
    box-shadow: var(--shadow);
}

.grid {
    display: grid;
    grid-template-columns: 4fr 1fr; /* ~80/20 split */
    gap: 10px;
    margin-top: 8px;
}

.grid.two-col {
    grid-template-columns: 1.1fr 0.9fr;
}

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

.pipeline {
    margin: 10px 0 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pipeline-stage {
    flex: 1;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pipeline-divider {
    width: 28px;
    height: 2px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
}

.pipeline-stage .stage-label {
    font-weight: 700;
    font-size: 14px;
}

.pipeline-stage .stage-caption {
    color: var(--muted);
    font-size: 12px;
}

.pipeline-stage.active {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.pipeline-stage.completed {
    border-style: dashed;
    border-color: rgba(0,0,0,0.12);
    opacity: 0.9;
}

.pipeline-stage.active .stage-label,
.pipeline-stage.active .stage-caption {
    color: #252525;
}

.pipeline-stage.completed .stage-label,
.pipeline-stage.completed .stage-caption {
    color: var(--muted);
}

.panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.eyebrow {
    font-variant-caps: small-caps;
    letter-spacing: 0.08em;
    font-size: 12px;
    color: var(--muted);
    margin: 0 0 6px 0;
}

h1, h2 {
    margin: 0 0 6px 0;
    font-weight: 700;
    letter-spacing: 0.01em;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #252525;
    margin-bottom: 8px;
}

h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #3a3a3a;
    margin-top: 10px;
}

p, label, textarea, input, select {
    color: #252525;
}

.panel-title {
    width: 100%;
}

.subtext {
    margin: 2px 0 0;
}

.intake-header {
    align-items: flex-start;
}

.process-header {
    align-items: flex-end;
}

.small-title {
    font-size: 16px;
}

.right-align {
    text-align: right;
    width: 100%;
}

.lede {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    font-size: 14px;
}

.field-label {
    display: block;
    margin: 18px 0 8px;
    font-size: 13px;
    color: var(--muted);
}

select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    box-shadow: inset 0 1px 0 rgba(0,0,0,0.02);
    background-image: linear-gradient(45deg, transparent 50%, rgba(0,0,0,0.12) 50%), linear-gradient(135deg, rgba(0,0,0,0.12) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

select:focus {
    border-color: rgba(0,0,0,0.16);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.12), 0 0 0 6px rgba(0,0,0,0.05);
    transform: scale(1.01);
}

textarea {
    width: 100%;
    height: 180px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    padding: 14px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

textarea:focus {
    border-color: rgba(0,0,0,0.16);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.12), 0 0 0 6px rgba(0,0,0,0.05);
    transform: scale(1.01);
}

.controls {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 120px;
}

input[type="number"] {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

input[type="number"]:focus {
    border-color: rgba(0,0,0,0.16);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.12), 0 0 0 6px rgba(0,0,0,0.05);
    transform: scale(1.01);
}

button {
    padding: 12px 20px;
    background: var(--accent);
    border: none;
    color: #252525;
    cursor: pointer;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.2px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: 0.15s ease;
}

button:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0) scale(0.99);
}

.btn-primary {
    background: var(--accent);
    color: #252525;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.cta-large {
    padding: 14px 20px;
    font-size: 15px;
    width: 100%;
    text-align: center;
}

.hint {
    margin: 10px 0 6px;
    color: var(--soft-muted);
    font-size: 12px;
}

.intake .hint {
    margin-bottom: 0;
    padding-bottom: 0;
}

.mode-hint {
    margin: 6px 0 12px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.helper {
    color: var(--muted);
    font-size: 12px;
}

.log-section {
    display: flex;
    flex-direction: column;
}

#log_wrapper {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 14px;
    padding: 12px;
    min-height: 160px;
    transition: opacity 0.2s ease, max-height 0.2s ease;
}

.panel-light {
    background: rgba(255, 255, 255, 0.9);
}

#log {
    white-space: pre-wrap;
    font-family: "SFMono-Regular", "JetBrains Mono", "Menlo", monospace;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    padding: 10px;
    max-height: 400px; /* GPT-5.1: Increased from 220px to accommodate collapsible sections */
    overflow: auto;
    color: #2f2f2f;
}

/* GPT-5.1 UPGRADE: Collapsible loop sections */
.loop-section {
    margin: 8px 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.5);
    overflow: hidden;
}

.loop-header {
    cursor: pointer;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.02);
    user-select: none;
    transition: background 0.15s ease;
}

.loop-header:hover {
    background: rgba(0, 0, 0, 0.05);
}

.loop-header::before {
    content: '▶';
    display: inline-block;
    margin-right: 6px;
    transition: transform 0.2s ease;
    font-size: 10px;
}

.loop-section[open] .loop-header::before {
    transform: rotate(90deg);
}

.loop-content {
    margin: 0;
    padding: 10px 12px;
    font-size: 11px;
    line-height: 1.5;
    background: transparent;
    border: none;
}

.status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.status-block {
    flex: 1 1 240px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.status-label {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.04em;
}

.status-value {
    font-weight: 700;
    font-size: 15px;
}

.progress-bar {
    position: relative;
    height: 8px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar #loop_progress {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.2s ease;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-size: 12px;
    border: 1px solid var(--panel-border);
}

.pill.muted {
    color: var(--muted);
}

.pill.action {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.06);
    transition: background 0.15s ease, transform 0.1s ease;
}

.pill.action:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.terminal-title {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.05em;
}

.critiques #critique_content {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 14px;
    padding: 18px;
    min-height: 260px;
    max-height: 520px;
    overflow: auto;
    line-height: 1.7;
    font-size: 14px;
    box-shadow: inset 0 1px 0 rgba(0,0,0,0.02);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
}

.final-output {
    margin-top: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 14px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

#final_output {
    margin-top: 8px;
    line-height: 1.7;
    color: var(--text);
    max-height: 260px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.badge-severity,
.badge-category {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    margin-right: 6px;
    margin-bottom: 6px;
}

.badge-severity {
    background: rgba(255, 99, 132, 0.12);
    border: 1px solid rgba(255, 99, 132, 0.3);
    color: #c24d62;
}

.badge-category {
    background: rgba(111, 228, 255, 0.12);
    border: 1px solid rgba(111, 228, 255, 0.25);
    color: #2c90aa;
}

.log-collapsed {
    max-height: 0;
    padding: 0 12px;
    opacity: 0;
    transition: opacity 0.2s ease, max-height 0.2s ease, padding 0.2s ease;
}

.visually-hidden {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.validation-actions {
    margin-top: 14px;
    padding: 14px;
    border: 1px dashed rgba(0,0,0,0.08);
    border-radius: 14px;
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.8);
}

.validation-copy .lede {
    margin: 4px 0 0;
}

.validation-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-actions {
    margin-top: 16px;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 18px;
}

.uniform-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.uniform-btn {
    min-width: 180px;
    text-align: center;
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 8px;
}

.page-title .lede {
    margin: 4px 0 0;
}

.header-actions {
    align-items: flex-start;
}

.header-cta button {
    margin: 0;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 14px 0;
}

.status-badge.valid {
    background: rgba(79, 255, 196, 0.15);
    border-color: rgba(79, 255, 196, 0.4);
    color: #0f6c4f;
}

.status-badge.partial {
    background: rgba(255, 186, 73, 0.15);
    border-color: rgba(255, 186, 73, 0.4);
    color: #8a5b0f;
}

.status-badge.invalid {
    background: rgba(255, 99, 132, 0.15);
    border-color: rgba(255, 99, 132, 0.4);
    color: #9b1f3d;
}

.summary-card {
    padding: 12px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: inset 0 1px 0 rgba(0,0,0,0.02);
}

.summary-value {
    font-size: 22px;
    font-weight: 700;
    margin-top: 6px;
}

.validation-report {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.critique-block {
    padding: 20px 0;
    background: transparent;
}

.critique-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0;
    cursor: default;
    background: transparent;
}

.critique-body {
    padding: 4px 0 0;
    white-space: pre-wrap;
}

.critique-block:not(:last-child)::after {
    content: "";
    display: block;
    border-bottom: 1px solid #e3e0dd;
    margin: 25px 0 0;
}

.critique-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.score-text {
    color: #252525;
    font-size: 13px;
    font-weight: 600;
}

.score-text::before {
    content: "Score: ";
    font-weight: 600;
    color: #252525;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    margin-right: 10px;
}

.status-badge.valid {
    background-color: #b4f4d8;
    color: #1e463b;
}

.status-badge.invalid {
    background-color: #ffb3ab;
    color: #742c2a;
}

.status-badge.partial {
    background-color: #d9c6ff;
    color: #3e2c6b;
}

.status-badge.unknown {
    background: rgba(0,0,0,0.08);
    color: #252525;
}

.critique-label {
    margin-top: 12px;
    font-weight: 600;
    color: #3a3a3a;
}

.critique-body p {
    white-space: pre-wrap;
    margin: 0;
    line-height: 1.55;
}

.download-row {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.top-download {
    margin-bottom: 12px;
}

.provenance {
    color: var(--muted);
    font-size: 13px;
    margin: 4px 0 14px;
}

.grid.two-col {
    grid-template-columns: 1.1fr 0.9fr;
}

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

@media (max-width: 1200px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    #app {
        margin-top: 32px;
    }

    .topbar {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

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

    body {
        font-size: 16px;
    }

    input[type="number"],
    select,
    textarea {
        width: 100%;
    }
}

/* Custom scrollbars */
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28);
}

.footer {
    margin: 24px auto 32px;
    padding: 12px 24px;
    max-width: 900px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
}

.footer-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.footer-text {
    color: var(--muted);
    letter-spacing: 0.02em;
}

/* ── PDF Upload Zone ──────────────────────────────────────────────────────── */
.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 12px;
    padding: 14px 18px;
    border: 1.5px dashed rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    text-align: center;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(255, 179, 171, 0.08);
}

.upload-icon {
    font-size: 22px;
    color: var(--muted);
}

.upload-label {
    font-size: 13px;
    color: var(--text);
}

.upload-hint {
    font-size: 11px;
    color: var(--soft-muted);
}

.upload-status {
    font-size: 12px;
    font-weight: 500;
    margin-top: 2px;
}

.upload-status.success { color: #0f6c4f; }
.upload-status.error   { color: #9b1f3d; }
.upload-status.loading { color: var(--muted); }

.link-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: var(--text);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    box-shadow: none;
}

.link-btn:hover {
    background: none;
    transform: none;
    opacity: 0.75;
}

/* ── Run History Panel ────────────────────────────────────────────────────── */
.history-panel {
    margin-top: 18px;
}

.history-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.history-header .panel-title {
    margin: 0;
    flex: 1;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-empty {
    font-size: 13px;
    text-align: center;
    padding: 16px 0;
}

.history-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 10px;
    font-size: 13px;
    flex-wrap: wrap;
}

.history-row-id {
    font-family: monospace;
    font-size: 11px;
    color: var(--muted);
    min-width: 70px;
}

.history-row-mode {
    flex: 1;
    color: var(--text);
    font-weight: 500;
}

.history-row-meta {
    color: var(--muted);
    font-size: 12px;
}

.history-row-actions {
    display: flex;
    gap: 6px;
}

.history-download-btn {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 8px;
}

/* Status badges for run history */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    border: 1px solid transparent;
}

.status-pill.queued   { background: rgba(200,200,200,0.2); border-color: rgba(150,150,150,0.3); color: #555; }
.status-pill.running  { background: rgba(73,180,255,0.15); border-color: rgba(73,180,255,0.4); color: #0a5a9c; }
.status-pill.completed { background: rgba(79,255,196,0.15); border-color: rgba(79,255,196,0.4); color: #0f6c4f; }
.status-pill.failed   { background: rgba(255,99,132,0.15); border-color: rgba(255,99,132,0.4); color: #9b1f3d; }

/* Current run status badge in process panel */
#run_status_badge.queued   { background: rgba(200,200,200,0.2); color: #555; }
#run_status_badge.running  { background: rgba(73,180,255,0.15); color: #0a5a9c; }
#run_status_badge.completed { background: rgba(79,255,196,0.15); color: #0f6c4f; }
#run_status_badge.failed   { background: rgba(255,99,132,0.15); color: #9b1f3d; }

/* ── Critique Review Page (from main) ────────────────────────────────────── */
/* Critique Review Page */
.critique-review-report {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.critique-category-section {
    margin-bottom: 24px;
}

.critique-category-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.critique-review-card {
    padding: 16px 0;
}

.critique-review-card:not(:last-child) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.critique-review-title-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.critique-review-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}

.critique-severity-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
}

.severity-critical {
    background-color: #ffb3ab;
    color: #742c2a;
}

.severity-moderate {
    background-color: #d9c6ff;
    color: #3e2c6b;
}

.severity-minor {
    background-color: rgba(0, 0, 0, 0.06);
    color: var(--text);
}

.severity-default {
    background-color: rgba(0, 0, 0, 0.06);
    color: var(--text);
}

.critique-review-body {
    padding-left: 0;
    color: var(--text);
}

.critique-review-body p {
    margin: 0 0 8px;
    line-height: 1.6;
    font-size: 14px;
}

.critique-review-body p:last-child {
    margin-bottom: 0;
}

/* ── Formatting banner (shown after convergence, before stream closes) ──────── */
.formatting-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding: 10px 14px;
    background: rgba(255, 186, 73, 0.12);
    border: 1px solid rgba(255, 186, 73, 0.35);
    border-radius: 8px;
    font-size: 13px;
    color: #7a5800;
}

.formatting-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 186, 73, 0.3);
    border-top-color: #f5a623;
    border-radius: 50%;
    flex-shrink: 0;
    animation: spin 0.8s linear infinite;
}

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

/* Proceed button in waiting state */
.btn-waiting,
button.btn-waiting,
button.btn-primary.btn-waiting {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Markdown renderer (used in auditor report and validateinput) ─────────── */
.md-body {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
}

.md-body h1, .md-body h2, .md-body h3, .md-body h4 {
    margin: 1.2em 0 0.4em;
    font-weight: 700;
    line-height: 1.3;
}

.md-body h1 { font-size: 1.4rem; }
.md-body h2 { font-size: 1.15rem; border-bottom: 1px solid rgba(0,0,0,0.07); padding-bottom: 4px; }
.md-body h3 { font-size: 1rem; }

.md-body p {
    margin: 0 0 0.75em;
}

.md-body ul, .md-body ol {
    margin: 0 0 0.75em 1.4em;
    padding: 0;
}

.md-body li {
    margin-bottom: 0.3em;
}

.md-body strong { font-weight: 700; }
.md-body em { font-style: italic; }

.md-body code {
    font-family: "JetBrains Mono", "Fira Code", "Courier New", monospace;
    font-size: 12px;
    background: rgba(0,0,0,0.06);
    border-radius: 4px;
    padding: 1px 5px;
}

.md-body pre {
    background: rgba(0,0,0,0.06);
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
    margin: 0 0 0.75em;
}

.md-body pre code {
    background: none;
    padding: 0;
}

.md-body blockquote {
    border-left: 3px solid rgba(0,0,0,0.15);
    margin: 0 0 0.75em;
    padding-left: 12px;
    color: rgba(0,0,0,0.55);
}

.md-body hr {
    border: none;
    border-top: 1px solid rgba(0,0,0,0.1);
    margin: 1.2em 0;
}

.md-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75em;
    font-size: 13px;
}

.md-body th, .md-body td {
    padding: 6px 10px;
    border: 1px solid rgba(0,0,0,0.1);
    text-align: left;
}

.md-body th {
    background: rgba(0,0,0,0.04);
    font-weight: 600;
}
