:root {
  --bg: #f5f1e8;
  --surface: #fbf9f4;
  --raised: #ffffff;
  --ink: #1e2b25;
  --muted: #6b726c;
  --line: #e4ddce;
  --brand: #1f4a3b;
  --brand-ink: #f5f1e8;
  --brass: #b8893b;
  --danger: #a63d2f;
  --warn: #a8741a;
  --info: #3e5c76;
  --ok: #3b6b4a;
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --nav-w: 252px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141a17; --surface: #1a221e; --raised: #202a25; --ink: #ece7da; --muted: #9aa39b;
    --line: #2d3832; --brand: #7fb69c; --brand-ink: #10231b; --brass: #d4a653;
    --danger: #e0806f; --warn: #d9a441; --info: #8fb0cf; --ok: #86c19a;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Shell */
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 22px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand b { font-family: var(--serif); font-size: 21px; font-weight: 500; display: block; line-height: 1; }
.brand span { font-size: 12px; color: var(--muted); }
.navgroup { margin-top: 18px; }
.navgroup > small { display: block; padding: 0 10px 6px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.navlink { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; text-decoration: none; color: var(--ink); font-size: 14.5px; }
.navlink:hover { background: color-mix(in srgb, var(--brand) 7%, transparent); }
.navlink.on { background: var(--brand); color: var(--brand-ink); }
.navlink svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.me { margin-top: 24px; padding: 12px 10px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--brass) 22%, var(--surface)); color: var(--ink); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.me .grow { min-width: 0; }
.me .grow div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { padding: 36px clamp(18px, 4vw, 52px) 80px; max-width: 1180px; width: 100%; }
.tabbar { display: none; }

/* Page chrome */
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.pagehead p { margin: 6px 0 0; color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--raised); cursor: pointer; font-weight: 500; text-decoration: none; min-height: 40px; }
.btn:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn svg { width: 17px; height: 17px; }
.btn[disabled] { opacity: .5; cursor: default; }

.card { background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.cardhead { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.cardhead a { font-size: 13px; color: var(--brand); text-decoration: none; font-weight: 500; }

/* Dashboard */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.today { background: var(--brand); color: var(--brand-ink); border-radius: var(--radius); padding: 26px; position: relative; overflow: hidden; }
.today h2 { color: inherit; font-size: 24px; }
.today p { margin: 6px 0 0; opacity: .8; }
.today .shiftline { margin-top: 22px; padding-top: 16px; border-top: 1px solid color-mix(in srgb, var(--brand-ink) 22%, transparent); display: flex; gap: 22px; flex-wrap: wrap; }
.today .shiftline div small { display: block; opacity: .7; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; }
.today .shiftline div b { font-family: var(--serif); font-weight: 500; font-size: 20px; }
.figures { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.figure { background: var(--raised); padding: 16px 18px; }
.figure b { display: block; font-family: var(--serif); font-size: 32px; font-weight: 500; line-height: 1.1; }
.figure span { font-size: 13px; color: var(--muted); }
.figure.alert b { color: var(--danger); }
.grid2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-top: 16px; }
.grid2 > .card + .card { margin-top: 0; }
.attn { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.attn a { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; text-decoration: none; background: var(--raised); border: 1px solid var(--line); border-left: 4px solid var(--info); font-size: 14px; }
.attn a.danger { border-left-color: var(--danger); } .attn a.warn { border-left-color: var(--warn); }

/* Lists */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.search { flex: 1 1 220px; min-width: 0; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--raised); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 13px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.list { background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; }
.row:last-child { border-bottom: 0; }
.row:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.row .t { font-weight: 500; }
.row .meta { grid-column: 1; display: flex; gap: 6px 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.row .end { grid-row: 1 / span 2; grid-column: 2; display: flex; align-items: center; gap: 10px; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: color-mix(in srgb, var(--muted) 14%, transparent); white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.pill.info { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; margin-right: 8px; }
.dot.kritisch { background: var(--danger); } .dot.hoch { background: var(--warn); } .dot.mittel { background: var(--info); }

/* Dienstplan */
.week { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised); }
.week table { border-collapse: collapse; width: 100%; min-width: 760px; }
.week th, .week td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 8px; vertical-align: top; font-size: 13px; }
.week th:last-child, .week td:last-child { border-right: 0; }
.week tr:last-child td { border-bottom: 0; }
.week th { font-weight: 500; text-align: left; background: var(--surface); }
.week th.today { color: var(--brand); box-shadow: inset 0 -3px var(--brass); }
.week td.who { min-width: 150px; font-weight: 500; }
.week td.who small { display: block; font-weight: 400; color: var(--muted); }
.shift { display: block; padding: 5px 8px; border-radius: 8px; background: color-mix(in srgb, var(--brand) 12%, transparent); border-left: 3px solid var(--brand); margin-bottom: 4px; cursor: pointer; }
.shift.t1 { border-left-color: var(--brass); background: color-mix(in srgb, var(--brass) 14%, transparent); }
.shift.t2 { border-left-color: var(--info); background: color-mix(in srgb, var(--info) 12%, transparent); }
.shift small { display: block; color: var(--muted); }
.weeknav { display: flex; align-items: center; gap: 8px; }

/* Modal & forms */
.overlay { position: fixed; inset: 0; background: rgba(20, 26, 23, .5); display: grid; place-items: center; padding: 16px; z-index: 50; backdrop-filter: blur(2px); }
.modal { background: var(--bg); border-radius: 18px; width: min(640px, 100%); max-height: 92vh; overflow: auto; border: 1px solid var(--line); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 6px; }
.modal form, .modal .body { padding: 14px 24px 24px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field label i { color: var(--danger); font-style: normal; }
.field input, .field select, .field textarea, .rte { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--raised); min-height: 42px; }
.field input:focus, .field select:focus, .field textarea:focus, .rte:focus, .search:focus { outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 1px; }
.field textarea { min-height: 96px; resize: vertical; }
.field.check { display: flex; align-items: center; gap: 10px; }
.field.check input { width: 20px; height: 20px; min-height: 0; }
.field.check label { margin: 0; color: var(--ink); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.rte { min-height: 140px; }
.rtebar { display: flex; gap: 4px; margin-bottom: 6px; }
.rtebar button { padding: 4px 10px; border: 1px solid var(--line); background: var(--raised); border-radius: 8px; cursor: pointer; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.actions .left { margin-right: auto; }
.err { color: var(--danger); font-size: 13px; margin: 6px 0; min-height: 18px; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; padding-top: 2px; }
.dl dd { margin: 0; }
.prose :is(h2, h3, h4) { margin: 14px 0 6px; } .prose p { margin: 8px 0; } .prose ul, .prose ol { padding-left: 22px; }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { background: var(--brand); color: var(--brand-ink); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login .art h1 { font-size: clamp(34px, 4vw, 52px); max-width: 14ch; color: inherit; }
.login .art p { max-width: 38ch; opacity: .8; }
.login .art .ring { position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--brand-ink) 25%, transparent); box-shadow: 0 0 0 60px color-mix(in srgb, var(--brand-ink) 4%, transparent), 0 0 0 120px color-mix(in srgb, var(--brand-ink) 3%, transparent); }
.login .formside { display: grid; place-items: center; padding: 32px; }
.login form { width: min(380px, 100%); }
.login form h2 { margin-bottom: 6px; font-size: 26px; }
.login .hint { margin-top: 18px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; font-size: 13px; color: var(--muted); }
.login .hint button { all: unset; cursor: pointer; text-decoration: underline; color: var(--brand); }

#toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; opacity: 0; transition: .25s; pointer-events: none; z-index: 99; font-size: 14px; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Mobil */
@media (max-width: 860px) {
  .shell { display: block; }
  .side { display: none; }
  .main { padding: 22px 16px 110px; }
  h1 { font-size: 25px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 30; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; text-decoration: none; font-size: 11px; color: var(--muted); border-radius: 10px; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--brand); font-weight: 600; }
  .hero, .grid2 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login .art { padding: 32px 24px 40px; min-height: 240px; }
  .two { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 0; } .dl dt { margin-top: 10px; }
  .overlay { align-items: end; padding: 0; } .modal { border-radius: 18px 18px 0 0; max-height: 94vh; }
  .morepanel a { padding: 14px 10px; }
}
.morepanel { display: flex; flex-direction: column; }
.morepanel a { display: flex; gap: 12px; align-items: center; text-decoration: none; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.morepanel svg { width: 20px; height: 20px; }
@media print { .side, .tabbar, .toolbar, .btn { display: none !important; } .shell { display: block; } }
