/* PMSU 2 – Stylesheet. Neutrale Grautöne + ein Akzent (Blau), Hell/Dunkel, tabellarische Ziffern. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e7eaee;
  --border: #dde1e6;
  --border-strong: #c3c9d0;
  --text: #15181c;
  --text-2: #535b66;
  --text-3: #6b737e;
  --accent: #1d5bd0;
  --accent-hover: #164bb0;
  --accent-weak: #e7eefb;
  --accent-text: #ffffff;
  --ok: #1d7446;
  --ok-weak: #e3f2e9;
  --warn: #8f5a00;
  --warn-weak: #fdf2dc;
  --bad: #bb2424;
  --bad-weak: #fbe9e8;
  --crit: #c2410c;
  --crit-weak: #fdeee5;
  --lvl-low: #d9efe1;
  --lvl-mid: #fbeec8;
  --lvl-high: #f6d3d0;
  --weekend: rgba(15, 23, 42, 0.045);
  --holiday: rgba(187, 36, 36, 0.10);
  --absence: rgba(143, 90, 0, 0.12);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, 0.16);
  --radius: 6px;
  --fs: 13.5px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1115; --surface: #151920; --surface-2: #1b2028; --surface-3: #232a34;
    --border: #2a313b; --border-strong: #3a4350;
    --text: #e5e8ec; --text-2: #a3adb9; --text-3: #8a94a1;
    --accent: #6d9eff; --accent-hover: #8db3ff; --accent-weak: #1b2a45; --accent-text: #0b1220;
    --ok: #5cc98b; --ok-weak: #15301f; --warn: #e6b04a; --warn-weak: #332711; --bad: #ff7a70; --bad-weak: #3a1a19;
    --crit: #ff9a5c; --crit-weak: #3a2214;
    --lvl-low: #1d3a28; --lvl-mid: #3d3316; --lvl-high: #4a2220;
    --weekend: rgba(255, 255, 255, 0.035); --holiday: rgba(255, 122, 112, 0.13); --absence: rgba(230, 176, 74, 0.13);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1115; --surface: #151920; --surface-2: #1b2028; --surface-3: #232a34;
  --border: #2a313b; --border-strong: #3a4350;
  --text: #e5e8ec; --text-2: #a3adb9; --text-3: #8a94a1;
  --accent: #6d9eff; --accent-hover: #8db3ff; --accent-weak: #1b2a45; --accent-text: #0b1220;
  --ok: #5cc98b; --ok-weak: #15301f; --warn: #e6b04a; --warn-weak: #332711; --bad: #ff7a70; --bad-weak: #3a1a19;
  --crit: #ff9a5c; --crit-weak: #3a2214;
  --lvl-low: #1d3a28; --lvl-mid: #3d3316; --lvl-high: #4a2220;
  --weekend: rgba(255, 255, 255, 0.035); --holiday: rgba(255, 122, 112, 0.13); --absence: rgba(230, 176, 74, 0.13);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--fs); line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.005em; }
p { margin: 0 0 0.5em; }
code, kbd, .mono { font-family: var(--mono); font-size: 0.92em; }
kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; font-size: 11px; color: var(--text-2); background: var(--surface); }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.num, table, .kpi-value, .tbl-count { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.bad-text { color: var(--bad); }
.warn-text { color: var(--warn); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.icon { flex: none; display: inline-block; vertical-align: middle; }

/* ------------------------------------------------------------------ Boot / Login */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); color: var(--text-2); z-index: 100; }
.boot-inner { display: flex; gap: 10px; align-items: center; }
.boot-mark { width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fatal { max-width: 560px; margin: 15vh auto; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 28px 24px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { font-size: 20px; }
.login-card h1 .muted { font-weight: 400; }
.login-logo { height: 44px; }
.login-error { margin: 0; padding: 8px 10px; border-radius: var(--radius); background: var(--bad-weak); color: var(--bad); font-size: 12.5px; }

.logo { display: block; object-fit: contain; }

/* ------------------------------------------------------------------ Shell */
.app { display: grid; grid-template-columns: 216px minmax(0, 1fr); height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); height: 54px; }
.brand-logo { display: flex; }
.brand-title { font-weight: 700; letter-spacing: 0.04em; font-size: 14px; }
.brand-sub { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.nav { flex: 1; overflow-y: auto; padding: 8px 8px 12px; }
.nav-group { margin-top: 6px; }
.nav-group-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); padding: 8px 8px 4px; font-weight: 600; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 5px; color: var(--text-2); text-decoration: none; font-size: 13px; min-height: 30px; }
.nav-list a:hover { background: var(--surface-2); color: var(--text); }
.nav-list a.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.nav-label { flex: 1; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--surface-3); color: var(--text-2); font-size: 11px; display: inline-grid; place-items: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.badge-bad { background: var(--bad-weak); color: var(--bad); }
.sidebar-foot { border-top: 1px solid var(--border); padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.user-line { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--text-2); flex: none; }
.user-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; }
.topbar { height: 54px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.view-title { font-size: 16px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.btn-search { gap: 8px; color: var(--text-2); border: 1px solid var(--border); min-width: 170px; justify-content: flex-start; }
.btn-search kbd { margin-left: auto; }
.save-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); padding: 0 8px; min-width: 20px; }
.save-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.save-status.st-busy .dot { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.save-status.st-bad { color: var(--bad); } .save-status.st-bad .dot { background: var(--bad); }
.save-status.st-warn { color: var(--warn); } .save-status.st-warn .dot { background: var(--warn); }
@keyframes pulse { 50% { opacity: 0.35; } }
.banner { display: flex; align-items: center; gap: 8px; padding: 7px 20px; background: var(--warn-weak); color: var(--warn); border-bottom: 1px solid var(--border); font-size: 12.5px; flex: none; }
.banner span { color: var(--text-2); }
.view { flex: 1; overflow: auto; padding: 16px 20px 48px; outline: none; }
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 25; }
.only-mobile { display: none !important; }

/* ------------------------------------------------------------------ Buttons & Inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger-ghost { color: var(--bad); border-color: var(--border); }
.btn-danger-ghost:hover { background: var(--bad-weak); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; height: 36px; }
.btn-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius); border: 1px solid transparent; background: transparent; color: var(--text-2); padding: 0; }
.btn-icon:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-icon:disabled { opacity: 0.35; cursor: default; }
.btn-icon.btn-xs { width: 24px; height: 24px; }
.btn-icon.danger:hover { color: var(--bad); background: var(--bad-weak); }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.input { height: 32px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); width: 100%; min-width: 0; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.input:disabled { background: var(--surface-2); color: var(--text-2); }
.input-sm { height: 28px; width: auto; max-width: 260px; font-size: 12.5px; }
.input-search { width: 220px; height: 28px; font-size: 12.5px; }
.input.num { text-align: right; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 11.5px; color: var(--text-3); }
.form { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.form-grid .field-wide { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ------------------------------------------------------------------ Karten, KPIs */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 14px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 13px; font-weight: 600; flex: 1; }
.card-body { padding: 12px 14px; min-width: 0; }
.card > .ms-timeline, .card > .risk-matrix { padding: 12px; }
.card-alert { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.error-card { padding: 16px; border-color: var(--bad); }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); font-weight: 600; margin: 4px 0 8px; }
.section-title.spaced { margin-top: 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.two-col > .card { margin-bottom: 14px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; min-width: 0; }
.kpi-label { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.kpi-value { font-size: 20px; font-weight: 600; margin-top: 2px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-bad { border-left: 3px solid var(--bad); } .kpi-bad .kpi-value { color: var(--bad); }
.kpi-warn { border-left: 3px solid var(--warn); }
.kpi-accent { border-left: 3px solid var(--accent); } .kpi-accent .kpi-value { color: var(--accent); }

.pbar { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.pbar.thin { height: 6px; }
.pbar-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.empty-note { margin: 4px 0; font-size: 12.5px; }
.alert-line { color: var(--bad); font-size: 12.5px; margin-bottom: 6px; }

/* Chips / Filter */
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; background: var(--surface-3); font-size: 11.5px; font-weight: 600; font-family: var(--mono); white-space: nowrap; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 10px; align-items: center; }
.chip-filter { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chip-filter-label { font-size: 11.5px; color: var(--text-2); font-weight: 600; margin-right: 2px; }
.fchip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); font-size: 12px; color: var(--text-2); }
.fchip:hover { border-color: var(--border-strong); color: var(--text); }
.fchip.on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.fchip-count { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.fchip.on .fchip-count { color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg-btn { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 11px; border: 0; background: transparent; font-size: 12.5px; color: var(--text-2); }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn.on { background: var(--accent-weak); color: var(--accent); font-weight: 600; }

.pill, .pill-select { font-weight: 700; font-size: 11.5px; letter-spacing: 0.03em; }
.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; }
.pill-muss { background: var(--bad-weak); color: var(--bad); }
.pill-soll { background: var(--warn-weak); color: var(--warn); }
.pill-kann { background: var(--surface-3); color: var(--text-2); }
select.cell-input.pill-muss { background: var(--bad-weak); color: var(--bad); }
select.cell-input.pill-soll { background: var(--warn-weak); color: var(--warn); }
select.cell-input.pill-kann { background: var(--surface-3); color: var(--text-2); }
select.cell-input.pill-select { border-radius: 10px; height: 22px; min-height: 22px; margin: 5px 6px; width: calc(100% - 12px); padding: 0 6px; font-size: 11.5px; font-weight: 700; }

.score { display: inline-grid; place-items: center; min-width: 28px; height: 20px; padding: 0 5px; border-radius: 4px; font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.score-low { background: var(--lvl-low); color: var(--ok); }
.score-mid { background: var(--lvl-mid); color: var(--warn); }
.score-high { background: var(--lvl-high); color: var(--bad); }

.link-id { border: 0; background: none; padding: 0; color: var(--accent); font-family: var(--mono); font-size: 12px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.link-id:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ Tabellen-Editor */
.tbl { margin-bottom: 14px; min-width: 0; }
.tbl-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.tbl-count { font-size: 12px; }
.tbl-scroll { overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); max-height: calc(100vh - 230px); }
.card .tbl-scroll { max-height: none; }
table.grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: 100%; }
table.grid th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); border-bottom: 1px solid var(--border); text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-2); padding: 0; height: 32px; }
table.grid th.sticky-col { z-index: 3; }
.col-resize { position: absolute; top: 0; right: 0; width: 8px; height: 100%; cursor: col-resize; z-index: 4; touch-action: none; }
.col-resize::after { content: ""; position: absolute; right: 0; top: 7px; bottom: 7px; width: 1px; background: var(--border-strong); }
.col-resize:hover::after, table.grid.resizing .col-resize::after { background: var(--accent); width: 2px; }
table.grid.resizing, table.grid.resizing * { cursor: col-resize !important; user-select: none; }
/* Umbruchmodus: Text vollständig zeigen, Zeilen wachsen mit */
table.grid.wrap textarea.cell-input { white-space: pre-wrap; overflow-wrap: anywhere; field-sizing: content; height: auto; min-height: 32px; max-height: none; overflow: hidden; }
table.grid.wrap textarea.cell-input:focus { max-height: none; }
.btn.is-on { color: var(--accent); }
.th-btn { width: 100%; height: 32px; border: 0; background: none; display: flex; align-items: center; gap: 4px; padding: 0 8px; text-align: left; font-weight: 600; color: inherit; }
.th-btn span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-btn:hover { color: var(--text); }
.sort-ind { font-size: 9px; color: var(--accent); }
table.grid td { border-bottom: 1px solid var(--border); padding: 0; vertical-align: top; background: var(--surface); height: 32px; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid td.sticky-col, table.grid th.sticky-col { position: sticky; left: 0; border-right: 1px solid var(--border); }
table.grid td.sticky-col { z-index: 1; padding: 0 8px; vertical-align: middle; }
table.grid tr.row:hover td { background: var(--surface-2); }
table.grid tr.hl td { background: var(--accent-weak) !important; }
table.grid tr.row-late td.sticky-col { box-shadow: inset 3px 0 0 var(--bad); }
table.grid tr.row-risk-high td.sticky-col { box-shadow: inset 3px 0 0 var(--bad); }
table.grid tr.row-crit td.sticky-col .link-id::after { content: " ●"; color: var(--crit); font-size: 9px; vertical-align: 2px; }
table.grid tr.row-done td .cell-input, table.grid tr.row-done td .computed { color: var(--text-3); }
table.grid tr.row-accent td { background: color-mix(in srgb, var(--accent-weak) 55%, var(--surface)); }
table.grid tr.group-row td { background: var(--surface-2); height: 28px; padding: 0 10px; vertical-align: middle; font-size: 12px; position: sticky; top: 32px; z-index: 1; }
.group-name { font-weight: 700; }
table.grid td.act { text-align: right; white-space: nowrap; vertical-align: middle; padding-right: 4px; }
table.grid td.act .btn-icon { opacity: 0; }
table.grid tr:hover td.act .btn-icon, table.grid td.act .btn-icon:focus-visible { opacity: 1; }
table.grid td.empty { padding: 16px; color: var(--text-2); text-align: center; }
table.grid th.num .th-btn { justify-content: flex-end; }
td.td-computed { vertical-align: middle !important; text-align: right; padding: 0 8px !important; }
.computed { font-variant-numeric: tabular-nums; }

.cell-input { display: block; width: 100%; min-height: 32px; height: 32px; border: 0; border-radius: 0; background: transparent; padding: 0 8px; font-size: 13px; color: var(--text); }
textarea.cell-input { padding: 7px 8px 5px; resize: none; line-height: 18px; height: 32px; overflow: hidden; white-space: pre; }
textarea.cell-input:focus { white-space: pre-wrap; field-sizing: content; min-height: 32px; max-height: 180px; overflow: auto; }
textarea.cell-input.full { white-space: pre-wrap; field-sizing: content; resize: vertical; overflow: auto; height: auto; min-height: 72px; max-height: 300px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.cell-input:hover:not(:disabled) { background: color-mix(in srgb, var(--surface-3) 60%, transparent); }
.cell-input:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--surface); position: relative; z-index: 1; }
.cell-input:disabled { color: var(--text); opacity: 1; cursor: default; -webkit-text-fill-color: var(--text); }
select.cell-input:disabled { appearance: none; }
.cell-input.invalid { outline: 2px solid var(--bad); outline-offset: -2px; }
.cell-num { text-align: right; }
.cell-date { font-variant-numeric: tabular-nums; min-width: 0; }
.cell-select { padding: 0 4px; cursor: pointer; }
.cell-color { width: 100%; height: 30px; border: 0; padding: 3px 6px; background: transparent; cursor: pointer; }
select.st-erledigt, select.st-done, select.st-erreicht, select.st-erfüllt, select.st-geklärt, select.st-entschieden, select.st-final, select.st-geliefert, select.st-ausgewertet { color: var(--ok); }
select.st-blockiert, select.st-blocked, select.st-gefährdet, select.st-eingetreten, select.st-nicht-erfüllt { color: var(--bad); }
select.st-in-arbeit, select.st-doing, select.st-review, select.st-bestellt, select.st-durchgeführt { color: var(--accent); }
select.st-verworfen, select.st-ersetzt, select.st-geschlossen { color: var(--text-3); }
.ref-wrap { display: flex; align-items: stretch; }
.ref-wrap .cell-input { flex: 1; min-width: 0; }
.ref-open { flex: none; width: 22px; border: 0; background: none; color: var(--text-3); display: grid; place-items: center; opacity: 0.6; }
.ref-open:hover { color: var(--accent); opacity: 1; }
.pct-wrap { display: grid; grid-template-columns: 1fr auto; align-items: center; position: relative; height: 32px; padding-right: 8px; }
.pct-wrap .cell-input { padding-right: 2px; }
.pct-unit { font-size: 12px; color: var(--text-2); }
.pct-bar { position: absolute; left: 8px; right: 8px; bottom: 4px; height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; pointer-events: none; }
.pct-bar > span { display: block; height: 100%; background: var(--accent); }

.static-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.static-table th { text-align: left; font-size: 11.5px; color: var(--text-2); font-weight: 600; background: var(--surface-2); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.static-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.static-table.compact td, .static-table.compact th { padding: 4px 8px; }
.static-table .num { text-align: right; }
.static-table td:first-child { white-space: nowrap; }
.static-table tr.row-late td { background: var(--bad-weak); }
.static-table tr.row-accent td { background: var(--accent-weak); }
.hist-scroll { max-height: 360px; }
.act-wide { text-align: right; }
.code-line { display: block; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; white-space: nowrap; }
dl.extra { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; font-size: 12px; }
dl.extra dt { font-family: var(--mono); color: var(--text-2); }
dl.extra dd { margin: 0; word-break: break-word; }

/* ------------------------------------------------------------------ Panel */
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 100vw; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform 0.18s ease; z-index: 40; display: flex; flex-direction: column; visibility: hidden; }
.panel.open { transform: none; visibility: visible; }
.panel-head { display: flex; align-items: flex-start; gap: 8px; padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--border); }
.panel-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.panel-title h2 { font-size: 15px; line-height: 1.3; word-break: break-word; }
.panel-body { flex: 1; overflow-y: auto; padding: 14px 18px 24px; display: flex; flex-direction: column; gap: 16px; }
.panel .cell-input:not(textarea) { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); height: 32px; }
.panel .pct-wrap { border: 1px solid var(--border-strong); border-radius: var(--radius); }
.panel .pct-wrap .cell-input { border: 0; }
.panel .ref-wrap .cell-input { border-radius: var(--radius); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fact { background: var(--surface-2); border-radius: var(--radius); padding: 6px 9px; }
.fact-label { font-size: 11px; color: var(--text-2); }
.fact-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.fact-crit .fact-value { color: var(--crit); }
.fact-bad .fact-value { color: var(--bad); }
.relations .rel-group { margin-bottom: 10px; }
.rel-title { font-size: 11.5px; font-weight: 600; color: var(--text-2); margin-bottom: 3px; }
.rel-list { list-style: none; margin: 0; padding: 0; }
.rel-list li { padding: 3px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; }
.rel-list li.bad span { color: var(--bad); }
.panel-actions { display: flex; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }

/* ------------------------------------------------------------------ Dialoge, Toasts, Suche */
dialog.dlg { border: 1px solid var(--border); border-radius: 10px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(480px, calc(100vw - 32px)); }
dialog.dlg-wide { width: min(760px, calc(100vw - 32px)); }
dialog.dlg::backdrop { background: rgba(10, 14, 20, 0.45); }
.dlg-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; }
.dlg-head h2 { font-size: 15px; flex: 1; }
.dlg-body { padding: 0 16px 8px; font-size: 13px; }
.dlg-body ul { padding-left: 18px; margin: 6px 0; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px 14px; flex-wrap: wrap; }
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 200; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: var(--radius); font-size: 12.5px; box-shadow: var(--shadow-lg); transition: opacity 0.3s; max-width: 90vw; }
.toast-error { background: var(--bad); color: #fff; }
.toast-warn { background: var(--warn); color: #fff; }
.toast.out { opacity: 0; }
dialog.search-dlg { width: min(640px, calc(100vw - 24px)); margin-top: 10vh; }
.search-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.search-input { border: 0; height: 36px; font-size: 15px; padding: 0; background: transparent; }
.search-input:focus { outline: none; }
.search-results { list-style: none; margin: 0; padding: 6px; max-height: 60vh; overflow-y: auto; }
.search-hit { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 7px 10px; border-radius: var(--radius); cursor: pointer; }
.search-hit.sel, .search-hit:hover { background: var(--accent-weak); }
.search-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-empty { padding: 14px 10px; }

/* ------------------------------------------------------------------ Dashboard */
.kpis-dash { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.dash-grid > .card { margin: 0; }
.dash-grid .span-2 { grid-column: span 2; }
.phase-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.phase-line { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; font-size: 12.5px; }
.phase-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.phase-pct { font-weight: 600; min-width: 38px; text-align: right; }
.rows { list-style: none; margin: 0; padding: 0; }
.row-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.row-item:last-child { border-bottom: 0; }
.row-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item.ext .link-id::before { content: "◆ "; color: var(--accent); }
.row-item.advisor { background: color-mix(in srgb, var(--accent-weak) 60%, transparent); margin: 0 -6px; padding: 5px 6px; border-radius: 4px; border-bottom-color: transparent; margin-bottom: 2px; }
.q-counts { display: flex; gap: 10px; margin-bottom: 8px; }
.q-count { flex: 1; background: var(--surface-2); border-radius: var(--radius); padding: 6px 10px; display: flex; flex-direction: column; }
.q-count.accent { background: var(--accent-weak); }
.q-count.accent .q-num { color: var(--accent); }
.q-num { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hbar-list li { display: grid; grid-template-columns: 118px 1fr 58px; gap: 8px; align-items: center; font-size: 12.5px; }
.hbar-label { color: var(--text-2); }
.hbar-track { height: 10px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.hbar { display: block; height: 100%; border-radius: 3px; }
.hbar-val { text-align: right; }
.b-plan { background: var(--border-strong); }
.b-soll { background: color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.b-ist { background: var(--accent); }
.b-earned { background: var(--ok); }
.crit-chain { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0; }
.crit-chain li { display: flex; align-items: center; gap: 4px; }
.crit-chain li + li::before { content: "→"; color: var(--text-3); }
.crit-chain .link-id { color: var(--crit); }

/* ------------------------------------------------------------------ Gantt */
.gantt-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.gantt-scroll { overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); max-height: calc(100vh - 220px); position: relative; overscroll-behavior: contain; }
.gantt-head { display: flex; position: sticky; top: 0; z-index: 5; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.gantt-corner { position: sticky; left: 0; z-index: 6; background: var(--surface-2); border-right: 1px solid var(--border); flex: none; display: flex; align-items: flex-end; padding: 0 10px 7px; font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.gantt-bodyrow { display: flex; }
.gantt-labels { position: sticky; left: 0; z-index: 4; background: var(--surface); border-right: 1px solid var(--border); flex: none; }
.gantt-chart { flex: none; }
.gantt-head-svg, .gantt-body-svg { display: block; }
.g-label { display: flex; align-items: center; gap: 6px; padding: 0 8px 0 10px; border-bottom: 1px solid var(--border); font-size: 12.5px; min-width: 0; white-space: nowrap; }
.g-label-group { background: var(--surface-2); padding: 0 6px 0 2px; font-weight: 600; }
.g-toggle { display: flex; align-items: center; gap: 6px; width: 100%; height: 100%; border: 0; background: none; padding: 0 4px; font-weight: 600; min-width: 0; text-align: left; }
.g-group-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.g-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.g-meta { font-size: 11.5px; color: var(--text-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.g-label-wp { padding-left: 26px; }
.g-label-ms { padding-left: 26px; }
.g-label.late .g-name { color: var(--bad); }
.g-crit-ico { color: var(--crit); display: flex; }
.g-late-ico { color: #fff; background: var(--bad); border-radius: 50%; width: 15px; height: 15px; font-size: 10px; font-weight: 700; display: grid; place-items: center; flex: none; }
.g-swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; display: inline-block; }
.g-month { font-size: 11.5px; font-weight: 600; fill: var(--text); }
.g-kw { font-size: 10.5px; fill: var(--text-2); font-variant-numeric: tabular-nums; }
.g-month-sep { stroke: var(--border-strong); stroke-width: 1; }
.g-week-sep { stroke: var(--border); stroke-width: 1; }
.g-today-head { fill: var(--accent); opacity: 0.25; }
.g-row-group { fill: var(--surface-2); }
.g-row-line { stroke: var(--border); stroke-width: 1; }
.g-weekend { fill: var(--weekend); }
.g-holiday { fill: var(--holiday); }
.g-absence { fill: var(--absence); }
.g-today { stroke: var(--accent); stroke-width: 2; }
.g-ms-line { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.45; }
.g-bar .g-bar-bg { opacity: 0.28; }
.g-bar .g-bar-fill { opacity: 0.95; }
.g-bar .g-bar-outline { fill: none; stroke: color-mix(in srgb, var(--text) 25%, transparent); stroke-width: 1; }
.g-bar.crit .g-bar-outline { stroke: var(--crit); stroke-width: 2; }
.g-bar.late .g-bar-outline { stroke: var(--bad); stroke-width: 2; stroke-dasharray: 4 2; }
.g-bar.done .g-bar-fill { opacity: 0.55; }
.g-bar.draggable { cursor: grab; }
.g-bar.dragging { cursor: grabbing; opacity: 0.85; }
.g-bar .g-handle { fill: transparent; cursor: ew-resize; }
.g-bar.draggable:hover .g-handle { fill: color-mix(in srgb, var(--text) 30%, transparent); }
.g-late-line { stroke: var(--bad); stroke-width: 2; stroke-dasharray: 2 3; }
.g-bar-text { font-size: 11px; fill: var(--text-2); font-variant-numeric: tabular-nums; pointer-events: none; }
.g-phase-bg { opacity: 0.25; }
.g-phase-fill { opacity: 0.9; }
.g-dep { fill: none; stroke: var(--text-3); stroke-width: 1.2; opacity: 0.75; }
.g-dep.crit { stroke: var(--crit); stroke-width: 1.8; opacity: 1; }
.g-dep.conflict { stroke: var(--bad); stroke-dasharray: 3 2; }
.g-arrowhead { fill: var(--text-3); }
.g-arrowhead.crit { fill: var(--crit); }
.g-ms path, .g-ms-mini path { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.g-ms { cursor: pointer; }
.g-ms.ext path, .g-ms-mini.ext path { fill: var(--accent); }
.g-ms.st-erreicht path, .g-ms-mini.st-erreicht path { fill: var(--ok); stroke: var(--ok); }
.g-ms.late path, .g-ms-mini.late path, .g-ms.st-gefahrdet path { stroke: var(--bad); }
.g-ms.late.ext path { fill: var(--bad); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 11.5px; color: var(--text-2); margin: 8px 2px 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.lg-bar { background: color-mix(in srgb, var(--accent) 28%, var(--surface)); box-shadow: inset 7px 0 0 var(--accent); }
.lg-crit { border: 2px solid var(--crit); }
.lg-late { border: 2px dashed var(--bad); }
.lg-ms, .lg-ext { width: 10px; height: 10px; transform: rotate(45deg); background: var(--accent); border-radius: 1px; }
.lg-int { width: 10px; height: 10px; transform: rotate(45deg); border: 2px solid var(--accent); }
.lg-done { width: 10px; height: 10px; transform: rotate(45deg); background: var(--ok); }
.lg-weekend { background: var(--surface-3); }
.lg-holiday { background: var(--holiday); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); }
.lg-absence { background: var(--absence); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.lg-today { width: 2px; height: 12px; background: var(--accent); }
.lg-plan { background: var(--border-strong); }
.lg-ist { background: var(--accent); }
.lg-cap { height: 0; border-top: 2px dashed var(--crit); }

/* Meilenstein-Zeitstrahl */
.tl-card { padding: 10px 14px 4px; }
.ms-timeline { display: block; overflow: visible; }
.tl-axis { stroke: var(--border-strong); stroke-width: 2; vector-effect: non-scaling-stroke; }
.tl-tick { stroke: var(--border-strong); vector-effect: non-scaling-stroke; }
.tl-month { font-size: 11px; fill: var(--text-2); }
.tl-today { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.tl-ms { cursor: pointer; }
.tl-ms .tl-diamond { fill: var(--surface); stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.tl-ms.ext .tl-diamond { fill: var(--accent); }
.tl-ms.st-erreicht .tl-diamond { fill: var(--ok); stroke: var(--ok); }
.tl-ms.late .tl-diamond { stroke: var(--bad); }
.tl-ms.late.ext .tl-diamond { fill: var(--bad); }
.tl-label { font-size: 11px; font-weight: 600; fill: var(--text); font-family: var(--mono); }
.tl-ms:focus { outline: none; }
.tl-ms:focus .tl-diamond { stroke-width: 4; }

/* ------------------------------------------------------------------ Kanban */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kb-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; min-height: 200px; max-height: calc(100vh - 200px); }
.kb-col.drop { border-color: var(--accent); background: var(--accent-weak); }
.kb-head { display: flex; align-items: center; gap: 7px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--border); }
.kb-head h2 { font-size: 12.5px; flex: 1; }
.kb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.kb-todo .kb-dot { background: var(--border-strong); }
.kb-doing .kb-dot { background: var(--accent); }
.kb-blocked .kb-dot { background: var(--bad); }
.kb-done .kb-dot { background: var(--ok); }
.kb-count { font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.kb-list { padding: 8px; display: flex; flex-direction: column; gap: 7px; overflow-y: auto; min-height: 60px; flex: 1; }
.kb-empty { font-size: 12px; color: var(--text-3); text-align: center; padding: 16px 4px; border: 1px dashed var(--border-strong); border-radius: 6px; }
.kb-card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px 8px; cursor: pointer; box-shadow: var(--shadow); border-left: 3px solid var(--border-strong); }
.kb-card:hover { border-color: var(--border-strong); }
.kb-card.prio-hoch { border-left-color: var(--bad); }
.kb-card.prio-mittel { border-left-color: var(--warn); }
.kb-card.prio-niedrig { border-left-color: var(--border-strong); }
.kb-card.dragging { opacity: 0.5; }
.kb-card.hl { outline: 2px solid var(--accent); }
.kb-card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.prio-tag { font-size: 10.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.prio-tag.prio-hoch { color: var(--bad); }
.kb-due { font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kb-due.soon { color: var(--warn); font-weight: 600; }
.kb-due.late { color: #fff; background: var(--bad); padding: 0 5px; border-radius: 3px; font-weight: 600; }
.kb-title { font-size: 13px; line-height: 1.35; word-break: break-word; }
.kb-meta { margin-top: 5px; }
.kb-wp { border: 0; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; padding: 1px 6px; border-radius: 3px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; text-align: left; }
.kb-wp:hover { color: var(--accent); }
.kb-owner { float: right; font-size: 11px; color: var(--text-3); margin-top: -18px; }

/* ------------------------------------------------------------------ Risiken */
.risk-top { display: grid; grid-template-columns: minmax(0, 520px) minmax(200px, 1fr); gap: 20px; padding: 14px; align-items: start; }
.risk-matrix { display: grid; grid-template-columns: 20px 1fr; grid-template-rows: 1fr auto; gap: 4px; }
.rm-ylabel { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 11.5px; color: var(--text-2); text-align: center; font-weight: 600; }
.rm-xlabel { grid-column: 2; text-align: center; font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.rm-grid { display: grid; grid-template-columns: 22px repeat(5, minmax(0, 1fr)); gap: 3px; }
.rm-axis { display: grid; place-items: center; font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 18px; }
.rm-cell { min-height: 72px; border-radius: 4px; padding: 4px; position: relative; cursor: pointer; display: flex; flex-direction: column; border: 2px solid transparent; }
.rm-cell.lvl-low { background: var(--lvl-low); }
.rm-cell.lvl-mid { background: var(--lvl-mid); }
.rm-cell.lvl-high { background: var(--lvl-high); }
.rm-cell.sel { border-color: var(--accent); }
.rm-score { font-size: 10px; color: var(--text-2); position: absolute; top: 3px; right: 5px; font-variant-numeric: tabular-nums; }
.rm-ids { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 14px; }
.rm-id { border: 0; background: var(--surface); color: var(--text); font-family: var(--mono); font-size: 11px; font-weight: 600; padding: 1px 4px; border-radius: 3px; box-shadow: var(--shadow); }
.rm-id:hover { color: var(--accent); }
.risk-side { display: flex; flex-direction: column; gap: 8px; }
.risk-lvl { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }

/* Anforderungen, Kapitel */
.req-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.req-sum-item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }
.req-sum-item .pbar { grid-column: 1 / -1; }
.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.pipe-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px; min-height: 80px; }
.pipe-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.pipe-final .pipe-head { color: var(--ok); }
.pipe-review .pipe-head { color: var(--accent); }
.pipe-count { font-variant-numeric: tabular-nums; }
.pipe-items { display: flex; flex-direction: column; gap: 5px; }
.pipe-item { display: flex; gap: 6px; align-items: center; border: 1px solid var(--border); background: var(--surface); border-radius: 5px; padding: 4px 6px; text-align: left; font-size: 12.5px; min-width: 0; }
.pipe-item:hover { border-color: var(--accent); }
.pipe-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Aufwand-Diagramm */
.chart-scroll { overflow-x: auto; }
.effort-chart { display: block; }
.ec-grid { stroke: var(--border); stroke-width: 1; }
.ec-base { stroke: var(--border-strong); stroke-width: 1; }
.ec-axis { font-size: 10.5px; fill: var(--text-2); font-variant-numeric: tabular-nums; }
.ec-axis.cur { fill: var(--accent); font-weight: 700; }
.ec-plan { fill: var(--border-strong); }
.ec-ist { fill: var(--accent); }
.ec-ist.over { fill: var(--crit); }
.ec-cap { stroke: var(--crit); stroke-width: 1.5; stroke-dasharray: 5 4; }
.ec-cap-label { font-size: 10.5px; fill: var(--crit); }
.ec-current { fill: var(--accent-weak); }

/* ------------------------------------------------------------------ Leserolle */
body.readonly .g-bar { cursor: pointer; }

/* ------------------------------------------------------------------ Responsiv */
@media (max-width: 1200px) {
  .kpis-dash { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 260px; transform: translateX(-102%); transition: transform 0.18s ease; box-shadow: var(--shadow-lg); visibility: hidden; }
  body.drawer-open .sidebar { transform: none; visibility: visible; }
  .only-mobile { display: inline-grid !important; }
  .topbar { padding: 0 8px; gap: 4px; }
  .view { padding: 12px 12px 40px; }
  .banner { padding: 6px 12px; }
  .panel { width: 100vw; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .risk-top { grid-template-columns: minmax(0, 1fr); }
  .btn-search { min-width: 0; }
}
@media (max-width: 640px) {
  :root { --fs: 13.5px; }
  .hide-sm { display: none !important; }
  .kpis, .kpis-dash { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 8px 10px; }
  .kpi-value { font-size: 17px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-grid .span-2 { grid-column: auto; }
  .req-summary, .pipeline { grid-template-columns: minmax(0, 1fr); }
  .input-search { width: 100%; flex: 1 1 160px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .view-title { font-size: 15px; }
  .btn-search { width: 32px; padding: 0; justify-content: center; border-color: transparent; }
  .tbl-scroll { max-height: none; }
  .gantt-scroll { max-height: calc(100vh - 250px); }
  .kanban { grid-template-columns: repeat(5, 82vw); scroll-snap-type: x mandatory; }
  .kb-col { scroll-snap-align: start; max-height: none; }
  .rm-cell { min-height: 54px; }
  .hbar-list li { grid-template-columns: 100px 1fr 52px; }
  table.grid td.act .btn-icon { opacity: 1; }
}
@media (hover: none) {
  table.grid td.act .btn-icon { opacity: 1; }
}

/* ------------------------------------------------------------------ Druck (A4 quer) */
.print-root { display: none; }
@page { size: A4 landscape; margin: 10mm; }
@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --surface-2: #f2f3f5; --surface-3: #e6e8eb; --border: #cfd4da; --border-strong: #aab2bb;
    --text: #000; --text-2: #333; --text-3: #555; --accent: #1d5bd0; --accent-weak: #e7eefb;
    color-scheme: light;
  }
  html, body { height: auto; background: #fff; font-size: 10.5px; }
  body > *:not(.print-root) { display: none !important; }
  .print-root { display: block; }
  .print-head { display: flex; justify-content: space-between; border-bottom: 1px solid #000; padding-bottom: 4px; margin-bottom: 8px; font-size: 11px; }
  .print-section h2 { font-size: 13px; margin: 0 0 6px; }
  .print-break { break-before: page; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  .kpis-dash { grid-template-columns: repeat(5, 1fr); }
  .dash-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .dash-grid .span-2 { grid-column: span 2; }
  .card-body { padding: 6px 8px; }
  .card-head { padding: 5px 8px; }
  .btn, .btn-icon { display: none !important; }
  .link-id { color: #000; }
  .gantt-scroll.print { overflow: visible; max-height: none; border: 1px solid #aab2bb; }
  .gantt-scroll.print .gantt-head, .gantt-scroll.print .gantt-corner, .gantt-scroll.print .gantt-labels { position: static; }
  .g-label { font-size: 9.5px; }
  .static-table { font-size: 9.5px; }
  .static-table th, .static-table td { padding: 3px 5px; }
  .static-table tr { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
