/* Termivo – iPhone-first: große Tippflächen, Systemschrift, helles und dunkles Design.
   Layout: Tab-Leiste unten (ab 900 px links), Inhalte als gruppierte Listen und Karten. */
:root {
  --bg: #F4F6F5;
  --surface: #FFFFFF;
  --surface-2: #EBF0EE;
  --fg: #111A17;
  --muted: #5E6B67;
  --line: #DCE3E0;
  --accent: #0E6B5C;
  --accent-ink: #FFFFFF;
  --accent-soft: #D9EFE9;
  --danger: #B93D0B;
  --danger-soft: #FCE8DD;
  --ok: #157A3B;
  --ok-soft: #DCF3E4;
  --wa: #1E8F4E;
  --ig: #B8327A;
  --tiktok: #1F2937;
  --test: #6B7280;
  --manual: #5B6B86;
  --shadow: 0 1px 2px rgba(16, 24, 22, .05), 0 6px 18px rgba(16, 24, 22, .06);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-rounded, -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Segoe UI", Roboto, sans-serif;
  --gutter-l: max(16px, env(safe-area-inset-left));
  --gutter-r: max(16px, env(safe-area-inset-right));
  --tabbar-h: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D1412;
    --surface: #16201D;
    --surface-2: #1F2B28;
    --fg: #E6EEEB;
    --muted: #96A7A2;
    --line: #2B3835;
    --accent: #45C7AA;
    --accent-ink: #04211B;
    --accent-soft: #173C34;
    --danger: #F2905F;
    --danger-soft: #3D241A;
    --ok: #57D98A;
    --ok-soft: #183323;
    --wa: #4BD084;
    --ig: #EE7DBB;
    --tiktok: #D1D5DB;
    --test: #A1A1AA;
    --manual: #9DB0CF;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.ico { width: 24px; height: 24px; flex: none; }
.ico.sm { width: 18px; height: 18px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.noscript { padding: 24px; text-align: center; }

/* ---------- Start & Anmeldung ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 60; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(180deg, #12806E, #0B5649); color: #fff;
  font: 800 19px/1 var(--font-display); position: relative; flex: none;
}
.brand-mark::after { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #9FE3D2; right: 7px; bottom: 7px; }
.brand-mark.big { width: 72px; height: 72px; border-radius: 18px; font-size: 38px; }
.brand-mark.big::after { width: 12px; height: 12px; right: 13px; bottom: 13px; }

.auth {
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: calc(env(safe-area-inset-top) + 24px) var(--gutter-r) calc(env(safe-area-inset-bottom) + 24px) var(--gutter-l);
}
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 18px; }
.auth-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.auth-card .brand b { font: 800 28px/1 var(--font-display); letter-spacing: -.02em; }
.auth-card h1 { font: 750 26px/1.2 var(--font-display); margin: 0; letter-spacing: -.01em; }
.auth-card p { margin: 0; color: var(--muted); }

/* ---------- Grundlayout ---------- */
.app { min-height: 100dvh; }
.main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px); min-height: 100dvh; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  padding: 4px max(6px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 50px; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600; position: relative;
}
.tab .ico { width: 26px; height: 26px; }
.tab[aria-current="page"] { color: var(--accent); }
.tab .tab-badge {
  position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.tabbar .brand-row { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 6px; min-height: 56px;
  padding: calc(env(safe-area-inset-top) + 8px) var(--gutter-r) 8px var(--gutter-l);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.topbar .titles { flex: 1; min-width: 0; }
.topbar h1 { margin: 0; font: 750 30px/1.15 var(--font-display); letter-spacing: -.02em; }
.topbar .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.topbar.compact h1 { font-size: 18px; font-weight: 700; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar.compact .sub { font-size: 13px; margin-top: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 2px; }

.content {
  max-width: 760px; margin: 0 auto;
  padding: 6px var(--gutter-r) 0 var(--gutter-l);
  display: flex; flex-direction: column; gap: 22px;
}
.section { display: flex; flex-direction: column; gap: 8px; }
.section-title {
  margin: 0 4px; font-size: 13px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.section-title .pill { text-transform: none; letter-spacing: 0; }
.section-note { margin: 0 4px; font-size: 14px; color: var(--muted); }

/* ---------- Bausteine ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cell {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 16px;
  border: 0; background: none; text-align: left; color: inherit; position: relative; text-decoration: none;
}
.cell + .cell::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--line); }
button.cell:active, a.cell:active { background: var(--surface-2); }
.cell .grow { flex: 1; min-width: 0; }
.cell .title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell .meta { display: block; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell .meta.wrap { white-space: normal; }
button.cell[disabled] { cursor: default; }
.toggle-row { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 600; }
.toggle-row .grow { flex: 1; }
.offscreen { position: fixed; left: -9999px; top: 0; }
.cell .value { color: var(--muted); font-size: 15px; text-align: right; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell .chev { color: var(--muted); opacity: .7; }
.cell.danger .title { color: var(--danger); }
.cell .time { width: 52px; flex: none; font-weight: 650; font-variant-numeric: tabular-nums; }
.cell.past { opacity: .5; }
.cell-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.cell-icon .ico { width: 18px; height: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 12px; border: 0;
  background: var(--surface-2); color: var(--fg); font-weight: 650; font-size: 16px; text-decoration: none;
}
.btn:active { filter: brightness(.95); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: none; color: var(--accent); }
.btn.block { width: 100%; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 140px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: none; color: var(--accent);
  display: grid; place-items: center; position: relative; flex: none;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn .dot-badge {
  position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}

.pill {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 12px;
  font-size: 12.5px; font-weight: 650; background: var(--surface-2); color: var(--muted); white-space: nowrap; flex: none;
}
.pill.warn { background: var(--danger-soft); color: var(--danger); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.c-whatsapp { --c: var(--wa); }
.c-instagram { --c: var(--ig); }
.c-tiktok { --c: var(--tiktok); }
.c-test { --c: var(--test); }
.c-manual { --c: var(--manual); }
.ch { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 650; color: var(--c); white-space: nowrap; }
.ch::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

.avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; position: relative;
  font: 700 18px/1 var(--font-display); color: var(--c, var(--accent));
  background: color-mix(in srgb, var(--c, var(--accent)) 14%, var(--surface));
}
.avatar.sm { width: 36px; height: 36px; font-size: 15px; }
.avatar .unread-dot { position: absolute; top: 0; right: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }

.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l)); padding: 2px var(--gutter-r) 2px var(--gutter-l);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14px; font-weight: 650; display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip .count { background: var(--danger); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 12px; line-height: 18px; }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty b { color: var(--fg); font-size: 17px; }
.empty p { margin: 0; max-width: 36ch; }

/* Formulare */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; font-weight: 650; color: var(--muted); }
.field small { font-size: 13px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-size: 16px; -webkit-appearance: none; appearance: none;
}
.select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-2 > * { min-width: 0; }
.form-error { color: var(--danger); font-size: 14px; margin: 0; }
.hint { font-size: 14px; color: var(--muted); margin: 0; }
.pw { position: relative; }
.pw .input { padding-right: 76px; }
.pw button { position: absolute; right: 6px; top: 6px; height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--accent); font-weight: 650; font-size: 14px; }

.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; margin: 0; border-radius: 16px; background: var(--line); transition: background .2s; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(20px); }
.switch input:disabled { opacity: .5; }

.segmented { display: flex; background: var(--surface-2); border-radius: 10px; padding: 2px; gap: 2px; }
.segmented button { flex: 1; border: 0; background: none; border-radius: 8px; min-height: 34px; font-size: 14px; font-weight: 650; color: var(--muted); padding: 0 10px; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

.code-box {
  font: 13px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--surface-2); border-radius: 10px;
  padding: 10px 12px; overflow-wrap: anywhere; -webkit-user-select: all; user-select: all;
}

/* ---------- Heute ---------- */
.next-card { display: flex; flex-direction: column; gap: 10px; border: 0; text-align: left; width: 100%; border-left: 5px solid var(--c, var(--accent)); }
.next-card .when { display: flex; align-items: baseline; gap: 10px; }
.next-card .big-time { font: 750 34px/1 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.next-card .who { font-size: 19px; font-weight: 700; }
.next-card .what { color: var(--muted); }
.attention .cell .title { color: var(--fg); }
.attention { border: 1.5px solid color-mix(in srgb, var(--danger) 45%, transparent); }
.setup-card { display: flex; flex-direction: column; gap: 4px; }
.setup-card .progress { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 6px 0 4px; }
.setup-card .progress span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.check-ico { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: transparent; }
.check-ico.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-ico .ico { width: 16px; height: 16px; }
.cell.done .title { color: var(--muted); text-decoration: line-through; }
.stats { display: flex; gap: 10px; }
.stat { flex: 1; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.stat b { display: block; font: 750 24px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

/* ---------- Chats ---------- */
.search {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 12px; padding: 0 12px; min-height: 42px; color: var(--muted);
}
.search input { flex: 1; border: 0; background: none; min-height: 42px; font-size: 16px; outline: none; color: var(--fg); }
.conv-row .line1 { display: flex; align-items: baseline; gap: 8px; }
.conv-row .line1 .title { flex: 1; }
.conv-row .line1 time { color: var(--muted); font-size: 13px; flex: none; }
.conv-row .line2 { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.conv-row .line2 .meta { flex: 1; }
.conv-row.unread .title { font-weight: 750; }
.conv-row.unread .meta { color: var(--fg); }

.chat { display: flex; flex-direction: column; height: 100dvh; background: var(--bg); }
.app.in-chat .tabbar { display: none; }
.app.in-chat .main { padding-bottom: 0; }
.chat .topbar { position: static; border-bottom: 1px solid var(--line); }
.chat-name { border: 0; background: none; padding: 0; text-align: left; min-width: 0; display: block; width: 100%; }
.chat-banners { display: flex; flex-direction: column; gap: 6px; padding: 8px var(--gutter-r) 0 var(--gutter-l); }
.banner {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; font-size: 14px;
  background: var(--surface-2); color: var(--fg);
}
.banner .grow { flex: 1; min-width: 0; }
.banner.ok { background: var(--accent-soft); }
.banner.warn { background: var(--danger-soft); color: var(--danger); }
.banner .btn.small { flex: none; }
.banner.appt { background: var(--surface); box-shadow: var(--shadow); border: 0; width: 100%; text-align: left; }
.messages { flex: 1; overflow-y: auto; padding: 12px var(--gutter-r) 16px var(--gutter-l); display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.day-sep { align-self: center; font-size: 12px; font-weight: 650; color: var(--muted); margin: 10px 0 4px; }
.bubble { max-width: min(82%, 560px); padding: 9px 13px; border-radius: 19px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.35; }
.bubble.in { align-self: flex-start; background: var(--surface); box-shadow: var(--shadow); border-bottom-left-radius: 6px; }
.bubble.out { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.bubble.out.bot { background: var(--accent-soft); color: var(--fg); }
.bubble .who { display: block; font-size: 12px; font-weight: 700; opacity: .75; margin-bottom: 2px; }
.bubble .stamp { display: block; font-size: 11px; opacity: .65; margin-top: 3px; text-align: right; }
.bubble.failed { box-shadow: 0 0 0 2px var(--danger); }
.bubble .fail { display: block; font-size: 12px; font-weight: 650; color: var(--danger); margin-top: 4px; white-space: normal; }
.bubble.out:not(.bot) .fail { color: #FFE1D3; }
.composer {
  border-top: 1px solid var(--line); background: var(--surface);
  padding: 8px var(--gutter-r) calc(8px + env(safe-area-inset-bottom)) var(--gutter-l);
  display: flex; flex-direction: column; gap: 8px;
}
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea {
  flex: 1; min-height: 42px; max-height: 150px; resize: none; border-radius: 21px; padding: 10px 16px;
  border: 1px solid var(--line); background: var(--bg); font-size: 16px; line-height: 1.3;
}
.composer textarea:focus { outline: none; border-color: var(--accent); }
.send-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.send-btn[disabled] { opacity: .4; }
.quick { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick .chip { height: 32px; font-size: 13.5px; }

/* ---------- Kalender ---------- */
.month-row { display: flex; align-items: center; gap: 8px; }
.month-row h2 { margin: 0; flex: 1; font: 700 17px/1.2 var(--font-display); }
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.day-pill { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0 6px; border: 0; background: none; border-radius: 12px; }
.day-pill .wd { font-size: 12px; font-weight: 650; color: var(--muted); }
.day-pill .n { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.day-pill.today .n { color: var(--accent); font-weight: 800; }
.day-pill.closed .n { color: var(--muted); font-weight: 500; }
.day-pill[aria-pressed="true"] .n { background: var(--accent); color: var(--accent-ink); }
.day-pill .dots { display: flex; gap: 3px; height: 6px; }
.day-pill .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--accent)); }
.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.day-head h3 { margin: 0; font: 700 20px/1.2 var(--font-display); }
.agenda { display: flex; flex-direction: column; gap: 8px; }
.agenda-row { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 10px; align-items: start; }
.agenda-time { text-align: right; padding-top: 11px; font-weight: 650; font-variant-numeric: tabular-nums; font-size: 15px; }
.agenda-time small { display: block; color: var(--muted); font-weight: 500; font-size: 12.5px; }
.appt-card {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; border: 0;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 11px 14px; border-left: 4px solid var(--c, var(--accent));
}
.appt-card .title { font-weight: 700; }
.appt-card .meta { color: var(--muted); font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.appt-card.cancelled { opacity: .55; }
.appt-card.cancelled .title { text-decoration: line-through; }
.appt-card.block { border-left-color: var(--muted); background: repeating-linear-gradient(135deg, var(--surface-2) 0 8px, var(--surface) 8px 16px); }
.gap-row {
  width: 100%; text-align: left; border: 1.5px dashed var(--line); border-radius: 12px; background: none;
  padding: 10px 14px; color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 8px;
}
.gap-row b { color: var(--accent); font-weight: 650; }
.gap-row:active { background: var(--surface-2); }

.week-wrap { overflow-x: auto; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.week-grid { display: grid; grid-template-columns: 52px repeat(7, minmax(110px, 1fr)); min-width: 820px; }
.week-grid .wh { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 4px; text-align: center; font-size: 13px; color: var(--muted); z-index: 2; }
.week-grid .wh b { display: block; font: 700 17px/1.2 var(--font-display); color: var(--fg); }
.week-grid .wh.today b { color: var(--accent); }
.week-gutter, .week-col { position: relative; }
.week-gutter span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.week-col { border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 52px; }
.week-col .closed-shade { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, transparent 6px 12px); }
.week-col .w-appt { position: absolute; left: 3px; right: 3px; border-radius: 7px; padding: 3px 6px; font-size: 12px; line-height: 1.25; overflow: hidden; border: 0; text-align: left; background: color-mix(in srgb, var(--c, var(--accent)) 16%, var(--surface)); border-left: 3px solid var(--c, var(--accent)); color: var(--fg); }
.week-col .w-appt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-col .w-appt.block { background: var(--surface-2); border-left-color: var(--muted); }
.week-col .w-appt.cancelled { opacity: .5; text-decoration: line-through; }
.week-col .now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 1; }

/* ---------- Einstellungen ---------- */
.profile { display: flex; align-items: center; gap: 14px; }
.profile .avatar { width: 56px; height: 56px; font-size: 22px; }
.profile b { display: block; font-size: 18px; }
.day-hours { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; }
.day-hours + .day-hours { border-top: 1px solid var(--line); }
.day-hours .row { display: flex; align-items: center; gap: 12px; }
.day-hours .row .grow { flex: 1; font-weight: 650; }
.day-hours .times { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.day-hours .times .input { min-height: 42px; padding: 8px 10px; }
.day-hours .add-pause { align-self: flex-start; border: 0; background: none; color: var(--accent); font-weight: 650; font-size: 14px; padding: 4px 0; }
.channel-card { display: flex; flex-direction: column; gap: 10px; }
.channel-card .head { display: flex; align-items: center; gap: 10px; }
.channel-card .head b { flex: 1; font-size: 17px; }
.channel-card p { margin: 0; color: var(--muted); font-size: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.footer-links { text-align: center; color: var(--muted); font-size: 13px; padding: 4px 0 8px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- Sheets, Hinweise ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(5, 12, 10, .4); animation: fade .2s ease-out; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 6px var(--gutter-r) calc(18px + env(safe-area-inset-bottom)) var(--gutter-l);
  animation: sheet-up .28s cubic-bezier(.2, .8, .2, 1);
  display: flex; flex-direction: column; gap: 14px;
}
.sheet .grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 2px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; }
.sheet-head h2 { flex: 1; margin: 0; font: 750 21px/1.25 var(--font-display); }
.sheet-head .icon-btn { color: var(--muted); background: var(--surface-2); width: 32px; height: 32px; }
.sheet-head .icon-btn .ico { width: 18px; height: 18px; }
.sheet .details { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.sheet .details dt { color: var(--muted); }
.sheet .details dd { margin: 0; overflow-wrap: anywhere; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; counter-increment: step; }
.steps li::before { content: counter(step); width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 750; }
.steps li .ico { vertical-align: -5px; color: var(--accent); }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -47%) scale(.98); } }

.toasts {
  position: fixed; z-index: 50; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  width: min(440px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto; background: var(--fg); color: var(--bg); border-radius: 14px; padding: 12px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-size: 15px; animation: toast-in .25s ease-out; border: 0; text-align: left;
}
.toast b { display: block; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.app.in-chat ~ .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }

/* ---------- Breite Bildschirme (iPad, Computer) ---------- */
@media (min-width: 700px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%);
    width: min(540px, 92vw); max-height: 86dvh; border-radius: 20px; padding-bottom: 20px; animation: pop .2s ease-out;
  }
  .sheet .grabber { display: none; }
}
@media (min-width: 900px) {
  .tabbar {
    top: 0; right: auto; width: 230px; grid-template-columns: 1fr; grid-auto-rows: min-content; align-content: start; gap: 2px;
    border-top: 0; border-right: 1px solid var(--line); padding: calc(env(safe-area-inset-top) + 18px) 12px 18px max(12px, env(safe-area-inset-left));
  }
  .tab { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 15px; min-height: 44px; padding: 0 12px; border-radius: 10px; }
  .tab[aria-current="page"] { background: var(--accent-soft); }
  .tab .tab-badge { position: static; margin-left: auto; }
  .tabbar .brand-row { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; font: 800 20px/1 var(--font-display); }
  .main, .app.in-chat .main { margin-left: 230px; padding-bottom: 32px; }
  .app.in-chat .tabbar { display: grid; }
  .toasts, .app.in-chat ~ .toasts { bottom: 24px; left: calc(50% + 115px); }
  .split { display: grid; grid-template-columns: 360px minmax(0, 1fr); height: 100dvh; }
  .split > aside { border-right: 1px solid var(--line); overflow-y: auto; }
  .split > aside .content { padding-top: 0; }
  .split .chat { height: 100dvh; }
  .split .chat .back-btn { display: none; }
}

/* ---------- Datenschutzseite ---------- */
body.legal { background: var(--bg); }
.legal-page { max-width: 68ch; margin: 0 auto; padding: 32px max(20px, env(safe-area-inset-right)) 48px max(20px, env(safe-area-inset-left)); }
.legal-page h1 { font: 750 30px/1.2 var(--font-display); }
.legal-page h2 { font-size: 18px; margin-top: 28px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
