:root {
  --marke: #0b5cad;          /* wird von brand.css (aus dem NK-Logo) ueberschrieben */
  --marke-text: #ffffff;
  --marke-hell: #e8f1fb;
  --bg: #f4f6f9;
  --karte: #ffffff;
  --text: #15202b;
  --leise: #556270;
  --rand: #d9e0e7;
  --ok: #157a3a;
  --ok-hell: #e6f4ea;
  --warn: #8a5a00;
  --warn-hell: #fff4d6;
  --rot: #b42318;
  --rot-hell: #fdecea;
  --pause: #8a4b00;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a; --karte: #18202a; --text: #e8edf2; --leise: #a5b1bd; --rand: #2c3845;
    --marke-hell: #16283b; --ok: #4ade80; --ok-hell: #12301f; --warn: #fbbf24; --warn-hell: #33290f;
    --rot: #f87171; --rot-hell: #3a1717; --pause: #fdba74;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.45; }
a { color: var(--marke); }
@media (prefers-color-scheme: dark) { a { color: #8cc4ff; } }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--karte); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 10px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
.leise { color: var(--leise); }
.klein { font-size: 13px; color: var(--leise); }
.fehler { color: var(--rot); min-height: 1.2em; margin: 6px 0; font-size: 14px; }
:focus-visible { outline: 3px solid var(--marke); outline-offset: 2px; }

/* Formulare */
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 5px; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid var(--rand); border-radius: 10px; background: var(--karte); color: var(--text); }
textarea { min-height: 70px; resize: vertical; }
.reihe { display: flex; gap: 10px; flex-wrap: wrap; }
.reihe > * { flex: 1 1 140px; }
.haken { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 12px 0; cursor: pointer; }
.haken input { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--marke); }
.tage-wahl { display: flex; gap: 6px; flex-wrap: wrap; }
.tage-wahl label { margin: 0; display: flex; align-items: center; gap: 4px; font-weight: 500; border: 1px solid var(--rand); border-radius: 8px; padding: 6px 9px; }
.tage-wahl input { width: 18px; height: 18px; accent-color: var(--marke); }

/* Knoepfe */
.knopf { font: inherit; font-weight: 700; font-size: 15px; border-radius: 10px; padding: 11px 16px; border: 1px solid var(--rand); background: var(--karte); color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; }
.knopf:hover { border-color: var(--marke); }
.knopf.haupt { background: var(--marke); border-color: var(--marke); color: var(--marke-text); }
.knopf.gruen { background: var(--ok); border-color: var(--ok); color: #fff; }
.knopf.rot { background: var(--rot); border-color: var(--rot); color: #fff; }
@media (prefers-color-scheme: dark) { .knopf.gruen, .knopf.rot { color: #0f141a; } }
.knopf.breit { width: 100%; }
.knopf.klein-k { min-height: 38px; padding: 7px 12px; font-size: 14px; }
.knopf:disabled { opacity: .55; cursor: default; }
.knopf-reihe { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-karte { background: var(--karte); border: 1px solid var(--rand); border-radius: 18px; padding: 26px 22px; width: 100%; max-width: 400px; box-shadow: 0 8px 30px rgba(0,0,0,.06); }
.login-logo { display: block; max-width: 220px; max-height: 90px; margin: 0 auto 16px; }
.login h1 { text-align: center; font-size: 22px; }
.login .leise { text-align: center; }
.login .knopf { margin-top: 14px; }

/* Kopf + Reiter */
.kopf { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--karte); border-bottom: 1px solid var(--rand); }
.kopf-logo { height: 36px; max-width: 110px; object-fit: contain; }
.kopf-text { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: 13px; color: var(--leise); }
.kopf-text b { color: var(--text); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menue { position: absolute; right: 12px; top: 58px; background: var(--karte); border: 1px solid var(--rand); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: 6px; display: flex; flex-direction: column; min-width: 200px; }
.menue[hidden] { display: none; }
.menue button, .menue a { font: inherit; text-align: left; background: none; border: 0; color: var(--text); padding: 11px 12px; border-radius: 8px; cursor: pointer; text-decoration: none; }
.menue button:hover, .menue a:hover { background: var(--marke-hell); }
.reiter { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; background: var(--karte); border-top: 1px solid var(--rand); padding-bottom: env(safe-area-inset-bottom); }
.reiter button { flex: 1; font: inherit; font-size: 11.5px; font-weight: 600; background: none; border: 0; color: var(--leise); padding: 8px 2px 9px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; min-height: 56px; position: relative; }
.reiter button .sym { font-size: 21px; line-height: 1; }
.reiter button[aria-current="page"] { color: var(--marke); }
@media (prefers-color-scheme: dark) { .reiter button[aria-current="page"] { color: #8cc4ff; } }
.reiter button[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: currentColor; }
.punkt-zahl { position: absolute; top: 4px; left: calc(50% + 8px); background: var(--rot); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 5px; min-width: 18px; line-height: 18px; }
@media (prefers-color-scheme: dark) { .punkt-zahl { color: #0f141a; } }
main#inhalt { max-width: 860px; margin: 0 auto; padding: 16px 16px 96px; outline: none; }
@media (min-width: 760px) {
  .reiter { position: sticky; top: 57px; bottom: auto; border-top: 0; border-bottom: 1px solid var(--rand); justify-content: center; padding: 0 12px; }
  .reiter button { flex: 0 0 auto; flex-direction: row; font-size: 14.5px; padding: 12px 16px; min-height: 48px; gap: 7px; }
  .reiter button .sym { font-size: 17px; }
  .reiter button[aria-current="page"]::before { top: auto; bottom: 0; left: 10px; right: 10px; border-radius: 3px 3px 0 0; }
  .punkt-zahl { top: 6px; left: auto; right: 2px; }
  main#inhalt { padding-bottom: 40px; }
}

/* Karten */
.karte { background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.karte-kopf { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.karte-kopf h2 { margin: 0; }
.zahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.zahl { background: var(--karte); border: 1px solid var(--rand); border-radius: 12px; padding: 12px 14px; }
.zahl small { display: block; color: var(--leise); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.zahl b { font-size: 22px; font-variant-numeric: tabular-nums; }
.zahl span { display: block; color: var(--leise); font-size: 13px; }

/* Stempeln */
.stempel { text-align: center; padding: 22px 16px; }
.zustand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; border-radius: 999px; padding: 6px 14px; font-size: 14px; }
.zustand.aus { background: var(--bg); color: var(--leise); }
.zustand.arbeit { background: var(--ok-hell); color: var(--ok); }
.zustand.pause { background: var(--warn-hell); color: var(--pause); }
.zustand::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.uhr { font-size: 46px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 12px 0 2px; letter-spacing: -.02em; }
.uhr-dez { font-size: 15px; color: var(--leise); font-variant-numeric: tabular-nums; }
.stempel .objekt-name { font-weight: 700; margin-top: 8px; }
.gross { font-size: 19px; min-height: 64px; border-radius: 14px; }
.stempel-knoepfe { display: grid; gap: 10px; margin-top: 18px; }
.stempel-knoepfe.zwei { grid-template-columns: 1fr 1fr; }
.stempel select { text-align: left; }

/* Listen */
.liste { display: flex; flex-direction: column; gap: 8px; }
.eintrag { background: var(--karte); border: 1px solid var(--rand); border-radius: 12px; padding: 12px 14px; }
.eintrag-kopf { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.eintrag-kopf b { font-size: 15.5px; }
.std { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.iv { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 7px 0; border-top: 1px dashed var(--rand); font-size: 14.5px; }
.iv:first-of-type { margin-top: 6px; }
.iv .zeit { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 104px; }
.iv .was { flex: 1 1 120px; color: var(--leise); min-width: 0; overflow-wrap: anywhere; }
.iv .dez { font-variant-numeric: tabular-nums; }
.iv-knopf { font: inherit; font-size: 13px; font-weight: 600; background: none; border: 1px solid var(--rand); color: var(--text); border-radius: 8px; padding: 6px 10px; cursor: pointer; min-height: 36px; }
.iv-knopf:hover { border-color: var(--marke); }
.marke { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 7px; background: var(--bg); color: var(--leise); }
.marke.ok { background: var(--ok-hell); color: var(--ok); }
.marke.warn { background: var(--warn-hell); color: var(--warn); }
.marke.rot { background: var(--rot-hell); color: var(--rot); }
.marke.blau { background: var(--marke-hell); color: var(--marke); }
@media (prefers-color-scheme: dark) { .marke.blau { color: #8cc4ff; } }
.hinweis { background: var(--warn-hell); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 8px 0; }
.hinweis.info { background: var(--marke-hell); color: var(--text); }
.leer { text-align: center; color: var(--leise); padding: 24px 10px; }
.monat-wahl { display: flex; align-items: center; gap: 8px; }
.monat-wahl input { width: auto; padding: 8px 10px; }
.tabelle-wrap { overflow-x: auto; }
table.tab { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.tab th, table.tab td { padding: 9px 8px; border-bottom: 1px solid var(--rand); text-align: left; vertical-align: top; }
table.tab th { font-size: 12.5px; color: var(--leise); text-transform: uppercase; letter-spacing: .03em; }
table.tab .z { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tab tr.klickbar { cursor: pointer; }
table.tab tr.klickbar:hover td { background: var(--marke-hell); }
.unter-reiter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.unter-reiter button { font: inherit; font-weight: 600; font-size: 14px; border: 1px solid var(--rand); background: var(--karte); color: var(--text); border-radius: 999px; padding: 8px 14px; cursor: pointer; min-height: 40px; }
.unter-reiter button[aria-pressed="true"] { background: var(--marke); border-color: var(--marke); color: var(--marke-text); }
.passwort-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; font-weight: 700; letter-spacing: .04em; background: var(--marke-hell); border-radius: 10px; padding: 12px; text-align: center; margin: 10px 0; user-select: all; }

/* Mobile-Tabellen als Karten */
@media (max-width: 640px) {
  table.tab.karten thead { display: none; }
  table.tab.karten, table.tab.karten tbody, table.tab.karten tr, table.tab.karten td { display: block; width: 100%; }
  table.tab.karten tr { border: 1px solid var(--rand); border-radius: 12px; margin-bottom: 8px; padding: 6px 4px; background: var(--karte); }
  table.tab.karten td { border: 0; padding: 4px 10px; text-align: left; }
  table.tab.karten td[data-l]::before { content: attr(data-l) ": "; color: var(--leise); font-size: 13px; }
  table.tab.karten td.z { text-align: left; }
}

/* Dialog + Toast */
dialog { border: 1px solid var(--rand); border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 24px)); background: var(--karte); color: var(--text); }
dialog::backdrop { background: rgba(10,15,20,.55); }
dialog form { padding: 18px; max-height: calc(100vh - 40px); overflow-y: auto; }
.dlg-knoepfe { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px); opacity: 0; background: #15202b; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14.5px; transition: .2s; pointer-events: none; z-index: 60; max-width: calc(100vw - 32px); }
.toast.an { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.fehler-t { background: #b42318; }
@media (min-width: 760px) { .toast { bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .kopf, .reiter, .knopf { display: none !important; } }
