  :root{
    color-scheme: light;
    --bg:#F5F7F9; --panel:#FFFFFF; --panel-2:#FBFCFD; --line:#E3E8EC; --line-2:#EDF1F4;
    --ink:#13242C; --ink-2:#4A5A63; --ink-3:#7E8B92;
    --accent:#3B4FE0; --accent-ink:#2436B8; --accent-soft:#ECEEFD;
    --track:#F1F4F6; --shade:#E7ECEF;
    --bad:#DC2626; --bad-soft:#FBE7E7; --warn:#E28C06; --warn-soft:#FBEBD2; --good:#128A5B; --good-soft:#E1F3EA;
    --shadow:0 1px 2px rgba(16,32,40,.05), 0 8px 24px rgba(16,32,40,.06);
    --disp:"Bricolage Grotesque", system-ui, sans-serif;
    --body:"IBM Plex Sans", system-ui, sans-serif;
    --mono:"IBM Plex Mono", ui-monospace, monospace;
    --r:14px;
  }
  @media (prefers-color-scheme: dark){
    :root:not([data-theme="light"]){
      color-scheme: dark;
      --bg:#070B14; --panel:#0E1524; --panel-2:#0A101D; --line:#1B2640; --line-2:#141D31;
      --ink:#E8EEF8; --ink-2:#A3B2CB; --ink-3:#66758F;
      --accent:#7F98FF; --accent-ink:#B4C3FF; --accent-soft:#18224A;
      --track:#0A1120; --shade:#141D31;
      --bad:#F26D6D; --bad-soft:#3A1818; --warn:#F4B45A; --warn-soft:#3A2A12; --good:#54C98D; --good-soft:#12302220;
      --shadow:0 1px 2px rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.4);
    }
  }
  :root[data-theme="dark"]{
    color-scheme: dark;
    --bg:#070B14; --panel:#0E1524; --panel-2:#0A101D; --line:#1B2640; --line-2:#141D31;
    --ink:#E8EEF8; --ink-2:#A3B2CB; --ink-3:#66758F;
    --accent:#7F98FF; --accent-ink:#B4C3FF; --accent-soft:#18224A;
    --track:#0A1120; --shade:#141D31;
    --bad:#F26D6D; --bad-soft:#3A1818; --warn:#F4B45A; --warn-soft:#3A2A12; --good:#54C98D; --good-soft:#163026;
    --shadow:0 1px 2px rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.4);
  }

  *{ box-sizing:border-box; }
  body{ margin:0; background:var(--bg); color:var(--ink); font-family:var(--body); -webkit-font-smoothing:antialiased; }
  .wrap{ max-width:1240px; margin:0 auto; padding:22px 16px 72px; }

  header.top{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
  .brand{ display:flex; align-items:center; gap:11px; }
  .logo{ width:34px; height:34px; border-radius:9px; background:var(--accent-soft); display:grid; place-items:center; color:var(--accent); }
  h1{ font-family:var(--disp); font-weight:700; font-size:22px; letter-spacing:-.01em; margin:0; }
  .tagline{ font-family:var(--mono); font-size:10px; letter-spacing:.14em; text-transform:uppercase; color:var(--ink-3); background:var(--line-2); padding:3px 8px; border-radius:999px; }
  .spacer{ flex:1; }
  .today{ font-family:var(--mono); font-size:12px; color:var(--ink-2); }
  .today b{ color:var(--ink); }
  .tbtn{ border:1px solid var(--line); background:var(--panel); color:var(--ink-2); width:36px; height:36px; border-radius:10px; cursor:pointer; display:grid; place-items:center; }
  .tbtn:hover{ color:var(--ink); border-color:var(--ink-3); }

  .lead{ color:var(--ink-2); font-size:14px; line-height:1.6; max-width:820px; margin:16px 0 2px; }
  .lead b{ color:var(--ink); }

  .warnbar{ display:none; align-items:center; gap:10px; margin:14px 0 2px; padding:10px 14px; border-radius:12px; font-size:13.5px; border:1px solid color-mix(in srgb,var(--bad) 40%, var(--line)); background:var(--bad-soft); color:color-mix(in srgb,var(--bad) 82%, var(--ink)); }
  .warnbar.show{ display:flex; }
  .warnbar .dot{ width:9px;height:9px;border-radius:50%;background:var(--bad);flex:0 0 auto; }

  .legend{ display:flex; flex-wrap:wrap; gap:8px 15px; margin:14px 2px 6px; align-items:center; }
  .lg{ display:flex; align-items:center; gap:7px; font-size:12px; color:var(--ink-2); font-family:var(--mono); }
  .lg i{ width:11px; height:11px; border-radius:3px; display:inline-block; }
  .lg.sep{ color:var(--ink-3); }

  /* ===== Board ===== */
  .boardwrap{ margin-top:10px; border:1px solid var(--line); border-radius:var(--r); background:var(--panel); box-shadow:var(--shadow); overflow:hidden; }
  .scroller{ overflow-x:auto; }
  .grid{ --lab:196px; --cw:104px; display:grid; grid-template-columns:var(--lab) repeat(var(--n), var(--cw)); min-width:max-content; }
  .ghead{ position:sticky; top:0; z-index:6; background:var(--panel-2); border-bottom:1px solid var(--line); font-family:var(--mono); }
  .ghead .cnr{ position:sticky; left:0; z-index:7; background:var(--panel-2); border-right:1px solid var(--line); padding:10px 12px; font-size:10px; letter-spacing:.12em; text-transform:uppercase; color:var(--ink-3); display:flex; align-items:center; }
  .dh{ padding:9px 10px; border-left:1px solid var(--line-2); }
  .dh.mon{ border-left:1px solid var(--line); }
  .dh .dw{ font-size:10px; letter-spacing:.1em; text-transform:uppercase; color:var(--ink-3); }
  .dh .dd{ font-family:var(--disp); font-weight:600; font-size:14px; color:var(--ink); margin-top:1px; }
  .dh.is-today .dw,.dh.is-today .dd{ color:var(--accent); }
  .dh .kw{ font-size:9px; color:var(--ink-3); display:block; margin-top:1px; }

  .elabel{ position:sticky; left:0; z-index:4; background:var(--panel); border-right:1px solid var(--line); border-top:1px solid var(--line-2); padding:10px 12px; display:flex; flex-direction:column; gap:3px; justify-content:center; }
  .elabel .nm{ font-family:var(--disp); font-weight:600; font-size:14.5px; }
  .elabel .sub{ font-family:var(--mono); font-size:10px; color:var(--ink-3); }
  .util{ height:5px; border-radius:3px; background:var(--line-2); overflow:hidden; margin-top:3px; }
  .util > i{ display:block; height:100%; background:var(--good); }
  .util.mid > i{ background:var(--warn); }
  .util.over > i{ background:var(--bad); }
  .elabel .ut{ font-family:var(--mono); font-size:9.5px; color:var(--ink-3); }
  .elabel .ut b{ color:var(--ink-2); }
  .elabel .ut.over b{ color:var(--bad); }

  .cell{ position:relative; border-left:1px solid var(--line-2); border-top:1px solid var(--line-2); height:68px; background:var(--track); overflow:hidden; }
  .cell.mon{ border-left:1px solid var(--line); }
  .cell.is-today{ background:color-mix(in srgb,var(--accent) 5%, var(--track)); }
  .cell.dragover{ outline:2px dashed var(--accent); outline-offset:-3px; background:color-mix(in srgb,var(--accent) 10%, var(--track)); }
  .shade{ position:absolute; top:0; bottom:0; background:repeating-linear-gradient(45deg,var(--shade),var(--shade) 5px,transparent 5px,transparent 10px); z-index:1; pointer-events:none; }
  .capline{ position:absolute; top:0; bottom:0; width:0; border-left:1px dashed color-mix(in srgb,var(--ink-3) 55%, transparent); z-index:1; pointer-events:none; }
  .half{ position:absolute; top:0; bottom:0; left:50%; width:0; border-left:1px solid var(--line-2); z-index:1; pointer-events:none; }

  .seg{ position:absolute; top:6px; bottom:6px; border-radius:8px; z-index:3; padding:5px 7px; overflow:hidden; cursor:grab; color:#fff; box-shadow:0 1px 2px rgba(16,32,40,.18); min-width:0; }
  .seg:active{ cursor:grabbing; }
  .seg .st{ font-weight:600; font-size:11.5px; line-height:1.2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .seg .sm{ font-family:var(--mono); font-size:9.5px; opacity:.92; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:1px; }
  .seg.cont{ border-top-left-radius:2px; border-bottom-left-radius:2px; }
  .seg.contr{ border-top-right-radius:2px; border-bottom-right-radius:2px; }
  .seg.late{ box-shadow:0 0 0 2px var(--bad), 0 1px 2px rgba(16,32,40,.18); }
  .seg .bang{ position:absolute; top:3px; right:4px; width:14px; height:14px; border-radius:50%; background:#fff; color:var(--bad); font-size:10px; font-weight:700; display:grid; place-items:center; font-family:var(--mono); }
  .ot{ position:absolute; top:6px; bottom:6px; z-index:3; border-radius:6px; background:repeating-linear-gradient(45deg,var(--bad),var(--bad) 6px,#b91c1c 6px,#b91c1c 12px); box-shadow:0 1px 2px rgba(16,32,40,.2); }
  .otchip{ position:absolute; bottom:3px; right:4px; z-index:4; font-family:var(--mono); font-size:9px; font-weight:600; color:#fff; background:var(--bad); padding:1px 5px; border-radius:999px; }
  .ghostdrag{ position:fixed; z-index:99; pointer-events:none; border-radius:8px; padding:5px 9px; color:#fff; font:600 12px var(--body); box-shadow:0 8px 20px rgba(16,32,40,.3); opacity:.95; }

  /* ===== Panels ===== */
  .cols{ display:grid; grid-template-columns:1.3fr 1fr; gap:16px; margin-top:16px; }
  @media (max-width:860px){ .cols{ grid-template-columns:1fr; } }
  .card{ border:1px solid var(--line); border-radius:var(--r); background:var(--panel); box-shadow:var(--shadow); padding:16px 16px 18px; }
  .card h2{ font-family:var(--disp); font-weight:600; font-size:15px; margin:0 0 12px; display:flex; align-items:center; gap:8px; }
  .card h2 .c{ font-family:var(--mono); font-size:10px; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-3); font-weight:400; }

  .frow{ display:flex; flex-wrap:wrap; gap:10px; align-items:end; }
  .field{ display:flex; flex-direction:column; gap:5px; }
  .field.grow{ flex:1 1 180px; min-width:150px; }
  .field label{ font-family:var(--mono); font-size:10px; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-3); }
  .field input,.field select{ font-family:var(--body); font-size:13.5px; color:var(--ink); background:var(--panel-2); border:1px solid var(--line); border-radius:9px; padding:8px 10px; }
  .field input:focus,.field select:focus{ outline:none; border-color:var(--accent); }
  .field input[type=number]{ width:84px; }
  .chk{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--ink-2); margin-top:10px; }
  .chk input{ width:16px; height:16px; accent-color:var(--warn); }
  .hint{ font-size:11.5px; color:var(--ink-3); margin-top:8px; line-height:1.5; }
  .addbtn{ font-family:var(--body); font-weight:600; font-size:13.5px; color:#fff; background:var(--accent); border:0; border-radius:9px; padding:9px 16px; cursor:pointer; }
  .addbtn:hover{ background:var(--accent-ink); }

  /* Mitarbeiter-Einstellungen */
  .team{ display:flex; flex-direction:column; gap:10px; }
  .trow{ display:grid; grid-template-columns:1fr auto auto auto; gap:8px; align-items:center; padding:8px; border:1px solid var(--line-2); border-radius:10px; background:var(--panel-2); }
  .trow .tn{ font-family:var(--disp); font-weight:600; font-size:13.5px; }
  .trow .tf{ display:flex; flex-direction:column; gap:2px; }
  .trow .tf label{ font-family:var(--mono); font-size:8.5px; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-3); }
  .trow .tf input{ width:78px; font-family:var(--body); font-size:12.5px; color:var(--ink); background:var(--panel); border:1px solid var(--line); border-radius:7px; padding:5px 7px; }
  .trow .tf input[type=number]{ width:58px; }

  /* Zeitanalyse */
  .an{ display:flex; flex-direction:column; gap:7px; }
  .anrow{ display:grid; grid-template-columns:14px 1fr auto auto; gap:9px; align-items:center; font-size:13px; }
  .anrow i{ width:12px; height:12px; border-radius:3px; }
  .anrow .nm{ color:var(--ink); }
  .anrow .bar{ grid-column:2 / 3; height:6px; border-radius:3px; background:var(--line-2); overflow:hidden; margin-top:3px; }
  .anrow .val{ font-family:var(--mono); font-size:12px; color:var(--ink-2); }
  .anrow .val b{ color:var(--ink); }
  .antot{ margin-top:8px; padding-top:9px; border-top:1px solid var(--line-2); font-family:var(--mono); font-size:12px; color:var(--ink-2); display:flex; justify-content:space-between; }

  .foot{ color:var(--ink-3); font-size:11.5px; line-height:1.6; margin-top:18px; max-width:880px; }

  /* ===== Monatsexport ===== */
  .exbar{ display:flex; flex-wrap:wrap; gap:10px; align-items:end; margin-bottom:10px; }
  .addbtn.ghost{ background:var(--panel); color:var(--accent); border:1px solid var(--accent); }
  .addbtn.ghost:hover{ background:var(--accent-soft); }
  .exnote{ font-family:var(--mono); font-size:11px; color:var(--good); align-self:center; }
  .exhint{ font-size:11px; color:var(--ink-3); margin:0 0 12px; line-height:1.5; }
  .extable{ display:flex; flex-direction:column; margin-bottom:12px; }
  .exk{ display:grid; grid-template-columns:14px 1fr auto auto; gap:9px; align-items:center; font-size:13px; padding:8px 0 5px; border-top:1px solid var(--line-2); }
  .exk:first-child{ border-top:0; }
  .exk i{ width:12px; height:12px; border-radius:3px; }
  .exk .kn{ font-weight:600; }
  .exk .v{ font-family:var(--mono); font-size:12px; color:var(--ink); }
  .exa{ display:grid; grid-template-columns:14px 1fr auto auto; gap:9px; font-size:12px; color:var(--ink-2); padding:2px 0; }
  .exa .an2{ grid-column:2; }
  .exa .v{ font-family:var(--mono); font-size:11px; }
  .exa.late .an2{ color:var(--bad); }
  .extot{ display:flex; justify-content:space-between; font-family:var(--mono); font-size:12px; color:var(--ink-2); border-top:1px solid var(--line-2); margin-top:5px; padding-top:8px; }
  .excsv{ width:100%; height:122px; font-family:var(--mono); font-size:11px; color:var(--ink-2); background:var(--panel-2); border:1px solid var(--line); border-radius:9px; padding:9px 11px; resize:vertical; white-space:pre; overflow:auto; }

  /* ===== Mobile-Ansicht (oben nach unten) ===== */
  .mobile{ display:none; margin-top:10px; }
  .mtoggle{ display:inline-flex; border:1px solid var(--line); border-radius:10px; overflow:hidden; margin-bottom:12px; }
  .mtoggle button{ font-family:var(--mono); font-size:11px; letter-spacing:.06em; text-transform:uppercase; padding:9px 16px; background:var(--panel); color:var(--ink-2); border:0; cursor:pointer; }
  .mtoggle button.on{ background:var(--accent); color:#fff; }
  .mday{ border:1px solid var(--line); border-radius:12px; background:var(--panel); box-shadow:var(--shadow); margin-bottom:10px; overflow:hidden; }
  .mday.is-today{ border-color:color-mix(in srgb,var(--accent) 45%, var(--line)); }
  .mdh{ display:flex; align-items:baseline; gap:8px; padding:9px 13px; background:var(--panel-2); border-bottom:1px solid var(--line-2); }
  .mdh .dw{ font-family:var(--mono); font-size:10px; letter-spacing:.1em; text-transform:uppercase; color:var(--ink-3); }
  .mdh .dd{ font-family:var(--disp); font-weight:600; font-size:16px; }
  .mdh .kw{ font-family:var(--mono); font-size:9px; color:var(--ink-3); }
  .mdh .td{ margin-left:auto; font-family:var(--mono); font-size:9px; color:var(--accent); border:1px solid color-mix(in srgb,var(--accent) 40%,transparent); border-radius:999px; padding:1px 8px; }
  .mrow{ padding:9px 13px; border-top:1px solid var(--line-2); }
  .mrow:first-child{ border-top:0; }
  .mrhead{ display:flex; align-items:center; gap:8px; }
  .mnm{ font-family:var(--disp); font-weight:600; font-size:13px; }
  .mcap{ margin-left:auto; font-family:var(--mono); font-size:10px; color:var(--ink-3); }
  .mcap.over{ color:var(--bad); }
  .mbar{ height:5px; border-radius:3px; background:var(--line-2); overflow:hidden; margin:5px 0 7px; display:flex; }
  .mbar > i{ display:block; height:100%; }
  .mbar > i.u{ background:var(--good); }
  .mbar.mid > i.u{ background:var(--warn); }
  .mbar > i.o{ background:repeating-linear-gradient(45deg,var(--bad),var(--bad) 4px,#b91c1c 4px,#b91c1c 8px); }
  .mchips{ display:flex; flex-wrap:wrap; gap:6px; }
  .mchip{ position:relative; border-radius:8px; color:#fff; padding:6px 9px; font-size:12px; line-height:1.2; cursor:pointer; max-width:100%; box-shadow:0 1px 2px rgba(16,32,40,.16); }
  .mchip .ct{ font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .mchip .cm{ font-family:var(--mono); font-size:9.5px; opacity:.93; margin-top:1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .mchip.late{ box-shadow:0 0 0 2px var(--bad), 0 1px 2px rgba(16,32,40,.16); }
  .mchip.ot{ outline:2px solid var(--bad); outline-offset:-2px; }
  .mchip .bang{ margin-left:5px; font-weight:700; }
  .mfree{ font-family:var(--mono); font-size:11px; color:var(--ink-3); }
  .mhelp{ font-family:var(--mono); font-size:10px; color:var(--ink-3); margin:0 2px 10px; }
  .mperson{ border:1px solid var(--line); border-radius:12px; background:var(--panel); box-shadow:var(--shadow); margin-bottom:10px; overflow:hidden; }
  .mph{ padding:11px 13px; background:var(--panel-2); border-bottom:1px solid var(--line-2); }
  .mph .sub{ font-family:var(--mono); font-size:10px; color:var(--ink-3); display:block; margin-top:2px; }
  .mpday{ display:grid; grid-template-columns:78px 1fr; gap:10px; padding:9px 13px; border-top:1px solid var(--line-2); align-items:start; }
  .mpday .d{ font-family:var(--mono); font-size:11px; color:var(--ink-2); padding-top:4px; }
  .mpday.is-today .d{ color:var(--accent); }

  .scrim{ display:none; position:fixed; inset:0; background:rgba(8,16,20,.4); z-index:49; }
  .scrim.show{ display:block; }
  .msheet{ display:none; position:fixed; left:0; right:0; bottom:0; z-index:50; background:var(--panel); border-top:1px solid var(--line); box-shadow:0 -8px 24px rgba(16,32,40,.22); padding:15px 16px calc(16px + env(safe-area-inset-bottom)); border-radius:16px 16px 0 0; }
  .msheet.show{ display:block; }
  .msheet h3{ font-family:var(--disp); font-weight:600; font-size:14.5px; margin:0 0 12px; }
  .msheet .srow{ display:flex; gap:10px; flex-wrap:wrap; }
  .msheet .srow .field{ flex:1 1 130px; }
  .msheet .btns{ display:flex; gap:8px; margin-top:14px; align-items:center; }
  .msheet .btns button{ font-family:var(--body); font-weight:600; font-size:13px; border-radius:9px; padding:9px 14px; border:1px solid var(--line); background:var(--panel); color:var(--ink); cursor:pointer; }
  .msheet .btns .prim{ background:var(--accent); color:#fff; border-color:var(--accent); margin-right:auto; }
  .msheet .btns .del{ color:var(--bad); border-color:color-mix(in srgb,var(--bad) 40%,var(--line)); }

  @media (max-width:760px){
    .boardwrap{ display:none; }
    .mobile{ display:block; }
    .cols{ grid-template-columns:1fr; }
    h1{ font-size:20px; }
  }
