/* Farbschema nach Vorbild des ChatGPT-Entwurfs: Anthrazit mit Bähr-Gelb */
:root {
  --bg: #151615; --card: #1d1f1d; --card2: #232521; --ink: #f5f2e8; --muted: #b0b1a4; --line: #363831;
  --accent: #ffcd58; --accent-ink: #201c12; --accent-soft: #332e21;
  --ok: #8fd19e; --ok-soft: #1f3324; --warn: #ffcd58; --warn-soft: #3a3320; --bad: #ff9b8b; --bad-soft: #3d2420;
  --info: #9cc3ea; --info-soft: #1e2c3a;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
h1 { font-size: 1.45rem; letter-spacing: -.02em; margin: .2rem 0 1rem; }
h2 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; }
h3 { font-size: .78rem; margin: .9rem 0 .2rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.muted { color: var(--muted); } .center { text-align: center; } .small { font-size: .84rem; }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Kopf */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: #1a1b19; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand img { height: 38px; width: auto; background: #fff; border-radius: 5px; padding: 2px 6px; }
.brand span { font-size: .95rem; }
.pill { margin-left: auto; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px;
  padding: 3px 10px; font-size: .78rem; cursor: pointer; white-space: nowrap; min-height: 0; font-weight: 600; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); border-color: #5a4d2c; } .pill.bad { color: var(--bad); border-color: #6a3a32; }
main { max-width: 1180px; margin: 0 auto; padding: 16px; }

/* Navigationsleiste unten – auf Handy und Desktop */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; background: #1a1b19; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabbar a { flex: 1; max-width: 120px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 1px 7px;
  font-size: .64rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.tabbar a span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar a.on { color: var(--accent); }
.tabbar a:hover { color: var(--ink); }
@media (min-width: 900px) { .tabbar a { font-size: .74rem; padding: 9px 4px 9px; } .tabbar svg.i { width: 22px; height: 22px; } }

/* Flächen */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.grid { display: grid; gap: 12px; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.pagehead h1 { margin: 0; }
.status { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.status .big { font-size: 1.1rem; font-weight: 700; }
.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
@media (min-width: 700px) { .actions { grid-template-columns: repeat(5, 1fr); } }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi .k { font-size: .78rem; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 1.5rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .s { font-size: .78rem; color: var(--muted); }

/* Bedienelemente */
button, .btn { font: inherit; font-weight: 650; border: 1px solid #57574d; border-radius: 7px; padding: 9px 12px; cursor: pointer;
  background: #292b25; color: var(--ink); min-height: 42px; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px; }
button:hover:not(:disabled), .btn:hover { filter: brightness(1.15); }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.ghost { background: transparent; }
button.danger { background: var(--bad-soft); color: var(--bad); border-color: #6a3a32; }
button.small { min-height: 30px; padding: 4px 9px; font-size: .82rem; }
button.icon { min-height: 38px; width: 38px; padding: 0; border-radius: 50%; }
button:disabled { opacity: .45; cursor: not-allowed; }
.voicebtn { width: 100%; min-height: 48px; }
.voicebtn.rec { background: var(--bad); border-color: var(--bad); color: #2a0f0b; }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { font: inherit; width: 100%; padding: 9px 10px; border-radius: 7px; border: 1px solid #55574e;
  background: #171916; color: var(--ink); min-height: 42px; }
textarea { min-height: 60px; resize: vertical; }
textarea.compact { min-height: 44px; font-size: .9rem; }
input[type=checkbox] { accent-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; } .row > * { flex: 1; min-width: 120px; }

/* Listen: eine Zeile je Eintrag, Abhaken vorne, Klick = Details */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.list > li:last-child { border-bottom: 0; }
.list > li .grow { flex: 1; min-width: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check input[type=checkbox] { width: 22px; height: 22px; min-height: 22px; margin: 0; flex: none; cursor: pointer; }
.check .body { flex: 1; min-width: 0; cursor: pointer; }
.check .line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.check .more { display: none; font-size: .84rem; color: var(--muted); margin-top: 4px; }
.check.open .line { white-space: normal; }
.check.open .more { display: block; }
.check.done .line { text-decoration: line-through; opacity: .55; }
.sitegroup + .sitegroup { margin-top: 6px; }
.sitegroup h3 a { color: var(--muted); text-decoration: none; }

.tag { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--line); color: var(--ink); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); } .tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); } .tag.info { background: var(--info-soft); color: var(--info); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tabs button { min-height: 34px; padding: 5px 11px; background: transparent; color: var(--muted); white-space: nowrap; }
.tabs button.on { background: var(--accent-soft); color: var(--accent); border-color: #5a4d2c; }
.question { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 10px 12px; border-radius: 8px; margin: 8px 0; }
.question .opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* Buchungen mit direkt bearbeitbaren Zeiten */
.booking { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.booking:last-child { border-bottom: 0; }
.booking .times { display: flex; align-items: center; gap: 4px; }
.booking .times input { width: 92px; min-height: 36px; padding: 5px 6px; font-variant-numeric: tabular-nums; }
.booking .what { min-width: 0; }
.booking .what div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.booking.running { border-left: 3px solid var(--accent); padding-left: 8px; }
@media (max-width: 480px) { .booking { grid-template-columns: 1fr auto; } .booking .times { grid-column: 1 / -1; } }

table.data { width: 100%; border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { color: var(--muted); font-weight: 650; font-size: .76rem; }
table.data td.num, table.data th.num { text-align: right; }
.scroll { overflow-x: auto; }

/* Abwesenheitskalender */
.cal { border-collapse: collapse; font-size: .75rem; min-width: 100%; }
.cal th, .cal td { border: 1px solid var(--line); padding: 3px; text-align: center; min-width: 26px; height: 30px; }
.cal th.name, .cal td.name { text-align: left; min-width: 140px; position: sticky; left: 0; background: var(--card); font-weight: 600; }
.cal .we { background: #191a18; }
.k-krank { background: var(--bad-soft); color: var(--bad); } .k-urlaub { background: var(--ok-soft); color: var(--ok); }
.k-urlaub_beantragt, .k-urlaub_offen { background: var(--warn-soft); color: var(--warn); }
.k-schulung { background: var(--info-soft); color: var(--info); } .k-schlechtwetter { background: #2a3038; color: #c5d0dc; }
.k-unbezahlt { background: var(--line); } .k-feiertag { background: var(--accent-soft); color: var(--accent); }
.legend { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 0; font-size: .75rem; }
.legend span { padding: 2px 8px; border-radius: 6px; }

/* Monatskalender Verwaltung */
.monthcal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.monthcal .wdh { font-size: .75rem; color: var(--muted); font-weight: 700; text-align: center; padding-bottom: 2px; }
.daycell { background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 7px; min-height: 108px;
  cursor: pointer; display: flex; flex-direction: column; gap: 2px; font-size: .76rem; text-align: left; color: var(--ink);
  font-weight: 400; align-items: stretch; justify-content: flex-start; }
.daycell:hover { border-color: #6b6a5c; }
.daycell.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.daycell.we { background: #191a18; color: var(--muted); }
.daycell.empty { visibility: hidden; }
.daycell .dn { display: flex; justify-content: space-between; font-weight: 700; font-size: .82rem; }
.daycell .hrs { font-size: 1.05rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.daycell .site { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daycell .diff.plus { color: var(--ok); } .daycell .diff.minus { color: var(--bad); }
.daycell.issue { border-color: #7a3b31; }
.daycell .tag { align-self: flex-start; }
@media (max-width: 760px) { .daycell { min-height: 64px; font-size: .68rem; } .daycell .site { display: none; } .daycell .hrs { font-size: .9rem; } }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photos figure { margin: 0; } .photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--line); }
.photos figcaption { font-size: .72rem; color: var(--muted); }
#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #3b3327;
  border: 1px solid #736550; color: var(--ink); padding: 9px 15px; border-radius: 8px; font-weight: 600; opacity: 0; transition: opacity .2s;
  pointer-events: none; max-width: 92vw; z-index: 50; }
#toast.show { opacity: 1; }
.login { max-width: 400px; margin: 8vh auto; }
.login .logo { display: block; height: 70px; margin: 0 auto 14px; background: #fff; border-radius: 6px; padding: 4px 10px; }
.blockers li { color: var(--bad); }
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; width: min(560px, 94vw); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.55); }
.offline-note { background: var(--warn-soft); color: var(--warn); padding: 8px 12px; border-radius: 8px; font-size: .85rem; margin-bottom: 12px; }
.sitehead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: .9rem; }
.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.daycell .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
/* Schmale Handys: nur Symbole, Beschriftung nur beim aktiven Bereich */
@media (max-width: 480px) {
  .tabbar a { padding: 9px 0 8px; }
  .tabbar svg.i { width: 23px; height: 23px; }
  .tabbar a span:last-child { display: none; }
  .tabbar a.on span:last-child { display: block; font-size: .6rem; overflow: visible; max-width: none; }
}

/* Jahreskalender */
.yearcal { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 620px) { .yearcal { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .yearcal { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1300px) { .yearcal { grid-template-columns: repeat(4, 1fr); } }
.ymhead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.ycgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.ycw { font-size: .66rem; color: var(--muted); text-align: center; font-weight: 600; }
.yc { position: relative; min-height: 40px; border-radius: 6px; background: var(--card2); display: flex; align-items: center; justify-content: center; }
.yc.empty { background: transparent; }
.yc.we { background: #191a18; }
.yc .dn { position: absolute; top: 2px; left: 4px; font-size: .58rem; opacity: .7; }
.yc .v { font-size: .82rem; font-weight: 700; padding-top: 8px; }
.yc.today { outline: 2px solid var(--ink); outline-offset: -2px; }
.s-erreicht { background: #6fcf86 !important; color: #10240f; }
.s-nicht_erreicht { background: #ffd84d !important; color: #2b2300; }
.s-urlaub { background: #ff9a3c !important; color: #2b1400; }
.s-beantragt { background: #8b8d86 !important; color: #161714; }
.s-krank { background: #ff8a7a !important; color: #2a0f0b; }
.s-feiertag { background: linear-gradient(135deg, #c18cff, #ff7ac8) !important; color: #24082f; }
.legend .s-erreicht, .legend .s-nicht_erreicht, .legend .s-urlaub, .legend .s-beantragt, .legend .s-krank, .legend .s-feiertag { font-weight: 600; }
