/* Projektverwaltung – Oberfläche
   Bewusst nur Systemschriften: keine Verbindung zu externen Schriftdiensten (DSGVO). */
:root {
  --paper: #f3f5f7;
  --surface: #ffffff;
  --ink: #18212b;
  --muted: #5a6573;
  --line: #d6dce3;
  --accent: #1d5a9c;
  --accent-ink: #ffffff;
  --accent-soft: #e4edf7;
  --ok: #1f7a4d;
  --ok-soft: #e3f3ea;
  --warn: #9a6400;
  --warn-soft: #fbf0d9;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --nav: #16202b;
  --nav-ink: #c9d3de;
  --nav-active: #ffffff;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0f141a;
    --surface: #161d25;
    --ink: #e2e8ee;
    --muted: #98a4b1;
    --line: #2b3643;
    --accent: #6ea6e4;
    --accent-ink: #0f141a;
    --accent-soft: #1b2b3d;
    --ok: #5cc28f;
    --ok-soft: #15301f;
    --warn: #e2b04a;
    --warn-soft: #33290f;
    --bad: #f08a80;
    --bad-soft: #3a1a17;
    --nav: #0b1015;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
h1 { font-size: 24px; line-height: 1.25; margin: 0; font-weight: 650; text-wrap: balance; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 650; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.mono { font-family: var(--mono); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- Layout */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.sidebar { background: var(--nav); color: var(--nav-ink); padding: 18px 12px; display: flex; flex-direction: column; gap: 18px; }
.brand { padding: 4px 10px 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand strong { display: block; color: var(--nav-active); font-size: 15px; }
.brand span { font-size: 12px; opacity: .75; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; opacity: .6; padding: 0 10px 4px; }
.nav a { display: block; padding: 7px 10px; border-radius: var(--radius); color: var(--nav-ink); text-decoration: none; }
.nav a:hover { background: rgba(255,255,255,.07); color: var(--nav-active); }
.nav a.active { background: rgba(255,255,255,.12); color: var(--nav-active); font-weight: 600; }
.nav .soon { display: block; padding: 7px 10px; opacity: .45; }
.nav .soon small { font-size: 11px; }
.sidebar-foot { margin-top: auto; font-size: 13px; padding: 10px; border-top: 1px solid rgba(255,255,255,.08); display: grid; gap: 6px; }
.sidebar-foot a { color: var(--nav-ink); }
.linkbutton { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

main.content { padding: 28px max(16px, 3vw) 48px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stack { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; }
.tile b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 13px; }
a.tile:hover { border-color: var(--accent); }

/* -------------------------------------------------------------- Elemente */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 550; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-small { padding: 3px 10px; font-size: 13px; }

.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-muted { background: var(--paper); color: var(--muted); border: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

.messages { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.messages li { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.messages .success { border-color: var(--ok); background: var(--ok-soft); }
.messages .error { border-color: var(--bad); background: var(--bad-soft); }
.messages .warning { border-color: var(--warn); background: var(--warn-soft); }
.messages .info { border-color: var(--accent); background: var(--accent-soft); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: var(--paper); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--accent-soft); }
td.nowrap { white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

dl.props { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; overflow-wrap: anywhere; }

/* -------------------------------------------------------------- Formulare */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=search], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit;
}
.filters input, .filters select { width: auto; min-width: 180px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.field { display: grid; gap: 4px; align-content: start; }
.field > label { font-weight: 550; font-size: 14px; }
.field .help { font-size: 12.5px; color: var(--muted); }
.field .errors { color: var(--bad); font-size: 13px; margin: 0; padding: 0; list-style: none; }
.field.check { grid-template-columns: auto 1fr; align-items: center; column-gap: 8px; }
.field.check input { width: 18px; height: 18px; }
.field.check > label { font-weight: 450; }
.field.wide { grid-column: 1 / -1; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 650; font-size: 15px; margin-bottom: 10px; }
.form-errors { color: var(--bad); background: var(--bad-soft); border-radius: var(--radius); padding: 10px 14px; }
.form-foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ----------------------------------------------------------- Anmeldung */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)); }
.auth .panel { width: min(420px, 100%); padding: 28px; display: grid; gap: 16px; }
.auth-brand { font-size: 13px; color: var(--muted); letter-spacing: .04em; }
.qr { background: #fff; padding: 10px; border-radius: var(--radius); width: 220px; max-width: 100%; justify-self: center; }
.qr svg { display: block; width: 100%; height: auto; }
.secret { font-family: var(--mono); letter-spacing: .08em; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; text-align: center; overflow-wrap: anywhere; }
ol.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* ------------------------------------------------- Projekte, Aufgaben */
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff;
  font-size: 12px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.contract { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 12px; font-weight: 700; letter-spacing: .03em;
  border: 1.5px solid var(--accent); color: var(--accent); white-space: nowrap; }
.contract-vob { background: var(--accent); color: var(--accent-ink); }
.prio-3 { color: var(--bad); font-weight: 700; }
.prio-1 { color: var(--muted); }
.overdue { color: var(--bad); font-weight: 600; }
.soon { color: var(--warn); font-weight: 600; }
tr.done td { color: var(--muted); }
tr.done td .title { text-decoration: line-through; }
.status-form { display: inline-flex; gap: 4px; }
.status-form select { width: auto; padding: 3px 6px; font-size: 13px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list li { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list .when { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13px; }
.month { margin: 22px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.notif-unread { font-weight: 600; }
.notif-level-warnung td:first-child { border-left: 3px solid var(--warn); }
.notif-level-eskalation td:first-child { border-left: 3px solid var(--bad); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inline-form .field { min-width: 180px; }
.comment { border-left: 3px solid var(--line); padding: 6px 12px; }
.comment p { margin: 4px 0 0; white-space: pre-line; }
.state-abgelaufen { color: var(--bad); font-weight: 600; }
.state-laeuft_ab { color: var(--warn); font-weight: 600; }

/* --------------------------------------------------------- Protokoll */
.changes { width: 100%; font-size: 13px; }
.changes td { padding: 4px 8px; border-bottom: 1px dashed var(--line); }
.changes .old { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1px; }
.changes .new { color: var(--ok); }
.hash { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; color: var(--muted); }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }

/* ---------------------------------------------------------- Schmal */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { padding: 12px max(16px, env(safe-area-inset-left, 0px)); gap: 10px; }
  .nav-group { flex-direction: row; flex-wrap: wrap; }
  .nav-label { display: none; }
  .sidebar-foot { margin-top: 0; flex-direction: row; display: flex; flex-wrap: wrap; gap: 12px; }
  dl.props { grid-template-columns: 1fr; }
  dl.props dt { margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
