/* Fortis Helpdesk – Gestaltung angelehnt an Zammad: dunkle Leiste links, helle Arbeitsfläche, Status als farbige Punkte */

:root {
  --nav: #2f3235;
  --nav-hover: #3b3f43;
  --nav-active: #474c51;
  --nav-text: #b9bec4;
  --nav-strong: #ffffff;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-2: #f8f9fa;
  --line: #e1e4e8;
  --text: #24292e;
  --muted: #6a737d;
  --accent: #23a2cd;
  --accent-strong: #1b86aa;
  --accent-soft: #e6f5fa;
  --ok: #38ad69;
  --ok-strong: #2e9459;
  --warn: #f0a20a;
  --danger: #e0503f;
  --pending: #9aa5b1;
  --internal: #fff6e9;
  --internal-line: #f0a20a;
  --bubble-agent: #e9f6fb;
  --bubble-customer: #ffffff;
  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 2px 8px rgba(20, 30, 40, .05);
  --radius: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --nav: #17191b; --nav-hover: #24272a; --nav-active: #2e3236; --nav-text: #a8aeb4;
    --bg: #1c1e21; --panel: #25282c; --panel-2: #2b2f33; --line: #3a3f45; --text: #e4e7ea; --muted: #9ba3ab;
    --accent-soft: #1d3a45; --internal: #3a3122; --bubble-agent: #1f3742; --bubble-customer: #2c3035;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 12px; margin: 0 0 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; font-size: 12px; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grow { flex: 1; }
.error { color: var(--danger); }
.empty { color: var(--muted); padding: 24px; text-align: center; margin: 0; }
.boot { padding: 40px; color: var(--muted); }
.note { background: var(--internal); border-left: 3px solid var(--internal-line); padding: 8px 10px; border-radius: 4px; white-space: pre-wrap; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.intro { margin: 0; padding: 0 20px 12px; }
.pad { padding: 16px 20px 0; }

/* Knöpfe und Felder */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn.primary { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.primary:hover { background: var(--ok-strong); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-strong); cursor: pointer; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--danger); }
.icon-btn { background: none; border: 0; padding: 4px; color: inherit; cursor: pointer; display: inline-flex; border-radius: 4px; }
.icon-btn:hover { background: rgba(127, 127, 127, .15); }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 9px; width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; min-height: 70px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.actions { display: flex; gap: 8px; justify-content: flex-end; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-block; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; background: var(--panel); }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); }
.attach { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-strong); cursor: pointer; position: relative; }
.attach input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.attach:focus-within { outline: 2px solid var(--accent); border-radius: 4px; }
.file-names { color: var(--muted); font-size: 12px; margin-left: 8px; }

/* Plaketten */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.xl { width: 64px; height: 64px; font-size: 22px; }
.avatar.org { background: var(--nav) !important; }
.avatar.org .icon { width: 28px; height: 28px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.pill.ok { color: var(--ok-strong); border-color: var(--ok); }
.pill.warn { color: #9a6700; border-color: var(--warn); background: var(--internal); }
.pill.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--warn); vertical-align: middle; flex: none; }
.dot.s-new { background: var(--warn); }
.dot.s-open { background: transparent; }
.dot.s-pending-reminder, .dot.s-pending-close { border-color: var(--pending); background: linear-gradient(90deg, var(--pending) 50%, transparent 50%); }
.dot.s-closed { border-color: var(--ok); background: var(--ok); }
.dot.s-merged { border-color: var(--pending); background: var(--pending); }
.dot.s-escalated { border-color: var(--danger); background: var(--danger); }
.state { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--internal); color: #8a5a00; }
.state.s-closed { background: rgba(56, 173, 105, .14); color: var(--ok-strong); }
.state.s-pending-reminder, .state.s-pending-close, .state.s-merged { background: var(--panel-2); color: var(--muted); }
.state.s-escalated { background: var(--danger); color: #fff; }
.prio.p3 { color: var(--danger); font-weight: 600; }
.prio.p1 { color: var(--muted); }
.sla { font-size: 12px; color: var(--muted); }
.sla.late { color: var(--danger); font-weight: 600; }

/* Gerüst */
#app { display: flex; height: 100vh; }
#main { flex: 1; min-width: 0; height: 100vh; overflow: auto; }
#nav { width: 232px; flex: none; background: var(--nav); color: var(--nav-text); display: flex; flex-direction: column; height: 100vh; }
#nav a { color: inherit; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; font-size: 17px; font-weight: 600; color: var(--nav-strong) !important; }
.brand.big { justify-content: center; font-size: 26px; padding: 0 0 18px; color: var(--text) !important; }
.logo { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; }
.brand.big .logo { width: 44px; height: 44px; font-size: 24px; border-radius: 12px; }
.search { margin: 0 12px 10px; position: relative; }
.search span { position: absolute; left: 9px; top: 8px; color: var(--nav-text); }
.search .icon { width: 16px; height: 16px; }
.search input { background: var(--nav-hover); border-color: transparent; color: var(--nav-strong); padding-left: 32px; }
.search input::placeholder { color: var(--nav-text); }
.menu, .tasks { list-style: none; margin: 0; padding: 0; }
.menu a { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-left: 3px solid transparent; }
.menu a:hover { background: var(--nav-hover); color: var(--nav-strong); }
.menu a.active { background: var(--nav-active); color: var(--nav-strong); border-left-color: var(--accent); }
.menu a span { flex: 1; }
.count { font-size: 12px; font-weight: 600; color: var(--nav-strong); }
.tasks-head { padding: 18px 16px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.tasks { flex: 1; overflow: auto; }
.tasks a { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 16px; font-size: 13px; }
.tasks .task-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tasks a:hover, .tasks a.active { background: var(--nav-hover); color: var(--nav-strong); }
.tasks a.active { box-shadow: inset 3px 0 var(--accent); }
.tasks .icon-btn { opacity: 0; }
.tasks a:hover .icon-btn, .tasks a:focus-within .icon-btn { opacity: 1; }
.tasks .icon { width: 14px; height: 14px; }
#nav.customer .menu { flex: 1; }
.nav-foot { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid rgba(255, 255, 255, .07); }
.round-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--nav-hover); color: var(--nav-strong); cursor: pointer; }
.round-btn:hover { background: var(--nav-active); }
.round-btn.new { background: var(--ok); }
.round-btn.new:hover { background: var(--ok-strong); }
.bubble-count { position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; line-height: 17px; text-align: center; }
.me { margin-left: auto; background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; }

/* Klappfenster */
#popover { position: fixed; z-index: 30; width: 320px; max-height: 70vh; overflow: auto; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 30px rgba(0, 0, 0, .2); }
.pop-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.pop-head div { flex: 1; display: flex; flex-direction: column; }
.pop-head small { color: var(--muted); }
.pop-item { display: block; width: 100%; text-align: left; padding: 10px 14px; background: none; border: 0; font: inherit; color: var(--text); cursor: pointer; }
.pop-item:hover { background: var(--panel-2); text-decoration: none; }
.notes { list-style: none; margin: 0; padding: 0; }
.notes a { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; color: var(--text); border-bottom: 1px solid var(--line); }
.notes a:hover { background: var(--panel-2); text-decoration: none; }
.notes time { font-size: 12px; color: var(--muted); }
.notes .unseen a { box-shadow: inset 3px 0 var(--accent); font-weight: 500; }

/* Seiten */
.page { padding: 24px 28px 40px; max-width: 1280px; }
.page.narrow { max-width: 760px; }
.page > * + * { margin-top: 18px; }
.page-head, .pane-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head input[type=search] { max-width: 320px; }
.pane-head { padding: 18px 20px 14px; }
.pane-head h1 { margin: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush h2.pad { padding: 16px 20px 4px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.cols .wide { grid-column: span 2; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-weight: 500; text-align: right; }

.split { display: flex; min-height: 100%; }
.subnav { width: 250px; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 18px 0; }
.subnav h3 { padding: 0 18px; }
.subnav ul { list-style: none; margin: 0 0 14px; padding: 0; }
.subnav a { display: flex; gap: 8px; padding: 8px 18px; color: var(--text); }
.subnav a span { flex: 1; }
.subnav a b { font-weight: 500; color: var(--muted); }
.subnav a:hover { background: var(--panel-2); text-decoration: none; }
.subnav a.active { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); font-weight: 600; }
.subnav .btn { margin: 0 18px; width: calc(100% - 36px); }
.list-pane { flex: 1; min-width: 0; background: var(--panel); }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tbody tr[data-href] { cursor: pointer; }
.grid tbody tr:hover { background: var(--panel-2); }
.grid tr.inactive td { color: var(--muted); }
.grid tr.inactive a { color: var(--muted); }
.grid .sel, .grid .st { width: 30px; padding-right: 0; }
.grid .c-number { white-space: nowrap; color: var(--muted); }
.grid .c-title { min-width: 220px; }
.grid .c-title a { color: var(--text); font-weight: 500; }
.grid .c-updated_at { white-space: nowrap; color: var(--muted); }
.grid .c-priority { white-space: nowrap; }
.sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.sort.asc::after { content: " ▲"; font-size: 9px; }
.sort.desc::after { content: " ▼"; font-size: 9px; }
.person-inline { display: inline-flex; align-items: center; gap: 8px; color: var(--text) !important; font-weight: 500; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .link + .link { margin-left: 12px; }
.bulk { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 20px; background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -4px 12px rgba(0, 0, 0, .05); }
.bulk select, .bulk input { width: auto; }

/* Dashboard und Bericht */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--text) !important; box-shadow: var(--shadow); }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile.static:hover { border-color: var(--line); }
.tile b { font-size: 26px; font-weight: 600; line-height: 1.2; }
.tile span { color: var(--muted); font-size: 13px; }
.tile.warn { box-shadow: inset 4px 0 var(--warn), var(--shadow); }
.tile.danger { box-shadow: inset 4px 0 var(--danger), var(--shadow); }
.tile.ok { box-shadow: inset 4px 0 var(--ok), var(--shadow); }
.stream { list-style: none; margin: 0; padding: 0; }
.stream li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stream li:last-child { border-bottom: 0; }
.stream p { margin: 0 0 2px; }
.stream time { font-size: 12px; color: var(--muted); }
.report .controls { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.report .controls input, .report .controls select { width: auto; }
table.bars { width: 100%; border-collapse: collapse; }
.bars th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: left; padding: 4px 0; }
.bars td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.bars .num { text-align: right; width: 80px; white-space: nowrap; padding-left: 8px; }
.bar-label { display: block; }
.bar { display: block; height: 5px; margin-top: 4px; background: var(--accent); border-radius: 3px; min-width: 2px; }

/* Ticket-Ansicht */
.zoom { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr) auto; height: 100vh; }
.zoom.is-customer { grid-template-rows: minmax(0, 1fr); }
.zoom-main { overflow: auto; padding: 0 0 20px; }
.zoom-head { display: flex; gap: 14px; align-items: flex-start; padding: 18px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.zoom-title { flex: 1; min-width: 0; }
.title-input { font-size: 19px; font-weight: 600; border-color: transparent; padding: 3px 6px; margin-left: -7px; background: transparent; }
.title-input:hover { border-color: var(--line); }
.zoom-title h1 { padding-top: 3px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.notice { margin: 16px 24px 0; padding: 10px 14px; background: var(--accent-soft); border-radius: 6px; }
.articles { padding: 8px 24px; }
.article { display: flex; gap: 12px; margin: 16px 0; align-items: flex-start; }
.article.from-agent { flex-direction: row-reverse; }
.bubble { max-width: min(720px, 85%); background: var(--bubble-customer); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); min-width: 200px; }
.from-agent .bubble { background: var(--bubble-agent); border-color: transparent; }
.article.internal .bubble { background: var(--internal); border: 1px dashed var(--internal-line); }
.bubble header { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.bubble header b { color: var(--text); font-size: 13px; }
.bubble .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.tag-internal { color: #9a6700; font-weight: 600; text-transform: uppercase; font-size: 10px; letter-spacing: .05em; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumb img { display: block; max-width: 180px; max-height: 130px; border-radius: 6px; border: 1px solid var(--line); }
.file { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); font-size: 13px; }
.file small { color: var(--muted); }
.reply { margin: 12px 24px 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; box-shadow: var(--shadow); }
.reply.internal { background: var(--internal); border: 1px dashed var(--internal-line); }
.reply h3 { margin-bottom: 8px; }
.reply-modes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.mode { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; }
.mode.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.reply-modes select { width: auto; margin-left: auto; padding: 4px 8px; font-size: 13px; }
.reply textarea { border: 0; background: transparent; padding: 4px 2px; min-height: 90px; }
.reply textarea:focus { outline: none; }
.reply-foot { display: flex; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.reply-hint { display: block; color: var(--muted); font-size: 12px; padding: 0 2px 6px; }
.quote { margin-top: 8px; color: var(--muted); }
.quote summary { cursor: pointer; font-size: 12px; color: var(--accent-strong); }
.quote summary:hover { text-decoration: underline; }
.form-grid h3 { margin: 10px 0 8px; }
.tm-list { list-style: none; margin: 4px 0; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); box-shadow: 0 6px 20px rgba(0, 0, 0, .12); }
.tm-list li { padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.tm-list li.sel, .tm-list li:hover { background: var(--accent-soft); }
.tm-list small { color: var(--muted); }
.tm-list span { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zoom-side { grid-row: 1; grid-column: 2; overflow: auto; background: var(--panel); border-left: 1px solid var(--line); }
.side-card { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.side-card .field { margin-bottom: 10px; }
.side-card select, .side-card input { padding: 6px 8px; }
.side-card p { margin: 0 0 6px; }
.side-links { display: flex; gap: 16px; }
.person { display: flex; gap: 10px; align-items: center; color: var(--text) !important; margin-bottom: 6px; }
.person span { display: flex; flex-direction: column; min-width: 0; }
.person small { color: var(--muted); overflow-wrap: anywhere; }
.action-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: var(--panel); border-top: 1px solid var(--line); }
.action-bar select { width: auto; }
.time-input { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.time-input input { width: 70px; padding: 6px 8px; }
.picker { position: relative; }
.picker-list { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; list-style: none; margin: 4px 0 0; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); }
.picker-list li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 4px; cursor: pointer; }
.picker-list li span { display: flex; flex-direction: column; }
.picker-list li small { color: var(--muted); }
.picker-list li:hover { background: var(--accent-soft); }
.picker-list li.new { color: var(--accent-strong); }

/* Personen, Wissen */
.profile-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-head p { margin: 0; }
.copy { display: flex; gap: 8px; }
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.kb-grid > * + * { margin-top: 0; }
.kb-cat header { display: flex; justify-content: space-between; align-items: baseline; }
.kb-list { list-style: none; margin: 0; padding: 0; }
.kb-list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.kb-list li:last-child { border-bottom: 0; }
.kb-answer { line-height: 1.6; }
.kb-answer h2, .kb-answer h3, .kb-answer h4 { margin: 18px 0 6px; }
.narrow-form { max-width: 420px; }

/* Anmeldung */
.login { min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(160deg, var(--nav) 0%, var(--nav) 40%, var(--bg) 40%); }
.login-box { width: 100%; max-width: 380px; background: var(--panel); border-radius: 12px; padding: 32px 28px; box-shadow: 0 10px 40px rgba(0, 0, 0, .18); }
.login-box p { margin: 0 0 16px; }
.login-box .error { margin: 12px 0 0; min-height: 1em; }

/* Dialog und Hinweis */
dialog { border: 0; border-radius: 10px; padding: 0; width: min(480px, calc(100vw - 32px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog.wide { width: min(720px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(20, 24, 28, .45); }
.modal-form header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-form header h2 { margin: 0; }
.modal-body { padding: 16px 18px; max-height: 70vh; overflow: auto; }
.modal-body p { margin-top: 0; }
.modal-form footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel-2); border-radius: 0 0 10px 10px; }
#toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 10px 16px; border-radius: 8px; background: #24292e; color: #fff; font-weight: 500; transition: .2s; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); }

/* Schmale Bildschirme: Leiste oben, Spalten untereinander */
@media (max-width: 800px) {
  #app { flex-direction: column; height: auto; min-height: 100vh; }
  #main { height: auto; overflow: visible; }
  #nav { width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; position: sticky; top: 0; z-index: 10; }
  .brand { padding: 10px 12px; font-size: 15px; }
  .brand .logo { width: 26px; height: 26px; }
  .search { order: 5; flex-basis: 100%; margin: 0 10px 8px; }
  .menu { order: 6; flex-basis: 100%; display: flex; overflow-x: auto; }
  .menu a { flex-direction: column; gap: 2px; padding: 6px 12px; font-size: 11px; border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
  .menu a.active { border-bottom-color: var(--accent); }
  .menu .count { display: none; }
  .tasks-head, .tasks { display: none; }
  .nav-foot { margin-left: auto; border: 0; padding: 8px 10px; }
  #nav.customer .menu { flex: 0 0 100%; }
  .page { padding: 16px; }
  .split { flex-direction: column; }
  .subnav { width: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 0; }
  .subnav ul { display: flex; overflow-x: auto; margin: 0; }
  .subnav a { white-space: nowrap; padding: 6px 12px; }
  .subnav h3 { display: none; }
  .subnav .btn { margin: 8px 12px 0; width: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .cols .wide { grid-column: auto; }
  .zoom { display: block; height: auto; }
  .zoom-head { position: static; padding: 14px 16px; }
  .articles { padding: 4px 12px; }
  .bubble { max-width: 100%; min-width: 0; }
  .article .avatar { display: none; }
  .reply { margin: 12px; }
  .zoom-side { border-left: 0; border-top: 1px solid var(--line); }
  .action-bar { position: sticky; bottom: 0; flex-wrap: wrap; }
  .grid .c-organization, .grid .c-owner, .grid .c-location, .grid .c-category { display: none; }
  .grid th:nth-child(n) { white-space: nowrap; }
}

@media print {
  #nav, .no-print, .bulk, #toast { display: none !important; }
  #app, #main { display: block; height: auto; overflow: visible; }
  body, .card, .tile { background: #fff; box-shadow: none; }
  .page { padding: 0; max-width: none; }
  .card, .tile { border-color: #ccc; break-inside: avoid; }
}
