/* ============================================================
   SV PROTOKOLL – Stylesheet
   Editor UI + print-exact A4 protocol pages
   ============================================================ */

:root {
    /* A4 dimensions */
    --page-w: 210mm;
    --page-h: 297mm;

    /* Outer margin (space from page edge to frame border) */
    --margin-outer: 12mm;

    /* Frame border thickness */
    --border-w: 1.5px;
    --rule-w: 3px;

    /* Inner padding (space from frame border to content) */
    --pad-x: 12mm;
    --pad-top: 4mm;
    --pad-bottom: 6mm;

    /* Font families */
    --font-heading: 'Courier Prime', 'Courier New', monospace;
    --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;

    /* Font sizes (matching reference PDF point sizes) */
    --fs-title: 22pt;
    --fs-subtitle: 10pt;
    --fs-section-header: 18pt;
    --fs-attendance: 12.5pt;
    --fs-entry-title: 13pt;
    --fs-entry-text: 11.5pt;
    --fs-topics: 11.5pt;
    --fs-table: 10.5pt;
    --fs-footer: 9.5pt;

    /* Document palette – deliberately not pure black */
    --ink: #16202b;
    --ink-soft: #5a6675;
    --ink-faint: #9aa6b4;
    --accent: #2f6fa8;
    --accent-dark: #234f78;
    --accent-soft: #eef4fa;
    --rule: #b3c2d1;
    --rule-light: #dde5ed;
    --panel: #f8fafc;
    --pos: #1f7a4d;
    --neg: #b03636;

    /* UI palette */
    --ui-bg: #f3f5f8;
    --ui-line: #e5e7eb;
    --ui-text: #111827;
    --ui-muted: #6b7280;
}

/* ============================================================
   GLOBAL
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--ui-bg);
    font-family: var(--font-body);
    color: var(--ui-text);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================================
   EDITOR SIDEBAR
   ============================================================ */

.editor-sidebar {
    width: 420px;
    min-width: 420px;
    background: #ffffff;
    border-right: 1px solid var(--ui-line);
    display: flex;
    flex-direction: column;
    z-index: 20;
    box-shadow: 4px 0 24px rgba(0,0,0,0.04);
}

.sidebar-header {
    padding: 22px 24px;
    background: #ffffff;
    color: var(--ui-text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
}

.sidebar-header h1 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.version-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-dark);
    background: var(--accent-soft);
    padding: 2px 8px;
    border-radius: 12px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: #fcfcfd;
}

.sidebar-content::-webkit-scrollbar { width: 8px; }
.sidebar-content::-webkit-scrollbar-thumb {
    background-color: #dfe3e8;
    border-radius: 4px;
}
.sidebar-content::-webkit-scrollbar-thumb:hover { background-color: #c9cfd6; }

.sidebar-footer {
    padding: 16px 24px 18px;
    background: #ffffff;
    border-top: 1px solid var(--ui-line);
}

.print-hint {
    margin-top: 10px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--ui-muted);
    text-align: center;
}

/* Editor Cards */
.editor-card {
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    border: 1px solid #f0f2f5;
    transition: box-shadow 0.2s;
}

.editor-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
}

.card-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ui-muted);
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    display: block;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 10px;
}

.card-header-row .card-label { margin-bottom: 0; }

.card-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pill {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-dark);
    background: var(--accent-soft);
    border-radius: 999px;
    padding: 3px 9px;
    white-space: nowrap;
}

/* Fields */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

.field-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #374151;
}

.field-hint {
    color: var(--ui-muted);
    font-weight: 400;
    font-size: 11px;
}

.field-input {
    width: 100%;
    border: 1px solid #d5dae1;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: #ffffff;
    color: var(--ui-text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 111, 168, 0.12);
}

.field-input::placeholder { color: #9ca3af; }

/* Buttons */
.btn-reset {
    font-size: 11px;
    font-weight: 600;
    color: var(--neg);
    background: #fef2f2;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.15s;
}

.btn-reset:hover { background: #fee2e2; border-color: #fecaca; }

.btn-add {
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #d7e4f0;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-add:hover { background: #e0ecf7; border-color: #bcd4e8; }

.btn-ghost {
    flex: 1;
    background: #ffffff;
    color: #374151;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #d5dae1;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.btn-ghost:hover { background: #f3f4f6; border-color: #c3c9d1; }
.btn-ghost-danger { color: var(--neg); }
.btn-ghost-danger:hover { background: #fef2f2; border-color: #fecaca; }

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

.data-actions + .data-actions { margin-top: 8px; }
.btn-ghost:disabled { opacity: 0.7; cursor: default; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 100;
    background: #111827;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.toast[hidden] { display: none; }

.btn-pdf {
    width: 100%;
    background: var(--ink);
    color: #fff;
    padding: 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.12);
}

.btn-pdf:hover {
    background: #0c141d;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.12);
}

.btn-pdf:active { transform: translateY(0); }

.empty-hint {
    font-size: 12px;
    line-height: 1.5;
    color: var(--ui-muted);
    background: #f8fafc;
    border: 1px dashed #dde2e8;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
}

/* Attendance Grid */
.att-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.att-field {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #f0f2f5;
    min-width: 0;
    transition: border-color 0.15s;
}

.att-field:focus-within { border-color: #bcd4e8; }

.att-field-label {
    font-size: 11px;
    font-weight: 700;
    color: #4b5563;
    width: 26px;
    flex-shrink: 0;
    text-align: center;
}

.att-field input {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    border: none;
    border-bottom: 1px solid transparent;
    background: transparent;
    padding: 2px;
    outline: none;
    color: #111;
    font-weight: 500;
    font-family: inherit;
}

.att-field input:focus { border-bottom-color: var(--accent); }

/* Sections List */
.sections-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.section-editor {
    background: #fff;
    padding: 14px 16px 16px;
    border: 1px solid var(--ui-line);
    border-radius: 10px;
    position: relative;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.section-editor:hover { border-color: #d1d5db; }
.section-editor:focus-within {
    border-color: #bcd4e8;
    box-shadow: 0 0 0 3px rgba(47, 111, 168, 0.08);
}

.sec-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.sec-index {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-dark);
    background: var(--accent-soft);
    border-radius: 999px;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sec-actions { display: flex; gap: 4px; }

.icon-btn {
    background: #fff;
    border: 1px solid var(--ui-line);
    color: #9ca3af;
    width: 24px;
    height: 24px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    transition: all 0.15s;
    padding: 0;
    font-family: inherit;
}

.icon-btn:hover:not(:disabled) { color: var(--accent-dark); background: var(--accent-soft); border-color: #bcd4e8; }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn.danger:hover { color: var(--neg); background: #fef2f2; border-color: #fecaca; }

.sec-title-input {
    width: 100%;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 14px;
    border: none;
    border-bottom: 2px solid transparent;
    outline: none;
    padding: 4px 0;
    margin-bottom: 10px;
    background: transparent;
    color: var(--ui-text);
    transition: border-color 0.15s;
}

.sec-title-input:focus { border-bottom-color: var(--accent); }

.sec-text-input {
    width: 100%;
    min-height: 84px;
    resize: vertical;
    border: 1px solid var(--ui-line);
    border-radius: 6px;
    padding: 10px;
    font-size: 13px;
    line-height: 1.5;
    background: #f9fafb;
    color: #374151;
    font-family: var(--font-body);
    outline: none;
    transition: all 0.15s;
}

.sec-text-input:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(47, 111, 168, 0.08);
}

/* Vote table editor */
.vote-editor {
    margin-top: 12px;
    border: 1px solid #e3ebf2;
    border-radius: 8px;
    background: #f8fafc;
    padding: 12px;
}

.vote-editor-head {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.vote-caption-input {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid #d5dae1;
    border-radius: 6px;
    padding: 6px 8px;
    outline: none;
    background: #fff;
    color: var(--ui-text);
}

.vote-caption-input:focus { border-color: var(--accent); }

.vote-rows { display: flex; flex-direction: column; gap: 6px; }

.vote-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px 46px 46px 24px;
    gap: 6px;
    align-items: center;
}

.vote-grid-head span {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ui-muted);
    text-align: center;
}

.vote-grid-head span:first-child { text-align: left; }

.vote-grid input {
    width: 100%;
    min-width: 0;
    font-size: 12px;
    font-family: inherit;
    border: 1px solid #d5dae1;
    border-radius: 6px;
    padding: 6px;
    outline: none;
    background: #fff;
    color: var(--ui-text);
}

.vote-grid input[type="number"] { text-align: center; -moz-appearance: textfield; }
.vote-grid input[type="number"]::-webkit-outer-spin-button,
.vote-grid input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.vote-grid input:focus { border-color: var(--accent); }

.vote-editor-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
}

.btn-mini {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #d5dae1;
    background: #fff;
    color: #374151;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.btn-mini:hover { background: #f3f4f6; }
.btn-mini.danger { color: var(--neg); }
.btn-mini.danger:hover { background: #fef2f2; border-color: #fecaca; }

.btn-vote-add {
    margin-top: 12px;
    width: 100%;
    font-size: 12px;
    font-weight: 600;
    padding: 8px;
    border-radius: 6px;
    border: 1px dashed #cbd5e1;
    background: #fff;
    color: var(--accent-dark);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.btn-vote-add:hover { background: var(--accent-soft); border-color: #bcd4e8; }

/* ============================================================
   PREVIEW AREA
   ============================================================ */

.preview-area {
    flex: 1;
    min-width: 0;
    background: #dfe4ea;
    display: flex;
    flex-direction: column;
}

.preview-toolbar {
    height: 44px;
    flex-shrink: 0;
    background: #ffffff;
    border-bottom: 1px solid var(--ui-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
}

.preview-status {
    font-size: 12px;
    font-weight: 600;
    color: var(--ui-muted);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.zoom-btn {
    min-width: 28px;
    height: 28px;
    border: 1px solid var(--ui-line);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    font-family: inherit;
    line-height: 1;
    transition: all 0.15s;
}

.zoom-btn:hover { background: #f3f4f6; }
.zoom-value { min-width: 62px; font-size: 12px; }

.preview-scroll {
    flex: 1;
    overflow: auto;
    padding: 36px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#pdf-preview-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
    align-items: center;
    transform-origin: top center;
}

/* ============================================================
   OFF-SCREEN MEASURE HOST
   ============================================================ */

#measure-host {
    position: absolute;
    left: -10000px;
    top: 0;
    width: var(--page-w);
    visibility: hidden;
    pointer-events: none;
}

/* ============================================================
   PROTOCOL PAGE (A4)
   ============================================================ */

.protocol-page {
    width: var(--page-w);
    height: var(--page-h);
    background: #fff;
    padding: var(--margin-outer);
    box-shadow: 0 10px 34px rgba(15, 25, 40, 0.18);
    position: relative;
    flex-shrink: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    color: var(--ink);
}

/* The frame – light, not a mourning border */
.page-frame {
    width: 100%;
    height: 100%;
    border-left: var(--border-w) solid var(--rule);
    border-right: var(--border-w) solid var(--rule);
    border-bottom: var(--border-w) solid var(--rule);
    border-top: none;
    border-radius: 0 0 3px 3px;
    position: relative;
    display: flex;
    flex-direction: column;
    /* The logo overhangs the top rule by design – never clip it.
       The paginator guarantees the content itself always fits. */
    overflow: visible;
}

/* ============================================================
   PAGE HEADER (Logo + accent rule = top border)
   ============================================================ */

.page-header {
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
}

.logo-area {
    display: flex;
    align-items: center;
    padding: 0 5mm 0 var(--pad-x);
    flex-shrink: 0;
    gap: 10px;
    /* Logo centre sits on the top rule */
    margin-top: -28px;
}

.logo-img {
    height: 56px;
    max-width: 160px;
    object-fit: contain;
}

/* The horizontal accent rule – acts as the top border */
.header-line {
    flex: 1;
    display: flex;
    align-items: flex-start;
    margin-right: calc(-1 * var(--border-w));
}

.header-line-inner {
    width: 100%;
    height: 0;
    border-top: var(--rule-w) solid var(--accent);
}

/* ============================================================
   PAGE CONTENT AREA
   ============================================================ */

.page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--pad-top) var(--pad-x) var(--pad-bottom) var(--pad-x);
    min-height: 0;
}

/* Flow container – a block formatting context so child margins
   are contained and measurable to the pixel. */
.protocol-flow {
    display: flow-root;
    flex: 0 0 auto;
}

/* TITLE */
.page-title {
    text-align: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--fs-title);
    margin-top: 6px;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    color: var(--ink);
}

.page-title .title-date { color: var(--accent); }

.page-subtitle {
    text-align: center;
    font-family: var(--font-body);
    font-size: var(--fs-subtitle);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 18px;
}

.page-title.no-subtitle { margin-bottom: 22px; }

/* SECTION HEADERS (Anwesend, Themen, Protokoll) */
.section-header {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--fs-section-header);
    color: var(--ink);
    margin-top: 14px;
    margin-bottom: 8px;
}

.section-header:first-child { margin-top: 0; }

.section-header.with-underline {
    display: inline-block;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 2px;
    margin-top: 18px;
}

/* ============================================================
   ATTENDANCE
   ============================================================ */

.attendance-block { margin-bottom: 4px; }

.attendance-panel {
    background: var(--panel);
    border: 1px solid var(--rule-light);
    border-radius: 6px;
    padding: 9px 14px;
}

.attendance-grid {
    display: grid;
    grid-template-columns: 11mm minmax(0, 1fr) 11mm minmax(0, 1fr);
    column-gap: 4px;
    row-gap: 0;
    align-items: baseline;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: var(--fs-attendance);
    line-height: 1.55;
    color: var(--ink);
}

/* Gutter between the two class columns – added after the left
   names cell so the class labels keep their full column width. */
.attendance-grid > :nth-child(4n + 2) { padding-right: 7mm; }

.att-class {
    font-weight: 700;
    color: var(--accent-dark);
    white-space: nowrap;
}

.att-names { min-width: 0; }
.att-empty { color: var(--ink-faint); }

.attendance-summary {
    font-family: var(--font-body);
    font-size: 9.5pt;
    color: var(--ink-soft);
    margin-top: 5px;
    padding-left: 2px;
}

/* ============================================================
   TOPICS
   ============================================================ */

.topics-block { margin-bottom: 4px; }

.topics-list {
    font-family: var(--font-body);
    font-size: var(--fs-topics);
    line-height: 1.5;
    padding-left: 18px;
    font-weight: 400;
    color: var(--ink);
    list-style-type: disc;
}

.topics-list li::marker { color: var(--accent); font-size: 1.05em; }

/* ============================================================
   PROTOCOL ENTRIES
   ============================================================ */

.entry-item { margin-bottom: 13px; }
.entry-item:last-child { margin-bottom: 0; }

.entry-title {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: var(--fs-entry-title);
    margin-bottom: 3px;
    color: var(--ink);
    position: relative;
    padding-left: 10px;
}

.entry-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.2em;
    bottom: 0.2em;
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
}

.entry-continued {
    font-weight: 500;
    font-size: 0.82em;
    color: var(--ink-soft);
    font-style: italic;
}

.entry-text {
    font-family: var(--font-body);
    font-size: var(--fs-entry-text);
    line-height: 1.45;
    text-align: left;
    hyphens: auto;
    overflow-wrap: break-word;
    color: var(--ink);
    font-weight: 400;
}

.entry-text + .entry-text { margin-top: 0.5em; }

/* ============================================================
   VOTE TABLES
   ============================================================ */

.vote-block { margin-top: 8px; }

.vote-caption {
    font-family: var(--font-body);
    font-size: 10.5pt;
    font-weight: 600;
    color: var(--accent-dark);
    margin-bottom: 4px;
}

.vote-caption .vote-continued {
    font-weight: 500;
    font-style: italic;
    color: var(--ink-soft);
}

.vote-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: var(--fs-table);
    color: var(--ink);
}

.vote-table th {
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 700;
    text-align: center;
    padding: 5px 8px;
    border-bottom: 1.5px solid var(--accent);
    white-space: nowrap;
}

.vote-table th.col-label,
.vote-table td.col-label {
    text-align: left;
    width: auto;
}

.vote-table th.col-num,
.vote-table td.col-num {
    width: 13mm;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.vote-table th.col-result,
.vote-table td.col-result {
    width: 30mm;
    text-align: center;
}

.vote-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--rule-light);
    vertical-align: top;
}

.vote-table tbody tr:nth-child(even) td { background: #fbfcfe; }
.vote-table tbody tr:last-child td { border-bottom: 1px solid var(--rule); }

.vote-result { font-weight: 700; }
.vote-result.pos { color: var(--pos); }
.vote-result.neg { color: var(--neg); }
.vote-result.neu { color: var(--ink-soft); }
.vote-result.none { color: var(--ink-faint); font-weight: 400; }

/* ============================================================
   FOOTER (every page)
   ============================================================ */

.page-footer {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--rule-light);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-family: var(--font-body);
    font-size: var(--fs-footer);
    color: var(--ink-soft);
    font-weight: 400;
    flex-shrink: 0;
}

.footer-meta { min-width: 0; }
.footer-page {
    white-space: nowrap;
    font-weight: 600;
    color: var(--accent-dark);
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    body {
        background: white !important;
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }

    .editor-sidebar,
    .preview-toolbar,
    .toast,
    #measure-host {
        display: none !important;
    }

    .preview-area {
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
        overflow: visible !important;
        display: block !important;
        position: static !important;
    }

    .preview-scroll {
        padding: 0 !important;
        overflow: visible !important;
        display: block !important;
    }

    #pdf-preview-container {
        gap: 0 !important;
        display: block !important;
        /* The on-screen zoom must never reach the paper. */
        zoom: 1 !important;
        transform: none !important;
    }

    .protocol-page {
        width: 210mm !important;
        height: 297mm !important;
        margin: 0 !important;
        padding: var(--margin-outer) !important;
        box-shadow: none !important;
        break-after: page;
        page-break-after: always;
        break-inside: avoid;
        page-break-inside: avoid;
        overflow: hidden !important;
    }

    .protocol-page:last-child {
        break-after: auto;
        page-break-after: auto;
    }

    .page-frame { height: 100% !important; }

    @page {
        size: A4 portrait;
        margin: 0;
    }
}

/* ============================================================
   RESPONSIVE (editor UI only – the page keeps A4 geometry)
   ============================================================ */

@media (max-width: 1100px) {
    body { flex-direction: column; }

    .editor-sidebar {
        width: 100%;
        min-width: 0;
        max-height: 52vh;
        border-right: none;
        border-bottom: 1px solid var(--ui-line);
    }

    .preview-scroll {
        padding: 16px;
        justify-content: flex-start;
    }
}
