:root {
  --bg: #F6F5F0; --card: #FFFFFF; --line: #E1DFD7; --line2: #D5D3CA; --ink: #1F2A27; --muted: #5B6661;
  --acc: #17503F; --acc2: #E8F1EC; --warn: #8A5A00; --err: #A32C2C; --ok: #17503F;
  --we: #E4E2DA; --fe: #F4D9D3; --fr: #FBEFB2;
  --u: #B84A14; --k0: #2E5E9E; --k1: #6B4E9B; --k2: #1B7F8C; --k3: #8A5A00; --k4: #A32C5A; --k5: #3C6E1F; --k6: #7A4B2A; --k7: #4A4F9C; --k8: #8C2F2F; --k9: #2F6B5A;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; line-height: 1.45; }
h1 { font-size: 24px; margin: 0; } h2 { font-size: 18px; margin: 0 0 8px; }
a { color: var(--acc); }
.muted { color: var(--muted); } .hint { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.strong { font-weight: 700; } .neg { color: var(--err); }
.hidden-default { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.inl { display: inline-flex; align-items: center; gap: 8px; margin: 0; }

/* Kopf */
.top { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.brand img { height: 52px; width: auto; display: block; }
.brand-t { display: flex; flex-direction: column; }
.firma { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.prod { font-size: 20px; font-weight: 700; }
.nav { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 100%; order: 3; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; }
.nav a:hover { background: var(--acc2); } .nav a.on { background: var(--acc); color: #fff; }
.usr { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.chip { font-size: 13px; color: var(--muted); }

/* Schaltflächen und Felder */
.btn { min-height: 44px; padding: 0 16px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-family: inherit; }
.btn:hover { background: var(--acc2); }
.btn.primary { background: var(--acc); border-color: var(--acc); color: #fff; } .btn.primary:hover { background: #0f3a2d; }
.btn.danger { color: var(--err); border-color: #E0B9B9; } .btn.danger:hover { background: #FBECEC; }
.btn.ghost { border-color: transparent; } .btn.small { min-height: 36px; padding: 0 10px; font-size: 13px; } .btn.big { width: 100%; min-height: 48px; }
input, select { min-height: 44px; border: 1px solid var(--line2); border-radius: 8px; padding: 0 12px; font-size: 15px; color: var(--ink); background: #fff; font-family: inherit; max-width: 100%; }
input.n { width: 84px; text-align: right; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #7FB7A2; outline-offset: 1px; }
label, .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.fld { display: flex; flex-direction: column; gap: 4px; } .grow { flex: 1 1 200px; }
.fixed { min-height: 44px; display: flex; align-items: center; color: var(--muted); }
.chk { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; color: var(--ink); font-weight: 400; }
.chk input { width: 18px; height: 18px; min-height: 0; }

/* Struktur */
.wrap { max-width: 1500px; margin: 0 auto; padding: 20px 24px 40px; } .wrap.narrow { max-width: 1000px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-bottom: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.msg { border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; font-size: 14px; border: 1px solid; }
.msg.ok { background: #E8F1EC; border-color: #B5D3C5; color: #0F3A2D; } .msg.err { background: #FBECEC; border-color: #E0B9B9; color: #7A1F1F; } .msg.warn { background: #FFF6DD; border-color: #E8D49A; color: #5C3D00; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }
ul.plain { list-style: none; padding: 0; margin: 0 0 12px; } ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.plain li form.row { align-items: center; }
.tabs, .mtabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs a { min-height: 48px; display: inline-flex; align-items: center; padding: 0 16px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; }
.tabs a.on { color: var(--acc); border-bottom-color: var(--acc); }
.mtabs { border-bottom: 0; } .mtabs a { min-height: 44px; min-width: 52px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; text-decoration: none; color: var(--ink); font-weight: 600; }
.mtabs a.on { background: var(--acc); border-color: var(--acc); color: #fff; }
.opts { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; }
.opts .hint { margin: 0; }

/* Anmeldeseiten */
.authwrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.authcard { width: 100%; max-width: 460px; }
.authlogo { display: block; width: 240px; max-width: 80%; height: auto; margin-bottom: 14px; }
.authcard h1 { margin-bottom: 10px; font-size: 22px; }
.authcard h2 { margin-top: 12px; }
.steps { padding-left: 20px; } .steps li { margin-bottom: 6px; }
.qrbox { display: flex; justify-content: center; margin: 12px 0; } .qrbox img { width: 220px; height: 220px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 8px; }
.secret { font-size: 15px; letter-spacing: .06em; background: #F1F0EA; padding: 4px 8px; border-radius: 6px; word-break: break-all; }
ul.codes { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 17px; }
ul.codes li { background: #F1F0EA; padding: 8px 12px; border-radius: 6px; text-align: center; letter-spacing: .08em; }
details.help { margin: 10px 0; color: var(--muted); font-size: 14px; } details.help summary { cursor: pointer; min-height: 32px; }

/* Plan-Tabelle */
.tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
table.plan { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
table.plan th, table.plan td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid #EFEDE6; text-align: center; vertical-align: middle; }
table.plan thead th { background: #FAF9F5; font-weight: 600; font-size: 12px; position: sticky; top: 0; z-index: 2; padding: 6px 2px; }
table.plan th.nm { text-align: left; min-width: 210px; position: sticky; left: 0; background: #fff; z-index: 1; padding: 0 10px; white-space: nowrap; }
table.plan thead th.nm { z-index: 3; background: #FAF9F5; }
table.plan .num { min-width: 56px; padding: 0 8px; font-variant-numeric: tabular-nums; }
table.plan th.d, table.plan td.d { min-width: 34px; width: 34px; }
table.plan th .wd { display: block; font-size: 10px; color: var(--muted); font-weight: 500; }
tr.blkhead th, tbody.blkhead th { background: var(--acc); color: #fff; text-align: left; padding: 8px 12px; font-size: 14px; position: static; }
tr.grphead th { background: #EEF3F0; color: var(--acc); text-align: left; padding: 6px 12px; font-size: 13px; position: static; }
tfoot th, tfoot td { background: #FAF9F5; padding: 8px; font-weight: 700; }
.wd.we { color: #888; }
td.d.wk, th.d.wk, td.d.so, th.d.so { background: var(--we); }
td.d.fe, th.d.fe { background: var(--fe); }
table.plan:not(.no-ferien) td.d.fr:not(.wk):not(.fe):not(.so), table.plan:not(.no-ferien) th.d.fr:not(.wk):not(.fe):not(.so) { background: var(--fr); }
.gesamt td.d.fr:not(.wk):not(.fe):not(.so) { background: var(--fr); }
.cell { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 40px; border: 0; background: transparent; font-weight: 700; font-size: 13px; color: #fff; font-family: inherit; padding: 0; margin: 0; }
button.cell { cursor: pointer; color: transparent; }
button.cell:hover { background: rgba(23, 80, 63, .12); }
button.cell[data-code]:not([data-code=""]) { color: #fff; }
button.cell:disabled { opacity: .5; cursor: progress; }
span.cell.ro { cursor: default; }
.legend .cell, .setup .cell { width: 28px; min-height: 28px; border-radius: 6px; display: inline-flex; }
.kU { background: var(--u); } .k0 { background: var(--k0); } .k1 { background: var(--k1); } .k2 { background: var(--k2); } .k3 { background: var(--k3); } .k4 { background: var(--k4); }
.k5 { background: var(--k5); } .k6 { background: var(--k6); } .k7 { background: var(--k7); } .k8 { background: var(--k8); } .k9 { background: var(--k9); }
.kA { background: #6F7773; } .kX { background: #444; } .cell.fe { background: var(--fe); color: #7A2A1A; }
.grip { width: 32px; height: 36px; border: 0; background: transparent; cursor: grab; color: var(--muted); font-size: 18px; margin-right: 4px; touch-action: none; border-radius: 6px; padding: 0; }
.grip:hover { background: var(--acc2); } .grip:active { cursor: grabbing; }
.nmt { vertical-align: middle; }
tr.emprow th.nm { height: 42px; }
tr.drop-line > th, tr.drop-line > td { border-top: 4px solid var(--acc) !important; background: var(--acc2) !important; }
tr.dragging { opacity: .9; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 14px 0; font-size: 13px; align-items: center; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--line2); }
.sw.fe { background: var(--fe); } .sw.wk { background: var(--we); } .sw.fr { background: var(--fr); }
.kpis { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; font-size: 14px; flex: 1 1 220px; }
.person .kpi { flex: 0 1 auto; }
.cnt { display: flex; align-items: center; justify-content: center; min-height: 36px; font-weight: 700; font-size: 12px; }
.cnt.l1 { background: #D6E8DE; } .cnt.l2 { background: #AFD3C0; } .cnt.l3 { background: #7FB89B; } .cnt.l4 { background: #4F9A78; color: #fff; } .cnt.l5 { background: #17503F; color: #fff; }
td.d.none { background: #F1F0EA; }
.gesamt th.d { min-width: 30px; width: 30px; }

/* Einrichtung */
table.setup th, table.setup td { padding: 6px 8px; text-align: left; border-right: 0; }
table.setup thead th { position: static; }
table.setup td input:not(.n), table.setup td select { width: 100%; min-width: 120px; }
table.setup .num { text-align: right; }
.pwcell { white-space: nowrap; } .pwcell input { width: 150px; min-height: 36px; } .acts { white-space: nowrap; }
.sortlist { list-style: none; padding: 0; margin: 0 0 12px; }
.sortlist li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); background: #fff; }
.sortlist li input { flex: 1 1 200px; } .sortlist li .muted { min-width: 90px; }
.sortlist li.drop-line { background: var(--acc2); border-top: 3px solid var(--acc); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #7A1F1F; color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 800px) { .top { padding: 10px 12px; } .wrap { padding: 12px; } .card { padding: 14px; } table.plan th.nm { min-width: 150px; } }
@media print { .top, .nav, .usr, .foot, .opts, .mtabs, .yearf, .grip { display: none !important; } body { background: #fff; } .tablewrap { border: 0; overflow: visible; } }
table.jahr td, table.jahr th.nm { height: 38px; font-size: 14px; }
table.jahr .num { min-width: 64px; }
