:root {
  color-scheme: light;
  --field: #FFFFFF;
  --soft: #FAF9F6;
  --tabs-bg: #E4E2DA;
  --top-line: #D6D3C9;
  --line-hover: #BDB9AD;
  --demo-bg: #F7E6CC;
  --cal-fremd: #F7F6F2;
  --cal-we: #FBFAF7;
  --muted-3: #A3A6A8;
  --on-accent: #FFFFFF;
  --backdrop: rgba(27,29,31,.35);
  --shadow-s: 0 1px 2px rgba(0,0,0,.08);
  --shadow-m: 0 10px 30px rgba(0,0,0,.12);
  --shadow-l: 0 20px 50px rgba(0,0,0,.18);
  --st-offen: #8F9296;
  --st-arbeit: #2F5BA8;
  --st-arbeit-soft: #E6EDF8;
  --st-erledigt: #1E6B45;
  --bg: #EFEEE8;
  --card: #FFFFFF;
  --line: #DAD7CD;
  --line-2: #E6E3DA;
  --line-3: #F0EEE7;
  --ink: #1B1D1F;
  --ink-2: #3A3D40;
  --muted: #5B5F62;
  --muted-2: #6B6F72;
  --accent: #0F6E68;
  --accent-ink: #0A4541;
  --accent-soft: #E1F0EC;
  --warn: #7A4A00;
  --warn-soft: #FBEBD6;
  --bad: #B42318;
  --bad-soft: #FBE4E1;
  --bad-bg: #FDF4F2;
  --bad-line: #F2C9C3;
  --good: #1E6B45;
  --good-soft: #E3F2EA;
  --track: #ECEAE3;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  /* Kalender-Ebenen */
  --k-termin: #0F6E68;
  --k-projekt: #2F5BA8;
  --k-aufgabe: #8A4B14;
  --k-planung: #5B5F62;
  --k-abwesenheit: #9A3B6A;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); }
body { min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.page { max-width: 1600px; margin: 0 auto; padding: 28px 32px 32px; display: flex; flex-direction: column; gap: 20px; }

/* ---------- Kopf ---------- */
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--top-line); }
.top-left { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.top h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.top-right { display: flex; align-items: baseline; gap: 18px; }
.top-right #datum { font-size: 14px; }
.clock { font-size: 28px; font-weight: 600; }
.badge-demo { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--warn); background: var(--demo-bg); padding: 3px 8px; border-radius: 4px; }

.tabs { display: flex; gap: 4px; background: var(--tabs-bg); padding: 3px; border-radius: 7px; align-self: center; }
.tab { border: 0; background: transparent; padding: 5px 14px; border-radius: 5px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: var(--mono); }
.tab[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-s); }
.tab:focus-visible, .btn:focus-visible, .add:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Raster ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: 300px 340px auto; gap: 20px; }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c12 { grid-column: span 12; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; min-height: 0; }
.card-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card-h h2 { margin: 0; font-size: 17px; font-weight: 600; white-space: nowrap; }
.meta { font-family: var(--mono); font-size: 13px; color: var(--muted); display: inline-flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.scroll { overflow-y: auto; min-height: 0; flex: 1; scrollbar-width: thin; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fehler { font-size: 13px; color: var(--bad); background: var(--bad-bg); border: 1px solid var(--bad-line); border-radius: 6px; padding: 8px 10px; white-space: normal; }
.leer { font-size: 13px; color: var(--muted); padding: 10px 0; }

.add { border: 1px solid var(--line); background: var(--soft); border-radius: 5px; padding: 1px 8px; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--accent); cursor: pointer; line-height: 20px; }
.add:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- Anwesenheit ---------- */
.anw-cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); flex-grow: 1; border-top: 1px solid var(--line-2); min-height: 0; overflow: hidden; }
.anw-col { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 0; border-right: 1px solid var(--line-2); overflow-y: auto; }
.anw-col:first-child { padding-left: 0; }
.anw-col:last-child { border-right: 0; padding-right: 0; }
.anw-col-h { display: flex; justify-content: space-between; align-items: baseline; }
.anw-col-h span:first-child { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.anw-col-h b { font-family: var(--mono); font-size: 20px; font-weight: 600; }
.anw-col .p { font-size: 14px; }
.anw-col .p small { color: var(--muted); font-size: 12px; }
.anw-foot { font-size: 13px; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--line-2); }

/* ---------- Daily ---------- */
.daily-grp { display: flex; flex-direction: column; gap: 5px; padding: 7px 0; border-top: 1px solid var(--line-2); }
.daily-grp:first-child { border-top: 0; padding-top: 0; }
.daily-leer { padding-top: 7px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--muted-2); }
.daily-grp-h { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--accent); text-transform: uppercase; display: flex; justify-content: space-between; }
.daily-grp-h span:last-child { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; line-height: 1.35; padding: 1px 7px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--soft); }
.chip .k { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--on-accent); padding: 0 5px; border-radius: 3px; }
.chip .x { display: none; margin-right: -4px; border: 0; background: transparent; color: var(--muted-2); cursor: pointer; padding: 0 4px; font-size: 14px; line-height: 1; }
.chip:hover .x, .chip:focus-within .x { display: inline; }
.chip .x:hover { color: var(--bad); }
.chip-leer { font-size: 13px; color: var(--muted-2); }
.kunden-legende { display: flex; gap: 12px; font-size: 12px; color: var(--muted); padding-top: 8px; border-top: 1px solid var(--line-2); }
.kunden-legende i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: baseline; }

/* ---------- Termine ---------- */
.list { display: flex; flex-direction: column; border-top: 1px solid var(--line-2); }
.term { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-3); }
.term:last-child { border-bottom: 0; }
.term .t { font-family: var(--mono); font-size: 14px; font-weight: 600; width: 54px; flex-shrink: 0; }
.term .t small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); white-space: nowrap; } /* Ende („–10:30“ bzw. „bis 05.10.“) */
.term.laeuft .t { color: var(--accent); }
.term-jetzt { font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0 4px; vertical-align: 1px; }
.term .n { font-size: 14px; line-height: 1.35; }
.term .n small { display: block; color: var(--muted); font-size: 12px; }
.term.vorbei { opacity: .5; }

/* ---------- Projekte ---------- */
.proj { display: flex; flex-direction: column; gap: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.proj-row { display: flex; flex-direction: column; gap: 6px; }
.proj-row .h { display: flex; justify-content: space-between; gap: 12px; }
.proj-row .h span:first-child { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-row .h span:last-child { font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.proj-row .h .spaet { color: var(--bad); font-weight: 600; }
.bar { height: 6px; background: var(--track); border-radius: 3px; }
.bar > div { height: 6px; background: var(--accent); border-radius: 3px; }

/* ---------- Tickets ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 8px; }
.kpi span { font-size: 13px; font-weight: 600; }
.kpi b { font-family: var(--mono); font-size: 38px; font-weight: 600; line-height: 1.2; }
.kpi-neu { background: var(--warn-soft); color: var(--warn); }
.kpi-offen { background: var(--line-3); color: var(--ink); } .kpi-offen span { color: var(--ink-2); }
.kpi-done { background: var(--accent-soft); color: var(--accent-ink); }
.tickets-recent { display: flex; flex-direction: column; border-top: 1px solid var(--line-2); min-height: 0; }
.tickets-recent .eyebrow { padding: 10px 0 4px; }
.tk { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line-3); }
.tk:last-child { border-bottom: 0; }
.tk .id { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.tk .n { font-size: 14px; flex-grow: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk .p { font-size: 12px; font-weight: 600; color: var(--muted); }
.tk .p.hoch { color: var(--bad); } .tk .p.mittel { color: var(--warn); }
.tk:hover .n { text-decoration: underline; }

/* ---------- ToDo ---------- */
.todo { display: flex; flex-direction: column; border-top: 1px solid var(--line-2); }
.todo-item { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 6px 0; border-bottom: 1px solid var(--line-3); width: 100%; }
.todo-item.busy { opacity: .6; pointer-events: none; }
.todo-item .box { display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; flex-shrink: 0; border-radius: 4px; border: 1.5px solid var(--st-offen); background: var(--field); cursor: pointer; }
.todo-item .l { display: flex; flex-direction: column; gap: 3px; background: transparent; border: 0; padding: 0; text-align: left; cursor: pointer; flex: 1; min-width: 0; font-size: 14px; }
.todo-item .wer { display: flex; flex-wrap: wrap; gap: 4px; }
.todo-item .wer-n { font-size: 11px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); padding: 1px 7px; border-radius: 9px; text-decoration: none; }
.todo-item[aria-pressed="true"] .wer-n { color: var(--muted-2); background: var(--line-3); }
.todo-item .l:hover .t { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.todo-item .box:focus-visible, .todo-item .l:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.todo-item[aria-pressed="true"] .box { border-color: var(--accent); background: var(--accent); }
.todo-item .l { font-size: 14px; }
.todo-item[aria-pressed="true"] .l .t { text-decoration: line-through; color: var(--muted-2); }
.todo-item .ue { font-family: var(--mono); font-size: 11px; color: var(--bad); margin-left: auto; }
.todo-item .f { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.todo-item:disabled { cursor: wait; opacity: .6; }
.todo-add input { width: 100%; border: 1px dashed var(--line); border-radius: 6px; padding: 7px 10px; font: inherit; font-size: 14px; background: var(--soft); }
.todo-add input:focus { outline: none; border-style: solid; border-color: var(--accent); background: var(--field); }

/* ---------- Monitor ---------- */
.mon-sum span:nth-child(1) { color: var(--good); } .mon-sum span:nth-child(2) { color: var(--warn); } .mon-sum span:nth-child(3) { color: var(--bad); }
.mon { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.srv { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 8px; }
.srv .h { display: flex; justify-content: space-between; align-items: center; }
.srv .h b { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.srv .pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.srv .r { font-size: 12px; color: var(--muted); }
.srv .w { display: flex; flex-direction: column; gap: 4px; font-family: var(--mono); font-size: 12px; }
.srv .w .hi { font-weight: 600; }
.srv.ok .pill { color: var(--good); background: var(--good-soft); }
.srv.warnung .pill { color: var(--warn); background: var(--warn-soft); } .srv.warnung .hi { color: var(--warn); }
.srv.stoerung { border-color: var(--bad-line); background: var(--bad-bg); }
.srv.stoerung .pill { color: var(--bad); background: var(--bad-soft); } .srv.stoerung .hi { color: var(--bad); }
.srv.unbekannt .pill, .srv.veraltet .pill { color: var(--muted); background: var(--line-3); }
.srv.veraltet { opacity: .7; }

/* ---------- Buttons / Dialoge ---------- */
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--line-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn:disabled { opacity: .6; cursor: wait; }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow-l); background: var(--card); color: var(--ink); }
dialog::backdrop { background: var(--backdrop); }
.dlg { display: flex; flex-direction: column; gap: 12px; padding: 22px; }
.dlg h3 { margin: 0 0 4px; font-size: 18px; }
.dlg label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); flex: 1; }
.dlg label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); font-weight: 500; }
.dlg textarea { font: inherit; font-size: 14px; color: var(--ink); padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); resize: vertical; min-height: 60px; }
.dlg textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.dlg input:not([type=checkbox]):not([type=radio]), .dlg select { font: inherit; font-size: 14px; color: var(--ink); padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); min-width: 0; }
.dlg input:focus, .dlg select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.dlg .row { display: flex; gap: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.dlg-err { color: var(--bad); font-size: 13px; margin: 0; }
.seg { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.seg legend { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; padding: 0; }
.seg label { flex: 0 0 auto; flex-direction: row; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; }
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--card); font-size: 14px; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--bad); }

/* ---------- Kalender ---------- */
.kal { display: flex; flex-direction: column; gap: 14px; }
.kal-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.kal-nav { display: flex; align-items: center; gap: 6px; }
.kal-nav h2 { margin: 0 0 0 10px; font-size: 20px; font-weight: 600; min-width: 190px; }
.kal-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.kal-filter label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 4px 10px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); cursor: pointer; user-select: none; }
.kal-filter input { accent-color: var(--accent); margin: 0; }
.kal-filter i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.kal-fehler { font-size: 13px; color: var(--bad); }
.kal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.kal-grid { padding: 0; gap: 0; overflow: hidden; }
.kal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line-2); }
.kal-head div { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 10px; text-transform: uppercase; letter-spacing: .06em; }
.week { position: relative; min-height: 118px; border-bottom: 1px solid var(--line-2); }
.week:last-child { border-bottom: 0; }
.week-bg { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.week-bg button { border: 0; border-right: 1px solid var(--line-3); background: transparent; cursor: pointer; padding: 0; }
.week-bg button:last-child { border-right: 0; }
.week-bg button:hover { background: var(--soft); }
.week-bg button.fremd { background: var(--cal-fremd); }
.week-bg button.wochenende { background: var(--cal-we); }
.week-bg button.gewaehlt { background: var(--accent-soft); }
.week-fg { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 22px; row-gap: 3px; padding: 6px 0 10px; pointer-events: none; }
.dnum { font-family: var(--mono); font-size: 13px; font-weight: 600; padding: 0 10px; align-self: center; }
.dnum.fremd { color: var(--muted-3); }
.dnum.heute span { background: var(--accent); color: var(--on-accent); border-radius: 10px; padding: 1px 7px; }
.ev { pointer-events: auto; margin: 0 4px; font-size: 12px; line-height: 20px; height: 22px; padding: 0 7px; border-radius: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; border: 1px solid transparent; }
.ev b { font-family: var(--mono); font-weight: 600; margin-right: 4px; }
.ev.span { color: var(--on-accent); }
.ev.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.ev.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.ev.done { text-decoration: line-through; opacity: .6; }
.ev.more { color: var(--muted); font-weight: 600; background: transparent; }
.ev.more:hover { color: var(--ink); }

.kal-side { position: sticky; top: 20px; max-height: calc(100vh - 40px); }
.side-item { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-3); }
.side-item .dot { width: 4px; border-radius: 2px; flex-shrink: 0; }
.side-item .n { font-size: 14px; font-weight: 500; }
.side-item .i { font-size: 12px; color: var(--muted); margin-top: 2px; }
.side-item .typ { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.side-plan { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.side-plan span { color: var(--muted); }

/* ---------- TV-Modus (?tv=1): keine Bearbeitungselemente ---------- */
body.tv .edit, body.gast .edit { display: none !important; }
body.tv .konto { display: none; }

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 1180px) {
  .grid { grid-template-rows: none; }
  .c3, .c4, .c5 { grid-column: span 6; }
  .grid .card { max-height: 420px; }
  .c12 { max-height: none; }
  .kal-wrap { grid-template-columns: 1fr; }
  .kal-side { position: static; max-height: none; }
}
@media (max-width: 720px) {
  .page { padding: 16px; }
  .c3, .c4, .c5, .c12 { grid-column: span 12; }
  .top { flex-direction: column; align-items: flex-start; }
  .kal-filter { margin-left: 0; }
  .ev { font-size: 11px; padding: 0 3px; }
  .ev b { display: none; }
}
body.tv .page { max-width: none; }
@media (max-width: 720px) {
  .kal-nav h2 { min-width: 0; font-size: 17px; }
  .kal-filter label { font-size: 12px; padding: 3px 8px; }
  .anw-col-h span:first-child { overflow-wrap: anywhere; }
  .kal-head div { padding: 8px 4px; font-size: 11px; }
  .dnum { padding: 0 4px; }
  .ev { margin: 0 2px; }
}
@media (max-width: 720px) {
  .card-h { flex-wrap: wrap; }
  .card-h h2 { white-space: normal; }
}

/* ---------- Anmeldung / Konto ---------- */
.konto { position: relative; align-self: center; }
.btn-klein { padding: 4px 10px; font-size: 12px; }
.konto-menu summary { list-style: none; }
.konto-menu summary::-webkit-details-marker { display: none; }
.konto-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 190px; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-m); padding: 4px; }
.konto-item { display: block; text-align: left; background: transparent; border: 0; border-radius: 5px; padding: 8px 10px; font-size: 13px; cursor: pointer; }
.konto-item:hover { background: var(--line-3); }

/* ---------- Aufgaben-Fenster ---------- */
dialog.dlg-breit { width: min(620px, calc(100vw - 32px)); }
.af-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.af-kopf h3 { margin: 0; overflow-wrap: anywhere; }
.pill { flex-shrink: 0; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; color: var(--muted); background: var(--line-3); }
.pill.ok { color: var(--good); background: var(--good-soft); }
.af-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; padding: 12px 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.af { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.af span { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.af b { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.af-block { display: flex; flex-direction: column; gap: 6px; }
.af-text { margin: 0; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow-y: auto; }
.af-check { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.af-check li.done { color: var(--muted-2); text-decoration: line-through; }
.af-link { font-size: 14px; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.af-actions { flex-wrap: wrap; align-items: center; }
.af-actions .spacer { flex: 1; }
@media (max-width: 560px) { .af-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .af-actions .spacer { display: none; } }

/* ---------- Neue Aufgabe ---------- */
#dlg-todo { max-height: calc(100vh - 32px); }
.nt-block { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.nt-h { font-size: 12px; font-weight: 600; color: var(--muted); }
.nt-h small { font-weight: 400; margin-left: 6px; }
.nt-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.nt-liste:empty { display: none; }
.nt-liste li { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 4px 8px; background: var(--soft); border: 1px solid var(--line-3); border-radius: 6px; min-width: 0; }
.nt-liste li span { overflow-wrap: anywhere; }
.nt-liste li small { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.nt-liste li .x { margin-left: auto; border: 0; background: transparent; font-size: 16px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.nt-liste li .x:hover { color: var(--bad); }
.nt-add { display: flex; gap: 8px; }
.nt-add input { flex: 1; min-width: 0; }
.nt-datei { align-self: flex-start; display: inline-block !important; font-size: 12px !important; color: var(--ink) !important; }
@media (max-width: 560px) { .nt-add { flex-wrap: wrap; } .nt-add input { flex-basis: 100%; } }

/* ---------- ToDo-Status ---------- */
.todo-item { border-left: 3px solid var(--st-offen); padding-left: 10px; }
.todo-item.st-arbeit { border-left-color: var(--st-arbeit); background: linear-gradient(90deg, var(--st-arbeit-soft), transparent 70%); }
.todo-item.st-erledigt { border-left-color: var(--st-erledigt); background: linear-gradient(90deg, var(--good-soft), transparent 70%); }
.todo-item.st-arbeit .box { border-color: var(--st-arbeit); background: linear-gradient(90deg, var(--st-arbeit) 50%, var(--field) 50%); }
.todo-item.st-erledigt .box { border-color: var(--st-erledigt); background: var(--st-erledigt); }
.todo-legende { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 8px 0 2px; font-size: 11px; color: var(--muted); }
.todo-legende span { display: inline-flex; align-items: center; gap: 5px; }
.todo-legende span::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--st-offen); }
.todo-legende .st-arbeit::before { background: var(--st-arbeit); }
.todo-legende .st-erledigt::before { background: var(--st-erledigt); }

/* ---------- ToDo: ganze Zeile klickbar, Status im Fenster ---------- */
button.todo-item { font: inherit; color: inherit; text-align: left; background-color: transparent; border-top: 0; border-right: 0; cursor: pointer; }
button.todo-item:hover .t { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
button.todo-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
body.tv button.todo-item { cursor: default; }
body.tv button.todo-item:hover .t { color: inherit; text-decoration: none; }
.todo-item.st-erledigt .l .t { text-decoration: line-through; color: var(--muted-2); }
.todo-item.st-erledigt .wer-n { color: var(--muted-2); background: var(--line-3); }

.af-status { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.af-st { flex: 1; font: inherit; font-size: 13px; font-weight: 600; padding: 8px 10px; border: 0; border-right: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; }
.af-st:last-child { border-right: 0; }
.af-st:hover:not([aria-pressed="true"]):not(:disabled) { background: var(--line-3); color: var(--ink); }
.af-st:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.af-st:disabled { cursor: wait; }
.af-st.st-offen[aria-pressed="true"] { background: var(--st-offen); color: var(--on-accent); }
.af-st.st-arbeit[aria-pressed="true"] { background: var(--st-arbeit); color: var(--on-accent); }
.af-st.st-erledigt[aria-pressed="true"] { background: var(--st-erledigt); color: var(--on-accent); }
body.gast .af-st:not([aria-pressed="true"]) { cursor: pointer; }

/* ================= Dunkles Design (pro Benutzer wählbar) ================= */
:root[data-theme="dunkel"] {
  color-scheme: dark;
  --bg: #0D1117;
  --card: #161B22;
  --field: #0D1117;
  --soft: #1C2128;
  --tabs-bg: #0D1117;
  --top-line: #2D333B;
  --line: #30363D;
  --line-2: #262C34;
  --line-3: #1F252D;
  --line-hover: #4A5361;
  --ink: #E6EDF3;
  --ink-2: #C9D1D9;
  --muted: #8B949E;
  --muted-2: #7D8590;
  --muted-3: #545D68;
  --accent: #4FD1C5;
  --accent-ink: #7EE3DA;
  --accent-soft: rgba(79, 209, 197, .14);
  --on-accent: #0D1117;
  --warn: #E3B341;
  --warn-soft: rgba(227, 179, 65, .15);
  --demo-bg: rgba(227, 179, 65, .15);
  --bad: #F47067;
  --bad-soft: rgba(244, 112, 103, .16);
  --bad-bg: rgba(244, 112, 103, .08);
  --bad-line: rgba(244, 112, 103, .35);
  --good: #5CC98A;
  --good-soft: rgba(92, 201, 138, .15);
  --track: #262C34;
  --cal-fremd: #12171D;
  --cal-we: #141920;
  --backdrop: rgba(1, 4, 9, .65);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-m: 0 10px 30px rgba(0, 0, 0, .5);
  --shadow-l: 0 20px 50px rgba(0, 0, 0, .6);
  --st-offen: #A0A8B3;
  --st-arbeit: #8B9CF7;
  --st-arbeit-soft: rgba(139, 156, 247, .14);
  --st-erledigt: #5CC98A;
  --k-termin: #4FD1C5;
  --k-projekt: #7C9CF5;
  --k-aufgabe: #E3A35B;
  --k-planung: #8B949E;
  --k-abwesenheit: #E07BB0;
}
/* Überschriften und Labels wie in der Projektübersicht: Mono, Akzentfarbe */
:root[data-theme="dunkel"] .top h1 { font-family: var(--mono); letter-spacing: -.01em; }
:root[data-theme="dunkel"] .card-h h2,
:root[data-theme="dunkel"] .eyebrow,
:root[data-theme="dunkel"] .af span,
:root[data-theme="dunkel"] .adm-tabelle th { font-family: var(--mono); color: var(--accent); letter-spacing: .08em; }
:root[data-theme="dunkel"] .card { border-color: var(--line); }
:root[data-theme="dunkel"] .af-st.st-offen[aria-pressed="true"],
:root[data-theme="dunkel"] .af-st.st-arbeit[aria-pressed="true"],
:root[data-theme="dunkel"] .af-st.st-erledigt[aria-pressed="true"] { color: #0D1117; }
:root[data-theme="dunkel"] .chip .k { color: #fff; }

/* Umschalter Hell / Dunkel */
.theme-btn { width: 30px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.theme-btn svg { width: 15px; height: 15px; }
body.tv .theme-btn { display: none; }
:root[data-theme="dunkel"] .card-h h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; }

/* ---------- Aufgabe bearbeiten ---------- */
#dlg-bearbeiten { max-height: calc(100vh - 32px); }
.bb-titel { font: inherit !important; font-size: 20px !important; font-weight: 700; border-color: transparent !important; padding: 4px 6px !important; margin: 0 -6px; background: transparent !important; }
.bb-titel:hover, .bb-titel:focus { border-color: var(--line) !important; background: var(--field) !important; }
.bb-info { margin: -6px 0 4px; font-size: 12px; }
.bb-check { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bb-check li { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; }
.bb-check li:hover { background: var(--soft); }
.bb-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); flex: 0 0 auto; }
.bb-check .bb-cl-text { flex: 1; min-width: 0; border-color: transparent !important; background: transparent !important; padding: 4px 6px !important; }
.bb-check .bb-cl-text:focus { border-color: var(--line) !important; background: var(--field) !important; }
.bb-check li.done .bb-cl-text { text-decoration: line-through; color: var(--muted-2); }
.bb-check .x { border: 0; background: transparent; font-size: 16px; color: var(--muted); cursor: pointer; padding: 0 4px; }
.bb-check .x:hover { color: var(--bad); }

/* ---------- Freigabe ---------- */
.fg-liste { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.fg-zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 8px; border: 1px solid var(--line-3); border-radius: 6px; background: var(--soft); font-size: 14px; }
.fg-zeile small { color: var(--muted); margin-left: 6px; }
.fg-zeile select { font: inherit; font-size: 13px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--ink); }

/* ---------- Umschalter MIT / FirstMKIT in Kacheln ---------- */
.umschalter { display: inline-flex; gap: 2px; padding: 2px; background: var(--tabs-bg); border-radius: 7px; margin-right: 8px; vertical-align: middle; }
.umschalter:empty { display: none; }
.umschalter button { font: inherit; font-family: var(--mono); font-size: 11px; font-weight: 600; padding: 3px 9px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; line-height: 1.4; }
.umschalter button:hover { color: var(--ink); }
.umschalter button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-s); }
/* Kundenfarbe als Punkt – gut lesbar in hell und dunkel */
.umschalter button[style]::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--u); margin-right: 5px; vertical-align: 1px; }
.umschalter button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
body.tv .umschalter button:not([aria-pressed="true"]) { display: none; }

/* ---------- fehlende Berechtigungen: Knöpfe ausblenden ---------- */
body.ohne-planung #btn-daily, body.ohne-planung #daily-body [data-del] { display: none !important; }
body.ohne-aufgaben #todo-form { display: none !important; }
body.ohne-termine #btn-termin, body.ohne-termine #kal-neu, body.ohne-termine #side-neu { display: none !important; }
.term-edit { cursor: pointer; border-radius: 6px; }
.term-edit:hover, .term-edit:focus-visible { background: var(--soft); outline: none; }
#dlg-termin .dlg-actions .spacer { flex: 1; }
.termin-info { font-size: 12.5px; margin: 0; }
.side-edit { margin-top: 6px; }
.anw-nav { display: inline-flex; align-items: center; gap: 2px; margin-left: 10px; }
.anw-btn, .anw-tag { border: 1px solid var(--line-2); background: var(--card); color: inherit; font: inherit; font-size: 12px; line-height: 1; padding: 3px 7px; border-radius: 6px; cursor: pointer; }
.anw-tag { min-width: 58px; }
.anw-tag.nicht-heute { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.anw-btn:hover, .anw-tag:hover { border-color: var(--accent); }
body.tv .anw-btn { display: none; }
body.tv .anw-tag { border: 0; background: none; pointer-events: none; }
.kw-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-size: 12px; white-space: nowrap; }
/* Termin-Dialog: Serie, Teilnehmer */
.chips-wahl { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip-w { position: relative; cursor: pointer; }
.chip-w input { position: absolute; opacity: 0; pointer-events: none; }
.chip-w span { display: inline-block; padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 12.5px; background: var(--card); }
.chip-w input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-w input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.termin-umfang { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); }
.termin-umfang .nt-h { width: 100%; color: var(--accent-ink); }
.termin-serie, .termin-teilnehmer { display: flex; flex-direction: column; gap: 6px; }
.serie-icon { color: var(--accent); font-weight: 700; margin-left: 2px; }
.daily-zeiten { align-items: flex-end; }
.daily-dauer { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--accent); padding-bottom: 10px; white-space: nowrap; }
.daily-schnell { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.daily-schnell .nt-h { margin-right: 4px; }
#dlg-daily .dlg-actions .spacer { flex: 1; }
/* Bereich, in dem die Person an dem Tag schon eingeplant ist */
#seg-bereich span.schon { border-style: dashed; }
#seg-bereich span.schon::after { content: ' ✓'; font-size: 12px; opacity: .7; }
/* Planung: kompakte Kacheln (Name, Kunde, Uhrzeit, Restzeit, Fortschritt) – mehrere nebeneinander, ohne Scrollen */
#daily-body .chips { display: flex; flex-wrap: wrap; gap: 5px; }
.plan-chip { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 1px; min-width: 0; max-width: 100%; padding: 4px 9px 5px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--soft); font-size: 13px; }
.plan-z1 { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.plan-name { font-weight: 600; font-size: 13px; }
.plan-z1 .k { font-family: var(--mono); font-size: 10px; font-weight: 600; color: #fff; padding: 0 5px; border-radius: 4px; }
.plan-z1 .x { position: absolute; top: 1px; right: 2px; display: none; border: 0; background: var(--soft); color: var(--muted-2); cursor: pointer; padding: 0 3px; font-size: 14px; line-height: 1; border-radius: 4px; }
.plan-chip.laeuft .x { background: var(--accent-soft); }
.plan-chip:hover .x, .plan-chip:focus-within .x { display: inline; }
.plan-z1 .x:hover { color: var(--bad); }
.plan-zeit { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.plan-rest { font-size: 11px; color: var(--muted); white-space: nowrap; }
.plan-thema { font-size: 11px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* passt es nicht, stufenweise verdichten (app.js → dailyEinpassen): eng kleinere Abstände · enger ohne Thema · engst ohne Restzeit · minimal ohne Kunde */
#daily-body.eng .daily-grp { padding: 4px 0; gap: 3px; }
#daily-body.eng .daily-grp-h { font-size: 11px; }
#daily-body.eng .chips { gap: 3px; }
#daily-body.eng .plan-chip { padding: 2px 7px 3px; }
#daily-body.enger .plan-thema { display: none; }
#daily-body.engst .plan-rest { display: none; }
#daily-body.minimal .plan-z1 .k { display: none; }
.plan-fortschritt { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); }
.plan-chip.laeuft { border-color: var(--accent); background: var(--accent-soft); }
.plan-chip.laeuft .plan-rest { color: var(--accent-ink); font-weight: 700; }
.plan-chip.laeuft .plan-zeit { color: var(--accent-ink); }
.plan-chip.vorbei { opacity: .55; }
.plan-edit { cursor: pointer; }
.plan-edit:hover { border-color: var(--accent); }

/* Anwesenheit: Spaltenköpfe in den Dienstplan-Farben */
.anw-col-h span:first-child { padding: 2px 8px; border-radius: 6px; }
.anw-col-h.anw-buero span:first-child { background: var(--good-soft); color: var(--good); }
.anw-col-h.anw-ho span:first-child { background: var(--st-arbeit-soft); color: var(--st-arbeit); }
.anw-col-h.anw-vorort span:first-child { background: var(--warn-soft); color: var(--warn); }

/* Pausen */
.pause-knopf { display: inline-flex; gap: 2px; }
.pause-btn.laeuft { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); font-weight: 600; }
.pause-uhr { font-family: var(--mono); }
.pause-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 11.5px; font-weight: 600; white-space: nowrap; animation: pause-puls 2s ease-in-out infinite; }
.anw-col .p .pause-badge { margin-left: 4px; }
.pause-geplant { display: block; font-size: 11.5px; color: var(--muted); }
@keyframes pause-puls { 50% { opacity: .65; } }
@media (prefers-reduced-motion: reduce) { .pause-badge { animation: none; } }
.pause-schnell { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pause-hinweis, .pause-aktuell { font-size: 12.5px; margin: 0; }
#dlg-pause .dlg-actions .spacer { flex: 1; }
.anw-col { overflow-x: hidden; min-width: 0; }
.anw-col-h { gap: 6px; }
.anw-col-h span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
/* Pausen-Übersicht: Zeile unter der Anwesenheit */
.anw-pausen { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 8px; margin-top: 6px; border-top: 1px dashed var(--line-2); font-size: 12.5px; }
.anw-pausen .ap-h { font-weight: 600; color: var(--warn); margin-right: 2px; }
.anw-pausen .ap { padding: 1px 8px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line-2); white-space: nowrap; }
.anw-pausen .ap b { font-family: var(--mono); font-weight: 600; }
.anw-pausen .ap.laeuft { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); font-weight: 600; }
.anw-pausen .ap.vorbei { opacity: .5; }
/* Pausen-Übersicht im Dialog (Zeitleiste) */
.pause-uebersicht { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 8px; background: var(--soft); }
.pu-h { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.pu-leer { margin: 0; font-size: 12.5px; }
.pu-achse { position: relative; height: 14px; margin: 0 92px 0 64px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.pu-achse span { position: absolute; transform: translateX(-50%); }
.pu-zeile { display: grid; grid-template-columns: 56px 1fr 84px; align-items: center; gap: 8px; font-size: 12.5px; }
.pu-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pu-spur { position: relative; height: 12px; border-radius: 6px; background: var(--card); border: 1px solid var(--line-2); }
.pu-spur i { position: absolute; top: 1px; bottom: 1px; border-radius: 5px; background: var(--muted-3); }
.pu-zeile.gleich .pu-spur i { background: var(--warn); }
.pu-zeile.ich .pu-spur i { background: var(--accent); }
.pu-zeile.ich .pu-name { color: var(--accent); }
.pu-zeit { font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.pu-zeit small { font-family: var(--sans); color: var(--muted); }
.pu-hinweis { margin: 4px 0 0; font-size: 12.5px; font-weight: 600; }
.pu-hinweis.warn { color: var(--warn); }
.pu-hinweis.ok { color: var(--good); }
/* Geteilter Zugang (Citrix) am Server */
.srv-zugang { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-2); }
.srv-zugang .zg-nutzen { border-color: var(--good); color: var(--good); font-weight: 600; }
.srv-zugang .zg-nutzen:hover { background: var(--good-soft); }
.zg-frei { font-size: 12.5px; font-weight: 600; color: var(--good); }
.zg-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.zg-wer { font-weight: 700; font-size: 13px; color: var(--bad); }
.zg-rest { font-size: 12px; color: var(--muted); }
.zg-uhr { font-family: var(--mono); font-size: 13px; color: var(--bad); }
.zg-notiz { font-size: 12px; color: var(--muted); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zg-akt { display: flex; gap: 4px; }
.srv.belegt { box-shadow: inset 3px 0 0 var(--bad); }
.zugang-min { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.zugang-hinweis { font-size: 12.5px; margin: 0; }
.mon { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
/* Kopfzeile: alle Knöpfe gleich hoch und mittig ausgerichtet */
.top-right { align-items: center; }
.top-right .theme-btn, .top-right .pause-knopf .btn, .top-right .konto-menu > summary.btn, .top-right #btn-login {
  box-sizing: border-box; height: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding-top: 0; padding-bottom: 0; line-height: 1;
}
.top-right .theme-btn, .top-right .pause-plan-btn { width: 30px; padding: 0; }
.top-right .pause-knopf { align-items: center; gap: 4px; }
.top-right .konto { display: inline-flex; align-items: center; }
.top-right .konto-menu > summary.btn { padding-left: 12px; padding-right: 12px; }
/* Feiertage im Kalender */
.week-bg button.feiertag-hier { background: color-mix(in srgb, #B45309 9%, transparent); }
.ev.ft-anders { opacity: .55; }
.top-right .konto-menu { display: inline-flex; position: relative; vertical-align: middle; }
/* Kalender: klickbare Einträge */
.ev.klickbar { cursor: pointer; }
.ev.klickbar:hover { filter: brightness(1.08); box-shadow: 0 0 0 1px currentColor inset; }
.side-link { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--accent-ink, var(--accent)); cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: transparent; }
.side-link:hover { text-decoration-color: currentColor; }
.side-planner { font-size: 11.5px; font-weight: 500; color: var(--muted); margin-left: 4px; white-space: nowrap; }
/* Meine Anmeldungen */
.sz-hinweis { font-size: 12.5px; margin: 0; }
.sz-liste { display: flex; flex-direction: column; gap: 6px; }
.sz-zeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 8px; }
.sz-zeile.aktuell { border-color: var(--accent); background: var(--accent-soft); }
.sz-zeile small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.sz-dies { font-size: 11px; font-weight: 600; color: var(--accent-ink); }
#dlg-sitzungen .dlg-actions .spacer { flex: 1; }

/* ---------- TV-Modus (Lobby): bildschirmfüllend, ohne Scrollen, skaliert per JS (Grundmaß 1600×900) ---------- */
.tv-btn { font-size: 15px; }
html:has(body.tv) { overflow: hidden; }
body.tv { overflow: hidden; min-height: 0 !important; height: auto; }
body.tv .page { max-width: none; padding: 18px 24px 20px; gap: 14px; box-sizing: border-box; overflow: hidden; }
body.tv .top { padding-bottom: 10px; align-items: center; }
body.tv .tabs, body.tv .tv-btn, body.tv .pause-knopf { display: none !important; }
body.tv .top h1 { font-size: 34px; }
body.tv .top-right #datum { font-size: 16px; }
body.tv #view-uebersicht { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1.05fr) minmax(0, 1fr) auto !important; gap: 14px; }
body.tv .c3 { grid-column: span 3 !important; } body.tv .c4 { grid-column: span 4 !important; }
body.tv .c5 { grid-column: span 5 !important; } body.tv .c12 { grid-column: span 12 !important; }
body.tv .grid .card { max-height: none; }
body.tv .card { padding: 16px 18px; gap: 10px; overflow: hidden; }
body.tv .card-h h2 { font-size: 19px; }
/* Listen nicht scrollen, sondern unten weich ausblenden */
body.tv .scroll, body.tv .anw-cols, body.tv .anw-col, body.tv .proj, body.tv .tickets-recent, body.tv .mon {
  overflow: hidden !important; scrollbar-width: none;
}
body.tv .scroll, body.tv .anw-col, body.tv .tickets-recent, body.tv .proj {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
}
body.tv .tickets-recent { min-height: 0; flex: 1; }
body.tv #card-tickets { display: flex; flex-direction: column; }
body.tv #card-monitor { padding: 12px 18px; gap: 8px; }
body.tv .mon { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
body.tv .todo-legende { display: none; }
body.tv .notiz-fab, body.tv .notiz-pop { display: none !important; }
body.tv.maus-weg, body.tv.maus-weg * { cursor: none !important; }
/* Wechsel MIT ↔ FirstMKIT: Fortschrittsbalken und sanftes Überblenden */
.tv-rot { height: 3px; margin-top: -6px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.tv-rot i { display: block; height: 100%; width: 0; background: var(--accent); }
body.tv #card-tickets .kpis, body.tv #card-tickets .tickets-recent { transition: opacity .25s; }
body.tv #card-tickets.tv-wechsel .kpis, body.tv #card-tickets.tv-wechsel .tickets-recent { opacity: .25; }
body.tv #tickets-schalter button[aria-pressed="true"] { font-size: 14px; padding: 3px 12px; }
/* Beenden-Knopf (erscheint bei Mausbewegung) */
.tv-exit { position: fixed; top: 14px; right: 14px; z-index: 50; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: inherit; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-m, 0 6px 18px rgba(0,0,0,.18)); }
.tv-exit:hover { border-color: var(--bad); color: var(--bad); }
/* TV-Knopf: eigenes Symbol, gleiche Größe wie der Design-Knopf */
.top-right .icon-btn { box-sizing: border-box; width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 16px; height: 16px; }
/* TV: Ausblenden unten nur, wenn wirklich mehr Inhalt da ist, als hineinpasst (Klasse tv-mehr setzt das Skript) */
body.tv .scroll, body.tv .anw-col, body.tv .tickets-recent, body.tv .proj { -webkit-mask-image: none; mask-image: none; }
body.tv .tv-mehr { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent) !important; mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent) !important; }
/* TV: Ticket-Kennzahlen kompakter, damit mehr Tickets Platz haben */
body.tv .kpis { gap: 8px; }
body.tv .kpi { flex-direction: row; align-items: baseline; justify-content: space-between; padding: 8px 12px; }
body.tv .kpi b { font-size: 30px; line-height: 1.1; }
body.tv .tickets-recent .eyebrow { padding: 8px 0 2px; }
body.tv .tk { padding: 5px 0; }
/* TV: Server-Monitor als kompakte Leiste (höchstens ~210 px), damit die Kacheln darüber mehr Platz haben */
body.tv #view-uebersicht { grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) fit-content(210px) !important; }
body.tv #card-monitor { min-height: 0; }
body.tv .mon { min-height: 0; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
body.tv .srv { padding: 8px 12px; gap: 4px; }
body.tv .srv .h b { font-size: 14px; }
body.tv .srv .w { display: flex; flex-wrap: wrap; gap: 2px 10px; }
body.tv .srv-zugang { margin-top: 4px; padding-top: 6px; }

/* ---------- Server-Monitor: links Citrix-Zugänge in einem Kasten, rechts Laufband der übrigen Monitore ---------- */
.mon.mon-teil, body.tv .mon.mon-teil { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.mon.mon-teil.beide, body.tv .mon.mon-teil.beide { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.mon-teil-h { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mon-teil-h small { font-weight: 500; margin-left: 4px; color: var(--muted-2); }
.mon-fest, .mon-lauf { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--soft); }
.mon-fest-k { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.mon-fest .srv { background: var(--card); }
.mon-fest .srv.stoerung { background: var(--bad-bg); }
.lauf-fenster { overflow: hidden; flex: 1; display: flex; align-items: stretch; }
.mon-lauf.bewegt .lauf-fenster { -webkit-mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent); }
.lauf-spur { display: flex; width: max-content; }
.lauf-satz { display: flex; gap: 10px; padding-right: 10px; }
.lauf-satz[hidden] { display: none; }
.mon-lauf.bewegt:hover .lauf-spur, .mon-lauf.bewegt:focus-within .lauf-spur { animation-play-state: paused !important; }
@keyframes lauf { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.lauf-k { display: flex; flex-direction: column; gap: 4px; width: 210px; text-align: left; font: inherit; color: inherit; padding: 10px 12px; border: 1px solid var(--line-2); border-left: 4px solid var(--muted-3); border-radius: 8px; background: var(--card); cursor: pointer; }
.lauf-k:hover { border-color: var(--line-hover); }
.lauf-k.ok { border-left-color: var(--good); } .lauf-k.warnung { border-left-color: var(--warn); } .lauf-k.stoerung { border-left-color: var(--bad); background: var(--bad-bg); }
.lauf-k.veraltet { opacity: .7; }
.lauf-h { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.lauf-h b { font-family: var(--mono); font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lauf-k .pill { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; flex: 0 0 auto; }
.lauf-k.ok .pill { color: var(--good); background: var(--good-soft); } .lauf-k.warnung .pill { color: var(--warn); background: var(--warn-soft); }
.lauf-k.stoerung .pill { color: var(--bad); background: var(--bad-soft); } .lauf-k.unbekannt .pill, .lauf-k.veraltet .pill { color: var(--muted); background: var(--line-3); }
.lauf-r { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lauf-w { font-family: var(--mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lauf-k.warnung .hi { color: var(--warn); font-weight: 600; } .lauf-k.stoerung .hi { color: var(--bad); font-weight: 600; }
body.tv .mon-fest, body.tv .mon-lauf { padding: 8px 10px; gap: 6px; }
body.tv .lauf-k { cursor: default; padding: 8px 10px; }
@media (max-width: 900px) { .mon.mon-teil.beide { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .lauf-fenster { overflow-x: auto; } }

/* ---------- Ausfall-Hinweis in der Mitte ---------- */
#mon-alarm { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: var(--backdrop); }
#mon-alarm[hidden] { display: none; }
.ma-karte { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--card); border: 2px solid var(--bad); border-radius: 14px; box-shadow: var(--shadow-l); padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; animation: ma-puls 1.6s ease-in-out infinite; }
@keyframes ma-puls { 0%, 100% { box-shadow: var(--shadow-l), 0 0 0 0 var(--bad-line); } 50% { box-shadow: var(--shadow-l), 0 0 0 10px transparent; } }
@media (prefers-reduced-motion: reduce) { .ma-karte { animation: none; } }
.ma-kopf { display: flex; gap: 14px; align-items: center; }
.ma-kopf h2 { margin: 0; font-size: 22px; color: var(--bad); }
.ma-symbol { flex: 0 0 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--bad); color: #fff; font-size: 26px; font-weight: 700; }
.ma-sub { font-size: 13px; color: var(--muted); }
.ma-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ma-liste li { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--bad-line); background: var(--bad-bg); border-radius: 8px; }
.ma-liste li > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ma-liste b { font-family: var(--mono); font-size: 16px; }
.ma-ziel { font-family: var(--mono); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.ma-text { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.ma-seit { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-family: var(--mono); font-size: 12px; color: var(--bad); white-space: nowrap; }
.ma-hinweis { margin: 0; font-size: 13px; color: var(--warn); background: var(--warn-soft); padding: 8px 10px; border-radius: 8px; }
.ma-akt { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ma-akt .spacer { flex: 1; }
body.tv .ma-karte { width: min(760px, 100%); } body.tv .ma-kopf h2 { font-size: 30px; } body.tv .ma-liste b { font-size: 20px; }
#mon-alarm-chip { position: fixed; left: 16px; bottom: 16px; z-index: 55; font: inherit; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--bad-line); background: var(--bad); color: #fff; cursor: pointer; box-shadow: var(--shadow-m); }
#mon-alarm-chip[hidden] { display: none; }
body.tv #mon-alarm-chip { top: 12px; bottom: auto; left: 50%; transform: translateX(-50%); font-size: 15px; }
/* TV: Werte der Citrix-Kacheln nebeneinander statt untereinander, damit „Zugang frei“ nicht abgeschnitten wird */
body.tv .srv .w { flex-direction: row; flex-wrap: wrap; gap: 2px 12px; }
body.tv .mon-fest .srv { gap: 3px; padding: 8px 12px; }
body.tv .mon-fest .srv-zugang { margin-top: 2px; padding-top: 5px; }
body.tv .mon-teil-h { font-size: 10px; }
body.tv #view-uebersicht { grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) fit-content(240px) !important; }
/* Kopfzeile in zwei Zeilen: oben Titel links, Datum/Uhr/Knöpfe rechts – darunter die Reiter als durchgehende Leiste */
.top { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: 'titel rechts' 'reiter reiter'; align-items: center; column-gap: 24px; row-gap: 14px; }
.top-left { display: contents; }
.top h1 { grid-area: titel; }
.top .tabs { grid-area: reiter; justify-self: stretch; flex-wrap: wrap; align-self: auto; }
.tab { white-space: nowrap; }
.top-right { grid-area: rechts; justify-self: end; flex-wrap: wrap; justify-content: flex-end; gap: 10px 12px; }
@media (max-width: 720px) {
  .top { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'titel' 'rechts' 'reiter'; }
  .top-right { justify-self: start; justify-content: flex-start; }
}
body.tv .top { grid-template-areas: 'titel rechts'; row-gap: 0; }

/* Standort-Auswahl (Aufgaben, Wochenbericht) – standortwahl.js */
.so-feld { position: relative; display: flex; flex-direction: column; gap: 4px; }
.so-eingabe { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-height: 36px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: text; }
.so-feld:focus-within .so-eingabe { border-color: var(--accent); }
.so-suche { flex: 1; min-width: 180px; border: 0 !important; outline: none; background: transparent; font: inherit; font-size: 14px; color: var(--ink); padding: 3px 2px !important; box-shadow: none !important; }
.so-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.so-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; line-height: 1.3; padding: 2px 8px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink, var(--accent)); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.so-chip.so-mehr { background: var(--soft); color: var(--muted); }
.so-wahl button { border: 0; background: none; color: inherit; font-size: 15px; line-height: 1; padding: 0 0 0 2px; cursor: pointer; opacity: .7; }
.so-wahl button:hover { opacity: 1; color: var(--bad); }
.so-liste { max-height: 230px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--card); box-shadow: 0 8px 22px rgba(0, 0, 0, .18); padding: 4px 0; }
.so-gruppe { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 7px 12px 3px; }
.so-opt { display: flex; align-items: baseline; gap: 8px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.so-opt:hover, .so-opt.mark { background: var(--soft); }
.so-opt.an { color: var(--accent-ink, var(--accent)); }
.so-haken { width: 14px; flex: 0 0 14px; font-weight: 700; color: var(--accent); }
.so-kz { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.so-opt small { color: var(--muted); font-size: 12px; }
.so-opt .so-kat { margin-left: auto; }
.so-leer { padding: 10px 12px; font-size: 13px; color: var(--muted); }
.au-orte, .wb-orte, .au-d-orte { display: block; }
.au-d-orte { margin-top: 6px; }

/* Standorte in Planner-Fenstern (Projekte, Tägliche Aufgaben) und auf Karten */
.pl-so { display: flex; flex-direction: column; gap: 4px; }
.pl-so-h { font-size: 12px; font-weight: 600; color: var(--muted); }
.todo-item .so-chips { margin-top: 2px; }
.todo-item .so-chip { font-size: 11px; padding: 1px 6px; }
.todo-rt { color: var(--accent); font-weight: 700; }
.karte .k-orte { display: block; margin-top: 2px; }
.karte .so-chip { font-size: 11px; }
/* Aufgaben: Standort-Filter und Sortierung */
.au-so-filter { font: inherit; font-size: 13px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); max-width: 260px; }
.au-so-filter.aktiv { border-color: var(--accent); color: var(--accent-ink, var(--accent)); font-weight: 600; }

/* Routinen (Tägliche Aufgaben) */
.rt-dlg { width: min(720px, calc(100vw - 32px)); max-height: 88vh; padding: 0; border-radius: 14px; overflow: hidden; }
.rt-dlg[open] { display: flex; }
.rt-rahmen { display: flex; flex-direction: column; width: 100%; max-height: 88vh; min-height: 0; }
.rt-rahmen > .leer { padding: 36px; text-align: center; }
.rt-kopf { display: flex; justify-content: space-between; gap: 14px; padding: 18px 22px 12px; border-bottom: 1px solid var(--line-2); }
.rt-kopf h3 { margin: 0 0 4px; font-size: 19px; }
.rt-kopf p { margin: 0; font-size: 13px; }
.rt-liste, .rt-felder { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 22px; display: flex; flex-direction: column; gap: 10px; }
.rt-z { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); }
.rt-z.aus { opacity: .6; }
.rt-inhalt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rt-inhalt > b { font-size: 15px; }
.rt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.rt-rh { color: var(--accent-ink, var(--accent)); font-weight: 600; }
.rt-naechste { font-size: 12px; color: var(--muted); }
.rt-akt { display: flex; gap: 4px; }
.rt-an { position: relative; display: inline-block; width: 38px; height: 22px; flex: 0 0 38px; margin-top: 1px; cursor: pointer; }
.rt-an input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.rt-an i { position: absolute; inset: 0; border-radius: 11px; background: var(--line); transition: background .15s; }
.rt-an i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.rt-an input:checked + i { background: var(--accent); }
.rt-an input:checked + i::after { transform: translateX(16px); }
.rt-an input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.rt-leer { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 30px 12px; color: var(--muted); text-align: center; font-size: 14px; }
.rt-leer b { color: var(--ink); }
.rt-fuss { display: flex; align-items: center; gap: 10px; padding: 12px 22px 16px; border-top: 1px solid var(--line-2); font-size: 12.5px; }
.rt-fuss .spacer { flex: 1; }
.rt-f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.rt-f input[name=titel], .rt-f textarea { font: inherit; font-size: 15px; font-weight: 400; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.rt-rhythmen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.rt-rh-k { position: relative; cursor: pointer; }
.rt-rh-k input { position: absolute; opacity: 0; }
.rt-rh-k span { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-weight: 400; color: var(--ink); height: 100%; box-sizing: border-box; }
.rt-rh-k span b { font-size: 14px; }
.rt-rh-k span small { font-size: 11.5px; color: var(--muted); }
.rt-rh-k input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.rt-rh-k input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.rt-tage { display: flex; gap: 6px; flex-wrap: wrap; }
.rt-tag { position: relative; cursor: pointer; }
.rt-tag input { position: absolute; opacity: 0; }
.rt-tag span { display: inline-block; min-width: 38px; text-align: center; padding: 6px 0; border: 1px solid var(--line); border-radius: 6px; font-weight: 600; color: var(--ink); }
.rt-tag input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
.rt-monat { display: flex; align-items: center; gap: 6px; font-weight: 400; color: var(--ink); }
.rt-monat input { width: 64px; font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }
.rt-vorschau { margin: 0; font-weight: 400; font-size: 12.5px; }
.rt-pers { margin: 0; }
.rt-form .dlg-err { margin: 0 22px; }

.af .so-chip { text-transform: none; letter-spacing: normal; font-family: var(--sans); font-size: 12.5px; font-weight: 500; color: var(--accent-ink, var(--accent)); } /* Chips im Planner-Detail nicht wie die Feldbeschriftung */
