/* Nenok Leitstand - Apple-HIG-Stil, hell. Lokal, ohne Inline-Style (CSP: style-src 'self'). */
:root {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --label: #1c1c1e;
  --label-2: rgba(60, 60, 67, .62);
  --label-3: rgba(60, 60, 67, .36);
  --sep: rgba(60, 60, 67, .16);
  --fill: rgba(118, 118, 128, .12);
  --nenok: #f39000;
  --nenok-ink: #b86a00;
  --nenok-soft: #fff3e0;
  --anthrazit: #454545;
  --veyno: #2563eb;
  --veyno-soft: #eaf1fe;
  --green: #34c759; --green-ink: #1f7a37; --green-soft: #e6f7ea;
  --yellow: #ffcc00; --yellow-ink: #8a6500; --yellow-soft: #fff7d6;
  --red: #ff3b30; --red-ink: #c4241b; --red-soft: #ffe8e6;
  --spring: cubic-bezier(.32, .72, 0, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--label); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; letter-spacing: -.005em; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-size: 34px; font-weight: 700; letter-spacing: -.022em; line-height: 1.12; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -.016em; }
h3 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin-top: 18px; }
h2 + h3 { margin-top: 12px; }
p { margin: 0 0 10px; }
a { color: var(--nenok-ink); text-decoration-color: rgba(184, 106, 0, .4); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
code, pre { font-family: var(--mono); font-size: 13px; }
code { background: var(--fill); border-radius: 5px; padding: 1px 5px; }
pre { background: var(--bg); border-radius: 12px; padding: 12px 14px; overflow: auto; margin: 8px 0; }
ul, ol { padding-left: 1.3em; margin: 8px 0; }
small { font-size: 12.5px; }
.muted { color: var(--label-2); }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid rgba(243, 144, 0, .55); outline-offset: 2px; border-radius: 8px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Seitenleiste ---------- */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 18px 12px 14px; display: flex; flex-direction: column; gap: 20px;
  background: rgba(246, 246, 248, .9); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-right: 1px solid var(--sep); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.mark { width: 36px; height: 36px; border-radius: 9px; background: var(--anthrazit); display: grid; place-items: center; flex: none; }
.mark svg { width: 26px; height: 26px; }
.brand b { display: block; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.brand b em { font-style: normal; color: var(--nenok); }
.brand span { font-size: 12.5px; color: var(--label-2); }
.navgroup { display: flex; flex-direction: column; gap: 1px; }
.cap { font-size: 11.5px; font-weight: 600; color: var(--label-2); }
.navgroup .cap { padding: 0 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; text-decoration: none; color: var(--label); font-weight: 500; transition: background-color .25s ease, color .25s ease; }
.nav a svg { color: var(--nenok); }
.nav a:hover { background: var(--fill); }
.nav a[aria-current="page"] { background: var(--nenok); color: #fff; }
.nav a[aria-current="page"] svg { color: #fff; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.userbox { display: flex; flex-direction: column; gap: 6px; padding: 0 6px; align-items: flex-start; }
.userbox .who { font-size: 13.5px; font-weight: 500; word-break: break-all; }
.userbox form { margin: 0; }
.veyno { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--sep); }
.veyno .dot { width: 30px; height: 30px; border-radius: 50%; background: var(--veyno); display: grid; place-items: center; flex: none; }
.veyno .dot svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.veyno small { display: block; font-size: 11px; color: var(--label-2); line-height: 1.2; }
.veyno b { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }

/* ---------- Inhalt ---------- */
main { padding: 34px 40px 56px; min-width: 0; max-width: 1240px; }
main.plain { max-width: none; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.view { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.head p { margin: 8px 0 0; color: var(--label-2); max-width: 64ch; font-size: 16px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--nenok-ink); margin-bottom: 4px; }
.head p.statusline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--label); font-size: 15px; }
.card { background: var(--surface); border-radius: 16px; padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.04); margin: 0; min-width: 0; }
.card > *:last-child { margin-bottom: 0; }
.narrow { width: min(420px, 100%); }
.narrow h1 { font-size: 28px; margin: 18px 0 14px; }
.stack-y { display: flex; flex-direction: column; gap: 18px; }
.section-cap { font-size: 13px; color: var(--label-2); text-transform: uppercase; letter-spacing: .02em; padding: 0 20px 7px; font-weight: 500; }
.empty { color: var(--label-2); text-align: center; padding: 40px 20px; }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.p-good { background: var(--green-soft); color: var(--green-ink); }
.p-warn { background: var(--yellow-soft); color: var(--yellow-ink); }
.p-bad { background: var(--red-soft); color: var(--red-ink); }
.p-plan { background: var(--fill); color: var(--label-2); }
.p-plan::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.p-ki { background: var(--veyno-soft); color: var(--veyno); }
.p-ki::before { display: none; }
.ph { display: inline-flex; align-items: center; font-size: 12.5px; color: var(--nenok-ink); background: var(--nenok-soft); border-radius: 999px; padding: 3px 10px; font-weight: 600; }

/* ---------- Flash ---------- */
.flash { margin: 0; padding: 12px 16px; border-radius: 14px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.04), inset 4px 0 0 var(--label-3); }
.flash-success { background: var(--green-soft); box-shadow: inset 4px 0 0 var(--green); color: var(--green-ink); }
.flash-error { background: var(--red-soft); box-shadow: inset 4px 0 0 var(--red); color: #8f1a13; }
.flash-info { background: var(--veyno-soft); box-shadow: inset 4px 0 0 var(--veyno); color: #1b49b0; }
.flash h3 { margin-top: 0; }
.flash p:last-child { margin-bottom: 0; }
.flash label { color: var(--label); }

/* ---------- Formulare ---------- */
label { display: block; font-weight: 500; margin-bottom: 14px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  display: block; width: 100%; margin-top: 6px; border: 0; background: var(--fill); border-radius: 10px; padding: 9px 12px; color: var(--label); font: inherit; font-weight: 400; }
input[type="date"], select { width: auto; min-width: 9rem; }
textarea { resize: vertical; line-height: 1.45; }
textarea.code, .code { font-family: var(--mono); font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(243, 144, 0, .45); outline-offset: 0; background: #fff; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--nenok); width: 18px; height: 18px; margin: 0 8px 0 0; vertical-align: -3px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
fieldset label { font-weight: 400; margin-bottom: 8px; }
form.inline { display: inline-block; margin: 0 8px 0 0; }

button, a[role="button"] { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; padding: 8px 18px; background: var(--nenok); color: #fff; cursor: pointer; font: inherit; font-weight: 600; text-decoration: none; line-height: 1.3; transition: transform .35s var(--spring), box-shadow .3s ease, background-color .2s ease; }
button:hover, a[role="button"]:hover { background: #dc8200; }
button.small, a[role="button"].small { padding: 6px 14px; font-size: 13.5px; }
button.wide { width: 100%; padding: 10px 18px; margin-top: 4px; }
button.secondary, a[role="button"].secondary { background: var(--fill); color: var(--nenok-ink); }
button.secondary:hover, a[role="button"].secondary:hover { background: rgba(118,118,128,.2); }
button.contrast { background: var(--red-soft); color: var(--red-ink); }
button.contrast:hover { background: #ffd6d2; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.actions > form { margin: 0; }

/* ---------- Segment (Tabs, Zeitraum) ---------- */
.tabs, .seg-bar { display: inline-flex; flex-wrap: wrap; gap: 2px; background: var(--fill); border-radius: 10px; padding: 2px; align-self: flex-start; }
.tabs a[role="button"], .seg-bar a[role="button"] { background: none; color: var(--label); font-weight: 500; font-size: 13px; border-radius: 8px; padding: 5px 13px; }
.tabs a[role="button"]:hover, .seg-bar a[role="button"]:hover { background: rgba(118,118,128,.12); }
.tabs a[aria-current="page"], .seg-bar a[aria-current="page"] { background: #fff; font-weight: 600; box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04); }
.tabs .count { color: var(--label-2); margin-left: 3px; font-variant-numeric: tabular-nums; }

/* ---------- Filter ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; background: var(--surface); border-radius: 16px; padding: 14px 18px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.filters label { margin: 0; font-size: 13px; color: var(--label-2); min-width: 9rem; }
.filters label.check { min-width: 0; color: var(--label); font-size: 14px; padding-bottom: 9px; }
.dash-filters { gap: 12px 16px; }
.dash-filters label { min-width: 0; }

/* ---------- Tabellen / Listen ---------- */
.list { background: var(--surface); border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 11px 14px; border-top: 1px solid var(--sep); vertical-align: top; }
th { color: var(--label-2); font-weight: 500; font-size: 12.5px; white-space: nowrap; }
thead th { padding-top: 12px; padding-bottom: 8px; border-top: 0; }
.list tbody tr:hover td { background: rgba(118,118,128,.05); }
.card table { margin-top: 6px; }
.card table td, .card table th { padding-left: 4px; padding-right: 10px; }
table.kv th { width: 12rem; font-size: 14px; }
table.kv tr:first-child th, table.kv tr:first-child td { border-top: 0; }
.pager { color: var(--label-2); font-size: 14px; display: flex; gap: 14px; align-items: center; margin: 0; padding: 0 6px; }
.pager a { font-weight: 600; }

pre.mailtext { white-space: pre-wrap; word-break: break-word; max-height: 28rem; overflow: auto; margin: 0; }

/* ---------- details / summary ---------- */
details { margin: 10px 0 0; }
summary { cursor: pointer; font-weight: 500; list-style: none; display: flex; gap: 8px; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--label-3); border-bottom: 2px solid var(--label-3); transform: rotate(-45deg); transition: transform .35s var(--spring); flex: none; margin: 0 4px 0 2px; }
details[open] > summary::before { transform: rotate(45deg); }
summary:hover { color: var(--nenok-ink); }
.chart-card details { margin-top: 12px; border-top: 1px solid var(--sep); padding-top: 12px; font-size: 14px; }
.chart-card details table { font-size: 13.5px; }
ol.history { list-style: none; padding-left: 0; margin: 0; }
ol.history li { padding: 12px 0; border-top: 1px solid var(--sep); }
ol.history li:first-child { border-top: 0; padding-top: 4px; }
ol.history .when { color: var(--label-2); margin-right: 8px; font-variant-numeric: tabular-nums; font-size: 13.5px; }
ol.history details { margin-top: 4px; font-size: 13px; color: var(--label-2); }
.card > details { padding: 10px 0; border-top: 1px solid var(--sep); margin: 0; }
.card > h2 + details { border-top: 0; }

/* ---------- Einstellungen (Inset Grouped) ---------- */
.group { background: var(--surface); border-radius: 14px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
details.setting { margin: 0; position: relative; }
details.setting + details.setting::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; border-top: 1px solid var(--sep); }
details.setting > summary { padding: 13px 18px; min-height: 50px; }
details.setting > summary:hover { background: rgba(118,118,128,.05); }
.st-title { font-weight: 600; flex: 1; min-width: 0; }
.st-tags { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.st-body { padding: 4px 18px 18px 36px; }
.st-body details { margin-top: 12px; }
.st-body .flash { margin-bottom: 12px; }
.plain-sum { font-size: 13.5px; color: var(--label-2); }

/* ---------- Dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 4px; }
.tile-value { font-size: 34px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; margin: 0; }
.tile-label { margin: 0; font-size: 13px; color: var(--label-2); }
.chart-card h2 { margin-bottom: 4px; }
.chart-card svg.chart { max-width: 100%; height: auto; display: block; margin-top: 12px; }

/* ---------- Anmeldung ---------- */
.login-brand { padding: 0; }
.login-veyno { margin-top: 22px; }

[hidden] { display: none !important; }

/* ---------- Bewegung ---------- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
  @keyframes grow { from { transform: scaleY(0); } }
  @keyframes growx { from { transform: scaleX(0); } }
  .view > * { animation: rise .7s var(--spring) both; }
  .view > *:nth-child(2) { animation-delay: .05s; }
  .view > *:nth-child(3) { animation-delay: .1s; }
  .view > *:nth-child(4) { animation-delay: .15s; }
  .view > *:nth-child(5) { animation-delay: .2s; }
  .view > *:nth-child(n+6) { animation-delay: .25s; }
  .tiles > * { animation: rise .65s var(--spring) both; }
  .tiles > *:nth-child(2) { animation-delay: .12s; }
  .tiles > *:nth-child(3) { animation-delay: .18s; }
  svg.chart path.bar { transform-box: fill-box; transform-origin: 50% 100%; animation: grow .9s var(--spring) both; animation-delay: .25s; }
  svg.chart path.bar:nth-of-type(2n) { animation-delay: .3s; }
  svg.chart path.bar:nth-of-type(3n) { animation-delay: .36s; }
  svg.chart rect.hbar { transform-box: fill-box; transform-origin: left center; animation: growx 1s var(--spring) both; animation-delay: .25s; }
  button:active, a[role="button"]:active { transform: scale(.965); }
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--sep); gap: 14px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .navgroup .cap { display: none; }
  main { padding: 22px 16px 40px; }
  h1 { font-size: 28px; }
  .st-body { padding-left: 18px; }
}

/* Korrekturen nach Sichtprüfung */
main.plain .view { width: min(420px, 100%); }
.narrow { width: 100%; }
.card > h2 { margin-bottom: 12px; }
.card > h2 + h3 { margin-top: 0; }
.list td a { color: var(--label); font-weight: 600; text-decoration: none; }
.list td a:hover { color: var(--nenok-ink); text-decoration: underline; }
.chart-card svg.chart { width: 100%; max-width: 900px; }
