:root {
    --color-bg: #0f1115;
    --color-surface: #171a21;
    --color-surface-raised: #1f232c;
    --color-border: #2a2f3a;
    --color-text: #e8eaed;
    --color-text-muted: #9aa1ac;
    --color-accent: #4f8cff;
    --color-accent-hover: #6a9dff;
    --color-user-bubble: #2a3550;
    --color-assistant-bubble: #1f232c;
    --color-error: #ff6b6b;
    --color-success: #4fd18b;
    --color-warning: #e8b84f;
    --radius: 12px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    display: flex;
    justify-content: center;
}

.app {
    width: 100%;
    max-width: 1100px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

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

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.nav-link.active {
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--color-accent), #7c5cff);
    font-weight: 700;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.app-header h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

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

.chat-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.conversations-sidebar {
    width: 240px;
    flex-shrink: 0;
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    overflow-y: auto;
}

.new-conversation-btn {
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    margin-bottom: 12px;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.new-conversation-btn:hover {
    background: var(--color-bg);
    border-color: var(--color-accent);
}

.conversations-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.conversation-item:hover {
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.conversation-item.active {
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.conversation-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.conversation-delete {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.conversation-item:hover .conversation-delete {
    opacity: 1;
}

.conversation-delete:hover {
    color: var(--color-error);
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.empty-state {
    margin: auto;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
    max-width: 360px;
}

.empty-state.hidden {
    display: none;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: fade-in 0.15s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.message.assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.bubble {
    padding: 12px 16px;
    border-radius: var(--radius);
    line-height: 1.5;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message.user .bubble {
    background: var(--color-user-bubble);
    border-bottom-right-radius: 4px;
}

.message.assistant .bubble {
    background: var(--color-assistant-bubble);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
}

.message.assistant .bubble.error {
    border-color: var(--color-error);
    color: var(--color-error);
}

/* Rendered Markdown answers (see markdown.js) override the plain-text
   pre-wrap behavior above, since content is now proper block markup. */
.bubble.markdown-body {
    white-space: normal;
}

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

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

.markdown-body p {
    margin: 0 0 10px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin: 14px 0 8px;
    font-weight: 600;
    line-height: 1.3;
}

.markdown-body h1 { font-size: 18px; }
.markdown-body h2 { font-size: 16px; }
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 { font-size: 14px; }

.markdown-body ul,
.markdown-body ol {
    margin: 0 0 10px;
    padding-left: 22px;
}

.markdown-body li {
    margin: 2px 0;
}

.markdown-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 1px 5px;
}

.markdown-body pre {
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    overflow-x: auto;
}

.markdown-body pre code {
    background: none;
    border: none;
    padding: 0;
    white-space: pre;
}

.markdown-body a {
    color: var(--color-accent);
}

.bubble.loading {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--color-text-muted);
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-text-muted);
    animation: pulse 1.2s infinite ease-in-out;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

.sources {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.source-pill {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

a.source-pill-link {
    text-decoration: none;
    color: var(--color-accent);
    border-color: var(--color-accent);
    cursor: pointer;
}

a.source-pill-link:hover {
    background: var(--color-accent);
    color: white;
}

.route-badge {
    margin-top: 6px;
    font-size: 11px;
    color: var(--color-text-muted);
}

.scope-badge {
    margin-top: 8px;
    font-size: 11px;
    color: var(--color-accent);
}

.confirmation-banner {
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--color-assistant-bubble);
    border: 1px solid var(--color-accent);
}

.confirmation-label {
    font-size: 14px;
    margin: 0 0 8px;
}

.confirmation-preview {
    max-height: 160px;
    overflow-y: auto;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0 0 12px;
}

.confirmation-actions {
    display: flex;
    gap: 8px;
}

.confirmation-confirm-btn,
.confirmation-cancel-btn {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.confirmation-confirm-btn {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
}

.confirmation-confirm-btn:disabled,
.confirmation-cancel-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.bubble.cancelled {
    background: var(--color-assistant-bubble);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-style: italic;
}

.composer {
    flex-shrink: 0;
    border-top: 1px solid var(--color-border);
    padding: 16px 24px 20px;
    background: var(--color-surface);
}

.ask-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.question-input {
    flex: 1;
    resize: none;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    padding: 12px 14px;
    font-family: inherit;
    font-size: 14px;
    max-height: 160px;
}

.question-input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.send-btn {
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.send-btn:hover:not(:disabled) {
    background: var(--color-accent-hover);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.upload-row {
    margin-top: 10px;
}

.upload-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}

.upload-label:hover {
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.upload-hint {
    font-size: 11px;
    opacity: 0.7;
}

.upload-banner {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
}

.upload-banner.success {
    color: var(--color-success);
    border-color: var(--color-success);
}

.upload-banner.error {
    color: var(--color-error);
    border-color: var(--color-error);
}

.upload-banner.pending {
    color: var(--color-text-muted);
}

.upload-banner.warning {
    color: var(--color-warning);
    border-color: var(--color-warning);
}

.upload-banner.warning ul {
    margin: 6px 0;
    padding-left: 20px;
}

.upload-banner.warning .banner-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* Documents management page */

.docs-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.upload-section h2,
.docs-list-section h2,
.pending-list-section h2,
.jobs-list-section h2,
.ingestion-context-section h2 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
}

.ingestion-context-hint {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.ingestion-context-section textarea {
    width: 100%;
    max-width: 640px;
    font-family: inherit;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    color: inherit;
    resize: vertical;
}

.ingestion-context-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.ingestion-context-status {
    font-size: 13px;
    color: var(--color-text-muted);
}

.ingestion-context-status--success {
    color: var(--color-success);
}

.ingestion-context-status--error {
    color: var(--color-error);
}

.docs-list-section .empty-state,
.pending-list-section .empty-state {
    margin: 24px auto;
}

.pending-hint,
.jobs-hint {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.dossier-picker,
.docs-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.docs-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.docs-toolbar .docs-filter {
    margin-bottom: 0;
}

.reingest-all-btn {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--color-accent);
    background: var(--color-accent);
    color: white;
    cursor: pointer;
    white-space: nowrap;
}

.reingest-all-btn:hover {
    opacity: 0.9;
}

.reingest-all-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.criteria-context-toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.criteria-context-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-muted);
    cursor: pointer;
    white-space: nowrap;
}

.criteria-context-toggle input[type="checkbox"] {
    cursor: pointer;
}

/* Small circular "?" button revealing an explanation via its title
   tooltip — same hover-tooltip convention as .criteria-synonyms-cell. */

.help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    cursor: help;
}

.help-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-text);
}

.dossier-picker label,
.docs-filter label {
    flex-shrink: 0;
}

.dossier-picker select,
.dossier-picker input,
.docs-filter select {
    font-family: inherit;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.dossier-picker select:focus,
.dossier-picker input:focus,
.docs-filter select:focus {
    outline: none;
    border-color: var(--color-accent);
}

.docs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.docs-table th,
.docs-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
}

.docs-table th {
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.doc-actions {
    display: flex;
    gap: 8px;
    white-space: nowrap;
}

.doc-action {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    color: var(--color-text);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.doc-action:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.doc-download:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.doc-open:hover,
.doc-edit:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.doc-filename-link {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    color: var(--color-accent);
    cursor: pointer;
    text-align: left;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.doc-filename-link:hover {
    color: var(--color-text);
}

.doc-delete:hover {
    border-color: var(--color-error);
    color: var(--color-error);
}

.doc-reingest:hover,
.doc-ingest:hover,
.doc-review:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.doc-cancel:hover {
    border-color: var(--color-error);
    color: var(--color-error);
}

/* Settings page (Statut + Sécurité tabs) */

.settings-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--color-border);
}

.settings-tab {
    padding: 10px 18px;
    border: none;
    background: none;
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.settings-tab:hover {
    color: var(--color-text);
}

.settings-tab.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.settings-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-panel[hidden] {
    display: none;
}

.settings-intro-text {
    margin: 0;
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.settings-note--success {
    background: rgba(79, 209, 139, 0.1);
    border-color: var(--color-success);
}

.model-select-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.model-select-row select {
    flex: 1;
    min-width: 220px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 13px;
}

.model-recommendation {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
}

.model-recommendation p {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.5;
}

.settings-note {
    margin: 12px 0 0;
    padding: 8px 12px;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid var(--color-error);
    border-radius: 8px;
    font-size: 12px;
    color: var(--color-error);
}

.status-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    background: var(--color-surface-raised);
}

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

.status-card-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.status-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 8px;
}

.status-summary-text {
    font-size: 13px;
    color: var(--color-text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.status-checks {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.status-check-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-check-label {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* Security panel */

.security-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.security-intro h2 {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
}

.security-intro p {
    margin: 0;
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.security-guards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.security-guard-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    background: var(--color-surface-raised);
}

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

.security-guard-header h3 {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
}

.security-guard-desc {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.4;
    max-width: 560px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--color-border);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: var(--color-text);
    border-radius: 50%;
    transition: transform 0.15s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--color-accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

.security-guard-footer {
    margin-top: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.test-btn {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    flex-shrink: 0;
}

.test-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

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

.self-test-result {
    flex: 1;
    min-width: 0;
}

.self-test-pending {
    font-size: 12px;
    color: var(--color-text-muted);
}

.self-test-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
}

.self-test-badge.pass {
    background: rgba(79, 209, 139, 0.15);
    color: var(--color-success);
}

.self-test-badge.fail {
    background: rgba(255, 107, 107, 0.15);
    color: var(--color-error);
}

.self-test-details {
    margin: 8px 0 0;
    padding: 8px 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 160px;
    overflow-y: auto;
}

.security-audit-section h2 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
}

/* Reports & criteria administration page (OBJ-14) */

.reports-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.reports-container h2 {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
}

.reports-hint {
    margin: 0 0 14px;
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.5;
    max-width: 640px;
}

.criterion-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.scope-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--color-text-muted);
}

.criterion-form input,
.scope-filters input {
    font-family: inherit;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.criterion-form select {
    font-family: inherit;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.criterion-form input:focus,
.criterion-form select:focus,
.scope-filters input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.field-select {
    grid-column: 1 / -1;
    max-width: 320px;
}

.criteria-section .reingest-all-btn {
    margin-top: 12px;
}

.report-view-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.generate-report-actions:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
}

.report-view-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.section-content-editor {
    width: 100%;
    box-sizing: border-box;
    margin: 8px 0;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    color: inherit;
    font: inherit;
    line-height: 1.45;
}

.advice-panel {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.advice-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.advice-card {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    font-size: 13px;
}

.advice-card label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.advice-card-title {
    margin: 6px 0 4px;
    font-weight: 600;
}

.advice-card blockquote {
    margin: 6px 0 0;
    padding-left: 10px;
    border-left: 3px solid var(--color-border);
    color: var(--color-text-muted);
}

.advice-card--documenter {
    background: var(--color-surface-raised);
    opacity: 0.92;
}

.regenerate-form {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.regenerate-form input {
    flex: 1;
    font-family: inherit;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}

.regenerate-form input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.criterion-form textarea,
.scope-filters textarea,
.analyzer-section textarea {
    font-family: inherit;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    color: var(--color-text);
    resize: vertical;
    width: 100%;
}

.criterion-form textarea:focus,
.scope-filters textarea:focus,
.analyzer-section textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* The hidden attribute is inert on flex containers without this reset. */
.field-label[hidden] {
    display: none;
}

.field-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--color-text-muted);
    flex: 1;
    min-width: 220px;
    grid-column: 1 / -1;
}

.criterion-form-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    grid-column: 1 / -1;
}

/* Criteria table: axe/modalité grouping (indent modalités under their axe) */

#criteria-table {
    table-layout: fixed;
}

.criteria-row--axe td:first-child,
.criteria-row--axe td:nth-child(2) {
    font-weight: 600;
}

.criteria-row--child td:first-child,
.criteria-row--child td:nth-child(2) {
    padding-left: 28px;
    color: var(--color-text-muted);
}

/* Synonyms column: truncate with an ellipsis instead of wrapping and
   inflating row height — full list available via the cell's title tooltip. */

.criteria-synonyms-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Chip input (synonyms): typed tokens rendered as removable pills */

.chip-input-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* AI draft assist (expected_content/retrieval_context): instruction input
   + "Générer via IA" button under a textarea, mirroring .chip-input-row. */

.field-ai-assist {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.field-ai-assist input {
    flex: 1;
    min-width: 160px;
}

.chip-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 220px;
    padding: 4px 6px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
}

.chip-input:focus-within {
    border-color: var(--color-accent);
}

.chip-input-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px 3px 10px;
    border-radius: 999px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 12px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* Flashed briefly (src/web/static/ingestion.js's addValues({highlight: true}))
   when a chip is accepted from the AI-suggestions row, so landing here reads
   as "added" rather than just "gone from the suggestion list". */
.chip-input-tag--added {
    background: color-mix(in srgb, var(--color-accent) 25%, var(--color-surface));
    border-color: var(--color-accent);
}

.chip-input-tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Deliberately larger than the visual "×" glyph — a small pill sitting
       right next to the synonym text was easy to hit by accident when
       intending to just click/select the chip (reported UX issue). */
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
}

.chip-input-tag-remove:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.chip-input-field {
    flex: 1;
    min-width: 120px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--color-text);
    font-family: inherit;
    font-size: 12px;
    padding: 4px;
}

/* AI-suggested synonyms: draft chips the user must click to accept, never
   auto-added to the real chip-input (same review-before-accept pattern as
   the mandate analyzer's draft criteria table). */

.chip-suggestions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.chip-suggestion {
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px dashed var(--color-border);
    background: transparent;
    color: var(--color-text-muted);
    font-size: 12px;
    cursor: pointer;
}

.chip-suggestion:hover {
    border-color: var(--color-accent);
    color: var(--color-text);
}

.chip-suggestions-add-all {
    font-size: 12px;
    color: var(--color-accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

/* Pipeline legend (OBJ-15): explanatory banner above the criteria table */

.pipeline-legend {
    margin-bottom: 14px;
}

.pipeline-legend summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text-muted);
}

.pipeline-legend-steps {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
}

.pipeline-legend-step {
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.pipeline-legend-arrow {
    color: var(--color-text-muted);
}

/* Status badges (criteria "ingested" flag + coverage grid statuses) */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

.status-badge__icon {
    font-size: 10px;
    line-height: 1;
}

.status-badge--found {
    color: var(--color-success);
    border-color: var(--color-success);
}

.status-badge--missing {
    color: var(--color-warning);
    border-color: var(--color-warning);
}

.status-badge--not-ingested {
    color: var(--color-text-muted);
    border-color: var(--color-border);
}

.status-badge--uncertain {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.status-badge--stale {
    color: var(--color-warning);
    border-color: var(--color-warning);
}

.coverage-row {
    cursor: pointer;
}

.coverage-row:hover,
.coverage-row:focus {
    background: var(--color-surface-raised);
    outline: none;
}

.evidence-card {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--color-surface);
}

.evidence-card--weak {
    border-style: dashed;
    opacity: 0.9;
}

.evidence-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.evidence-card__source-badge {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.evidence-card__weak-notice {
    margin: 0 0 6px;
    font-size: 11px;
    font-style: italic;
    color: var(--color-warning);
}

.evidence-card__passage {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
}

.coverage-cell-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(420px, 100vw);
    height: 100vh;
    overflow: auto;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
    padding: 16px 18px 32px;
    z-index: 40;
}

.coverage-cell-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.coverage-cell-panel__title {
    margin: 0;
    font-size: 16px;
}

.coverage-cell-panel__close {
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-muted);
}

.coverage-cell-panel__explanation {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 8px 0 12px;
}

.coverage-cell-panel__actions {
    margin-bottom: 16px;
}

.coverage-cell-panel__empty {
    font-size: 13px;
    color: var(--color-text-muted);
}

.coverage-review-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(440px, 100vw);
    height: 100vh;
    overflow: auto;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
    padding: 16px 18px 32px;
    z-index: 45;
}

.coverage-review-panel__notice {
    font-size: 12px;
    padding: 8px 10px;
    border-left: 3px solid var(--color-accent);
    background: var(--color-surface-raised);
    color: var(--color-text-muted);
}

.coverage-review-panel__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

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

.gold-progress {
    font-size: 12px;
    overflow: auto;
    max-height: 240px;
    padding: 8px;
    background: var(--color-surface-raised);
    border-radius: 8px;
}

.modal-open {
    overflow: hidden;
}

.modal-box.gold-review-modal__dialog {
    width: min(900px, calc(100vw - 32px));
    height: calc(100dvh - 32px);
    max-height: calc(100dvh - 32px);
    padding: 0;
    overflow: hidden;
}

.gold-review-modal__header,
.gold-review-modal__meta,
.gold-review-modal__footer {
    flex: 0 0 auto;
    padding: 16px 20px;
    background: var(--color-surface);
}

.gold-review-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--color-border);
}

.gold-review-modal__header h3 {
    margin: 0;
}

.gold-review-modal__header .coverage-review-panel__notice {
    margin: 8px 0 0;
}

.gold-review-modal__meta {
    display: grid;
    grid-template-columns: minmax(100px, 1fr) minmax(220px, 320px);
    align-items: end;
    gap: 16px;
    padding-top: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.gold-review-modal__meta .coverage-review-panel__progress {
    margin: 0;
    font-weight: 600;
}

.gold-review-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
}

.gold-review-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid var(--color-border);
}

.gold-review-modal__footer .coverage-review-panel__buttons {
    margin: 0;
}

.gold-panel__criterion {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 650;
}

.gold-panel__guideline-wrap {
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-raised);
}

.gold-panel__guideline-wrap summary {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.gold-panel__guideline {
    font-size: 12px;
    white-space: pre-wrap;
    max-height: 220px;
    overflow: auto;
    margin: 0;
    padding: 0 12px 12px;
    color: var(--color-text-muted);
}

.gold-panel__passage {
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    margin: 8px 0 16px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-raised);
}

.gold-panel__agent {
    font-size: 12px;
    color: var(--color-text-muted);
}

.coverage-review-panel__author,
.gold-panel__reason {
    width: 100%;
    margin-top: 4px;
    font-family: inherit;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}

@media (max-width: 640px) {
    .modal-box.gold-review-modal__dialog {
        width: 100vw;
        height: 100dvh;
        max-height: none;
        border: 0;
        border-radius: 0;
    }

    .gold-review-modal__header,
    .gold-review-modal__meta,
    .gold-review-modal__body,
    .gold-review-modal__footer {
        padding-left: 14px;
        padding-right: 14px;
    }

    .gold-review-modal__meta {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .gold-review-modal__footer {
        align-items: stretch;
        flex-direction: column;
    }

    .gold-review-modal__footer .coverage-review-panel__buttons {
        display: grid;
        grid-template-columns: 1fr;
    }
}

/* Section cards: expected-content reminder + rating */

.section-expected-content {
    margin: 0 0 8px;
    padding: 8px 10px;
    border-left: 3px solid var(--color-accent);
    background: var(--color-surface-raised);
    font-size: 12px;
    color: var(--color-text-muted);
    border-radius: 0 8px 8px 0;
}

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

.rating-form select {
    font-family: inherit;
    font-size: 12px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}

.rating-form input[type="text"] {
    flex: 1;
    min-width: 160px;
    font-family: inherit;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}

/* Mandate analyzer panel */

.analyzer-section .empty-state {
    margin-top: 10px;
}

.analyzer-drafts-table {
    margin-top: 14px;
}

.analyzer-drafts-table td input[type="text"] {
    width: 100%;
    font-family: inherit;
    font-size: 12px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}

/* Re-ingestion confirmation modal (OCR pre-scan) */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-box {
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.modal-box--wide {
    width: min(880px, calc(100vw - 32px));
}

.modal-filename {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    word-break: break-all;
}

.modal-hint {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.45;
}

.doc-edit-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doc-edit-form label {
    font-size: 12px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.doc-edit-form textarea {
    font-family: inherit;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.doc-profile-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.spinner {
    flex: none;
    width: 14px;
    height: 14px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner[hidden] {
    display: none;
}

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

.doc-profile-notes,
.criterion-source-notes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0;
}

.md-preview-body {
    overflow-y: auto;
    max-height: min(70vh, 640px);
    margin: 0 0 14px;
    padding: 16px 18px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-raised);
}

.md-preview-body.markdown-body h1 {
    font-size: 22px;
}

.md-preview-body.markdown-body h2 {
    font-size: 18px;
}

.doc-preview-body {
    overflow-y: auto;
    max-height: min(70vh, 640px);
    margin: 0 0 14px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-raised);
    font-size: 13px;
    line-height: 1.5;
}

.doc-preview-body h4 {
    margin: 16px 0 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
}

.doc-preview-body h4:first-child {
    margin-top: 0;
}

.doc-preview-body pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
}

.doc-review-body {
    overflow-y: auto;
    max-height: min(70vh, 640px);
    margin: 0 0 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.doc-review-page {
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-raised);
}

.doc-review-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 8px;
}

.doc-review-page-header h4 {
    margin: 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
}

.doc-review-flags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.doc-review-flag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--color-border);
    color: var(--color-text);
}

.doc-review-suggestion {
    margin-top: 8px;
    padding: 10px;
    border-radius: 8px;
    border: 1px dashed var(--color-border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.doc-review-suggestion p {
    flex: 1 1 100%;
    margin: 0;
    font-size: 13px;
}

.doc-review-suggestion-text {
    flex: 1 1 100%;
    margin: 0;
    white-space: pre-wrap;
    font-size: 12px;
    font-family: inherit;
}

.pii-scan-section {
    margin-top: 32px;
}

.doc-review-page textarea {
    width: 100%;
    min-height: 120px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.45;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    resize: vertical;
}

.doc-review-page label {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-box h3 {
    margin: 0 0 10px;
    font-size: 16px;
}

#reingest-ocr-modal-intro {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.modal-file-list {
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    max-height: 260px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.modal-file-list li {
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}

.modal-file-list li:last-child {
    border-bottom: none;
}

.modal-file-list label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

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

/* Job progress inside a modal: the page banner sits under the overlay. */
.modal-status {
    margin-right: auto;
    align-self: center;
    font-size: 13px;
    color: var(--color-text-muted);
}

.modal-status--success {
    color: var(--color-success);
}

.modal-status--error {
    color: var(--color-error);
}

/* /logs page: last ingestion card + history table (src.rag.ingestion_log) */

.last-run-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface-raised);
    padding: 16px;
}

.last-run-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.last-run-card-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.last-run-card-meta {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.last-run-card-error {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--color-error);
}

#logs-history-table {
    table-layout: fixed;
}

#logs-history-table td {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The detail row's single <td colspan="7"> holds a full nested table, not
   a truncated label — it must not inherit the ellipsis/hidden overflow
   above, which forced its content into an unreadable one-column sliver. */
.log-file-detail-row > td {
    overflow: visible;
    text-overflow: unset;
    background: var(--color-surface-raised);
}

.log-file-toggle {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.log-file-toggle:hover {
    color: var(--color-text);
}

.log-file-list {
    max-width: 100%;
}

.log-file-list summary {
    cursor: pointer;
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-file-table {
    margin-top: 8px;
    width: 100%;
    table-layout: fixed;
}

.log-file-table td {
    font-size: 12px;
    overflow-wrap: anywhere;
}

.review-container .pending-hint {
    max-width: 72ch;
}

.review-summary {
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.review-summary p {
    margin: 0 0 6px;
}

.review-summary p:last-child {
    margin-bottom: 0;
    font-size: 13px;
    color: var(--color-text-muted);
}

.review-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.review-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.review-columns h3 {
    margin: 0 0 8px;
    font-size: 13px;
}

.review-generated {
    margin: 0;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.45;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    min-height: 12em;
}

.review-columns textarea {
    width: 100%;
    min-height: 12em;
    box-sizing: border-box;
}

.review-section-actions,
.review-finding-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.review-stale {
    font-size: 12px;
    color: var(--color-accent);
}

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

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

.nav-account {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.logout-form {
    margin: 0;
}

.nav-logout {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
}

.login-body {
    align-items: center;
    min-height: 100%;
}

.login-card {
    width: min(400px, calc(100% - 32px));
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-error {
    margin: 0;
    color: var(--color-error);
    font-size: 14px;
}

.login-submit {
    width: 100%;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 14px;
}

.auth-field input,
.auth-field select,
.user-admin-input {
    font: inherit;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text);
}

.auth-field input:focus,
.auth-field select:focus,
.user-admin-input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.user-form {
    max-width: 420px;
}

.user-table td {
    vertical-align: middle;
}

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

.user-table .user-admin-input {
    width: 100%;
    max-width: 220px;
    margin-right: 8px;
}
