:root {
  --bg: #eef1f8;
  --bg-grad: radial-gradient(1200px 600px at 50% -10%, #e7ecff 0%, #eef1f8 45%, #eef1f8 100%);
  --card: #ffffff;
  --card-2: #f8fafc;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #6366f1;
  --accent-soft: #eef2ff;
  --shadow: 0 10px 30px -12px rgba(30, 41, 59, 0.25);

  --yes: #22c55e;
  --yes-soft: #dcfce7;
  --maybe: #f59e0b;
  --maybe-soft: #fef3c7;
  --no: #ef4444;
  --no-soft: #fee2e2;
  --unknown: #cbd5e1;

  --radius: 16px;
  --radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --bg-grad: radial-gradient(1200px 600px at 50% -10%, #1e2a4a 0%, #0f172a 45%, #0f172a 100%);
    --card: #1e293b;
    --card-2: #182236;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #334155;
    --accent: #818cf8;
    --accent-soft: #28324f;
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);

    --yes-soft: #11331f;
    --maybe-soft: #3a2c0c;
    --no-soft: #3a1518;
    --unknown: #475569;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 18px 64px;
}

.hero { text-align: center; margin-bottom: 22px; }
.hero h1 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  letter-spacing: -0.02em;
}
.hero p {
  margin: 0 auto;
  max-width: 46ch;
  color: var(--muted);
  font-size: 0.98rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

/* --- Identitaet --- */
.identity-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.identity-row label { font-weight: 600; }
.name-input {
  flex: 1 1 180px;
  min-width: 0;
  padding: 11px 14px;
  font-size: 1rem;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.name-input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

.btn {
  appearance: none;
  cursor: pointer;
  font-size: 0.98rem;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  transition: transform 0.05s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--border);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.12s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-me {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.hint { color: var(--muted); font-size: 0.9rem; margin: 10px 0 0; }
.you-are { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.you-are .avatar {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700;
}
.you-are .who { font-weight: 600; }
.you-are .who span { display: block; font-weight: 400; font-size: 0.85rem; color: var(--muted); }

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px;
  margin: 0 auto 18px;
  max-width: 440px;
  box-shadow: var(--shadow);
}
.tab {
  flex: 1;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 9px 10px;
  border-radius: 999px;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.tab.is-active { background: var(--accent); color: #fff; }

/* --- Legende --- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.85rem;
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot-yes { background: var(--yes); }
.dot-maybe { background: var(--maybe); }
.dot-no { background: var(--no); }
.dot-unknown { background: var(--unknown); }

/* --- Monatsgruppen --- */
.month {
  margin: 0 0 10px;
  padding: 4px 4px 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.month:not(:first-child) { margin-top: 22px; }

/* --- Eingabe-Zeilen --- */
.weekend {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.weekend .date { flex: 1; min-width: 0; }
.weekend .date .range { font-weight: 600; }
.weekend .date .kw { font-size: 0.78rem; color: var(--muted); }

.choices { display: flex; gap: 6px; flex: 0 0 auto; }
.choice {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  transition: all 0.12s ease;
}
.choice:hover { border-color: var(--accent); }
.choice.sel-yes { background: var(--yes); border-color: var(--yes); color: #fff; }
.choice.sel-maybe { background: var(--maybe); border-color: var(--maybe); color: #fff; }
.choice.sel-no { background: var(--no); border-color: var(--no); color: #fff; }

/* --- Uebersicht --- */
.summary {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 16px;
  text-align: center;
}
.summary strong { color: var(--text); }

.best { margin-bottom: 22px; }
.best h2 {
  font-size: 1rem;
  margin: 0 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.best-card {
  background: linear-gradient(135deg, var(--accent-soft), var(--card));
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.best-card .bc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.best-card .bc-date { font-weight: 700; }
.best-card .bc-count { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.best-card .badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 9px;
  margin-bottom: 6px;
}

.ov-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.ov-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.ov-date { font-weight: 600; }
.ov-date .kw { font-size: 0.78rem; color: var(--muted); font-weight: 400; }
.ov-count { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }

.bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--unknown);
}
.bar span { display: block; height: 100%; }
.bar .b-yes { background: var(--yes); }
.bar .b-maybe { background: var(--maybe); }
.bar .b-no { background: var(--no); }

.people { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 5px; }
.pill {
  font-size: 0.76rem;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.pill-yes { background: var(--yes-soft); }
.pill-maybe { background: var(--maybe-soft); }
.pill-no { background: var(--no-soft); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 36px 16px;
}

.footer { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 26px; }

@media (max-width: 480px) {
  .choice { width: 40px; height: 40px; }
  .weekend { padding: 10px; gap: 8px; }
}

/* --- Kalenderansicht --- */
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.82rem;
}
.cal-legend .sw {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 5px;
  border: 1px solid var(--border);
}
.cal-legend .sw.cal-all { background: var(--yes); }
.cal-legend .sw.cal-good { background: var(--yes-soft); }
.cal-legend .sw.cal-mixed { background: var(--maybe-soft); }
.cal-legend .sw.cal-bad { background: var(--no-soft); }
.cal-legend .sw.cal-none { background: var(--card-2); }

.cal-month {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin: 0 auto 14px;
  max-width: 560px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.cal-weekday {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  padding-bottom: 4px;
}
.cal-day {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  border-radius: 8px;
  color: var(--muted);
}
.cal-day.cal-empty { background: transparent; }
.cal-day.cal-wd { color: var(--text); opacity: 0.4; }
.cal-day.cal-we {
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform 0.05s ease, filter 0.15s ease;
}
.cal-day.cal-we:hover { filter: brightness(1.06); }
.cal-day.cal-we:active { transform: translateY(1px); }
.cal-day.cal-we.out {
  opacity: 0.3;
  cursor: default;
  font-weight: 400;
  border-style: dashed;
}
.cal-day.sel { outline: 3px solid var(--accent); outline-offset: 1px; z-index: 1; }

.cal-day.cal-all { background: var(--yes); color: #fff; border-color: var(--yes); }
.cal-day.cal-good { background: var(--yes-soft); border-color: var(--yes); }
.cal-day.cal-mixed { background: var(--maybe-soft); border-color: var(--maybe); }
.cal-day.cal-bad { background: var(--no-soft); border-color: var(--no); }
.cal-day.cal-none { background: var(--card-2); }

.cal-count {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
  padding: 1px 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
}

.cal-detail {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.cal-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.cal-detail-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cal-detail-label { font-size: 0.85rem; color: var(--muted); }

@media (max-width: 480px) {
  .cal-grid { gap: 3px; }
  .cal-day { font-size: 0.8rem; border-radius: 6px; }
  .cal-count { font-size: 0.55rem; padding: 1px 3px; }
}

/* --- Eingabe: Wochenend-Gruppe mit einzelnen Tagen (Fr/Sa/So) --- */
.we-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 14px;
  margin-bottom: 10px;
}
.we-group-head {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}
.we-group-head .kw,
.ov-group-head .kw {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.8rem;
}
.day-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
}
.day-row + .day-row { border-top: 1px solid var(--border); }
.day-label { flex: 1; min-width: 0; font-weight: 500; }

/* --- Uebersicht: einzelne Tage je Wochenende --- */
.ov-group { margin-bottom: 16px; }
.ov-group-head {
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0 2px 8px;
}
