/* ---------- Tokens ---------- */
:root {
  --ink: #221f1a;
  --ink-soft: #55503f;
  --ink-faint: #83795f;

  --paper: #e9e2d0;
  --paper-card: #f6f2e7;
  --paper-sunk: #ded5bd;

  --line: #d9cfb5;
  --line-strong: #c2b896;

  --ledger: #212a3b;
  --ledger-soft: #2e3a50;
  --ledger-line: #3c4a63;
  --ledger-ink: #d8dce6;
  --ledger-ink-soft: #8f9ab0;

  --accent: #b0401f;
  --accent-ink: #fff8ef;
  --focus: #2e6e8e;

  --status-entwurf: #6b6455;
  --status-entwurf-bg: #ece6d5;
  --status-versendet: #2e6e8e;
  --status-versendet-bg: #dceaf0;
  --status-einladung: #93701d;
  --status-einladung-bg: #f1e8cc;
  --status-absage: #8c3b33;
  --status-absage-bg: #f1dad6;
  --status-zusage: #2f6b45;
  --status-zusage-bg: #dceedf;

  --vs-offen: #55606e;
  --vs-offen-bg: #e4e7eb;
  --vs-uebernommen: #2f6b45;
  --vs-uebernommen-bg: #dceedf;
  --vs-abgelehnt: #8c3b33;
  --vs-abgelehnt-bg: #f1dad6;

  --font-display: "IBM Plex Serif", "Iowan Old Style", Georgia, serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --radius-sm: 3px;
  --radius: 6px;
  --sidebar-w: 236px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); color: var(--ink); font-weight: 600; line-height: 1.2; }
h1 { font-size: 1.7rem; margin: 0 0 1.25rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 .85rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .6rem; }

a { color: var(--status-versendet); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

p { line-height: 1.55; }

small { color: var(--ink-soft); }

code, pre { font-family: var(--font-mono); }
pre {
  white-space: pre-wrap;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  line-height: 1.55;
}

@media (prefers-reduced-motion: no-preference) {
  .sidebar, .content, .toast { transition: transform .18s ease, opacity .18s ease; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Shell / sidebar ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--ledger);
  color: var(--ledger-ink);
  display: flex;
  flex-direction: column;
  padding: 1.1rem .9rem 1.5rem;
  gap: 1.4rem;
}

.sidebar-brand {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  padding: .3rem .5rem .9rem;
  border-bottom: 1px solid var(--ledger-line);
  letter-spacing: .01em;
}

.sidebar-section { display: flex; flex-direction: column; gap: .15rem; }

.sidebar-heading {
  font-size: .72rem;
  color: var(--ledger-ink-soft);
  margin: 0 0 .35rem .5rem;
}

.sidebar-tab, .sidebar-child {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--ledger-ink);
  text-decoration: none;
  padding: .5rem .55rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  font-size: .93rem;
}

.sidebar-tab:hover, .sidebar-child:hover { background: var(--ledger-soft); }

.sidebar-tab.active, .sidebar-child.active {
  background: var(--ledger-soft);
  border-left-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.sidebar-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--ledger-line); }
.sidebar-foot a { color: var(--ledger-ink-soft); font-size: .85rem; text-decoration: none; }
.sidebar-foot a:hover { color: #fff; }

.nav-toggle { display: none; }

/* ---------- Main column ---------- */

.main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 1.75rem;
  background: var(--paper-card);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.topbar-left { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: .9rem; }

.child-switch summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  padding: .3rem .6rem;
  border-radius: var(--radius-sm);
}
.child-switch summary::-webkit-details-marker { display: none; }
.child-switch summary:hover { background: var(--paper-sunk); }
.child-switch summary .caret { color: var(--ink-faint); font-family: var(--font-body); font-size: .75rem; }
.child-switch[open] summary { background: var(--paper-sunk); }

.child-switch {
  position: relative;
}
.child-switch .menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--paper-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  min-width: 190px;
  padding: .35rem;
  box-shadow: 0 6px 18px rgba(34,31,26,.14);
  z-index: 20;
}
.child-switch .menu a {
  display: block;
  padding: .4rem .55rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink);
  font-size: .9rem;
}
.child-switch .menu a:hover { background: var(--paper-sunk); }
.child-switch .menu a.active { font-weight: 600; color: var(--accent); }

.plain-name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; padding: .3rem .6rem; }

.role-switch select {
  width: auto;
  padding: .35rem .5rem;
  font-size: .85rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.user-name { font-size: .85rem; color: var(--ink-soft); }

.logout-link {
  font-size: .85rem;
  color: var(--ink-soft);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  padding: .35rem .65rem;
  border-radius: var(--radius-sm);
}
.logout-link:hover { border-color: var(--accent); color: var(--accent); }

.content { max-width: 1080px; width: 100%; margin: 0 auto; padding: 1.75rem 2rem 3rem; flex: 1; }

/* ---------- Flash messages ---------- */

.flashes { list-style: none; padding: 0; margin: 0 0 1.25rem; display: flex; flex-direction: column; gap: .5rem; }
.flashes li {
  padding: .6rem .9rem;
  border-radius: var(--radius-sm);
  background: var(--paper-card);
  border-left: 3px solid var(--line-strong);
  font-size: .92rem;
}
.flash-success { border-left-color: var(--status-zusage); }
.flash-error { border-left-color: var(--status-absage); }

/* ---------- Cards (dog-eared index card) ---------- */

.card {
  position: relative;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.card::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 16px; height: 16px;
  background:
    linear-gradient(135deg, transparent 50%, var(--paper) 50%),
    linear-gradient(135deg, var(--line) 50%, transparent 52%);
  border-bottom-left-radius: var(--radius-sm);
}

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem; margin-bottom: 1.5rem; }

.stat { text-align: left; }
.stat .num { display: block; font-family: var(--font-mono); font-size: 1.9rem; font-weight: 500; color: var(--ink); }
.stat .label { display: block; margin-top: .2rem; font-size: .85rem; color: var(--ink-soft); }

/* ---------- Buttons ---------- */

button, .button {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.05rem;
  border: 1px solid var(--ledger);
  border-radius: var(--radius-sm);
  background: var(--ledger);
  color: #fff;
  font: inherit;
  font-size: .92rem;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { background: var(--ledger-soft); border-color: var(--ledger-soft); }

button.primary, .button.primary { background: var(--accent); border-color: var(--accent); }
button.primary:hover, .button.primary:hover { background: #8f3319; border-color: #8f3319; }

button.ghost, .button.ghost {
  background: transparent; color: var(--ink); border-color: var(--line-strong);
}
button.ghost:hover, .button.ghost:hover { border-color: var(--ink-soft); background: var(--paper-sunk); }

button.danger, .button.danger { background: var(--status-absage); border-color: var(--status-absage); }
button.danger:hover, .button.danger:hover { background: #6f2c26; border-color: #6f2c26; }

button.small, .button.small { padding: .3rem .7rem; font-size: .8rem; }

form.inline { display: inline; }

.actions-row { display: flex; gap: .6rem; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; }
.actions-row.end { justify-content: flex-end; }

/* ---------- Forms ---------- */

label { display: block; margin-bottom: 1rem; font-size: .92rem; color: var(--ink-soft); }
label.check { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; color: var(--ink); }
label.check input { width: auto; }

input, select, textarea {
  width: 100%;
  padding: .55rem .65rem;
  font: inherit;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  margin-top: .35rem;
}
textarea { font-family: var(--font-mono); font-size: .9rem; line-height: 1.5; }
input[type=checkbox] { margin-top: 0; }

fieldset { margin: 0 0 1rem; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
legend { font-size: .85rem; color: var(--ink-soft); padding: 0 .3rem; }

.form-card { max-width: 640px; }

/* Quill-Editor (Anschreiben) an die Papier/Tinte-Palette angleichen */
.letter-editor .ql-toolbar.ql-snow {
  font-family: var(--font-body);
  background: var(--paper-card);
  border: 1px solid var(--line-strong);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.letter-editor .ql-container.ql-snow {
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--paper-card);
  border: 1px solid var(--line-strong);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  min-height: 320px;
}
.letter-editor .ql-editor { color: var(--ink); min-height: 320px; line-height: 1.5; }
.letter-editor .ql-editor img { max-width: 100%; }
/* Quill setzt fuer h1-h3 selbst margin:0 (siehe quill.snow.css) - hier an .letter-preview
   (weiter unten) angeglichen. p bleibt bei Quills eigenem margin:0 (siehe app/pdf.py fuer
   die PDF-Seite dieser Angleichung): Absatzabstand entsteht so nur noch durch eine bewusst
   eingefuegte Leerzeile (leeres <p></p>), nicht mehr automatisch und unterschiedlich stark
   in Editor/Vorschau/PDF - genau das machte z.B. eine mit Enter statt Shift+Enter getippte
   Adresse sichtbar breiter als denselben Text als <br>-Zeilen (wie {{empfaenger}}). */
.letter-editor .ql-editor h1, .letter-editor .ql-editor h2, .letter-editor .ql-editor h3 { margin: .6rem 0 .3rem; }
.letter-editor .ql-snow .ql-stroke { stroke: var(--ink-soft); }
.letter-editor .ql-snow .ql-fill { fill: var(--ink-soft); }
.letter-editor .ql-snow .ql-picker { color: var(--ink-soft); }
.editor-actions { margin: .5rem 0 1rem; }

/* Anschreiben-Vorschau (Uebersichts-/Pruefen-Seite): zeigt dasselbe sanitisierte HTML,
   das auch als PDF gerendert wird (app/pdf.py), statt wie frueher Markdown-lite in <pre>. */
.letter-preview { font-family: var(--font-body); line-height: 1.5; }
.letter-preview img { max-width: 100%; }
.letter-preview h1, .letter-preview h2, .letter-preview h3 { margin: .6rem 0 .3rem; }
.letter-preview p { margin: 0; }

.hint { font-size: .85rem; color: var(--ink-faint); margin-top: -.5rem; margin-bottom: 1.25rem; }

.back-link { display: inline-block; margin-top: 1.5rem; font-size: .88rem; color: var(--ink-soft); text-decoration: none; }
.back-link:hover { color: var(--accent); }

/* ---------- PDF-Vorschau (Dialog) ---------- */

.pdf-preview-dialog {
  width: min(720px, 92vw);
  height: min(880px, 88vh);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(34,31,26,.28);
}
.pdf-preview-dialog::backdrop { background: rgba(0,0,0,.45); }
.pdf-preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper-card);
  font-weight: 600;
}
.pdf-preview-frame { display: block; width: 100%; height: calc(100% - 48px); border: 0; background: var(--paper-sunk); }

/* ---------- Filter bar ---------- */

.filter-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.filter-bar .search-input {
  flex: 0 1 240px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: .87rem;
}

.pill-group { display: flex; gap: .35rem; flex-wrap: wrap; }
.pill-link {
  font-size: .82rem;
  padding: .32rem .7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  text-decoration: none;
  background: var(--paper-card);
}
.pill-link:hover { border-color: var(--ink-soft); color: var(--ink); }
.pill-link.active { background: var(--ledger); border-color: var(--ledger); color: #fff; font-weight: 600; }

.filter-spacer { margin-left: auto; }

/* ---------- Tables ---------- */

.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; }
.table-wrap.scroll { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; background: var(--paper-card); }
table.data caption { display: none; }

table.data thead th {
  text-align: left;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .82rem;
  color: var(--ink-soft);
  background: var(--paper-sunk);
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
table.data thead th[data-sort] { cursor: pointer; user-select: none; }
table.data thead th[data-sort]:hover { color: var(--ink); }
table.data thead th[data-sort]::after { content: ""; margin-left: .3rem; color: var(--ink-faint); }
table.data thead th[aria-sort="ascending"]::after { content: "▲"; font-size: .65em; }
table.data thead th[aria-sort="descending"]::after { content: "▼"; font-size: .65em; }

table.data tbody td { padding: .6rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .92rem; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--paper-sunk); }
table.data tbody tr.row-link { cursor: pointer; }
table.data td.num, table.data td.date { font-family: var(--font-mono); font-size: .85rem; color: var(--ink-soft); white-space: nowrap; }
table.data td.actions { text-align: right; white-space: nowrap; }
table.data td a.row-title { color: var(--ink); font-weight: 600; text-decoration: none; }
table.data td a.row-title:hover { color: var(--accent); }

.empty-state { padding: 2rem 1rem; text-align: center; color: var(--ink-faint); font-size: .92rem; }
.empty-row td { padding: 1.5rem .9rem; text-align: center; color: var(--ink-faint); }

/* ---------- Status badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  font-weight: 600;
  padding: .22rem .55rem .22rem .45rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid;
  white-space: nowrap;
}
.badge.status-entwurf     { background: var(--status-entwurf-bg);   color: var(--status-entwurf);   border-color: var(--status-entwurf); }
.badge.status-versendet   { background: var(--status-versendet-bg); color: var(--status-versendet); border-color: var(--status-versendet); }
.badge.status-einladung   { background: var(--status-einladung-bg); color: var(--status-einladung); border-color: var(--status-einladung); }
.badge.status-absage      { background: var(--status-absage-bg);    color: var(--status-absage);    border-color: var(--status-absage); }
.badge.status-zusage      { background: var(--status-zusage-bg);    color: var(--status-zusage);    border-color: var(--status-zusage); }
.badge.vorschlag-offen        { background: var(--vs-offen-bg);       color: var(--vs-offen);       border-color: var(--vs-offen); }
.badge.vorschlag-uebernommen  { background: var(--vs-uebernommen-bg); color: var(--vs-uebernommen); border-color: var(--vs-uebernommen); }
.badge.vorschlag-abgelehnt    { background: var(--vs-abgelehnt-bg);   color: var(--vs-abgelehnt);   border-color: var(--vs-abgelehnt); }

select.status-select {
  width: auto;
  margin: 0;
  padding: .28rem .45rem;
  font-size: .82rem;
  border-radius: var(--radius-sm);
}

/* ---------- Bewerbungs-Werkstatt (Schritt-Navigation) ---------- */

.wizard-steps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0;
  margin: 0 0 .5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-card);
  overflow: hidden;
}
.wizard-step { flex: 1 1 0; min-width: 100px; border-right: 1px solid var(--line); }
.wizard-step:last-child { border-right: none; }
.wizard-step a {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem .8rem;
  text-decoration: none;
  color: var(--ink-faint);
  font-size: .85rem;
}
.wizard-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--ink-soft);
}
.wizard-step.done a { color: var(--ink-soft); }
.wizard-step.done .wizard-step-num { background: var(--status-zusage-bg); border-color: var(--status-zusage); color: var(--status-zusage); }
.wizard-step.current a { color: var(--ink); font-weight: 600; background: var(--paper-sunk); }
.wizard-step.current .wizard-step-num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.wizard-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: 1.1rem; }
.wizard-actions .action-group { display: inline-flex; align-items: center; gap: .6rem; }

/* ---------- Misc content patterns ---------- */

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-head h2 { margin-top: 0; }

.copy-card h2 { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* ---------- E-Mail-Vorschau (Kind-Werkstatt: Schritt "Prüfen") ---------- */

.email-card h2 { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.email-header {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  padding: .2rem .9rem;
  margin-bottom: 1rem;
}
.email-header-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 0;
}
.email-header-row + .email-header-row { border-top: 1px solid var(--line); }
.email-header-label {
  flex: 0 0 4.5rem;
  font-size: .8rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.email-header-value { flex: 1 1 auto; font-family: var(--font-mono); font-size: .92rem; word-break: break-word; }

.email-body { margin-bottom: .6rem; }

.email-attachments-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
}
.email-attachments-head h3 { margin: 0; }

.email-attachments { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.email-attachments li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  flex-wrap: wrap;
  padding: .6rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.email-attachment-name { font-size: .92rem; }
.email-attachment-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.list-plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.list-plain li { padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper-card); }
.list-plain .meta { color: var(--ink-soft); font-size: .85rem; margin-top: .2rem; }

/* ---------- Vorschläge (Vorschlag-Tabelle, Dashboard-Hinweis) ---------- */

/* border-left auf allen Zeilen reserviert (statt nur auf .is-open), damit der Textbeginn
   nicht je nach Status um 3px verspringt - gleiche Technik wie .sidebar-tab. */
.vorschlag-row td:first-child { border-left: 3px solid transparent; }
.vorschlag-row.is-open td:first-child { border-left-color: var(--accent); }

.row-edit summary { list-style: none; cursor: pointer; }
.row-edit summary::-webkit-details-marker { display: none; }
.row-edit-panel {
  margin-top: .6rem;
  padding: .75rem .85rem;
  min-width: 260px;
  text-align: left;
  white-space: normal;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.row-edit-panel label { margin-bottom: .6rem; }

.suggestion-add { margin: 0 0 2rem; }
.suggestion-add summary { list-style: none; cursor: pointer; }
.suggestion-add summary::-webkit-details-marker { display: none; }
.suggestion-add[open] summary { margin-bottom: .9rem; }

.suggestion-callout {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--paper-card);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.suggestion-callout .list-plain { margin-top: .75rem; }
.suggestion-callout .list-plain li { background: var(--paper); }

.count-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 .4rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: .85rem;
  font-weight: 600;
}

/* ---------- Responsive ---------- */

@media (max-width: 880px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transform: translateX(-100%);
    box-shadow: 4px 0 18px rgba(0,0,0,.25);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after {
    content: "";
    position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30;
  }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem; height: 2.1rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--paper-card);
    cursor: pointer;
    font-size: 1.1rem;
  }
  .content { padding: 1.25rem 1rem 2.5rem; }
  .topbar { padding: .6rem 1rem; }
}

/* [hidden] muss die display-Regeln fuer Buttons/Bilder schlagen - sonst blieben die
   erst per JS eingeblendeten Elemente (z.B. "entfernen" beim Lebenslauf-Bild) sichtbar,
   weil eine Klassenregel den display-Wert des Browsers ueberschreibt. */
[hidden] { display: none !important; }

/* ---------- Lebenslauf-Editor ---------- */
/* Zweispaltig: links das strukturierte Formular, rechts die mitlaufende PDF-Vorschau.
   Die Vorschau klebt (position:sticky) beim Scrollen oben - bei einem Editor, dessen
   Ergebnis man nicht direkt sieht, ist der staendige Blick aufs Blatt der halbe Nutzen. */
.ll-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 1.25rem; align-items: start; }
.ll-spalte-form { min-width: 0; }
.ll-karte { max-width: none; }
.ll-karte h2 { margin-top: 0; font-size: 1.05rem; }
.ll-zwei { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.ll-spalte-vorschau { position: sticky; top: 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper-card); overflow: hidden; }
.ll-vorschau-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .55rem .75rem; border-bottom: 1px solid var(--line); font-size: .9rem; color: var(--ink-soft); }
.ll-vorschau-status { font-size: .78rem; color: var(--ink-faint); text-align: right; }
.ll-vorschau-rahmen { display: block; width: 100%; height: 62vh; border: 0; background: var(--paper-sunk); }
.ll-vorschau-fuss { display: flex; gap: .5rem; padding: .55rem .75rem; border-top: 1px solid var(--line); }

.ll-abschnitt { padding: .85rem 1rem; margin-bottom: .9rem; }
.ll-abschnitt-kopf { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.ll-abschnitt-titel { flex: 1 1 12rem; margin-top: 0; font-weight: 600; }
.ll-abschnitt-kopf select { width: auto; margin-top: 0; }
.ll-abschnitt-fuss { display: flex; gap: .5rem; margin-top: .6rem; }

.ll-eintrag { display: flex; gap: .75rem; align-items: flex-start; padding: .7rem 0; border-top: 1px solid var(--line); }
.ll-eintrag:first-child { border-top: 0; }
.ll-eintrag-felder { flex: 1; min-width: 0; display: grid; gap: .55rem; }
.ll-feld { margin: 0; }
.ll-feld input, .ll-feld textarea { margin-top: 0; }
.ll-feld-label { display: block; font-size: .78rem; color: var(--ink-faint); margin-bottom: .2rem; }
.ll-feld-label small { font-size: .95em; }
.ll-zeitraum { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.ll-zeitraum select { width: auto; margin-top: 0; }
.ll-zeitraum input[type=number] { width: 5.5rem; margin-top: 0; }
.ll-zeitraum .ll-bis { font-size: .85rem; color: var(--ink-faint); }
.ll-zeitraum .ll-laufend { margin-bottom: 0; font-size: .85rem; white-space: nowrap; }
.ll-zeilen-aktionen { display: flex; gap: .25rem; flex-shrink: 0; }
.ll-zeilen-aktionen button { padding: .25rem .5rem; }

/* Welche Felder ein Eintrag zeigt, haengt am Typ des Abschnitts - umgeschaltet wird per
   data-typ am Abschnitt (lebenslauf_editor.js), damit kein Feld doppelt gepflegt wird. */
.ll-abschnitt[data-typ="zeitraum"] .ll-nur-liste { display: none; }
.ll-abschnitt[data-typ="liste"] .ll-nur-zeitraum,
.ll-abschnitt[data-typ="liste"] .ll-nur-zeitraum-inline { display: none; }

.ll-bild { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.ll-bild input[type=file] { width: auto; margin-top: 0; font-size: .85rem; }
.ll-bild-vorschau { max-height: 72px; max-width: 60px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.ll-bild-vorschau.ll-bild-breit { max-width: 140px; max-height: 48px; }

.ll-farbe { display: flex; gap: .4rem; align-items: center; margin-top: .35rem; }
.ll-farbe input[type=color] { width: 3rem; height: 2rem; padding: .15rem; margin-top: 0; }
.ll-farbtupfer { width: 1.6rem; height: 1.6rem; padding: 0; border-radius: 50%; border: 1px solid var(--line-strong); }
.ll-farbtupfer:hover { border-color: var(--ink-soft); }

.ll-speichern { display: flex; gap: .75rem; align-items: center; margin-top: 1rem; }

@media (max-width: 1100px) {
  .ll-layout { grid-template-columns: 1fr; }
  .ll-spalte-vorschau { position: static; }
  .ll-vorschau-rahmen { height: 70vh; }
}
