/* ═══════════════════════════════════════════════════════
   Dokumentation – UI (Corporate Identity analog Intranet/Kontakte/Verträge)
   ═══════════════════════════════════════════════════════ */

:root {
  --primary:     #2563eb;
  --primary-dk:  #1d4ed8;
  --primary-lt:  #eff6ff;
  --primary-mid: #dbeafe;
  --gray-50:  #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb;
  --gray-300: #d1d5db; --gray-400: #9ca3af; --gray-500: #6b7280;
  --gray-600: #4b5563; --gray-700: #374151; --gray-800: #1f2937;
  --gray-900: #111827;
  --green-50: #f0fdf4; --green-100: #dcfce7; --green-600: #16a34a; --green-700: #15803d;
  --amber-50: #fffbeb; --amber-100: #fef3c7; --amber-500: #f59e0b; --amber-600: #d97706;
  --red-50:   #fef2f2; --red-100:   #fee2e2; --red-500: #ef4444;  --red-600:   #dc2626; --red-700: #b91c1c;
  --radius-sm: 0.375rem; --radius: 0.5rem; --radius-lg: 0.75rem; --radius-xl: 1rem;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
  --shadow-xl: 0 25px 50px -12px rgba(0,0,0,.25);
  --sidebar-w: 17rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9375rem; line-height: 1.5; color: var(--gray-800);
  background: #f4f6f9; -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4,h5,h6,p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; line-height: inherit; }
svg { display: block; flex-shrink: 0; }

/* ── Layout ────────────────────────────────────────────── */
.app-shell  { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.main-area  { flex: 1 1 0%; display: flex; flex-direction: column; overflow: hidden; min-width: 0; min-height: 0; }
.main-scroll{ flex: 1 1 0%; overflow-y: auto; min-height: 0; -webkit-overflow-scrolling: touch; }
.page-wrap  { max-width: 56rem; margin: 0 auto; padding: 2rem 1.5rem; }
.page-wrap-wide { max-width: 80rem; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: #fff; border-right: 1px solid var(--gray-200);
  display: flex; flex-direction: column;
  box-shadow: 1px 0 0 var(--gray-100); overflow: hidden;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 1.125rem 1rem; border-bottom: 1px solid var(--gray-100); min-height: 3.75rem;
}
.sidebar-logo-icon {
  width: 2rem; height: 2rem; border-radius: var(--radius);
  background: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-logo-icon svg { color: #fff; width: 1.125rem; height: 1.125rem; }
.sidebar-title { font-size: 0.875rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.sidebar-subtitle { font-size: 0.7rem; color: var(--gray-400); font-weight: 500; }
.sidebar-scroll { flex: 1 1 0%; overflow-y: auto; padding: 0.5rem 0.5rem; min-height: 0; }

.nav-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4375rem 0.625rem; border-radius: var(--radius);
  font-size: 0.8125rem; font-weight: 500; color: var(--gray-600);
  cursor: pointer; user-select: none; transition: background .12s, color .12s;
  border: none; background: transparent; width: 100%; text-align: left;
}
.nav-item:hover  { background: var(--primary-lt); color: var(--primary-dk); }
.nav-item.active { background: var(--primary-lt); color: var(--primary); font-weight: 600; }
.nav-item .nav-icon { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--gray-200); color: var(--gray-600);
  font-size: 0.625rem; font-weight: 700; padding: 0.125rem 0.375rem;
  border-radius: 9999px; min-width: 1.125rem; text-align: center;
}
.nav-badge-amber { background: var(--amber-500); color: #fff; }
.nav-badge-red   { background: var(--red-500);   color: #fff; }

.section-label {
  font-size: 0.625rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--gray-400); padding: 0.75rem 0.625rem 0.25rem;
}

/* ── Seitenbaum ────────────────────────────────────────── */
.tree-node { user-select: none; }
.tree-row {
  display: flex; align-items: center; gap: 0.25rem;
  padding: 0.3125rem 0.5rem; border-radius: var(--radius);
  font-size: 0.8125rem; color: var(--gray-700); cursor: pointer;
  transition: background .1s, color .1s;
}
.tree-row:hover  { background: var(--primary-lt); color: var(--primary-dk); }
.tree-row.active { background: var(--primary-lt); color: var(--primary); font-weight: 600; }
.tree-caret {
  width: 1rem; height: 1rem; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: var(--gray-400); border-radius: 4px; transition: transform .12s;
}
.tree-caret.open { transform: rotate(90deg); }
.tree-caret.spacer { visibility: hidden; }
.tree-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-emoji { font-size: .9rem; line-height: 1; }
.tree-lock { width: .8rem; height: .8rem; color: var(--gray-400); flex-shrink: 0; }
.tree-children { margin-left: 0.75rem; border-left: 1px solid var(--gray-100); padding-left: .15rem; }

.sidebar-footer { border-top: 1px solid var(--gray-100); padding: 0.75rem 0.875rem 0; flex-shrink: 0; }
.sidebar-link {
  display: flex; align-items: center; gap: 0.375rem;
  padding: 0.4375rem 0.625rem; border-radius: var(--radius);
  font-size: 0.8125rem; font-weight: 500; color: var(--gray-500);
  text-decoration: none; transition: background .12s, color .12s; margin-bottom: 0.125rem;
}
.sidebar-link:hover { background: var(--primary-lt); color: var(--primary-dk); }
.sidebar-link svg  { width: 1rem; height: 1rem; flex-shrink: 0; }
.sidebar-copyright {
  font-size: 0.625rem; color: var(--gray-300); text-align: center;
  padding: 0.625rem 0.5rem 0.875rem; border-top: 1px solid var(--gray-100); margin-top: 0.5rem;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem;
  padding: 0.5rem 1rem; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 600; border: 1px solid transparent;
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary-dk); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.btn-primary:hover:not(:disabled)  { background: var(--primary-dk); }
.btn-secondary{ background: #fff; color: var(--gray-700); border-color: var(--gray-300); box-shadow: var(--shadow-xs); }
.btn-secondary:hover:not(:disabled){ background: var(--gray-50); border-color: var(--gray-400); }
.btn-ghost    { background: transparent; color: var(--gray-600); border-color: transparent; }
.btn-ghost:hover:not(:disabled)    { background: var(--gray-100); color: var(--gray-900); }
.btn-danger   { background: var(--red-600); color: #fff; border-color: var(--red-700); }
.btn-danger:hover:not(:disabled) { background: var(--red-700); }
.btn-success  { background: var(--green-600); color: #fff; border-color: var(--green-700); }
.btn-success:hover:not(:disabled) { background: var(--green-700); }
.btn-sm  { padding: .3125rem .75rem; font-size: .8125rem; }
.btn-xs  { padding: .2rem .5rem;   font-size: .75rem;   }
.btn-icon{ padding: .4375rem; }

/* ── Forms ─────────────────────────────────────────────── */
.lbl { display: block; font-size: .8125rem; font-weight: 600; color: var(--gray-700); margin-bottom: .25rem; }
.inp {
  display: block; width: 100%; padding: .5rem .75rem;
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  background: #fff; color: var(--gray-900); outline: none;
  transition: border .15s, box-shadow .15s;
}
.inp:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.inp::placeholder { color: var(--gray-400); }
.sel { display: block; width: 100%; padding: .5rem .75rem; border: 1px solid var(--gray-300); border-radius: var(--radius); background: #fff; color: var(--gray-900); outline: none; }
.sel:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
textarea.inp { resize: vertical; min-height: 4rem; }

/* ── Cards ─────────────────────────────────────────────── */
.card    { background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm); padding: 1.25rem; }
.card-sm { background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm); padding: 1rem; }

/* ── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .5rem; border-radius: 9999px;
  font-size: .6875rem; font-weight: 700; white-space: nowrap;
}
.badge-green  { background: var(--green-100); color: #14532d;  border: 1px solid #86efac; }
.badge-amber  { background: var(--amber-100); color: #92400e;  border: 1px solid #fde68a; }
.badge-red    { background: var(--red-100);   color: #7f1d1d;  border: 1px solid #fca5a5; }
.badge-gray   { background: var(--gray-100);  color: var(--gray-600); border: 1px solid var(--gray-200); }
.badge-blue   { background: var(--primary-mid); color: #1e3a8a; border: 1px solid #93c5fd; }

/* ── Stats row ─────────────────────────────────────────── */
.stats-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.stat-card {
  flex: 1 1 9rem; background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 1rem 1.25rem; box-shadow: var(--shadow-xs);
}
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: .75rem; font-weight: 600; color: var(--gray-500); margin-top: .25rem; }
.stat-card.clickable { cursor: pointer; transition: box-shadow .12s, border-color .12s; }
.stat-card.clickable:hover { box-shadow: var(--shadow); border-color: var(--primary-mid); }

/* ── Topbar / Suche ────────────────────────────────────── */
.topbar {
  background: #fff; border-bottom: 1px solid var(--gray-200);
  padding: 0.75rem 1.25rem; display: flex; align-items: center; gap: .75rem;
  flex-shrink: 0; position: relative; flex-wrap: wrap;
}
.search-wrap { flex: 1; max-width: 32rem; position: relative; min-width: 10rem; }
.search-wrap > svg { position: absolute; left: .625rem; top: 50%; transform: translateY(-50%); width: 1rem; height: 1rem; color: var(--gray-400); pointer-events: none; }
.search-inp { padding-left: 2.125rem !important; }
.search-results {
  position: absolute; top: calc(100% + .375rem); left: 0; right: 0; z-index: 50;
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); max-height: 24rem; overflow-y: auto;
}
.search-item { padding: .625rem .875rem; cursor: pointer; border-bottom: 1px solid var(--gray-100); }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--primary-lt); }
.search-item .si-title { font-weight: 600; font-size: .875rem; color: var(--gray-900); display:flex; align-items:center; gap:.4rem; }
.search-item .si-snip  { font-size: .75rem; color: var(--gray-500); margin-top: .15rem; }

/* ── Page header ───────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; display:flex; justify-content:space-between; align-items:flex-end; gap:1rem; flex-wrap:wrap; }
.page-title  { font-size: 1.25rem; font-weight: 800; color: var(--gray-900); }
.page-desc   { font-size: .875rem; color: var(--gray-500); margin-top: .25rem; }
.breadcrumb { display:flex; align-items:center; gap:.35rem; flex-wrap:wrap; font-size:.8125rem; color:var(--gray-500); margin-bottom:.5rem; }
.breadcrumb a { cursor:pointer; } .breadcrumb a:hover { color:var(--primary); }
.breadcrumb .sep { color: var(--gray-300); }

/* ── Dokument-Inhalt (Anzeige) ─────────────────────────── */
.doc-content { font-size: 1rem; line-height: 1.7; color: var(--gray-800); word-wrap: break-word; }
.doc-content h1 { font-size: 1.75rem; font-weight: 800; margin: 1.5rem 0 .75rem; color: var(--gray-900); }
.doc-content h2 { font-size: 1.35rem; font-weight: 700; margin: 1.35rem 0 .6rem; color: var(--gray-900); }
.doc-content h3 { font-size: 1.1rem;  font-weight: 700; margin: 1.1rem 0 .5rem; color: var(--gray-800); }
.doc-content p  { margin: .6rem 0; }
.doc-content ul, .doc-content ol { margin: .6rem 0; padding-left: 1.5rem; }
.doc-content li { margin: .25rem 0; }
.doc-content a  { color: var(--primary); text-decoration: underline; }
.doc-content img { max-width: 100%; height: auto; border-radius: var(--radius); margin: .5rem 0; box-shadow: var(--shadow-sm); }
.doc-content blockquote {
  border-left: 4px solid var(--primary-mid); background: var(--primary-lt);
  padding: .6rem 1rem; margin: .8rem 0; border-radius: 0 var(--radius) var(--radius) 0; color: var(--gray-700);
}
.doc-content hr { border: none; border-top: 1px solid var(--gray-200); margin: 1.5rem 0; }
.doc-content code { background: var(--gray-100); padding: .1rem .35rem; border-radius: .25rem; font-family: ui-monospace, monospace; font-size: .9em; }
.doc-content table { border-collapse: collapse; width: 100%; margin: .8rem 0; font-size: .9375rem; }
.doc-content th, .doc-content td { border: 1px solid var(--gray-300); padding: .5rem .7rem; text-align: left; vertical-align: top; }
.doc-content th { background: var(--gray-50); font-weight: 700; }
.doc-content tr:nth-child(even) td { background: var(--gray-50); }

/* Prozess-Flow (Ablaufdarstellung) */
.proc-flow { margin: 1.2rem 0; display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.proc-step {
  position: relative; background: #fff; border: 2px solid var(--primary-mid);
  border-radius: var(--radius-lg); padding: .75rem 1rem; margin: 0 auto; max-width: 32rem; width: 100%;
  box-shadow: var(--shadow-xs); text-align: center; font-weight: 600; color: var(--gray-800);
}
.proc-step + .proc-step { margin-top: 2.1rem; }
.proc-step + .proc-step::before {
  content: ''; position: absolute; top: -1.95rem; left: 50%; transform: translateX(-50%);
  width: 2px; height: 1.4rem; background: var(--primary);
}
.proc-step + .proc-step::after {
  content: ''; position: absolute; top: -0.65rem; left: 50%; transform: translateX(-50%);
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid var(--primary);
}

/* ── Editor ────────────────────────────────────────────── */
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: .25rem; padding: .5rem;
  border: 1px solid var(--gray-300); border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0; background: var(--gray-50);
  position: sticky; top: 0; z-index: 5;
}
.tb-btn {
  min-width: 2rem; height: 2rem; padding: 0 .45rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .8125rem; font-weight: 700; color: var(--gray-700); transition: all .1s;
}
.tb-btn:hover { background: #fff; border-color: var(--gray-300); box-shadow: var(--shadow-xs); }
.tb-btn svg { width: 1rem; height: 1rem; }
.tb-sep { width: 1px; background: var(--gray-300); margin: .15rem .25rem; align-self: stretch; }
.tb-color { width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--gray-300); cursor: pointer; }
.tb-color:hover { transform: scale(1.12); }
.editor-area {
  border: 1px solid var(--gray-300); border-radius: 0 0 var(--radius) var(--radius);
  background: #fff; padding: 1rem 1.25rem; min-height: 22rem; max-height: 60vh; overflow-y: auto;
  outline: none; line-height: 1.7;
}
.editor-area:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* ── Tabs ──────────────────────────────────────────────── */
.tabs { display:flex; gap:.25rem; border-bottom:1px solid var(--gray-200); margin-bottom:1.25rem; flex-wrap:wrap; }
.tab { padding:.5rem .875rem; font-size:.8125rem; font-weight:600; color:var(--gray-500); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px; }
.tab:hover { color:var(--gray-800); }
.tab.active { color:var(--primary); border-bottom-color:var(--primary); }

/* ── Timeline / Historie ───────────────────────────────── */
.timeline { border-left:2px solid var(--gray-200); padding-left:1rem; margin-left:.25rem; }
.timeline-item { position:relative; padding:.4rem 0 .8rem; }
.timeline-item::before { content:''; position:absolute; left:-1.32rem; top:.65rem; width:.55rem; height:.55rem; border-radius:50%; background:var(--primary); border:2px solid #fff; }
.timeline-action { font-weight:700; font-size:.8125rem; color:var(--gray-800); }
.timeline-meta { font-size:.7rem; color:var(--gray-400); }
.timeline-note { font-size:.8125rem; color:var(--gray-600); margin-top:.1rem; }

/* ── Listen / Items ────────────────────────────────────── */
.list-item {
  display:flex; align-items:center; gap:.75rem; padding:.875rem 1rem;
  border:1px solid var(--gray-200); border-radius:var(--radius-lg); background:#fff;
  box-shadow:var(--shadow-xs); margin-bottom:.625rem;
}
.list-item .li-title { font-weight:700; color:var(--gray-900); }
.list-item .li-sub { font-size:.75rem; color:var(--gray-500); margin-top:.1rem; }

.locked-banner {
  display: flex; align-items: center; gap: 1rem;
  background: linear-gradient(0deg, var(--primary-lt), #fff);
  border: 1px solid var(--primary-mid); border-radius: var(--radius-lg);
  padding: 1.5rem; box-shadow: var(--shadow-xs);
}
.locked-banner svg { width: 2.5rem; height: 2.5rem; color: var(--primary); }

/* ── Settings ──────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 680px) { .settings-grid { grid-template-columns: 1fr; } }
.form-row { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .875rem; }
.hint { font-size: .75rem; color: var(--gray-400); margin-top: .25rem; }
.settings-section-title { font-size: .875rem; font-weight: 700; color: var(--gray-800); margin-bottom: .875rem; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 1.5rem 0; }
.info-box {
  background: var(--primary-lt); border: 1px solid var(--primary-mid);
  border-radius: var(--radius); padding: .875rem 1rem;
  font-size: .8125rem; color: #1e40af; line-height: 1.5;
}
.info-box code { background: rgba(37,99,235,.12); padding: .1rem .35rem; border-radius: .25rem; font-family: monospace; font-size: .8rem; }
.link-row { display:flex; gap:.5rem; align-items:center; margin-bottom:.5rem; }
.toggle-row { display:flex; align-items:center; gap:.5rem; }

/* ── Empty state ───────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; padding: 4rem 2rem; color: var(--gray-400); text-align: center;
}
.empty-state svg { width: 3rem; height: 3rem; opacity: .35; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--gray-500); }
.empty-state-text  { font-size: .875rem; color: var(--gray-400); max-width: 28rem; }

/* ── Toast ─────────────────────────────────────────────── */
.toast {
  position: fixed; top: 1.25rem; right: 1.25rem; z-index: 9999;
  max-width: 22rem; padding: .875rem 1.125rem;
  border-radius: var(--radius-lg); font-size: .875rem; font-weight: 600;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,.05); color: #fff;
}
.toast-success { background: var(--green-600); }
.toast-error   { background: var(--red-600);   }
.toast-info    { background: var(--primary);   }

/* ── Loader ────────────────────────────────────────────── */
#app-loader {
  position: fixed; inset: 0; background: #f4f6f9;
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; flex-direction: column; gap: 1rem;
}
#app-loader.done { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 2rem; height: 2rem; border: 3px solid var(--gray-200);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .75s linear infinite;
}

/* ── Modal ─────────────────────────────────────────────── */
.modal-backdrop { position:fixed; inset:0; z-index:200; display:flex; align-items:center; justify-content:center; padding:1rem; background:rgba(15,23,42,.45); backdrop-filter:blur(4px); }
.modal-box { background:#fff; border-radius:var(--radius-xl); box-shadow:var(--shadow-xl),0 0 0 1px rgba(0,0,0,.05); width:100%; max-width:26rem; padding:1.75rem; }
.modal-lg  { max-width: 60rem; max-height: 94vh; display:flex; flex-direction:column; padding:0; }
.modal-title { font-size:1.0625rem; font-weight:700; color:var(--gray-900); }
.modal-head { display:flex; align-items:center; justify-content:space-between; padding:1.25rem 1.5rem; border-bottom:1px solid var(--gray-200); flex-shrink:0; }
.modal-body { padding:1.5rem; overflow-y:auto; }
.modal-foot { display:flex; align-items:center; justify-content:flex-end; gap:.5rem; padding:1rem 1.5rem; border-top:1px solid var(--gray-200); background:var(--gray-50); border-radius:0 0 var(--radius-xl) var(--radius-xl); flex-shrink:0; flex-wrap:wrap; }

/* ── Utilities ─────────────────────────────────────────── */
[x-cloak] { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .items-end { align-items:flex-end; }
.justify-between { justify-content: space-between; } .justify-end { justify-content:flex-end; } .flex-wrap { flex-wrap: wrap; }
.gap-1 { gap:.25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-4 { gap:1rem; }
.mt-1 { margin-top:.25rem; } .mt-2 { margin-top:.5rem; } .mt-4 { margin-top:1rem; }
.mb-1 { margin-bottom:.25rem; } .mb-2 { margin-bottom:.5rem; } .mb-4 { margin-bottom:1rem; }
.text-sm { font-size: .875rem; } .text-xs { font-size: .75rem; }
.text-muted { color: var(--gray-500); } .font-bold { font-weight: 700; }
.w-full { width: 100%; } .flex-1 { flex:1; }

/* ── Mobile ────────────────────────────────────────────── */
.mobile-topbar { display: none; }
.mobile-bottom-nav { display: none; }
.sidebar-mobile-backdrop { display: none; }

@media (max-width: 820px) {
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 300;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-xl); width: 18rem;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mobile-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 250; }
  .mobile-topbar {
    display: flex; align-items: center; gap: .625rem;
    background: #fff; border-bottom: 1px solid var(--gray-200);
    padding: .625rem .875rem; flex-shrink: 0;
  }
  .mobile-topbar .mt-title { font-weight: 700; font-size: .9375rem; color: var(--gray-900); }
  .hamburger { padding: .375rem; border-radius: var(--radius); border: 1px solid var(--gray-200); background: #fff; cursor: pointer; }
  .hamburger svg { width: 1.25rem; height: 1.25rem; color: var(--gray-700); }
  .page-wrap, .page-wrap-wide { padding: 1rem .875rem; }
  .settings-grid { grid-template-columns: 1fr; }
  .modal-lg { max-width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; }
  .editor-area { max-height: none; }
}

/* ── Druck / PDF-Export ────────────────────────────────── */
@media print {
  body { background: #fff; }
  .sidebar, .mobile-topbar, .mobile-bottom-nav, .topbar, .editor-toolbar,
  .no-print, .btn, .tabs, .breadcrumb, .sidebar-mobile-backdrop { display: none !important; }
  .app-shell, .main-area, .main-scroll { display: block; height: auto; overflow: visible; }
  .page-wrap { max-width: none; padding: 0; }
  .doc-content { font-size: 12pt; }
  .doc-content img { box-shadow: none; }
  .proc-step { break-inside: avoid; }
  a { color: #000 !important; text-decoration: none !important; }
  .print-title { display: block !important; font-size: 20pt; font-weight: 800; margin-bottom: .5rem; }
  .print-meta { display: block !important; font-size: 9pt; color: #666; margin-bottom: 1rem; }
}
.print-title, .print-meta { display: none; }
