/* Praxis-Manager – Oberfläche
   Schriften: Bahnschrift (DIN-Charakter, auf jedem Windows vorhanden) für Überschriften,
   Segoe UI für Text. Keine Webfonts aus dem Internet (DSGVO). */

:root {
  --bg: #EEF2F1;
  --surface: #FFFFFF;
  --surface-2: #F6F8F8;
  --ink: #17302D;
  --muted: #5B6E6B;
  --faint: #8A9997;
  --line: #D5DEDC;
  --line-strong: #B9C6C3;
  --brand: #13615A;
  --brand-ink: #0D4540;
  --danger: #A8322D;
  --danger-bg: #FBEDEC;
  --ok: #2F7A3E;

  --c-documents: #2F4E8C;
  --c-contacts: #13615A;
  --c-notes: #A36F0E;
  --c-products: #5A7A26;
  --c-scores: #A13D4F;
  --c-sops: #7A5230;
  --c-chat: #7B3F7A;
  --c-admin: #4A5654;

  --sec: var(--brand);
  --sec-tint: color-mix(in srgb, var(--sec) 9%, white);

  --font-head: "Bahnschrift", "DIN Alternate", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --shadow-pop: 0 12px 32px -8px rgba(23, 48, 45, .28), 0 2px 6px rgba(23, 48, 45, .08);
  --sidebar: 236px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; margin: 0; letter-spacing: -.005em; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 21px; line-height: 1.2; }
h3 { font-size: 17px; line-height: 1.3; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Grundgerüst ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; height: 100vh; }
.sidebar {
  background: var(--ink);
  color: #DCE6E4;
  display: flex; flex-direction: column;
  padding: 18px 12px 14px;
  overflow-y: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 20px; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand-name { font-family: var(--font-head); font-size: 16px; line-height: 1.2; color: #fff; }
.brand-sub { font-size: 12px; color: #9DB2AE; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-sep { height: 1px; background: rgba(255,255,255,.1); margin: 12px 8px; }
.nav button {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 9px 10px;
  background: none; border: 0; border-radius: var(--r-sm);
  color: inherit; text-align: left; cursor: pointer;
  font-family: var(--font-head); font-size: 15px;
}
.nav button:hover { background: rgba(255,255,255,.07); }
.nav button[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; }
.nav .swatch { width: 10px; height: 22px; border-radius: 3px; background: var(--c); flex: none; }
.nav button[aria-current="page"] .swatch { box-shadow: 0 0 0 2px rgba(255,255,255,.55); }
.nav .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
.me { display: flex; align-items: center; gap: 10px; }
.me-name { font-size: 14px; color: #fff; line-height: 1.25; }
.me-role { font-size: 12px; color: #9DB2AE; }
.me-actions { display: flex; gap: 6px; margin-top: 10px; }
.me-actions button {
  flex: 1; background: rgba(255,255,255,.08); border: 0; color: #DCE6E4;
  border-radius: var(--r-sm); padding: 7px 8px; font-size: 13px; cursor: pointer;
}
.me-actions button:hover { background: rgba(255,255,255,.15); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font: 600 13px var(--font-head); color: #fff; background: var(--av, var(--brand));
}

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.gsearch { position: relative; flex: 1; max-width: 620px; }
.gsearch input {
  width: 100%; padding: 9px 12px 9px 38px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
}
.gsearch input:focus { background: #fff; border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.gsearch > svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--faint); }
.gsearch kbd { position: absolute; right: 10px; top: 50%; translate: 0 -50%; }
kbd { font: 12px var(--font-body); color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: #fff; }
.gresults {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  max-height: 70vh; overflow-y: auto; padding: 6px;
}
.gresults .grp { padding: 8px 10px 4px; font: 600 13px var(--font-head); color: var(--c); }
.gresults button {
  display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: var(--r-sm);
  padding: 7px 10px; cursor: pointer;
}
.gresults button:hover, .gresults button.active { background: var(--surface-2); }
.gresults .empty { padding: 14px 10px; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }

.content { flex: 1; overflow-y: auto; padding: 28px 28px 80px; }
.page { max-width: 1320px; margin: 0 auto; }

/* ---------- Bereichskopf ---------- */
.sec-head {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  padding-bottom: 18px; margin-bottom: 18px; border-bottom: 3px solid var(--sec);
}
.sec-head h1 { color: var(--ink); }
.sec-head .count { font: 500 15px var(--font-head); color: var(--muted); margin-left: 4px; }
.sec-head p { margin: 4px 0 0; color: var(--muted); max-width: 60ch; }
.sec-head .actions { margin-left: auto; display: flex; gap: 8px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.search {
  position: relative; flex: 0 1 380px;
}
.search input { width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.search input:focus { border-color: var(--sec); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--sec) 18%, transparent); }
.search svg { position: absolute; left: 10px; top: 50%; translate: 0 -50%; color: var(--faint); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 4px 12px; font-size: 13px; cursor: pointer; color: var(--muted);
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--sec); border-color: var(--sec); color: #fff; }
.chip .n { opacity: .7; margin-left: 4px; }

/* ---------- Schaltflächen & Formulare ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none;
}
code { overflow-wrap: anywhere; font-family: Consolas, "Cascadia Mono", monospace; font-size: .95em; }
#doc-side .kv { grid-template-columns: 92px 1fr; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--sec); border-color: var(--sec); color: #fff; }
.btn.primary:hover { background: color-mix(in srgb, var(--sec) 86%, black); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, white); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  border: 0; background: none; border-radius: var(--r-sm); color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.form { display: grid; gap: 14px; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.field { display: grid; gap: 5px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--faint); font-weight: 400; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: #fff;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field textarea.tall { min-height: 260px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--sec); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--sec) 18%, transparent); }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--sec); }
.error-msg { background: var(--danger-bg); color: var(--danger); border-radius: var(--r-sm); padding: 9px 12px; font-size: 14px; }

/* ---------- Übersicht ---------- */
.hello { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.hello p { margin: 4px 0 0; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 14px; margin-bottom: 30px; }
.tile {
  position: relative; display: flex; flex-direction: column; min-height: 168px;
  padding: 16px 16px 14px; border: 0; border-radius: var(--r-md);
  background: var(--c); color: #fff; text-align: left; cursor: pointer; overflow: hidden;
}
.tile::after {
  /* Ordnerrücken-Kerbe */
  content: ""; position: absolute; right: 16px; top: 0; width: 26px; height: 10px;
  background: rgba(255,255,255,.22); border-radius: 0 0 4px 4px;
}
.tile:hover { filter: brightness(1.07); }
.tile:active { transform: translateY(1px); }
.tile svg { opacity: .9; }
.tile-name { font: 600 21px/1.1 var(--font-head); margin-top: auto; hyphens: manual; }
@media (max-width: 1640px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } .tile { min-height: 132px; } }
.tile-meta { font-size: 13px; opacity: .85; margin-top: 6px; }
.tile .badge { position: absolute; right: 14px; bottom: 14px; background: #fff; color: var(--c); }

.dash-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 6px 18px 12px; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.activity li:last-child { border-bottom: 0; }
.activity .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); justify-self: center; }
.activity .when { color: var(--faint); font-size: 13px; white-space: nowrap; }
.activity button { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.pinned-note { padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.pinned-note:last-child { border-bottom: 0; }
.pinned-note p { margin: 4px 0 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Karten ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 15px 16px 13px; cursor: pointer; text-align: left; min-height: 132px;
  border-top: 3px solid var(--sec);
}
.card:hover { border-color: var(--line-strong); border-top-color: var(--sec); box-shadow: 0 4px 14px -6px rgba(23,48,45,.18); }
.card.selected { outline: 2px solid var(--sec); outline-offset: -1px; }
.card h3 { padding-right: 28px; overflow-wrap: anywhere; }
.card .sub { color: var(--muted); font-size: 14px; }
.card .lines { font-size: 14px; display: grid; gap: 2px; }
.card .excerpt { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.card .foot { margin-top: auto; padding-top: 8px; font-size: 12px; color: var(--faint); display: flex; justify-content: space-between; gap: 8px; }
.card .corner { position: absolute; right: 10px; top: 10px; }
.card .corner svg { color: var(--sec); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--sec-tint); color: color-mix(in srgb, var(--sec) 80%, black); font-weight: 600; }
.copy {
  border: 0; background: none; padding: 0 2px; cursor: copy; color: inherit; font: inherit;
  border-bottom: 1px dashed var(--line-strong);
}
.copy:hover { color: var(--sec); border-bottom-color: var(--sec); }
.pick {
  position: absolute; right: 10px; top: 10px; width: 26px; height: 26px; border-radius: 6px;
  border: 1.5px solid var(--line-strong); background: #fff; display: grid; place-items: center; cursor: pointer; color: transparent;
}
.pick[aria-pressed="true"] { background: var(--sec); border-color: var(--sec); color: #fff; }
.qr-mini { width: 54px; height: 54px; flex: none; }
.card-row { display: flex; gap: 12px; align-items: flex-start; }

.empty-state {
  border: 2px dashed var(--line-strong); border-radius: var(--r-md); padding: 44px 24px; text-align: center; color: var(--muted);
}
.empty-state h2 { color: var(--ink); margin-bottom: 6px; }
.empty-state .btn { margin-top: 14px; }

.dropzone-hint {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c-documents) 78%, transparent); color: #fff;
  font: 600 26px var(--font-head); pointer-events: none;
}

.selbar {
  position: fixed; left: calc(var(--sidebar) + 50%); translate: -50% 0; bottom: 22px; z-index: 25;
  display: flex; gap: 12px; align-items: center;
  background: var(--ink); color: #fff; padding: 10px 12px 10px 18px; border-radius: 999px; box-shadow: var(--shadow-pop);
}
.selbar .btn { border-radius: 999px; }

/* ---------- Seitenleiste (Detail) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(23,48,45,.35); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(560px, 100vw); background: var(--surface);
  display: flex; flex-direction: column; box-shadow: var(--shadow-pop);
  border-top: 4px solid var(--sec);
  animation: slide .18s ease-out;
}
.drawer.wide { width: min(1100px, 100vw); }
@keyframes slide { from { transform: translateX(24px); opacity: .4; } }
.drawer-head { display: flex; gap: 12px; align-items: flex-start; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { flex: 1; overflow-wrap: anywhere; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-foot { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.drawer-foot .spacer { flex: 1; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.meta-box { margin-top: 22px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-sm); font-size: 13px; color: var(--muted); display: grid; gap: 2px; }
.pdf-frame { width: 100%; height: 100%; border: 0; background: #525659; }
.drawer-body.flush { padding: 0; }
.qr-big { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.block { margin-top: 18px; }
.block h3 { font-size: 14px; color: var(--muted); margin-bottom: 4px; }

/* ---------- Dialoge ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(23,48,45,.4); padding: 20px; }
.modal { background: #fff; border-radius: var(--r-md); width: min(560px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-pop); border-top: 4px solid var(--sec); }
.modal.wide { width: min(980px, 100%); }
.modal-head { padding: 18px 20px 6px; }
.modal-head p { margin: 6px 0 0; color: var(--muted); }
.modal-body { padding: 14px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; }

/* ---------- Anmeldung ---------- */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 440px) 1fr;
}
.auth-panel { background: #fff; padding: 56px 44px; display: flex; flex-direction: column; justify-content: center; gap: 26px; }
.auth-panel .brand { padding: 0; }
.auth-panel .brand-name { color: var(--ink); font-size: 18px; }
.auth-panel .brand-sub { color: var(--muted); }
.auth-art {
  background: var(--ink); position: relative; overflow: hidden;
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; padding: 14% 6%; align-content: center;
}
.auth-art div { border-radius: 10px; height: 46vh; max-height: 420px; background: var(--c); position: relative; }
.auth-art div:nth-child(2) { margin-top: 40px; }
.auth-art div:nth-child(3) { margin-top: 12px; }
.auth-art div:nth-child(4) { margin-top: 64px; }
.auth-art div:nth-child(5) { margin-top: 26px; }
.auth-art div:nth-child(6) { margin-top: 52px; }
.auth-art div:nth-child(7) { margin-top: 8px; }
.auth-art div::after { content: ""; position: absolute; right: 12px; top: 0; width: 22px; height: 9px; background: rgba(255,255,255,.22); border-radius: 0 0 4px 4px; }
.auth-art span {
  position: absolute; left: 14px; bottom: 16px; color: #fff; font: 600 18px var(--font-head);
  writing-mode: vertical-rl; transform: rotate(180deg);
}

/* ---------- Messenger ---------- */
.chat { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 62px - 56px); min-height: 420px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.chat-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat-list-head { padding: 12px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.chat-list-items { overflow-y: auto; flex: 1; }
.conv { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; width: 100%; padding: 11px 12px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.conv:hover { background: var(--surface-2); }
.conv[aria-current="true"] { background: color-mix(in srgb, var(--c-chat) 9%, white); box-shadow: inset 3px 0 0 var(--c-chat); }
.conv .avatar { width: 36px; height: 36px; }
.conv-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-last { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-when { font-size: 12px; color: var(--faint); align-self: start; }
.conv .badge { grid-column: 3; justify-self: end; }
.thread { display: flex; flex-direction: column; min-height: 0; }
.thread-head { padding: 12px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.thread-msgs { flex: 1; overflow-y: auto; padding: 16px 18px; background: var(--surface-2); }
.day-sep { text-align: center; margin: 14px 0 10px; }
.day-sep span { font-size: 12px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.msg { display: grid; grid-template-columns: 32px 1fr; gap: 10px; margin-top: 12px; }
.msg.cont { margin-top: 2px; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg-head { font-size: 13px; color: var(--muted); }
.msg-head b { color: var(--ink); font-weight: 600; margin-right: 6px; }
.msg-body {
  display: inline-block; max-width: min(640px, 100%); background: #fff; border: 1px solid var(--line);
  border-radius: 4px 12px 12px 12px; padding: 7px 12px; white-space: pre-wrap; overflow-wrap: anywhere; position: relative;
}
.msg.mine .msg-body { background: color-mix(in srgb, var(--c-chat) 10%, white); border-color: color-mix(in srgb, var(--c-chat) 22%, white); }
.msg-body.deleted { color: var(--faint); font-style: italic; }
.msg-line { display: flex; align-items: flex-start; gap: 4px; }
.msg-line .icon-btn { width: 26px; height: 26px; opacity: 0; }
.msg-line:hover .icon-btn { opacity: 1; }
.new-line { display: flex; align-items: center; gap: 10px; color: var(--c-chat); font-size: 12px; font-weight: 600; margin: 14px 0 0; }
.new-line::before, .new-line::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--c-chat) 45%, white); }
.composer { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 9px 12px; max-height: 160px; min-height: 42px; }
.composer textarea:focus { outline: none; border-color: var(--c-chat); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-chat) 18%, transparent); }

.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #E0475A; color: #fff; font: 600 12px var(--font-body); }

/* ---------- Verwaltung ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; font-family: var(--font-head); font-size: 15px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--sec); }
table.tbl { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.inactive td { color: var(--faint); }
.status-line { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); margin-bottom: 12px; }
.status-line.ok { background: #EAF4EC; color: #1F5A2B; }
.status-line.warn { background: #FFF4E0; color: #7A4C00; }
.cards-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Meldungen ---------- */
#toasts { position: fixed; left: calc(var(--sidebar) + 24px); bottom: 20px; z-index: 70; display: grid; gap: 8px; justify-items: start; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: var(--r-sm); box-shadow: var(--shadow-pop);
  max-width: 380px; font-size: 14px; animation: rise .2s ease-out; cursor: default;
}
.toast.error { background: var(--danger); }
.toast.chatmsg { background: #fff; color: var(--ink); border-left: 4px solid var(--c-chat); cursor: pointer; }
.toast b { display: block; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

.lock { position: fixed; inset: 0; z-index: 90; background: var(--bg); }

@media (max-width: 1180px) {
  .dash-cols, .cards-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  :root { --sidebar: 0px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; left: 0; right: 0; flex-direction: row; padding: 6px; z-index: 20; }
  .sidebar .brand, .sidebar-foot, .nav-sep, .nav .label { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav button { justify-content: center; width: auto; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .content { padding: 18px 16px 90px; }
  .topbar { padding: 10px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- SOPs ---------- */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 999px; }
.pill.ok { background: #E3F1E6; color: #1F5A2B; }
.pill.draft { background: #FFF1D6; color: #7A4C00; }
.pill.arch { background: #E8ECEB; color: #5B6E6B; }
.sop-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card .kind { font: 600 11px var(--font-body); color: var(--sec); border: 1px solid color-mix(in srgb, var(--sec) 40%, white); border-radius: 4px; padding: 0 5px; }
.need-read { font-weight: 600; color: #fff; background: var(--sec); border-radius: 999px; padding: 1px 9px; }
.read-ok { color: var(--ok); font-weight: 600; }
.warn-text { color: #9A5B00; font-weight: 600; }
.excerpt.snippet { font-style: italic; }
.chip-sep { width: 1px; align-self: stretch; background: var(--line-strong); margin: 2px 4px; }
.sop-view { display: grid; grid-template-columns: 1fr 360px; height: 100%; }
.doc-frame { width: 100%; height: 100%; border: 0; background: #E9EEED; }
.sop-side { padding: 18px; overflow-y: auto; border-left: 1px solid var(--line); }
.sop-side .kv { grid-template-columns: 118px 1fr; }
.sop-side .status-line { margin-bottom: 16px; }
.status-line.arch { background: #EEF1F0; color: var(--muted); }
.sop-confirm { flex-direction: column; }
.sop-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.readers, .versions { list-style: none; margin: 6px 0 0; padding: 0; }
.readers li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 5px 0; color: var(--muted); }
.readers li .avatar { width: 26px; height: 26px; font-size: 11px; opacity: .45; }
.readers li.done { color: var(--ink); }
.readers li.done .avatar { opacity: 1; }
.versions li { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 6px; }
.versions li.shown { border-color: var(--sec); background: color-mix(in srgb, var(--sec) 6%, white); }
.sop-notice { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; padding: 16px 18px; margin-bottom: 22px; border-left: 5px solid var(--c-sops); }
.sop-notice h2 { font-size: 17px; margin-bottom: 8px; }
.sop-links { display: flex; flex-direction: column; gap: 2px; }
.sop-link { background: none; border: 0; text-align: left; padding: 5px 6px; border-radius: var(--r-sm); cursor: pointer; display: flex; gap: 8px; align-items: center; }
.sop-link:hover { background: var(--surface-2); }
.sop-link .tag { background: color-mix(in srgb, var(--c-sops) 12%, white); color: var(--c-sops); }
@media (max-width: 1100px) { .sop-view { grid-template-columns: 1fr; grid-template-rows: 60vh auto; } .sop-side { border-left: 0; border-top: 1px solid var(--line); } }
#sop-meta { display: grid; gap: 14px; }

/* ---------- Zwei-Faktor ---------- */
.code-input { font: 600 26px/1 Consolas, "Cascadia Mono", monospace !important; letter-spacing: .35em; text-align: center; }
.steps2fa { margin: 0 0 6px; padding-left: 1.3em; display: grid; gap: 12px; }
.qr2fa { width: 184px; height: 184px; margin: 10px 0 8px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px; background: #fff; }
.qr2fa svg { width: 100%; height: 100%; display: block; }
code.secret { font-size: 14px; letter-spacing: .06em; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }

/* ---------- Messenger 1.4: Benachrichtigungen, Menü, Bearbeiten ---------- */
.notif-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 12px; font-size: 13px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--c-chat) 6%, white); color: var(--ink); }
.notif-bar > span { flex: 1; min-width: 150px; }
.notif-bar svg { color: var(--c-chat); flex: none; }
.muted-ico { display: inline-flex; vertical-align: -2px; margin-left: 6px; color: var(--faint); }
.badge.quiet { background: var(--line-strong); color: var(--ink); }
.icon-btn.on { color: var(--c-chat); background: color-mix(in srgb, var(--c-chat) 10%, white); }
.menu-wrap { position: relative; }
.pop-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 6px; display: grid; }
.pop-menu button { display: flex; align-items: center; gap: 10px; background: none; border: 0; border-radius: var(--r-sm); padding: 8px 10px; text-align: left; cursor: pointer; font-size: 14px; }
.pop-menu button:hover, .pop-menu button:focus-visible { background: var(--surface-2); }
.pop-menu button.danger { color: var(--danger); }
.edited { margin-left: 8px; font-size: 12px; color: var(--faint); }
.msg-edit { display: grid; gap: 6px; max-width: min(640px, 100%); }
.msg-edit textarea { border: 1px solid var(--c-chat); border-radius: 8px; padding: 7px 12px; resize: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-chat) 15%, transparent); outline: none; }
.msg-edit-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.msg-edit-actions .small { margin-right: auto; }
.notif-bar .linkish { background: none; border: 0; padding: 0; color: var(--c-chat); font-size: 13px; text-decoration: underline; cursor: pointer; }
.notif-bar:has(.linkish) { padding: 6px 12px; }
