/* Chalet Avenches - Autor: Reto Waldmann */
/* Hell ist Standard, Dunkel über die Schaltfläche (data-theme auf <html>) */
:root {
  --bg: #faf7f0;
  --surface: #ffffff;
  --surface-2: #f4f0e6;
  --ink: #23261f;
  --muted: #74746a;
  --line: #ece6d9;
  --accent: #3a7a55;
  --accent-2: #67b184;
  --accent-ink: #ffffff;
  --accent-soft: #e6f2ea;
  --danger: #c0442f;
  --today: #e8892c;
  --sky-1: #e4f1ff;
  --sky-2: #fff6e6;
  --glass: rgba(255, 255, 255, .72);
  --glow: rgba(103, 177, 132, .16);
  --glow-2: rgba(232, 137, 44, .10);
  --radius: 18px;
  --shadow: 0 1px 2px rgba(35, 38, 31, .04), 0 6px 24px rgba(35, 38, 31, .06);
  --shadow-hover: 0 2px 4px rgba(35, 38, 31, .05), 0 12px 32px rgba(35, 38, 31, .10);
  --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #141713; --surface: #1d211c; --surface-2: #252a24; --ink: #ebe8de; --muted: #a3a294; --line: #2f352e;
  --accent: #8fc7a2; --accent-2: #4f8f69; --accent-ink: #10150f; --accent-soft: #24322a; --danger: #ec806d; --today: #f0a95e;
  --sky-1: #1c2a38; --sky-2: #22261f;
  --glass: rgba(29, 33, 28, .72); --glow: rgba(143, 199, 162, .08); --glow-2: rgba(240, 169, 94, .05);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-hover: 0 8px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.55 var(--font); color: var(--ink); -webkit-font-smoothing: antialiased;
  background: radial-gradient(900px 480px at 0% -10%, var(--glow), transparent 70%),
              radial-gradient(700px 420px at 100% 0%, var(--glow-2), transparent 70%), var(--bg);
  background-attachment: fixed; min-height: 100vh;
}
h1, h2, h3 { font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.4rem; } h3 { font-size: 1.05rem; margin-top: 1.6rem; }
a { color: var(--accent); }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.error { color: var(--danger); min-height: 1.2em; margin: .25rem 0; font-size: .9rem; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* Buttons und Felder */
.btn { font: inherit; font-weight: 500; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: .5rem 1.05rem; cursor: pointer; transition: border-color .15s, background .15s, transform .15s, box-shadow .15s; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; font-weight: 600; box-shadow: 0 4px 14px var(--glow); }
.btn.primary:hover { box-shadow: 0 6px 20px rgba(58, 122, 85, .28); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn.icon { width: 2.4rem; height: 2.4rem; padding: 0; font-size: 1.25rem; line-height: 1; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .55rem .75rem; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn:focus-visible, .tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
input[type=color] { padding: .2rem; height: 2.5rem; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .75rem; }
label > input, label > select, label > textarea { margin-top: .3rem; }
label.check { display: flex; align-items: center; gap: .45rem; color: var(--ink); font-size: .95rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .8rem; align-items: end; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 .8rem; align-items: end; }
input[type=date] { min-width: 0; }
.row-end { display: flex; gap: .5rem; align-items: center; margin-top: .6rem; }

/* Anmeldung */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(600px 400px at 20% 20%, var(--glow), transparent 70%), radial-gradient(500px 360px at 85% 80%, var(--glow-2), transparent 70%); }
.auth-card { width: min(390px, 100%); background: var(--surface); padding: 2.2rem 1.8rem; border-radius: 24px; box-shadow: var(--shadow-hover); border: 1px solid var(--line); }
.auth-card h1 { font-size: 1.8rem; }
.auth-logo { width: 56px; height: 56px; display: block; margin-bottom: 1rem; }
.auth-card .btn { width: 100%; margin-top: .3rem; padding: .65rem 1rem; }

/* Kopfzeile: schwebende Glas-Pille. Der Glas-Effekt liegt auf ::before,
   damit die Handy-Leiste (position: fixed) nicht an der Kopfzeile hängen bleibt. */
.top { position: sticky; top: 12px; z-index: 5; margin: 12px auto 0; width: min(1068px, calc(100% - 32px));
  display: flex; align-items: center; gap: 1rem; padding: .45rem .5rem .45rem 1rem; border-radius: 999px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.top::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--glass); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); }
.brand { display: flex; align-items: center; gap: .55rem; font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.brand img { width: 30px; height: 30px; }
.tabs { display: flex; gap: .15rem; margin-left: auto; order: 1; padding: .2rem; border-radius: 999px; background: var(--surface-2); }
.tabs button { font: inherit; font-size: .92rem; font-weight: 500; display: flex; align-items: center; gap: .4rem; background: transparent; color: var(--muted); border: 0; padding: .42rem .85rem; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: background .2s, color .2s; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.tabs svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Umschalter Hell/Dunkel: Mond im hellen, Sonne im dunklen Modus */
.theme-toggle { order: 2; flex: none; width: 2.4rem; height: 2.4rem; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; transition: transform .3s, color .15s, border-color .15s; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); transform: rotate(-15deg); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; }
.theme-toggle .sun, .theme-icon .sun, :root[data-theme="dark"] .theme-toggle .moon, :root[data-theme="dark"] .theme-icon .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun, :root[data-theme="dark"] .theme-icon .sun { display: block; }
.more-btn { display: none !important; }
.more-btn svg circle { fill: currentColor; stroke: none; }
.auth .theme-toggle { position: fixed; top: 14px; right: 16px; }

.tab { max-width: 1100px; margin: 0 auto; padding: 1.6rem 16px 3rem; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tab { animation: none; } * { transition: none !important; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }

/* ---------- Startseite (Kacheln) ---------- */
.bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.tile { grid-column: span 2; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); min-height: 9rem; min-width: 0; transition: transform .2s, box-shadow .2s; }
.tile.wide, .tile.hero { grid-column: 1 / -1; min-height: 0; }
.tile.clickable { cursor: pointer; }
.tile.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.tile h3 { margin: 0 0 .8rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.tile h3 .link { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: .85rem; font-weight: 500; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.tile .sub { color: var(--muted); font-size: .88rem; }
.tile p { margin: .2rem 0; }

.hero { position: relative; overflow: hidden; border: 0; color: #fff; padding: 1.8rem 1.6rem;
  background: linear-gradient(120deg, #2f6b4a 0%, #3a7a55 35%, #67b184 75%, #9fd0a7 100%); }
:root[data-theme="dark"] .hero { background: linear-gradient(120deg, #1f3a2b 0%, #2b4f3b 45%, #3f6f53 100%); color: #eef5ee; }
.hero::after { content: "🏔️"; position: absolute; right: 1.2rem; bottom: -.6rem; font-size: 6.5rem; opacity: .18; pointer-events: none; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: .1rem 0 .7rem; letter-spacing: -.03em; }
.hero-date { margin: 0; opacity: .85; font-size: .95rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem; border-radius: 999px; background: rgba(255, 255, 255, .2); font-size: .9rem; font-weight: 500; backdrop-filter: blur(4px); }

.who { display: flex; align-items: center; gap: .9rem; }
.avatar { width: 3.2rem; height: 3.2rem; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 1.3rem; flex: none; box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--line); }
.who-name { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }
.big-emoji { font-size: 2.2rem; line-height: 1; margin-bottom: .4rem; }
.count { display: flex; align-items: baseline; gap: .45rem; margin-bottom: .3rem; }
.count-num { font-size: 3rem; font-weight: 800; letter-spacing: -.05em; line-height: 1; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.count-unit { font-size: 1.1rem; font-weight: 600; color: var(--muted); }

.mini-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.mini-list li { display: flex; align-items: center; gap: .7rem; padding: .45rem .55rem; margin: 0 -.55rem; border-radius: 12px; cursor: pointer; transition: background .15s; }
.mini-list li:hover { background: var(--surface-2); }
.mini-list .grow { flex: 1; min-width: 0; }
.mini-list .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: .78rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }

/* Wetter */
.weather { background: linear-gradient(160deg, var(--sky-1), var(--sky-2)); }
.wx-now { display: flex; align-items: center; gap: 1rem; }
.wx-icon { font-size: 3.6rem; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .12)); }
.wx-temp { font-size: 3rem; font-weight: 800; letter-spacing: -.05em; line-height: 1; }
.wx-desc { font-weight: 600; }
.wx-facts { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin-top: .9rem; font-size: .88rem; color: var(--muted); }
.wx-facts b { color: var(--ink); font-weight: 600; }
/* 14 Tage: passt sich der Breite der Kachel an, nie horizontal scrollen.
   Breit 14 Spalten, mittel 2 Wochen à 7 Spalten, schmal eine Liste. */
#start-forecast { container: fc / inline-size; }
.forecast { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .4rem; }
@container fc (max-width: 939px) {
  .forecast { grid-auto-flow: row; grid-template-columns: repeat(7, minmax(0, 1fr)); }
}
@container fc (max-width: 520px) {
  .forecast { grid-template-columns: minmax(0, 1fr); gap: .3rem; }
  /* .forecast davor, damit diese Regeln die Grundregeln für .fday weiter unten schlagen */
  .forecast .fday { display: grid; grid-template-columns: 3.3rem 1.9rem 2rem minmax(1.5rem, 1fr) 2rem 2.9rem; grid-template-areas: "d e lo range hi rain" "dt e lo range hi rain";
    align-items: center; gap: 0 .35rem; padding: .35rem .6rem; text-align: left; }
  .forecast .fday .d { grid-area: d; } .forecast .fday .dt { grid-area: dt; } .forecast .fday .e { grid-area: e; font-size: 1.4rem; }
  .forecast .fday .lo { grid-area: lo; text-align: right; } .forecast .fday .hi { grid-area: hi; }
  .forecast .fday .range { grid-area: range; width: auto; margin: 0; }
  .forecast .fday .rain { grid-area: rain; text-align: right; min-height: 0; }
}
.fday { min-width: 0; text-align: center; padding: .7rem .3rem .6rem; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; gap: .15rem; }
.fday.weekend { background: var(--accent-soft); }
.fday .d { font-size: .8rem; font-weight: 600; }
.fday .dt { font-size: .72rem; color: var(--muted); }
.fday .e { font-size: 1.7rem; line-height: 1.3; }
.fday .hi { font-weight: 700; }
.fday .lo { color: var(--muted); font-size: .85rem; }
.fday .rain { font-size: .72rem; color: #3b82c4; min-height: 1.1em; }
:root[data-theme="dark"] .fday .rain { color: #7fb6ea; }
.range { width: 70%; height: 4px; border-radius: 4px; background: var(--line); position: relative; margin: .25rem 0; }
.range i { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: linear-gradient(90deg, #5fa8e8, #f0b44c, #e8742c); }
.source { margin: .6rem 0 0; font-size: .75rem; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chips span { padding: .3rem .8rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .9rem; }
.chips span b { color: var(--today); }

/* ---------- Belegung ---------- */
.status-card { background: var(--accent-soft); border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: 1.2rem; font-size: .95rem; }
.status-card strong { font-size: 1.02rem; }
.cal-head { display: flex; align-items: center; gap: .4rem; margin-bottom: .8rem; flex-wrap: wrap; }
.cal-head h2 { margin: 0 .3rem; min-width: 10rem; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: .72rem; font-weight: 600; color: var(--muted); padding: .2rem 0 .3rem; text-transform: uppercase; letter-spacing: .08em; }
.cal .day { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-height: 5.4rem; padding: .3rem .2rem .35rem; cursor: pointer; position: relative; display: flex; flex-direction: column; gap: 3px; transition: background .15s, border-color .15s; }
.cal .day:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.cal .day.other { opacity: .4; }
.cal .day.past .num { color: var(--muted); }
.cal .num { font-size: .8rem; font-weight: 500; padding-left: .25rem; }
.cal .day.today { border-color: var(--today); box-shadow: 0 0 0 1px var(--today); }
.cal .day.today .num { color: var(--today); font-weight: 800; }
.bar { font-size: .72rem; font-weight: 600; color: #fff; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; line-height: 1.5; position: relative; z-index: 1; }
/* Balken über die Lücke zwischen den Tagen ziehen (Lücke 4px, Rand 1px) */
.bar.cont { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: calc(-.2rem - 3px); }
.bar.goes { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: calc(-.2rem - 3px); }
/* Am Wochenrand nicht über das Raster hinaus (7 Wochentag-Köpfe, dann die Tage) */
.cal .day:nth-child(7n+1) .bar.cont { margin-left: 0; }
.cal .day:nth-child(7n) .bar.goes { margin-right: 0; }

/* Listen */
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; align-items: center; gap: .8rem; padding: .7rem .6rem; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li.clickable { cursor: pointer; border-radius: 12px; transition: background .15s; }
.list li.clickable:hover { background: var(--accent-soft); }
#upcoming { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .3rem .5rem; box-shadow: var(--shadow); }
.dot { width: .8rem; height: .8rem; border-radius: 50%; flex: none; }
.list .grow { flex: 1; min-width: 0; }
.list .sub { color: var(--muted); font-size: .85rem; }
.empty { color: var(--muted); padding: .8rem .2rem; }

/* Inventar */
.toolbar { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar input[type=search] { max-width: 280px; border-radius: 999px; padding-left: 1rem; }
.toolbar label.check { margin: 0; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.inv { width: 100%; border-collapse: collapse; font-size: .92rem; }
.inv th, .inv td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.inv th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.inv td:first-child { white-space: normal; min-width: 10rem; font-weight: 500; }
.inv tbody tr { cursor: pointer; transition: background .15s; }
.inv tbody tr:hover { background: var(--accent-soft); }
.inv tbody tr:last-child td { border-bottom: 0; }
.inv .num { text-align: right; }
.inv tr.room-row td { background: var(--surface-2); font-weight: 700; cursor: default; font-size: .85rem; }
.pill { display: inline-block; font-size: .78rem; font-weight: 500; padding: .05rem .6rem; border-radius: 999px; border: 1px solid var(--line); }
.pill.abgenutzt { border-color: var(--today); color: var(--today); }
.pill.defekt, .pill.fehlt { border-color: var(--danger); color: var(--danger); }
.pill.bring { background: var(--today); color: #fff; border-color: var(--today); }

/* Infos */
.hero-info { margin-bottom: 1rem; }
.hero-info::after { content: "📋"; }
.hero-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.hero .hero-btn { background: rgba(255, 255, 255, .2); color: #fff; border-color: rgba(255, 255, 255, .4); }
.hero .hero-btn:hover { background: rgba(255, 255, 255, .32); border-color: #fff; }
.info-tile { line-height: 1.6; overflow-wrap: anywhere; }
.info-tile h3 { font-size: .85rem; color: var(--ink); }
.info-icon { width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); font-size: 1.05rem; flex: none; }
.info-tile p { margin: 0 0 .6rem; }
.checks { list-style: none; padding: 0; margin: 0 0 .6rem; display: grid; gap: .45rem; }
.checks li { position: relative; padding-left: 1.8rem; }
.checks li::before { content: "✓"; position: absolute; left: 0; top: .15rem; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: .72rem; font-weight: 800; display: grid; place-items: center; }
#info-form textarea { margin-top: .4rem; }
#info-text { font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace; font-size: .9rem; }

.copy-row { display: flex; gap: .5rem; }
.note { background: var(--accent-soft); padding: .8rem 1rem; border-radius: 12px; }
.note code { font-size: 1.05rem; font-weight: 700; user-select: all; }
details summary { cursor: pointer; margin-top: .8rem; }

/* Dialoge */
dialog { border: 1px solid var(--line); border-radius: 22px; padding: 1.5rem 1.5rem 1.1rem; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 24px 70px rgba(0, 0, 0, .25); }
dialog[open] { animation: pop .2s ease both; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
dialog::backdrop { background: rgba(20, 24, 18, .35); backdrop-filter: blur(3px); }
dialog h3 { margin-top: 0; font-size: 1.25rem; }

/* ---------- Familie und Profile ---------- */
img.avatar { object-fit: cover; background: var(--surface-2); }
.avatar.lg { width: 4.4rem; height: 4.4rem; font-size: 1.7rem; }
.avatar.xl { width: 7.5rem; height: 7.5rem; font-size: 3rem; box-shadow: 0 0 0 5px var(--surface), 0 8px 24px rgba(0, 0, 0, .15); }
.hero-family { margin-bottom: 1rem; }
.hero-family::after { content: "🏡"; }
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }
.member { font: inherit; color: var(--ink); text-align: center; cursor: pointer; position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: .25rem;
  padding: 1.5rem 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.member::before { content: ""; position: absolute; inset: 0 0 auto; height: 3.6rem; background: var(--c); background: linear-gradient(120deg, var(--c), color-mix(in srgb, var(--c) 40%, #fff)); opacity: .9; }
.member > * { position: relative; }
.member .avatar { margin-bottom: .4rem; }
.member:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.member:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.member-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.member .sub { color: var(--muted); font-size: .85rem; }
.member-icons { display: flex; flex-wrap: wrap; gap: .25rem; justify-content: center; align-items: center; min-height: 1.5rem; margin-top: .35rem; font-size: .95rem; }

.back { margin: 0 0 .6rem -.6rem; }
.profile-head { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 1rem; }
.profile-banner { height: 150px; background: var(--c);
  background: radial-gradient(circle at 85% 20%, rgba(255, 255, 255, .35), transparent 40%), linear-gradient(120deg, var(--c), color-mix(in srgb, var(--c) 35%, #fff)); }
.profile-main { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 1rem 1.3rem; padding: 1rem 1.6rem 1.4rem; }
.profile-main > .btn { align-self: flex-end; }
.profile-main .avatar.xl { margin-top: -5rem; }
.profile-names { flex: 1; min-width: 200px; }
.profile-names h1 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); margin: 0 0 .15rem; letter-spacing: -.03em; }
.profile-names .sub { color: var(--muted); }
.profile-names .chips { margin-top: .6rem; }

.contacts { display: grid; gap: .5rem; }
.contact { display: flex; align-items: center; gap: .8rem; padding: .55rem .7rem; border-radius: 14px; background: var(--surface-2); color: var(--ink); text-decoration: none; transition: background .15s, transform .15s; }
.contact:hover { background: var(--accent-soft); transform: translateX(2px); }
.c-ico { width: 2.3rem; height: 2.3rem; border-radius: 50%; display: grid; place-items: center; background: var(--surface); font-size: 1.1rem; flex: none; }
.c-val { font-weight: 600; overflow-wrap: anywhere; }
.profile-socials { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.social, .mini { display: grid; place-items: center; border-radius: 50%; color: #fff; flex: none; }
.social { width: 2.1rem; height: 2.1rem; transition: transform .15s; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.social:hover { transform: scale(1.1); }
.social svg { width: 1rem; height: 1rem; }
.mini { width: 1.35rem; height: 1.35rem; }
.mini svg { width: .8rem; height: .8rem; }
.instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
.facebook { background: #1877f2; }
.tiktok { background: #111; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.linkedin { background: #0a66c2; }

.bday-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: .6rem; }
.bday { font: inherit; color: var(--ink); text-align: left; cursor: pointer; display: flex; align-items: center; gap: .8rem; padding: .6rem .75rem; border: 0; border-radius: 14px; background: var(--surface-2); transition: transform .15s; }
.bday:hover { transform: translateY(-2px); }
.bday > div { flex: 1; min-width: 0; }
.bday .title { font-weight: 600; }
.bday .avatar { width: 2.6rem; height: 2.6rem; font-size: 1rem; box-shadow: none; }
.bday.today { background: linear-gradient(135deg, #fff1d6, #ffe0ec); }
:root[data-theme="dark"] .bday.today { background: linear-gradient(135deg, #3a2f1c, #3a2030); }

.photo-edit { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.photo-edit label.btn { display: inline-block; margin: 0 .3rem 0 0; color: var(--ink); font-size: .95rem; }
.photo-edit p { margin: .4rem 0 0; }
#dlg-profile { width: min(580px, calc(100vw - 32px)); }
dialog { max-height: calc(100dvh - 32px); overflow: auto; }
dialog h4, .card h4 { margin: .4rem 0 .6rem; font-size: .95rem; }
.card h4 { margin-top: 1.4rem; }
.grid2 > .full { grid-column: 1 / -1; }
.mail-alert { margin: 0 0 1.2rem; padding: .8rem 1rem; border-radius: 12px; border: 1px solid var(--danger); color: var(--danger); background: #fdf0ed; overflow-wrap: anywhere; }
:root[data-theme="dark"] .mail-alert { background: #3a221d; }
.mail-alert .small { color: var(--ink); margin-top: .2rem; }

/* ---------- Blatt «Mehr» (Handy und Tablet) ---------- */
.sheet { position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(620px, 100%); max-width: 100%; padding: 0; border: 1px solid var(--line); border-bottom: 0; border-radius: 26px 26px 0 0; }
.sheet[open] { animation: sheet-up .25s ease both; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.sheet-body { padding: .6rem 1.1rem calc(1rem + env(safe-area-inset-bottom)); outline: none; }
.sheet-grip { width: 2.6rem; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto .9rem; }
.sheet-me { font: inherit; font-size: 1.3rem; color: var(--muted); width: 100%; display: flex; align-items: center; gap: .9rem; text-align: left; padding: .7rem .9rem; margin-bottom: .8rem; border: 0; border-radius: 18px; background: var(--accent-soft); cursor: pointer; }
.sheet-me .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--ink); font-size: 1rem; }
.sheet-me .sub { font-size: .85rem; color: var(--muted); }
.sheet-me .avatar { width: 3rem; height: 3rem; font-size: 1.2rem; box-shadow: none; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.sheet-item { font: inherit; font-weight: 600; color: var(--ink); text-align: left; display: flex; align-items: center; gap: .7rem; min-height: 3.8rem; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-2); cursor: pointer; transition: transform .1s, background .15s; }
.sheet-item:hover { background: var(--accent-soft); }
.sheet-item:active, .sheet-me:active { transform: scale(.97); }
.sheet-item.danger, .sheet-item.danger .s-ico { color: var(--danger); }
.s-ico { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--accent); flex: none; }
.s-ico svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sheet-close { width: 100%; margin-top: .7rem; }

/* Fusszeile */
.foot { text-align: center; font-size: .8rem; color: var(--muted); padding: .5rem 16px 1.6rem; }
.foot a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.foot a:hover { color: var(--accent); text-decoration-color: currentColor; }
.auth { grid-template-rows: 1fr auto; }
.auth .foot { padding-bottom: .4rem; }

.toast { position: fixed; bottom: 1.4rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: .6rem 1.2rem; border-radius: 999px; font-size: .9rem; font-weight: 500; z-index: 20; max-width: calc(100vw - 32px); box-shadow: var(--shadow-hover); }
#user-form { margin-top: 1rem; }

@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { grid-column: span 1; }
}

/* Schmale Fenster: Navigation als Leiste unten, Kopfzeile nur mit Logo und Umschalter */
@media (max-width: 860px) {
  .tabs { position: fixed; left: 50%; transform: translateX(-50%); width: min(620px, calc(100% - 20px)); bottom: calc(10px + env(safe-area-inset-bottom)); margin: 0; justify-content: space-around; padding: .3rem; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); box-shadow: var(--shadow-hover); }
  /* 4 Haupt-Tabs plus «Mehr», Infos und Konto liegen im Blatt */
  .tabs .in-more { display: none; }
  .tabs .more-btn { display: flex !important; }
  .tabs button { flex: 1; min-width: 0; flex-direction: column; gap: .15rem; font-size: .74rem; font-weight: 600; padding: .5rem .1rem .45rem; border-radius: 22px; }
  .tabs button.active { background: var(--accent-soft); box-shadow: none; }
  .tabs svg { width: 1.45rem; height: 1.45rem; }
  .top .theme-toggle { margin-left: auto; }
  #app .foot { padding-bottom: calc(6.5rem + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(5.8rem + env(safe-area-inset-bottom)); }
  /* Ab 16px zoomt Safari auf dem iPhone beim Antippen nicht mehr ins Feld */
  input, select, textarea { font-size: 16px; }
}

/* Querformat am Handy (wenig Höhe): Kopfzeile scrollt mit, Leiste flacher mit Symbol neben Text */
@media (max-width: 1000px) and (max-height: 520px) {
  .top { position: relative; top: 0; }
  .tabs button { flex-direction: row; gap: .4rem; font-size: .8rem; padding: .4rem .3rem; }
  .tabs svg { width: 1.2rem; height: 1.2rem; }
  #app .foot { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(4rem + env(safe-area-inset-bottom)); }
}

/* Handy */
@media (max-width: 640px) {
  .top { top: 8px; margin-top: 8px; width: calc(100% - 24px); padding-left: .8rem; }
  .brand { font-size: 1rem; }
  .tab { padding: 1.1rem 12px 1.5rem; }
  .profile-main { padding: .8rem 1.1rem 1.2rem; }
  /* Kontenverwaltung: Knöpfe unter Name und Adresse statt daneben */
  #user-list li { flex-wrap: wrap; row-gap: .3rem; }
  #user-list li .grow { flex: 1 1 calc(100% - 2rem); overflow-wrap: anywhere; }
  #user-list li .btn { padding: .35rem .75rem; }
  .members { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
  .member { padding: 1.2rem .6rem .9rem; }
  .member-name { font-size: .95rem; }
  .profile-banner { height: 110px; }
  .bento { grid-template-columns: minmax(0, 1fr); gap: .8rem; }
  /* Inventar: jede Zeile als Karte, gruppiert nach Raum */
  .table-wrap { overflow: visible; background: none; border: 0; box-shadow: none; }
  table.inv, .inv tbody, .inv tr, .inv td { display: block; }
  .inv thead { display: none; }
  .inv tbody tr:not(.room-row) { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; padding: .75rem .9rem; margin-bottom: .55rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
  .inv td { padding: 0; border: 0; white-space: normal; }
  .inv td:first-child { flex-basis: 100%; min-width: 0; }
  .inv td:nth-child(2), .inv td:empty { display: none; }
  .inv td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: .8rem; }
  .inv .num { text-align: left; font-weight: 600; }
  .inv tr.room-row td { background: none; padding: .9rem .2rem .45rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
  .inv tbody tr:not(.room-row):hover { background: var(--surface); }
  .toolbar input[type=search] { max-width: none; flex: 1 1 100%; }
  .tile { min-height: 0; }
  .hero { padding: 1.4rem 1.2rem; }
  .hero::after { font-size: 4.5rem; }
  .cal { gap: 2px; }
  .cal .day { min-height: 3.6rem; border-radius: 8px; }
  .bar { font-size: 0; height: .45rem; padding: 0; }
  .bar.cont { margin-left: calc(-.2rem - 2px); }
  .bar.goes { margin-right: calc(-.2rem - 2px); }
  .cal .day:nth-child(7n+1) .bar.cont { margin-left: 0; }
  .cal .day:nth-child(7n) .bar.goes { margin-right: 0; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .cal-head h2 { min-width: 0; font-size: 1.15rem; }
}
