/* ═══════════════════════════════
   DESIGN TOKENS
═══════════════════════════════ */
:root {
  --purple-dark:   #3a3558;
  --purple-mid:    #7a78a8;
  --purple-light:  #c8cadb;
  --text-muted:    #5a5790; /* dunklere Variante für Fließtext auf --purple-light-Basis — --purple-light selbst hat auf Weiß nur 1.6:1 Kontrast, weit unter WCAG AA (4.5:1) */
  --lavender:      #f4e2e7;
  --lavender-soft: #fdf5f7;
  --mint:          #b9dcd2;
  --teal:          #ddf0eb;
  --teal-mid:      #6aada0;
  --white:         #ffffff;
  --gray-text:     #4a4a5e;
  --gray-light:    #f2f3f6;
  --gray-mid:      #e0e2ea;
  --radius:        14px;
  --radius-sm:     10px;
  --shadow:        0 4px 20px rgba(58,53,88,0.09);
  --shadow-lg:     0 8px 40px rgba(58,53,88,0.18);
}

/* ═══════════════════════════════
   BASE
═══════════════════════════════ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--purple-light);
  min-height: 100vh;
  color: var(--gray-text);
  padding: 0 0 80px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }

/* ═══════════════════════════════
   ONBOARDING
═══════════════════════════════ */
.onboarding-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(58,53,88,0.88); z-index: 300;
  align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(8px);
}
.onboarding-overlay.open { display: flex; }
.ob-box {
  background: var(--white); border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 32px 28px; max-width: 420px; width: 100%;
  animation: slideUp 0.3s ease;
  max-height: 90vh; overflow-y: auto;
}
.ob-box h2 {
  font-family: 'Fredoka', sans-serif; font-size: 1.75rem;
  color: var(--purple-dark); margin-bottom: 8px; line-height: 1.2;
}
.ob-box .ob-sub {
  font-size: 0.87rem; color: var(--gray-text); margin-bottom: 24px; line-height: 1.65;
}
.ob-label {
  font-size: 0.72rem; font-weight: 700; color: var(--purple-mid);
  text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; display: block;
}
.ob-name {
  width: 100%; box-sizing: border-box; font-family: inherit; font-size: 0.95rem;
  color: var(--gray-text); padding: 11px 13px; border-radius: 10px;
  border: 1.5px solid var(--purple-light); background: var(--white); margin-bottom: 6px;
}
.ob-name-hinweis {
  font-size: 0.76rem; color: var(--gray-text); opacity: 0.85;
  line-height: 1.5; margin: 0 0 22px;
}
.ob-cycle-opts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 28px; }
.ob-cycle-opt {
  padding: 12px 14px; border-radius: 12px; border: 2px solid var(--gray-mid);
  cursor: pointer; transition: all 0.18s; display: flex; align-items: center; gap: 12px;
  background: var(--lavender-soft);
}
.ob-cycle-opt:hover { border-color: var(--purple-mid); }
.ob-cycle-opt.selected { border-color: var(--purple-mid); background: var(--lavender); }
.ob-cycle-opt .oc-icon { font-size: 1.3rem; flex-shrink: 0; }
.ob-cycle-opt .oc-text h4 { font-size: 0.88rem; font-weight: 700; color: var(--purple-dark); }
.ob-cycle-opt .oc-text p { font-size: 0.76rem; color: var(--gray-text); margin-top: 2px; }

/* ═══════════════════════════════
   HEADER
═══════════════════════════════ */
.app-header {
  text-align: center; padding: 28px 20px 16px;
  background: var(--purple-light);
}
.brand-title {
  font-family: 'Fredoka', sans-serif; font-size: 2.2rem; font-weight: 700;
  letter-spacing: 0.3px; line-height: 1;
}
.brand-title .migra { color: var(--purple-mid); }
.brand-title .motion { color: var(--teal-mid); }
.brand-sub {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 2.5px; color: var(--purple-dark); margin-top: 4px;
}

/* ═══════════════════════════════
   NAV
═══════════════════════════════ */
.nav {
  display: flex; justify-content: center; gap: 6px;
  padding: 12px 16px 4px; flex-wrap: wrap;
}
.nav-btn {
  padding: 8px 16px; border: none; border-radius: 50px; font-size: 0.83rem;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
  background: var(--white); color: var(--purple-mid);
  box-shadow: 0 2px 8px rgba(74,45,107,0.08);
  text-decoration: none; display: inline-block;
}
.nav-btn.active { background: var(--purple-mid); color: var(--white); }
.nav-btn:hover:not(.active) { background: var(--white); box-shadow: 0 2px 12px rgba(74,45,107,0.15); }

/* ═══════════════════════════════
   VIEWS
═══════════════════════════════ */
.view { display: none; padding: 12px 14px 0; max-width: 680px; margin: 0 auto; }
.view.active { display: block; }

/* ═══════════════════════════════
   CARDS
═══════════════════════════════ */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 12px;
}
.card-title {
  font-size: 0.75rem; font-weight: 700; color: var(--purple-mid);
  text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 14px;
}

/* ═══════════════════════════════
   CALENDAR
═══════════════════════════════ */
.month-nav {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.month-nav h2 { font-size: 1rem; color: var(--purple-dark); font-weight: 700; }
.month-nav-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: var(--lavender); color: var(--purple-dark); font-size: 1rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.18s;
}
.month-nav-btn:hover { background: var(--purple-light); color: white; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day-name {
  text-align: center; font-size: 0.68rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; padding: 3px 0 7px; letter-spacing: 0.4px;
}
.cal-day {
  aspect-ratio: 1; min-height: 40px; border-radius: 9px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.8rem; font-weight: 600; transition: all 0.15s;
  position: relative; border: 2px solid transparent;
  background: var(--gray-light); color: var(--gray-text); user-select: none;
}
.cal-day:hover { border-color: var(--purple-light); transform: scale(1.06); }
.cal-day.empty { background: transparent; cursor: default; pointer-events: none; }
.cal-day.today { border-color: var(--purple-mid) !important; }
.cal-day.future { opacity: 0.3; cursor: default; pointer-events: none; }
.cal-day.tracked { background: var(--teal); }
.cal-day.has-migraine { background: #ffcdd2; }
.cal-day.tracked.has-migraine { background: #ef9a9a; }
.cal-day .dot-row { display: flex; gap: 2px; margin-top: 2px; }
.cal-day .dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.cal-legend {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px;
  padding-top: 12px; border-top: 1px solid var(--lavender); justify-content: center;
}
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 0.72rem; color: var(--gray-text); }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

/* ═══════════════════════════════
   PROGRESS CARD
═══════════════════════════════ */
.prog-bar-track {
  height: 8px; background: var(--gray-light); border-radius: 4px;
  overflow: hidden; margin: 8px 0 10px;
}
.prog-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--mint), var(--teal-mid));
  transition: width 0.5s ease;
}
.prog-meta {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;
}
.prog-stage { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.prog-next  { font-size: 0.73rem; color: var(--text-muted); }
.prog-msg   { font-size: 0.83rem; color: var(--gray-text); line-height: 1.55; }

/* ═══════════════════════════════
   MODAL OVERLAY
═══════════════════════════════ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(58,53,88,0.4); z-index: 200;
  align-items: flex-end; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lg);
  padding: 0; width: 100%; max-width: 600px;
  max-height: 92vh; display: flex; flex-direction: column;
  animation: slideUp 0.28s ease;
}
.modal-handle {
  width: 36px; height: 4px; background: var(--gray-mid);
  border-radius: 2px; margin: 12px auto 0;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 12px; flex-shrink: 0;
  border-bottom: 1px solid var(--gray-light);
}
.modal-header h3 { font-size: 1rem; color: var(--purple-dark); font-weight: 700; }
.modal-close {
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: var(--lavender); color: var(--purple-dark); font-size: 1rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.18s; flex-shrink: 0;
}
.modal-close:hover { background: var(--purple-light); color: white; }
.modal-body { overflow-y: auto; padding: 16px 20px 24px; flex: 1; }
.modal-footer { padding: 12px 20px 20px; flex-shrink: 0; border-top: 1px solid var(--gray-light); }

/* ═══════════════════════════════
   FORM SECTIONS (Modal)
═══════════════════════════════ */
.form-section { margin-bottom: 22px; }
.form-section:last-child { margin-bottom: 0; }
.section-title {
  font-size: 0.8rem; font-weight: 700; color: var(--purple-dark);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 12px; display: flex; align-items: center; gap: 7px;
}
.section-divider {
  height: 1px; background: var(--gray-light); margin: 20px 0;
}

/* ═══════════════════════════════
   MIGRÄNE TOGGLE (groß)
═══════════════════════════════ */
.migraine-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-radius: 14px; margin-bottom: 14px;
  border: 2px solid var(--gray-mid); background: var(--lavender-soft);
  cursor: pointer; transition: all 0.2s;
}
.migraine-toggle.active { background: #ffebee; border-color: #e57373; }
.mt-left { display: flex; align-items: center; gap: 12px; }
.mt-icon { font-size: 1.6rem; }
.mt-text h4 { font-size: 0.97rem; font-weight: 700; color: var(--purple-dark); }
.mt-text p  { font-size: 0.78rem; color: var(--gray-text); margin-top: 2px; }
.toggle-sw {
  width: 50px; height: 28px; border-radius: 14px; background: var(--gray-mid);
  position: relative; transition: background 0.2s; flex-shrink: 0;
}
.toggle-sw.on { background: #e57373; }
.toggle-sw::after {
  content: ''; position: absolute; top: 4px; left: 4px;
  width: 20px; height: 20px; border-radius: 50%; background: white;
  transition: transform 0.2s; box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.toggle-sw.on::after { transform: translateX(22px); }

/* ═══════════════════════════════
   AMPEL (3-Wege)
═══════════════════════════════ */
.ampel { display: flex; gap: 7px; }
.ampel-btn {
  flex: 1; padding: 11px 6px; border-radius: 11px; border: 2px solid transparent;
  cursor: pointer; font-size: 0.82rem; font-weight: 600; transition: all 0.16s;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: var(--gray-light); color: var(--gray-text);
}
.ampel-btn .ai { font-size: 1.25rem; }
.ampel-btn:hover { border-color: var(--purple-light); }
.ampel-btn.sel-red    { background: #ffebee; border-color: #e57373; color: #c62828; }
.ampel-btn.sel-yellow { background: #fff8e1; border-color: #ffb74d; color: #e65100; }
.ampel-btn.sel-green  { background: #e8f5e9; border-color: #81c784; color: #2e7d32; }

/* ═══════════════════════════════
   INTENSITY SELECTOR
═══════════════════════════════ */
.intensity-row { display: flex; gap: 7px; margin-top: 10px; }
.int-btn {
  flex: 1; padding: 10px 6px; border-radius: 10px; border: 2px solid transparent;
  cursor: pointer; font-size: 0.82rem; font-weight: 600; transition: all 0.16s;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--gray-light); color: var(--gray-text);
}
.int-btn:hover { border-color: var(--purple-light); }
.int-btn.sel-light  { background: #fff8e1; border-color: #ffb74d; color: #e65100; }
.int-btn.sel-medium { background: #ffe0b2; border-color: #fb8c00; color: #bf360c; }
.int-btn.sel-severe { background: #ffebee; border-color: #e57373; color: #c62828; }

/* ═══════════════════════════════
   SLEEP DURATION SELECTOR
═══════════════════════════════ */
.sleep-dur { display: flex; gap: 7px; }
.sleep-dur-btn {
  flex: 1; padding: 10px 4px; border-radius: 11px; border: 2px solid transparent;
  cursor: pointer; font-size: 0.78rem; font-weight: 600; transition: all 0.16s;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--gray-light); color: var(--gray-text); text-align: center;
}
.sleep-dur-btn .sdi { font-size: 1.3rem; }
.sleep-dur-btn:hover { border-color: var(--purple-light); }
.sleep-dur-btn.selected { background: var(--lavender); border-color: var(--purple-mid); color: var(--purple-dark); }

/* ═══════════════════════════════
   TOGGLES (kleine Checkboxen)
═══════════════════════════════ */
.toggle-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: 10px; background: var(--lavender-soft);
  border: 1.5px solid var(--gray-mid); cursor: pointer; transition: all 0.16s;
}
.toggle-row:hover { border-color: var(--purple-light); }
.toggle-row.active { background: var(--lavender); border-color: var(--purple-mid); }
.toggle-row-label { display: flex; align-items: center; gap: 9px; font-size: 0.86rem; color: var(--gray-text); font-weight: 500; }
.toggle-row-label .ti { font-size: 1.1rem; }
.mini-toggle {
  width: 38px; height: 22px; border-radius: 11px; background: var(--gray-mid);
  position: relative; transition: background 0.18s; flex-shrink: 0;
}
.toggle-row.active .mini-toggle { background: var(--purple-mid); }
.mini-toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: white;
  transition: transform 0.18s; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-row.active .mini-toggle::after { transform: translateX(16px); }

/* ═══════════════════════════════
   CHIPS
═══════════════════════════════ */
.chip-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 8px 13px;
  border-radius: 50px; background: var(--gray-light); font-size: 0.82rem;
  cursor: pointer; transition: all 0.16s; border: 2px solid transparent;
  color: var(--gray-text); font-weight: 500; user-select: none;
}
.chip:hover { border-color: var(--purple-light); }
.chip.selected { background: var(--lavender); border-color: var(--purple-mid); color: var(--purple-dark); font-weight: 700; }
.chip-note { font-size: 0.76rem; color: var(--text-muted); margin-bottom: 9px; line-height: 1.5; }

/* ═══════════════════════════════
   ERNÄHRUNG: GENAU EINTRAGEN
═══════════════════════════════ */
.detailed-food { margin-top: 14px; }
.detailed-food-toggle {
  background: none; border: none; color: var(--purple-mid); font-size: 0.8rem;
  font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline;
}
.detailed-food-list { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.detailed-food-row { background: var(--gray-light); border-radius: 10px; padding: 10px 12px; }
.detailed-food-row-top { display: flex; gap: 8px; align-items: center; }
.detailed-food-input {
  flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--purple-light);
  font-size: 0.85rem; font-family: inherit; color: var(--gray-text);
}
.detailed-food-remove {
  background: none; border: none; color: var(--text-muted); font-size: 0.95rem;
  cursor: pointer; flex-shrink: 0; padding: 4px;
}
.detailed-food-cats { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.mini-chip {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 50px;
  background: var(--white); font-size: 0.72rem; cursor: pointer; transition: all 0.16s;
  border: 1px solid var(--purple-light); color: var(--gray-text); user-select: none;
}
.mini-chip.selected { background: var(--lavender); border-color: var(--purple-mid); color: var(--purple-dark); font-weight: 700; }
.detailed-food-add {
  background: none; border: 1px dashed var(--purple-light); color: var(--purple-mid);
  border-radius: 8px; padding: 8px; font-size: 0.78rem; font-weight: 600; cursor: pointer;
}

/* ═══════════════════════════════
   KOFFEIN SKALA
═══════════════════════════════ */
.coffee-row { display: flex; gap: 6px; margin-top: 8px; }
.coffee-btn {
  flex: 1; padding: 9px 4px; border-radius: 10px; border: 2px solid transparent;
  cursor: pointer; font-size: 0.75rem; font-weight: 600; transition: all 0.16s;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--gray-light); color: var(--gray-text); text-align: center;
}
.coffee-btn .ci { font-size: 1.2rem; }
.coffee-btn:hover { border-color: var(--purple-light); }
.coffee-btn.selected { background: var(--lavender); border-color: var(--purple-mid); color: var(--purple-dark); font-weight: 700; }

/* ═══════════════════════════════
   BEWEGUNG GRID
═══════════════════════════════ */
.movement-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.mv-btn {
  padding: 12px 8px; border-radius: 12px; border: 2px solid var(--gray-mid);
  cursor: pointer; font-size: 0.82rem; font-weight: 600; transition: all 0.16s;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--lavender-soft); color: var(--gray-text); text-align: center;
}
.mv-btn .mvi { font-size: 1.5rem; }
.mv-btn:hover { border-color: var(--purple-mid); }
.mv-btn.selected { background: var(--teal); border-color: var(--teal-mid); color: var(--purple-dark); }

/* ═══════════════════════════════
   HYDRATION
═══════════════════════════════ */
.hydration-row { display: flex; gap: 7px; }
.hydration-btn {
  flex: 1; padding: 10px 6px; border-radius: 11px; border: 2px solid transparent;
  cursor: pointer; font-size: 0.8rem; font-weight: 600; transition: all 0.16s;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--gray-light); color: var(--gray-text);
}
.hydration-btn .hi { font-size: 1.3rem; }
.hydration-btn:hover { border-color: var(--teal-mid); }
.hydration-btn.selected { background: var(--teal); border-color: var(--teal-mid); color: var(--purple-dark); }

/* ═══════════════════════════════
   WETTER
═══════════════════════════════ */
.weather-card {
  background: var(--teal); border-radius: 12px; padding: 13px 15px;
}
.weather-loading { font-size: 0.82rem; color: var(--teal-mid); display: flex; align-items: center; gap: 8px; }
.weather-content { display: flex; align-items: flex-start; gap: 12px; }
.w-icon { font-size: 2rem; flex-shrink: 0; line-height: 1; margin-top: 2px; }
.w-details { flex: 1; }
.w-temp   { font-size: 1.35rem; font-weight: 800; color: var(--purple-dark); }
.w-label  { font-size: 0.8rem; color: var(--teal-mid); font-weight: 600; margin-top: 1px; }
.w-meta   { font-size: 0.76rem; color: var(--gray-text); margin-top: 5px; line-height: 1.7; }
.w-loc    { font-size: 0.7rem; color: var(--purple-mid); margin-top: 4px; }
.weather-error-wrap { font-size: 0.82rem; }
.weather-past-note { font-size: 0.8rem; color: var(--teal-mid); font-style: italic; }

.weather-gespeichert {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px;
  background: var(--teal); color: var(--purple-dark);
  font-size: 0.82rem; font-weight: 600; text-align: center;
}

.weather-reload {
  display: none; width: 100%; margin-top: 8px; padding: 9px;
  font-family: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer;
  border-radius: 9px; border: 1.5px solid var(--purple-light);
  background: var(--white); color: var(--purple-mid);
}
.city-row { display: flex; gap: 7px; align-items: center; margin-top: 8px; }
.city-input {
  flex: 1; padding: 8px 11px; border: 2px solid var(--mint); border-radius: 8px;
  font-size: 0.84rem; color: var(--gray-text); background: var(--white);
  outline: none; font-family: inherit;
}
.city-input:focus-visible { outline: 2px solid var(--purple-dark); outline-offset: 2px; }
.cal-day:focus-visible, .ob-cycle-opt:focus-visible, .migraine-toggle:focus-visible,
.toggle-row:focus-visible, .chip:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid var(--purple-dark); outline-offset: 2px;
}
.city-btn {
  padding: 8px 13px; border: none; border-radius: 8px;
  background: var(--teal-mid); color: white; font-size: 0.84rem;
  font-weight: 700; cursor: pointer; font-family: inherit; white-space: nowrap;
}

/* ═══════════════════════════════
   BUTTONS
═══════════════════════════════ */
.btn-primary {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: var(--purple-mid); color: white; font-size: 0.95rem;
  font-weight: 700; cursor: pointer; transition: background 0.2s;
}
.btn-primary:hover { background: var(--purple-dark); }
.btn-danger {
  width: 100%; margin-top: 8px; padding: 11px;
  border: 2px solid #ef9a9a; border-radius: 12px;
  background: transparent; color: #c62828;
  font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-danger:hover { background: #ffebee; }
.btn-secondary {
  width: 100%; padding: 12px; border: 2px solid var(--purple-light); border-radius: 12px;
  background: transparent; color: var(--purple-mid); font-size: 0.9rem;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { background: var(--lavender); }

/* ═══════════════════════════════
   AUSWERTUNG
═══════════════════════════════ */
.period-nav {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 12px;
}
.period-btn {
  padding: 7px 16px; border: none; border-radius: 50px; font-size: 0.83rem;
  font-weight: 600; cursor: pointer; background: var(--white); color: var(--purple-mid);
  box-shadow: 0 2px 8px rgba(74,45,107,0.08); transition: all 0.18s;
}
.period-btn.active { background: var(--purple-mid); color: white; }
.btn-print {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px; border: 2px solid var(--purple-mid); border-radius: 10px;
  background: var(--white); color: var(--purple-mid); font-size: 0.9rem;
  font-weight: 700; cursor: pointer; transition: all 0.2s; font-family: inherit;
  margin-bottom: 16px;
}
.btn-print:hover { background: var(--purple-mid); color: var(--white); }
.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px;
}
.stat-box {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; text-align: center;
}
.stat-val   { font-size: 2rem; font-weight: 800; color: var(--purple-dark); line-height: 1; }
/* "von 14" ist der Bezug, nicht der Wert: kleiner und zurückgenommen, damit
   die eigentliche Zahl die Kachel trägt. */
.stat-von   { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); }
.stat-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; hyphens: auto; overflow-wrap: break-word; }
.bar-row { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.bar-label { font-size: 0.8rem; color: var(--gray-text); width: 12.5em; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 9px; background: var(--gray-light); border-radius: 5px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 5px; }
.bar-fill.bp { background: linear-gradient(90deg, var(--purple-light), var(--purple-mid)); }
.bar-fill.bt { background: linear-gradient(90deg, var(--mint), var(--teal-mid)); }
.bar-count { font-size: 0.78rem; font-weight: 700; color: var(--teal-mid); min-width: 22px; text-align: right; }
.pattern-legend { font-size: 0.74rem; color: var(--text-muted); margin-bottom: 12px; line-height: 1.5; }
.pattern-bars { margin-bottom: 4px; }
.pattern-bar-strong .bar-label { font-weight: 700; color: var(--purple-dark); }
.pattern-bar-strong .bar-count { color: var(--teal-mid); }
.insight-box {
  background: var(--lavender); border-radius: 10px; padding: 13px 15px;
  margin-bottom: 9px; border-left: 4px solid var(--purple-mid);
}
.insight-box.green { background: #e8f5e9; border-left-color: #81c784; }
.insight-box p { font-size: 0.85rem; line-height: 1.6; color: var(--gray-text); }
.insight-box strong { color: var(--purple-dark); }
.empty-state { text-align: center; padding: 24px 14px; color: var(--text-muted); font-size: 0.86rem; line-height: 1.6; }
.empty-state .es-icon { font-size: 2.2rem; display: block; margin-bottom: 8px; }

/* ═══════════════════════════════
   ATTACKEN VERGLEICH
═══════════════════════════════ */
.attack-row { padding: 10px 0; border-bottom: 1px solid rgba(200,202,219,0.35); }
.attack-row:last-of-type { border-bottom: none; }
.attack-header { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.attack-date { font-size: 0.8rem; font-weight: 700; color: var(--purple-dark); }
.attack-int { font-size: 0.68rem; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.attack-int.int-light  { background: #fff8e1; color: #e65100; }
.attack-int.int-medium { background: #ffe0b2; color: #bf360c; }
.attack-int.int-severe { background: #ffebee; color: #c62828; }
.attack-tags { display: flex; flex-wrap: wrap; gap: 5px; }

/* ── MEIN BALLON ──────────────────────────────────────────────────
   Das Ballonmodell, gezeichnet aus den eigenen Einträgen. Bewusst ohne
   Grenzlinie: Die Belastungsgrenze verschiebt sich laut Modell täglich, eine
   gezeichnete Linie wäre eine Zahl, die es nicht gibt. */
.ballon-block {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0 9px;
  background: var(--lavender-soft, #f2effa);
  border-radius: 10px; padding: 10px 12px;
}
/* 54 statt 42 Pixel: Bei kleinerer Darstellung geht der Riss unter und sieht
   aus wie ein Kratzer. Die Zeile ist ohnehin drei Textzeilen hoch. */
.ballon-bild { flex-shrink: 0; width: 54px; }
.ballon-svg { width: 54px; height: 77px; display: block; }
.ballon-text {
  font-size: 0.78rem; line-height: 1.5;
  color: var(--gray-text);
}
.ballon-ventile { margin-top: 6px; }
.ballon-ventile-titel { color: var(--text-muted); }
.attack-tags-titel {
  font-size: 0.78rem; color: var(--text-muted);
  align-self: center; margin-right: 2px;
}
.attack-gegessen { margin-top: 6px; }

/* "Bekommt mir nicht": eine Angabe über die Person, nicht über das
   Lebensmittel. Deshalb ruhig gesetzt und nicht als Warnung eingefärbt. */
.bekannt-zeile {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; padding: 5px 10px; border-radius: 20px; cursor: pointer;
  font-size: 0.78rem; color: var(--gray-text);
  border: 1px solid var(--purple-light); background: var(--white);
}
.bekannt-zeile.aktiv { border-color: var(--teal-mid); font-weight: 600; }
.bekannt-haken { font-size: 0.85rem; line-height: 1; }
.bekannt-hinweis {
  font-size: 0.75rem; line-height: 1.5; margin-top: 10px;
  color: var(--text-muted);
}
.bekannt-toggle {
  display: block; width: 100%; text-align: left; margin-top: 10px; padding: 8px 0;
  font-family: inherit; font-size: 0.8rem; cursor: pointer;
  background: none; border: none; color: var(--purple-mid);
  text-decoration: underline;
}
.bekannt-kategorien {
  margin-top: 4px; padding: 11px 12px;
  background: var(--gray-light); border-radius: 10px;
}
.bekannt-kat-liste { display: flex; flex-wrap: wrap; gap: 6px; }
.ballon-ventil {
  display: inline-block; margin: 2px 4px 0 0; padding: 1px 7px;
  border-radius: 20px; font-size: 0.72rem;
  /* Schrift in der normalen Textfarbe, nur der Rand trägt das Teal: Teal auf
     Weiß liegt unter dem lesbaren Kontrast, und im Dunkelmodus dreht sich das
     Verhältnis um. So stimmt es in beiden Fassungen. */
  background: var(--white); color: var(--gray-text);
  border: 1px solid var(--teal-mid);
}

/* Der Ballon wächst beim Erscheinen einmal auf, das trägt das Bild. Wer
   Bewegung im System abgeschaltet hat, bekommt ihn ohne. */
@media (prefers-reduced-motion: no-preference) {
  .ballon-svg ellipse, .ballon-svg path { transform-origin: 35px 55px; animation: ballon-auf 520ms ease-out both; }
}
@keyframes ballon-auf {
  from { transform: scale(0.82); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.attack-tag { font-size: 0.72rem; padding: 3px 9px; border-radius: 20px; background: rgba(200,202,219,0.35); color: var(--purple-dark); }
.tip-box { background: var(--lavender-soft); border-left: 3px solid var(--teal-mid); border-radius: 0 10px 10px 0; padding: 11px 14px; margin-bottom: 10px; }
.tip-box-label { font-size: 0.75rem; font-weight: 700; color: var(--purple-dark); margin-bottom: 4px; }
.tip-box-text { font-size: 0.78rem; color: var(--gray-text); line-height: 1.6; }

/* ═══════════════════════════════
   WEGLASSVERSUCH
═══════════════════════════════ */
.trial-hint {
  background: var(--lavender); border-radius: 10px; padding: 12px 14px;
  margin-bottom: 12px; border-left: 4px solid var(--purple-mid);
  font-size: 0.82rem; line-height: 1.6; color: var(--gray-text);
}
.trial-hint strong { color: var(--purple-dark); }
.trial-active { background: var(--gray-light); border-radius: 10px; padding: 12px 14px; }
.trial-active-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.trial-active-label, .trial-past-label { font-size: 0.82rem; color: var(--gray-text); }
.trial-active-label strong { color: var(--purple-dark); }
.trial-delete {
  background: none; border: none; color: var(--text-muted); font-size: 0.9rem;
  cursor: pointer; flex-shrink: 0; padding: 2px 4px;
}
.trial-compare { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.trial-compare-col { flex: 1; background: var(--white); border-radius: 8px; padding: 8px 10px; text-align: center; }
.trial-compare-label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 3px; }
.trial-compare-val { font-size: 0.85rem; font-weight: 700; color: var(--purple-dark); }
.trial-compare-arrow { font-size: 1rem; color: var(--text-muted); flex-shrink: 0; }
.trial-history { margin-top: 14px; }
.trial-history-title { font-size: 0.74rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px; }
.trial-past-item { background: var(--gray-light); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.tip-disclaimer { font-size: 0.7rem; color: var(--text-muted); margin-top: 12px; font-style: italic; line-height: 1.5; }
.const-section { margin-top: 14px; padding-top: 13px; border-top: 2px solid rgba(122,120,168,0.25); }
.const-title { font-size: 0.72rem; font-weight: 700; color: var(--purple-mid); margin-bottom: 9px; text-transform: uppercase; letter-spacing: 0.6px; }
.const-tag { font-size: 0.72rem; padding: 4px 10px; border-radius: 20px; font-weight: 600; }
.const-always { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.const-often  { background: var(--lavender); color: var(--purple-dark); border: 1px solid var(--purple-light); }

/* ═══════════════════════════════
   EINSTELLUNGEN
═══════════════════════════════ */
.settings-section-title {
  font-size: 0.8rem; font-weight: 700; color: var(--purple-dark);
  margin-bottom: 10px;
}
.settings-opt {
  padding: 11px 13px; border-radius: 10px; border: 2px solid var(--gray-mid);
  cursor: pointer; transition: all 0.18s; display: flex; align-items: center; gap: 10px;
  background: var(--lavender-soft); margin-bottom: 7px;
}
.settings-opt:hover { border-color: var(--purple-mid); }
.settings-opt.selected { border-color: var(--purple-mid); background: var(--lavender); }
.settings-opt .so-icon { font-size: 1.15rem; }
.settings-opt .so-label { font-size: 0.86rem; font-weight: 600; color: var(--purple-dark); }

/* ═══════════════════════════════
   ZYKLUSANSICHT (nach Zyklustag ausgerichtet)
═══════════════════════════════ */
.ct-note { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 12px; }
.ct-scroll { overflow-x: auto; padding-bottom: 4px; }
.cycle-timeline { display: flex; flex-direction: column; gap: 3px; width: max-content; }
.ct-row { display: flex; align-items: center; gap: 6px; }
.ct-label {
  position: sticky; left: 0; z-index: 1; flex-shrink: 0; width: 88px;
  font-size: 0.68rem; color: var(--text-muted); background: var(--white); padding-right: 4px;
}
.ct-header .ct-label { background: var(--white); }
.ct-days { display: flex; gap: 2px; }
.ct-cell { width: 16px; height: 16px; border-radius: 4px; background: var(--gray-light); flex-shrink: 0; }
.ct-cell.ct-empty { background: transparent; }
.ct-cell.ct-daynum {
  width: 16px; height: 16px; background: none; font-size: 0.6rem; color: var(--text-muted);
  display: flex; align-items: flex-end; justify-content: center; border-radius: 0;
}
.ct-cell.ct-bleeding { background: var(--lavender); }
.ct-cell.ct-migraine { background: linear-gradient(135deg, var(--purple-mid), var(--purple-dark)); }
.ct-cell.ct-bleeding.ct-migraine { background: linear-gradient(135deg, var(--purple-mid), var(--purple-dark)); box-shadow: inset 0 0 0 2px var(--lavender); }
.ct-legend { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 0.74rem; color: var(--text-muted); flex-wrap: wrap; }
.ct-legend-swatch { display: inline-block; }

/* ═══════════════════════════════
   ANIMATIONS
═══════════════════════════════ */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════
   RESPONSIVE
═══════════════════════════════ */
@media (max-width: 420px) {
  .view { padding: 10px 10px 0; }
  .modal-body { padding: 14px 16px 20px; }
  .modal-footer { padding: 10px 16px 16px; }
  .stat-val { font-size: 1.65rem; }
  .brand-title { font-size: 1.9rem; }
  .movement-grid { grid-template-columns: repeat(3, 1fr); }
  /* Am Handy lieber zwei Zeilen als abgeschnitten: Mit über zwanzig
     Faktoren in der Liste muss man lesen können, welcher gemeint ist, und
     „Später schlafen als üblich“ passt in keine Zeile. */
  .bar-label {
    width: 9.4em; white-space: normal; overflow: visible;
    line-height: 1.3; align-self: center;
    /* „Schlechter/unruhiger“ ist ein Wort ohne Leerzeichen und breiter als
       die Spalte; ohne das hier ragt es über den Balken. */
    overflow-wrap: anywhere;
  }
}
/* Der Ballon in der Musteranalyse fasst drei Tage zusammen, der auf der
   Startseite zeigt einen. Ohne diesen Satz wirkt derselbe Tag widersprüchlich. */
.ballon-hinweis { color: var(--text-muted); font-size: 0.72rem; }

/* ══════════ VORBOTEN ══════════
   Der Abschnitt ist eingeklappt, bis jemand ihn braucht. Deshalb ist der
   Knopf die ganze Überschrift und nicht nur ein kleiner Pfeil daneben: Er
   wird mit dem Daumen getroffen, nicht mit der Maus. */
.vorboten-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; cursor: pointer;
  font-family: inherit; font-size: 0.95rem; font-weight: 700;
  color: var(--purple-dark); background: none; border: none; padding: 2px 0;
}
.vorboten-pfeil { font-size: 0.8rem; color: var(--purple-mid); transition: transform 0.18s ease; }
.vorboten-toggle.offen .vorboten-pfeil { transform: rotate(180deg); }
/* Die Zielgruppe ist bewegungsempfindlich: Ohne Animation springt der Pfeil
   einfach um, die Richtung stimmt trotzdem. */
@media (prefers-reduced-motion: reduce) {
  .vorboten-pfeil { transition: none; }
}
.vorboten-inhalt { margin-top: 10px; }
.vorboten-text {
  width: 100%; margin-top: 10px; font-family: inherit; font-size: 0.86rem;
  color: var(--gray-text); background: var(--white);
  padding: 9px 11px; border: 1.5px solid var(--purple-light); border-radius: 10px;
}
.vorboten-text:focus { outline: none; border-color: var(--purple-mid); }
.vorboten-hinweis {
  font-size: 0.74rem; line-height: 1.5; color: var(--text-muted); margin-top: 9px;
}
/* In der Auswertung: eigene Zeile auf der Attackenkarte, eigener Kasten in
   den Mustern. Beides abgesetzt von den Belastungsfaktoren. */
.attack-vorboten { margin-top: 6px; }
.vorboten-muster-note {
  font-size: 0.73rem; line-height: 1.5; color: var(--text-muted); margin-top: 9px;
}

/* Die Gegenzahl unter der Prozentangabe: kleiner und ruhiger, sie ist der
   Vergleichswert und nicht die Hauptzahl. */
.bar-sonst {
  font-size: 0.66rem; font-weight: 600; color: var(--text-muted);
  line-height: 1.2; margin-top: 1px; white-space: nowrap;
}

/* Der Hinweis, wenn im gewählten Zeitraum nichts hervorgehoben werden kann.
   Abgesetzt, damit er nicht wie Teil der Erklärung darüber wirkt. */
.pattern-legend-hinweis {
  background: var(--gray-light); border-radius: 9px;
  padding: 9px 11px; margin-top: 8px;
}

/* Eigener Zeitraum: zwei Datumsfelder unter der Knopfreihe. Am Handy dürfen
   sie umbrechen, zwei Datumsfelder nebeneinander sind dort eng. */
.zeitraum-felder {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 14px; font-size: 0.84rem; color: var(--text-muted);
}
.zeitraum-felder input[type=date] {
  font-family: inherit; font-size: 0.86rem; color: var(--gray-text);
  padding: 7px 9px; border: 1.5px solid var(--purple-light); border-radius: 9px;
  background: var(--white); flex: 1 1 130px; min-width: 0;
}
.zeitraum-felder input[type=date]:focus { outline: none; border-color: var(--purple-mid); }

/* ══════════ KLAPPBARE KARTEN IN DER AUSWERTUNG ══════════
   Der Kopf ist der ganze Knopf, nicht nur ein Pfeil daneben: Er wird mit
   dem Daumen getroffen. */
.karte-kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; cursor: pointer;
  background: none; border: none; padding: 0; font-family: inherit;
}
.karte-kopf .card-title { margin-bottom: 0; }
.karte-pfeil { font-size: 0.85rem; color: var(--purple-mid); transition: transform 0.18s ease; flex-shrink: 0; }
.klappbar.zu .karte-pfeil { transform: rotate(-90deg); }
/* Bewegungsempfindliche Zielgruppe: ohne Animation springt der Pfeil um,
   die Richtung stimmt trotzdem. */
@media (prefers-reduced-motion: reduce) {
  .karte-pfeil { transition: none; }
}
.karte-inhalt { margin-top: 12px; }
.klappbar.zu { padding-bottom: 14px; }
/* Die vier zusammengelegten Wertegruppen in einer Karte. */
.werte-block + .werte-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--gray-light); }
.werte-titel {
  font-size: 0.84rem; font-weight: 700; color: var(--purple-dark); margin-bottom: 9px;
}
