/* Ressourcenplanung – ruhiges, helles Design mit einer Akzentfarbe */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --text: #17202b;
  --muted: #6b7685;
  --line: #e4e8ee;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e6f4f2;
  --ok: #15803d;   --ok-bg: #e7f6ec;
  --warn: #a16207; --warn-bg: #fdf3d7;
  --bad: #b42318;  --bad-bg: #fde7e4;
  --none: #6b7685; --none-bg: #f0f2f5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1419; --surface: #171d25; --surface-2: #1c232d; --text: #e6ebf1; --muted: #94a0b0; --line: #2a3440;
    --accent: #2dd4bf; --accent-ink: #0b1714; --accent-soft: #15302c;
    --ok-bg: #163524; --warn-bg: #3a2f12; --bad-bg: #3b1a17; --none-bg: #222a34;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1419; --surface: #171d25; --surface-2: #1c232d; --text: #e6ebf1; --muted: #94a0b0; --line: #2a3440;
  --accent: #2dd4bf; --accent-ink: #0b1714; --accent-soft: #15302c;
  --ok-bg: #163524; --warn-bg: #3a2f12; --bad-bg: #3b1a17; --none-bg: #222a34;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
input, select, button, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 15px; font-weight: 650; margin: 24px 0 10px; }
.muted { color: var(--muted); font-size: 13px; }
.msg { font-size: 13px; min-height: 1em; }
.msg.err { color: var(--bad); }
.msg.ok { color: var(--ok); }

/* Layout: Seitenleiste + Inhalt */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.shell:has(#top[hidden]) { grid-template-columns: 1fr; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand strong { display: block; font-size: 15px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; }
.beta { display: inline-block; margin-left: 6px; font-size: 10px; letter-spacing: .04em; background: var(--warn-bg); color: var(--warn); padding: 1px 5px; border-radius: 4px; vertical-align: middle; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
nav a:hover { background: var(--surface-2); color: var(--text); }
nav a.active { background: var(--accent-soft); color: var(--accent); }
nav a .ico { width: 18px; text-align: center; }
.me { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.me .who { color: var(--muted); margin-bottom: 8px; word-break: break-word; }
.me-actions { display: flex; gap: 6px; flex-wrap: wrap; }
main { padding: 26px 28px 60px; min-width: 0; max-width: 1400px; width: 100%; }
.shell:has(#top[hidden]) main { margin: 0 auto; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }

/* Karten & Bausteine */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 12px 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .v { font-size: 24px; font-weight: 650; letter-spacing: -.01em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12px; }
.kpi.alert .v { color: var(--bad); }

label { display: inline-flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 550; color: var(--muted); }
label.row { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; font-weight: 500; }
input, select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type="number"] { width: 100px; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.grid { display: grid; gap: 12px; }

button { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 550; }
button:hover { filter: brightness(1.05); }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.ghost:hover { color: var(--text); }
button.danger { background: var(--bad); color: #fff; }
button.small { padding: 4px 9px; font-size: 13px; }
button.primary { background: var(--accent); }

/* Tabellen */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-weight: 600; color: var(--muted); font-size: 12px; background: var(--surface-2); position: sticky; top: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.name { font-weight: 550; }
td.sticky, th.sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; }
th.sticky { background: var(--surface-2); }

/* Auslastung */
.u { display: inline-block; min-width: 56px; text-align: center; border-radius: 6px; padding: 2px 6px; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.u.ok { background: var(--ok-bg); color: var(--ok); }
.u.warn { background: var(--warn-bg); color: var(--warn); }
.u.bad { background: var(--bad-bg); color: var(--bad); }
.u.none { background: var(--none-bg); color: var(--none); font-weight: 400; }
.sub { display: block; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--none-bg); color: var(--muted); }
.tag.bill { background: var(--ok-bg); color: var(--ok); }

/* Planungsraster */
.matrix td.cell { text-align: center; cursor: pointer; min-width: 84px; }
.matrix td.cell:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.cell .h { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }
.cell .p { display: block; font-size: 11px; color: var(--muted); }
.cell.ok { background: var(--ok-bg); }
.cell.warn { background: var(--warn-bg); }
.cell.bad { background: var(--bad-bg); }
.cell.none { color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 10px 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Buttons Hauptaktion */
.btn { border-radius: 9px; }
.btn.primary { padding: 9px 16px; }

/* Assistent */
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); max-width: min(680px, 96vw); width: 100%; }
dialog::backdrop { background: rgba(10,15,20,.45); }
.wiz { width: min(680px, 96vw); }
#wizBody { padding: 22px; }
.steps { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.steps .s { display: flex; align-items: center; gap: 6px; }
.steps .n { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-weight: 600; }
.steps .s.on { color: var(--text); }
.steps .s.on .n { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.steps .s.done .n { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.steps .line { flex: 1; height: 1px; background: var(--line); }
.wiz h3 { font-size: 18px; margin: 0 0 4px; letter-spacing: -.01em; }
.wiz .sub2 { color: var(--muted); margin: 0 0 16px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; color: var(--text); font-weight: 400; }
.choice:hover { border-color: var(--accent); }
.choice .t { font-weight: 650; font-size: 15px; display: block; margin-bottom: 4px; }
.choice .d { color: var(--muted); font-size: 13px; }
.choice .ic { font-size: 20px; color: var(--accent); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fields .full { grid-column: 1 / -1; }
.fields label { width: 100%; }
.fields input, .fields select, .fields textarea { width: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.preview { margin-top: 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.preview .sum { font-size: 13px; margin-bottom: 8px; }
.preview table th, .preview table td { padding: 6px 8px; }
.wiz-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; align-items: center; }
.wiz-foot .right { display: flex; gap: 8px; }

/* Login */
.login { max-width: 360px; margin: 12vh auto; }

details.project { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; box-shadow: var(--shadow); }
details.project > summary { padding: 13px 16px; cursor: pointer; font-weight: 600; list-style: none; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
details.project > summary::-webkit-details-marker { display: none; }
details.project .inner { padding: 0 16px 16px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 10px; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .me { margin-top: 0; border-top: 0; padding: 0; margin-left: auto; display: flex; gap: 8px; align-items: center; }
  .me .who { margin: 0; }
  main { padding: 16px 14px 40px; }
  .choices, .fields { grid-template-columns: 1fr; }
  th, td { padding: 6px; font-size: 12.5px; }
}
