:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --ink: #1b2430;
  --muted: #6b7a89;
  --line: #e3e8ec;
  --brand: #1d4e6f;
  --brand-soft: #e8f0f5;
  --ok: #2f7d4f;
  --warn: #b8791f;
  --err: #b0343f;
  --radius: 13px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .07), 0 6px 18px rgba(16, 32, 48, .05);
}

* { box-sizing: border-box; }
[v-cloak] { display: none; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 14px calc(40px + env(safe-area-inset-bottom));
}

/* ------------------------------------------------------------- Anmeldung */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card {
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  padding: 28px 24px; width: 100%; max-width: 400px; text-align: center;
}
.login-card .logo { font-size: 46px; line-height: 1; }
.login-card h1 { margin: 10px 0 2px; font-size: 22px; }
.login-card .sub { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.login-card .hint { font-size: 14px; color: var(--muted); text-align: left; }
.login-card .switch { margin: 16px 0 0; font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------- Kopf + Tabs */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--brand); color: #fff;
}
.topbar .title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.topbar .van { font-size: 26px; }
.topbar strong { display: block; font-size: 16px; }
.topbar small { display: block; font-size: 12px; opacity: .8; }
.topbar .ghost { color: #fff; border-color: rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .1); }

.tabs {
  display: flex; gap: 4px; padding: 8px 10px;
  background: var(--brand); overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 1 0 auto; border: 0; border-radius: 9px; padding: 8px 14px;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tabs button.on { background: #fff; color: var(--brand); }

/* ------------------------------------------------------------- Bausteine */
h2.section { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 24px 0 8px; }
h2.section.clickable { cursor: pointer; }
.caret { font-size: 12px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.empty, .muted { color: var(--muted); font-size: 14px; }
.muted.plain { list-style: none; }
.fieldhint { font-size: 13px; color: var(--muted); margin: -2px 0 10px; }
.version { text-align: center; color: var(--muted); font-size: 12px; margin-top: 22px; }

/* a.btnlink sieht aus wie ein Button (z.B. der webcal-Abo-Link) */
button, a.btnlink {
  font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; padding: 9px 14px;
}
button.primary, a.btnlink.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
button.primary:disabled { opacity: .55; cursor: default; }
button.danger { background: #fff; border-color: #e6c3c7; color: var(--err); font-weight: 600; }
button.ghost { background: #fff; color: var(--ink); }
button.link { border: 0; background: none; color: var(--brand); padding: 4px 6px; font-size: 14px; }
button.block, a.btnlink.block { display: block; width: 100%; }
button.big, a.btnlink.big { padding: 13px; font-size: 16px; margin-top: 12px; }

input, select, textarea {
  font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
}
input:disabled { background: #f7f9fa; color: var(--muted); }
textarea { resize: vertical; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.form label input:not([type=checkbox]), .form label select, .form label textarea { margin-top: 5px; }
.form label.row { display: flex; align-items: center; gap: 9px; font-weight: 400; color: var(--ink); font-size: 15px; }
.form label.row input { width: auto; }
.form label.row.warnrow { color: var(--err); font-weight: 600; }
.two { display: flex; gap: 10px; }
.two label { flex: 1; }

.notice { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 10px 0 0; }
.notice.ok { background: #e7f4ec; color: #1e5c39; }
.notice.err { background: #fbe9eb; color: #8e2a33; }
.notice.info { background: var(--brand-soft); color: #16405c; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  background: #1b2430; color: #fff; padding: 10px 18px; border-radius: 22px;
  font-size: 14px; box-shadow: var(--shadow); z-index: 60;
}

/* ------------------------------------------------------------- Status */
.status-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px 16px; border-left: 5px solid var(--ok); }
.status-card.busy { border-left-color: var(--warn); }
.status-line { display: flex; align-items: center; gap: 9px; font-size: 17px; }
.status-sub { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--warn); flex: none; }
.dot.ok { background: var(--ok); }

/* ------------------------------------------------------------- Liste */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.timeline .booking {
  position: relative; display: flex; align-items: stretch; gap: 12px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 12px 12px 0; overflow: hidden; cursor: pointer;
}
.timeline .stripe { width: 6px; flex: none; border-radius: 0 4px 4px 0; }
.timeline .b-main { flex: 1; min-width: 0; }
.b-head { display: flex; align-items: baseline; gap: 8px; }
.b-head strong { font-size: 16px; }
.b-head .days { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.b-date { font-size: 14px; margin-top: 1px; }
.b-title { font-size: 14px; color: var(--brand); margin-top: 2px; }
.b-buffer, .b-note { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.b-buffer { display: flex; flex-wrap: wrap; gap: 5px; }
.b-buffer .pill { background: #eef2f5; border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.timeline .booking.mine { background: #fbfdff; }
.timeline .booking.service .b-head strong::before { content: '🔧 '; }
.timeline .edit-hint { align-self: center; color: var(--muted); font-size: 15px; }
.timeline.past { opacity: .72; }

.timeline .gap {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 1px dashed #bcd3c6; border-radius: var(--radius); background: #f4faf6;
  font-size: 14px; cursor: pointer;
}
.gap-mark {
  background: var(--ok); color: #fff; border-radius: 6px; padding: 1px 7px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.gap-text { flex: 1; }
.gap-add { color: var(--ok); font-size: 12.5px; font-weight: 600; white-space: nowrap; }

.free-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.free-list li { background: var(--card); border-radius: 10px; box-shadow: var(--shadow); padding: 9px 12px; font-size: 14px; cursor: pointer; }

/* ------------------------------------------------------------- Monat */
.nav-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.nav-row strong { flex: 1; text-align: center; font-size: 17px; }
.nav-row .ghost { width: 40px; }
.today-btn { flex: none; }

.cal { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head span { padding: 7px 0; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); background: #eef2f5; }
.cal-day {
  min-height: 66px; border-top: 1px solid var(--line); border-right: 1px solid var(--line);
  padding: 3px 3px 4px; cursor: pointer;
}
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: #fafbfc; }
.cal-day.out .dnum { color: #c3ccd4; }
.cal-day.today { background: #fff8e8; }
.cal-day.today .dnum { background: var(--brand); color: #fff; border-radius: 50%; }
.cal-day .dnum { display: inline-block; min-width: 19px; text-align: center; font-size: 11.5px; color: var(--muted); }
.chips { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.chip {
  display: block; min-height: 15px; font-size: 10.5px; font-weight: 700; line-height: 15px;
  padding: 0 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.chip.start { border-radius: 4px 0 0 4px; }
.chip.end { border-radius: 0 4px 4px 0; }
.chip.start.end { border-radius: 4px; }
.chip.load, .chip.unload {
  background-image: repeating-linear-gradient(45deg, rgba(0, 0, 0, .11) 0 3px, transparent 3px 6px);
}

.legend { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }
.leg { display: inline-flex; align-items: center; gap: 5px; }
.leg i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.leg i.hatched { background: #d7dee4; background-image: repeating-linear-gradient(45deg, rgba(0, 0, 0, .18) 0 3px, transparent 3px 6px); }
.leg b { color: var(--ink); }

/* ------------------------------------------------------------- Jahr */
.year-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ymonth { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 9px; }
.ymonth h3 { margin: 0 0 6px; font-size: 13px; color: var(--brand); cursor: pointer; }
.ycells { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ycell {
  aspect-ratio: 1; display: grid; place-items: center; border-radius: 3px;
  background: #eff2f5; color: var(--muted); font-size: 9.5px; cursor: pointer;
}
.ycell.pad { background: none; cursor: default; }
.ycell.sun { box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .07); }
.ycell.today { outline: 2px solid var(--brand); outline-offset: -1px; font-weight: 800; }
.year-sum { font-size: 13.5px; color: var(--muted); margin-top: 12px; }

/* ------------------------------------------------------------- Personen */
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.people li {
  display: flex; align-items: center; gap: 12px; overflow: hidden;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 11px 12px 11px 0;
}
.people li.disabled { opacity: .6; }
.people .stripe { width: 6px; align-self: stretch; border-radius: 0 4px 4px 0; }
.p-main { flex: 1; min-width: 0; }
.p-head { display: flex; align-items: center; gap: 7px; }
.p-mail, .p-meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { background: var(--brand-soft); color: var(--brand); font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; text-transform: uppercase; }
.badge.warn { background: #fdf0dd; color: var(--warn); }

.colors { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }

.ics { display: flex; align-items: center; gap: 10px; }
.ics code { flex: 1; font-size: 11.5px; word-break: break-all; color: var(--muted); }
.btnlink { display: block; text-align: center; text-decoration: none; }
.fieldhint.center { text-align: center; margin: 10px 0 8px; }
.howto { margin-top: 14px; font-size: 13px; color: var(--muted); }
.howto summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.howto ul { margin: 8px 0 0; padding-left: 18px; }
.howto li { margin-bottom: 6px; }
.howto strong { color: var(--ink); }

/* ------------------------------------------------------------- Dialog */
.modal-wrap {
  position: fixed; inset: 0; background: rgba(16, 26, 36, .45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
.modal {
  background: var(--card); width: 100%; max-width: 480px;
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 92dvh; overflow-y: auto;
}
.modal h3 { margin: 0 0 14px; font-size: 18px; }
.rangeinfo { font-size: 13px; color: var(--muted); margin: -2px 0 0; }
.modal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.modal-actions .right { margin-left: auto; }
.log { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.log summary { cursor: pointer; }
.log ul { margin: 6px 0 0; padding-left: 18px; }

@media (min-width: 600px) {
  .modal-wrap { align-items: center; padding: 20px; }
  .modal { border-radius: 18px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151a20;
    --card: #1e252d;
    --ink: #e8edf1;
    --muted: #94a3b0;
    --line: #2c353f;
    --brand: #2b6c94;
    --brand-soft: #23323d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
  input, select, textarea, button:not(.primary):not(.danger), a.btnlink:not(.primary) { background: #232b34; color: var(--ink); }
  input:disabled { background: #1b2229; }
  button.danger { background: #2b2023; border-color: #5c3a3f; color: #f0a4ab; }
  .cal-head span { background: #232b34; }
  .b-buffer .pill { background: #262f38; }
  .cal-day.out { background: #1a2027; }
  .cal-day.today { background: #2a2b21; }
  .ycell { background: #262f38; }
  .timeline .booking.mine { background: #212b34; }
  .timeline .gap { background: #1c2724; border-color: #35544a; }
  .notice.ok { background: #1d3527; color: #a8dcbc; }
  .notice.err { background: #382225; color: #f2b3ba; }
  .notice.info { background: #22303a; color: #b6d6ea; }
}
