/* BEguided Web Interface Styles */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg: #f8fafc;
    --panel: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --chart-abe: #2563eb;
    --chart-cbe: #f59e0b;
    --chart-all: #475569;
    --chart-unknown: #94a3b8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Top bar */
.top-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    background: var(--panel);
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.top-bar .group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar .right {
    margin-left: auto;
}

.top-bar label {
    font-weight: 600;
    font-size: 14px;
    color: var(--muted);
}

.top-bar select,
.top-bar input[type="file"],
.top-bar input[type="number"] {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
}

.top-bar input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Base editor multi-select dropdown (lives in the top-bar). */
.be-multiselect {
    position: relative;
    display: inline-block;
}

.be-multiselect-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 160px;
    max-width: 280px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 400;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.be-multiselect-btn:hover {
    border-color: var(--primary);
}

.be-multiselect-btn:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.be-multiselect-btn[aria-expanded="true"] {
    border-color: var(--primary);
}

.be-multiselect-btn .be-caret {
    font-size: 11px;
    color: var(--muted);
    transition: transform 0.15s ease;
}

.be-multiselect-btn[aria-expanded="true"] .be-caret {
    transform: rotate(180deg);
}

.be-multiselect-btn #beMultiselectLabel {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.be-multiselect-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 200;
    min-width: 320px;
    max-width: 420px;
    max-height: 420px;
    overflow: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
    padding: 8px 0;
}

.be-quick-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 10px 8px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
    position: sticky;
    top: 0;
    background: var(--panel);
    z-index: 1;
}

.be-quick-toggles button {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.be-quick-toggles button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.be-checkbox-groups {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 10px 8px 10px;
}

.be-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.be-group-header {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    padding: 6px 4px 4px 4px;
}

.be-group-header-custom {
    color: var(--primary);
}

.be-subgroup {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-left: 8px;
    padding-left: 8px;
    border-left: 2px solid var(--border);
}

.be-subgroup-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    padding: 4px 4px 2px 4px;
}

.be-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.1s ease;
}

.be-checkbox-row:hover {
    background: var(--bg);
}

.be-checkbox-row input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
    cursor: pointer;
    margin: 0;
}

.be-checkbox-row .be-name {
    flex: 1;
}

.be-checkbox-row .be-pam {
    font-size: 11px;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Mode switch (Spreadsheet / Sequence) sits inside the top-bar */
.mode-switch {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg);
}

.mode-switch-btn {
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.mode-switch-btn + .mode-switch-btn {
    border-left: 1px solid var(--border);
}

.mode-switch-btn:hover {
    color: var(--text);
}

.mode-switch-btn.active {
    background: var(--primary);
    color: #fff;
}

/* Input-mode panels (file upload or sequence textarea) */
.input-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.input-panel .group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Title row inside an input panel (currently only the spreadsheet panel).
   The left side carries a single-line instruction with the upload limits,
   the right side carries the genome/GTF preload status badges. */
.input-panel .input-panel-title {
    font-size: 16px;
    font-weight: 400;
    color: var(--text);
    padding-left: 16px;
}

/* Group of status badges inside an input-panel row. Pushed to the far right
   via margin-left: auto so the badges never visually "hug" the title text. */
.input-panel .input-panel-statuses {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* A little extra space between the prominent upload button and the
   Template button on the spreadsheet input panel's actions row. */
.input-panel .input-actions-row > .btn-secondary {
    margin-left: 12px;
}

/* Load example + Run pair at the right edge of the spreadsheet actions row.
   The shared Run button is moved in here by app.js's setMode() when the
   spreadsheet mode is active. */
.input-actions-run-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Visually hide the native file input while keeping it focusable and
   activatable via its <label for="fileInput"> button. `display:none`
   would remove it from the tab order and break the label activation. */
.visually-hidden-file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Mirror the input's focus ring onto the visible "Choose file" label. */
.input-panel input.visually-hidden-file:focus + label {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

/* Genome selector group inside the spreadsheet actions row. Centered between
   the left cluster (Choose file / Template) and the right-aligned run group:
   the auto margins on both sides split the free space equally. */
.genome-select-group {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    margin-right: auto;
}

.genome-select-group label {
    font-weight: 600;
    font-size: 13px;
    color: var(--muted);
}

.genome-select-group select {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
}

.genome-select-group select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Action row inside an input panel. In spreadsheet mode it sits on top
   (Template button, upload-limits info, Run button). In sequence mode it
   sits at the bottom (bracket-format hint, Load example button, shared Run
   button). */
.input-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 13px;
}

.input-meta-row .right {
    margin-left: auto;
}

/* Single-target input panel: the chromosome / position / editing-type
   fields reuse the compact results-toolbar control style (see the shared
   .single-field selectors on the .results-toolbar rules). The genome
   selector intentionally keeps the wider .genome-select-group styling so
   it looks the same as the spreadsheet panel's selector. */
.single-fields-row {
    flex-wrap: wrap;
    row-gap: 8px;
}

/* Widths tuned to the content: chromosome tokens are short (1-22, X, Y,
   chr1) and genomic positions are at most ~9 digits. */
#singleChromosome {
    width: 7ch;
}

#singlePosition {
    width: 11ch;
}

/* Generic muted text color (also used by .info-row spans). */
.muted {
    color: var(--muted);
}

.sequence-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f1f5f9;
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.5;
    resize: vertical;
    min-height: 160px;
}

.sequence-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

#sequenceHint code {
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    color: var(--text);
}

/* Highlight the edit position in the preview table */
.sequence-edit-mark {
    background: #fef3c7;
    color: #78350f;
    border-radius: 3px;
    padding: 0 3px;
    font-weight: 700;
}

/* Highlight the edited base inside a guide RNA sequence in the results table.
   Soft blue background + darker blue text; matches the visual weight of the
   yellow .sequence-edit-mark used in the preview. The <code> wrapper is on
   the parent cell, so this background sits inside the monospace sequence. */
.guide-edit-base {
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 3px;
    padding: 0 3px;
    font-weight: 700;
}

/* Highlight bystander edits inside a guide RNA sequence in the results table.
   Text color only (no background) so bystanders stay legible while the blue
   edited base remains the primary visual anchor. */
.guide-bystander-base {
    color: #b91c1c;
}

/* Results-tab filter toolbar */
.results-guide-status {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #1e3a8a;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
}

.results-guide-status .results-guide-count {
    display: inline-block;
    padding: 2px 10px;
    margin: 0 2px;
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

/* Outcome line of the off-target check, appended to the guide-count status
   box on the Guides tab. Lighter than the headline counts. */
.results-guide-status .ot-check-status {
    margin-top: 4px;
    font-size: 13.5px;
    font-weight: 500;
    color: #334155;
}

/* Rows for targets without a usable guide RNA ("**No guide possible**",
   "**Base change incompatible**", "**Guides removed by filter**"). Dark red
   so "nothing found / removed by filtering" states stand out from real
   guides; italic keeps them clearly distinct from data rows. */
tr.no-guide td {
    color: #b91c1c;
    font-style: italic;
}

tr.no-guide td code {
    color: #b91c1c;
    font-style: italic;
}

.results-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 16px;
}

.results-toolbar .group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.results-toolbar label,
.single-field label {
    font-weight: 600;
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
}

.results-toolbar select,
.results-toolbar input[type="number"],
.single-field input[type="text"],
.single-field select {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--panel);
    color: var(--text);
}

.results-toolbar .muted {
    margin-left: auto;
    font-size: 13px;
    color: var(--muted);
}

/* Section title for the results-toolbar box. Sits on its own line above
   the controls (width:100% forces a wrap inside the flex container),
   in the primary blue and slightly larger than the control labels. */
.results-toolbar .results-toolbar-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--primary);
    width: 100%;
}

/* Second section title ("Off-target check") inside the same toolbar box;
   the top divider separates it from the Filters row above. */
.results-toolbar .results-toolbar-title-section {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* Info glyph after the "Off-target check" section title: carries the
   plain-language search-window note (exact PAM-proximal seed, tolerated
   PAM-distal mismatches) as a native tooltip on the title, set from the
   /config fast_search block. Hidden when the fast engine is absent. */
.results-toolbar .results-toolbar-title .th-info {
    color: var(--muted);
    opacity: 0.6;
    font-size: 11px;
    margin-left: 6px;
}

.results-toolbar .results-toolbar-title[title] {
    cursor: help;
}

/* Off-target screening controls live in the results filter toolbar
   (the search acts on exactly the filtered subset). The hint sits on its
   own full-width line below the controls so longer explanations — e.g.
   the sequence-mode on-target caveat — can wrap freely. The element is
   hidden entirely (via JS) whenever it has nothing to say. */
.results-toolbar .ot-hint {
    width: 100%;
    margin-left: 0;
    font-size: 13px;
    line-height: 1.45;
}

/* Reference-genome selector for sequence-mode off-target searches. Sits
   at the far right of the Off-target check controls row (margin-left:
   auto, same pattern as the "Showing x of y" counter). Only shown for
   sequence jobs (the input-mode genome selectors cover the other modes);
   inherits the compact results-toolbar control style. */
.results-toolbar .ot-genome-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Spinner shown on the screening button while its job is running. */
.btn-loading::before {
    content: "";
    display: inline-block;
    width: 11px;
    height: 11px;
    margin-right: 6px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    vertical-align: -2px;
    animation: ot-spin 0.8s linear infinite;
}

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

/* Badges marking off-target values the operator's removal rule would
   reject, plus the pass/fail verdict of the off-target check.
   Display-only: the screening result always keeps every row. */
.ot-badge {
    display: inline-block;
    padding: 1px 7px;
    margin-left: 4px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(217, 119, 6, 0.14);
    color: var(--warning);
    white-space: nowrap;
}

.ot-badge-danger {
    background: rgba(220, 38, 38, 0.12);
    color: var(--danger);
}

.ot-badge-pass {
    background: rgba(22, 163, 74, 0.12);
    color: var(--success);
}

/* Scroll wrapper for the results table only — toolbar above stays static */
.results-table-scroll {
    max-height: 800px;
    overflow: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-top: 16px;
}

/* Per-base-editor target count summary shown above the results table.
   Renders a horizontal bar chart; sized to accommodate ~10 bars with labels. */
.results-summary {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
}

.summary-chart-wrap {
    position: relative;
    width: 100%;
    height: clamp(280px, 40vh, 520px);
}

.summary-chart-wrap canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

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

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

.btn-secondary {
    background: var(--panel);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
}

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

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Status badge */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--border);
    color: var(--muted);
    border: 1px solid var(--border);
}

.badge.running {
    background: #dbeafe;
    color: var(--primary);
    border-color: #93c5fd;
}

.badge.complete {
    background: #dcfce7;
    color: var(--success);
    border-color: #86efac;
}

.badge.error {
    background: #fee2e2;
    color: var(--danger);
    border-color: #fca5a5;
}

.badge.queued,
.badge.submitting {
    background: #fef3c7;
    color: #78350f;
    border-color: #fcd34d;
}

.badge.cancelled {
    background: #e5e7eb;
    color: #374151;
    border-color: #d1d5db;
}

.badge.loading {
    background: #fef3c7;
    color: #78350f;
    border-color: #fcd34d;
    animation: badge-pulse 1.4s ease-in-out infinite;
}

.badge.ready {
    background: #dcfce7;
    color: var(--success);
    border-color: #86efac;
}

.badge.muted {
    background: #f1f5f9;
    color: var(--muted);
    border-color: var(--border);
}

.badge.badge-warn {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

@keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

/* Info row */
.info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--muted);
}

.info-row .right {
    margin-left: auto;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
}

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

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

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Sub-tabs (nested inside a top-level tab panel, e.g. Results) */
.subtabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
}

.subtab-button {
    padding: 6px 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 13px;
}

.subtab-button:hover {
    color: var(--text);
}

.subtab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.subtab-panel {
    display: none;
}

.subtab-panel.active {
    display: block;
}

/* Panels */
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    overflow: auto;
}

/* Upload row on the Base Editors tab: label + file input on the left with
   a 10px gap, template-download link pushed to the far right. */
.be-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
}

.be-upload-row > a.btn-secondary {
    margin-left: auto;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    position: sticky;
    top: 0;
    background: var(--panel);
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    font-weight: 700;
    color: var(--muted);
    white-space: nowrap;
}

/* Headers that carry a tooltip (via the native title attribute) get a
   help cursor and a small muted info glyph as a visual affordance. */
.data-table thead th[title] {
    cursor: help;
}

.data-table thead th .th-info {
    color: var(--muted);
    opacity: 0.6;
    font-size: 11px;
    margin-left: 4px;
}

/* Filter labels in the results toolbar mirror the header tooltip behavior:
   the <label> gets `title` from RESULTS_COLUMN_TOOLTIPS at init, the help
   cursor signals the tooltip exists, and the same info glyph renders inline. */
.results-toolbar label[title] {
    cursor: help;
}

.results-toolbar label .th-info {
    color: var(--muted);
    opacity: 0.6;
    font-size: 11px;
    margin-left: 4px;
}

.data-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.data-table tbody tr:hover td {
    background: #f8fafc;
}

/* Target-group zebra stripes: every other (chromosome, position) target group
   gets a light-grey tint to visually separate one target's guides from the next. */
.data-table tbody tr.target-a td {
    background: var(--panel);
}

.data-table tbody tr.target-b td {
    background: #f1f5f9;
}

.data-table tbody tr.target-a:hover td,
.data-table tbody tr.target-b:hover td {
    background: #e2e8f0;
}

/* Guide tab prose */
#guideTab h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 20px;
}

#guideTab h3 {
    margin-top: 24px;
    margin-bottom: 8px;
    font-size: 16px;
    color: var(--text);
}

#guideTab p,
#guideTab ul {
    margin: 8px 0;
    line-height: 1.6;
}

#guideTab code {
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12.5px;
}

#guideTab ul {
    padding-left: 22px;
}

#guideTab ul li {
    margin-bottom: 4px;
}

#baseEditorTableContainer {
    margin-top: 12px;
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* Log area */
pre.log {
    background: #0f172a;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 10px;
    overflow: auto;
    max-height: 70vh;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 14px;
    border: 1px solid transparent;
}

.alert.info {
    background: #eff6ff;
    color: #1e3a8a;
    border-color: #bfdbfe;
}

.alert.error {
    background: #fef2f2;
    color: #7f1d1d;
    border-color: #fecaca;
}

.alert.success {
    background: #f0fdf4;
    color: #14532d;
    border-color: #bbf7d0;
}

.alert.warning {
    background: #fffbeb;
    color: #78350f;
    border-color: #fcd34d;
}

/* Keep base editor names on one line in the results table.
   The wrapper div guarantees the column width because min-width on
   <td> is unreliable in table-layout:auto. */
.data-table th[data-col="base_editor"] {
    min-width: 200px;
}
.data-table td[data-col="base_editor"] {
    white-space: nowrap;
}
.data-table td[data-col="base_editor"] > .be-cell {
    display: inline-block;
    min-width: 200px;
}

/* When the condense-results toggle is on, the base_editor cell may hold
   newline-separated editor names. Switch the cell to pre-line so "\n"
   becomes a real line break, drop the min-width (otherwise the column
   would balloon to the length of the longest stacked name), and let the
   cell wrap nicely on long stacks. */
.results-table-wrap.condensed .data-table td[data-col="base_editor"] {
    white-space: pre-line;
}
.results-table-wrap.condensed .data-table td[data-col="base_editor"] > .be-cell {
    display: inline-block;
    min-width: 0;
}

/* Toolbar checkbox: match the visual weight of the adjacent dropdowns
   without crowding the label. */
.results-toolbar input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ---------------------------------------------------------------------------
   Accessibility (BFSG / EAA readiness)
   --------------------------------------------------------------------------- */

/* Skip-link: visible only when focused via keyboard. Slides into view at
   the very top of the viewport; positioned absolutely so it does not
   affect layout of the rest of the page. */
.skip-link {
    position: absolute;
    top: -40px;
    left: 8px;
    background: var(--primary);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    z-index: 1100;
    transition: top 120ms ease-out;
}
.skip-link:focus,
.skip-link:focus-visible {
    top: 8px;
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

/* Keyboard focus ring on every interactive element. Using
   :focus-visible keeps the ring off for mouse clicks but draws it for
   keyboard tabbing, which is what screen-reader and keyboard-only users
   need. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Site footer (Imprint / Privacy / AGB links + partner logos). */
.site-footer {
    margin-top: 32px;
    padding: 20px 0 12px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
}
.site-footer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 8px;
}
.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}
.site-footer nav a {
    color: var(--primary);
    text-decoration: none;
}
.site-footer nav a:hover,
.site-footer nav a:focus-visible {
    text-decoration: underline;
}
/* Partner logos on the right of the footer. */
.site-footer-partners {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
}
.site-footer-partner-logo {
    max-height: 60px;
    height: auto;
    width: auto;
    display: block;
}
.site-footer-meta {
    margin: 4px 0 0;
    font-style: italic;
}

/* ---------------------------------------------------------------------------
   Legal pages (Impressum, Datenschutz, AGB)
   --------------------------------------------------------------------------- */

.legal-section {
    margin-top: 24px;
}
.legal-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.legal-header-brand {
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
    text-decoration: none;
}
.legal-header-brand:hover,
.legal-header-brand:focus-visible {
    text-decoration: underline;
}
.legal-header-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 8px;
}
.legal-header-back:hover {
    background: #eff6ff;
}
.legal-header-back:hover,
.legal-header-back:focus-visible {
    text-decoration: underline;
}
.legal-section h2 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text);
}
.legal-updated {
    color: var(--muted);
    font-style: italic;
    margin-top: -4px;
}
.legal-address {
    font-style: normal;
    line-height: 1.6;
}
.legal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 16px;
    font-size: 14px;
}
.legal-table th,
.legal-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.legal-table th {
    background: var(--bg);
    font-weight: 600;
}

/* ---------------------------------------------------------------------------
   Honour OS reduced-motion preference
   --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

