/* Standard: dunkel und warm, mit einem Hauch Grün aus dem Logo. */
:root {
  color-scheme: dark;
  --bg: #1d2320;
  --paper: #262d29;
  --raised: #303833;
  --ink: #eef1ee;
  --muted: #a6b0a9;
  --line: #3a443e;
  --link: #eef1ee;
  --accent: #557f1f;          /* Buttons – Grün aus dem Logo */
  --accent-hover: #639725;
  --accent-ink: #ffffff;
  --accent-soft: #343d37;     /* aktive Navigation, Hervorhebungen */
  --sand: #303833;
  --warn: #e8b46a;
  --warn-soft: #3b3223;
  --bad: #f09a93;
  --bad-soft: #432a28;
  --ok-soft: #303833;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .18);
}
/* «Nacht»: die bisherige, sehr dunkle Variante */
:root[data-theme="night"] {
  --bg: #121212; --paper: #1c1c1c; --raised: #262626; --ink: #ececec; --muted: #9b9b9b;
  --line: #2e2e2e; --link: #ececec; --accent-soft: #262626; --sand: #2a2a2a;
  --warn: #e3a857; --warn-soft: #33281a; --bad: #ef8b84; --bad-soft: #3a1f1e; --ok-soft: #262626;
  --shadow: none;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f5; --paper: #ffffff; --raised: #f0f0f1; --ink: #1d1d1f; --muted: #6b6b70;
  --line: #e2e2e5; --link: #1d1d1f; --accent: #557f1f; --accent-hover: #4a701b;
  --accent-soft: #ececee; --sand: #ececee; --warn: #9a5b13; --warn-soft: #fbf0dc;
  --bad: #9b2c2c; --bad-soft: #f8e3e1; --ok-soft: #ececee;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 14px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    color-scheme: light;
    --bg: #f4f4f5; --paper: #ffffff; --raised: #f0f0f1; --ink: #1d1d1f; --muted: #6b6b70;
    --line: #e2e2e5; --link: #1d1d1f; --accent: #557f1f; --accent-hover: #4a701b;
    --accent-soft: #ececee; --sand: #ececee; --warn: #9a5b13; --warn-soft: #fbf0dc;
    --bad: #9b2c2c; --bad-soft: #f8e3e1; --ok-soft: #ececee;
    --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 14px rgba(0, 0, 0, .04);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; }
h3 { font-size: .95rem; margin: 1.2rem 0 .5rem; color: var(--muted); font-weight: 600; }

/* ---------- Kopf / Navigation */
.top {
  position: sticky; top: 0; z-index: 10; background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1080px; margin: 0 auto; padding: .6rem 16px;
  display: flex; align-items: center; gap: 1rem;
}
.brand { font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: .5rem; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--raised);
  color: var(--ink); display: grid; place-items: center; font-size: .85rem;
  box-shadow: inset 0 0 0 1px var(--line);
}
.brand-logo { height: 40px; max-width: 200px; object-fit: contain; display: block; }
.login .brand-logo { height: 110px; max-width: 100%; margin: 0 auto .5rem; }
.login .brand { margin-bottom: 1.6rem; }
.nav { display: flex; gap: .25rem; margin-left: auto; align-items: center; }
.nav a {
  color: var(--muted); padding: .45rem .7rem; border-radius: 8px; font-weight: 500;
}
.nav a.on { color: var(--ink); background: var(--accent-soft); }
.nav a:hover { text-decoration: none; color: var(--ink); }
.nav form { margin: 0; }
.nav .linkbtn { color: var(--muted); }

main { max-width: 1080px; margin: 0 auto; padding: 1.2rem 16px 6rem; }

/* Mobile: Tab-Leiste unten */
@media (max-width: 720px) {
  .nav { display: none; }
  .tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    display: grid; grid-template-columns: repeat(7, 1fr);
    background: var(--paper); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabs a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: .5rem 0 .55rem; font-size: .64rem; color: var(--muted); letter-spacing: -.01em;
  }
  .tabs a.on { color: var(--ink); }
  .tabs a:hover { text-decoration: none; }
  .tabs svg { width: 22px; height: 22px; }
  .tabs .plus svg { width: 30px; height: 30px; }
}
@media (min-width: 721px) { .tabs { display: none; } }

/* ---------- Bausteine */
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; }
@media (min-width: 721px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.stat .label { color: var(--muted); font-size: .82rem; }
.stat .value { font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; }

.head { display: flex; align-items: flex-start; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.head h1 { margin-right: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.btn, button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  padding: .55rem 1rem; display: inline-flex; align-items: center; gap: .4rem;
  text-decoration: none; min-height: 42px;
}
.btn:hover, button:hover { text-decoration: none; filter: brightness(.97); }
.btn.primary, button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover, button.primary:hover { background: var(--accent-hover); filter: none; }
.btn.danger, button.danger { color: var(--bad); border-color: var(--bad-soft); }
.btn.small, button.small { padding: .3rem .7rem; min-height: 34px; font-size: .88rem; }
.linkbtn { background: none; border: 0; padding: .45rem .7rem; min-height: 0; font-weight: 500; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.badge {
  display: inline-block; font-size: .74rem; font-weight: 600; padding: .12rem .5rem;
  border-radius: 999px; background: var(--sand); color: var(--ink); white-space: nowrap;
}
.badge.kk { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.badge.offen { background: var(--warn-soft); color: var(--warn); }
.badge.bezahlt { background: var(--raised); color: var(--ink); }
.badge.storniert { background: var(--line); color: var(--muted); text-decoration: line-through; }
.badge.overdue { background: var(--bad-soft); color: var(--bad); }

/* ---------- Tabellen / Listen */
table.list { width: 100%; border-collapse: collapse; }
table.list th {
  text-align: left; font-size: .78rem; color: var(--muted); font-weight: 600;
  padding: .4rem .5rem; border-bottom: 1px solid var(--line);
}
table.list td { padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--bg); }
.scroll { overflow-x: auto; }
@media (max-width: 720px) {
  table.list .hide-m { display: none; }
}
.empty { color: var(--muted); padding: 1rem 0; text-align: center; }

/* ---------- Formulare */
form.stack { display: grid; gap: .9rem; }
.fields { display: grid; gap: .8rem; }
@media (min-width: 721px) {
  .fields.c2 { grid-template-columns: 1fr 1fr; }
  .fields.c3 { grid-template-columns: 1fr 1fr 1fr; }
  .fields.c4 { grid-template-columns: 2fr 1fr 1fr 2fr; }
  .span2 { grid-column: span 2; }
}
label { display: grid; gap: .25rem; font-size: .85rem; color: var(--muted); font-weight: 500; }
.pseudo-label { display: grid; gap: .25rem; font-size: .85rem; color: var(--muted); font-weight: 500; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; min-height: 42px;
  width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
textarea { min-height: 84px; resize: vertical; }
.check { display: flex; align-items: center; gap: .5rem; color: var(--ink); font-size: .95rem; }
.check input { width: 20px; height: 20px; min-height: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.seg label {
  border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; cursor: pointer;
  display: flex; gap: .55rem; align-items: center; color: var(--ink); font-size: .95rem;
}
.seg input { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.hint { font-size: .8rem; color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 650; margin-bottom: .6rem; font-size: 1rem; }

.total-preview {
  display: flex; justify-content: space-between; align-items: baseline;
  background: var(--accent-soft); border-radius: 10px; padding: .7rem .9rem;
}
.total-preview strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }

/* ---------- Meldungen */
.flash { border-radius: 10px; padding: .7rem .9rem; margin-bottom: .8rem; font-weight: 500; }
.flash.ok { background: var(--raised); color: var(--ink); border-left: 3px solid var(--accent); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: .8rem 1rem; margin-bottom: 1rem; }
.notice ul { margin: .3rem 0 0 1.1rem; padding: 0; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .85rem; }
dl.kv dd { margin: 0; }

/* ---------- Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 380px; }
.login .brand { justify-content: center; margin-bottom: 1.2rem; font-size: 1.15rem; }

/* Eingabefelder in Rastern unten bündig, auch wenn ein Label einen Hinweis hat */
.fields { align-items: end; }
table.list th.num { text-align: right; }

/* Links in Listen als Namen: hell, unterstrichen beim Hover */
table.list a { font-weight: 550; }
.version { color: var(--muted); font-size: .75rem; text-align: center; padding: 2rem 0 0; }
.version-icon { width: 18px; height: 18px; border-radius: 5px; vertical-align: -4px; margin-right: .45rem; }
.logo-preview { background: #fff; border-radius: 8px; padding: 10px; display: inline-block; }
.logo-preview img { max-height: 70px; max-width: 260px; display: block; }
.doc-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
  background: var(--raised); font-size: .68rem; font-weight: 700; color: var(--muted); }
input[type=file] { padding: .45rem; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }

/* Kennzahlen auch auf dem Handy nebeneinander */
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
  .stats .card { padding: .7rem .6rem; margin-bottom: .5rem; }
  .stats .value { font-size: 1rem; }
  .stats .label { font-size: .72rem; }
}

/* Belege erfassen */
.capture-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.capture-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .4rem; min-height: 110px; border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--ink); font-weight: 600; font-size: .95rem; cursor: pointer; background: var(--raised);
}
.capture-btn svg { width: 32px; height: 32px; }
.capture-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.capture-btn.primary-tile { background: var(--accent); color: var(--accent-ink); border: 0; }
.beleg-img { max-width: 100%; max-height: 70vh; border-radius: 8px; display: block; background: #fff; }

/* Navigation für die Rolle «Erfassung»: weniger Tabs */
@media (max-width: 720px) {
  .tabs.staff { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
}

.mail-log { list-style: none; padding: 0; margin: .8rem 0 0; font-size: .9rem; }
.mail-log li { padding: .25rem 0; border-top: 1px solid var(--line); }

@media (min-width: 721px) and (max-width: 1060px) {
  .nav { gap: 0; }
  .nav a, .nav .linkbtn { padding: .45rem .45rem; font-size: .88rem; }
}

/* ---------- Kalender */
.cal-head { margin-bottom: .6rem; }
.cal-nav { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.cal-title { margin-left: .4rem; margin-right: auto; }
.cal-jump input { width: auto; min-height: 0; padding: .3rem .5rem; }
.cal-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--paper); }
.cal {
  --hh: 48px;
  display: grid; grid-template-columns: 52px repeat(var(--cols), minmax(104px, 1fr));
  grid-template-rows: auto calc(var(--hours) * var(--hh));
  min-width: calc(52px + var(--cols) * 104px);
}
.cal-corner, .cal-dayhead { position: sticky; top: 0; background: var(--paper); z-index: 3;
  border-bottom: 1px solid var(--line); }
.cal-corner { left: 0; z-index: 4; }
.cal-dayhead { padding: .55rem .4rem; text-align: center; font-size: .85rem; color: var(--muted);
  border-left: 1px solid var(--line); }
.cal-dayhead strong { color: var(--ink); }
.cal-dayhead.is-today strong { background: var(--accent); color: var(--accent-ink); border-radius: 999px;
  padding: .05rem .45rem; }
.cal-times { position: sticky; left: 0; z-index: 2; background: var(--paper); }
.cal-hour { height: var(--hh); position: relative; }
.cal-hour span { position: absolute; top: -.55em; right: 6px; font-size: .72rem; color: var(--muted); }
.cal-hour:first-child span { top: 2px; }
.cal-col {
  position: relative; border-left: 1px solid var(--line); cursor: copy;
  background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--hh)),
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--hh) / 2), color-mix(in srgb, var(--line) 45%, transparent) calc(var(--hh) / 2) calc(var(--hh) / 2 + 1px), transparent calc(var(--hh) / 2 + 1px) var(--hh));
}
.cal-col.is-past { background-color: color-mix(in srgb, var(--raised) 35%, transparent); }
.cal-col.is-today { background-color: color-mix(in srgb, var(--accent) 6%, transparent); }
.ev {
  position: absolute; margin-left: 2px; padding: 3px 6px; border-radius: 6px; overflow: hidden;
  font-size: .76rem; line-height: 1.25; color: var(--accent-ink); background: var(--accent);
  display: flex; flex-direction: column; cursor: pointer; z-index: 1;
  box-shadow: 0 0 0 1px var(--paper);
}
.ev:hover { text-decoration: none; filter: brightness(1.08); }
.ev-time { font-size: .7rem; opacity: .85; white-space: nowrap; }
.ev-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ev.block { background: var(--raised); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.ev.vorschlag, .ev.pick {
  background: color-mix(in srgb, var(--accent) 14%, var(--paper)); color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--accent); border: 0;
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--accent) 16%, transparent) 6px 12px);
}
.ev.pick { z-index: 2; box-shadow: inset 0 0 0 2px var(--accent); }
.ev.done .ev-label::after { content: " ✓"; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 2; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--bad); }
body.proposing .cal-col { cursor: crosshair; }
body.proposing .cal-scroll { box-shadow: 0 0 0 2px var(--accent); }

.propose-panel { border-color: var(--accent); }
.propose-row { display: grid; grid-template-columns: 1fr 140px; gap: .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .4rem .3rem .7rem;
  border-radius: 999px; background: var(--raised); font-size: .88rem; }
.chip button { min-height: 0; padding: 0 .4rem; border: 0; background: transparent; color: var(--muted);
  font-size: 1.1rem; line-height: 1; }
.hint.warn { color: var(--warn); }
.slot-list { list-style: none; padding: 0; margin: 0; }
.slot-list li { padding: .5rem 0; border-top: 1px solid var(--line); }
.slot-list li:first-child { border-top: 0; }
.slot-list li.chosen { font-weight: 600; }
.copy-row { display: flex; gap: .5rem; }
.copy-row input { flex: 1; font-size: .85rem; }

/* ---------- Öffentliche Buchungsseite */
body.public { background: var(--bg); }
.booking { max-width: 520px; margin: 0 auto; padding: 2rem 16px 3rem; }
.booking-brand { text-align: center; margin-bottom: 1.4rem; }
.booking-brand img { max-height: 90px; max-width: 100%; }
.booking-card h1 { font-size: 1.3rem; margin: 0 0 .6rem; }
.booking-when { font-size: 1.15rem; font-weight: 600; margin: .4rem 0; }
.booking-ok { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 1.5rem; margin-bottom: .8rem; }
.slot-choice { display: grid; gap: .5rem; margin: 1rem 0; }
.slot-choice label { display: flex; gap: .7rem; align-items: center; padding: .8rem .9rem;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--ink); font-size: 1rem; }
.slot-choice label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--paper)); }
.slot-choice input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); flex: none; }
.booking-msg { margin-bottom: 1rem; }
.booking-btn { width: 100%; }
.booking-none { margin-top: 1.2rem; }
.booking-none summary { cursor: pointer; color: var(--muted); }
.booking-foot { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 1.4rem; }
.upcoming li { display: flex; gap: .6rem; }
.ev.short { flex-direction: row; gap: .35rem; align-items: baseline; padding-top: 1px; padding-bottom: 1px; }
.ev.short .ev-label { white-space: nowrap; }
.ev.short .ev-time { display: none; }
.du-texts { margin-top: .4rem; }
.du-texts summary { cursor: pointer; color: var(--muted); padding: .3rem 0; }
.du-texts[open] summary { color: var(--ink); }
