/* Compadi Intern — Oberfläche. Drei Spalten (Menü · Inhalt · Seitenleiste),
   weiße Karten auf Ivory, Bricolage für Titel und Zahlen, Instrument Sans für
   alles andere, Plex Mono für Nummern und Geld. Keine Schatten außer bei
   schwebenden Elementen, Linien statt Rahmen, viel Luft. */

@import url('/css/tokens.css');

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); color: var(--fg); -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: var(--font-body); font-size: var(--fs); line-height: 1.45;
  background: var(--bg); color: var(--fg);
  font-feature-settings: 'ss01', 'cv01';
}
::selection { background: var(--accent); color: var(--ink); }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--fg-3); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; font-family: var(--font-body); font-weight: 600; color: var(--fg-2); text-transform: uppercase; letter-spacing: 0.06em; }
p { margin: 0 0 10px; }
small, .small { font-size: 13px; }
.muted { color: var(--fg-2); }
.faint { color: var(--fg-3); }
.mono, .num { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; font-size: 0.93em; }
.display { font-family: var(--font-display); font-weight: 800; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; gap: var(--gap); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mt { margin-top: var(--gap); }
.mb { margin-bottom: var(--gap); }
.gap-s { gap: 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* --- Wortmarke: das o ist der Kompass --- */
.brand { display: inline-flex; align-items: center; gap: 0; font-family: var(--font-brand); font-weight: 700; letter-spacing: -0.03em; font-size: 24px; line-height: 1; color: var(--fg); text-decoration: none !important; }
.brand .dial { width: 0.86em; height: 0.86em; margin: 0 0.02em; transform: translateY(0.02em); }
:root[data-theme='dark'] .brand .dial-bg { fill: var(--ivory); }
:root[data-theme='dark'] .brand .dial-n2 { fill: var(--ink); }
.brand-sub { font-family: var(--font-body); font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-2); margin-top: 4px; }

/* --- Layout --- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--aside); min-height: 100vh; min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; padding: 22px 14px; scrollbar-width: thin; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--line); background: var(--bg); overflow-y: auto; }
.sidebar .brand-wrap { padding: 4px 10px 16px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r); color: var(--fg-2); font-weight: 500; }
.nav a:hover { background: var(--card); color: var(--fg); text-decoration: none; }
.nav a.aktiv { background: var(--accent); color: var(--ink); font-weight: 600; }
.nav a .ic { width: 20px; height: 20px; flex: none; }
.nav a .ic svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav .grp { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-3); padding: 14px 12px 4px; }
.sidebar .foot { margin-top: auto; padding: 8px 4px 0; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r); }
.me:hover { background: var(--card); text-decoration: none; }
.me .nm { font-weight: 600; font-size: 14px; line-height: 1.2; }
.me .rl { font-size: 12px; color: var(--fg-2); }

.main { min-width: 0; padding: 0 var(--pad) 60px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: var(--topbar); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad); border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar h1 { font-size: 20px; opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; }
.topbar.scrolled h1 { opacity: 1; transform: none; }
.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.page { padding-top: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--fg-2); margin-top: 4px; }

.aside { position: sticky; top: 0; height: 100vh; height: 100dvh; border-left: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
.aside .aside-head { padding: 18px 18px 10px; display: flex; align-items: center; gap: 10px; }
.aside .aside-body { padding: 0 14px 14px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }

/* --- Karten --- */
.card { background: var(--card); border-radius: var(--r-card); padding: var(--pad); border: 1px solid var(--line); }
.card.tight { padding: 14px 16px; }
.card.flat { border: 0; background: var(--card-2); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.kpi { display: flex; flex-direction: column; gap: 2px; min-height: 104px; }
.kpi .lbl { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-2); }
.kpi .val { font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: -0.02em; margin-top: auto; font-variant-numeric: tabular-nums; }
.kpi .val.money { font-size: 26px; }
.kpi .hint { font-size: 12px; color: var(--fg-2); }
.kpi .val.bad { color: var(--bad); }
.kpi .val.ok { color: var(--ok); }
.kpi .val.warn { color: var(--warn); }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--card); color: var(--fg); font-weight: 600; font-size: 14px; cursor: pointer; line-height: 1.2; white-space: nowrap; transition: transform .06s, background .15s, border-color .15s; user-select: none; }
.btn:hover { border-color: var(--fg-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.btn.primary:hover { background: #f0bb00; border-color: #f0bb00; }
.btn.ink { background: var(--ink); border-color: var(--ink); color: var(--ivory); }
:root[data-theme='dark'] .btn.ink { background: var(--ivory); border-color: var(--ivory); color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--card-2); color: var(--fg); }
.btn.danger { color: var(--bad); border-color: var(--bad-soft); background: var(--bad-soft); }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn.icon { padding: 8px; width: 36px; height: 36px; border-radius: 50%; }
.btn .ic, .btn > svg, .icbtn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn.full { width: 100%; }

/* --- Formulare --- */
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--fg-2); }
label.f > span { display: flex; justify-content: space-between; }
.inp, input.inp, select.inp, textarea.inp { width: 100%; padding: 9px 12px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--card); color: var(--fg); font-weight: 400; font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s; }
.inp:focus { border-color: var(--fg); box-shadow: 0 0 0 3px var(--focus); }
.inp::placeholder { color: var(--fg-3); }
.inp.mono { font-family: var(--font-mono); }
textarea.inp { min-height: 90px; resize: vertical; line-height: 1.45; }
select.inp { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b655a' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.inp[aria-invalid='true'] { border-color: var(--bad); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--fg); cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.form { display: grid; gap: 14px; }
.form.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form .span2 { grid-column: span 2; }
.fehler { color: var(--bad); font-size: 13px; font-weight: 500; min-height: 1em; }
.hilfe { font-size: 13px; color: var(--fg-2); }

/* Schalter */
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: .15s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + i { background: var(--ink); }
:root[data-theme='dark'] .switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }

/* --- Badges / Status --- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; background: var(--info-soft); color: var(--fg-2); line-height: 1.4; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: #7a5300; }
:root[data-theme='dark'] .badge.warn { color: var(--yellow); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.accent { background: var(--accent); color: var(--ink); }
.badge.ink { background: var(--ink); color: var(--ivory); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--fg-3); flex: none; display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.off { background: var(--fg-3); }

/* --- Avatare --- */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--stone); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 14px; flex: none; overflow: hidden; letter-spacing: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.xl { width: 96px; height: 96px; font-size: 34px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

/* --- Tabellen --- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-2); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--card-2); }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tbl th.num { font-family: var(--font-body); }
.tbl .act { text-align: right; white-space: nowrap; }
.tbl tr.klick { cursor: pointer; }
.leer { padding: 30px; text-align: center; color: var(--fg-2); }
.leer .big { font-size: 40px; margin-bottom: 8px; }

/* --- Listen --- */
.list { display: flex; flex-direction: column; }
.list > .item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.list > .item:last-child { border-bottom: 0; }
.list > .item .t { font-weight: 600; }
.list > .item .s { font-size: 13px; color: var(--fg-2); }

/* --- Tabs / Filter --- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--card-2); border-radius: var(--r-pill); width: max-content; max-width: 100%; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 6px 14px; border-radius: var(--r-pill); font-weight: 600; font-size: 13px; color: var(--fg-2); cursor: pointer; white-space: nowrap; }
.tabs button.aktiv { background: var(--card); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter .inp { width: auto; min-width: 160px; }

/* --- Drawer (Details rechts) & Modal --- */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 40; opacity: 0; animation: fade .15s forwards; }
@keyframes fade { to { opacity: 1; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--card); z-index: 41; box-shadow: var(--shadow); display: flex; flex-direction: column; transform: translateX(30px); opacity: 0; animation: slide .18s forwards; }
@keyframes slide { to { transform: none; opacity: 1; } }
.drawer .d-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 12px; border-bottom: 1px solid var(--line); }
.drawer .d-head h2 { font-size: 20px; flex: 1; }
.drawer .d-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.drawer .d-foot { padding: 12px 22px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.modal { position: fixed; inset: 0; z-index: 42; display: grid; place-items: center; padding: 20px; }
.modal .box { background: var(--card); border-radius: var(--r-card); padding: 22px; width: min(440px, 100%); box-shadow: var(--shadow); }
.modal .box h3 { margin-bottom: 8px; }

/* --- Toast --- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--ivory); padding: 10px 16px; border-radius: var(--r-pill); font-weight: 600; font-size: 14px; box-shadow: var(--shadow); animation: up .2s; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--pine); color: #fff; }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }

/* --- Rechte-Matrix --- */
.matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.matrix th, .matrix td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix select { padding: 4px 26px 4px 8px; font-size: 13px; }

/* --- Sonstiges --- */
.pill-input { display: flex; gap: 6px; flex-wrap: wrap; }
.code-big { font-family: var(--font-mono); font-size: 22px; letter-spacing: 0.2em; font-weight: 500; }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ink); border-radius: 999px; }
:root[data-theme='dark'] .progress i { background: var(--accent); }
.progress.warn i { background: var(--warn); }
.progress.bad i { background: var(--bad); }
.kbd { font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--fg-2); }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--r); background: var(--accent-soft); font-weight: 500; margin-bottom: 14px; }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.loading { color: var(--fg-3); padding: 30px; text-align: center; }

/* --- Panels ziehen & einklappen --- */
.app { --sb: var(--sidebar); --as: var(--aside); grid-template-columns: var(--sb) minmax(0, 1fr) var(--as); }
.app.sb-zu { --sb: 72px; }
.app.as-zu { --as: 0px; }
.app.as-zu .aside { display: none; }
.app { position: relative; }
.resizer { position: absolute; top: 0; bottom: 0; width: 9px; cursor: col-resize; z-index: 25; }
.resizer.sb { left: calc(var(--sb) - 5px); }
.resizer.as { right: calc(var(--as) - 4px); }
.app.as-zu .resizer.as { display: none; }
.resizer::after { content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background .15s; }
.resizer:hover::after, .resizer.aktiv::after { background: var(--accent); }
body.ziehen { cursor: col-resize; user-select: none; }
body.ziehen * { pointer-events: none; }
.sb-toggle { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r); color: var(--fg-3); cursor: pointer; font-size: 13px; font-weight: 500; border: 0; background: transparent; width: 100%; }
.sb-toggle:hover { background: var(--card); color: var(--fg); }
.sb-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.app.sb-zu .sidebar { padding-left: 10px; padding-right: 10px; }
.app.sb-zu .nav a span:not(.ic), .app.sb-zu .nav .grp, .app.sb-zu .nav .badge, .app.sb-zu .brand-sub, .app.sb-zu .me > div, .app.sb-zu .sb-toggle span { display: none; }
.app.sb-zu .nav a { justify-content: center; padding: 10px; }
.app.sb-zu .brand { font-size: 0; }
.app.sb-zu .brand .dial { width: 28px; height: 28px; }
.app.sb-zu .brand-wrap { padding: 4px 0 16px; display: flex; justify-content: center; }
.app.sb-zu .me { justify-content: center; padding: 8px 0; }
.app.sb-zu .sb-toggle { justify-content: center; }
.app.sb-zu .sb-toggle .pfeil { transform: rotate(180deg); }

/* Mobile-Navigation unten */
.bottomnav { display: none; }

/* --- Responsiv --- */
@media (max-width: 1280px) { :root { --aside: 280px; --sidebar: 210px; } }
@media (max-width: 1150px) { .app { --sb: var(--sidebar) !important; } .app.sb-zu { --sb: 72px !important; } .app.as-zu .aside { display: flex; } .resizer { display: none; } }
@media (max-width: 1150px) {
  .app { grid-template-columns: var(--sb) minmax(0, 1fr); }
  .aside { position: fixed; right: 0; top: 0; bottom: 0; width: min(360px, 100vw); transform: translateX(100%); transition: transform .2s; z-index: 30; box-shadow: none; }
  .aside.offen { transform: none; box-shadow: var(--shadow); }
  .topbar .aside-toggle { display: inline-flex; }
}
.topbar .aside-toggle { display: inline-flex; }
@media (max-width: 760px) {
  :root { --pad: 16px; --r-card: 16px; }
  .app { grid-template-columns: minmax(0, 1fr) !important; }
  .sidebar { display: none; }
  .main { padding-bottom: 84px; }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 64px; background: var(--card); border-top: 1px solid var(--line); z-index: 30; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; font-weight: 600; color: var(--fg-2); padding: 4px 8px; border-radius: var(--r); min-width: 56px; }
  .bottomnav a.aktiv { color: var(--ink); background: var(--accent); }
  .bottomnav a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c1m { grid-template-columns: minmax(0, 1fr); }
  .form.c2 { grid-template-columns: minmax(0, 1fr); }
  .form .span2 { grid-column: auto; }
  .topbar h1 { font-size: 19px; opacity: 1; transform: none; }
  .tbl.cards thead { display: none; }
  .tbl.cards tr { display: block; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; padding: 6px 4px; }
  .tbl.cards td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 5px 10px; }
  .tbl.cards td::before { content: attr(data-l); color: var(--fg-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
  .drawer { width: 100vw; }
  .btn { min-height: 40px; }
}
@media (max-width: 420px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0, 1fr); } }

/* --- Kanban --- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.kb-col { background: var(--card-2); border-radius: var(--r-card); padding: 10px; min-height: 200px; transition: background .15s; }
.kb-col.over { background: var(--accent-soft); }
.kb-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; padding: 4px 6px 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-2); }
.kb-body { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kb-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; cursor: pointer; transition: border-color .15s, transform .1s; }
.kb-card:hover { border-color: var(--line-strong); }
.kb-card.dragging { opacity: .5; transform: rotate(1deg); }
.kb-titel { font-weight: 600; line-height: 1.3; }
.badge.ghost { background: transparent; border: 1px solid var(--line); }
@media (max-width: 1000px) { .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kanban { grid-template-columns: minmax(0, 1fr); } }

/* --- Markdown --- */
.md { line-height: 1.55; }
.md h2 { font-size: 18px; margin: 16px 0 6px; }
.md h3 { font-size: 15px; margin: 14px 0 4px; }
.md h4, .md h5 { font-size: 14px; margin: 12px 0 4px; text-transform: none; letter-spacing: 0; color: var(--fg); font-family: var(--font-display); font-weight: 800; }
.md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md li.task { list-style: none; margin-left: -18px; }
.md li.task.done { color: var(--fg-2); text-decoration: line-through; }
.md code { font-family: var(--font-mono); font-size: 0.9em; background: var(--info-soft); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--info-soft); padding: 10px 12px; border-radius: var(--r); overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--accent); margin: 0 0 8px; padding: 4px 12px; color: var(--fg-2); }
.md table { border-collapse: collapse; margin: 0 0 8px; font-size: 14px; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; }
.md th { background: var(--card-2); }
.md a { text-decoration: underline; text-underline-offset: 2px; }
.md hr { margin: 12px 0; }
.md-diagram svg { max-width: 100%; height: auto; }
.item.aktiv { background: var(--accent-soft); border-radius: 8px; }

/* --- Chat --- */
.chat { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.chat-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.chat-tabs button { border: 1px solid var(--line); background: var(--card); border-radius: var(--r-pill); padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--fg-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.chat-tabs button.aktiv { background: var(--ink); color: var(--ivory); border-color: var(--ink); }
:root[data-theme='dark'] .chat-tabs button.aktiv { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.chat-tabs .n { background: var(--bad); color: #fff; border-radius: 999px; padding: 0 5px; font-size: 10px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px 2px; min-height: 160px; max-height: 50vh; }
.chat-msg { display: flex; gap: 8px; align-items: flex-start; }
.chat-msg .b { background: var(--card-2); border-radius: 12px; padding: 6px 10px; font-size: 14px; max-width: 100%; word-break: break-word; }
.chat-msg.mine { flex-direction: row-reverse; }
.chat-msg.mine .b { background: var(--accent-soft); }
.chat-msg .m { font-size: 11px; color: var(--fg-3); margin-top: 2px; }
.chat-inp { display: flex; gap: 6px; margin-top: 8px; }
.chat-inp textarea { flex: 1; min-height: 38px; max-height: 120px; resize: none; padding: 8px 10px; }
.typing { font-size: 11px; color: var(--fg-3); height: 14px; }

/* --- Kalender --- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .wd { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-2); padding: 4px 6px; }
.cal .day { min-height: 92px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px; font-size: 12px; }
.cal .day.other { opacity: .45; }
.cal .day.today { border-color: var(--ink); }
:root[data-theme='dark'] .cal .day.today { border-color: var(--accent); }
.cal .day .d { font-weight: 600; font-family: var(--font-mono); font-size: 12px; margin-bottom: 3px; }
.cal .ev { display: block; border-radius: 6px; padding: 1px 6px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; background: var(--info-soft); }
.cal .ev.meeting { background: var(--accent-soft); }
.cal .ev.frist { background: var(--bad-soft); color: var(--bad); }
.cal .ev.messe { background: var(--ok-soft); color: var(--ok); }
.cal .ev.ferien, .cal .ev.feiertag { background: transparent; border: 1px dashed var(--line-strong); color: var(--fg-2); }
.cal .ev.abw { background: transparent; color: var(--fg-2); font-style: italic; }
@media (max-width: 760px) { .cal .day { min-height: 56px; } .cal .ev { font-size: 10px; padding: 0 4px; } }

/* --- Team-Board --- */
.tb-card { position: relative; }
.tb-card .aktiv-app { font-size: 13px; color: var(--fg-2); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.tb-card .aktiv-app .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-card .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(31,111,92,.5); } 70% { box-shadow: 0 0 0 8px rgba(31,111,92,0); } 100% { box-shadow: 0 0 0 0 rgba(31,111,92,0); } }
body.wand .sidebar, body.wand .aside, body.wand .topbar, body.wand .resizer, body.wand .bottomnav { display: none !important; }
body.wand .app { grid-template-columns: minmax(0, 1fr) !important; }
body.wand .main { padding: 24px; }
