/* Putzplan-Familie – Frisch Mint + Sauber-Weiss */
:root {
  --mint-50: #f0fdfa;
  --mint-100: #ccfbf1;
  --mint-200: #99f6e4;
  --mint-300: #5eead4;
  --mint-400: #2dd4bf;
  --mint-500: #14b8a6;
  --mint-600: #0d9488;
  --mint-700: #0f766e;
  --mint-800: #115e59;

  --bg: #f4fbfa;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0fdfa;
  --border: #d7e9e6;
  --border-strong: #b7d8d3;
  --text: #0f2a28;
  --text-soft: #486b67;
  --text-faint: #7b9a96;
  --primary: #14b8a6;
  --primary-strong: #0d9488;
  --primary-ink: #ffffff;
  --danger: #e11d48;
  --danger-soft: #fff1f3;
  --shadow: 0 4px 16px rgba(15, 118, 110, 0.10);
  --shadow-lg: 0 12px 32px rgba(15, 118, 110, 0.18);
  --radius: 16px;
  --radius-sm: 11px;
  --radius-lg: 22px;
  --focus: 0 0 0 3px rgba(20, 184, 166, 0.45);
  --maxw: 760px;
}

[data-theme="dark"] {
  --bg: #08201e;
  --bg-elev: #0e2b28;
  --surface: #0e2b28;
  --surface-2: #123430;
  --border: #1d4540;
  --border-strong: #2a5a54;
  --text: #e6fbf7;
  --text-soft: #a3ccc6;
  --text-faint: #6f9a94;
  --primary: #2dd4bf;
  --primary-strong: #14b8a6;
  --primary-ink: #04201d;
  --danger: #fb7185;
  --danger-soft: #3a1622;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
  --focus: 0 0 0 3px rgba(45, 212, 191, 0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { margin: 0; line-height: 1.25; }
p { margin: 0; }

.hidden { display: none !important; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--primary);
  color: var(--primary-ink);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 200;
}
.skip-link:focus { left: 0; }

/* Header */
.app-header {
  background: linear-gradient(135deg, var(--mint-500), var(--mint-600));
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 14px) 16px 14px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  flex: 0 0 auto;
  color: #fff;
}
.brand-text { min-width: 0; }
.brand h1 { font-size: 1.28rem; font-weight: 800; letter-spacing: -0.02em; }
.brand-sub { font-size: 0.78rem; opacity: 0.9; margin-top: 1px; }
.header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

/* Buttons */
.btn {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }

.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-strong); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.3); }

.tab-panel .btn-ghost {
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
}
.tab-panel .btn-ghost:hover { background: var(--border); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.05); }

.btn-sm { padding: 9px 14px; font-size: 0.9rem; }

.btn-icon {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  font-size: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.modal .btn-icon {
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
}

/* Theme toggle icon states */
#themeToggle .theme-icon-dark { display: none; }
[data-theme="dark"] #themeToggle .theme-icon-light { display: none; }
[data-theme="dark"] #themeToggle .theme-icon-dark { display: inline; }

/* Tabbar */
.tabbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  max-width: var(--maxw);
  margin: 14px auto 0;
  padding: 6px;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.tabbar { width: calc(100% - 28px); }
.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 6px;
  border-radius: 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: background .15s ease, color .15s ease;
}
.tab-btn .tab-emoji { font-size: 1.15rem; }
.tab-btn:hover { background: var(--surface-2); }
.tab-btn.is-active { background: var(--primary); color: var(--primary-ink); }
.tab-btn:focus-visible { outline: none; box-shadow: var(--focus); }

/* Main */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 14px 40px;
}
.tab-panel { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Week bar */
.week-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.week-info { text-align: center; min-width: 0; flex: 1; }
.week-title { font-size: 1.05rem; font-weight: 800; }
.week-range { font-size: 0.82rem; color: var(--text-faint); margin-top: 2px; }

/* Progress */
.progress-card {
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.9rem;
  color: var(--text-soft);
  font-weight: 600;
  margin-bottom: 9px;
}
.progress-percent { color: var(--primary-strong); font-weight: 800; font-size: 1.05rem; }
.progress-track {
  height: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--mint-400), var(--mint-600));
  border-radius: 99px;
  transition: width .4s ease;
}

/* Assignment list (week) */
.assignment-list { margin-top: 16px; display: grid; gap: 12px; }
.person-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.person-block-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
  flex: 0 0 auto;
}
.person-block-name { font-weight: 800; font-size: 1rem; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.person-block-count {
  font-size: 0.78rem;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 99px;
  font-weight: 700;
  flex: 0 0 auto;
}
.chore-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}
.chore-row:first-child { border-top: none; }
.chore-check {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.9rem;
  line-height: 1;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
  padding: 0;
}
.chore-check:active { transform: scale(0.9); }
.chore-check:focus-visible { outline: none; box-shadow: var(--focus); }
.chore-check.is-done {
  background: var(--primary);
  border-color: var(--primary);
}
.chore-main { flex: 1; min-width: 0; }
.chore-name { font-weight: 600; overflow-wrap: anywhere; }
.chore-row.done .chore-name { text-decoration: line-through; color: var(--text-faint); }
.chore-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  margin-top: 3px;
}
.badge-daily { background: var(--mint-100); color: var(--mint-700); }
.badge-weekly { background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border); }
[data-theme="dark"] .badge-daily { background: #103e38; color: var(--mint-300); }

/* Section heads */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.section-head h2 { font-size: 1.2rem; font-weight: 800; }
.section-hint { color: var(--text-faint); font-size: 0.85rem; margin: 6px 0 16px; }

/* Card list (people / tasks) */
.card-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.list-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.list-card-main { flex: 1; min-width: 0; }
.list-card-title { font-weight: 700; overflow-wrap: anywhere; }
.list-card-sub { font-size: 0.8rem; color: var(--text-faint); margin-top: 2px; }
.list-card-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.icon-action {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 1rem;
  display: grid;
  place-items: center;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.icon-action:active { transform: scale(0.92); }
.icon-action:hover { background: var(--border); }
.icon-action.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.icon-action:focus-visible { outline: none; box-shadow: var(--focus); }

/* Empty states */
.empty-state {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  margin-top: 16px;
}
.empty-emoji { font-size: 2.6rem; display: block; margin-bottom: 8px; }
.empty-state h3 { font-size: 1.05rem; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 0.88rem; max-width: 36ch; margin: 0 auto; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 32, 30, 0.55); backdrop-filter: blur(3px); animation: fade .2s ease; }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
.modal-card-sm { max-width: 380px; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.modal-head h3 { font-size: 1.15rem; font-weight: 800; }
.confirm-message { color: var(--text-soft); margin-bottom: 18px; overflow-wrap: anywhere; }

/* Forms */
.field { display: block; margin-bottom: 16px; border: none; padding: 0; }
fieldset.field { margin: 0 0 16px; }
.field-label { display: block; font-weight: 700; font-size: 0.88rem; margin-bottom: 7px; color: var(--text-soft); }
.field input[type="text"] {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.field input[type="text"]:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.field-error { display: block; color: var(--danger); font-size: 0.8rem; margin-top: 6px; min-height: 1em; }

.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-pill { flex: 1; min-width: 120px; cursor: pointer; }
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill span {
  display: block;
  text-align: center;
  padding: 11px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 700;
  color: var(--text-soft);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.radio-pill input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.radio-pill input:focus-visible + span { box-shadow: var(--focus); }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; min-width: 120px; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 99px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Responsive */
@media (max-width: 420px) {
  .brand h1 { font-size: 1.12rem; }
  .btn-sm { padding: 8px 11px; font-size: 0.85rem; }
  main { padding: 14px 12px 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
