/* Wohnung Wien — iPhone-first, auch am Desktop, hell/dunkel */
:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #6e6e73;
  --faint: #a1a1a6;
  --line: rgba(60, 60, 67, 0.16);
  --fill: rgba(118, 118, 128, 0.12);
  --accent: #0e7490;
  --accent-weak: rgba(14, 116, 144, 0.12);
  --fix: #2f9e44;
  --fix-weak: #d9ead3;
  --res: #f08c00;
  --res-weak: #fff3bf;
  --res-text: #5c3c00;
  --ok: #1f8a3b;
  --ok-weak: rgba(52, 199, 89, 0.16);
  --warn: #b25000;
  --warn-weak: rgba(255, 159, 10, 0.18);
  --bad: #d70015;
  --bad-weak: rgba(255, 59, 48, 0.13);
  --radius: 14px;
  --tabbar-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f5f5f7;
    --muted: #98989f;
    --faint: #6c6c70;
    --line: rgba(84, 84, 88, 0.65);
    --fill: rgba(118, 118, 128, 0.24);
    --accent: #3bc9db;
    --accent-weak: rgba(59, 201, 219, 0.18);
    --fix: #40c057;
    --fix-weak: rgba(64, 192, 87, 0.28);
    --res: #fcc419;
    --res-weak: rgba(252, 196, 25, 0.22);
    --res-text: #ffe8a3;
    --ok: #30d158;
    --ok-weak: rgba(48, 209, 88, 0.18);
    --warn: #ff9f0a;
    --warn-weak: rgba(255, 159, 10, 0.2);
    --bad: #ff453a;
    --bad-weak: rgba(255, 69, 58, 0.18);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.no-scroll { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; }
p { margin: 0 0 10px; }
.icon { flex: none; vertical-align: -0.2em; }

.app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px);
}
.splash { min-height: 100vh; display: grid; place-items: center; }

/* ---------- Kopfzeile */
header.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: calc(var(--safe-t) + 6px) 8px 6px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
header.top h1 { font-size: 17px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-side { display: flex; align-items: center; min-width: 0; }
.top-side.right { justify-content: flex-end; }
.large-title { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; padding: 0 16px 6px; }

.link-btn {
  background: none; border: 0; color: var(--accent); padding: 8px; display: inline-flex; align-items: center; gap: 2px;
  font-size: 17px;
}
.link-btn.small { font-size: 14px; padding: 8px 0 0; }
.link-btn.center { display: block; margin: 10px auto 0; }
.link-btn:disabled { color: var(--faint); }
.icon-btn {
  background: none; border: 0; color: var(--accent); width: 44px; height: 44px; display: inline-grid; place-items: center;
  border-radius: 50%;
}
.icon-btn:active { background: var(--fill); }
.plain { background: none; border: 0; padding: 0; text-align: inherit; }
.left { text-align: left; }

/* ---------- Karten & Listen */
.card {
  background: var(--card);
  border-radius: var(--radius);
  margin: 10px 16px;
  padding: 14px 16px;
}
.card.link { display: flex; gap: 10px; align-items: flex-start; color: inherit; }
.list {
  background: var(--card);
  border-radius: var(--radius);
  margin: 8px 16px;
  overflow: hidden;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--line);
  color: inherit;
}
.row:last-child { border-bottom: 0; }
.row.link:active, a.row:active { background: var(--fill); }
.row-main { flex: 1; min-width: 0; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row.inactive { opacity: 0.55; }
.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin: 22px 32px 6px;
}
.pad { padding: 12px 16px; }
.pad-x { padding-left: 16px; padding-right: 16px; }
.stack { display: grid; gap: 10px; }
.stack.pad { padding: 12px 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-bad { color: var(--bad); }
.text-accent { color: var(--accent); }
.h2 { font-size: 19px; font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.note { margin: 10px 0 0; padding: 10px 12px; background: var(--fill); border-radius: 10px; white-space: pre-wrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; }

/* ---------- Buttons */
.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 17px;
  background: var(--accent);
  color: #fff;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}
.btn:active { filter: brightness(0.92); }
.btn.secondary { background: var(--accent-weak); color: var(--accent); }
.btn.danger { background: var(--bad-weak); color: var(--bad); }
.btn.small { width: auto; padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: 0.45; }
a.btn { color: #fff; }
a.btn.secondary { color: var(--accent); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; line-height: 1;
  padding: 5px 8px; border-radius: 999px;
  background: var(--fill); color: var(--muted); white-space: nowrap;
}
.chip.ok { background: var(--ok-weak); color: var(--ok); }
.chip.warn { background: var(--warn-weak); color: var(--warn); }
.chip.bad { background: var(--bad-weak); color: var(--bad); }
.chip.accent { background: var(--accent-weak); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 16px; }
.chip-btn {
  border: 0; background: var(--card); color: var(--accent); font-size: 14px; font-weight: 600;
  padding: 8px 12px; border-radius: 999px;
}
.chip-btn.active { background: var(--accent); color: #fff; }

.segmented {
  display: flex; background: var(--fill); border-radius: 10px; padding: 2px; margin: 4px 16px 8px;
}
.segmented.pad-x { margin-left: 16px; margin-right: 16px; padding: 2px; }
.segmented.inline { margin: 4px 0 0; }
.segmented button {
  flex: 1; border: 0; background: none; padding: 7px 8px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--text);
}
.segmented button.active { background: var(--card); color: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), inset 0 0 0 1px var(--accent-weak); }

/* ---------- Formulare */
.form { padding-bottom: 8px; }
.field { display: block; padding: 9px 16px; border-bottom: 0.5px solid var(--line); }
.list .field:last-child { border-bottom: 0; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.field-hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1.4fr 1fr; border-bottom: 0.5px solid var(--line); }
.field-row .field { border-bottom: 0; }
.field-row .field + .field { border-left: 0.5px solid var(--line); }
input, select, textarea {
  font: 17px var(--font);
  color: var(--text);
  background: transparent;
  border: 0;
  width: 100%;
  padding: 4px 0;
  outline: none;
  border-radius: 0;
}
input[type="date"], input[type="time"] { min-height: 30px; -webkit-appearance: none; appearance: none; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; }
input:disabled { color: var(--faint); }
select { -webkit-appearance: none; appearance: none; background: transparent; }
textarea { resize: vertical; min-height: 60px; }
.card input[type="email"], .card input.code-input {
  background: var(--fill); border-radius: 10px; padding: 12px; margin: 4px 0 12px;
}
.code-input { font-size: 22px; letter-spacing: 0.12em; text-align: center; font-variant-numeric: tabular-nums; }
.inline-input { font-weight: 600; padding: 0; }
.num-input { width: 80px; text-align: right; background: var(--fill); border-radius: 8px; padding: 6px 8px; }
.num-input.wide { width: 104px; }
input[type="color"] { height: 34px; padding: 0; }
.switch {
  -webkit-appearance: none; appearance: none; width: 51px; height: 31px; border-radius: 999px; background: var(--fill);
  position: relative; flex: none; transition: background 0.2s; padding: 0;
}
.switch::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, 0.25); transition: transform 0.2s;
}
.switch:checked { background: #34c759; }
.switch:checked::after { transform: translateX(20px); }

/* ---------- Hinweise */
.notice { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.notice .icon { margin-top: 1px; color: var(--accent); }
.notice.warn { background: var(--warn-weak); }
.notice.warn .icon { color: var(--warn); }
.notice.bad { background: var(--bad-weak); }
.notice.bad .icon { color: var(--bad); }
.error-box { background: var(--bad-weak); color: var(--bad); }
.error-box p { margin: 0 0 8px; }
.error-box p:last-child { margin: 0; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 28px; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Status */
.status-card { padding: 16px; }
.sc-name { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 6px; }
.sc-status { margin-top: 4px; font-size: 16px; }
.sc-next { margin-top: 6px; }
.status-free { color: var(--ok); font-weight: 700; }
.status-busy { color: var(--accent); font-weight: 700; }

/* ---------- Kalender (Monat) */
.cal { background: var(--card); border-radius: var(--radius); margin: 12px 16px; padding: 6px 6px 10px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 4px; }
.cal-head h2 { font-size: 17px; font-weight: 700; text-align: center; }
.cal-head .icon-btn:disabled { opacity: 0.3; }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; padding-bottom: 4px; }
.wk { position: relative; min-height: 58px; border-top: 0.5px solid var(--line); }
.wk-days { display: grid; grid-template-columns: repeat(7, 1fr); height: 100%; }
.cal-day {
  min-height: 58px; border: 0; background: none; padding: 4px 0 0; display: flex; flex-direction: column; align-items: center;
  min-width: 0; border-radius: 0;
}
.cal-day:active:not(:disabled) { background: var(--fill); }
.cal-day:disabled { cursor: default; }
.cal-day .num {
  font-size: 15px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%;
  font-variant-numeric: tabular-nums;
}
.cal-day.today .num { background: var(--accent); color: #fff; font-weight: 700; }
.cal-day.other { opacity: 0.35; }
.cal-day.past:not(.today) .num { color: var(--muted); }
.cal-day:disabled .num { color: var(--faint); }
.cal-day.full:not(.past) .num { text-decoration: line-through; text-decoration-color: var(--faint); }
.cal-day.in-sel { background: var(--accent-weak); }
.cal-day.sel-start { border-top-left-radius: 12px; border-bottom-left-radius: 12px; }
.cal-day.sel-end { border-top-right-radius: 12px; border-bottom-right-radius: 12px; }
.cal-day.sel-start .num, .cal-day.sel-end .num { background: var(--accent); color: #fff; font-weight: 700; }
.wk-bars { position: absolute; left: 0; right: 0; bottom: 6px; height: 18px; pointer-events: none; }
.bar {
  position: absolute; top: 0; height: 18px; border-radius: 6px; font-size: 11px; font-weight: 600; line-height: 18px;
  padding: 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff;
}
.bar.confirmed { background: var(--fix); }
.bar.reserved {
  color: var(--res-text); background: repeating-linear-gradient(135deg, var(--res-weak) 0 6px, color-mix(in srgb, var(--res) 35%, var(--res-weak)) 6px 9px);
  box-shadow: inset 0 0 0 1.5px var(--res);
}
.bar.mine { box-shadow: inset 0 0 0 2px var(--accent); }
.bar.reserved.mine { box-shadow: inset 0 0 0 2px var(--accent); }
.bar.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bar.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; padding: 10px 8px 0; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-bar { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-bar.confirmed { background: var(--fix); }
.legend-bar.reserved { background: var(--res-weak); box-shadow: inset 0 0 0 1.5px var(--res); }
.legend-bar.mine { box-shadow: inset 0 0 0 2px var(--accent); }
.dot.confirmed { background: var(--fix); }
.dot.reserved { background: var(--res-weak); box-shadow: inset 0 0 0 2px var(--res); }
.dot.cancelled, .dot.expired { background: var(--faint); }
.big-dot { width: 16px; height: 16px; }

/* ---------- Jahresübersicht (wie das Google Sheet) */
.year { background: var(--card); border-radius: var(--radius); margin: 12px 16px; padding: 6px 6px 10px; }
.year-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.year-table { border-collapse: collapse; font-size: 12px; width: 100%; min-width: 860px; table-layout: fixed; }
.year-table thead th:first-child { width: 28px; }
.year-table th { font-weight: 600; color: var(--muted); padding: 3px 2px; text-align: center; white-space: nowrap; }
.year-table thead th { position: sticky; top: 0; background: var(--card); }
.year-table tbody th { width: 26px; position: sticky; left: 0; background: var(--card); z-index: 1; font-variant-numeric: tabular-nums; }
.year-table td { border: 0.5px solid var(--line); height: 22px; padding: 0; overflow: hidden; }
.year-table td.we { background: color-mix(in srgb, var(--fill) 45%, transparent); }
.year-table td.void { background: repeating-linear-gradient(135deg, transparent 0 4px, var(--line) 4px 5px); }
.year-table td.today { box-shadow: inset 0 0 0 2px var(--accent); }
.year-table td.confirmed { background: var(--fix-weak); }
.year-table td.reserved { background: var(--res-weak); }
.year-table td.past { opacity: 0.6; }
.year-table td.mine .cell-btn { font-weight: 700; }
.cell-btn { display: block; width: 100%; height: 22px; padding: 0 4px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }

/* ---------- Buchungsformular */
.guest { margin-top: 6px; }
.guest-head { display: flex; justify-content: space-between; align-items: baseline; margin: 10px 32px 0; font-size: 14px; }
.guest-head .link-btn.small { padding: 0; }
.row.choice { cursor: pointer; align-items: flex-start; }
.row.choice input[type="radio"] { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.row.choice.disabled { opacity: 0.5; }
.segmented button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

/* ---------- Checkout (eigene Seite ohne Login) */
.public-page { max-width: 560px; margin: 0 auto; padding: calc(var(--safe-t) + 28px) 0 48px; }
.public-page .login-brand h1 { font-size: 26px; margin-top: 12px; }
.public-page details { margin-top: 18px; }
.public-page summary { cursor: pointer; padding: 6px 0; }
.check { width: 22px; height: 22px; accent-color: var(--fix); flex: none; }
.stars { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.star { border: 0; background: none; font-size: 34px; line-height: 1; color: var(--faint); padding: 0 2px; }
.star.on { color: #f5b300; }
.star-label { margin-left: 8px; }

/* ---------- Detail */
.detail-head { display: flex; align-items: center; gap: 10px; }
.big-range { font-size: 20px; font-weight: 700; margin-top: 12px; }
.stay-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 6px; }
.stay-times div { display: flex; flex-direction: column; background: var(--fill); border-radius: 10px; padding: 8px 10px; }
.stay-times b { font-size: 15px; }
.contact { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; margin-right: 12px; }
.code-inline { font-variant-numeric: tabular-nums; letter-spacing: 0.08em; font-size: 17px; }
.row.full { width: 100%; text-align: left; }
.addr { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; }
.rich ul { margin: 0 0 10px; padding-left: 20px; }
.rich li { margin: 0 0 5px; }
.rich p.rich-h { font-weight: 700; margin: 10px 0 4px; }
.rich p.rich-h:first-child { margin-top: 0; }
.card.notice.link { color: inherit; }
.lockline { display: flex; gap: 6px; align-items: center; margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--muted); }

/* ---------- Admin */
.tabs-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 8px; scrollbar-width: none; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.tab-pill { flex: none; padding: 7px 14px; border-radius: 999px; background: var(--card); color: var(--text); font-size: 14px; font-weight: 600; }
.tab-pill.active { background: var(--accent); color: #fff; }
.code-display {
  font-size: 34px; font-weight: 700; letter-spacing: 0.12em; text-align: center; padding: 16px; margin: 12px 0;
  background: var(--fill); border-radius: 12px; font-variant-numeric: tabular-nums; user-select: all; -webkit-user-select: all;
}
.raw { font-size: 11px; white-space: pre-wrap; word-break: break-all; background: var(--card); padding: 10px; border-radius: 10px; }

/* ---------- Login */
.login { max-width: 420px; margin: 0 auto; padding: calc(var(--safe-t) + 48px) 0 40px; }
.login-brand { text-align: center; margin-bottom: 18px; }
.login-brand h1 { font-size: 26px; margin-top: 12px; }
.login-logo {
  width: 72px; height: 72px; border-radius: 18px; background: var(--accent); color: #fff; display: grid; place-items: center; margin: 0 auto;
}
.login .card { padding: 18px 16px; }
.login .field { padding: 0; border: 0; }
.login > p { padding: 0 24px; }
.code-input::placeholder { letter-spacing: 0.02em; font-size: 17px; }

/* ---------- Tab-Leiste */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; justify-content: center;
  background: color-mix(in srgb, var(--card) 86%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--line);
}
.tab {
  flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10px; font-weight: 600; color: var(--faint);
}
.tab.active { color: var(--accent); }
.tab-plus {
  width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center;
  margin-top: -16px; box-shadow: 0 6px 16px rgba(14, 116, 144, 0.35);
}
.tab-book { color: var(--accent); }

/* ---------- Sheet & Toast */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.38); display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.18s ease-out;
}
.sheet {
  background: var(--bg); width: 100%; max-width: 720px; max-height: 90vh; overflow-y: auto; border-radius: 16px 16px 0 0;
  padding-bottom: calc(14px + var(--safe-b)); animation: up 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  -webkit-overflow-scrolling: touch;
}
.sheet-grip { width: 36px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 0 16px; }
.sheet-head h2 { font-size: 19px; }
@keyframes up { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.toasts {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.toast {
  background: rgba(28, 28, 30, 0.94); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 15px; font-weight: 500;
  max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); animation: up 0.2s ease-out;
}
.toast.ok { background: rgba(31, 138, 59, 0.95); }
.toast.bad { background: rgba(215, 0, 21, 0.95); }

@media (min-width: 760px) {
  .app { padding-top: 8px; }
  .wk, .cal-day { min-height: 72px; }
  .bar { font-size: 12px; }
}
@media (min-width: 1000px) {
  .app { max-width: 960px; }
}
