/* ============================================================
   DocAI console — paper & ink

   A document-provenance product: hairline rules instead of card
   shadows, ink as the primary action colour, rubric red reserved
   for the citation apparatus and the wordmark.
   ============================================================ */

:root {
    /* surfaces */
    --paper: #f6f6f4;
    --sheet: #ffffff;
    --sheet-sunk: #faf9f7;
    --rule: #e3e1dc;
    --rule-strong: #cfccc5;

    /* text */
    --ink: #191b1f;
    --ink-soft: #3c4046;
    --graphite: #5b5f66;
    --graphite-light: #6f747a;

    /* the one accent: rubric red, for citations and the mark */
    --rubric: #a32b20;
    --rubric-wash: #f7ecea;

    /* status */
    --ok: #166b4e;
    --ok-wash: #e8f1ed;
    --work: #8a5a12;
    --work-wash: #f7efe2;
    --stop: #b02a1f;
    --stop-wash: #f9ebe9;
    --idle: #5f6368;
    --idle-wash: #eeedea;

    --rail-w: 244px;

    --font-sans: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-serif: 'IBM Plex Serif', 'IBM Plex Sans Arabic', Georgia, serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    /* bootstrap bridge */
    --bs-body-bg: var(--paper);
    --bs-body-color: var(--ink);
    --bs-body-font-family: var(--font-sans);
    --bs-body-font-size: 0.9375rem;
    --bs-body-line-height: 1.55;
    --bs-border-color: var(--rule);
    --bs-border-radius: 4px;
    --bs-border-radius-sm: 3px;
    --bs-border-radius-lg: 5px;
    --bs-link-color: var(--ink);
    --bs-link-hover-color: var(--rubric);
    --bs-secondary-color: var(--graphite);
    --bs-emphasis-color: var(--ink);
    --bs-primary: #191b1f;
    --bs-primary-rgb: 25, 27, 31;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: #e7e3da;
    color: var(--ink);
}

:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
    border-radius: 2px;
}

a {
    text-underline-offset: 2px;
}

/* ============================================================
   Rail
   ============================================================ */

.rail {
    width: var(--rail-w);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1030;
    background: var(--sheet);
    border-right: 1px solid var(--rule);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.rail-head {
    padding: 20px 20px 18px;
    border-bottom: 1px solid var(--rule);
}

.wordmark {
    display: flex;
    align-items: baseline;
    gap: 7px;
    text-decoration: none;
    color: var(--ink);
}

.wordmark-mark {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--rubric);
    line-height: 1;
}

.wordmark-name {
    font-family: var(--font-serif);
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.wordmark-sub {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--graphite-light);
}

.rail-nav {
    padding: 12px;
}

.rail-group {
    padding: 14px 8px 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--graphite-light);
}

.rail-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 3px;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.12s ease, color 0.12s ease;
}

.rail-link i {
    font-size: 0.95rem;
    color: var(--graphite-light);
    width: 1.1rem;
}

.rail-link:hover {
    background: var(--sheet-sunk);
    color: var(--ink);
}

.rail-link:hover i {
    color: var(--graphite);
}

.rail-link.is-active {
    background: var(--sheet-sunk);
    color: var(--ink);
    font-weight: 500;
}

.rail-link.is-active i {
    color: var(--rubric);
}

.rail-link.is-active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--rubric);
}

.rail-count {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--graphite-light);
    font-variant-numeric: tabular-nums;
}

.rail-foot {
    margin-top: auto;
    padding: 14px 16px;
    border-top: 1px solid var(--rule);
    display: flex;
    align-items: center;
    gap: 10px;
}

.identity {
    min-width: 0;
    flex: 1;
}

.identity-name {
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.identity-role {
    font-size: 0.75rem;
    color: var(--graphite-light);
}

/* ============================================================
   Frame
   ============================================================ */

.frame {
    margin-left: var(--rail-w);
    min-height: 100vh;
}

.masthead {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 32px 16px;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
}

.masthead h1 {
    font-family: var(--font-serif);
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    margin: 0;
}

.masthead-note {
    margin: 2px 0 0;
    font-size: 0.8125rem;
    color: var(--graphite);
}

.masthead-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sheet-main {
    padding: 26px 32px 56px;
}

.stack {
    display: grid;
    gap: 18px;
}

@media (max-width: 991.98px) {
    .rail {
        transform: translateX(-100%);
        transition: transform 0.18s ease;
    }

    .rail.is-open {
        transform: none;
        box-shadow: 0 0 0 100vmax rgba(25, 27, 31, 0.35);
    }

    .frame {
        margin-left: 0;
    }

    .masthead {
        padding: 14px 18px;
    }

    .sheet-main {
        padding: 18px 18px 48px;
    }
}

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

/* ============================================================
   Panels — ruled, never shadowed
   ============================================================ */

.card {
    background: var(--sheet);
    border: 1px solid var(--rule);
    border-radius: 4px;
    box-shadow: none;
}

.card-header,
.card-footer {
    background: transparent;
    border-color: var(--rule);
    padding: 14px 18px;
}

.card-body {
    padding: 18px;
}

.panel-title {
    font-family: var(--font-serif);
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.005em;
}

.panel-note {
    font-size: 0.8125rem;
    color: var(--graphite);
    margin: 3px 0 0;
}

/* ============================================================
   Ledger — the dashboard's one loud moment
   ============================================================ */

.ledger {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: var(--sheet);
    border: 1px solid var(--rule);
    border-radius: 4px;
    overflow: hidden;
}

.ledger-cell {
    padding: 18px 20px 20px;
    border-left: 1px solid var(--rule);
}

.ledger-cell:first-child {
    border-left: 0;
}

.ledger-label {
    font-size: 0.75rem;
    color: var(--graphite);
    margin-bottom: 12px;
}

.figure {
    font-family: var(--font-mono);
    font-size: 1.875rem;
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

.figure-unit {
    font-size: 0.875rem;
    color: var(--graphite-light);
    margin-left: 3px;
}

.figure-of {
    color: var(--graphite-light);
}

.ledger-foot {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--graphite-light);
}

.tally {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border: 1px solid var(--rule);
    border-radius: 4px;
    background: var(--sheet);
    overflow: hidden;
}

.tally-cell {
    padding: 13px 16px;
    border-left: 1px solid var(--rule);
}

.tally-cell:first-child {
    border-left: 0;
}

.tally-label {
    font-size: 0.75rem;
    color: var(--graphite);
}

.tally-value {
    font-family: var(--font-mono);
    font-size: 1.0625rem;
    font-variant-numeric: tabular-nums;
    margin-top: 4px;
}

.tally-value.is-stop {
    color: var(--stop);
}

.tally-value.is-work {
    color: var(--work);
}

@media (max-width: 1199.98px) {
    .ledger {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ledger-cell:nth-child(3) {
        border-left: 0;
    }

    .ledger-cell:nth-child(n + 3) {
        border-top: 1px solid var(--rule);
    }

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

    .tally-cell:nth-child(4) {
        border-left: 0;
    }

    .tally-cell:nth-child(n + 4) {
        border-top: 1px solid var(--rule);
    }
}

@media (max-width: 575.98px) {
    .ledger {
        grid-template-columns: minmax(0, 1fr);
    }

    .ledger-cell {
        border-left: 0;
    }

    .ledger-cell + .ledger-cell {
        border-top: 1px solid var(--rule);
    }

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

    .tally-cell:nth-child(odd) {
        border-left: 0;
    }

    .tally-cell:nth-child(n + 3) {
        border-top: 1px solid var(--rule);
    }
}

/* ============================================================
   Tables — ruled rows, tabular numerals
   ============================================================ */

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ink);
    margin-bottom: 0;
    font-size: 0.875rem;
}

.table > thead > tr > th {
    background: var(--sheet-sunk);
    border-bottom: 1px solid var(--rule-strong);
    color: var(--graphite);
    font-weight: 500;
    font-size: 0.75rem;
    padding: 9px 18px;
    white-space: nowrap;
}

.table > tbody > tr > td {
    border-bottom: 1px solid var(--rule);
    padding: 12px 18px;
    vertical-align: middle;
}

.table > tbody > tr:last-child > td {
    border-bottom: 0;
}

.table > tbody > tr:hover > td {
    background: var(--sheet-sunk);
}

.num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.8125rem;
}

.cell-title {
    font-weight: 500;
}

.cell-meta {
    font-size: 0.75rem;
    color: var(--graphite-light);
    margin-top: 2px;
}

.ref {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--graphite-light);
}

/* ============================================================
   Status marks — glyph plus word, never colour alone
   ============================================================ */

.mark {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 3px 8px 3px 7px;
    border-radius: 3px;
    white-space: nowrap;
}

.mark::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 1px;
    background: currentColor;
    flex: none;
}

.mark.is-ready {
    color: var(--ok);
    background: var(--ok-wash);
}

.mark.is-processing,
.mark.is-uploading {
    color: var(--work);
    background: var(--work-wash);
}

.mark.is-failed {
    color: var(--stop);
    background: var(--stop-wash);
}

.mark.is-pending {
    color: var(--idle);
    background: var(--idle-wash);
}

.mark.is-processing::before,
.mark.is-uploading::before {
    animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
    50% {
        opacity: 0.3;
    }
}

/* ============================================================
   Buttons — ink is the primary action
   ============================================================ */

.btn {
    --bs-btn-padding-y: 0.44rem;
    --bs-btn-padding-x: 0.85rem;
    --bs-btn-font-size: 0.875rem;
    --bs-btn-font-weight: 500;
    --bs-btn-border-radius: 4px;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn-sm {
    --bs-btn-padding-y: 0.28rem;
    --bs-btn-padding-x: 0.6rem;
    --bs-btn-font-size: 0.8125rem;
}

.btn-primary {
    --bs-btn-bg: var(--ink);
    --bs-btn-border-color: var(--ink);
    --bs-btn-hover-bg: #000;
    --bs-btn-hover-border-color: #000;
    --bs-btn-active-bg: #000;
    --bs-btn-active-border-color: #000;
    --bs-btn-disabled-bg: var(--graphite-light);
    --bs-btn-disabled-border-color: var(--graphite-light);
}

.btn-outline-secondary {
    --bs-btn-color: var(--ink-soft);
    --bs-btn-border-color: var(--rule-strong);
    --bs-btn-bg: var(--sheet);
    --bs-btn-hover-bg: var(--sheet-sunk);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-border-color: var(--graphite-light);
    --bs-btn-active-bg: var(--sheet-sunk);
    --bs-btn-active-color: var(--ink);
    --bs-btn-active-border-color: var(--graphite);
}

.btn-outline-danger {
    --bs-btn-color: var(--stop);
    --bs-btn-border-color: var(--rule-strong);
    --bs-btn-bg: var(--sheet);
    --bs-btn-hover-bg: var(--stop-wash);
    --bs-btn-hover-color: var(--stop);
    --bs-btn-hover-border-color: var(--stop);
    --bs-btn-active-bg: var(--stop-wash);
    --bs-btn-active-color: var(--stop);
    --bs-btn-active-border-color: var(--stop);
}

.btn-link {
    --bs-btn-color: var(--ink);
    --bs-btn-hover-color: var(--rubric);
    text-decoration: none;
}

.segmented {
    display: inline-flex;
    border: 1px solid var(--rule-strong);
    border-radius: 4px;
    overflow: hidden;
    background: var(--sheet);
}

.segmented a {
    padding: 5px 12px;
    font-size: 0.8125rem;
    color: var(--graphite);
    text-decoration: none;
    border-left: 1px solid var(--rule);
    font-variant-numeric: tabular-nums;
}

.segmented a:first-child {
    border-left: 0;
}

.segmented a:hover {
    background: var(--sheet-sunk);
    color: var(--ink);
}

.segmented a.is-on {
    background: var(--ink);
    color: #fff;
}

/* ============================================================
   Forms
   ============================================================ */

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ink-soft);
    margin-bottom: 5px;
}

.form-control,
.form-select {
    border: 1px solid var(--rule-strong);
    border-radius: 4px;
    background-color: var(--sheet);
    color: var(--ink);
    font-size: 0.875rem;
    padding: 0.45rem 0.7rem;
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(25, 27, 31, 0.08);
}

.form-control::placeholder {
    color: var(--graphite-light);
}

.form-text {
    font-size: 0.75rem;
    color: var(--graphite);
    margin-top: 5px;
}

textarea.form-control {
    line-height: 1.6;
}

textarea[name='instructions'] {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.7;
    background: var(--sheet-sunk);
}

.form-check-input:checked {
    background-color: var(--ink);
    border-color: var(--ink);
}

.form-check-input:focus {
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(25, 27, 31, 0.08);
}

/* ============================================================
   Notices
   ============================================================ */

.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--rule);
    border-left: 2px solid var(--graphite);
    border-radius: 3px;
    background: var(--sheet);
    font-size: 0.875rem;
    margin-bottom: 18px;
}

.notice i {
    line-height: 1.5;
}

.notice-body {
    flex: 1;
    min-width: 0;
}

.notice-close {
    background: none;
    border: 0;
    color: var(--graphite-light);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 2px;
}

.notice-close:hover {
    color: var(--ink);
}

.notice.is-ok {
    border-color: #d5e5dd;
    border-left-color: var(--ok);
    background: var(--ok-wash);
}

.notice.is-ok i {
    color: var(--ok);
}

.notice.is-stop {
    border-color: #f0d9d6;
    border-left-color: var(--stop);
    background: var(--stop-wash);
}

.notice.is-stop i {
    color: var(--stop);
}

.notice.is-work {
    border-color: #efe2cd;
    border-left-color: var(--work);
    background: var(--work-wash);
}

.notice.is-work i {
    color: var(--work);
}

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

/* ============================================================
   Empty states — an invitation, not a shrug
   ============================================================ */

.blank {
    padding: 44px 24px;
    text-align: center;
}

.blank-line {
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--ink-soft);
}

.blank-note {
    font-size: 0.8125rem;
    color: var(--graphite-light);
    margin-top: 5px;
}

/* ============================================================
   Odds and ends
   ============================================================ */

code {
    font-family: var(--font-mono);
    font-size: 0.8125em;
    color: var(--ink-soft);
    background: var(--sheet-sunk);
    border: 1px solid var(--rule);
    border-radius: 3px;
    padding: 0.1em 0.35em;
}

pre.snippet {
    font-family: var(--font-mono);
    background: var(--sheet-sunk);
    border: 1px solid var(--rule);
    border-radius: 3px;
    padding: 12px 14px;
    white-space: pre-wrap;
    font-size: 0.75rem;
    line-height: 1.65;
    max-height: 230px;
    overflow: auto;
    margin: 0;
}

.steps {
    counter-reset: step;
    list-style: none;
    margin: 0;
    padding: 0;
}

.steps li {
    position: relative;
    padding: 0 0 12px 26px;
    margin-left: 6px;
    font-size: 0.8125rem;
    color: var(--graphite);
    border-left: 1px solid var(--rule);
}

.steps li:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.steps li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: -8px;
    top: -1px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--sheet);
    border: 1px solid var(--rule-strong);
    color: var(--graphite);
    font-family: var(--font-mono);
    font-size: 0.625rem;
    display: grid;
    place-items: center;
}

.page-nav {
    display: flex;
    justify-content: flex-end;
    padding: 12px 18px 0;
}

.pagination {
    --bs-pagination-color: var(--ink-soft);
    --bs-pagination-bg: var(--sheet);
    --bs-pagination-border-color: var(--rule);
    --bs-pagination-hover-bg: var(--sheet-sunk);
    --bs-pagination-hover-color: var(--ink);
    --bs-pagination-hover-border-color: var(--rule-strong);
    --bs-pagination-active-bg: var(--ink);
    --bs-pagination-active-border-color: var(--ink);
    --bs-pagination-focus-box-shadow: 0 0 0 3px rgba(25, 27, 31, 0.08);
    --bs-pagination-font-size: 0.8125rem;
    margin-bottom: 0;
}

.dl-env {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 9px 16px;
    margin: 0;
    font-size: 0.8125rem;
}

.dl-env dt {
    color: var(--graphite);
    font-weight: 400;
}

.dl-env dd {
    margin: 0;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    overflow-wrap: anywhere;
}

/* ============================================================
   Gate — sign in
   ============================================================ */

.gate {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    padding: 24px;
    background: var(--paper);
}

.gate-card {
    width: 100%;
    max-width: 380px;
}

.gate-mark {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}

.gate-mark .wordmark-name {
    font-size: 1.5rem;
}

.gate-mark .wordmark-mark {
    font-size: 1.5rem;
}

.gate-lede {
    font-family: var(--font-serif);
    font-size: 0.9375rem;
    color: var(--graphite);
    margin: 0 0 24px;
    line-height: 1.6;
}

.gate-sheet {
    background: var(--sheet);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 22px;
}

.gate-foot {
    margin: 16px 0 0;
    font-size: 0.75rem;
    color: var(--graphite-light);
}

/* ============================================================
   Transcript — the admin's reading view of a thread
   ============================================================ */

.transcript {
    max-width: 76ch;
}

.turn {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 20px;
    padding: 22px 0;
    border-top: 1px solid var(--rule);
}

.turn:first-child {
    border-top: 0;
    padding-top: 4px;
}

.turn-rubric {
    font-size: 0.75rem;
    color: var(--graphite-light);
    padding-top: 2px;
}

.turn.is-answer .turn-rubric {
    color: var(--rubric);
}

.turn-body {
    min-width: 0;
}

.ask-text {
    font-size: 0.9375rem;
    color: var(--ink-soft);
    margin: 0;
    white-space: pre-wrap;
}

.answer-text {
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 1.72;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.answer-text:lang(ar),
.answer-text[dir='rtl'] {
    line-height: 1.95;
}

.turn-meta {
    margin-top: 12px;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--graphite-light);
}

.turn-queries {
    margin-top: 4px;
    font-family: var(--font-sans);
    font-size: 0.75rem;
}

.apparatus {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid var(--rule);
}

.apparatus-head {
    font-size: 0.75rem;
    color: var(--graphite);
    margin-bottom: 8px;
}

.apparatus-list {
    margin: 0;
    padding-left: 18px;
    font-size: 0.8125rem;
}

.apparatus-list li {
    margin-bottom: 6px;
}

.apparatus-list li::marker {
    color: var(--rubric);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.apparatus-list summary {
    cursor: pointer;
    color: var(--ink-soft);
}

.apparatus-list summary:hover {
    color: var(--rubric);
}

.apparatus-score {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--graphite-light);
    margin-left: 6px;
}

@media (max-width: 767.98px) {
    .turn {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }
}

/* ============================================================
   Playground
   ============================================================ */

.probe-result {
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 1.72;
    white-space: pre-wrap;
}

.hit {
    border-top: 1px solid var(--rule);
    padding: 14px 0;
}

.hit:first-of-type {
    border-top: 0;
}

.hit-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}

.hit-file {
    font-weight: 500;
    font-size: 0.875rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.hit-score {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--rubric);
    flex: none;
}

.turn-meta span + span::before {
    content: '';
    display: inline-block;
    width: 1px;
    height: 9px;
    background: var(--rule-strong);
    margin: 0 9px;
    vertical-align: -1px;
}

/* facts read as a ruled line, never a dot-joined string */
.facts span + span::before,
.masthead-note span + span::before {
    content: '';
    display: inline-block;
    width: 1px;
    height: 9px;
    background: var(--rule-strong);
    margin: 0 8px;
    vertical-align: -1px;
}

/* ============================================================
   Starter questions editor
   ============================================================ */

.suggestion-rows {
    display: grid;
    gap: 8px;
}

.suggestion-row {
    display: grid;
    grid-template-columns: 66px minmax(0, 1fr) 58px;
    gap: 10px;
    align-items: center;
}

.suggestion-state {
    font-size: 0.75rem;
    color: var(--ok);
}

@media (max-width: 575.98px) {
    .suggestion-row {
        grid-template-columns: 66px minmax(0, 1fr);
    }

    .suggestion-state {
        display: none;
    }
}

/* native spinners are ugly and easy to hit by accident */
input[type='number'] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ============================================================
   Scrollbars — no arrow buttons, thin thumb
   ============================================================ */

* {
    scrollbar-width: thin;
    scrollbar-color: var(--rule-strong) transparent;
}

::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--rule-strong);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--graphite-light);
    background-clip: content-box;
}

/* ============================================================
   Dialogs — a sheet on paper, not a floating balloon
   ============================================================ */

.modal-content {
    background: var(--sheet);
    border: 1px solid var(--rule-strong);
    border-radius: 4px;
    box-shadow: 0 16px 48px rgba(25, 27, 31, 0.16);
}

.modal-header,
.modal-footer {
    border-color: var(--rule);
    padding: 14px 18px;
}

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

.modal-body {
    padding: 18px;
}

.modal-footer {
    gap: 8px;
}

.modal-footer > * {
    margin: 0;
}

.modal-backdrop.show {
    opacity: 0.28;
}

/* ============================================================
   Row actions and filters
   ============================================================ */

.row-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 5px;
    justify-content: flex-end;
    white-space: nowrap;
}

.col-actions {
    width: 1%;
    white-space: nowrap;
}

.row-actions form {
    display: inline;
}

.filters {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.filters > div {
    flex: 1 1 150px;
    min-width: 0;
}

.filters > div:first-child {
    flex: 2 1 220px;
}

.cell-error {
    display: block;
    max-width: 46ch;
    font-size: 0.75rem;
    color: var(--stop);
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .filters > div,
    .filters > div:first-child {
        flex: 1 1 100%;
    }
}
