/* DAVOSchönisch – Designrichtung «Bergmorgen» */
:root {
  --bg: #f2f4f6;
  --karte: #ffffff;
  --text: #1c2833;
  --text-2: #5b6874;
  --linie: #e1e6eb;
  --himmel: #dfe7ee;
  --primaer: #2e5a78;
  --primaer-dunkel: #234861;
  --gletscher: #9fb6c8;
  --fels: #3e5a70;

  --tanne: #2f6b55;
  --bergrot: #c0612d;
  --seeblau: #3a52a3;
  --arve: #8a6a3e;
  --enzian: #4b3fa0;
  --stein: #6b7682;

  --ok-bg: #e3f0ea; --ok: #23624a;
  --warn-bg: #fbe9df; --warn: #a2481b;
  --nein-bg: #f6e2e2; --nein: #9b2c2c;
  --grau-bg: #eceff2;

  --radius: 18px;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.45 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primaer); }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; margin: 0; }

.huelle { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; padding-bottom: calc(var(--nav-h) + 96px + var(--safe-b)); }
.inhalt { padding: 0 16px; }

/* ---------- Kopf ---------- */
.kopf { position: relative; height: 230px; overflow: hidden; background: linear-gradient(#dbe5ee, #e8eef3); }
.kopf svg.berge { position: absolute; inset: 0; width: 100%; height: 100%; }
.kopf .titel { position: absolute; left: 20px; top: 18px; z-index: 2; }
.kopf h1 { font-size: clamp(26px, 8vw, 34px); max-width: calc(100% - 120px); line-height: 1.05; }
.kopf .unter { font-weight: 500; color: #33424f; margin-top: 2px; }
.kopf .aktionen { position: absolute; right: 14px; top: 14px; z-index: 3; display: flex; gap: 8px; }
.kopf .steinbock { position: absolute; right: 30px; bottom: 62px; width: 92px; height: 92px; color: #1f3a4f; z-index: 2; --grat: #dbe5ee; }

.kopf-klein { position: relative; padding: 18px 20px 30px; }
.kopf-klein h1 { font-size: clamp(24px, 7.4vw, 30px); line-height: 1.1; padding-right: 118px; }
.kopf-klein .unter { padding-right: 118px; }
.kopf-klein .unter { color: var(--text-2); font-weight: 500; font-size: 15px; }
.kopf-klein svg.grat { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 26px; }
.kopf-klein .aktionen { position: absolute; right: 14px; top: 14px; display: flex; gap: 8px; }

.rundknopf { position: relative; width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--linie); background: rgba(255,255,255,.9); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(30,50,70,.08); }
.rundknopf svg { width: 22px; height: 22px; }
.rundknopf .badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--bergrot); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.avatar { width: 46px; height: 46px; border-radius: 14px; color: #fff; font-weight: 700; font-size: 15px; display: grid; place-items: center; border: 0; }

/* ---------- Monatskalender ---------- */
.monat-kopf { display: flex; align-items: center; justify-content: space-between; padding: 16px 4px 10px; }
.monat-kopf h2 { font-family: var(--sans); font-weight: 700; font-size: 21px; letter-spacing: 0; }
.pfeil { width: 44px; height: 44px; border: 0; background: none; border-radius: 12px; display: grid; place-items: center; }
.pfeil:disabled { opacity: .25; cursor: default; }
.pfeil svg { width: 22px; height: 22px; }
.wochentage, .raster { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wochentage div { text-align: center; color: var(--text-2); font-size: 13px; padding-bottom: 4px; }
.raster { touch-action: pan-y; }
.tag { min-height: 64px; background: var(--karte); border: 0; border-radius: 12px; padding: 7px 4px 6px; display: flex; flex-direction: column; align-items: stretch; gap: 3px; box-shadow: 0 1px 2px rgba(30,50,70,.05); text-align: center; }
.tag .nr { font-weight: 600; font-size: 15px; margin-bottom: 3px; }
.tag.we .nr { color: var(--primaer); }
.tag.heute { outline: 2px solid var(--primaer); outline-offset: -2px; }
.tag.leer { background: transparent; box-shadow: none; pointer-events: none; }
.tag:disabled { opacity: .4; cursor: default; }
.tag:not(:disabled):active { transform: scale(.96); }
.balken { height: 7px; border-radius: 4px; background: var(--c); }
.balken.provisorisch { background: repeating-linear-gradient(-45deg, var(--c) 0 3px, color-mix(in srgb, var(--c) 30%, #fff) 3px 6px); }
.balken.angefragt { background: color-mix(in srgb, var(--c) 14%, #fff); border: 1.5px dashed var(--c); height: 8px; }
.balken.angefragt.provisorisch { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 30%, #fff) 0 3px, #fff 3px 6px); }

.legende { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 14px 4px 0; color: #33424f; font-size: 14px; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { display: inline-block; width: 13px; height: 13px; border-radius: 4px; background: var(--c); }
.legende .bsp { width: 24px; --c: var(--stein); }

/* ---------- Karten & Listen ---------- */
.abschnitt { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); margin: 26px 4px 10px; }
.karte { background: var(--karte); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px rgba(30,50,70,.06); }
.liste { display: flex; flex-direction: column; gap: 10px; }
.eintrag { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; border: 0; background: var(--karte); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 1px 3px rgba(30,50,70,.06); }
.eintrag .avatar { width: 48px; height: 48px; flex: none; }
.eintrag .mitte { flex: 1; min-width: 0; }
.eintrag .t1 { font-weight: 600; }
.eintrag .t2 { color: var(--text-2); font-size: 14.5px; }
.eintrag .t3 { color: var(--text-2); font-size: 13.5px; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.chip.bewilligt { background: var(--ok-bg); color: var(--ok); }
.chip.angefragt { background: var(--warn-bg); color: var(--warn); }
.chip.abgelehnt { background: var(--nein-bg); color: var(--nein); }
.chip.storniert { background: var(--grau-bg); color: var(--text-2); }
.leer-hinweis { color: var(--text-2); text-align: center; padding: 28px 12px; }
.filter { display: flex; gap: 8px; margin: 4px 0 6px; flex-wrap: wrap; }
.filter button { border: 1px solid var(--linie); background: var(--karte); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 500; }
.filter button.an { background: var(--primaer); border-color: var(--primaer); color: #fff; }

.anfrage-aktionen { display: flex; gap: 10px; margin-top: 12px; }

/* ---------- Knöpfe ---------- */
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border-radius: 14px; border: 0; font-weight: 600; font-size: 16px; background: var(--primaer); color: #fff; }
.knopf:active { background: var(--primaer-dunkel); }
.knopf.zweit { background: var(--karte); color: var(--text); border: 1px solid var(--linie); }
.knopf.gruen { background: var(--tanne); }
.knopf.rot { background: var(--karte); color: var(--nein); border: 1px solid #e8c9c9; }
.knopf.voll { width: 100%; }
.knopf:disabled { opacity: .5; }
.buchen-fix { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 14px + var(--safe-b)); width: min(560px, 100%); padding: 0 16px; z-index: 20; }
.buchen-fix .knopf { width: 100%; min-height: 58px; font-size: 19px; border-radius: 16px; box-shadow: 0 6px 18px rgba(35,72,97,.28); }

/* ---------- Navigation ---------- */
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--linie); padding-bottom: var(--safe-b); }
nav.tabs .innen { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); height: var(--nav-h); }
nav.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--text-2); font-size: 12.5px; font-weight: 500; position: relative; }
nav.tabs a svg { width: 25px; height: 25px; }
nav.tabs a.aktiv { color: var(--primaer); font-weight: 700; }
nav.tabs a .badge { position: absolute; top: 7px; left: calc(50% + 8px); min-width: 17px; height: 17px; border-radius: 9px; background: var(--bergrot); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }

/* ---------- Bottom Sheet ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(20,32,44,.38); z-index: 50; animation: ein .15s ease-out; }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(560px, 100%); max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0; z-index: 51; padding: 10px 18px calc(22px + var(--safe-b)); animation: hoch .2s ease-out; }
.sheet .griff { width: 42px; height: 5px; border-radius: 3px; background: #c9d1d8; margin: 0 auto 12px; }
.sheet h2 { font-size: 26px; margin-bottom: 14px; }
@keyframes ein { from { opacity: 0; } }
@keyframes hoch { from { transform: translate(-50%, 40px); opacity: 0; } }

.feld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.feld label, .feld .label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.feld input, .feld select, .feld textarea { width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 12px; border: 1px solid #d5dce3; background: var(--karte); font-size: 16px; }
.feld textarea { min-height: 76px; resize: vertical; }
.feld input:focus, .feld select:focus, .feld textarea:focus { outline: 2px solid var(--primaer); outline-offset: -1px; border-color: transparent; }
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segment { display: grid; grid-template-columns: 1fr 1fr; background: #e4e9ee; border-radius: 12px; padding: 4px; gap: 4px; }
.segment button { border: 0; background: transparent; border-radius: 9px; min-height: 44px; font-weight: 600; color: var(--text-2); }
.segment button.an { background: var(--karte); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.naechte { font-size: 14.5px; color: var(--text-2); margin: -4px 0 14px; }
.fehler { background: var(--nein-bg); color: var(--nein); padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14.5px; }
.info { background: #e6eef5; color: #29465c; padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14.5px; }
.schon-da { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.schon-da button { border: 0; border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); }
.knopfreihe { display: flex; gap: 10px; flex-wrap: wrap; }
.knopfreihe .knopf { flex: 1; }
.detail-zeile { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--linie); }
.detail-zeile:last-child { border-bottom: 0; }
.detail-zeile span:first-child { color: var(--text-2); }
.detail-zeile span:last-child { text-align: right; font-weight: 500; }

/* ---------- Login ---------- */
.login { max-width: 420px; margin: 0 auto; min-height: 100vh; }
.login form { padding: 0 20px 40px; margin-top: -10px; position: relative; z-index: 3; }
.login .karte { padding: 22px 18px; }
.demo { font-size: 13.5px; color: var(--text-2); margin-top: 14px; text-align: center; }

/* ---------- Webcam & Waxtipp ---------- */
.cam { position: relative; border-radius: var(--radius); overflow: hidden; background: #b8c8d6; aspect-ratio: 16 / 10; }
.cam iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cam .live { position: absolute; top: 12px; left: 12px; background: rgba(28,40,51,.82); color: #fff; font-size: 13px; font-weight: 700; padding: 5px 11px; border-radius: 9px; display: flex; align-items: center; gap: 7px; pointer-events: none; }
.cam .live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #e44; }
.cam-fuss { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px 0; font-size: 14px; color: var(--text-2); }
.wax-kopf { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.wax-kopf .abschnitt { margin: 0; }
.wax-kopf select { border: 1px solid var(--linie); border-radius: 10px; padding: 8px 10px; background: var(--bg); font-weight: 600; }
.wax-farbe { display: flex; gap: 14px; align-items: center; margin: 16px 0 12px; }
.wax-farbe .feld-farbe { width: 58px; height: 58px; border-radius: 12px; flex: none; border: 1px solid rgba(0,0,0,.1); }
.wax-farbe .t1 { font-weight: 700; font-size: 19px; }
.wax-farbe .t2 { color: var(--text-2); font-size: 14.5px; }
.schritte { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.schritte li { display: flex; gap: 12px; align-items: center; }
.schritte li b.n { width: 26px; height: 26px; border-radius: 50%; background: #e6eef5; color: var(--primaer); font-size: 13px; display: grid; place-items: center; flex: none; }
table.loipen { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--karte); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(30,50,70,.06); }
table.loipen th { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-2); text-align: right; padding: 12px 10px 8px; background: var(--bg); font-weight: 600; }
table.loipen th:first-child { text-align: left; padding-left: 4px; }
table.loipen td { padding: 11px 10px; border-top: 1px solid var(--linie); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.loipen td:first-child { text-align: left; white-space: normal; padding-left: 16px; }
table.loipen td small { display: block; color: var(--text-2); font-size: 13px; }
table.loipen td.ob { color: var(--primaer); font-weight: 600; }
.quelle { font-size: 13.5px; color: var(--text-2); margin: 10px 4px 0; }
.demo-band { display: inline-block; background: var(--warn-bg); color: var(--warn); font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; margin-left: 6px; }

/* ---------- Statistik ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi .zahl { font-family: var(--serif); font-size: 40px; line-height: 1.1; }
.kpi .txt { color: var(--text-2); font-size: 14px; }
.stat-zeile { margin-bottom: 16px; }
.stat-zeile .oben { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 6px; }
.stat-zeile .spur { height: 18px; border-radius: 6px; background: #edf1f4; display: flex; overflow: hidden; }
.stat-zeile .spur div { height: 100%; }
.stat-zeile .spur .p { background: repeating-linear-gradient(-45deg, var(--c) 0 4px, color-mix(in srgb, var(--c) 30%, #fff) 4px 8px); }

/* ---------- Admin ---------- */
.farbwahl { display: flex; gap: 8px; flex-wrap: wrap; }
.farbwahl button { width: 40px; height: 40px; border-radius: 12px; border: 3px solid transparent; background: var(--c); }
.farbwahl button.an { border-color: var(--text); }
.mail { border-bottom: 1px solid var(--linie); padding: 12px 0; }
.mail:last-child { border: 0; }
.mail .an { font-size: 13px; color: var(--text-2); }
.mail .betreff { font-weight: 600; }
.mail pre { white-space: pre-wrap; font: 13.5px/1.45 var(--sans); color: #33424f; margin: 6px 0 0; }

#toast { position: fixed; left: 50%; top: 0; transform: translateX(-50%) translateY(-110%); visibility: hidden; background: #1c2833; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 500; z-index: 100; transition: transform .25s; max-width: 90vw; }
#toast.zeigen { transform: translateX(-50%) translateY(16px); visibility: visible; }

@media (min-width: 600px) {
  .kopf { border-radius: 0 0 26px 26px; }
  .tag { min-height: 74px; }
}

/* ---------- Schalter (Feature-Toggles) ---------- */
.schalter-zeile { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.schalter-zeile small { display: block; color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.schalter { appearance: none; -webkit-appearance: none; flex: none; width: 52px; height: 32px; border-radius: 16px; background: #cfd7de; position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.schalter::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.schalter:checked { background: var(--tanne); }
.schalter:checked::after { transform: translateX(20px); }
.schalter:focus-visible { outline: 2px solid var(--primaer); outline-offset: 2px; }

/* ---------- Aktivitätsprotokoll ---------- */
.log { padding: 11px 0 11px 12px; border-bottom: 1px solid var(--linie); border-left: 3px solid var(--linie); margin-left: -4px; }
.log:last-child { border-bottom: 0; }
.log.ok { border-left-color: var(--tanne); }
.log.warn { border-left-color: #d9a441; }
.log.fehler { border-left-color: var(--nein); background: linear-gradient(90deg, var(--nein-bg), transparent 60%); }
.log-kopf { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--text-2); }
.log-text { font-size: 14.5px; margin-top: 2px; }
.log-ip { display: block; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }


/* Icons in Knöpfen immer fest dimensionieren */
.knopf svg { width: 20px; height: 20px; flex: none; }
.buchen-fix .knopf svg { width: 24px; height: 24px; }

/* Link mit Kopier-Knopf im selben Feld */
.kopierfeld { display: flex; align-items: stretch; border: 1px solid #d5dce3; border-radius: 12px; background: var(--karte); overflow: hidden; }
.kopierfeld input { flex: 1; min-width: 0; border: 0 !important; border-radius: 0 !important; background: transparent !important; color: var(--text-2); }
.kopierfeld input:focus { outline: none !important; }
.kopierfeld .knopf { min-height: 0; border-radius: 0; padding: 0 16px; font-size: 15px; }
