/* ============================================================
   PM-Organizer – Stil im PSP-Viewer-Look (schlank, professionell)
   ============================================================ */
:root {
  --bg: #f5f7fa; --panel: #ffffff; --panel-2: #fafbfc;
  --ink: #1f2937; --muted: #6b7280; --line: #e5e7eb; --line2: #cbd5e1;
  --hdr: #1f4e78; --hdr2: #2e75b6; --accent: #2e75b6; --accent-ink: #ffffff; --code-ink: #1f4e78;
  --lvl1: #bdd7ee; --lvl2: #ddebf7; --lvl3: #ffffff;
  --bar1: #1f4e78; --bar2: #2e75b6; --bar3: #6fa8dc;
  --milestone: #a78bfa; --milestone-ink: #6d28d9;
  --green: #00b050; --yellow: #ffc000; --red: #c00000; --grey: #a6a6a6;
  --prio-hoch: #c00000; --prio-mittel: #d97706; --prio-niedrig: #2563eb;
  --ferien: #fff6cc; --ferien-ink: #8a6d00;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .1), 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .18);
  --radius: 7px; --radius-sm: 4px;
  --appbar-h: 52px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b; --panel: #161d27; --panel-2: #131a23;
    --ink: #e5e9f0; --muted: #94a3b8; --line: #263041; --line2: #334155;
    --hdr: #14304a; --hdr2: #4f86c6; --accent: #2e75b6; --code-ink: #8fb8e6;
    --ferien: #3b3414; --ferien-ink: #e8cf7a;
    --lvl1: #1c3a55; --lvl2: #16293c; --lvl3: #161d27;
    --bar1: #4f86c6; --bar2: #2e75b6; --bar3: #6fa8dc;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 2px 6px rgba(0, 0, 0, .45);
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, .6);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: Arial, Helvetica, "Segoe UI", sans-serif; font-size: 13px; line-height: 1.45;
}
body.modal-open { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
a { color: var(--hdr2); text-decoration: none; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.danger-text { color: var(--red) !important; }
.hidden { display: none !important; }
.spacer { flex: 1 1 auto; }

/* ---------- Appbar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 40; height: var(--appbar-h);
  display: flex; align-items: center; gap: 20px; padding: 0 16px;
  background: var(--hdr); color: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px;
  background: #fff; color: var(--hdr); font-weight: 800; font-size: 12px; letter-spacing: .5px;
}
.brand h1 { font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.mainnav { display: flex; gap: 2px; }
.mainnav a {
  color: #dbe6f3; padding: 8px 14px; border-radius: 6px; font-weight: 600; font-size: 13px;
  transition: background .12s, color .12s;
}
.mainnav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.mainnav a.active { background: #fff; color: var(--hdr); }
.appbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.sync-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; color: #cbd5e1; background: rgba(148,163,184,.18); }
.sync-badge.on { color: #bbf7d0; background: rgba(34,197,94,.22); }
.user-switch { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: #fff; color: var(--hdr); font-weight: 700; font-size: 11px;
}
.user-switch select {
  background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 6px; padding: 5px 8px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.user-switch select option { color: #1f2937; }
.icon-btn {
  background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .22);
  width: 30px; height: 30px; border-radius: 6px; cursor: pointer; font-size: 16px; line-height: 1;
}
.icon-btn:hover { background: rgba(255, 255, 255, .22); }
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: 38px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg);
  min-width: 220px; padding: 6px; display: flex; flex-direction: column; z-index: 50;
}
.menu-pop button {
  text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 6px;
  cursor: pointer; font: inherit; color: inherit;
}
.menu-pop button:hover { background: var(--panel-2); }

/* ---------- Layout ---------- */
.view { padding: 18px; max-width: 1400px; margin: 0 auto; }
.page-hd { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-hd h2 { font-size: 20px; }
.page-hd .sub { color: var(--muted); font-size: 13px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--hdr2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line2); padding: 7px 13px; border-radius: var(--radius-sm); cursor: pointer;
  font: inherit; font-weight: 600; font-size: 12.5px; transition: filter .12s, background .12s, border-color .12s;
}
.btn:hover { filter: brightness(.98); border-color: var(--hdr2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--hdr2); }
.btn.ghost:hover { background: rgba(46, 117, 182, .1); border-color: transparent; }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.sm { padding: 4px 9px; font-size: 11.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.active { background: var(--hdr2); color: #fff; border-color: var(--hdr2); }
.panel-hd.clickable { cursor: pointer; user-select: none; }
.panel-hd.clickable:hover { filter: brightness(1.07); }
.task-group { font-size: 11px; font-weight: 700; color: var(--hdr2); text-transform: uppercase; letter-spacing: .3px; padding: 9px 2px 3px; border-bottom: 1px solid var(--line); margin-top: 4px; }
.task-group:first-child { margin-top: 0; padding-top: 2px; }

/* ---------- Panels / Cards ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 16px; }
.panel-hd { background: var(--hdr2); color: #fff; padding: 9px 13px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.panel-hd .panel-tools { margin-left: auto; display: flex; gap: 6px; }
.panel-hd .panel-tools .btn { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .3); }
.panel-hd .panel-tools .btn:hover { background: rgba(255, 255, 255, .26); }
.panel-bd { padding: 14px; }
.panel-bd.flush { padding: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden; cursor: pointer; transition: box-shadow .14s, transform .14s;
  border-top: 4px solid var(--hdr2);
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.card .card-bd { padding: 13px 14px; }
.card .card-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card .code-chip { font-size: 11px; font-weight: 700; color: #fff; background: var(--hdr2); padding: 1px 7px; border-radius: 10px; }
.card .card-desc { color: var(--muted); margin: 7px 0 11px; min-height: 34px; }
.card .card-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-sm); }
.kpi .kpi-val { font-size: 26px; font-weight: 800; line-height: 1.1; }
.kpi .kpi-lbl { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi.alert .kpi-val { color: var(--red); }

/* ---------- Progress ---------- */
.progress { height: 7px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.progress.sm { height: 5px; }

/* ---------- Badges / Chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 11px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.amp-Grün { background: var(--green); } .amp-Gelb { background: var(--yellow); } .amp-Rot { background: var(--red); } .amp-Grau { background: var(--grey); }
.badge.status { background: var(--panel-2); border: 1px solid var(--line2); color: var(--muted); }
.badge.prio-hoch { background: rgba(192, 0, 0, .12); color: var(--prio-hoch); }
.badge.prio-mittel { background: rgba(217, 119, 6, .14); color: var(--prio-mittel); }
.badge.prio-niedrig { background: rgba(37, 99, 235, .12); color: var(--prio-niedrig); }
.badge.type { background: var(--lvl2); color: var(--hdr); }
.avatar-sm { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 9.5px; font-weight: 700; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 14px; border: 1px solid var(--line2); background: var(--panel); cursor: pointer; font-size: 12px; font-weight: 600; }
.chip.active { background: var(--hdr2); color: #fff; border-color: var(--hdr2); }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }

/* ---------- Tables / lists ---------- */
table.grid { width: 100%; border-collapse: collapse; }
table.grid th { text-align: left; background: var(--panel-2); color: var(--muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; }
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:hover td { background: var(--panel-2); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: .25; transition: opacity .12s; }
tr:hover .row-actions, .item-row:hover .row-actions, .wbs-row:hover .row-actions { opacity: 1; }
.iconbtn { background: none; border: 0; cursor: pointer; padding: 3px 5px; border-radius: 4px; font-size: 13px; color: var(--muted); }
.iconbtn:hover { background: var(--line); color: var(--ink); }

/* ---------- WBS Baum ---------- */
.wbs { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.wbs-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.wbs-row:last-child { border-bottom: 0; }
.wbs-row.lvl1 { background: var(--lvl1); font-weight: 700; }
.wbs-row.lvl2 { background: var(--lvl2); }
.wbs-row.lvl3 { background: var(--lvl3); }
.wbs-row.sel { box-shadow: inset 3px 0 0 var(--hdr); }
.wbs-row .twirl { width: 16px; text-align: center; color: var(--muted); font-size: 10px; user-select: none; }
.wbs-row .wbs-code { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--code-ink); min-width: 46px; }
.wbs-row .wbs-title { flex: 1; }
.wbs-row .wbs-counts { display: flex; gap: 6px; color: var(--muted); font-size: 11px; }
.wbs-indent { display: inline-block; }
/* Arbeitspakete & Aufgaben als Blattzeilen im PSP-Baum */
.wbs-row.wbs-item { background: var(--panel); font-size: 12px; }
.wbs-row.wbs-item:hover { background: var(--panel-2); }
.wbs-row.wbs-item .wbs-title { font-weight: 400; }
.wbs-row.wbs-item.done .wbs-title { text-decoration: line-through; color: var(--muted); }
.wbs-item-icon { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; }
.wbs-item-icon .it-check { width: 15px; height: 15px; cursor: pointer; margin: 0; }
.wbs-item-meta { color: var(--muted); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wbs-type-tag { font-size: 9.5px; font-weight: 700; color: var(--accent-ink); background: var(--hdr2); border-radius: 3px; padding: 1px 4px; letter-spacing: .3px; }

/* Projektdetail-Layout */
.detail-grid { display: grid; grid-template-columns: minmax(340px, 440px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .detail-grid { grid-template-columns: 1fr; } }
.node-col > .panel:last-child { margin-bottom: 0; }
.node-head .panel-bd { gap: 12px; align-items: center; }
.node-head .wbs-code { min-width: auto; }

/* ---------- Knoten-Detail ---------- */
.node-detail { display: grid; grid-template-columns: 1fr; gap: 16px; }
.subhead { display: flex; align-items: center; gap: 8px; margin: 2px 0 10px; }
.subhead h3 { font-size: 14px; }
.subhead .count { color: var(--muted); font-weight: 600; }
.goal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 860px) { .goal-grid { grid-template-columns: 1fr; } }
.goalbox h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--hdr2); margin-bottom: 6px; }
.goalbox .gtext { white-space: pre-wrap; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumb { width: 130px; }
.thumb img { width: 130px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line2); cursor: pointer; display: block; }
.thumb .cap { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* item rows in node detail */
.item-row { display: flex; align-items: center; gap: 9px; padding: 7px 4px; border-bottom: 1px dashed var(--line); }
.item-row:last-child { border-bottom: 0; }
.item-row .it-title { flex: 1; }
.item-row.done .it-title { text-decoration: line-through; color: var(--muted); }
.item-row .it-check { width: 16px; height: 16px; cursor: pointer; }
.item-row .it-dates { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.empty-line { color: var(--muted); padding: 8px 4px; font-style: italic; }
.add-strip { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Übersicht ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.todo-line { display: flex; align-items: center; gap: 9px; padding: 7px 2px; border-bottom: 1px dashed var(--line); }
.todo-line:last-child { border-bottom: 0; }
.todo-line .when { min-width: 92px; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.todo-line.overdue .when { color: var(--red); font-weight: 700; }
.todo-line .it-title { flex: 1; min-width: 0; }
.todo-node { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.task-done-toggle { padding: 8px 2px 3px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; }
.task-done-toggle:hover { color: var(--hdr2); }
.proc-loc { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; margin: 12px 0 4px; }
.proc-loc:first-child { margin-top: 0; }

/* ---------- Kalender ---------- */
.cal-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; position: sticky; top: var(--appbar-h); z-index: 20; background: var(--bg); padding: 10px 0; border-bottom: 1px solid var(--line); }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; }
.seg button { background: var(--panel); border: 0; padding: 6px 13px; cursor: pointer; font: inherit; font-weight: 600; color: var(--muted); border-right: 1px solid var(--line2); }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--hdr2); color: #fff; }
.cal-title { font-size: 16px; font-weight: 700; min-width: 190px; text-align: center; }

.month { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.month-head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--panel-2); }
.month-head .dow { padding: 6px; text-align: center; font-weight: 700; font-size: 11px; color: var(--muted); text-transform: uppercase; border-right: 1px solid var(--line); }
.month-head .dow:last-child { border-right: 0; }
.cal-week { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); }
.day-cell { background: var(--panel); min-height: 96px; padding: 4px 5px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); }
.day-cell:last-child { border-right: 0; }
.day-cell.other { background: var(--panel-2); color: var(--muted); }
.day-cell:hover { background: var(--lvl2); }
.day-cell .dnum { font-weight: 700; font-size: 12px; align-self: flex-end; height: 16px; line-height: 16px; }
.day-cell.today .dnum { background: var(--hdr); color: #fff; border-radius: 50%; width: 18px; height: 18px; line-height: 18px; display: grid; place-items: center; }
.barspace { flex: none; pointer-events: none; }
.day-bar { position: absolute; height: 16px; line-height: 16px; font-size: 11px; font-weight: 600; color: #fff; padding: 0 6px; box-sizing: border-box; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; z-index: 3; }
.day-bar.start { border-top-left-radius: 5px; border-bottom-left-radius: 5px; }
.day-bar.end { border-top-right-radius: 5px; border-bottom-right-radius: 5px; }
.ev { font-size: 11px; padding: 1px 5px; border-radius: 4px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ev.task { background: var(--bar2); } .ev.wp { background: var(--bar1); } .ev.appointment { background: #0f766e; }
.ev.routine { background: #7c3aed; } .ev.milestone { background: var(--milestone-ink); }
.ev.more { background: transparent; color: var(--muted); font-weight: 700; }

.year-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) { .year-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .year-grid { grid-template-columns: 1fr; } }
.mini { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow-sm); cursor: pointer; }
.mini h4 { text-align: center; font-size: 12.5px; margin-bottom: 5px; color: var(--hdr); }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.mini-grid span { text-align: center; font-size: 9.5px; padding: 2px 0; border-radius: 3px; }
.mini-grid .h { color: var(--muted); font-weight: 700; }
.mini-grid .today { background: var(--hdr); color: #fff; }
.mini-grid .has { font-weight: 700; color: var(--hdr2); position: relative; }
.mini-grid .has::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 3px; height: 3px; border-radius: 50%; background: var(--accent); }

/* Jahresansicht als Tagesliste */
.year-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.yl-month { background: var(--hdr2); color: #fff; font-weight: 700; padding: 6px 12px; font-size: 12.5px; }
.yl-day { display: flex; align-items: center; gap: 10px; padding: 5px 12px; border-bottom: 1px solid var(--line); min-height: 33px; cursor: pointer; }
.yl-day:last-child { border-bottom: 0; }
.yl-day:hover { background: var(--lvl2); }
.yl-day.weekend { background: var(--panel-2); }
.yl-day.ferien { background: var(--ferien); }
.yl-day.today { box-shadow: inset 3px 0 0 var(--hdr); }
.yl-day.today .yl-dnum { color: var(--hdr); font-weight: 800; }
.yl-wd { width: 22px; color: var(--muted); font-weight: 700; font-size: 11px; flex: none; }
.yl-day.weekend .yl-wd { color: var(--red); }
.yl-dnum { width: 22px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; flex: none; }
.yl-evs { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
.yl-ferien { color: var(--ferien-ink); font-size: 10.5px; font-weight: 700; white-space: nowrap; flex: none; }
.yl-pill { font-size: 10.5px; line-height: 1.5; padding: 0 7px; border-radius: 9px; color: #fff; cursor: pointer; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.yl-pill.appointment { background: #0f766e; } .yl-pill.task { background: var(--bar2); } .yl-pill.milestone { background: var(--milestone-ink); } .yl-pill.routine { background: #7c3aed; } .yl-pill.wp { background: var(--bar1); }

/* Tagesplan (Zeitraster 5–24 Uhr) */
.day-head { margin-bottom: 12px; }
.ferien-badge { background: var(--ferien); color: var(--ferien-ink); border: 1px solid var(--ferien-ink); }
.dayplan { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .dayplan { grid-template-columns: 1fr; } }
.dp-scroll { max-height: 72vh; overflow: auto; }
.dp-grid { position: relative; }
.dp-hlabel { position: absolute; left: 0; width: 44px; transform: translateY(-7px); text-align: right; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dp-area { position: absolute; left: 52px; right: 8px; top: 0; bottom: 0; cursor: pointer; }
.dp-area:hover { background: rgba(46, 117, 182, .035); }
.dp-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.dp-line.hour { border-top-color: var(--line2); }
.dp-line.q { border-top-style: dotted; opacity: .55; }
.dp-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--red); z-index: 4; }
.dp-now::before { content: ''; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.dp-ev { position: absolute; border-radius: 5px; padding: 2px 7px; color: #fff; overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm); z-index: 2; }
.dp-ev:hover { filter: brightness(1.06); z-index: 5; }
.dp-ev.appointment { background: #0f766e; } .dp-ev.routine { background: #7c3aed; }
.dp-ev-time { font-weight: 700; font-size: 9.5px; opacity: .95; }
.dp-ev-title { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-ev-note { font-size: 10px; opacity: .9; margin-top: 1px; line-height: 1.25; overflow: hidden; white-space: pre-line; }
.it-note { font-size: 11px; color: var(--muted); margin-top: 1px; white-space: pre-line; }
.it-path { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.it-path::before { content: '⌗ '; opacity: .7; }
.dp-ev-path { font-size: 9.5px; opacity: .85; font-style: italic; margin-top: 1px; line-height: 1.2; overflow: hidden; }
/* ----- Wochenansicht ----- */
.wk-head, .wk-allday, .wk-grid { display: grid; grid-template-columns: 52px repeat(7, 1fr); }
.wk-head { background: var(--panel-2); border-bottom: 1px solid var(--line); }
.wk-dhead { text-align: center; padding: 6px 2px; cursor: pointer; border-left: 1px solid var(--line); }
.wk-dhead:hover { background: var(--lvl2); }
.wk-dhead.today { background: var(--hdr); color: #fff; }
.wk-dow { display: block; font-size: 10.5px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.wk-dhead.today .wk-dow { color: rgba(255, 255, 255, .85); }
.wk-dnum { display: block; font-size: 15px; font-weight: 800; }
.wk-allday { border-bottom: 1px solid var(--line); }
.wk-allday .wk-corner { font-size: 9px; color: var(--muted); text-align: right; padding: 3px 5px 0 0; align-self: start; }
.wk-adcell { border-left: 1px solid var(--line); padding: 2px; display: flex; flex-direction: column; gap: 2px; min-height: 24px; }
.wk-adchip { font-size: 10px; color: #fff; padding: 1px 5px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.wk-grid { position: relative; }
.wk-axis { position: relative; }
.wk-col { position: relative; border-left: 1px solid var(--line); cursor: pointer; }
.wk-col:hover { background: rgba(46, 117, 182, .025); }

/* Tagesansicht */
.day-view { display: grid; grid-template-columns: 1fr; gap: 16px; }
.day-head { display: flex; align-items: baseline; gap: 10px; }
.day-head .big { font-size: 22px; font-weight: 800; }

/* ---------- Gantt ---------- */
.gantt-wrap { overflow: auto; max-height: 74vh; border-top: 1px solid var(--line); position: relative; line-height: 0; font-size: 0; }
.g-header { display: flex; position: sticky; top: 0; z-index: 6; width: max-content; }
.g-corner { position: sticky; left: 0; z-index: 7; flex: none; background: var(--panel-2); border-right: 2px solid var(--line2); }
.g-head-tl { flex: none; background: var(--panel); }
.g-body { display: flex; width: max-content; }
.g-side { position: sticky; left: 0; z-index: 5; flex: none; background: var(--panel); border-right: 2px solid var(--line2); }
.g-body-tl { flex: none; }
.gantt-wrap svg { display: block; shape-rendering: crispEdges; }
.legend { padding: 9px 13px; font-size: 12px; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.legend .chip2 { display: inline-flex; align-items: center; gap: 6px; cursor: default; }
.legend .swatch { width: 13px; height: 13px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0, 0, 0, .12); }
/* Gantt-Sidebar (HTML) */
.g-srow { display: grid; grid-template-columns: 50px 1fr 30px 18px 20px; align-items: center; gap: 6px; padding: 0 10px; font-size: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.g-shead { background: var(--panel-2); color: var(--muted); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: .3px; align-items: end; padding-bottom: 4px; }
.g-srow .g-c-code { font-weight: 700; color: var(--code-ink); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.g-srow .g-c-title { overflow: hidden; text-overflow: ellipsis; }
.g-srow .g-c-own, .g-srow .g-c-amp, .g-srow .g-c-prog { display: flex; justify-content: center; align-items: center; }
.g-prog { width: 13px; height: 13px; border: 1.5px solid var(--muted); border-radius: 3px; background: var(--panel); overflow: hidden; }
.g-prog > i { display: block; height: 100%; background: var(--hdr2); }
/* ----- Philips Hue ----- */
.hue-app { display: flex; flex-direction: column; gap: 12px; }
.hue-setup { display: flex; flex-direction: column; gap: 10px; max-width: 460px; }
.hue-steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.hue-row { display: flex; gap: 8px; }
.hue-status { font-size: 13px; min-height: 18px; }
.hue-err { color: var(--red); font-size: 13px; padding: 8px 0; }
.hue-toolbar { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.hue-lights { display: flex; flex-direction: column; gap: 2px; }
.hue-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.hue-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.hue-tab.active { color: var(--hdr2); border-bottom-color: var(--hdr2); }
.hue-content { padding-top: 4px; max-height: 56vh; overflow: auto; }
.hue-scene-group { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin: 12px 0 5px; }
.hue-scene-row { display: flex; flex-wrap: wrap; gap: 6px; }
.hue-twirl { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; width: 14px; padding: 0; flex: none; }
.hue-room { border-bottom: 1px dashed var(--line); }
.hue-room-hd { border-bottom: 0 !important; }
.hue-sub { padding-left: 26px; }
.hue-sub .hue-light { border-bottom: 1px dotted var(--line); padding: 6px 4px; }
.hue-auto-sec { margin-bottom: 16px; }
.hue-auto-hd { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 0 4px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.hue-auto-list { display: flex; flex-direction: column; }
.hue-light { display: flex; align-items: center; gap: 12px; padding: 9px 6px; border-bottom: 1px dashed var(--line); }
.hue-light.off { opacity: .55; }
.hue-ic { width: 18px; height: 18px; border-radius: 50%; flex: none; border: 1px solid rgba(0, 0, 0, .15); box-shadow: inset 0 0 3px rgba(0, 0, 0, .25); }
.hue-name { font-weight: 600; font-size: 13px; }
.hue-bri { width: 130px; flex: none; }
.hue-color { width: 30px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: none; cursor: pointer; flex: none; }
.hue-ct { width: 92px; height: 16px; flex: none; -webkit-appearance: none; appearance: none; border-radius: 8px; background: linear-gradient(to right, #bcd7ff, #fff4e0, #ffb259); outline: none; cursor: pointer; }
.hue-ct::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 1px solid var(--muted); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); cursor: pointer; }
.hue-ct::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 1px solid var(--muted); cursor: pointer; }
.hue-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; cursor: pointer; }
.hue-cb { position: absolute; opacity: 0; width: 0; height: 0; }
.hue-knob { position: absolute; inset: 0; background: var(--line2); border-radius: 999px; transition: background .15s; }
.hue-knob::before { content: ''; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.hue-cb:checked + .hue-knob { background: var(--green); }
.hue-cb:checked + .hue-knob::before { transform: translateX(18px); }
.hue-cb:disabled + .hue-knob { opacity: .4; cursor: not-allowed; }
.g-srow.g-node.lvl1 { background: var(--lvl1); font-weight: 700; }
.g-srow.g-node.lvl2 { background: var(--lvl2); }
.g-srow.g-node.lvl3 { background: var(--lvl3); }
.g-srow.g-group { display: flex; align-items: center; background: var(--hdr2); color: #fff; font-weight: 700; }
.g-srow.g-group .g-grp-name { overflow: hidden; text-overflow: ellipsis; }
.g-srow:hover:not(.g-shead):not(.g-group) { background: var(--lvl2); }

/* ---------- Modal / Formular ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: grid; place-items: center; z-index: 100; padding: 18px; }
.modal { background: var(--panel); color: var(--ink); border-radius: 10px; box-shadow: var(--shadow-lg); width: 100%; max-width: 540px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.modal.wide { max-width: 820px; }
.modal-hd { background: var(--hdr); color: #fff; padding: 12px 16px; font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: space-between; }
.modal-x { background: none; border: 0; color: #fff; font-size: 16px; cursor: pointer; opacity: .85; }
.modal-x:hover { opacity: 1; }
.modal-bd { padding: 16px; overflow: auto; }
.modal-ft { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--panel-2); }
.confirm-msg { font-size: 14px; }

.form { display: flex; flex-direction: column; gap: 13px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-weight: 600; font-size: 12.5px; }
.field .req { color: var(--red); }
.field input[type=text], .field input[type=date], .field input[type=time], .field input[type=number],
.field input[type=color], .field textarea, .field select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line2); border-radius: 6px; font: inherit;
  background: var(--panel); color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid rgba(46, 117, 182, .35); outline-offset: 0; border-color: var(--hdr2); }
.field input[type=color] { height: 38px; padding: 3px; }
.field-check { flex-direction: row; align-items: center; gap: 8px; }
.field-check input { width: 17px; height: 17px; }
.field-check > label { font-weight: 600; }
.field.static .static-val { color: var(--muted); }
.range-wrap { display: flex; align-items: center; gap: 10px; }
.range-wrap input[type=range] { flex: 1; }
.range-val { min-width: 42px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.img-list { display: flex; flex-wrap: wrap; gap: 10px; }
.img-item { width: 150px; }
.img-item img { width: 150px; height: 100px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line2); }
.img-meta { display: flex; gap: 4px; margin-top: 4px; align-items: center; }
.img-cap { flex: 1; padding: 4px 6px !important; font-size: 11px; }
.img-empty { padding: 8px 0; }
/* Datei-Ablage */
.file-folder { font-size: 11.5px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; margin-bottom: 6px; word-break: break-word; }
.file-folder b { color: var(--ink); }
.file-list { display: flex; flex-direction: column; gap: 5px; }
.file-item { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line2); border-radius: 7px; padding: 6px 9px; background: var(--panel); }
.file-ic { font-size: 17px; flex: none; }
.file-meta { flex: 1; min-width: 0; }
.file-name { font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-sub { font-size: 10.5px; }
.file-empty { font-size: 12px; padding: 6px 0; }
.file-badge { font-size: 11px; color: var(--hdr2); font-weight: 600; }

.checks-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.check-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line2); border-radius: 16px; padding: 5px 11px; cursor: pointer; font-weight: 600; }
.check-pill input { width: 15px; height: 15px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .82); display: grid; place-items: center; z-index: 120; cursor: zoom-out; padding: 24px; }
.lightbox img { max-width: 94vw; max-height: 84vh; border-radius: 8px; box-shadow: var(--shadow-lg); }
.lightbox .lb-cap { position: absolute; bottom: 22px; color: #fff; font-size: 14px; background: rgba(0, 0, 0, .5); padding: 6px 14px; border-radius: 20px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 15px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 13px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; max-width: 340px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

/* ---------- Misc ---------- */
.empty-state { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty-state .big { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.flex { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.nowrap { white-space: nowrap; }
.tag-owner { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Anmeldung / Nutzer ---------- */
body.logged-out #mainnav, body.logged-out .appbar-right { display: none; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-wrap { max-width: 380px; margin: 7vh auto 0; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; color: var(--hdr); }
.login-card { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 7px; }
.login-card h2 { font-size: 18px; margin-bottom: 4px; }
.login-label { font-size: 12px; font-weight: 600; margin-top: 6px; color: var(--muted); }
.login-input { width: 100%; padding: 9px 11px; border: 1px solid var(--line2); border-radius: 7px; font: inherit; background: var(--panel); color: var(--ink); }
.login-input:focus { outline: 2px solid rgba(46, 117, 182, .35); border-color: var(--hdr2); }
.login-btn { width: 100%; justify-content: center; margin-top: 10px; }
.login-err { color: var(--red); font-size: 12.5px; min-height: 15px; }
.login-sep { height: 1px; background: var(--line); margin: 10px 0 2px; }
.login-note { margin-top: 6px; }
.user-list { display: flex; flex-direction: column; }
.user-row { display: flex; align-items: center; gap: 9px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }

/* ---------- Ziele & KPIs ---------- */
.kpi-overview .panel-bd { display: flex; flex-direction: column; gap: 12px; }
.kpi-block { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--panel-2); }
.kpi-block-hd { display: flex; align-items: center; gap: 8px; }
.kpi-block-hd .wbs-code { min-width: auto; }
.kpi-goal { font-size: 12.5px; margin: 6px 0 2px; }
.kpi-goal-lbl { font-weight: 700; color: var(--hdr2); }
.kpi-cards { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.kpi-card { min-width: 168px; flex: 0 1 210px; border: 1px solid var(--line2); border-left: 4px solid var(--grey); border-radius: 8px; padding: 9px 11px; background: var(--panel); box-shadow: var(--shadow-sm); }
.kpi-card.ok { border-left-color: var(--green); }
.kpi-card.bad { border-left-color: var(--red); }
.kpi-card.warn { border-left-color: var(--yellow); }
.kpi-climate-wrap { margin-bottom: 12px; }
.kpi-climate { max-width: 380px; }
.kpi-climate .kpi-val { display: flex; align-items: center; }
.kpi-climate-chart { margin: 6px 0 4px; }
.temp-chart { width: 100%; height: 118px; display: block; }
.temp-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-left: 8px; }
.temp-lbl { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 5px; }
.kpi-climate-out { font-size: 13px; margin: 1px 0 3px; }
.temp-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.temp-legend .lg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.kpi-name { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12.5px; }
.kpi-name a { color: var(--ink); }
.kpi-actions { margin-left: auto; display: flex; gap: 1px; opacity: .25; transition: opacity .12s; }
.kpi-card:hover .kpi-actions { opacity: 1; }
.kpi-val { font-size: 22px; font-weight: 800; line-height: 1.15; margin: 3px 0 2px; }
.kpi-spark { width: 100%; height: 30px; display: block; margin: 1px 0 4px; }
.kpi-unit { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-trend { font-size: 13px; }
.kpi-trend.up { color: var(--green); } .kpi-trend.down { color: var(--red); }
.kpi-sub { font-size: 11px; color: var(--muted); }
.kpi-sub.overdue { color: var(--red); font-weight: 600; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------- Prozesse / Automatisierung ---------- */
.proc-card { border: 1px solid var(--line); border-left: 3px solid var(--hdr2); border-radius: 7px; padding: 11px 13px; margin-bottom: 11px; background: var(--panel-2); }
.proc-card:last-child { margin-bottom: 0; }
.proc-hd { display: flex; align-items: center; gap: 9px; }
.proc-ic { font-size: 19px; line-height: 1; }
.proc-desc { font-size: 11.5px; margin: 7px 0; }
.proc-outputs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 7px; }
.proc-out { background: var(--panel); border: 1px solid var(--line2); border-radius: 6px; padding: 4px 10px; font-size: 12px; }
.proc-out .k { color: var(--muted); margin-right: 6px; }
.proc-out .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.app-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
@media (max-width: 700px) { .app-picker { grid-template-columns: 1fr; } }
.app-tile { border: 1px solid var(--line2); border-radius: 9px; padding: 13px; cursor: pointer; transition: border-color .12s, background .12s, transform .12s; }
.app-tile:hover { border-color: var(--hdr2); background: var(--lvl2); transform: translateY(-1px); }
.app-ic { font-size: 26px; margin-bottom: 5px; }

/* ---------- Blockdarstellung (PSP als vertikaler Block-Baum) ---------- */
.panel-hd .panel-tools .btn.active { background: #fff; color: var(--hdr); border-color: #fff; }
.bt-scroll { overflow: auto; max-height: 78vh; background: var(--panel); padding: 6px 14px 14px; }
.bt-bar { display: flex; gap: 6px; padding: 6px 0 10px; position: sticky; left: 0; }
.bt { max-width: 940px; }
.bt-children { margin-left: 16px; padding-left: 16px; border-left: 1.5px solid var(--line); }
.bt-row { display: flex; align-items: center; gap: 8px; padding: 7px 11px; margin: 5px 0; border: 1px solid var(--line2); border-radius: 7px; background: var(--panel); box-shadow: var(--shadow-sm); min-width: 240px; }
.bt-row[data-clickable] { cursor: pointer; transition: box-shadow .12s, transform .12s; }
.bt-row[data-clickable]:hover { box-shadow: var(--shadow); transform: translateX(1px); }
.bt-root { background: var(--hdr); color: #fff; }
.bt-project { background: var(--panel); }
.bt-node.lvl1 { background: var(--lvl1); }
.bt-node.lvl2 { background: var(--lvl2); }
.bt-node.lvl3 { background: var(--lvl3); }
.bt-twirl { width: 16px; text-align: center; color: var(--muted); font-size: 11px; user-select: none; flex: none; cursor: pointer; }
.bt-twirl.empty { cursor: default; }
.bt-root .bt-twirl { color: rgba(255, 255, 255, .85); }
.bt-code { font-weight: 700; color: var(--code-ink); font-variant-numeric: tabular-nums; min-width: 44px; flex: none; }
.bt-code-chip { font-weight: 700; color: #fff; font-size: 11px; padding: 1px 8px; border-radius: 9px; flex: none; }
.bt-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-title.strong { font-weight: 700; }
.bt-row .grow { flex: 1 1 auto; min-width: 8px; }
.bt-cnt { font-size: 11px; color: var(--muted); font-weight: 600; flex: none; white-space: nowrap; }
.bt-root .bt-cnt { color: rgba(255, 255, 255, .85); }
.bt-prog { width: 84px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; flex: none; }
.bt-prog i { display: block; height: 100%; background: var(--green); }
