/* ============================================================
   Karl-Log – Haupt-Stylesheet (Verbund-Framework, aus Karl-Zeit) (Hell & Dunkel)
   Themes über CSS-Variablen; data-theme="auto|light|dark" am <html>.
   ============================================================ */

:root {
  --bg:        #eef2f7;
  --bg-grad-1: #dbe6f3;
  --bg-grad-2: #f4f7fb;
  --surface:   #ffffff;
  --surface-2: #f6f8fb;
  --border:    #dde3ec;
  --text:      #1f2a37;
  --muted:     #6b7685;
  --primary:   #7c4a12;
  --primary-2: #96601c;
  --accent:    #b45309;
  --shadow:    0 8px 28px rgba(31, 59, 92, .10);
  --radius:    14px;

  --bk-go:    #16a34a;
  --bk-stop:  #dc2626;
  --bk-pause: #0ea5e9;
  --bk-dg:    #f59e0b;
  --bk-home:  #111827;
}

html[data-theme="dark"] {
  --bg:        #0f141b;
  --bg-grad-1: #131b26;
  --bg-grad-2: #0c1118;
  --surface:   #161d27;
  --surface-2: #1c2531;
  --border:    #2a3645;
  --text:      #e6ebf2;
  --muted:     #93a1b3;
  --primary:   #4f86c6;
  --primary-2: #3f6fa8;
  --accent:    #5aa2ff;
  --shadow:    0 8px 28px rgba(0, 0, 0, .45);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg:#0f141b; --bg-grad-1:#131b26; --bg-grad-2:#0c1118;
    --surface:#161d27; --surface-2:#1c2531; --border:#2a3645;
    --text:#e6ebf2; --muted:#93a1b3; --primary:#4f86c6; --primary-2:#3f6fa8;
    --accent:#5aa2ff; --shadow:0 8px 28px rgba(0,0,0,.45);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
}

/* ---------------- Auth (Login / Setup) ---------------- */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(160deg, var(--bg-grad-1), var(--bg-grad-2) 60%);
}
.auth-wrap { width: 100%; max-width: 420px; padding: 20px; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 30px 28px;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-mark {
  font-size: 26px; width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--primary); color: #fff;
}
.brand-name { font-size: 20px; font-weight: 700; }
.brand-sub  { color: var(--muted); font-size: 13px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.narrow { max-width: 420px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: 11px 12px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.input-icon { position: relative; }
.input-icon input { padding-right: 42px; }
.input-icon .ico {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; background: transparent;
  display: grid; place-items: center; color: var(--muted); cursor: default; font-size: 16px;
}
.input-icon .eye { cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--surface-2); color: var(--text);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn.block { width: 100%; }

.note { padding: 10px 12px; border-radius: 10px; font-size: 14px; margin: 0 0 12px; }
.note.ok   { background: #e7f6ec; color: #16653a; }
.note.err  { background: #fdeaea; color: #a31616; }
.note.warn { background: #fff4e0; color: #8a5a08; }
html[data-theme="dark"] .note.ok   { background: #14301f; color: #7ee2a8; }
html[data-theme="dark"] .note.err  { background: #3a1717; color: #ffb3b3; }
html[data-theme="dark"] .note.warn { background: #3a2c12; color: #ffd591; }

.muted { color: var(--muted); }
.section-h { margin: 8px 0 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

/* ---------------- App-Shell ---------------- */
body.app { display: grid; grid-template-columns: 78px 1fr; grid-template-rows: 56px 1fr; min-height: 100vh; }
.sidebar { grid-row: 1 / 3; grid-column: 1; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding-top: 10px; }
.side-brand { width: 46px; height: 46px; border-radius: 12px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 22px; margin-bottom: 14px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.side-link { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px; color: var(--muted); text-decoration: none; font-size: 10px; border-left: 3px solid transparent; }
.side-link .ic { font-size: 19px; }
.side-link:hover { color: var(--text); background: var(--surface-2); }
.side-link.on { color: var(--accent); border-left-color: var(--accent); background: var(--surface-2); }
.side-ver { margin-top: auto; padding: 8px 4px 10px; width: 100%; text-align: center; }
.ver-badge { display: inline-block; font-size: 10px; line-height: 1.2; color: var(--muted); text-decoration: none; padding: 4px 6px; border-radius: 8px; }
.ver-up { color: #fff; background: var(--accent); font-weight: 700; box-shadow: var(--shadow); }
.ver-up:hover { filter: brightness(1.08); }

.topbar { grid-row: 1; grid-column: 2; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.tb-title { font-weight: 600; }
.tb-left { display: flex; align-items: center; gap: 10px; }
.tb-ctx { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; background: #fff4e0; color: #8a5a08; padding: 4px 12px; border-radius: 20px; border: 1px solid #f0c97a; white-space: nowrap; }
html[data-theme="dark"] .tb-ctx { background: #3a2c12; color: #ffd591; border-color: #6b4f1a; }
.tb-ctx-form { display: inline; margin: 0; }
.tb-ctx-exit { font-size: 12px; font-weight: 600; cursor: pointer; background: transparent; border: 1px solid var(--err); color: var(--err); padding: 4px 10px; border-radius: 20px; }
.tb-ctx-exit:hover { background: var(--err); color: #fff; }
.linklike { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: var(--err); cursor: pointer; text-decoration: underline; }
.tb-right { display: flex; align-items: center; gap: 12px; }
.tb-clock { background: var(--surface-2); padding: 5px 10px; border-radius: 20px; font-variant-numeric: tabular-nums; border: 1px solid var(--border); }
.tb-work { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-work b { font-weight: 700; }
.tb-work .tw-leave { color: var(--accent); }
.tb-work.done { color: var(--muted); }
.tb-work.done .tw-rest b { color: #28c244; }
.tb-vac { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-vac b { font-weight: 700; }
@media (max-width: 760px) { .tb-work, .tb-vac { display: none; } }
.tb-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; display: grid; place-items: center; text-decoration: none; font-size: 16px; }
.tb-user { display: flex; align-items: center; gap: 7px; text-decoration: none; color: var(--text); padding: 4px 6px; border-radius: 9px; }
.tb-user:hover { background: var(--surface-2); }
.tb-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; border: 1px solid var(--border); }
.tb-name { font-size: 13px; }

.content { grid-row: 2; grid-column: 2; overflow: auto; }
.page-pad { padding: 22px 26px; }
.app-footer { padding: 16px 26px; margin-top: 8px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; text-align: center; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0 0; }
.welcome h1 { margin: 0 0 4px; font-size: 22px; }
h1 { font-size: 22px; }

/* ---------------- Kacheln ---------------- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 18px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.tile-wide { grid-column: span 2; }
.tile-full { grid-column: 1 / -1; }
.gold-star { color: #e3a008; cursor: help; filter: drop-shadow(0 0 1px rgba(227,160,8,.5)); font-size: .9em; }
.tile-h { font-weight: 600; margin-bottom: 12px; }
.tile-note { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.book-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bk { color: #fff; border: 0; border-radius: 12px; padding: 16px 6px; font-weight: 700; font-size: 13px; cursor: pointer; opacity: .92; }
.bk:disabled { opacity: .5; cursor: not-allowed; }
.bk-go { background: var(--bk-go); } .bk-stop { background: var(--bk-stop); }
.bk-pause { background: var(--bk-pause); } .bk-dg { background: var(--bk-dg); }
.bk-home { background: var(--bk-home); }

.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); }
.kv li:last-child { border-bottom: 0; }

.ampel { display: flex; flex-direction: column; gap: 6px; align-items: center; width: 40px; margin: 6px auto; background: #222; padding: 8px; border-radius: 12px; }
.ampel .dot { width: 18px; height: 18px; border-radius: 50%; background: #444; }
.ampel .dot.on { background: #f4c20d; box-shadow: 0 0 8px #f4c20d; }

/* ---------------- Karten-Links (Admin) ---------------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 18px; }
.card-link { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.card-link:hover { border-color: var(--accent); }
.card-link.disabled { opacity: .5; pointer-events: none; }
.cl-ic { font-size: 22px; }

/* ---------------- Tabs ---------------- */
.tabs { margin-top: 16px; }
.tab-heads { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-h { display: inline-block; background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; cursor: pointer; color: var(--muted); font-size: 14px; text-decoration: none; }
.tab-h:hover { color: var(--text); }
.tab-h.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab-heads { flex-wrap: wrap; }
.tab-pane { display: none; }
.tab-pane.on { display: block; }

.log-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-family: ui-monospace, monospace; font-size: 13px; margin: 12px 0; }
.changelog { padding-left: 18px; }
.changelog li { margin: 4px 0; }

/* Update-Box (installiert → verfügbar) */
.upd-head { display: flex; align-items: center; gap: 16px; background: var(--surface-2); border: 1px solid var(--border);
            border-radius: var(--radius); padding: 16px 20px; margin: 8px 0 14px; max-width: 520px; }
.upd-box { display: flex; flex-direction: column; gap: 2px; }
.upd-box span { font-size: 11px; letter-spacing: .06em; color: var(--muted); }
.upd-box b { font-size: 26px; }
.upd-box.upd-new b { color: var(--accent); }
.upd-arrow { font-size: 22px; color: var(--muted); }

/* Changelog-Karten */
.cl-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; }
.cl-h { font-weight: 700; margin-bottom: 4px; }
.cl-badge { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 11px;
            font-weight: 600; padding: 1px 8px; border-radius: 20px; margin-left: 6px; }
.cl-list { margin: 4px 0 0; padding-left: 18px; }
.cl-list li { margin: 2px 0; }
.hint { margin: 12px 0; }
.hint summary { cursor: pointer; color: var(--accent); }
.hint-list { padding-left: 20px; line-height: 1.7; }
.hint-list code { font-size: 12px; }
.tok { font-size: 11px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; user-select: all; word-break: break-all; }

/* ---------------- Phase 2: Buchen / Charts ---------------- */
.today-sum { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 14px; }
.tile-center { text-align: center; margin: 8px 0 0; }

/* Status-Textfarben */
.st-anwesend   { color: var(--bk-go); }
.st-abwesend   { color: var(--bk-stop); }
.st-pause      { color: var(--bk-pause); }
.st-dienstgang { color: var(--bk-dg); }
.st-homeoffice { color: #0d9488; }

/* Ampel-Farben */
.ampel .dot.green  { background: #28c244; box-shadow: 0 0 8px #28c244; }
.ampel .dot.yellow { background: #f4c20d; box-shadow: 0 0 8px #f4c20d; }
.ampel .dot.red    { background: #e23b3b; box-shadow: 0 0 8px #e23b3b; }
.flex-green { color: #1f9d3a; } .flex-red { color: #d12f2f; } .flex-yellow { color: #b8860b; }

/* Stempel-Chips */
.stamp { display: inline-block; padding: 2px 8px; border-radius: 7px; font-size: 12px; font-weight: 600;
         color: #fff; margin: 2px 4px 2px 0; white-space: nowrap; }
.stamp-go { background: var(--bk-go); } .stamp-stop { background: var(--bk-stop); }
.stamp-pause { background: var(--bk-pause); } .stamp-dg { background: var(--bk-dg); }
.stamp-home { background: var(--bk-home); }
.stamp-err { background: #dc2626; cursor: help; }

/* Buchungs-Tabelle */
.book-table { width: 100%; border-collapse: collapse; }
.book-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.book-table tr:last-child td { border-bottom: 0; }
.bt-day { white-space: nowrap; font-weight: 600; width: 86px; }
.bt-sum { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ta-r { text-align: right; }
.btn-del { background: transparent; border: 1px solid var(--border); border-radius: 7px; color: var(--bk-stop);
           width: 28px; height: 28px; cursor: pointer; }
.btn-del:hover { background: var(--bk-stop); color: #fff; }

/* Charts */
.chart { width: 100%; height: auto; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .zero { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 3 3; }
.chart .ax  { fill: var(--muted); font-size: 9px; }
.chart .ax.mid { text-anchor: middle; }
.chart .bar-soll { fill: var(--accent); }
.chart .bar-ist  { fill: #28c244; }
.chart .bar-over { fill: #f59e0b; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .dot  { fill: var(--accent); }

/* Donut */
.donut-wrap { display: flex; justify-content: center; }
.donut { width: 160px; height: 160px; }
.donut .seg-go { stroke: #28c244; } .donut .seg-stop { stroke: #f0a830; }
.donut .seg-home { stroke: #0d9488; } .donut .seg-dg { stroke: #f59e0b; }
.donut .seg-pause { stroke: #0ea5e9; } .donut .seg-abs { stroke: #ff6b6b; }
.donut .seg-empty { stroke: var(--border); }
.avail-legend { justify-content: center; }
.donut .donut-c { fill: var(--text); font-size: 22px; font-weight: 700; text-anchor: middle; }

/* Legenden */
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.lg { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.lg-go { background: #28c244; } .lg-stop { background: #f0a830; }
.lg-soll { background: var(--accent); } .lg-ist { background: #28c244; } .lg-over { background: #f59e0b; }

/* Formulare Buchen / Settings */
.row-form { display: flex; align-items: center; gap: 18px; margin: 14px 0; flex-wrap: wrap; }
.row-form label { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.two-col { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; align-items: start; }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week-grid input { text-align: center; padding: 8px 4px; }
.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.check input { width: auto; }

/* ---------------- Phase 3: Kalender / Anträge ---------------- */
.subnav { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.subnav-link { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.subnav-link:hover { color: var(--text); }
.subnav-link.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.cal-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cal-bar .btn { padding: 6px 12px; }

/* Urlaubskonto-Leiste */
.vac-summary { display: flex; flex-wrap: wrap; gap: 8px 22px; background: var(--surface); border: 1px solid var(--border);
               border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.vac-summary .vac-rest b { color: var(--accent); }

/* Informationstableau */
.tableau-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 16px; font-size: 13px; color: var(--muted); }
.tableau-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tcard { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border);
         border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); }
.tcard-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.tcard-name { font-weight: 600; font-size: 14px; }
.tcard-meta { font-size: 12px; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.tcard-badge { color: #fff; padding: 1px 6px; border-radius: 5px; font-size: 11px; font-weight: 700; }

/* Gruppenkalender */
.gk-scroll, .pk-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table.gk { border-collapse: collapse; font-size: 12px; }
table.gk th, table.gk td { border: 1px solid var(--border); text-align: center; }
.gk-name { position: sticky; left: 0; background: var(--surface); text-align: left !important;
           padding: 6px 10px; white-space: nowrap; min-width: 160px; z-index: 1; }
.gk-d { width: 26px; padding: 3px 0; color: var(--muted); }
.gk-wd { display: block; font-size: 9px; }
.gk-d.we, .gk-c.we { background: var(--surface-2); }
.gk-d.ho { background: #5bd1d1; color: #06343a; }
.gk-c { width: 26px; height: 26px; color: #06343a; font-weight: 700; font-size: 10px; }
.gk-d.today, .gk-c.today { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Persönlicher Jahreskalender */
table.pk { border-collapse: collapse; font-size: 11px; width: 100%; }
table.pk th, table.pk td { border: 1px solid var(--border); text-align: center; }
.pk-m { background: var(--surface); position: sticky; left: 0; padding: 4px 8px; text-align: left !important;
        white-space: nowrap; min-width: 48px; z-index: 1; }
.pk-d { width: 22px; color: var(--muted); padding: 2px 0; }
.pk-c { width: 22px; height: 22px; color: #06343a; font-weight: 700; font-size: 9px; }
.pk-x { background: repeating-linear-gradient(45deg, transparent, transparent 3px, var(--border) 3px, var(--border) 4px); }
.pk-c.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.pk-sum { width: 30px; background: var(--surface-2); color: var(--text); font-weight: 600; }

.gk-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12px; color: var(--muted); }

/* Badges & Entscheidungen */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.b-ok { background: #e7f6ec; color: #16653a; } .b-warn { background: #fff4e0; color: #8a5a08; }
.b-err { background: #fdeaea; color: #a31616; } .b-mut { background: var(--surface-2); color: var(--muted); }
html[data-theme="dark"] .b-ok { background: #14301f; color: #7ee2a8; }
html[data-theme="dark"] .b-warn { background: #3a2c12; color: #ffd591; }
html[data-theme="dark"] .b-err { background: #3a1717; color: #ffb3b3; }

.inline-decide { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.note-inp { width: 160px; padding: 7px 9px; }
.btn-ok { background: #16a34a; color: #fff; } .btn-no { background: #dc2626; color: #fff; }
.btn-ok:hover { background: #15803d; } .btn-no:hover { background: #b91c1c; }
.hgroup { float: right; } .mini { text-decoration: none; color: var(--muted); padding: 0 6px; font-size: 16px; }

/* ---------------- Phase 4: Admin / HR ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.form-grid label { color: var(--muted); }
.au-field { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 10px; }
.au-cap { font-size: 13px; color: var(--muted); }
.au-r { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.au-r input { width: auto; margin: 0; }
.fg-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; }
.thr th { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em;
          border-bottom: 2px solid var(--border); padding: 6px; }
.row-off { opacity: .55; }
.nowrap { white-space: nowrap; }
.mini-btn { padding: 5px 10px; font-size: 13px; font-weight: 500; margin-left: 4px; }
.hgroup-inline { display: inline-flex; align-items: center; gap: 10px; }
.hgroup-inline .btn { padding: 5px 11px; }

.journal td { padding: 5px 6px; }
/* Inline-Bearbeitung im Monatsjournal (HR) */
.je { display: inline-flex; align-items: center; gap: 2px; margin: 2px 8px 2px 0; }
.je-geo { text-decoration: none; font-size: 13px; cursor: help; }
.je-f { display: inline-flex; align-items: center; gap: 2px; margin: 0; }
.je-time { width: 84px; padding: 3px 4px; font-size: 12px; }
.je-type { padding: 3px 4px; font-size: 12px; width: auto; }
.je-ok, .je-plus { border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; width: 24px; height: 26px; cursor: pointer; color: var(--bk-go); font-weight: 700; }
.je-ok:hover, .je-plus:hover { background: var(--bk-go); color: #fff; }
.je-del { width: 24px; height: 26px; }
.je-add { margin-left: 6px; padding: 3px 6px; border-radius: 8px; background: var(--surface-2); }
.journal .we-row { background: var(--surface-2); }
.journal .ho-row td { background: rgba(91, 209, 209, .12); }

/* ---------------- Phase 5: Mandanten / MS365 / Krankmeldung ---------------- */
.sick-tile { border-left: 4px solid var(--bk-stop); margin-bottom: 16px; }

.or-sep { display: flex; align-items: center; text-align: center; color: var(--muted); margin: 16px 0; font-size: 13px; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.or-sep span { padding: 0 12px; }

.btn-ms { background: #2f2f2f; color: #fff; }
.btn-ms:hover { background: #1f1f1f; }
.ms-logo { display: inline-block; width: 16px; height: 16px; margin-right: 8px; vertical-align: -2px;
           background:
             linear-gradient(#f25022 0 0) 0 0 / 7px 7px no-repeat,
             linear-gradient(#7fba00 0 0) 9px 0 / 7px 7px no-repeat,
             linear-gradient(#00a4ef 0 0) 0 9px / 7px 7px no-repeat,
             linear-gradient(#ffb900 0 0) 9px 9px / 7px 7px no-repeat; }

/* ---------------- Dokumentation ---------------- */
.doc-edit { width: 100%; font-family: ui-monospace, monospace; font-size: 13px; line-height: 1.5; resize: vertical; }
.doc-content { max-width: 820px; background: var(--surface); border: 1px solid var(--border);
               border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 30px; line-height: 1.6; }
.doc-content h1 { font-size: 24px; margin: 0 0 14px; }
.doc-content h2 { font-size: 19px; margin: 22px 0 8px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.doc-content h3 { font-size: 16px; margin: 16px 0 6px; }
.doc-content ul { margin: 6px 0 14px; padding-left: 22px; }
.doc-content li { margin: 3px 0; }
.doc-content p { margin: 8px 0; }

/* ---------------- Phase 6: Planung / Konten / Journal ---------------- */
.gk-col { width: 52px; background: var(--surface); color: var(--text); font-size: 11px; padding: 4px 6px; text-align: right; white-space: nowrap; }
.gk-c.edit { cursor: pointer; }
.gk-c.edit:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.gk-group td { position: sticky; left: 0; background: var(--primary); color: #fff; font-weight: 700;
               font-size: 12px; padding: 5px 10px; }
html[data-theme="dark"] .gk-group td { background: var(--primary-2); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 92%; max-width: 420px; box-shadow: var(--shadow); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 600; }
.modal-x { background: transparent; border: 0; font-size: 18px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

/* Konten */
.konten-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.konto td { padding: 7px 6px; }
.konto td:first-child { color: var(--muted); }
.amp-mini { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
.amp-green { background: #28c244; } .amp-yellow { background: #f4c20d; } .amp-red { background: #e23b3b; }

/* Monatsjournal */
.mj .mj-week td { background: var(--surface-2); font-weight: 600; }
.mj-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 16px; }
.mj-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.mj-box h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }

/* Pager */
.pager { display: flex; align-items: center; gap: 14px; margin-top: 12px; justify-content: center; }

/* Workflow-Stufen */
.wf-stage { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; background: var(--surface-2); }
.wf-stage-h { display: flex; align-items: center; gap: 8px; }
.wf-stage-h .hgroup { margin-left: auto; float: none; }
.wf-list { list-style: none; margin: 8px 0 0; padding: 0; }
.wf-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px dashed var(--border); }
.wf-list li:first-child { border-top: 0; }
.wf-flow { font-size: 1.05rem; line-height: 1.9; padding: 12px 14px; border-radius: 10px;
           background: var(--surface-2); border: 1px solid var(--border); }
.wf-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.wf-presets form { margin: 0; }
.doc-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.support-rec { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin: 0; }
.support-rec legend { padding: 0 6px; font-weight: 600; }
.support-rec .radio { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; cursor: pointer; }
.support-rec .radio input { margin-top: 3px; }
.sup-new > td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.sup-new > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

@media print {
  .sidebar, .topbar, .cal-bar, .subnav, .gk-legend, .no-print, .row-form { display: none !important; }
  body.app { display: block; }
  .content { overflow: visible; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 760px) { .two-col, .konten-grid { grid-template-columns: 1fr; } .form-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  body.app { grid-template-columns: 64px 1fr; }
  .tile-wide { grid-column: span 1; }
  .tb-name { display: none; }
}

/* ============ Karl-Log Basis-Komponenten (nutzen Framework-Tokens) ============ */
:root{ --km-ok:#1f9d57; --km-warn:#c98a00; --km-crit:#d23b3b; --km-ok-bg:#e7f6ec; --km-warn-bg:#fbf1da; --km-crit-bg:#fbe6e6; }
@media (prefers-color-scheme:dark){:root:not([data-theme=light]){ --km-ok:#46c47f; --km-warn:#e0b34a; --km-crit:#e8756b; --km-ok-bg:#123122; --km-warn-bg:#33290f; --km-crit-bg:#331717; }}
:root[data-theme=dark]{ --km-ok:#46c47f; --km-warn:#e0b34a; --km-crit:#e8756b; --km-ok-bg:#123122; --km-warn-bg:#33290f; --km-crit-bg:#331717; }
.km h1{font-size:23px;margin:.2em 0 .1em}
.km .sub{color:var(--muted);margin:0 0 18px}
.km .panel{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius,14px);box-shadow:var(--shadow);padding:16px 18px;margin:0 0 16px}
.km .panel-h{font-weight:700;margin:0 0 10px;display:flex;align-items:center;gap:8px;justify-content:space-between}
.km .grid{display:grid;gap:14px;grid-template-columns:repeat(auto-fill,minmax(255px,1fr))}
.km .detail-grid{display:grid;gap:14px;grid-template-columns:1fr 1fr}
@media(max-width:720px){.km .detail-grid{grid-template-columns:1fr}}
.km .kcard{display:block;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius,14px);box-shadow:var(--shadow);padding:15px 16px;color:inherit;text-decoration:none}
.km .kcard:hover{border-color:var(--accent,var(--primary))}
.km .kpi{display:flex;gap:14px;flex-wrap:wrap;margin:0 0 16px}
.km .kpi .k{flex:1;min-width:150px;background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:12px 14px;box-shadow:var(--shadow)}
.km .kpi .k .l{color:var(--muted);font-size:12.5px}
.km .kpi .k .n{font-size:24px;font-weight:800;margin-top:2px}
.km .metric{display:flex;align-items:baseline;gap:6px}.km .metric .v{font-size:26px;font-weight:800}.km .metric .u{color:var(--muted);font-size:13px}
.km .muted{color:var(--muted)}.km .mono{font-family:ui-monospace,Menlo,Consolas,monospace}.km .nowrap{white-space:nowrap}.km .r{text-align:right}
.km table{width:100%;border-collapse:collapse}.km th,.km td{padding:8px 10px;border-bottom:1px solid var(--border);text-align:left;font-size:14px}.km th{color:var(--muted);font-weight:600}
.km .pill{display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:20px;font-size:12.5px;font-weight:700}
.km .lvl-ok{background:var(--km-ok-bg);color:var(--km-ok)}.km .lvl-warn{background:var(--km-warn-bg);color:var(--km-warn)}.km .lvl-crit{background:var(--km-crit-bg);color:var(--km-crit)}
.km .dotlvl{width:11px;height:11px;border-radius:50%;display:inline-block}.km .d-ok{background:var(--km-ok)}.km .d-warn{background:var(--km-warn)}.km .d-crit{background:var(--km-crit)}
.km .toolbar{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:0 0 14px}
.km .chart-wrap{overflow-x:auto}.km svg{max-width:100%}
.km .flash{padding:10px 14px;border-radius:10px;margin:0 0 14px;font-weight:600}
.km .flash.ok{background:var(--km-ok-bg);color:var(--km-ok)}.km .flash.warn{background:var(--km-warn-bg);color:var(--km-warn)}.km .flash.err{background:var(--km-crit-bg);color:var(--km-crit)}
.km label{display:block;font-size:13px;color:var(--muted);margin:.4rem 0 .2rem}
.km input,.km select{width:100%;padding:8px 10px;border:1px solid var(--border);border-radius:9px;background:var(--surface-2);color:var(--text);font-size:14px}
.km input[type=checkbox]{width:auto}
.km form.inline{display:inline}
/* Alias-Tokens, damit Bestands-Inline-Styles der Klima-Seiten weiter passen */
:root{ --ink:var(--text); --surface2:var(--surface-2); --ok:var(--km-ok); --warn:var(--km-warn); --crit:var(--km-crit); }
.km .btn.sm,.km .btn.btn-sm{padding:5px 10px;font-size:13px}
/* Sofort-Tooltip für Aktions-Buttons (Hover-Info) */
.km [data-tip]{position:relative}
.km [data-tip]:hover::after{content:attr(data-tip);position:absolute;bottom:calc(100% + 7px);right:0;
  background:#1f2a37;color:#f5f8fb;border:1px solid rgba(255,255,255,.12);padding:5px 9px;border-radius:7px;
  font-size:12px;font-weight:600;white-space:nowrap;z-index:30;box-shadow:0 4px 14px rgba(0,0,0,.28);pointer-events:none}
.km [data-tip]:hover::before{content:"";position:absolute;bottom:calc(100% + 2px);right:12px;border:5px solid transparent;border-top-color:#1f2a37;z-index:30;pointer-events:none}

