/* ActiMals – Farbwelt aus dem Logo: Wal-Blau, Sternen-Gelb, Bären-Braun, Creme */

:root {
    --blue-900: #10295c;   /* Schriftkontur – Text */
    --blue-700: #1d5fc4;
    --blue-500: #2f8cf0;   /* Wal – Hauptfarbe */
    --blue-300: #8cc8ff;
    --blue-100: #dcefff;
    --blue-50:  #eef7ff;

    --yellow-600: #e8a800;
    --yellow-500: #ffc72c;  /* Sterne – Punkte */
    --yellow-300: #ffe27a;
    --yellow-100: #fff4c7;

    --brown-800: #5e3417;
    --brown-600: #9a5a26;   /* Bär */
    --brown-400: #c98a4b;
    --brown-200: #efd6b4;   /* Schnauze */
    --brown-100: #f8ead6;

    --cream: #fff9ef;
    --white: #ffffff;
    --green-600: #3f9a2f;
    --green-500: #5db848;   /* Schürze – erledigt */
    --green-100: #e3f5dc;
    --red-600: #d23c3c;
    --red-100: #fde4e2;

    --bg: var(--cream);
    --surface: var(--white);
    --text: var(--blue-900);
    --text-muted: #5b6b8c;
    --border: var(--brown-200);
    --primary: var(--blue-500);
    --primary-dark: var(--blue-700);

    --radius-s: 10px;
    --radius: 16px;
    --radius-l: 24px;
    --shadow: 0 2px 0 rgba(94, 52, 23, 0.10), 0 4px 14px rgba(16, 41, 92, 0.08);
    --shadow-strong: 0 3px 0 rgba(16, 41, 92, 0.18), 0 10px 30px rgba(16, 41, 92, 0.18);
    --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Segoe UI", system-ui, -apple-system, sans-serif;
    --nav-height: 68px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    /* "only": Browser dürfen das Design nicht selbst abdunkeln (z. B. Samsung Internet im dunklen Modus von Android) */
    color-scheme: only light;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

body { min-height: 100vh; min-height: 100dvh; }

h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 800; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Grundgerüst ---------- */

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    background: var(--header-bg, var(--primary)); /* Skins: eigener Verlauf/Deko */
    color: var(--white);
    box-shadow: 0 3px 0 var(--blue-700);
}
.app-header img { width: 40px; height: 40px; }

/* Logo oben links gedrückt halten → groß (app.js holdToShowLogo) */
.logo-hold { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: none; }
.logo-peek {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: rgb(20 30 45 / 0.6);
    pointer-events: none;
    animation: logo-peek-fade 0.15s ease-out;
}
.logo-peek img {
    width: min(92vw, 480px);
    height: auto;
    filter: drop-shadow(0 8px 24px rgb(0 0 0 / 0.35));
    animation: logo-peek-zoom 0.2s ease-out;
}
@keyframes logo-peek-fade { from { opacity: 0; } }
@keyframes logo-peek-zoom { from { transform: scale(0.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .logo-peek, .logo-peek img { animation: none; }
}
.app-header .title { font-size: 1.25rem; font-weight: 900; letter-spacing: 0.01em; flex: 1; }
.app-header .title span { color: var(--yellow-300); }

.user-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 4px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: var(--white);
    font-weight: 700;
    cursor: pointer;
}

main {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 16px calc(var(--nav-height) + var(--safe-bottom) + 90px);
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    justify-content: space-around;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--surface);
    border-top: 3px solid var(--brown-200);
}
.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 700;
}
.bottom-nav a .icon { font-size: 1.5rem; line-height: 1; filter: grayscale(0.6); opacity: 0.75; }
.bottom-nav a.active { color: var(--primary-dark); }
.bottom-nav a.active .icon { filter: none; opacity: 1; transform: scale(1.12); }

/* ---------- Bausteine ---------- */

.card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 22px 0 10px;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--brown-600);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.section-title .count {
    display: inline-block;
    white-space: nowrap;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--brown-100);
    font-size: 0.8rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 8px 16px;
    border: 0;
    border-radius: 999px;
    background: var(--primary);
    color: var(--white);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 0 var(--blue-700);
    transition: transform 0.08s, box-shadow 0.08s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--blue-700); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.secondary { background: var(--blue-50); color: var(--primary-dark); box-shadow: 0 3px 0 var(--blue-100); }
.btn.success { background: var(--green-500); box-shadow: 0 3px 0 var(--green-600); }
.btn.warning { background: var(--yellow-500); color: var(--brown-800); box-shadow: 0 3px 0 var(--yellow-600); }
.btn.danger { background: var(--red-600); box-shadow: 0 3px 0 #9e2727; }
.btn.ghost { background: transparent; color: var(--primary-dark); box-shadow: none; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: 0.9rem; }
.btn.block { width: 100%; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}
.badge.points { background: var(--yellow-500); color: var(--brown-800); font-size: 0.9rem; padding: 3px 10px; }
.badge.mandatory { background: var(--brown-600); color: var(--white); }
.badge.overdue { background: var(--red-100); color: var(--red-600); }
.badge.due { background: var(--yellow-100); color: #8a5a00; }
.badge.due_soon { background: var(--blue-50); color: var(--blue-700); }
.badge.not_due { background: var(--brown-100); color: var(--brown-600); }
.badge.none { background: var(--blue-50); color: var(--blue-700); }
.badge.ok { background: var(--green-100); color: var(--green-600); }
.badge.fail { background: var(--red-100); color: var(--red-600); }
.badge.neutral { background: var(--brown-100); color: var(--brown-800); }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brown-400);
    color: var(--white);
    font-weight: 900;
    flex: none;
}
.avatar.large { width: 72px; height: 72px; font-size: 1.8rem; border: 4px solid var(--surface); box-shadow: var(--shadow); }

/* ---------- Aufgabenkarten ---------- */

.task {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 14px 14px 18px;
    overflow: hidden;
}
.task::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--cat-color, var(--blue-300));
}
.task.overdue { border-color: #f3b4b0; }
.task .head { display: flex; align-items: flex-start; gap: 10px; }
.task .cat-icon { font-size: 1.6rem; line-height: 1; }
.task .title { font-weight: 800; font-size: 1.05rem; }
.task .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.task .note { font-size: 0.9rem; color: var(--text-muted); }
.task .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.task .claimed { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; color: var(--text-muted); }
.task .claimed .avatar { width: 24px; height: 24px; font-size: 0.75rem; }
/* Verwaltung (Organisatoren/Admins): schlichte Symbolleiste unter den Hauptknöpfen */
.task .manage-bar { display: flex; justify-content: space-around; gap: 4px; margin: 2px -4px -6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.manage-btn {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    min-height: 44px;
    padding: 4px 2px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}
.manage-btn .manage-icon { font-size: 1.05rem; line-height: 1.2; color: var(--primary-dark); }
.manage-btn.danger .manage-icon { color: var(--red-600); }
.manage-btn:active { background: var(--border); }
.manage-btn:disabled { opacity: 0.5; cursor: default; }

/* Knopf unten im Pool: "Häufige Aufgaben" */
.fab-bar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
    z-index: 15;
    display: flex;
    gap: 8px;
    width: calc(100% - 24px);
    max-width: 520px;
}
.fab-bar .btn {
    flex: 1;
    min-height: 52px;
    padding: 0 10px;
    font-size: 0.95rem;
    box-shadow: var(--shadow-strong);
}
.fab-done { background: var(--yellow-500); color: var(--brown-800); }

/* ---------- Fortschritt & Statistik ---------- */

.progress {
    height: 16px;
    border-radius: 999px;
    background: var(--brown-100);
    overflow: hidden;
    border: 2px solid var(--brown-200);
}
.progress > div {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--yellow-500), var(--yellow-300));
    transition: width 0.5s ease;
}
.progress.done > div { background: linear-gradient(90deg, var(--green-500), #9bdc7f); }

.score { display: flex; align-items: baseline; gap: 6px; }
.score .big { font-size: 2.2rem; font-weight: 900; color: var(--blue-700); }

.week-card {
    background: var(--week-bg, linear-gradient(135deg, var(--blue-500), var(--blue-700)));
    color: var(--white);
    border: 0;
    box-shadow: 0 4px 0 var(--blue-900), var(--shadow);
}
.week-card .score .big { color: var(--yellow-300); }
.week-card .muted { color: var(--blue-100); }
.week-card .progress { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.3); }

/* Wochenbilanz der Vorwoche */
.week-summary { border-left: 6px solid var(--yellow-500); }
.week-summary.over, .week-summary.exact { border-left-color: var(--green-500); background: var(--green-100); }
.week-summary.under { background: var(--yellow-100); }
.week-summary.vacation, .vacation-card { border-left: 6px solid var(--green-500); background: var(--green-100); }
.vacation-card p { margin: 0; }
.week-summary p { margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.stat-tile { text-align: center; padding: 12px 6px; }
.stat-tile .value { font-size: 1.6rem; font-weight: 900; }
.stat-tile .label { font-size: 0.8rem; color: var(--text-muted); font-weight: 700; }

.segmented {
    display: flex;
    padding: 4px;
    border-radius: 999px;
    background: var(--brown-100);
    gap: 4px;
}
.segmented button {
    flex: 1;
    min-height: 38px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-weight: 800;
    color: var(--brown-600);
    cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--primary-dark); box-shadow: var(--shadow); }

.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.bar-row .bar { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--brown-100); overflow: hidden; }
.bar-row .bar > div { height: 100%; background: var(--blue-500); border-radius: 999px; }

.history { padding: 4px 14px; }
.history-row {
    display: grid;
    grid-template-columns: 64px 26px 1fr auto;
    align-items: center;
    gap: 6px;
    padding: 10px 0;
    border-bottom: 1px solid var(--brown-100);
}
.history-row:last-child { border-bottom: 0; }
.history-row .day { font-size: 0.8rem; font-weight: 700; color: var(--brown-600); white-space: nowrap; }
.history-row .icon { font-size: 1.2rem; text-align: center; }
.history-row .label { min-width: 0; overflow-wrap: anywhere; }
.history-row .amount { font-weight: 900; color: var(--green-600); }
.history-row .amount.neg { color: var(--red-600); }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--brown-100); }
table.list th { font-size: 0.78rem; color: var(--brown-600); text-transform: uppercase; }
table.list td.num, table.list th.num { text-align: right; }

/* ---------- Listen (Admin) ---------- */

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    text-align: left;
    cursor: pointer;
    box-shadow: var(--shadow);
}
.list-item.inactive, .card.inactive { opacity: 0.6; }
.list-item .main { flex: 1; min-width: 0; }
.list-item .main .name { font-weight: 800; }
.list-item .main .sub { font-size: 0.85rem; color: var(--text-muted); }

.reorder-row { display: flex; align-items: stretch; gap: 8px; }
.reorder-row .list-item { flex: 1; min-width: 0; }
.reorder-buttons { display: flex; flex-direction: column; gap: 4px; }
.reorder-buttons button {
    flex: 1;
    min-width: 40px;
    border: 2px solid var(--brown-200);
    border-radius: var(--radius-s);
    background: var(--surface);
    color: var(--primary-dark);
    font-size: 0.85rem;
    cursor: pointer;
}
.reorder-buttons button:disabled { opacity: 0.3; cursor: default; }
/* Dreieck per CSS (statt ▲▼◀▶ – diese Zeichen sind je nach Gerät unterschiedlich groß) */
.tri {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 11px solid currentColor;
    vertical-align: middle;
}
.tri.down { transform: rotate(180deg); }
.tri.left { transform: rotate(-90deg); }
.tri.right { transform: rotate(90deg); }

.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.emoji-grid button {
    height: 42px;
    border: 2px solid transparent;
    border-radius: var(--radius-s);
    background: var(--surface);
    font-size: 1.4rem;
    cursor: pointer;
}
.emoji-grid button.selected { border-color: var(--primary); background: var(--blue-50); box-shadow: 0 0 0 3px var(--blue-100); }
.emoji-preview { font-size: 2rem; width: 46px; text-align: center; }
.input.emoji-own { width: 110px; flex: none; text-align: center; font-size: 1.1rem; }

/* Admin-Reiter: Kachelraster statt Scrollleiste – alle Reiter immer sichtbar */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tabs button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
    padding: 8px 4px;
    border: 2px solid var(--brown-200);
    border-radius: var(--radius-s);
    background: var(--surface);
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--brown-600);
    cursor: pointer;
}
.tabs button .icon { font-size: 1.3rem; line-height: 1; }
.tabs button.active { background: var(--primary); border-color: var(--primary); color: var(--white); box-shadow: 0 3px 0 var(--blue-700); }
@media (min-width: 600px) {
    .tabs { grid-template-columns: repeat(6, 1fr); }
}

/* ---------- Formulare ---------- */

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 0.85rem; font-weight: 800; color: var(--brown-600); }
.field .hint { font-size: 0.8rem; color: var(--text-muted); }
.input, select.input, textarea.input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 2px solid var(--brown-200);
    border-radius: var(--radius-s);
    background: var(--surface);
    outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--blue-100); }
textarea.input { min-height: 80px; resize: vertical; }
/* Nebeneinanderliegende Formularfelder oben bündig, auch wenn eines einen Hinweistext hat */
form .row { align-items: flex-start; }
form .field .row { align-items: center; }

.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 700; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); }
.form-error { color: var(--red-600); font-weight: 700; font-size: 0.9rem; }
input[type="color"].input { padding: 4px; height: 46px; }

/* ---------- Login ---------- */

.login {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 24px 16px calc(24px + var(--safe-bottom));
    background: var(--login-bg,
        radial-gradient(circle at 20% 10%, var(--yellow-100) 0, transparent 40%),
        radial-gradient(circle at 85% 30%, var(--blue-50) 0, transparent 45%),
        var(--bg));
}
.login .logo { width: min(260px, 70vw); height: auto; }
.login .people { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px; width: 100%; max-width: 480px; }
.login .person {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 6px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    font-weight: 800;
    cursor: pointer;
}
.login .person:hover, .login .person:focus-visible { background: var(--surface); border-color: var(--brown-200); }

.pin-dots { display: flex; gap: 12px; justify-content: center; min-height: 20px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--blue-500); }
.pin-dots span.filled { background: var(--blue-500); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; justify-content: center; }
.pin-pad button {
    height: 64px;
    border: 0;
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--blue-900);
    box-shadow: 0 3px 0 var(--brown-200);
    cursor: pointer;
}
.pin-pad button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--brown-200); }
.pin-pad button.ok { background: var(--green-500); color: var(--white); box-shadow: 0 3px 0 var(--green-600); }
.pin-pad button.muted-key { background: transparent; box-shadow: none; font-size: 1.2rem; }

/* Einrichtungsassistent */
.wizard-head h1 { font-size: 1.4rem; }
.wizard-steps { display: flex; justify-content: space-between; font-size: 1.3rem; }
.wizard-steps span { opacity: 0.35; filter: grayscale(1); }
.wizard-steps span.done { opacity: 0.8; filter: none; }
.wizard-steps span.active { opacity: 1; filter: none; transform: scale(1.2); }
.wizard-nav { margin-top: 6px; }
.wizard-sticky {
    position: sticky;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 8px 14px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-strong);
}
.wizard-summary { flex: 1; font-size: 0.85rem; font-weight: 800; color: var(--primary-dark); }
.wizard-tips { text-align: left; margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.catalog-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 0; border-bottom: 1px solid var(--brown-100); }
.catalog-row:last-child { border-bottom: 0; }
.catalog-row.exists { opacity: 0.6; }
.catalog-title { display: flex; align-items: flex-start; gap: 10px; flex: 1 1 200px; cursor: pointer; }
.catalog-title input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--primary); flex: none; }
.catalog-title > span { display: flex; flex-direction: column; gap: 3px; }
.catalog-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.catalog-values { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.catalog-values label { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.input.mini { width: 64px; min-height: 36px; padding: 4px 6px; text-align: center; }

/* "Erste Schritte" */
.checklist { border-color: var(--primary); background: var(--blue-50); }
.checklist-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.checklist-items li { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.checklist-items li.done { color: var(--text-muted); text-decoration: line-through; }
.checklist-items .check-mark { width: 22px; text-align: center; color: var(--primary-dark); }
.checklist-items li.done .check-mark { color: var(--green-600); }

/* Einführung */
.intro-card { padding: 8px 4px 0; }
.intro-icon { font-size: 3.4rem; }
.intro-dots { display: flex; justify-content: center; gap: 8px; }
.intro-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--brown-200); }
.intro-dots span.active { background: var(--primary); }

/* Neue Person / Freigabe */
.avatar.new-person { background: var(--yellow-500); color: var(--brown-800); }
.card.pending { border-color: var(--yellow-500); background: var(--yellow-100); }
.bottom-nav a { position: relative; }
.nav-badge {
    position: absolute;
    top: 6px;
    left: calc(50% + 8px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--red-600);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 900;
    line-height: 18px;
    text-align: center;
}

/* Startseite: große Auswahl-Karten */
.choice {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.choice > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.choice-icon { font-size: 2rem; }
.choice:hover, .choice:focus-visible { border-color: var(--primary); }

/* QR-Code für Geräte-Einladungen */
.qr { display: block; width: min(240px, 70vw); height: auto; margin: 0 auto; background: #fff; /* immer weiß – sonst nicht scanbar */ border-radius: var(--radius-s); padding: 10px; border: 2px solid var(--brown-200); }
.code-big { font-family: ui-monospace, Consolas, monospace; font-size: 1.5rem; font-weight: 900; letter-spacing: 0.08em; text-align: center; padding: 12px; background: var(--yellow-100); border-radius: var(--radius-s); user-select: all; }
.link-box { font-size: 0.8rem; word-break: break-all; padding: 8px 10px; background: var(--blue-50); border-radius: var(--radius-s); user-select: all; }

/* ---------- Sheet, Toast, Leerzustand ---------- */

.backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(16, 41, 92, 0.45);
    animation: fade 0.15s ease;
}
.sheet {
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    max-height: 88dvh;
    overflow-y: auto;
    padding: 8px 16px calc(20px + var(--safe-bottom));
    border-radius: var(--radius-l) var(--radius-l) 0 0;
    background: var(--sheet-bg, var(--bg));
    animation: slide-up 0.2s ease;
}
.sheet .grabber { width: 44px; height: 5px; margin: 4px auto 12px; border-radius: 999px; background: var(--brown-200); }
.sheet .sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sheet .sheet-head h2 { flex: 1; }

.toast-area {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 84px);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 480px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--blue-900);
    color: var(--white);
    font-weight: 700;
    box-shadow: var(--shadow-strong);
    pointer-events: auto;
    animation: slide-up 0.2s ease;
}
.toast.success { background: var(--green-600); }
.toast.error { background: var(--red-600); }
.toast button { border: 0; background: transparent; color: var(--yellow-300); font-weight: 900; cursor: pointer; padding: 4px; }
/* Text nimmt die Zeile; Knöpfe rücken bei Platzmangel darunter (statt den Text zu quetschen) */
.toast { flex-wrap: wrap; }
.toast > span { flex: 1 1 200px; }
.toast button { white-space: nowrap; }

.empty { padding: 32px 16px; text-align: center; color: var(--text-muted); }
.empty .emoji { font-size: 2.6rem; display: block; margin-bottom: 8px; }

.loading { padding: 40px; text-align: center; color: var(--brown-400); font-weight: 800; }
.loading::after { content: "…"; animation: dots 1s steps(3) infinite; display: inline-block; width: 1em; text-align: left; overflow: hidden; vertical-align: bottom; }

@keyframes fade { from { opacity: 0; } }
@keyframes slide-up { from { transform: translateY(24px); opacity: 0; } }
@keyframes dots { from { width: 0; } }
@keyframes pop { 50% { transform: scale(1.15); } }
.pop { animation: pop 0.35s ease; }

@media (min-width: 720px) {
    .bottom-nav { justify-content: center; gap: 24px; }
    .bottom-nav a { flex: 0 0 110px; }
}

/* "Mit wem?" – Mithelfende antippen */
.share-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.share-person { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 2px solid transparent; border-radius: 14px; background: transparent; font: inherit; font-weight: 700; cursor: pointer; }
.share-person[aria-pressed="true"] { border-color: var(--green-500); background: var(--green-100); }

/* Haushalts-Statistik: Rest bzw. erreicht unter Punkte/Soll */
.ok-text { color: var(--green-600); font-weight: 700; }
.fail-text { color: var(--red-600); font-weight: 700; }

/* Schalter an/aus (input[type=checkbox][role=switch] + .switch als Optik) */
.switch-row { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch {
    position: relative;
    flex: none;
    width: 50px;
    height: 30px;
    border-radius: 999px;
    background: var(--brown-200);
    transition: background 0.2s;
}
.switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s;
}
.switch-row input:checked + .switch { background: var(--green-500); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.switch-row input:focus-visible + .switch { outline: 3px solid var(--blue-300, #8cc0ff); outline-offset: 2px; }
.switch-row input:disabled + .switch { opacity: 0.6; }

/* Einführung: zusätzliche Inhalte (Installationsanleitung, Erinnerungs-Schalter) */
.intro-extra { padding: 12px; border-radius: var(--radius-s); background: var(--brown-50, #fdf6ec); }
.intro-extra ol { margin: 0; padding-left: 1.3em; }

/* Familienstatistik */
.family-row { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.family-row:last-child { border-bottom: 0; padding-bottom: 0; }
.family-row .num { text-align: right; }
.family-row > .btn { align-self: flex-start; }

/* Freigaben: je Erledigung eine Gruppe, darin die Anteile */
.approval-group { padding-top: 10px; border-top: 1px solid var(--border); }
.approvals > .approval-group:first-of-type { border-top: 0; padding-top: 0; }
.approval-share { padding-left: 4px; }
.approval-share .btn { min-width: 44px; }
.approval-actions { flex-wrap: wrap; }
.approval-actions .btn { flex: 1 1 140px; white-space: normal; }
.approval-actions.stacked .btn { flex-basis: 100%; }

/* Wartungsmodus */
.maintenance { max-width: 480px; margin: 0 auto; padding: 48px 16px; }
.maintenance-logo { width: 160px; margin: 0 auto; }
.maintenance-banner {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 6px 12px;
    background: var(--yellow-500);
    color: var(--brown-800, #4a2a10);
    font-size: 0.85rem;
    font-weight: 800;
    text-align: center;
}

/* Admin → Aufgaben: Kategorien auf-/zuklappbar, kompakt */
.template-groups { gap: 4px; }
.template-groups .section-title { margin: 6px 0; }
.template-groups section > .stack { margin-bottom: 10px; }

/* Häufige Aufgaben: drei Aktionen je Zeile (umbrechen auf schmalen Handys) */
.frequent-actions { flex-wrap: wrap; }
.frequent-actions .btn { flex: 1 1 90px; }
.frequent-help { gap: 2px; }
/* Häufige Aufgaben: Mehrfachauswahl (Zeile gedrückt halten) */
.frequent-row.can-select { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.frequent-check {
    display: none;
    flex: none;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 2px solid var(--brown-200);
    border-radius: 8px;
    color: transparent;
    font-weight: 900;
}
.frequent-selecting .frequent-check { display: grid; }
.frequent-selecting .frequent-actions { display: none; }
.frequent-selecting .frequent-row.can-select { cursor: pointer; }
.frequent-selecting .frequent-row:not(.can-select) { opacity: 0.5; pointer-events: none; }
.frequent-row.selected { outline: 3px solid var(--green-500); outline-offset: -3px; }
.frequent-row.selected .frequent-check { border-color: var(--green-500); background: var(--green-500); color: var(--white); }
.frequent-bar {
    position: sticky;
    bottom: calc(var(--safe-bottom) + 8px);
    z-index: 1;
    padding: 10px 12px;
    box-shadow: var(--shadow-strong);
}
/* Beschreibung einer Aufgabe (vom Admin hinterlegt) */
.task-description { color: var(--text-muted, #6b5a4a); white-space: pre-line; }
.by-task { gap: 10px; }
.by-task .num { min-width: 36px; text-align: right; }
.by-task-points { min-width: 64px; }

/* Stellvertretung: Leiste oben, solange man für eine betreute Person einträgt */
.acting-banner {
    position: sticky;
    top: 0;
    z-index: 60;
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    background: var(--green-500);
    color: var(--white);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    text-align: center;
    cursor: pointer;
}

/* Installationshinweis für andere Browser als Chrome (Android) */
.install-hint { background: var(--yellow-100); border-color: var(--yellow-500); }
.install-hint ol, details ol { margin: 0; padding-left: 1.3em; }
details summary { cursor: pointer; font-weight: 700; padding: 4px 0; }

/* Admin → Aufgaben: Zuständige direkt unter dem Titel, Suche + Personenfilter */
.assignee-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 2px; }
.assignee-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 1px 8px 1px 2px; border-radius: 999px;
    background: var(--brown-100); color: var(--brown-800);
    font-size: 0.8rem; font-weight: 800;
}
.assignee-chip .avatar { width: 18px; height: 18px; font-size: 0.65rem; }
.template-filters { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 520px) { .template-filters { grid-template-columns: 2fr 1fr; } }

/* Dauer als Zahl + Einheit (Stunden/Tage) */
.hours-input { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.claim-deadline { display: block; font-size: 0.85em; opacity: 0.85; }

/* Verlauf einer Aufgabe */
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.history li { display: flex; gap: 10px; align-items: flex-start; }
.history-icon { width: 1.6em; text-align: center; flex: none; }
.claim-deadline.passed { color: var(--red-600, #c62828); opacity: 1; font-weight: 800; }

/* Haushalt → Pro Person: Zeile anklickbar, Aktivität einer Person */
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--brown-100); }
.link-text { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.activity-item { align-items: flex-start; }
.activity-icon { width: 1.6em; text-align: center; flex: none; font-size: 1.2rem; }
.activity-title { font-weight: 800; }
.activity-points { font-weight: 700; color: var(--brown-600); }
.activity-points .badge { margin-left: 6px; }

/*
 * Skins: gemeinsame Deko-Ebene. Ein Skin setzt nur Variablen (siehe css/skin-*.css):
 * --deco (fester Hintergrund hinter der App), --header-bg, --week-bg, --login-bg, --sheet-bg, --nav-line.
 */
:root[data-skin] body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: var(--deco, none);
}
:root[data-skin] #app { position: relative; z-index: 1; }
.bottom-nav { border-top-color: var(--nav-line, var(--brown-200)); }

/* Design-Auswahl (Benutzermenü → Design): Automatik-Schalter + Kacheln nach Gruppen */
.skin-group-title { margin: 6px 2px 0; font-size: 0.85rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.skin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.skin-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px 6px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    text-align: center;
    cursor: pointer;
    min-width: 0;
}
.skin-tile.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--blue-100); }
.skin-tile img { width: 64px; height: 64px; object-fit: contain; }
.skin-tile .name { font-weight: 800; font-size: 0.85rem; line-height: 1.15; overflow-wrap: anywhere; }
.skin-tile .when { font-size: 0.7rem; color: var(--text-muted); line-height: 1.15; }
.skin-tile .skin-check {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    font-size: 0.8rem;
    font-weight: 900;
    line-height: 22px;
}
.skin-auto { display: flex; flex-direction: column; gap: 4px; }
.news-card { border-color: var(--primary); background: var(--blue-50); display: flex; flex-direction: column; gap: 6px; }

/* Rechtliche Seiten (Impressum, Lizenzen) */
.legal-links { text-align: center; }
.license-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.75rem; line-height: 1.4; margin: 0; padding: 10px; background: var(--bg); border-radius: var(--radius-s); max-height: 260px; overflow-y: auto; }

/* Android-App: Hinweis bleibt unsichtbar, solange keine APK bereitsteht; Prüfsummen zum Antippen und Kopieren */
.android-app-hint:empty { display: none; }
.checksum { display: block; width: 100%; text-align: left; font-family: ui-monospace, Consolas, monospace; font-size: 0.75rem; overflow-wrap: anywhere; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-s); color: inherit; cursor: copy; }
