  :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;
    --radius:       14px;
    --shadow:       0 4px 20px rgba(58,53,88,0.10);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--lavender);
    min-height: 100vh; color: var(--gray-text); padding: 16px;
  }
  .app-header {
    text-align: center; padding: 32px 24px 24px; margin-bottom: 20px;
    background: var(--lavender);
    border-radius: 20px;
    max-width: 680px; margin-left: auto; margin-right: auto;
    box-shadow: 0 4px 20px rgba(185,120,140,0.13);
  }
  .app-header .brand-title {
    font-family: 'Fredoka', 'Segoe UI', system-ui, sans-serif;
    /* min(): bei sehr großer Schrift deckelt 11vw den Namen, damit er auf
       schmalen Handys nicht über den Rand läuft. */
    font-size: min(2.6rem, 11vw); font-weight: 700; letter-spacing: 0.5px;
    line-height: 1.1; margin-bottom: 6px;
  }
  .app-header .brand-title .migra { color: var(--purple-mid); }
  .app-header .brand-title .motion { color: var(--teal-mid); }
  .app-header p  { margin-top: 8px; font-size: 0.9rem; color: var(--purple-mid); opacity: 0.85; }

  /* NAV */
  .nav { display: flex; justify-content: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
  .nav button, .nav a {
    padding: 9px 16px; border: none; border-radius: 50px; font-size: 0.85rem;
    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.1);
    text-decoration: none; display: inline-block;
  }
  .nav button.active { background: var(--purple-mid); color: var(--white); }
  .nav button:hover:not(.active), .nav a:hover { background: var(--lavender); }

  .view { display: none; }
  .view.active { display: block; }

  /* CARD */
  .card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
    max-width: 680px; margin-left: auto; margin-right: auto;
  }

  /* MONTH NAV */
  .month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
  .month-nav h2 { font-size: 1.1rem; color: var(--purple-dark); font-weight: 700; }
  .month-nav button {
    width: 36px; height: 36px; border-radius: 50%; border: none;
    background: var(--lavender); color: var(--purple-dark); font-size: 1.1rem;
    cursor: pointer; transition: background 0.2s;
    display: flex; align-items: center; justify-content: center;
  }
  .month-nav button:hover { background: var(--purple-light); color: var(--white); }

  /* CALENDAR */
  .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
  .cal-day-name {
    text-align: center; font-size: 0.72rem; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase; padding: 4px 0 8px; letter-spacing: 0.5px;
  }
  .cal-day {
    aspect-ratio: 1; min-height: 44px; border-radius: 10px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; cursor: pointer;
    font-size: 0.82rem; font-weight: 600; transition: all 0.18s;
    position: relative; border: 2px solid transparent;
    background: var(--gray-light); color: var(--gray-text); user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .cal-day:hover { border-color: var(--purple-light); transform: scale(1.05); }
  .cal-day.empty { background: transparent; cursor: default; }
  .cal-day.empty:hover { border-color: transparent; transform: none; }
  .cal-day.today { border-color: var(--purple-mid) !important; }
  .cal-day .pain-badge { font-size: 0.62rem; font-weight: 700; margin-top: 2px; opacity: 0.85; }
  .cal-day .med-only-badge { font-size: 0.68rem; margin-top: 2px; opacity: 0.85; }
  .cal-day .inj-badge { position: absolute; top: 2px; right: 3px; font-size: 0.65rem; }
  .cal-day .period-badge { position: absolute; top: 2px; left: 3px; font-size: 0.65rem; }
  .cal-day .note-badge { position: absolute; bottom: 2px; right: 3px; font-size: 0.6rem; opacity: 0.9; }

  .dauer-offen {
    display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
    margin-top: 16px; padding: 12px 14px; border-radius: 12px;
    background: var(--teal); border-left: 4px solid var(--teal-mid);
    font-size: 0.86rem; line-height: 1.5; color: var(--purple-dark);
  }
  .dauer-offen .do-icon { flex-shrink: 0; font-size: 1rem; }
  .dauer-offen .do-mehr { opacity: 0.8; }

  .notiz-liste {
    margin-top: 16px; padding: 14px 16px; border-radius: 12px;
    background: var(--lavender-soft, #fdf5f7); border: 1px solid var(--lavender, #f4e2e7);
  }
  .notiz-liste-titel {
    font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--purple-mid); margin-bottom: 8px;
  }
  .notiz-zeile { display: flex; gap: 10px; padding: 5px 0; font-size: 0.9rem; line-height: 1.45; }
  .notiz-zeile + .notiz-zeile { border-top: 1px solid var(--lavender, #f4e2e7); }
  .notiz-datum { flex-shrink: 0; font-weight: 700; color: var(--purple-mid); min-width: 5.4em; }
  .notiz-text { color: var(--gray-text); overflow-wrap: anywhere; }

  .legend {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px;
    padding-top: 14px; border-top: 1px solid var(--lavender); justify-content: center;
  }
  .legend-item { display: flex; align-items: center; gap: 5px; font-size: 0.75rem; color: var(--gray-text); }
  .legend-dot { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }

  /* ONBOARDING */
  .onboarding-overlay {
    display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 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: 0 8px 40px rgba(58,53,88,0.18);
    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-light);
    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; }

  /* MODAL */
  .modal-overlay {
    display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(74,45,107,0.35); z-index: 100;
    align-items: center; justify-content: center; padding: 16px;
    backdrop-filter: blur(4px);
  }
  .modal-overlay.open { display: flex; }
  .modal {
    background: var(--white); border-radius: var(--radius);
    box-shadow: 0 8px 40px rgba(74,45,107,0.25);
    padding: 24px; width: 100%; max-width: 460px;
    max-height: 90vh; overflow-y: auto; animation: slideUp 0.25s ease;
  }
  @keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
  .modal-header h3 { color: var(--purple-dark); font-size: 1.05rem; 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.2s;
  }
  .modal-close:hover { background: var(--purple-light); color: var(--white); }

  .form-section { margin-bottom: 20px; }
  .form-label {
    font-size: 0.8rem; font-weight: 700; color: var(--purple-dark);
    margin-bottom: 10px; display: block; text-transform: uppercase; letter-spacing: 0.5px;
  }

  /* PAIN SLIDER */
  .pain-slider-wrap { display: flex; align-items: center; gap: 12px; }
  .pain-slider-wrap input[type=range] {
    flex: 1; -webkit-appearance: none; height: 6px; border-radius: 3px;
    background: linear-gradient(to right, #a5d6a7, #fff176, #ffcc80, #ef9a9a, #c62828); outline: none;
  }
  .pain-slider-wrap input[type=range]:focus-visible { outline: 2px solid var(--purple-dark); outline-offset: 3px; }
  .cal-day:focus-visible, .ob-cycle-opt:focus-visible, [role="button"]:focus-visible {
    outline: 2px solid var(--purple-dark); outline-offset: 2px;
  }
  .pain-slider-wrap input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
    background: var(--purple-mid); border: 3px solid var(--white);
    box-shadow: 0 2px 6px rgba(74,45,107,0.3); cursor: pointer;
  }
  .pain-value {
    min-width: 36px; text-align: center; font-size: 1.2rem; font-weight: 800;
    color: var(--purple-dark); background: var(--lavender); border-radius: 8px; padding: 4px 8px;
  }
  .intensity-row { display: flex; gap: 3px; margin-top: 8px; }
  .intensity-bar {
    flex: 1; height: 18px; border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.55rem; font-weight: 700; color: #000;
  }

  /* CHECKS */
  .check-grid { display: flex; flex-wrap: wrap; gap: 7px; }
  .check-item { display: none; }
  .check-label {
    display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px;
    border-radius: 50px; background: var(--gray-light); font-size: 0.82rem;
    cursor: pointer; transition: all 0.18s; border: 2px solid transparent;
    color: var(--gray-text); font-weight: 500;
  }
  .check-label:hover { border-color: var(--purple-light); }
  .check-item:checked + .check-label {
    background: var(--lavender); border-color: var(--purple-mid);
    color: var(--purple-dark); font-weight: 700;
  }

  /* NO PAIN */
  .no-pain-toggle {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    background: var(--teal); border-radius: 10px; cursor: pointer; margin-bottom: 14px;
    border: 2px solid transparent;
  }
  .no-pain-toggle input { width: 18px; height: 18px; accent-color: var(--teal-mid); cursor: pointer; }
  .no-pain-toggle label { font-size: 0.88rem; font-weight: 600; color: var(--teal-mid); cursor: pointer; }
  .pain-section.hidden { opacity: 0.3; pointer-events: none; }

  /* INJECTION IN MODAL */
  .inj-toggle {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    background: var(--teal); border-radius: 10px; cursor: pointer; border: 2px solid transparent; transition: border-color 0.2s;
  }
  .inj-toggle.checked { border-color: var(--teal-mid); }
  .inj-toggle input { width: 18px; height: 18px; accent-color: var(--teal-mid); cursor: pointer; flex-shrink: 0; }
  .inj-toggle label { font-size: 0.9rem; font-weight: 600; color: var(--teal-mid); cursor: pointer; }
  .inj-details { background: var(--teal); border-radius: 10px; padding: 12px 14px; margin-top: 8px; display: none; }
  .inj-details.visible { display: block; }
  .inj-med-select, .inj-note-input {
    width: 100%; padding: 8px 12px; border: 2px solid var(--mint); border-radius: 8px;
    font-size: 0.85rem; color: var(--gray-text); background: var(--white); font-family: inherit;
    outline: none; margin-top: 8px;
  }
  .inj-med-select:focus, .inj-note-input:focus { border-color: var(--teal-mid); }

  /* TEXT INPUT */
  .text-input {
    width: 100%; padding: 10px 14px; border: 2px solid var(--lavender);
    border-radius: 10px; font-size: 0.88rem; color: var(--gray-text);
    background: var(--lavender-soft); outline: none; font-family: inherit;
    resize: vertical; min-height: 60px; transition: border-color 0.2s;
  }
  .text-input:focus { border-color: var(--purple-mid); background: var(--white); }

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

  /* STATS */
  .stats-grid {
    /* auto-fit statt fester Spalten: bei großer Schrift rutschen die Kacheln
       in eine zweite Zeile, statt zu eng zu werden. 120px, damit "Kopf-
       schmerztage" auf einem Handy nicht mitten im Wort getrennt wird —
       vier Kacheln stehen dort dann als zwei mal zwei. */
    display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px;
    max-width: 680px; margin-left: auto; margin-right: auto;
  }
  .stat-box {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px; text-align: center;
  }
  .stat-box .stat-value { font-size: 2rem; font-weight: 800; color: var(--purple-dark); line-height: 1; }
  /* Silbentrennung, damit lange Wörter wie "Kopfschmerztage" bei großer
     Schrift umbrechen statt aus der Kachel zu laufen. */
  .stat-box .stat-label { font-size: 0.76rem; color: var(--text-muted); margin-top: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; hyphens: auto; overflow-wrap: break-word; }
  .stat-card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; margin-bottom: 12px;
    max-width: 680px; margin-left: auto; margin-right: auto;
  }
  /* Auch die Kartenüberschriften trennen, sonst sprengt ein Wort wie
     "Medikamentenübergebrauch-Check" bei großer Schrift die Karte. */
  .stat-card h3 { font-size: 0.83rem; color: var(--purple-mid); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; margin-bottom: 14px; hyphens: auto; overflow-wrap: break-word; }

  /* PRINT BUTTON */
  .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; max-width: 680px; margin-left: auto; margin-right: auto;
  }
  .btn-print:hover { background: var(--purple-mid); color: var(--white); }
  .print-wrap { max-width: 680px; margin: 0 auto 16px; }

  /* BARS */
  .bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
  /* Breite in em, damit die Beschriftung mit der Schriftgröße mitwächst und
     bei großer Schrift nicht mehr abgeschnitten wird als vorher. */
  .bar-label { font-size: 0.82rem; color: var(--gray-text); width: 10.7em; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bar-track { flex: 1; height: 10px; background: var(--gray-light); border-radius: 5px; overflow: hidden; }
  .bar-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--mint), var(--teal-mid)); }
  .bar-count { font-size: 0.8rem; font-weight: 700; color: var(--teal-mid); min-width: 20px; text-align: right; }

  .empty-state { text-align: center; padding: 30px; color: var(--text-muted); font-size: 0.9rem; }
  .empty-state .emoji { font-size: 2.5rem; display: block; margin-bottom: 10px; }

  /* ── PROPHYLAXE ── */
  .proph-card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 22px; margin-bottom: 16px;
    max-width: 680px; margin-left: auto; margin-right: auto;
  }
  .proph-card h2 { font-size: 1rem; font-weight: 700; color: var(--purple-dark); margin-bottom: 4px; }
  .proph-card .subtitle { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 18px; }
  .proph-card h3 { font-size: 0.83rem; font-weight: 700; color: var(--purple-mid); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }

  .med-group { margin-bottom: 16px; }
  .med-group-title {
    font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
    padding-bottom: 4px; border-bottom: 1px solid var(--lavender);
  }
  .med-check-item { display: none; }
  .med-check-label {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px;
    border-radius: 50px; background: var(--gray-light); font-size: 0.83rem;
    cursor: pointer; transition: all 0.18s; border: 2px solid transparent;
    color: var(--gray-text); font-weight: 500; margin: 3px;
  }
  .med-check-label:hover { border-color: var(--purple-light); }
  .med-check-item:checked + .med-check-label {
    background: var(--teal); border-color: var(--teal-mid);
    color: var(--purple-dark); font-weight: 700;
  }

  .med-interval-row {
    /* Umbruch ist Pflicht: Seit die Zeile neben Intervall und Dosierung auch
       ein Startdatum trägt, passt sie auf einem Handy nicht mehr nebeneinander
       und das letzte Feld liefe sonst rechts aus dem Bild. */
    display: none; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin: 6px 4px 0;
    padding: 8px 12px; background: var(--teal); border-radius: 8px;
    border-left: 3px solid var(--teal-mid);
  }
  .med-interval-row.visible { display: flex; }
  .med-interval-row label { font-size: 0.8rem; color: var(--gray-text); flex-shrink: 0; }
  /* Jede Beschriftung beginnt eine neue Reihe, damit "Intervall", "Dosierung"
     und "Seit" untereinander stehen statt in einer gequetschten Zeile. */
  .med-interval-row label:not(:first-child) { flex-basis: 100%; }
  .med-interval-row input[type="date"] { flex: 1; min-width: 140px; }
  .med-interval-select {
    padding: 5px 10px; border: 1.5px solid var(--mint); border-radius: 7px;
    font-size: 0.82rem; color: var(--gray-text); background: var(--white);
    font-family: inherit; outline: none; flex: 1;
  }
  .med-dose-input {
    padding: 5px 10px; border: 1.5px solid var(--mint); border-radius: 7px;
    font-size: 0.82rem; color: var(--gray-text); background: var(--white);
    font-family: inherit; outline: none; width: 110px;
  }

  .field-row { margin-bottom: 14px; }
  .field-row label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--purple-dark); margin-bottom: 5px; }
  .field-input, .field-select {
    width: 100%; padding: 9px 13px; border: 2px solid var(--lavender);
    border-radius: 9px; font-size: 0.88rem; color: var(--gray-text);
    background: var(--lavender-soft); font-family: inherit; outline: none; transition: border-color 0.2s;
  }
  .field-input:focus, .field-select:focus { border-color: var(--purple-mid); background: var(--white); }
  .field-textarea {
    width: 100%; padding: 9px 13px; border: 2px solid var(--lavender);
    border-radius: 9px; font-size: 0.88rem; color: var(--gray-text);
    background: var(--lavender-soft); font-family: inherit; outline: none;
    resize: vertical; min-height: 70px; transition: border-color 0.2s;
  }
  .field-textarea:focus { border-color: var(--purple-mid); background: var(--white); }

  .btn-save-proph {
    padding: 11px 24px; border: none; border-radius: 9px;
    background: var(--teal-mid); color: var(--white); font-size: 0.9rem;
    font-weight: 700; cursor: pointer; transition: background 0.2s; font-family: inherit;
  }
  .btn-save-proph:hover { background: var(--purple-dark); }

  .hormone-hint {
    font-size: 0.78rem; color: var(--purple-mid); background: var(--lavender-soft);
    border-radius: 8px; padding: 7px 11px; margin-top: 10px; line-height: 1.4;
  }
  .meds-validation {
    font-size: 0.78rem; color: #b71c1c; background: #ffebee;
    border-radius: 8px; padding: 7px 11px; margin-top: 10px; line-height: 1.4;
  }

  /* PROPHYLAXE BANNER */
  .proph-banner {
    background: linear-gradient(135deg, var(--lavender), var(--teal));
    border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px;
    max-width: 680px; margin-left: auto; margin-right: auto;
    border-left: 4px solid var(--teal-mid);
  }
  .proph-banner .banner-label { font-size: 0.75rem; font-weight: 700; color: var(--teal-mid); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
  .med-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
  .med-tag {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px;
    border-radius: 50px; background: var(--teal-mid); color: var(--white);
    font-size: 0.78rem; font-weight: 600;
  }
  .med-tag-seit {
    font-size: 0.72rem; font-weight: 400; opacity: 0.85;
    padding-left: 6px; margin-left: 2px; border-left: 1px solid rgba(255,255,255,0.45);
  }
  .proph-banner .banner-days { font-size: 0.82rem; color: var(--teal-mid); margin-top: 6px; font-weight: 600; }

  /* INJECTION TIMELINE */
  .inj-timeline { margin-top: 4px; }
  .inj-entry {
    display: flex; align-items: flex-start; gap: 12px; padding: 10px 0;
    border-bottom: 1px solid var(--lavender);
  }
  .inj-entry:last-child { border-bottom: none; }
  .inj-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 2px; }
  .inj-info { flex: 1; }
  .inj-info .inj-date { font-size: 0.85rem; font-weight: 700; color: var(--purple-dark); }
  .inj-info .inj-med-name { font-size: 0.8rem; color: var(--teal-mid); margin-top: 2px; }
  .inj-info .inj-note { font-size: 0.78rem; color: var(--gray-text); margin-top: 2px; font-style: italic; }
  .inj-ago { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

  .next-inj-box {
    background: linear-gradient(135deg, var(--teal), var(--lavender));
    border-radius: 10px; padding: 12px 14px; margin-top: 10px;
    border-left: 4px solid var(--teal-mid); display: flex; align-items: center; gap: 10px;
  }
  .next-inj-box .nib-icon { font-size: 1.4rem; }
  .next-inj-box .nib-text { font-size: 0.85rem; color: var(--teal-mid); font-weight: 700; }
  .next-inj-box .nib-date { font-size: 0.8rem; color: var(--gray-text); margin-top: 2px; }
  .next-inj-box .nib-med  { font-size: 0.75rem; color: var(--teal-mid); margin-top: 1px; }

  /* MOH CHECK */
  /* MOH mini widget below calendar */
  #cal-moh-wrap { margin-top: 10px; }
  .cal-moh-mini {
    background: var(--white);
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 8px;
    border: 1px solid var(--purple-light);
  }
  /* flex-wrap: bei großer Schrift rutscht die Zahl unter die Beschriftung,
     statt sich mit ihr zu überlappen. */
  .cal-moh-mini .moh-header { display: flex; flex-wrap: wrap; gap: 2px 10px; justify-content: space-between; align-items: center; margin-bottom: 5px; }
  .cal-moh-mini .moh-label { font-size: 0.8rem; font-weight: 600; color: var(--purple-dark); min-width: 0; hyphens: auto; overflow-wrap: break-word; }
  .cal-moh-mini .moh-count { font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
  .cal-moh-mini .moh-track { height: 8px; background: var(--gray-light); border-radius: 10px; overflow: hidden; position: relative; }
  .cal-moh-mini .moh-fill { height: 100%; border-radius: 10px; transition: width 0.4s ease; }
  .cal-moh-mini .moh-fill.green  { background: #81c784; }
  .cal-moh-mini .moh-fill.yellow { background: #ffb300; }
  .cal-moh-mini .moh-fill.red    { background: #e53935; }
  .cal-moh-mini .moh-sub { font-size: 0.72rem; color: var(--purple-mid); margin-top: 3px; }
  .cal-moh-mini .moh-warning {
    font-size: 0.78rem; border-radius: 8px; padding: 7px 10px; margin-top: 7px; line-height: 1.4;
  }
  .cal-moh-mini .moh-warning.ok     { background: #e8f5e9; color: #2e7d32; border-left: 3px solid #81c784; }
  .cal-moh-mini .moh-warning.watch  { background: #fff8e1; color: #e65100; border-left: 3px solid #ffb300; }
  .cal-moh-mini .moh-warning.danger { background: #ffebee; color: #b71c1c; border-left: 3px solid #e53935; }

  .moh-item { margin-bottom: 14px; }
  .moh-item:last-child { margin-bottom: 0; }
  .moh-header { display: flex; flex-wrap: wrap; gap: 2px 10px; justify-content: space-between; align-items: center; margin-bottom: 5px; }
  .moh-label { font-size: 0.84rem; font-weight: 600; color: var(--purple-dark); min-width: 0; hyphens: auto; overflow-wrap: break-word; }
  .moh-count { font-size: 0.84rem; font-weight: 700; white-space: nowrap; }
  .moh-track { height: 10px; background: var(--gray-light); border-radius: 10px; overflow: hidden; position: relative; }
  .moh-fill { height: 100%; border-radius: 10px; transition: width 0.4s ease; }
  .moh-fill.green  { background: #81c784; }
  .moh-fill.yellow { background: #ffb300; }
  .moh-fill.red    { background: #e53935; }
  .moh-limit-line { position: absolute; top: 0; height: 100%; width: 2px; background: rgba(0,0,0,0.2); }
  .moh-sub { font-size: 0.75rem; color: var(--purple-mid); margin-top: 3px; }
  .moh-warning {
    margin-top: 12px; padding: 12px 14px; border-radius: 10px;
    font-size: 0.83rem; line-height: 1.55;
  }
  .moh-warning.ok     { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #81c784; }
  .moh-warning.watch  { background: #fff8e1; color: #e65100; border-left: 4px solid #ffb300; }
  .moh-warning.danger { background: #ffebee; color: #b71c1c; border-left: 4px solid #e53935; }
  .moh-empty { font-size: 0.85rem; color: var(--text-muted); text-align: center; padding: 12px 0; }

  @media (max-width: 420px) {
    .stats-grid { gap: 6px; }
    .stat-box { padding: 12px 6px; }
    .stat-box .stat-value { font-size: 1.4rem; }
    .stat-box .stat-label { font-size: 0.62rem; letter-spacing: 0.2px; }
    .cal-day { font-size: 0.75rem; }
    .modal { padding: 18px; }
    body { padding: 10px; }
    .nav button { padding: 8px 11px; font-size: 0.8rem; }
  }

  /* ── Medikamentenzeilen: Name und Wirkung je Präparat ───────────────
     Eine Zeile pro angehaktem Medikament. Zwei Medikamente an einem Tag sind
     der Normalfall, deshalb müssen die Zeilen klar voneinander getrennt sein. */
  .med-detail-row {
    background: var(--gray-light, var(--gray-light));
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
  }
  .med-detail-row:last-child { margin-bottom: 0; }
  .med-detail-name {
    font-size: 0.9rem; font-weight: 700; color: var(--purple-dark, var(--purple-dark));
    margin-bottom: 8px;
  }
  .med-name-input {
    width: 100%; font-family: inherit; font-size: 0.88rem; color: var(--gray-text, var(--gray-text));
    padding: 8px 11px; border: 1px solid var(--purple-light, var(--purple-light)); border-radius: 8px;
    background: var(--white); margin-bottom: 9px;
  }
  .med-name-input:focus { outline: none; border-color: var(--purple-mid, var(--purple-mid)); }

  /* Attacken mit Uhrzeit. Eine Zeile je Attacke, an einem Clustertag können
     das bis zu acht sein, deshalb kompakter als die Medikamentenzeilen. */
  /* ══════════ DIE AURA IM EINZELNEN ══════════
     Ein eigener, leicht abgesetzter Kasten: Er klappt auf und zu, und ohne
     Rahmen würde man beim Auftauchen nicht sehen, wo er anfängt und aufhört.
     Durchgehend über Farbvariablen, damit der dunkle Modus von selbst
     stimmt. */
  .aura-section {
    background: var(--lavender-soft); border-radius: 12px;
    padding: 14px 14px 12px;
  }
  .aura-intro {
    font-size: 0.78rem; line-height: 1.55; color: var(--text-muted);
    margin: 2px 0 10px;
  }
  .aura-erinnerung {
    font-size: 0.76rem; line-height: 1.5; color: var(--text-muted);
    background: var(--white); border-radius: 8px; padding: 8px 10px;
    margin-bottom: 12px; font-style: italic;
  }
  .aura-feld { margin-bottom: 14px; }
  .aura-feld:last-of-type { margin-bottom: 8px; }
  .aura-label {
    display: block; font-size: 0.82rem; font-weight: 700;
    color: var(--purple-dark); margin-bottom: 7px;
  }
  .aura-feld .check-grid { margin-bottom: 6px; }
  .aura-unterlabel {
    display: block; font-size: 0.74rem; font-weight: 600;
    color: var(--text-muted); margin: 2px 0 5px;
  }
  .aura-text { margin-top: 2px; min-height: unset; resize: none; }
  .aura-zeiten {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 0.84rem; color: var(--gray-text);
  }
  .aura-zeiten input[type=time], .aura-min {
    font-family: inherit; font-size: 0.86rem; color: var(--gray-text);
    padding: 6px 8px; border: 1px solid var(--purple-light); border-radius: 8px;
    background: var(--white);
  }
  .aura-min { width: 74px; }
  .aura-dauer { font-weight: 700; color: var(--teal-mid); white-space: nowrap; }
  .aura-hinweis {
    font-size: 0.76rem; line-height: 1.5; margin-top: 6px;
    color: var(--text-muted);
  }
  /* Anjas eigener Hinweis aus dem PDF, wörtlich. Er steht dort, wo gerade
     jemand eine Sehstörung notiert, und nicht irgendwo in der Anleitung. */
  .aura-steuer {
    font-size: 0.78rem; line-height: 1.55; color: #7a5300;
    background: #fff3dc; border-radius: 10px; padding: 10px 12px;
    margin-top: 12px;
  }
  :root[data-theme="dark"] .aura-steuer { background: #3a3220; color: #f0d9a0; }

  .attack-times-toggle {
    margin-top: 8px; font-family: inherit; font-size: 0.82rem;
    padding: 7px 12px; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--purple-light, var(--purple-light));
    background: var(--white); color: var(--purple-dark, var(--purple-dark));
  }
  .attack-time-row {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    background: var(--gray-light, var(--gray-light));
    border-radius: 10px; padding: 9px 11px; margin-bottom: 8px;
  }
  .attack-time-row input[type=time] {
    font-family: inherit; font-size: 0.88rem; color: var(--gray-text, var(--gray-text));
    padding: 7px 9px; border: 1px solid var(--purple-light, var(--purple-light));
    border-radius: 8px; background: var(--white);
  }
  .attack-time-nr { font-size: 0.82rem; font-weight: 700; color: var(--purple-dark, var(--purple-dark)); min-width: 18px; }
  .attack-time-bis { font-size: 0.82rem; color: var(--text-muted, var(--text-muted)); }
  .attack-time-dauer { font-size: 0.82rem; font-weight: 700; color: var(--teal-mid, var(--teal-mid)); margin-left: auto; }
  .attack-time-del {
    border: none; background: none; cursor: pointer; font-size: 0.95rem; padding: 2px 4px;
  }
  .attack-times-add {
    font-family: inherit; font-size: 0.82rem; padding: 7px 12px; border-radius: 8px; cursor: pointer;
    border: 1px dashed var(--purple-light, var(--purple-light));
    background: var(--white); color: var(--purple-dark, var(--purple-dark));
  }
  .attack-times-hint {
    font-size: 0.78rem; line-height: 1.5; margin-top: 9px;
    color: var(--text-muted, var(--text-muted));
  }
  .attack-times-warnung { color: #b26a00; font-weight: 700; }

  /* Zusammenfassung der Attacken mit Uhrzeit, über den Dauerstufen. */
  .attacken-summe {
    background: var(--gray-light, var(--gray-light));
    border-radius: 10px; padding: 11px 13px; margin-bottom: 12px;
    font-size: 0.84rem; line-height: 1.6; color: var(--gray-text, var(--gray-text));
  }

  /* Wirkung je Präparat in der Auswertung */
  .med-wirkung-row { padding: 9px 0; border-bottom: 1px solid var(--purple-light, #e6e4ee); }
  .med-wirkung-row:last-child { border-bottom: none; }
  .med-wirkung-name { font-size: 0.9rem; font-weight: 700; color: var(--purple-dark, var(--purple-dark)); margin-bottom: 4px; }
  .med-wirkung-werte { font-size: 0.84rem; color: var(--gray-text, var(--gray-text)); line-height: 1.9; }

  /* ── Auslassversuch bei der Prophylaxe ───────────────────────────── */
  .auslass-eintrag {
    background: var(--gray-light, var(--gray-light)); border-radius: 12px;
    padding: 14px 16px; margin-bottom: 12px;
  }
  .av-kopf { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
  .av-med { font-size: 0.95rem; font-weight: 700; color: var(--purple-dark, var(--purple-dark)); }
  .av-del { background: none; border: none; cursor: pointer; font-size: 1rem; opacity: 0.6; padding: 2px 4px; }
  .av-del:hover { opacity: 1; }
  .av-daten { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
  .av-daten label { font-size: 0.76rem; color: var(--text-muted, var(--text-muted)); display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 130px; }
  .av-daten input {
    font-family: inherit; font-size: 0.86rem; color: var(--gray-text, var(--gray-text));
    padding: 7px 9px; border: 1px solid var(--purple-light, var(--purple-light)); border-radius: 8px; background: var(--white);
  }
  .auslass-vergleich { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
  /* var(--white) statt #fff: Im Dunkelmodus wird die Textfarbe hell, eine fest
     weiße Fläche darunter macht die Zahl unlesbar. Die Eingabefelder daneben
     nimmt sich das Theme schon selbst vor, diese Kästen nicht. */
  .av-spalte { flex: 1; background: var(--white); border-radius: 10px; padding: 10px; text-align: center; }
  .av-label { font-size: 0.7rem; color: var(--text-muted, var(--text-muted)); text-transform: uppercase; letter-spacing: 0.5px; }
  .av-wert { font-size: 1.5rem; font-weight: 800; color: var(--purple-dark, var(--purple-dark)); line-height: 1.15; }
  .av-unit { font-size: 0.72rem; color: var(--text-muted, var(--text-muted)); line-height: 1.3; }
  .av-leerwert { color: var(--text-muted, var(--text-muted)); font-weight: 600; }
  .av-hinweis { font-style: italic; }
  .av-pfeil { color: var(--purple-mid, var(--purple-mid)); font-size: 1.1rem; flex-shrink: 0; }
  .av-zeitraum { font-size: 0.74rem; color: var(--text-muted, var(--text-muted)); line-height: 1.45; margin-bottom: 10px; }
  .av-erg-zeile { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
  /* Die Ergebnisknöpfe sind Knöpfe, keine Eingabefelder: Das Theme greift bei
     ihnen nicht von selbst, und mit fest weißem Hintergrund standen sie im
     Dunkelmodus hellgrau auf weiß da, also unlesbar. */
  .av-erg-btn {
    font-family: inherit; font-size: 0.8rem; padding: 7px 12px; border-radius: 8px;
    border: 1px solid var(--purple-light, var(--purple-light)); background: var(--white);
    color: var(--gray-text, var(--gray-text)); cursor: pointer;
  }
  .av-erg-btn.aktiv { background: var(--lavender-soft, var(--lavender-soft)); border-color: var(--purple-mid, var(--purple-mid)); font-weight: 700; color: var(--purple-dark, var(--purple-dark)); }
  .av-notiz {
    width: 100%; font-family: inherit; font-size: 0.84rem; color: var(--gray-text, var(--gray-text));
    padding: 8px 10px; border: 1px solid var(--purple-light, var(--purple-light)); border-radius: 8px; background: var(--white);
  }
  .av-leer { font-size: 0.84rem; color: var(--text-muted, var(--text-muted)); line-height: 1.5; }
  .av-neu-zeile { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
  .av-neu-zeile select, .av-neu-zeile input {
    font-family: inherit; font-size: 0.86rem; color: var(--gray-text, var(--gray-text));
    padding: 8px 10px; border: 1px solid var(--purple-light, var(--purple-light)); border-radius: 8px; background: var(--white); flex: 1; min-width: 140px;
  }
