/* ============================================================
   Akteneinsicht — design system
   ------------------------------------------------------------
   Palette retuned to Riedl Rechtsanwälte: clean white surfaces,
   deep-navy text/secondary, red accent. Variable names kept
   ("copper" → red accent, "ink-blue" → navy) so the rest of the
   stylesheet doesn't need to be touched. Bootstrap is the substrate.
   ============================================================ */

:root {
    /* ---- palette (Riedl: navy + red on white) ---- */
    --paper:           #FFFFFF;   /* page background, clean white */
    --paper-deep:      #F4F5FA;   /* sidebar / sunken surfaces, pale navy tint */
    --surface:         #FFFFFF;   /* cards, raised surfaces */
    --ink:             #131533;   /* body text, deep navy */
    --ink-soft:        #2A2D55;
    --ink-mute:        #5C6080;
    --ink-faint:       #A8ACC4;
    --rule:            #E2E4ED;   /* hairline border */
    --rule-strong:     #C5C8DC;

    /* "copper" is now Riedl red — the primary accent (CTA, focus, key links). */
    --copper:          #CB0D1C;
    --copper-deep:     #A00813;
    --copper-soft:     #FCE6E8;   /* tinted hover/active surfaces */
    --copper-faint:    #FEF5F6;

    /* Riedl navy — secondary accent for headings, secondary links. */
    --ink-blue:        #202354;
    --warning-amber:   #B8853B;
    --positive:        #1F7A3E;
    --negative:        #B91C1C;

    /* ---- typography ---- */
    --font-display: "Newsreader", Georgia, "Times New Roman", serif;
    --font-sans:    "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

    /* ---- spacing ---- */
    --gutter:       28px;
    --gutter-tight: 18px;

    /* ---- shell sizing ---- */
    --topbar-h:     56px;
    --docstrip-h:   44px;
    --sidebar-w:    300px;
    --content-max:  1320px;

    /* ---- timing ---- */
    --ease:         cubic-bezier(.2, .8, .2, 1);
}

/* =====================================================================
   Reset & Base
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    font-feature-settings: "ss01", "cv11";
    /* very subtle paper grain — recolored to a faint navy tint so it
       harmonises with the Riedl palette instead of warming the page. */
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 0.07  0 0 0 0 0.08  0 0 0 0 0.20  0 0 0 0.035 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    background-attachment: fixed;
}

::selection {
    background: var(--copper-soft);
    color: var(--ink);
}

a { color: var(--ink-blue); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .15s var(--ease); }
a:hover { border-bottom-color: var(--ink-blue); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 500;
    color: var(--ink);
    letter-spacing: -0.01em;
    margin: 0;
}

/* =====================================================================
   Top bar
   ===================================================================== */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 24px;
    background: #202354;
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--rule);
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
}

.topbar__logo { display: flex; align-items: center; }
.topbar__logo img { display: block; height: 22px; width: auto; }
.topbar__logo--riedl img { height: 44px; }

.topbar__rule {
    display: inline-block;
    width: 1px;
    height: 24px;
    background: var(--rule-strong);
    flex: 0 0 auto;
}

.topbar__title {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}
.topbar__title-name {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 17px;
    letter-spacing: -0.01em;
    color: var(--ink);
}
.topbar__title-sub {
    font-family: var(--font-sans);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-mute);
    margin-top: 2px;
}

.topbar__spacer { flex: 1; }

.topbar__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 0 auto;
}

/* Language switcher (overrides original .language-switcher absolute pos)
   Bootstrap's button reset and our own variants are spec'd high, so the
   selectors here intentionally win on specificity + !important. */
.topbar .language-switcher,
.language-switcher {
    position: static !important;
    transform: none !important;
    display: inline-flex !important;
    align-items: center;
    gap: 2px;
    border: 1px solid var(--rule-strong) !important;
    border-radius: 999px !important;
    padding: 2px !important;
    background: var(--surface) !important;
    box-shadow: none !important;
}

.topbar .language-switcher .language-btn,
.language-switcher .language-btn {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    padding: 4px 12px !important;
    font-family: var(--font-sans) !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    letter-spacing: 0.08em !important;
    color: var(--ink-mute) !important;
    cursor: pointer;
    border-radius: 999px !important;
    line-height: 1.4;
    transition: background-color .15s var(--ease), color .15s var(--ease);
    box-shadow: none !important;
}

.topbar .language-switcher .language-btn:hover,
.language-switcher .language-btn:hover {
    color: var(--ink) !important;
    background: transparent !important;
}

.topbar .language-switcher .language-btn.active,
.language-switcher .language-btn.active {
    background: var(--ink) !important;
    background-color: var(--ink) !important;
    color: var(--paper) !important;
    border-color: var(--ink) !important;
}

.topbar .language-switcher .language-btn:focus,
.topbar .language-switcher .language-btn:focus-visible {
    outline: 0 !important;
    box-shadow: 0 0 0 3px var(--copper-soft) !important;
}

/* =====================================================================
   Document strip — the Akten-Lasche
   ===================================================================== */

.docstrip {
    position: sticky;
    top: var(--topbar-h);
    z-index: 49;
    height: var(--docstrip-h);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    background: var(--paper-deep);
    border-bottom: 1px solid var(--rule);
    font-size: 12px;
}

.docstrip__dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--copper);
    box-shadow: 0 0 0 3px var(--copper-faint);
    flex: 0 0 auto;
}

.docstrip__label {
    font-family: var(--font-sans);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ink-mute);
}

.docstrip__name {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 14px;
    color: var(--ink);
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.docstrip__meta {
    color: var(--ink-mute);
    font-family: var(--font-mono);
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 14px;
}
.docstrip__meta span:not(:first-child)::before {
    content: "·";
    margin-right: 14px;
    color: var(--ink-faint);
}

.docstrip__spacer { flex: 1; }

/* Compact upload action that lives in the docstrip — the only persistent
   way to swap the loaded case file. Quiet hairline button, copper on hover. */
.docstrip__upload {
    background: var(--surface);
    color: var(--ink-soft);
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
    padding: 4px 12px;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.docstrip__upload:hover {
    background: var(--copper-soft);
    border-color: var(--copper);
    color: var(--copper-deep);
}
.docstrip__upload svg { opacity: .8; }
.docstrip__upload:hover svg { opacity: 1; }

/* Hide the legacy upload form visually but keep it focusable for the JS. */
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =====================================================================
   Shell — two-column layout
   ===================================================================== */

.shell {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 36px 24px 80px;
    display: grid;
    /* Workbench layout: main on the left, history sidebar on the right.
       The main column is the workspace; the sidebar is a quiet aside. */
    grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
    gap: 36px;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: calc(var(--topbar-h) + var(--docstrip-h) + 24px);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.main {
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-width: 0;
}

@media (max-width: 1080px) {
    .shell {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 24px 16px 64px;
    }
    .sidebar { position: static; }
}

/* Hero card — the primary workflow (Akten-Auswertung) gets a touch more
   visual weight: a copper hairline at the top so it reads as anchored. */
.card--hero {
    border-top: 2px solid var(--copper) !important;
}

/* =====================================================================
   Section heading (the small uppercase label above each block)
   ===================================================================== */

.eyebrow {
    font-family: var(--font-sans);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-mute);
    margin: 0 0 12px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.012em;
    margin: 0 0 14px;
    color: var(--ink);
}

/* =====================================================================
   Cards — the page-on-paper feel
   ===================================================================== */

.card {
    background: var(--surface) !important;
    border: 1px solid var(--rule) !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    padding: 0;
    overflow: hidden;
}

.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--rule) !important;
    padding: 14px 20px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h5 {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink);
}

.card-body { padding: 20px !important; }

/* Sidebar tools use a quieter card with paper-deep header tint */
.sidebar .card-header { background: var(--paper-deep) !important; }

/* =====================================================================
   Form controls
   ===================================================================== */

.form-label {
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-mute);
    margin-bottom: 6px;
}

.form-control,
.form-select {
    background: var(--surface);
    border: 1px solid var(--rule-strong);
    border-radius: 3px;
    padding: 10px 12px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--ink);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}

.form-control:focus,
.form-select:focus {
    outline: 0;
    border-color: var(--copper);
    box-shadow: 0 0 0 3px var(--copper-soft);
    background: var(--surface);
}

textarea.form-control { line-height: 1.5; min-height: 92px; resize: vertical; }

.form-control::placeholder { color: var(--ink-faint); font-style: italic; }

/* Form check / switch — only override colors, never the shorthand `background`,
   because Bootstrap relies on a data-URI background-image for the switch knob. */
.form-check-input {
    border-color: var(--rule-strong);
    background-color: var(--surface);
}
.form-check-input:checked {
    background-color: var(--copper);
    border-color: var(--copper);
}
.form-check-input:focus {
    border-color: var(--copper);
    box-shadow: 0 0 0 3px var(--copper-soft);
}

/* Make the switch a touch smaller so it sits politely next to the label */
.form-switch .form-check-input {
    width: 2.1em;
    height: 1.1em;
    margin-top: 0.18em;
}

.form-check-label { color: var(--ink-soft); font-size: 12px; }

/* File input */
input[type="file"].form-control {
    padding: 8px 12px;
    cursor: pointer;
}
input[type="file"].form-control::file-selector-button {
    background: var(--paper-deep);
    color: var(--ink);
    border: 1px solid var(--rule-strong);
    border-radius: 2px;
    padding: 4px 12px;
    margin-right: 12px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s var(--ease);
}
input[type="file"].form-control::file-selector-button:hover {
    background: var(--copper-soft);
}

/* =====================================================================
   Buttons
   ===================================================================== */

.btn {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    border-radius: 3px;
    padding: 9px 18px;
    transition: transform .12s var(--ease), background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
    border: 1px solid transparent;
    line-height: 1.4;
}

.btn:focus, .btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px var(--copper-soft);
}

/* Primary — copper with embossed bottom edge */
.btn-primary,
.btn-primary:focus {
    background: var(--copper) !important;
    border-color: var(--copper) !important;
    border-bottom-color: var(--copper-deep) !important;
    border-bottom-width: 2px !important;
    color: #fff !important;
    box-shadow: none;
}
.btn-primary:hover {
    background: var(--copper-deep) !important;
    border-color: var(--copper-deep) !important;
    transform: translateY(1px);
}
.btn-primary:active { transform: translateY(2px); }
.btn-primary:disabled,
.btn-primary.disabled {
    background: var(--paper-deep) !important;
    border-color: var(--rule-strong) !important;
    color: var(--ink-faint) !important;
    transform: none;
    border-bottom-width: 1px !important;
}

/* Secondary stays muted */
.btn-secondary,
.btn-outline-secondary {
    background: var(--surface) !important;
    border-color: var(--rule-strong) !important;
    color: var(--ink-soft) !important;
}
.btn-secondary:hover,
.btn-outline-secondary:hover {
    background: var(--paper-deep) !important;
    color: var(--ink) !important;
}

.btn-outline-primary {
    background: var(--surface) !important;
    border-color: var(--copper) !important;
    color: var(--copper-deep) !important;
}
.btn-outline-primary:hover {
    background: var(--copper-soft) !important;
    border-color: var(--copper) !important;
    color: var(--copper-deep) !important;
}

.btn-outline-danger {
    background: transparent !important;
    border-color: var(--rule-strong) !important;
    color: var(--ink-mute) !important;
}
.btn-outline-danger:hover {
    background: #FBE9E4 !important;
    border-color: var(--negative) !important;
    color: var(--negative) !important;
}

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Action icons inside answer headers */
.copy-btn { display: inline-flex; align-items: center; gap: 6px; }

/* =====================================================================
   Answer block — the marginalia line
   ===================================================================== */

#answerSection h5 {
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink);
    margin-bottom: 12px;
}

#answerContent {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 0 0 0 18px !important;
    position: relative;
}
#answerContent::before {
    content: "";
    position: absolute;
    left: 0; top: 4px; bottom: 4px;
    width: 2px;
    background: var(--copper);
    opacity: .85;
}

.answer-container {
    font-family: var(--font-display);
    font-size: 16.5px;
    line-height: 1.6;
    color: var(--ink);
    white-space: normal !important;
}
.answer-container p { margin-bottom: 0.85em; }
.answer-container h1 { font-size: 1.45rem; margin: 1.2rem 0 0.6rem; }
.answer-container h2 { font-size: 1.2rem; margin: 1.0rem 0 0.5rem; }
.answer-container h3 { font-size: 1.05rem; margin: 0.85rem 0 0.4rem; }
.answer-container ul, .answer-container ol { margin-bottom: 0.85em; padding-left: 1.4em; }
.answer-container li { margin-bottom: 0.2em; }
.answer-container code {
    font-family: var(--font-mono);
    font-size: 0.86em;
    background: var(--paper-deep);
    padding: 0.1em 0.35em;
    border-radius: 2px;
}
.answer-container blockquote {
    border-left: 2px solid var(--rule-strong);
    padding-left: 14px;
    color: var(--ink-soft);
    margin: 0.9em 0;
}

/* =====================================================================
   Schema renderers
   ===================================================================== */

/* TOC — editorial dotted leaders between title and page numbers.
   The leader is a dedicated flex child with a dotted bottom-border so it
   never wraps onto a second line and always sits on the baseline. */
.akt-toc {
    width: 100%;
}
.akt-toc__row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    border-bottom: 1px solid var(--rule);
    padding: 9px 0;
}
.akt-toc__title {
    flex: 0 1 auto;
    font-family: var(--font-display);
    font-size: 15px;
    color: var(--ink);
    line-height: 1.3;
}
.akt-toc__leader {
    flex: 1 1 auto;
    min-width: 24px;
    height: 0;
    border-bottom: 1px dotted var(--ink-faint);
    transform: translateY(-3px); /* drop the dots onto the baseline */
}
.akt-toc__pages {
    flex: 0 0 auto;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-soft);
    white-space: nowrap;
}

/* Participant cards — index numerals in copper */
.akt-card {
    border: 1px solid var(--rule);
    background: var(--surface);
    padding: 16px 18px 16px 56px;
    margin-bottom: 12px;
    position: relative;
    border-radius: 3px;
}
.akt-card__index {
    position: absolute;
    left: 16px;
    top: 14px;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: 22px;
    color: var(--copper);
    letter-spacing: 0.02em;
}
.akt-card__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--rule);
}
.akt-card__role {
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--ink);
}
.akt-card__type {
    font-family: var(--font-sans);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-mute);
    border: 1px solid var(--rule-strong);
    padding: 2px 8px;
    border-radius: 999px;
}
.akt-card__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 24px;
    font-size: 13px;
}
.akt-card__grid > div { display: flex; gap: 8px; }
.akt-card__field-label {
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-mute);
    flex: 0 0 auto;
    padding-top: 1px;
}
.akt-card__field-value {
    color: var(--ink);
    word-break: break-word;
}
.akt-card__field-value--muted { color: var(--ink-faint); }
.akt-card__field--full { grid-column: 1 / -1; }

/* Damage block */
.akt-damage { display: grid; gap: 14px; }
.akt-damage__panel {
    border: 1px solid var(--rule);
    background: var(--surface);
    padding: 16px 18px;
    border-radius: 3px;
}
.akt-damage__title {
    font-family: var(--font-sans);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-mute);
    margin-bottom: 10px;
}
.akt-damage__row { display: flex; gap: 10px; padding: 4px 0; font-size: 14px; }
.akt-damage__row .label {
    flex: 0 0 130px;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-mute);
    padding-top: 2px;
}
.akt-damage__row .value { color: var(--ink); }
.akt-damage__total {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--ink);
    margin-top: 4px;
}
.akt-damage__positions {
    width: 100%; border-collapse: collapse;
    margin-top: 10px;
}
.akt-damage__positions th {
    text-align: left;
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ink-mute);
    padding: 8px 0;
    border-bottom: 1px solid var(--rule);
}
.akt-damage__positions td {
    padding: 8px 0;
    border-bottom: 1px solid var(--rule);
    font-size: 13px;
}
.akt-damage__positions td:last-child {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 12.5px;
}

/* Substance grid — quiet copper dots, not warning badges */
.akt-substances {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.akt-sub-tile {
    border: 1px solid var(--rule);
    background: var(--surface);
    padding: 14px 16px;
    border-radius: 3px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.akt-sub-tile__indicator {
    flex: 0 0 auto;
    width: 12px; height: 12px; border-radius: 50%;
    margin-top: 4px;
    border: 1px solid var(--rule-strong);
}
.akt-sub-tile--found .akt-sub-tile__indicator {
    background: var(--copper);
    border-color: var(--copper);
    box-shadow: 0 0 0 3px var(--copper-faint);
}
.akt-sub-tile__body { flex: 1; min-width: 0; }
.akt-sub-tile__head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.akt-sub-tile__name {
    font-family: var(--font-display);
    font-size: 15px;
    color: var(--ink);
}
.akt-sub-tile__status {
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ink-mute);
}
.akt-sub-tile--found .akt-sub-tile__status { color: var(--copper-deep); }
.akt-sub-tile__evidence {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--ink-soft);
    line-height: 1.5;
}

@media (max-width: 640px) {
    .akt-substances { grid-template-columns: 1fr; }
    .akt-card__grid { grid-template-columns: 1fr; }
}

/* =====================================================================
   Batch results — Roman-numeral marginalia
   ===================================================================== */

.batch-results-container { display: flex; flex-direction: column; gap: 28px; }
#batchResultsContent {
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
}

.batch-item {
    position: relative;
    padding-left: 48px;
}
.batch-item__marker {
    position: absolute;
    left: 0; top: 0;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 18px;
    font-weight: 500;
    color: var(--copper);
    letter-spacing: 0.04em;
    user-select: none;
}
.batch-item__question {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 17px;
    color: var(--ink);
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--rule);
}
.batch-item__answer { /* renderAnswer output container */ }
.batch-item__answer .answer-container { font-size: 15.5px; }

/* =====================================================================
   Verlauf — the Aktenstreifen
   ===================================================================== */

#historySection .card-body { padding: 0 !important; }

.akt-history { display: flex; flex-direction: column; }
.akt-history__empty {
    padding: 16px 20px;
    color: var(--ink-mute);
    font-style: italic;
    font-size: 12.5px;
}

.history-row {
    border: 0 !important;
    border-bottom: 1px solid var(--rule) !important;
    border-radius: 0 !important;
    padding: 12px 18px !important;
    margin: 0 !important;
    background: var(--surface);
    transition: background-color .15s var(--ease);
    position: relative;
}
.history-row:hover { background: var(--copper-faint); }
.history-row:last-child { border-bottom: 0 !important; }

.history-row__top {
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap;
    font-size: 11px;
}
.history-row__time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
}
.history-row__type {
    font-family: var(--font-sans);
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ink-mute);
    border: 1px solid var(--rule-strong);
    padding: 1px 7px;
    border-radius: 999px;
}
.history-row__type--batch {
    color: var(--copper-deep);
    border-color: var(--copper);
    background: var(--copper-faint);
}
.history-row__count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-faint);
}
.history-row__status {
    font-family: var(--font-sans);
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--warning-amber);
}

.history-row__question {
    margin-top: 6px;
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--ink);
    line-height: 1.4;
}
.history-row__doc {
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--ink-faint);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.history-row__delete {
    position: absolute;
    top: 10px; right: 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--ink-faint);
    border-radius: 3px;
    padding: 3px 6px;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}
.history-row:hover .history-row__delete { opacity: 1; }
.history-row__delete:hover {
    color: var(--negative);
    background: var(--surface);
    border-color: var(--rule-strong);
}

/* The legacy inline history-detail (in the sidebar) is no longer used —
   we now show a full dedicated view in the main column instead. */

/* Active history entry in the sidebar gets a copper left rule so the user
   can see which run is currently open in the detail view. */
.history-row.is-active {
    background: var(--copper-faint);
    box-shadow: inset 3px 0 0 var(--copper);
}
.history-row.is-active:hover { background: var(--copper-faint); }

/* =====================================================================
   Verlauf-Detail-View — dedicated workspace replacement
   ===================================================================== */

.history-detail-view .card-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
}

.history-detail-view__back {
    background: transparent;
    border: 1px solid var(--rule-strong);
    color: var(--ink-soft);
    padding: 4px 10px 4px 8px;
    border-radius: 3px;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.history-detail-view__back:hover {
    background: var(--copper-soft);
    border-color: var(--copper);
    color: var(--copper-deep);
}

.history-detail-view .card-header h5 {
    text-align: center;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: 16px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink);
}

.history-detail-view__delete {
    /* uses .btn-outline-danger styles from global rules */
}

.history-detail-view__meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
    padding-bottom: 14px;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}
.history-detail-view__meta-pair {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}
.history-detail-view__meta-label {
    font-family: var(--font-sans);
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-faint);
}
.history-detail-view__meta-value {
    color: var(--ink-soft);
}

.history-detail-view__items {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.history-detail-view__item {
    position: relative;
    padding-left: 48px;
}
.history-detail-view__item-marker {
    position: absolute;
    left: 0; top: 0;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: 18px;
    color: var(--copper);
    letter-spacing: 0.04em;
    user-select: none;
}
.history-detail-view__item-question {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 17px;
    color: var(--ink);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--rule);
    line-height: 1.4;
}

/* =====================================================================
   Loading / streaming — the slow stamp
   ===================================================================== */

.loading {
    display: none;
    text-align: left;
    padding: 16px 0;
}
.loading p {
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ink-mute);
    margin: 0;
    padding-bottom: 8px;
}
.loading .spinner-border { display: none; } /* swap default Bootstrap spinner */

.loading::after {
    content: "";
    display: block;
    height: 1.5px;
    background: linear-gradient(90deg, var(--copper) 0%, var(--copper) 40%, transparent 40%);
    background-size: 200% 100%;
    animation: loading-sweep 1.6s linear infinite;
}

@keyframes loading-sweep {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Streaming caret — typewriter blink at the end of streamed text */
#streamingResponse::after {
    content: "▍";
    display: inline-block;
    margin-left: 2px;
    color: var(--copper);
    animation: caret-blink 1.05s steps(2) infinite;
    vertical-align: text-bottom;
}
@keyframes caret-blink { 50% { opacity: 0; } }

/* =====================================================================
   Status pill (api status — bottom right)
   ===================================================================== */

.api-status {
    position: fixed;
    bottom: 14px;
    right: 14px;
    padding: 5px 12px 5px 22px;
    border-radius: 999px;
    font-family: var(--font-sans);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--rule-strong);
    color: var(--ink-mute);
    z-index: 60;
}
.api-status::before {
    content: "";
    position: absolute;
    left: 9px; top: 50%;
    width: 7px; height: 7px;
    border-radius: 50%;
    transform: translateY(-50%);
    background: var(--ink-faint);
}
.api-status.connected { border-color: var(--rule-strong); color: var(--positive); background: var(--surface); }
.api-status.connected::before { background: var(--positive); box-shadow: 0 0 0 3px rgba(68,112,79,0.18); }
.api-status.disconnected { border-color: var(--rule-strong); color: var(--negative); background: var(--surface); }
.api-status.disconnected::before { background: var(--negative); }

/* =====================================================================
   Document upload result chips (#documentsContainer alerts)
   ===================================================================== */

#resultsSection { display: none; margin-top: 30px; }
#documentsContainer .alert {
    border-radius: 3px;
    border: 1px solid var(--rule);
    background: var(--surface);
    color: var(--ink-soft);
    padding: 10px 14px;
    font-size: 13px;
}
#documentsContainer .alert-success { border-color: rgba(68,112,79,0.4); background: #F1F5F2; color: var(--positive); }
#documentsContainer .alert-danger  { border-color: rgba(140,58,46,0.4); background: #FBE9E4; color: var(--negative); }

/* =====================================================================
   Question template list (sidebar)
   ===================================================================== */

#templateQuestionsContainer .list-group-item {
    border: 0;
    border-bottom: 1px solid var(--rule);
    background: transparent;
    padding: 8px 0;
    color: var(--ink-soft);
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
#templateQuestionsContainer .list-group-item:last-child { border-bottom: 0; }
#templateQuestionsContainer .list-group-item::before {
    content: "§";
    flex: 0 0 auto;
    color: var(--copper);
    font-family: var(--font-display);
    font-style: italic;
    font-size: 16px;
    line-height: 1.1;
    padding-top: 1px;
}

/* =====================================================================
   Misc utilities
   ===================================================================== */

.text-muted { color: var(--ink-mute) !important; }
.fst-italic { font-family: var(--font-display); font-style: italic; }

.alert {
    border-radius: 3px;
    font-size: 13px;
}
.alert-warning {
    border-color: rgba(184,133,59,0.45);
    background: #FBF3E1;
    color: #6E5217;
}
.alert-danger {
    border-color: rgba(140,58,46,0.4);
    background: #FBE9E4;
    color: var(--negative);
}

/* Copy toast keeps working unchanged */
.copy-notification {
    position: fixed;
    bottom: 64px;
    right: 14px;
    background: var(--ink);
    color: var(--paper);
    padding: 8px 14px;
    border-radius: 3px;
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 0.04em;
    z-index: 70;
    animation: toast-in .3s var(--ease) both, toast-out .3s var(--ease) 1.6s both;
}
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; } }

/* Hide the old loose logo containers if they still ship — top bar carries them now */
body > .logo-container { display: none; }

/* Container reset: kill the old absolute-centered layout */
body > .container { display: none !important; }

/* Footer */
footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--rule);
    color: var(--ink-mute);
    font-size: 12px;
}
