:root {
  color-scheme: light;
  /* Farben angelehnt an itsrr.de: dunkles Flaschengrün für Text/Akzente, kräftiges Grün für Aktionen */
  --bg: #d8e0da; --surface: #ffffff; --surface2: #f2f6f3; --ink: #4a4a4a; --muted: #647266;
  --line: #dde4df; --line2: #ebf0ed;
  --accent: #1f4e43; --accent-bright: #2a6c33;
  --accent-hover: #21501f; --accent-ink: #ffffff; --accent-soft: #e2efe4;
  --st-offen: #5a6f8c; --st-arbeit: #2f77b5; --st-wartet: #a86d14; --st-erledigt: #2b8452;
  --p-niedrig: #66768a; --p-normal: #3f6fb5; --p-hoch: #c0600a; --p-kritisch: #c22f36;
  --pr-online: #2b8452; --pr-kundenbesuch: #3f6fb5; --pr-urlaub: #8a5bc0;
  --danger: #c22f36; --danger-soft: #fbe6e7; --ok-soft: #e2efe4;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e1613; --surface: #17211c; --surface2: #1b2721; --ink: #e7ede9; --muted: #93a195;
    --line: #2c3a32; --line2: #233027;
    --accent: #6fcf9e; --accent-bright: #4e9a5a;
    --accent-hover: #86dba7; --accent-ink: #062314; --accent-soft: #1b3326;
    --st-offen: #8ea3c0; --st-arbeit: #6aa9e0; --st-wartet: #e0a44a; --st-erledigt: #5cc389;
    --p-niedrig: #8797a5; --p-normal: #6b9ce0; --p-hoch: #f0913f; --p-kritisch: #ff6b70;
    --pr-online: #5cc389; --pr-kundenbesuch: #6b9ce0; --pr-urlaub: #b48bec;
    --danger: #ff6b70; --danger-soft: #3a1c20; --ok-soft: #1b3326;
  }
}
* { box-sizing: border-box; }
html, body { background: var(--bg); }
body { margin: 0; padding: 0; color: var(--ink); font: 14px/1.45 var(--sans); }
h1, h2, h3, p { margin: 0; }
h2, h3 { font-weight: 700; letter-spacing: -.01em; color: var(--accent); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.wrap { max-width: 1480px; margin-inline: auto; padding-inline: 20px; }
.wrap.main { padding-block: 18px 40px; }

/* Kopfzeile: helle Logozeile, darunter die Navigation, beides auf hellem Grund */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brandlink { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.brand .logo { height: 52px; width: auto; max-width: 240px; display: block; }
.mark { width: 26px; height: 26px; border-radius: 6px; background: var(--accent-bright); display: grid; place-items: center; color: var(--accent-ink); font: 500 13px var(--mono); }
.brand h1 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: var(--accent); }
.role { font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.navbar { background: var(--surface2); border-bottom: 1px solid var(--line); }
.navbar .wrap { padding-inline: 12px; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tab { padding: 11px 16px; color: var(--muted); font-weight: 600; text-decoration: none; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--ink); background: var(--surface); }
.tab[aria-current="page"] { color: var(--accent); background: var(--surface); border-bottom-color: var(--accent-bright); }
.me { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.me a { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; text-decoration: none; }
.me a span:last-child { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me form { margin: 0; }
.btn { display: inline-block; border: 1px solid var(--line); background: var(--surface); border-radius: 5px; padding: 7px 14px; cursor: pointer; font-weight: 600; line-height: 1.3; color: var(--ink); text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent-bright); border-color: var(--accent-bright); color: var(--accent-ink); box-shadow: 0 1px 4px rgba(20, 40, 24, .3); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { padding: 3px 10px; font-size: 12.5px; }
.banner { margin-bottom: 12px; padding: 8px 12px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.banner.ok { background: var(--ok-soft); }
.banner.err { background: var(--danger-soft); border-color: var(--danger); }
.err { color: var(--danger); font-size: 13px; margin-bottom: 8px; }
.meta { color: var(--muted); font-size: 12.5px; }
.note { margin-bottom: 12px; }
.count { margin-bottom: 8px; }
.empty { color: var(--muted); font-size: 13px; padding: 14px 6px; text-align: center; }

/* Kennzahlen & Filter */
.stats { display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; }
.stat { flex: 1 1 130px; display: flex; align-items: baseline; gap: 8px; padding: 10px 16px; border-right: 1px solid var(--line2); color: inherit; text-decoration: none; }
.stat:last-child { border-right: 0; }
a.stat:hover { background: var(--surface2); }
.stat .n { font: 500 22px var(--mono); font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat.alert .n { color: var(--danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); display: inline-block; flex: none; }

/* Kennzahlen im Board: ein Kreis je Kennzahl */
.board-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 28px; margin-bottom: 18px; }
.circle-stat { display: flex; flex-direction: column; align-items: center; gap: 8px; color: inherit; text-decoration: none;
    animation: circle-pop .5s ease backwards; }
.circle-stat:nth-child(1) { animation-delay: 0s; } .circle-stat:nth-child(2) { animation-delay: .1s; }
.circle-stat:nth-child(3) { animation-delay: .2s; } .circle-stat:nth-child(4) { animation-delay: .3s; }
.circle-stat .ring { width: 112px; height: 112px; border-radius: 50%; border: 9px solid var(--c); background: var(--surface);
    display: grid; place-items: center; font: 700 28px var(--mono); font-variant-numeric: tabular-nums;
    transition: transform .15s ease, background .15s ease; }
.circle-stat .lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: center; }
.circle-stat:hover .ring { background: var(--surface2); transform: scale(1.06); }
.cs-all { --c: var(--accent); } .cs-open { --c: var(--st-offen); } .cs-overdue { --c: var(--danger); } .cs-done { --c: var(--st-erledigt); }
@keyframes circle-pop {
    from { opacity: 0; transform: scale(.6); }
    to { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .circle-stat { animation: none; }
    .circle-stat .ring { transition: none; }
}
@media (max-width: 760px) {
    .board-stats { gap: 16px; }
    .circle-stat .ring { width: 88px; height: 88px; border-width: 7px; font-size: 22px; }
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters input[type=search], .filters select { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; min-width: 0; }
.filters input[type=search] { flex: 1 1 220px; max-width: 340px; }
.chk { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; padding-inline: 4px; }

/* Status- und Prioritätsfarben */
.s-offen { --c: var(--st-offen); } .s-arbeit { --c: var(--st-arbeit); } .s-wartet { --c: var(--st-wartet); } .s-erledigt { --c: var(--st-erledigt); }
.p-niedrig { --c: var(--p-niedrig); } .p-normal { --c: var(--p-normal); } .p-hoch { --c: var(--p-hoch); } .p-kritisch { --c: var(--p-kritisch); }
.pr-online { --c: var(--pr-online); } .pr-kundenbesuch { --c: var(--pr-kundenbesuch); } .pr-urlaub { --c: var(--pr-urlaub); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 99px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.num { font: 12px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.due { font: 12px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.due.late { color: var(--danger); font-weight: 500; }
.due.today { color: var(--st-wartet); font-weight: 500; }
.who { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; }
.who .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.av { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 10.5px; font-weight: 600; color: #fff; background: hsl(var(--h, 140) 38% 38%); overflow: hidden; }
.av.none { background: none; border: 1.5px dashed var(--muted); color: var(--muted); }
.av.photo { background: var(--surface2); }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Liste */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; min-width: 980px; }
th { text-align: left; padding: 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sortb { display: block; padding: 9px 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; text-decoration: none; }
.sortb:hover { color: var(--ink); }
td { padding: 9px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
tr.row { cursor: pointer; }
tr.row:hover td { background: var(--surface2); }
tr:last-child td { border-bottom: 0; }
td.ttl { max-width: 380px; overflow-wrap: anywhere; font-weight: 500; }
td.num a { color: var(--muted); text-decoration: none; }

/* Board */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.col { background: var(--surface2); border: 1px solid var(--line2); border-radius: 10px; padding: 10px; min-height: 160px; display: flex; flex-direction: column; gap: 8px; }
.col.over { outline: 2px dashed var(--accent); outline-offset: -3px; }
.col-h { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; font-weight: 600; }
.col-h .cnt { margin-left: auto; font: 400 12px var(--mono); color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 10px 11px; display: flex; flex-direction: column; gap: 7px; cursor: pointer; }
.card:hover { border-color: var(--muted); }
.card.dragging { opacity: .4; }
.card h3 { font-size: 14px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.card h3 a { color: var(--ink); text-decoration: none; }
.c-top, .c-foot { display: flex; align-items: center; gap: 8px; }
.c-top .pill { margin-left: auto; }
.c-foot { justify-content: space-between; flex-wrap: wrap; }
.c-meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 10px; flex-wrap: wrap; }
.adv-form { margin: 0; }
.adv { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 12.5px; padding: 0; font-weight: 500; text-decoration: none; }
.adv:hover { text-decoration: underline; }

/* Team & Kunden */
.team-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.team-form input, .se input, .se select { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; min-width: 0; }
.team-form input { flex: 1 1 180px; max-width: 260px; }
.team-form input.wide { max-width: 420px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.trow { display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(200px, 2fr) auto; gap: 8px 20px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 11px 14px; margin-bottom: 8px; }
.trow.unassigned { border-style: dashed; }
.trow.inactive { opacity: .6; }
.tname { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.tname .av { width: 32px; height: 32px; font-size: 12.5px; }
.tname b { font-weight: 600; display: block; }
.tname small { color: var(--muted); display: block; }
.bar { display: flex; height: 10px; background: var(--surface2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line2); }
.bar i { display: block; background: var(--c); height: 100%; }
.tnums { display: flex; gap: 14px; margin-top: 6px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.trow > .tnums { margin-top: 0; }
.tnums b { font: 500 13px var(--mono); color: var(--ink); }
.tnums .late b { color: var(--danger); }
.tact { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.tact form { margin: 0; }
.se { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; grid-column: 1 / -1; }
.se input { flex: 1 1 160px; }
.trow.edit { display: block; }

/* Formulare & Detailseite */
.panelbox { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 14px; }
.panelbox.narrow { max-width: 440px; margin: 6vh auto 0; }
.panelbox h2 { font-size: 18px; margin-bottom: 8px; }
.panelbox h3 { font-size: 15px; margin-bottom: 10px; }
.panelbox summary { cursor: pointer; font-weight: 600; }
.add-user { margin-top: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.profile-form { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
.profile-av { display: flex; align-items: center; gap: 14px; }
.profile-av .av { width: 64px; height: 64px; font-size: 20px; flex: none; }
.profile-av .fld { flex: 1 1 auto; }
.profile-av input[type=file] { padding: 5px 0; background: none; border: 0; }
.detail { max-width: 860px; margin-inline: auto; }
.d-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.d-head h2 { font: 500 18px var(--mono); }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld.end { justify-content: flex-end; }
.fld > label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.fld input, .fld select, .fld textarea, .stack textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; width: 100%; min-width: 0; }
.fld input.big { font-size: 17px; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
textarea { resize: vertical; min-height: 84px; }
.p-foot { display: flex; gap: 8px; }
.feed { display: flex; flex-direction: column; gap: 10px; list-style: none; margin: 14px 0 0; padding: 0; }
.feed li { display: flex; flex-direction: column; gap: 2px; }
.feed .h { font-size: 12.5px; color: var(--muted); }
.feed .h b { color: var(--ink); font-weight: 600; }
.feed .t { white-space: pre-wrap; overflow-wrap: anywhere; }
.feed.hist li { flex-direction: row; gap: 10px; align-items: baseline; }
.feed.hist .h { flex: none; font: 12px var(--mono); }
.feed.comments-inline { gap: 0; margin-top: 6px; }
.feed.comments-inline li { padding-block: 10px; border-top: 1px solid var(--line); }
.feed.comments-inline li:first-child { border-top: 0; padding-top: 0; }
.dash-team li { flex-direction: row; align-items: center; gap: 12px; padding-block: 10px; border-top: 1px solid var(--line); }
.dash-team li:first-child { border-top: 0; padding-top: 0; }
.dash-team .nm { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; min-width: 0; }
.dash-team .nm small { color: var(--muted); font-size: 12px; }
.dash-team .pill { flex: none; }
.danger-zone { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }

@media (max-width: 1180px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .wrap { padding-inline: 16px; }
  .board { grid-template-columns: 1fr; }
  .trow { grid-template-columns: 1fr; }
  .tact { justify-content: flex-start; }
  .stat { flex-basis: 45%; }
  .grid2 { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr; }
}

.note-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12.5px; margin-top: 4px; padding: 6px 10px; background: var(--surface2); border-left: 3px solid var(--accent); border-radius: 4px; }
.note-text[hidden] { display: none; }
textarea.note-in { flex: 1 1 180px; max-width: 420px; min-width: 0; min-height: 0; height: auto; resize: none; field-sizing: content; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; line-height: 1.45; }

.ev-login { --c: var(--st-erledigt); } .ev-logout { --c: var(--p-niedrig); } .ev-failed { --c: var(--p-hoch); } .ev-blocked { --c: var(--p-kritisch); }
td.ua { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12.5px; }
td.mono { font: 12.5px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.ev-password { --c: var(--st-arbeit); } .ev-session_ended { --c: var(--p-niedrig); } .ev-session_invalid { --c: var(--p-kritisch); }
.here { margin-left: 6px; }
.sess-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.sess-actions form { margin: 0; }
.panelbox.wide { max-width: 860px; margin-inline: auto; }
.dash-now { text-align: center; }
.now-dt { display: flex; justify-content: center; align-items: center; gap: 18px; flex-wrap: wrap; }
.now-date, .now-time { display: inline-flex; align-items: center; gap: 6px; }
.now-dt .ic { flex: none; color: var(--muted); }
.now-date { font-size: 15px; font-weight: 600; }
.now-time { font: 600 15px var(--mono); color: #fff; font-variant-numeric: tabular-nums;
    background: var(--accent-bright); padding: 4px 12px; border-radius: 999px; }
.now-time .ic { color: #fff; }
.now-quote { color: var(--muted); margin: 8px 0 0; font-style: italic; }

.foot { background: var(--surface2); border-top: 1px solid var(--line); color: var(--muted); }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; padding-block: 16px; font-size: 13px; }
.foot a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.foot a:hover, .foot a:focus-visible { color: var(--accent-hover); }
.imprint dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 14px 0; }
.imprint dt { color: var(--muted); }
.imprint dd { margin: 0; white-space: pre-line; }

.mail-log {
    font: 12.5px var(--mono); line-height: 1.55; white-space: pre-wrap; word-break: break-word;
    background: var(--surface2); border: 1px solid var(--line); border-radius: 8px;
    padding: 12px 14px; max-height: 70vh; overflow-y: auto; color: var(--ink);
}
