/* Voice2Notes-Webapp, Richtung A „Klar“ (Redesign 2026-10-08/13): fühlt sich an wie eine eingebaute
   iPhone-/Mac-App. Graue Gruppen-Hintergründe, weiße Karten, Systemschrift, Linien-Symbole statt Emojis;
   Navy für Text und Hauptknöpfe, Messing nur als Akzent (Stimmgerät-Nadel, Fokus, Hinweise).
   Farben und Maße nur über die Variablen unten. */

:root {
  /* Marke */
  --navy: #0E1A33;          /* Text, Hauptknöpfe, gewählte Einträge */
  --navy-hover: #1E2D4D;
  --brass: #E8A33D;         /* nur Akzent */
  --brass-soft: #FBEBD0;
  --brass-ink: #8A5A0B;     /* Text auf hellem Messing (Kontrast ≥ 4,5:1) */
  /* Flächen */
  --bg: #F2F2F7;            /* Gruppen-Hintergrund (Handy, Aufnehmen) */
  --surface: #FFFFFF;       /* Karten, Listen, Notenbild */
  --surface-2: #F5F5F7;     /* Seitenleiste, Bearbeitungsfeld */
  --bar: #F6F6F8;           /* Kopfzeile am Arbeitsplatz */
  --fill: #E3E3E8;          /* runde Knöpfe, Suchfeld auf Grau */
  --fill-2: #EEEEF2;        /* Spur von Umschaltern und − | + */
  --sep: #E5E5EA;           /* Trennlinien in Listen */
  --line: #D8D8DD;          /* Rahmen von Feldern und Knöpfen */
  --white: #FFFFFF;
  --paper: #FFFFFF;         /* Notenbild: immer weißes Notenblatt (auch im Dark Mode) */
  --paper-line: #ECECF0;
  --control: #FFFFFF;       /* Felder, Knöpfe mit Rahmen, roter Punkt */
  --seg-on: #FFFFFF;        /* gewähltes Segment eines Umschalters */
  --track: #E9E9ED;         /* Spur von Umschaltern in der Werkzeugleiste und Seitenleiste */
  --fill-hover: #D9D9DF;
  --chip: #EEF0F5;          /* Stichwort-Chips */
  --border-soft: #E2E2E6;   /* Kopfzeile, Seitenleiste */
  --grabber: #C7C7CC;       /* Griff oben an Blättern */
  --header-glass: rgba(242, 242, 247, 0.92);
  --tabs-glass: rgba(249, 249, 251, 0.94);
  --tb-hover: rgba(255, 255, 255, 0.6);
  /* Akzent: Navy-Flächen (Hauptknöpfe, Auswahl, Symbol-Kacheln) und Text darauf */
  --accent: #0E1A33;
  --accent-hover: #1E2D4D;
  --on-accent: #FFFFFF;
  --link: #1E2D4D;
  --on-accent-danger: #FFB4AE;   /* „Löschen“ auf gewähltem Eintrag */
  --ring: rgba(14, 26, 51, 0.06); /* feiner Rand um Menüs und Hilfefelder */
  /* Text */
  --heading: #0E1A33;
  --text: #0E1A33;
  --text-muted: #6E6E73;
  --text-faint: #8E8E93;
  --chevron: #C4C4C9;
  /* Zustände */
  --record: #D7322B;        /* nur Aufnahmepunkt und Stopp-Quadrat */
  --error: #C42B22;
  --error-soft: #FDECEA;
  --ok: #2E7D4F;            /* Stimmgerät: „passt“ */
  --ok-soft: #D6EBDD;       /* Stimmgerät: grüner Bereich ±15 Cent */
  /* Maße */
  --radius: 14px;
  --radius-small: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --text-size: 17px;
  --column: 760px;
  --gap: 20px;
  --tap: 52px;              /* Mindesthöhe von Knöpfen und Feldern (mobil) */
  --tap-desk: 36px;         /* Knöpfe am Arbeitsplatz (Maus) */
  --sidebar: 260px;         /* Seitenleiste am Arbeitsplatz */
  --tabs: 58px;             /* Höhe der Handy-Reiter (ohne Sicherheitsabstand unten) */
  --shadow-seg: 0 1px 3px rgba(14, 26, 51, 0.14);
  --shadow-pop: 0 10px 30px rgba(14, 26, 51, 0.18);
  color-scheme: light dark;
}

/* Dark Mode: „Automatisch“ folgt der Einstellung des Geräts (iOS, macOS, Windows), „Hell“/„Dunkel“ aus dem
   Kontomenü setzen data-theme auf <html> (theme.js). Nur die Tokens wechseln – die Liste steht deshalb zweimal
   (automatisch und erzwungen), bitte beide gleich halten. Navy bleibt Markenfarbe auf Messing und im weißen
   Notenbild. Werte angelehnt an die Apple-Systemfarben. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brass-soft: #3A2C12;
    --brass-ink: #F2C27A;
    --bg: #000000;
    --surface: #1C1C1E;
    --surface-2: #232325;
    --bar: #1C1C1E;
    --fill: #3A3A3C;
    --fill-2: #2C2C2E;
    --sep: #38383A;
    --line: #48484A;
    --control: #2C2C2E;
    --seg-on: #636366;
    --track: #2C2C2E;
    --fill-hover: #48484A;
    --chip: #2C3550;
    --border-soft: #2C2C2E;
    --grabber: #5A5A5E;
    --header-glass: rgba(0, 0, 0, 0.82);
    --tabs-glass: rgba(22, 22, 24, 0.92);
    --tb-hover: rgba(255, 255, 255, 0.08);
    --accent: #E6EBF5;
    --accent-hover: #FFFFFF;
    --on-accent: #0E1A33;
    --link: #A9BCE0;
    --on-accent-danger: #C42B22;
    --ring: rgba(255, 255, 255, 0.12);
    --heading: #F5F5F7;
    --text: #F5F5F7;
    --text-muted: #98989F;
    --text-faint: #8E8E93;
    --chevron: #5A5A5E;
    --error: #FF6961;
    --error-soft: #3A1A18;
    --ok: #4CD27F;
    --ok-soft: #1E3A28;
    --shadow-seg: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  --brass-soft: #3A2C12;
  --brass-ink: #F2C27A;
  --bg: #000000;
  --surface: #1C1C1E;
  --surface-2: #232325;
  --bar: #1C1C1E;
  --fill: #3A3A3C;
  --fill-2: #2C2C2E;
  --sep: #38383A;
  --line: #48484A;
  --control: #2C2C2E;
  --seg-on: #636366;
  --track: #2C2C2E;
  --fill-hover: #48484A;
  --chip: #2C3550;
  --border-soft: #2C2C2E;
  --grabber: #5A5A5E;
  --header-glass: rgba(0, 0, 0, 0.82);
  --tabs-glass: rgba(22, 22, 24, 0.92);
  --tb-hover: rgba(255, 255, 255, 0.08);
  --accent: #E6EBF5;
  --accent-hover: #FFFFFF;
  --on-accent: #0E1A33;
  --link: #A9BCE0;
  --on-accent-danger: #C42B22;
  --ring: rgba(255, 255, 255, 0.12);
  --heading: #F5F5F7;
  --text: #F5F5F7;
  --text-muted: #98989F;
  --text-faint: #8E8E93;
  --chevron: #5A5A5E;
  --error: #FF6961;
  --error-soft: #3A1A18;
  --ok: #4CD27F;
  --ok-soft: #1E3A28;
  --shadow-seg: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-size);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

/* Linien-Symbole aus dem Sprite in index.html */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
}

.ic .ic-fill, .ic-fill { fill: currentColor; stroke: none; }

/* --- Kopf, Spalte, Fuß (Anmeldeseite) ----------------------------------------------------------- */

.masthead {
  padding: 14px 16px 0;
  text-align: center;
}

.brand {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.brand::after {               /* kleiner Messing-Punkt als Akzent */
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 3px;
  border-radius: 50%;
  background: var(--brass);
}

.page {
  max-width: var(--column);
  margin: 0 auto;
  padding: 28px 16px 40px;
}

.footer {
  max-width: var(--column);
  margin: 0 auto;
  padding: 0 16px 40px;
  color: var(--text-muted);
  font-size: 15px;
}

h1, h2 { color: var(--heading); line-height: 1.2; }
h1 { font-size: 34px; font-weight: 700; margin: 0; letter-spacing: 0.01em; }
h2 { font-size: 22px; font-weight: 700; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; }

/* Großer Titel wie in iOS („Aufnehmen“, „Meine Melodien“) */
.large-title {
  margin: 0;
  color: var(--heading);
  font-size: 34px;
  font-weight: 700;
  line-height: 41px;
  letter-spacing: 0.01em;
  text-transform: none;
}

.subtitle {
  margin: 4px 0 16px;
  color: var(--text-muted);
  font-size: 17px;
}

p { margin: 0 0 14px; }

/* --- Karten und Hinweise ---------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: var(--gap);
}

.notice {
  background: var(--brass-soft);
  border-radius: var(--radius-small);
  padding: 12px 14px;
  margin-bottom: var(--gap);
  color: var(--heading);
  font-size: 15px;
}

.notice p:last-child, .notice ul:last-child { margin-bottom: 0; }
.notice ul { margin: 0; padding-left: 20px; }

.notice-error {
  background: var(--error-soft);
  color: var(--error);
}

.notice-error p { font-weight: 600; }

/* --- Formularfelder ------------------------------------------------------------------------- */

.field { margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.field:last-child { margin-bottom: 0; }

label, .label {
  display: block;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 6px;
}

input[type="text"], input[type="email"], input[type="number"], input[type="password"], input[type="search"], select {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--control);
  color: var(--heading);
  font: inherit;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 2px;
}

input:disabled, select:disabled { opacity: 0.6; }

.range { flex: 1; min-width: 0; height: var(--tap); accent-color: var(--accent); }

.choice { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }

.hint { color: var(--text-muted); font-size: 15px; }

/* --- Knöpfe --------------------------------------------------------------------------------- */

.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 12px 22px;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--fill); color: var(--text); }
.btn-secondary:hover { background: var(--fill-hover); }

.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-large { width: 100%; min-height: 56px; font-size: 17px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }

/* --- Pegel ---------------------------------------------------------------------------------- */

.meter {
  position: relative;
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.meter-fill { display: none; }     /* Wert für Bildschirmleser bleibt in aria-valuenow */

/* Pegelverlauf: Balken in Navy, ganz rechts der neueste; rote Linie = jetzt */
.wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 120px;
  padding: 0 14px;
}

.wave::after {
  content: "";
  flex: none;
  width: 2px;
  height: 96px;
  margin-left: 4px;
  border-radius: 1px;
  background: var(--record);
}

.wave-bar {
  flex: 1;
  height: 4px;
  min-width: 0;
  border-radius: 2px;
  background: var(--line);
  transition: height 0.08s linear;
}

.wave-bar.is-on { background: var(--accent); }
.meter.is-loud .wave-bar.is-on:last-child { background: var(--error); }

@media (prefers-reduced-motion: reduce) { .wave-bar { transition: none; } }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

h2:focus { outline: none; }

audio { width: 100%; margin: 4px 0 0; }

.busy { font-weight: 600; color: var(--heading); }

/* --- Bearbeitungsfeld: Knöpfe ------------------------------------------------------------------ */

.ed-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap-desk);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.ed-btn:hover:not(:disabled) { background: var(--surface-2); }
.ed-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ed-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* --- Editor: Notenbild und Bearbeitungsfeld ---------------------------------------------------- */

.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-small);
}

.editor:focus { outline: none; }
.editor:focus-visible { outline: 3px solid var(--brass); outline-offset: 4px; }

.editor-score {
  align-self: start;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(14, 26, 51, 0.04);
  padding: 14px 10px;
  overflow-x: auto;
  min-height: 80px;
}

.editor-system { position: relative; }
.editor-system svg { display: block; overflow: visible; }
.editor-system svg [data-id] { cursor: pointer; }

.editor-selbox, .editor-cursor {
  position: absolute;
  border-radius: 6px;
  pointer-events: none;
}

.editor-selbox { border: 2px solid var(--navy); background: rgba(14, 26, 51, 0.07); }
.editor-cursor { border: 2px solid var(--brass); background: rgba(232, 163, 61, 0.2); }
/* Mitlaufen beim Abspielen und Auswählen: nicht direkt an den Rand, am Handy nicht hinter die Reiterleiste */
.editor-selbox, .editor-cursor { scroll-margin-block: 24px; }
@media (max-width: 767px) {
  .editor-selbox, .editor-cursor { scroll-margin-bottom: calc(var(--tabs) + env(safe-area-inset-bottom, 0px) + 24px); }
}

/* Bearbeitungsfeld wie ein Mac-Inspektor: hellgrau, kleine Überschriften */
.editor-panel {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 16px 16px 12px;
  align-self: start;
  font-size: 14px;
}

.ed-title { margin: 0 0 4px; color: var(--text-faint); font-size: 12px; font-weight: 600; }
.ed-pitch { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 0 14px; }
.ed-big { color: var(--heading); font-size: 24px; font-weight: 600; }
.ed-sub { color: var(--text-muted); font-size: 14px; }
.ed-group { margin: 0 0 14px; }
.ed-label { color: var(--text-muted); font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.ed-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ed-row > .ed-btn { flex: 1 1 auto; }
.ed-acc { font-size: 20px; line-height: 1; min-width: 0.7em; }

/* Tonwert als Umschalter (Segmente) */
.ed-row:has(> [data-act="dur"]) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--track);
}

.ed-row > [data-act="dur"], .ed-row > [data-act="dot"] { border-color: transparent; background: transparent; }
.ed-row > [data-act="dur"][aria-pressed="true"], .ed-row > [data-act="dot"][aria-pressed="true"] {
  background: var(--seg-on);
  border-color: var(--seg-on);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-seg);
}
.ed-row > [data-act="dot"] { grid-column: 1 / -1; }

.ed-btn kbd, .editor-keys kbd {
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-muted);
}
.ed-btn[aria-pressed="true"] kbd { background: transparent; color: inherit; border-color: currentColor; opacity: 0.7; }
.ed-row > [data-act="dur"][aria-pressed="true"] kbd, .ed-row > [data-act="dot"][aria-pressed="true"] kbd { color: var(--text-muted); border-color: var(--line); }

.ed-status { margin: 0 0 6px; color: var(--heading); }
.ed-status.is-over { color: var(--error); font-weight: 600; }
.ed-status.is-short { color: var(--brass-ink); font-weight: 600; }

.editor-msg { min-height: 1.45em; margin: 0 0 8px; color: var(--error); font-weight: 600; }
.editor-msg:empty { min-height: 0; margin: 0; }

.editor-keys { border-top: 1px solid var(--line); padding-top: 10px; }
.editor-keys summary { cursor: pointer; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.editor-keys dl { margin: 8px 0; font-size: 13px; }
.editor-keys dl div { display: grid; grid-template-columns: 7.5em 1fr; gap: 8px; margin-bottom: 4px; }
.editor-keys dt, .editor-keys dd { margin: 0; }

@media (min-width: 1000px) {
  .editor { grid-template-columns: minmax(0, 1fr) 300px; }
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.summary div {
  background: var(--surface-2);
  border-radius: var(--radius-small);
  padding: 10px 14px;
}

.summary dt { font-size: 15px; color: var(--text-muted); }
.summary dd { margin: 0; color: var(--heading); font-weight: 600; font-size: 19px; }

.save-status { margin: 12px 0 0; font-weight: 500; color: var(--heading); word-break: break-word; }
.save-status.is-error { color: var(--error); }

@media (max-width: 520px) {
  .card { padding: 18px 16px; }
  .actions > * { flex: 1 1 100%; }
}

/* Schalter: Kontrollkästchen als iOS-Schalter */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin: 0;
  color: var(--heading);
  font-size: 17px;
  cursor: pointer;
}

.switch input {
  flex: none;
  position: relative;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 16px;
  background: var(--fill);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.switch input::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }

@media (prefers-reduced-motion: reduce) {
  .switch input, .switch input::after { transition: none; }
}

.editor-readonly { margin-bottom: 0; }

@media (min-width: 1000px) {
  .editor.editor-readonly { grid-template-columns: minmax(0, 1fr); }
}


/* --- Anmeldeseite --------------------------------------------------------------------------- */

.login-page { max-width: 420px; }
.login-logo { display: block; margin: 8px auto 14px; border-radius: 16px; }
.login-page > h1, .login-page > .subtitle, .login-note { text-align: center; }
.login-card { margin-top: 8px; }
.login-card .notice { margin-bottom: 16px; }
.login-card .btn-large { margin-top: 4px; }
.login-note { margin: 16px 0 0; font-size: 13px; color: var(--text-muted); }

/* --- Rechtstexte und Fußlinks ------------------------------------------------------------------ */

/* Nutzungsbedingungen, Datenschutz, Impressum (terms.py): Kopfzeile wie in der App, Text auf einer Karte */
.legal-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--header-glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-soft);
}

.legal-brand { display: flex; align-items: center; gap: 8px; color: var(--heading); font-size: 17px; font-weight: 600; }
.legal-melicus { margin-right: auto; padding-left: 12px; border-left: 1px solid var(--line); font-size: 13px; }

.legal-back {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  background: var(--fill);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.legal-back:hover { background: var(--fill-hover); }

.legal-page { padding-top: 24px; padding-bottom: 16px; }
.legal { padding: 28px 28px 32px; border-radius: var(--radius); background: var(--surface); }
.legal-head { padding-bottom: 18px; border-bottom: 1px solid var(--sep); }
.legal h1 { font-size: 28px; line-height: 34px; }
.legal-meta { margin: 8px 0 0; color: var(--text-muted); font-size: 15px; }

.legal-stand {
  display: inline-block;
  margin: 12px 0 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brass-soft);
  color: var(--brass-ink);
  font-size: 13px;
  font-weight: 600;
}

.legal-section { padding-top: 22px; scroll-margin-top: 52px; }   /* Sprungziel (#widerspruch) unter der Kopfzeile */
.legal h2 { display: block; margin: 0 0 10px; font-size: 19px; line-height: 25px; }
.legal-par { display: inline-block; min-width: 2.2em; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.legal p, .legal li { font-size: 16px; line-height: 1.55; }
.legal p { margin: 0 0 10px; }
.legal a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }

/* Absätze (1), (2) … wie in Vertragstexten */
.legal-abs { margin: 0 0 6px; padding: 0 0 0 2.4em; list-style: none; counter-reset: abs; }
.legal-abs > li { position: relative; margin-bottom: 10px; counter-increment: abs; }
.legal-abs > li::before {
  content: "(" counter(abs) ")";
  position: absolute;
  left: -2.4em;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.legal-abs > li > p:last-child { margin-bottom: 0; }
.legal-abs .legal-list { margin-top: 6px; }
.legal-list { margin: 0 0 10px; padding-left: 1.3em; }
.legal-list li { margin-bottom: 6px; }

.legal-table { margin: 4px 0 8px; border: 1px solid var(--sep); border-radius: var(--radius-small); overflow: hidden; }
.legal table { width: 100%; border-collapse: collapse; }
.legal th {
  padding: 8px 12px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.legal td { padding: 10px 12px; border-top: 1px solid var(--sep); font-size: 15px; line-height: 1.45; vertical-align: top; }
.legal td:first-child { width: 32%; font-weight: 600; }

/* Fußlinks: Rechtstexte, Anmeldeseiten, in der App unter dem Datenschutz-Hinweis */
.legal-foot { padding: 4px 16px calc(28px + env(safe-area-inset-bottom)); }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 18px; font-size: 13px; }
.legal-links a { display: inline-flex; align-items: center; min-height: 36px; color: var(--text-muted); text-decoration: none; }
.legal-links a:hover { color: var(--text); text-decoration: underline; }
.legal-links a[aria-current="page"] { color: var(--heading); font-weight: 600; }
.legal-contact { margin: 2px 0 0; color: var(--text-faint); font-size: 13px; text-align: center; }
.legal-contact a { color: inherit; }
.privacy .legal-links { justify-content: flex-start; gap: 0 12px; margin-top: 6px; font-size: inherit; }
.privacy .legal-links a { min-height: 24px; }
@media (max-width: 767px) { .privacy .legal-links a { min-height: 44px; } }   /* Tippfläche am Handy */

@media (max-width: 520px) {
  .legal-page { padding-top: 16px; }
  .legal { padding: 22px 18px 24px; }
  .legal h1 { font-size: 26px; line-height: 31px; }
  .legal-abs { padding-left: 2.1em; }
  .legal-abs > li::before { left: -2.1em; }
  .legal td:first-child { width: 36%; }
  .legal-links a { min-height: 44px; }
}

@media (max-width: 380px) { .legal-melicus { display: none; } .legal-brand { margin-right: auto; } }

/* --- Seitengerüst: Kopfzeile, Seitenleiste (Arbeitsplatz), Reiter (Handy) ------------------------- */

/* Arbeitsplatz (≥ 768 px): helle Kopfzeile oben, links Seitenleiste mit Datenschutz-Zeile unten, rechts der
   Arbeitsbereich. Seitenleiste und Arbeitsbereich scrollen jeweils für sich. */
body.shell {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "header header"
    "side   main"
    "foot   main";
  background: var(--surface);
}

.app-header {
  grid-area: header;
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 max(10px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--bar);
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
}

/* Logo + Name als unauffälliger Knopf „Zur freien Aufnahme“ */
.app-home {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  margin: 0;
  padding: 0 4px;
  border: 0;
  border-radius: var(--radius-small);
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.app-home:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.app-logo { flex: none; width: 26px; height: 26px; border-radius: 6px; }
.app-name { font-size: 15px; font-weight: 600; }
/* melicus● zurückgenommen: klein, gedämpft, durch dünnen Trenner abgesetzt */
.app-header .app-brand {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.4;
}
.app-header-space { flex: 1; }

/* ?-Knopf (und ↻ neben „Meine Melodien“): Trefferfläche --tap, sichtbar als grauer Kreis (36 px) */
.help-button,
.refresh-button {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--fill) 17.5px, transparent 18px);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.help-button:hover,
.refresh-button:hover { background: radial-gradient(circle, var(--fill-hover) 17.5px, transparent 18px); }

.help-button[aria-expanded="true"] {
  background: radial-gradient(circle, var(--accent) 17.5px, transparent 18px);
  color: var(--on-accent);
}

.help-pop {
  position: fixed;
  z-index: 40;
  width: 340px;
  overflow-y: auto;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 12px 40px rgba(14, 26, 51, 0.22), 0 0 0 1px var(--ring);
}

.help-pop-title { display: block; margin-bottom: 6px; color: var(--heading); font-size: 15px; font-weight: 600; }
.help-pop-list { margin: 0; padding-left: 18px; }
.help-pop-list li { margin-bottom: 4px; }
.help-pop-list li:last-child { margin-bottom: 0; }

/* Kontomenü: Arbeitsplatz „Name ▾“, Handy Personen-Symbol im grauen Kreis */
.account-menu { position: relative; flex: none; }

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap-desk);
  max-width: 260px;
  padding: 4px 14px;
  border: 0;
  border-radius: 18px;
  background: var(--fill);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.account-button:hover, .account-button[aria-expanded="true"] { background: var(--fill-hover); }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-caret { font-size: 11px; color: var(--text-muted); }

.account-icon {
  display: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.account-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 220px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-pop), 0 0 0 1px var(--ring);
}

.account-item {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.account-item:hover { background: var(--surface-2); }

/* Darstellung Auto | Hell | Dunkel im Kontomenü (theme.js) */
.theme-item { margin: 4px 0; padding: 8px 6px; border-top: 1px solid var(--sep); border-bottom: 1px solid var(--sep); }
.theme-row { display: flex; flex-direction: column; gap: 6px; }
.theme-label { padding: 0 6px; color: var(--text-muted); font-size: 13px; }
.theme-seg { display: flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--track); }

.theme-option {
  flex: 1;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.theme-option:hover { background: var(--tb-hover); }

/* Einsicht durch das Team (Widerspruch, accounts-view.js): Schalter mit Erklärung */
.team-item { padding: 6px 6px 8px; border-bottom: 1px solid var(--sep); margin-bottom: 4px; }
.team-switch { display: flex; justify-content: space-between; width: 100%; padding: 0 6px; font-size: 15px; }
.team-note { max-width: 268px; margin: 2px 0 0; padding: 0 6px; color: var(--text-muted); font-size: 13px; line-height: 1.4; }
.team-more { color: var(--link); white-space: nowrap; }
.team-error { max-width: 268px; margin: 6px 0 0; padding: 0 6px; color: var(--error); font-size: 13px; }
.theme-option[aria-checked="true"] { background: var(--seg-on); font-weight: 600; box-shadow: var(--shadow-seg); }
@media (max-width: 767px) { .theme-option { min-height: 44px; font-size: 15px; } }

/* Dialoge (Passwort ändern, Konten) */
.dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 22px 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(14, 26, 51, 0.25);
}

.dialog::backdrop { background: rgba(14, 26, 51, 0.35); }
.dialog-form { position: relative; }
.dialog-form .sr-only { left: 0; top: 0; }   /* unsichtbares Benutzerfeld ragt sonst über den Rand und verschiebt den Dialog */
.dialog h2 { font-size: 20px; }
.dialog .actions { margin-bottom: 0; }
.dialog .notice { margin-bottom: 16px; }
.dialog-intro { margin: 0 0 16px; color: var(--text-muted); }   /* Pflicht-Passwortwechsel */

/* Bestätigung der Nutzungsbedingungen (Pflichtdialog, accounts-view.js) */
.terms-link { margin: 0 0 16px; }
.terms-read { display: inline-flex; align-items: center; min-height: 44px; color: var(--link); font-weight: 600; text-underline-offset: 2px; }
.terms-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 4px;
  padding: 12px 14px;
  border-radius: var(--radius-small);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  cursor: pointer;
}
.terms-check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.terms-dialog .save-status:empty { display: none; }
.terms-leave { margin: 12px 0 0; text-align: center; }
.link-button.terms-logout { color: var(--text-muted); font-weight: 500; }

/* Banner „Nur lesen, bis Du die Nutzungsbedingungen bestätigst“ (app.js) */
.terms-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 16px; color: var(--brass-ink); font-weight: 500; }
.terms-banner-text { flex: 1 1 220px; }
.terms-banner:focus { outline: none; }

/* Seitenleiste */
.sidebar {
  grid-area: side;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: hidden;   /* „Neue Aufnahme“ bleibt oben, nur .side-scroll scrollt */
  padding: 14px 12px 0;
  background: var(--surface-2);
  border-right: 1px solid var(--border-soft);
  font-size: 14px;
}

.side-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap-desk);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.side-new:hover { background: var(--bg); }
.side-new[aria-current] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* Roter Punkt (Neue Aufnahme, Neu aufnehmen): Zeichen ausgeblendet, Kreis gezeichnet */
.rec-dot {
  display: inline-block;
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--record);
  color: transparent;
  font-size: 0;
}

/* Listen in der Seitenleiste (Arbeitsplatz) und im Bereich „Meine Melodien“ (Handy) */
.side-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -12px;
  padding: 0 12px 12px;
}

.side-section { margin-top: 6px; }
.side-head { display: flex; align-items: center; justify-content: space-between; min-height: 32px; margin-bottom: 2px; padding-left: 8px; }
.side-head .help-button { margin: -10px -8px -10px 0; transform: scale(0.8); }
/* ↻ neben „Meine Melodien“: steht rechts vor dem ?, dreht sich kurz beim Neuladen */
.side-head .refresh-button { margin: -10px -14px -10px auto; transform: scale(0.8); display: grid; place-items: center; }
/* ⤓ neben „Testfälle“ (Link auf die ZIP): kein ? dahinter, daher bündig wie der ?-Knopf */
.side-head .download-cases { margin-right: -8px; text-decoration: none; }
.refresh-button .ic { width: 18px; height: 18px; }
.refresh-button.is-busy .ic { animation: spin 0.8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .refresh-button.is-busy .ic { animation-duration: 2.4s; } }
.side-heading {
  margin: 0;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 600;
}

.side-items { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
/* Testfall: Eintrag und darunter „Löschen“ (Trefferfläche ≥ 44 px), Titel über die ganze Breite */
.side-row {
  display: flex;
  flex-direction: column;
  border-radius: 8px;
}

.side-row:has(.side-item[aria-current="true"]) { background: var(--accent); }
.side-row .side-item { border-radius: 8px 8px 0 0; padding: 6px 8px 0; min-height: 0; }
.side-row .side-item[aria-current="true"] { padding: 6px 8px 0; }
.side-row:has(.side-item[aria-current="true"]) .side-delete { color: var(--on-accent-danger); }

.side-item { flex: 1; min-width: 0; }

.side-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  min-height: 44px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.side-item:hover { background: var(--fill-2); }
.side-item[aria-current="true"], .side-item[aria-current="true"]:hover { background: var(--accent); color: var(--on-accent); }
.side-item-title { max-width: 100%; color: inherit; font-size: 14px; font-weight: 600; line-height: 18px; overflow-wrap: anywhere; }
.side-item-line { max-width: 100%; color: inherit; opacity: 0.72; font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
.side-draft {
  display: inline-block;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--brass-soft);
  color: var(--brass-ink);
  font-size: 11px;
  font-weight: 600;
  vertical-align: 1px;
}

.side-delete {
  align-self: flex-end;
  min-width: 44px;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--error);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.side-delete:disabled { opacity: 0.5; cursor: default; }
.side-delete:hover:not(:disabled) { text-decoration: underline; }
.side-note { margin: 0 0 8px; padding: 0 8px; color: var(--text-muted); font-size: 13px; }
.side-status { color: var(--heading); }
.side-empty-button, .side-reload { align-self: flex-start; }
.side-error { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }

.side-item-tags { max-width: 100%; color: inherit; opacity: 0.85; font-size: 12px; overflow-wrap: anywhere; }

/* Suche und Stichwort-Chips über „Meine Melodien“ (Spec 2026-10-07 5.2) */
.side-search {
  width: 100%;
  min-height: 30px;
  margin: 0 0 8px;
  padding: 4px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--track);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
input.side-search { min-height: 30px; padding: 4px 10px; border: 0; }
.side-search::placeholder { color: var(--text-muted); }
.side-chips { display: flex; gap: 6px; margin: 0 0 8px; overflow-x: auto; padding-bottom: 2px; }
.side-chips[hidden] { display: none; }
.side-chip {
  flex: none;
  min-height: 26px;
  padding: 2px 10px;
  border: 0;
  border-radius: 13px;
  background: var(--track);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.side-chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* Handy-Liste „Meine Melodien“: großer Titel, graues Suchfeld, weiße Gruppe mit Trennlinien und › */
.library-view .side-head { padding: 0; margin-bottom: 10px; }
.library-view .side-head .help-button { margin: -8px -8px -8px 0; transform: none; }
.library-view .side-head .refresh-button { margin: -8px 0 -8px auto; transform: none; }
.library-view .large-title { color: var(--heading); font-size: 34px; font-weight: 700; }
.library-view input.side-search { min-height: 38px; padding: 6px 12px; border-radius: 10px; background: var(--fill); font-size: 17px; }
.library-view .side-chips { margin: 4px 0 14px; gap: 8px; }
.library-view .side-chip { min-height: 32px; padding: 0 14px; border-radius: 16px; background: var(--surface); font-size: 15px; font-weight: 500; }
.library-view .side-chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.library-view .side-items { gap: 0; overflow: hidden; border-radius: var(--radius); background: var(--surface); }
.library-view .side-items > li + li .side-item::before {   /* Trennlinie ab dem Text, wie in iOS */
  content: "";
  position: absolute;
  left: 16px;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--sep);
}
.library-view .side-item {
  position: relative;
  min-height: 64px;
  padding: 11px 36px 11px 16px;
  border-radius: 0;
  gap: 2px;
}
.library-view .side-item::after {      /* › wie in iOS-Listen */
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-top: 2px solid var(--chevron);
  border-right: 2px solid var(--chevron);
  transform: rotate(45deg);
}
.library-view .side-item:hover { background: var(--surface-2); }
.library-view .side-item[aria-current="true"] { background: var(--surface-2); color: var(--text); }
.library-view .side-item-title { font-size: 17px; line-height: 22px; }
.library-view .side-item-line { opacity: 1; color: var(--text-muted); font-size: 15px; line-height: 20px; font-variant-numeric: tabular-nums; }
.library-view .side-item-tags { opacity: 1; color: var(--link); font-size: 13px; margin-top: 2px; }
.library-view .side-note { padding: 0; font-size: 15px; }

/* Datenschutz: Arbeitsplatz unten in der Seitenleiste */
.privacy {
  grid-area: foot;
  padding: 10px 20px 14px;
  background: var(--surface-2);
  border-right: 1px solid var(--border-soft);
  color: var(--text-faint);
  font-size: 11px;
  line-height: 15px;
}

.privacy p { margin: 0; }

/* Arbeitsbereich */
.main {
  grid-area: main;
  min-width: 0;
  overflow-y: auto;
  padding: 20px 28px 40px;
  background: var(--surface);
}

/* Aufnehmen, Liste und Konten auf grauem Grund (weiße Karten darauf), die Noten auf Weiß */
body[data-panel="record-panel"] .main, body:not([data-panel]) .main,
body[data-panel="library-view"] .main { background: var(--bg); }

.phone-tabs { display: none; }

/* Handy (< 768 px): schlanke Kopfzeile, ein Bereich, feste Reiter unten; Datenschutz unter „Meine Melodien“ */
@media (max-width: 767px) {
  body.shell {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
    display: block;
    padding-bottom: calc(var(--tabs) + env(safe-area-inset-bottom));
    background: var(--bg);
  }

  .app-header {
    position: sticky;
    top: 0;
    gap: 2px;
    min-height: 52px;
    padding: 0 max(4px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
    background: var(--header-glass);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0;
  }

  .app-header .app-brand { display: none; }   /* am Handy: Logo + Titel + Konto + ? passen in 390 px */
  .app-name { font-size: 15px; color: var(--text-muted); }

  .account-button {
    justify-content: center;
    width: var(--tap);
    min-height: var(--tap);
    padding: 0;
    border-radius: 50%;
    background: radial-gradient(circle, var(--fill) 17.5px, transparent 18px);
  }

  .account-button:hover, .account-button[aria-expanded="true"] { background: radial-gradient(circle, var(--fill-hover) 17.5px, transparent 18px); }
  .account-name, .account-caret { display: none; }
  .account-icon { display: block; }

  .sidebar { display: none; }

  .main { overflow: visible; padding: 0 16px 24px; background: var(--bg); }

  .privacy { display: none; padding: 4px 32px 20px; background: none; border: 0; color: var(--text-muted); font-size: 13px; line-height: 18px; }
  body[data-panel="library-view"] .privacy { display: block; }

  .phone-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--tabs-glass);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line);
  }

  .phone-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: var(--tabs);
    padding: 6px 4px 4px;
    border: 0;
    background: transparent;
    color: var(--text-faint);
    font: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
  }

  .phone-tab[aria-current] { color: var(--text); font-weight: 600; }
  .phone-tab-icon { width: 26px; height: 26px; }
  .phone-tab:focus-visible { outline-offset: -3px; }
}

/* --- Aufnahme-Bereich (record-panel.js): Handy „Sprachmemos“, Arbeitsplatz mittig ------------------- */

.record-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  min-height: 100%;
  margin: 0 auto;
}

/* Titelzeile: „Aufnehmen“ links, ⚙ und ? rechts */
.rec-tools {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 -8px 14px 0;
  color: var(--text);
}

.rec-title { flex: 1; }
.record-panel[data-stage]:not([data-stage="start"]) .rec-tools { display: none; }

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--fill) 17.5px, transparent 18px);
  color: var(--text);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.tool-button .ic { width: 20px; height: 20px; }
.tool-button:hover { background: radial-gradient(circle, var(--fill-hover) 17.5px, transparent 18px); }

.rec-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.rec-spacer { flex: 1; min-height: 12px; }
.rec-spacer-small { flex: 0.3; }
.rec-spacer-large { flex: 1.4; }
.rec-stage p { margin: 0; }

/* Tempo-Karte: links „Tempo / 120 BPM · 2/4“, rechts − | + */
.tempo-block { display: flex; flex-direction: column; align-items: stretch; gap: 20px; width: 100%; }

.tempo-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 14px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}

.tempo-read { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.tempo-caption { color: var(--text-muted); font-size: 13px; }
.tempo { display: flex; align-items: center; }

.tempo-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--heading);
  font: inherit;
  cursor: text;
}

.tempo-number { font-size: 48px; font-weight: 600; line-height: 52px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tempo-value small { color: var(--text-muted); font-size: 15px; white-space: nowrap; }

input.tempo-input {
  width: 3.2em;
  min-height: 56px;
  padding: 2px 6px;
  font-size: 40px;
  font-weight: 600;
  text-align: center;
}

.stepper {
  display: flex;
  flex: none;
  align-items: center;
  height: var(--tap);
  border-radius: 12px;
  background: var(--fill-2);
}

.stepper-sep { width: 1px; height: 24px; background: var(--line); }

.tempo-step {
  width: 58px;
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.tempo-step:hover { background: var(--fill); }
.tempo-step:active { background: var(--line); }

/* Gruppierte Liste: Zeilen mit Symbol-Kachel, Text, Wert und › */
.group-list {
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
}

.group-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--tap);
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 17px;
  text-align: left;
  cursor: pointer;
}

.group-row + .group-row::before {      /* Trennlinie ab dem Text, wie in iOS */
  content: "";
  position: absolute;
  left: 58px;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--sep);
}

.group-row:hover { background: var(--surface-2); }
.group-row:active { background: var(--fill-2); }

.row-icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
}

.row-icon .ic { width: 18px; height: 18px; }
.row-label { flex: 1; }
.row-chevron { width: 16px; height: 16px; color: var(--chevron); stroke-width: 2.2; }
.row-play { display: flex; color: var(--text); }
.row-play .ic { width: 18px; height: 18px; }

/* Startton: Wert grau, gewählt in Navy */
.start-tone-row { min-height: var(--tap); }
.start-tone-value { color: var(--text-muted); }
.start-tone-row.is-set .start-tone-value { color: var(--text); font-weight: 600; }

.tuner-button { min-height: var(--tap); }

/* Metronom anhören: ▶, läuft es, ■ und die Kachel in Messing */
.metro-toggle .ic-stop { display: none; }
.metro-toggle[aria-pressed="true"] .ic-play { display: none; }
.metro-toggle[aria-pressed="true"] .ic-stop { display: block; }
.metro-toggle[aria-pressed="true"] .row-icon { background: var(--brass); color: var(--navy); }

/* Runder Pillen-Knopf (z. B. „▶ Startton anhören“ im Stimmgerät) */
.pill-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 8px 20px;
  border: 0;
  border-radius: 26px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.pill-button:hover { background: var(--surface-2); }

/* Startton wählen: 12 Tasten (6 × 2) und „frei“ */
.tone-picker .sheet-dialog-inner { align-items: stretch; }
.tone-picker .sheet-dialog-title { justify-content: center; }   /* h2 ist flex */
.tone-keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }

.tone-key {
  min-width: 0;
  min-height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: var(--radius-small);
  background: var(--fill-2);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.tone-key:hover { background: var(--fill); }
.tone-key[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.tone-free {
  align-self: center;
  min-height: var(--tap);
  padding: 4px 16px;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}

.tone-free[aria-pressed="true"] { color: var(--text); font-weight: 600; }
.tone-picker-note { margin: 0; color: var(--text-muted); font-size: 15px; text-align: center; }

/* Stimmgerät: groß (Übungsmodus) und klein (während der Aufnahme). Skala −50…+50 Cent, grün ±15. */
.tuner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 22px 16px 16px;
  border-radius: var(--radius);
  background: var(--surface);
}

.tuner-target { color: var(--text-muted); font-size: 15px; }
.tuner-target b, .tuner-mini-target b { color: var(--text); }
.tuner-reading { display: flex; align-items: baseline; justify-content: center; gap: 10px; }
.tuner-note { color: var(--heading); font-size: 76px; font-weight: 300; line-height: 1; }
.tuner-hz { color: var(--text-muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.tuner-scale { position: relative; display: block; width: 100%; height: 58px; }

.tuner-track {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 22px;
  height: 6px;
  border-radius: 3px;
  background: var(--fill-2);
}

.tuner-ok { position: absolute; left: 38%; width: 24%; top: 0; height: 6px; border-radius: 3px; background: var(--ok-soft); }
.tuner-tick { position: absolute; left: 50%; top: -7px; width: 2px; height: 20px; margin-left: -1px; border-radius: 1px; background: var(--heading); }

.tuner-needle {
  position: absolute;
  left: 50%;
  top: -9px;
  width: 6px;
  height: 24px;
  margin-left: -3px;
  border-radius: 3px;
  background: var(--brass);
  transition: left 0.08s linear, opacity 0.3s ease;
}

.tuner-label { position: absolute; bottom: 0; color: var(--text-muted); font-size: 13px; }
.tuner-label-low { left: 0; }
.tuner-label-high { right: 0; }
.tuner-cents { min-height: 1.45em; color: var(--text-muted); font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tuner-cents[data-tone="good"], .tuner-mini-cents[data-tone="good"] { color: var(--ok); }
.tuner-cents[data-tone="low"], .tuner-cents[data-tone="high"],
.tuner-mini-cents[data-tone="low"], .tuner-mini-cents[data-tone="high"] { color: var(--error); }
.is-idle .tuner-needle { visibility: hidden; }
.is-faded .tuner-needle { opacity: 0.25; }
.tuner-note, .tuner-mini-note, .tuner-mini-cents { transition: opacity 0.3s ease; }
/* „‹ Zurück“ oben im Stimmgerät (Spec 2026-10-07 S6); Tippfläche aus .melody-back (--tap) */
.tuner-top { display: flex; justify-content: flex-end; width: 100%; }
.tuner-back { padding: 0 0 0 10px; }
.is-faded .tuner-note, .is-faded .tuner-mini-note, .is-faded .tuner-mini-cents { opacity: 0.35; }
.tuner-done { max-width: 420px; }

.tuner-mini { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.tuner-mini-target { color: var(--text-muted); font-size: 15px; }

.tuner-mini-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  border-radius: var(--radius);
  background: var(--surface);
}

.tuner-mini-note { flex: none; width: 2em; color: var(--heading); font-size: 26px; font-weight: 600; line-height: 1.2; text-align: left; }
.tuner-scale-mini { flex: 1; height: 34px; }
.tuner-scale-mini .tuner-track { left: 0; right: 0; top: 14px; }
.tuner-scale-mini .tuner-tick { top: -5px; height: 16px; }
.tuner-scale-mini .tuner-needle { top: -7px; height: 20px; }
.tuner-mini-cents { flex: none; width: 3.4em; color: var(--text-muted); font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .tuner-needle, .tuner-note, .tuner-mini-note { transition: none; }
}

/* Roter Punkt (≥ 110 px) und Stopp-Quadrat: weißer Knopf mit grauem Ring wie in „Sprachmemos“ */
.rec-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 112px;
  height: 112px;
  padding: 0;
  border: 5px solid var(--line);
  border-radius: 50%;
  background: var(--control);
  cursor: pointer;
  touch-action: manipulation;
}

.rec-button-dot {
  display: block;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--record);
  transition: transform 0.1s ease;
}

.rec-button:hover .rec-button-dot { transform: scale(0.96); }
.rec-button:active .rec-button-dot { transform: scale(0.9); }
.rec-button:disabled { opacity: 0.4; cursor: not-allowed; }
.rec-button:disabled .rec-button-dot { transform: none; }

.stop-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 112px;
  height: 112px;
  padding: 0;
  border: 5px solid var(--line);
  border-radius: 50%;
  background: var(--control);
  cursor: pointer;
  touch-action: manipulation;
}

.stop-square { display: block; width: 42px; height: 42px; border-radius: 9px; background: var(--record); }
.stop-button:disabled { opacity: 0.5; cursor: progress; }
.rec-caption { color: var(--text-muted); font-size: 13px; margin-top: -4px; }

/* Kopfhörer-Hinweis unter dem Punkt: kleine Zeile mit Lautsprecher und durchgestrichenem Kopfhörer */
.speaker-strip {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.speaker-strip > span { display: inline-flex; align-items: center; gap: 5px; }
.strip-icon { width: 18px; height: 18px; }

.no-phones { position: relative; display: inline-flex; }
.no-phones::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  top: 50%;
  height: max(2px, 0.09em);
  margin-top: -1px;
  border-radius: 2px;
  background: var(--record);
  transform: rotate(-35deg);
}

.big-icons { display: flex; justify-content: center; gap: 18px; }

.big-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--on-accent);
}

.big-icon .ic { width: 36px; height: 36px; }
.big-icon.no-phones::after { left: 8px; right: 8px; height: 3px; }

.rec-error { width: 100%; margin: 0; text-align: left; }

/* ⚙ Einstellungen: am Handy Blatt von unten, am Arbeitsplatz Karte über dem Tempo */
.settings {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.settings-inner { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.settings-title { margin: 0; padding-right: var(--tap); font-size: 20px; }
.settings-help { position: absolute; top: -6px; right: -6px; color: var(--text); }

.seg-field { margin: 0; padding: 0; border: 0; min-width: 0; }

/* Umschalter (Segmente) wie in iOS: graue Spur, gewähltes Segment weiß mit Schatten */
.seg {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 10px;
  background: var(--fill);
}

.seg-item {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin: 0;
  padding: 4px 14px;
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.voice-range-field { display: flex; align-items: center; gap: 10px; }
.voice-range-field .seg { flex: 1; }
.seg-sub { margin-left: 0.4em; color: var(--text-muted); font-size: 13px; font-weight: 400; }
.time-sig-field { padding: 0 2px; }
.seg-caption { flex: none; min-width: 6.5em; color: var(--heading); font-size: 17px; }
.seg-item input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.seg-item:has(input:checked) { background: var(--seg-on); font-weight: 600; box-shadow: var(--shadow-seg); }
.seg-item:has(input:focus-visible) { outline: 3px solid var(--brass); outline-offset: -3px; }

.settings-field { display: block; margin: 0; color: var(--heading); font-size: 17px; font-weight: 400; }
.settings-switch { justify-content: space-between; min-height: var(--tap); flex-direction: row-reverse; }

.settings-done { width: 100%; }

/* Bildschirm-Blätter (Handy: von unten); is-modal setzt record-panel.js (ältere Safari kennen :modal nicht) */
.settings.is-modal, .sheet-dialog {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: none;
  max-height: 88dvh;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  border: 0;
  border-radius: 14px 14px 0 0;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 -8px 30px rgba(14, 26, 51, 0.16);
}

.settings.is-modal .settings-inner, .sheet-dialog-inner {
  padding: 22px 16px calc(22px + env(safe-area-inset-bottom));
}

.settings.is-modal .settings-inner::before, .sheet-dialog-inner::before {   /* Griff oben */
  content: "";
  align-self: center;
  width: 36px;
  height: 5px;
  margin: -12px 0 2px;
  border-radius: 3px;
  background: var(--grabber);
}

.settings.is-modal .settings-help { top: 16px; right: 8px; }
.settings::backdrop, .sheet-dialog::backdrop { background: rgba(14, 26, 51, 0.35); }

/* Einstellungen am Handy: Zeilen als weiße Karten */
.settings.is-modal .voice-range-field, .settings.is-modal .settings-switch,
.settings.is-modal .settings-field {
  min-height: var(--tap);
  padding: 6px 8px 6px 16px;
  border-radius: var(--radius);
  background: var(--surface);
}
.settings.is-modal .settings-field select { min-height: 40px; border: 0; background-color: var(--fill-2); }

.sheet-dialog-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.sheet-dialog-title { margin: 0; font-size: 20px; }
.sheet-dialog-text { margin: 0 0 6px; font-size: 15px; color: var(--text-muted); }
.sheet-dialog .btn-large { margin-top: 4px; }

.only-desk { display: none; }

/* Vorzählen und Aufnahme */
.countin, .recording { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.countin { margin-top: 40px; }
.countin-bar { min-height: 1.1em; color: var(--heading); font-size: 110px; font-weight: 200; line-height: 1; font-variant-numeric: tabular-nums; }
.countin-text { color: var(--text-muted); font-size: 17px; }
.beat-dots { display: flex; gap: 16px; }
.beat-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--fill); }
.beat-dot.is-on { background: var(--accent); }

.recording { margin-top: 12px; gap: 6px; }
.rec-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--error);
  font-size: 13px;
  font-weight: 600;
}
.rec-label-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--record); }
.rec-time { color: var(--heading); font-size: 76px; font-weight: 200; line-height: 80px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rec-bar { color: var(--text-muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.recording .meter { width: 100%; margin-top: 22px; }

/* Nach Stopp: anhören und entscheiden */
.review-title { margin: 0; font-size: 28px; }
.review-note { color: var(--text-muted); font-size: 15px; }

.player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 20px 16px 12px;
  border-radius: var(--radius);
  background: var(--surface);
}

.play-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.play-button .ic { width: 30px; height: 30px; }
.play-button .ic-play { margin-left: 4px; }
.play-button .ic-pause, .play-button.is-playing .ic-play { display: none; }
.play-button.is-playing .ic-pause { display: block; }
.play-button:hover { background: var(--accent-hover); }
.play-seek { width: 100%; height: 28px; margin: 0; accent-color: var(--accent); }
.play-error { color: var(--error); font-size: 15px; font-weight: 500; }
.play-times { display: flex; justify-content: space-between; width: 100%; color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.convert-error { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.convert-error .notice { width: 100%; margin: 0; text-align: left; color: var(--text); }
.convert-error-title { display: block; color: var(--error); }

.review-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; }

/* Umwandeln */
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--fill);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.busy-text { color: var(--heading); font-size: 17px; font-weight: 500; }
.busy-cancel { width: 100%; max-width: 320px; }

/* Handy: Bereich füllt die Höhe zwischen Kopfzeile und Reitern */
@media (max-width: 767px) {
  .record-panel { min-height: calc(100dvh - 52px - var(--tabs) - env(safe-area-inset-bottom) - 24px); }
  /* Nur-Lesen-Hinweis oben nimmt Platz: Bereich entsprechend niedriger, damit die Zeile unter ● frei bleibt */
  .access-banner:not([hidden]) ~ .record-panel { min-height: calc(100dvh - 52px - var(--tabs) - env(safe-area-inset-bottom) - 24px - 130px); }
}

/* Arbeitsplatz: ⚙-Inhalte als Karte über dem Tempo, Hinweisblatt mittig */
@media (min-width: 768px) {
  .record-panel { padding-top: 4px; }
  #settings-button { display: none; }
  .only-phone { display: none; }
  .only-desk { display: block; }
  .rec-tools { margin-bottom: 8px; }

  .settings[open] {
    position: static;
    width: 100%;
    max-width: none;
    margin: 0 0 14px;
  }

  .settings-inner {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 12px 12px 12px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    text-align: left;
  }

  .settings-title, .settings-done { display: none; }
  .settings-help { position: static; order: 99; margin: -8px -6px -8px auto; }
  .settings-inner .seg-item { min-height: 34px; padding: 2px 12px; }
  .settings-inner select { width: auto; max-width: 16em; min-height: 38px; }
  .settings-switch { flex-direction: row; font-size: 15px; min-height: 38px; }
  .settings-switch input { width: 42px; height: 26px; }
  .settings-switch input::after { width: 22px; height: 22px; }
  .settings-switch input:checked::after { transform: translateX(16px); }
  .seg-caption, .settings-field { font-size: 15px; }
  .seg-caption { min-width: 0; }

  .sheet-dialog {
    inset: 0;
    width: min(460px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    margin: auto;
    border-radius: var(--radius);
  }

  .sheet-dialog-inner { padding: 26px 24px; }
  .sheet-dialog-inner::before { display: none; }
  .rec-review .rec-spacer { flex: 0 0 8px; min-height: 8px; }
  .review-actions { flex-direction: row; }
  .review-actions > * { flex: 1; }
}

/* --- Melodie-Ansicht (melody-view.js): Arbeitsplatz Kopf + Werkzeugleiste + Editor, Handy „Deine Noten“ -- */

.melody-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}

.melody-view[data-state="loading"] .melody-body,
.melody-view[data-state="error"] .melody-body,
.melody-view[data-state="empty"] .melody-body,
.melody-view[data-state="empty"] .melody-head { display: none; }

.melody-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }

.melody-title-box {
  flex: 1 1 260px;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 12px;
}

.melody-heading { margin: 0; font-size: 22px; min-width: 0; }

.melody-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--heading);
  font: inherit;
  font-weight: 700;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.melody-title:disabled { cursor: default; opacity: 1; }
.melody-pen { display: inline-flex; color: var(--chevron); }
.melody-pen .ic { width: 16px; height: 16px; }
.melody-title:hover:not(:disabled) .melody-pen { color: var(--text); }
.melody-view[data-rename="0"] .melody-pen { display: none; }

.melody-title-input { flex: 1 1 100%; max-width: 560px; font-size: 20px; font-weight: 600; }

.melody-meta { margin: 0; color: var(--text-muted); font-size: 13px; }

/* Notiz und Stichwörter (notes-view.js, Spec 2026-10-07 5.1) */
.melody-notes { display: flex; flex-direction: column; gap: 4px; flex-basis: 100%; margin-top: 4px; max-width: var(--column); }
.notes-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.notes-chips { display: contents; list-style: none; margin: 0; padding: 0; }
.notes-chip {
  display: inline-flex; align-items: center; gap: 0; min-height: 26px; padding: 2px 2px 2px 10px;
  border-radius: 13px; background: var(--chip); color: var(--text); font-size: 13px; font-weight: 500;
}
.melody-notes[data-mode="read"] .notes-chip { padding-right: 10px; }
.notes-chip-remove {
  width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent;
  color: var(--text-muted); font-size: 15px; line-height: 1; cursor: pointer;
}
.notes-chip-remove:hover, .notes-chip-remove:focus-visible { background: var(--fill); color: var(--text); }
input.notes-tag-input {
  flex: 1 1 120px; min-width: 110px; max-width: 200px; min-height: 28px; padding: 2px 10px;
  border: 0; border-radius: 13px; background: transparent; color: var(--link); font: inherit; font-size: 13px;
}
input.notes-tag-input:focus { background: var(--surface-2); outline: none; }
input.notes-tag-input:focus-visible { outline: 2px solid var(--brass); outline-offset: 0; }
.notes-tag-input::placeholder { color: var(--link); }
.notes-help { width: 36px; height: 36px; transform: scale(0.8); }
.notes-suggest { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.notes-suggest[hidden] { display: none; }
.notes-suggestion {
  min-height: 26px; padding: 2px 10px; border: 0; border-radius: 13px;
  background: var(--fill-2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
}
.notes-error { margin: 0; color: var(--error); font-size: 13px; }
.notes-error:empty { display: none; }
.notes-toggle {
  align-self: flex-start; max-width: 100%; min-height: 30px; padding: 2px 8px; margin-left: -8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-muted); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.notes-toggle:hover, .notes-toggle:focus-visible { background: var(--surface-2); color: var(--text); }
.notes-text {
  width: 100%; min-height: 96px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-small);
  background: var(--control); color: var(--text); font: inherit; font-size: 15px; resize: vertical;
}
.notes-read { margin: 0; color: var(--text); font-size: 15px; white-space: pre-wrap; }
.notes-count, .notes-state { color: var(--text-muted); font-size: 12px; }
.notes-state:empty { display: none; }
.notes-state[data-tone="error"] { color: var(--error); }
@media (max-width: 760px) {
  .notes-chip-remove, input.notes-tag-input, .notes-suggestion, .notes-toggle { min-height: 44px; }
  input.notes-tag-input { font-size: 15px; }
  .notes-chip-remove { width: 44px; }
  .notes-chip { font-size: 15px; }
}

.melody-actions { display: flex; align-items: center; gap: 8px; color: var(--text); }

.btn-small { min-height: var(--tap-desk); padding: 4px 14px; font-size: 14px; border-radius: 8px; }
.btn-small .ic { width: 15px; height: 15px; }

.melody-menu { position: relative; }
.melody-menu .tool-button .ic { width: 22px; height: 22px; }

.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 240px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-pop), 0 0 0 1px var(--ring);
}

.menu-item {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }

.melody-saved { margin: -6px 0 0; color: var(--text-muted); font-size: 13px; }
.melody-error { margin: 0; font-size: 15px; }
.melody-status { margin: 0; color: var(--heading); font-size: 15px; font-weight: 500; }
.melody-status:empty { display: none; }

.melody-body { display: flex; flex-direction: column; gap: 12px; }

/* Werkzeugleiste wie in einer Mac-App: Abspiel-Umschalter, Symbole, Tonart, Speicherstand */
.melody-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0;
}

.tb-group {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--track);
}

.tb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap-desk);
  min-width: var(--tap-desk);
  padding: 4px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.tb .ic { width: 17px; height: 17px; }
.tb-group .tb { min-height: 32px; }
.tb:hover:not(:disabled) { background: var(--fill-2); }
.tb-group .tb:hover:not(:disabled) { background: var(--tb-hover); }
.tb:disabled { opacity: 0.35; cursor: not-allowed; }
.tb[aria-pressed="true"], .tb.is-playing, .tb-group .tb[aria-pressed="true"], .tb-group .tb.is-playing {
  background: var(--seg-on);
  color: var(--text);
  box-shadow: var(--shadow-seg);
}
.tb:not(.tb-group .tb)[aria-pressed="true"] { background: var(--fill); box-shadow: none; }
.tb-icon { display: inline-flex; }
.tb-icon .ic { width: 12px; height: 12px; }
.tb-icon .ic-stop, .shows-stop .tb-icon .ic-play { display: none; }
.shows-stop .tb-icon .ic-stop { display: block; }

.tb-sep { width: 1px; height: 22px; margin: 0 4px; background: var(--line); }
.tb-grow { flex: 1; }

.tb-key { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--text-muted); font-size: 14px; font-weight: 400; }
.tb-key select { width: auto; max-width: 18em; min-height: 32px; padding: 2px 30px 2px 10px; border-radius: 7px; font-size: 14px; }

.melody-view[data-readonly="1"] .tb-edit { display: none; }

.save-state { margin: 0 4px; color: var(--text-muted); font-size: 13px; }
.save-state[data-tone="ok"] { color: var(--text-muted); }
.save-state[data-tone="draft"] { color: var(--brass-ink); }
.save-state[data-tone="error"] { color: var(--error); }

.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--link);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.link-button:hover { text-decoration: underline; }
.save-state .link-button { color: var(--error); }

/* Unsichere Takte: Messing-Punkt + Text + „Anzeigen“ */
.unsure-bars {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 10px;
  color: var(--heading);
  font-size: 14px;
}

.unsure-bars::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brass);
}

.unsure-bars .link-button { min-height: 32px; padding: 0; }

.melody-view .editor { margin-bottom: 0; }

@media (min-width: 1100px) {
  .melody-view .editor { grid-template-columns: minmax(0, 1fr) 300px; }
  .melody-view .editor.editor-readonly { grid-template-columns: minmax(0, 1fr); }
}

.pc-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 18px;
}

.pc-hint .ic { width: 20px; height: 20px; }

.melody-back {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 2px;
  min-height: var(--tap);
  padding: 0 10px 0 0;
  border: 0;
  background: transparent;
  color: var(--link);
  font: inherit;
  font-size: 17px;
  cursor: pointer;
}

.melody-back .ic { width: 22px; height: 22px; margin-left: -6px; stroke-width: 2.2; }

.storage-state { margin: 2px 0 0; color: var(--text-muted); font-size: 13px; }
.storage-state[data-tone="changed"] { color: var(--brass-ink); }
.melody-phone-actions .storage-state { margin: 0 0 6px; text-align: center; font-size: 14px; }
.melody-spacer, .melody-phone-actions { display: none; }

.discard-button {
  display: inline-flex;
  align-self: center;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--error);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

/* Verdeckte Melodie (Community): statt Werkzeugleiste und Notenbild eine Karte mit Klavierklang, Aufnahme und
   „Noten anzeigen“ (Zusatz: Kontingent) */
.melody-view[data-state="hidden"] :is(.melody-toolbar, .unsure-bars, .melody-editor, .pc-hint) { display: none; }

.hidden-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 520px;
  width: 100%;
  margin: 8px auto 0;
  padding: 24px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--ring);
  text-align: center;
}

.hidden-panel[hidden] { display: none; }
.hidden-lead { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 0; color: var(--text-muted); font-size: 15px; line-height: 21px; }
.hidden-lead .ic { width: 28px; height: 28px; color: var(--brass); }

.hidden-play {
  display: flex;
  gap: 2px;
  width: 100%;
  padding: 2px;
  border-radius: 10px;
  background: var(--track);
}

.hidden-play .tb { flex: 1; min-height: 44px; padding: 4px 8px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.hidden-play .tb:hover:not(:disabled) { background: var(--tb-hover); }
.hidden-play .tb.is-playing[aria-pressed="true"] { background: var(--seg-on); box-shadow: var(--shadow-seg); }

/* Wellenspur der Aufnahme statt der Noten: Balken wie beim Einsingen, gespielte eingefärbt, Linie läuft mit */
.hidden-wave { position: relative; width: 100%; height: 96px; padding: 0; }
.hidden-wave .wave-head {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--record);
  pointer-events: none;
}
.hidden-wave .wave-head[hidden] { display: none; }
.hidden-wave[hidden] { display: none; }
.hidden-wave::after { display: none; }
.hidden-wave .wave-bar { transition: none; }

.reveal-button { flex-direction: column; gap: 2px; padding-top: 8px; padding-bottom: 8px; }
.reveal-sub { font-size: 13px; font-weight: 400; opacity: 0.8; }

/* Kontingent aufgebraucht: Titel fett, Hinweis auf die Ausbildung kleiner und kursiv */
.quota-dialog { width: min(400px, calc(100vw - 32px)); text-align: center; }
.quota-dialog[hidden] { display: none; }
.quota-title { margin: 0 0 10px; font-size: 19px; font-weight: 700; line-height: 25px; }
.quota-upsell { margin: 0; color: var(--text-muted); font-size: 14px; font-style: italic; line-height: 20px; }
.quota-upsell a { color: var(--link); }
.quota-dialog .actions { justify-content: center; margin-top: 18px; }
.quota-dialog .actions .btn-primary { min-width: 120px; }

/* Schloss vor dem Titel in „Meine Melodien“: Noten noch nicht angezeigt */
.side-lock { width: 13px; height: 13px; margin-right: 2px; vertical-align: -1px; stroke-width: 2.2; }
.library-view .side-lock { width: 15px; height: 15px; }

/* Handy: nur lesen; Reihenfolge wie Mockup „Deine Noten“ – Noten, ▶ Noten / ▶ Aufnahme, Hinweise, unten
   „Neue Aufnahme“ und klein „Diese Melodie verwerfen“ */
@media (max-width: 767px) {
  .melody-view { min-height: calc(100dvh - 52px - var(--tabs) - env(safe-area-inset-bottom) - 24px); }
  .melody-body { flex: 1; }
  .melody-heading { font-size: 28px; }
  .melody-title { padding: 2px 0; }
  .melody-title-box { flex-basis: 100%; flex-direction: column; align-items: flex-start; }
  .melody-meta { font-size: 15px; }
  .melody-actions, .tb-desk { display: none; }

  .melody-editor { order: 2; }
  .melody-toolbar { order: 3; }
  .unsure-bars { order: 4; }
  .pc-hint { order: 5; }
  .melody-spacer { order: 6; display: block; flex: 1; min-height: 8px; }
  .melody-phone-actions { order: 7; display: flex; flex-direction: column; gap: 4px; }
  .hidden-panel { order: 3; margin-top: 4px; padding: 20px 16px; }

  .melody-toolbar .tb-group { flex: 1; padding: 2px; border-radius: 10px; background: var(--fill); }
  .tb-play { flex: 1; min-height: 44px; font-size: 15px; font-weight: 600; }
  .tb-group .tb-play { min-height: 44px; }
  .unsure-bars { font-size: 15px; }
}

/* Zugang: Kontingent im Kontomenü, Nur-Lesen-Hinweis */
.account-quota { padding: 8px 12px; color: var(--text-muted); font-size: 13px; line-height: 1.4; }
.access-banner { margin: 0 0 16px; background: var(--brass-soft); color: var(--brass-ink); font-weight: 500; }
.speaker-strip.is-access-hint { display: block; padding: 0 8px; font-size: 12px; text-align: center; line-height: 1.35; }

/* --- Verwaltung /admin (admin.html, admin-login.html; Spec 2026-10-15 Abschnitt 6) -------------------------
   Eigene Seite im Stil der App: graue Gruppen, weiße Karten, Systemschrift. Ein dunkles Navy-Band oben mit
   Messing-Plakette „Verwaltung“ unterscheidet sie auf einen Blick von der Kunden-App. Ampeln immer mit
   Farbe + Symbol + Wort. Farb-Tokens wie oben zweimal für Dunkel (automatisch und erzwungen), bitte gleich halten. */

:root {
  --admin-band: #0E1A33;               /* Band oben, in Hell und Dunkel */
  --admin-band-text: #FFFFFF;
  --admin-band-muted: #C5CCDA;         /* Navigation auf dem Band (Kontrast > 9:1) */
  --admin-band-hover: rgba(255, 255, 255, 0.10);
  --admin-band-current: rgba(255, 255, 255, 0.18);
  --admin-width: 1180px;
  /* Ampel: Punkt (Symbol darin in --status-on), heller Grund, Text darauf (Kontrast ≥ 4,5:1) */
  --status-on: #FFFFFF;
  --status-ok: #1F7A45;
  --status-ok-soft: #E1F2E7;
  --status-ok-ink: #17603A;
  --status-warn: #B36A00;
  --status-warn-soft: #FBEBD0;
  --status-warn-ink: #7A4B05;
  --status-bad: #C42B22;
  --status-bad-soft: #FDECEA;
  --status-bad-ink: #A3241C;
  --status-off: #8E8E93;
  --status-off-soft: #EEEEF2;
  --status-off-ink: #55555A;
  --danger: #C42B22;                   /* „Endgültig löschen“ */
  --danger-hover: #A3241C;
  --on-danger: #FFFFFF;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --admin-band: #111D36;
    --admin-band-muted: #B9C1D1;
    --status-on: #000000;
    --status-ok: #4CD27F;
    --status-ok-soft: #1E3A28;
    --status-ok-ink: #7EE0A3;
    --status-warn: #F2B24F;
    --status-warn-soft: #3A2C12;
    --status-warn-ink: #F6C67E;
    --status-bad: #FF6961;
    --status-bad-soft: #3A1A18;
    --status-bad-ink: #FF8E87;
    --status-off: #98989F;
    --status-off-soft: #2C2C2E;
    --status-off-ink: #C7C7CC;
    --danger: #FF6961;
    --danger-hover: #FF8E87;
    --on-danger: #000000;
  }
}

:root[data-theme="dark"] {
  --admin-band: #111D36;
  --admin-band-muted: #B9C1D1;
  --status-on: #000000;
  --status-ok: #4CD27F;
  --status-ok-soft: #1E3A28;
  --status-ok-ink: #7EE0A3;
  --status-warn: #F2B24F;
  --status-warn-soft: #3A2C12;
  --status-warn-ink: #F6C67E;
  --status-bad: #FF6961;
  --status-bad-soft: #3A1A18;
  --status-bad-ink: #FF8E87;
  --status-off: #98989F;
  --status-off-soft: #2C2C2E;
  --status-off-ink: #C7C7CC;
  --danger: #FF6961;
  --danger-hover: #FF8E87;
  --on-danger: #000000;
}

body.admin-body { min-height: 100vh; min-height: 100dvh; background: var(--bg); }

.admin-skip {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 50;
  padding: 10px 14px;
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-pop);
}
.admin-skip:focus { top: 10px; }

/* Band oben: Marke, Navigation (Arbeitsplatz), Menü */
.admin-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: var(--admin-band);
  color: var(--admin-band-text);
}

.admin-bar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: var(--admin-width);
  min-height: 58px;
  margin: 0 auto;
  padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
}

.admin-brand { display: flex; flex: none; align-items: center; gap: 10px; }
.admin-brand-logo { flex: none; border-radius: 7px; }
.admin-brand-name { font-size: 16px; font-weight: 600; }
.admin-badge {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--brass);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-nav { display: flex; flex: 1; justify-content: center; gap: 4px; }
.admin-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: var(--radius-small);
  color: var(--admin-band-muted);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}
.admin-nav-link:hover { background: var(--admin-band-hover); color: var(--admin-band-text); }
.admin-nav-link[aria-current="page"] { background: var(--admin-band-current); color: var(--admin-band-text); font-weight: 600; }
.admin-nav-icon { width: 20px; height: 20px; }

.admin-menu { flex: none; }
.admin-bar .account-button { background: var(--admin-band-hover); color: var(--admin-band-text); }
.admin-bar .account-button:hover, .admin-bar .account-button[aria-expanded="true"] { background: var(--admin-band-current); }
.admin-bar .account-caret { color: var(--admin-band-muted); }
.admin-menu .account-list { color: var(--text); }
.admin-menu-who {
  display: flex;
  flex-direction: column;
  margin: 0 0 4px;
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--sep);
  color: var(--text-muted);
  font-size: 13px;
}
.admin-menu-who strong { color: var(--text); font-size: 15px; font-weight: 600; }

/* Arbeitsbereich */
.admin-main {
  max-width: var(--admin-width);
  margin: 0 auto;
  padding: 28px max(20px, env(safe-area-inset-right)) 56px max(20px, env(safe-area-inset-left));
}
.admin-main:focus { outline: none; }
.admin-loading { color: var(--text-muted); }

.admin-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 0 0 18px; }
.admin-title { flex: 1; margin: 0; color: var(--heading); font-size: 34px; font-weight: 700; line-height: 41px; letter-spacing: 0.01em; }
.admin-title:focus { outline: none; }   /* nur per Skript fokussiert (Ansichtswechsel), nie per Tab */
.admin-head-side { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.admin-stamp { margin: 0; color: var(--text-muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.btn-primary.admin-btn-small, .btn-secondary.admin-btn-small {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-small);
  font-size: 15px;
}
.admin-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 32px;
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
}
.admin-link:hover { text-decoration: underline; }
.admin-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; }
.admin-empty { padding: 18px; color: var(--text-muted); list-style: none; }
.admin-count { margin: 0 0 10px; color: var(--text-muted); font-size: 14px; }
.admin-count:empty { display: none; }

/* Gruppen-Überschrift wie in iOS-Einstellungen */
.admin-section { margin-top: 28px; }
h2.admin-section-title {
  display: block;
  margin: 0 0 8px;
  padding-left: 4px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card.admin-list-card { padding: 0; margin-bottom: 0; overflow: hidden; }

/* Ampel: Punkt mit Symbol + Wort auf hellem Grund */
.admin-light {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 7px;
  padding: 4px 11px 4px 5px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.admin-light-dot {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: var(--status-on);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}
.admin-light-small { gap: 5px; padding: 2px 9px 2px 3px; font-size: 13px; }
.admin-light-small .admin-light-dot { width: 16px; height: 16px; font-size: 10px; }
.admin-light.status-ok { background: var(--status-ok-soft); color: var(--status-ok-ink); }
.admin-light.status-ok .admin-light-dot { background: var(--status-ok); }
.admin-light.status-ok .admin-light-dot::before { content: "✓"; }
.admin-light.status-warn { background: var(--status-warn-soft); color: var(--status-warn-ink); }
.admin-light.status-warn .admin-light-dot { background: var(--status-warn); }
.admin-light.status-warn .admin-light-dot::before { content: "!"; }
.admin-light.status-bad { background: var(--status-bad-soft); color: var(--status-bad-ink); }
.admin-light.status-bad .admin-light-dot { background: var(--status-bad); }
.admin-light.status-bad .admin-light-dot::before { content: "✕"; }
.admin-light.status-off { background: var(--status-off-soft); color: var(--status-off-ink); }
.admin-light.status-off .admin-light-dot { background: var(--status-off); }
.admin-light.status-off .admin-light-dot::before { content: "–"; }
.admin-light.admin-light-info .admin-light-dot::before { content: "i"; }   /* Ereignis „Info“ */

/* Übersicht: Gesamtzustand, Fehler, Dienste, Kennzahlen */
.admin-summary { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--gap); }
.admin-summary .card { margin: 0; }
.admin-overall { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.admin-overall-text { margin: 0; color: var(--heading); font-size: 22px; font-weight: 700; line-height: 1.25; }
.admin-overall .hint { margin: 0; }
.admin-errors-label { margin: 0; color: var(--text-muted); font-size: 15px; }
.admin-errors-count { margin: 0 0 4px; color: var(--heading); font-size: 34px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.admin-errors-count.is-bad { color: var(--status-bad-ink); }

.admin-services, .admin-events { margin: 0; padding: 0; list-style: none; }
.admin-service {
  display: grid;
  grid-template-columns: 172px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 18px;
  padding: 14px 18px;
}
.admin-service + .admin-service, .admin-event + .admin-event { border-top: 1px solid var(--sep); }
.admin-service-label { margin: 0; color: var(--heading); font-size: 17px; font-weight: 600; }
.admin-service-text { margin: 2px 0 0; color: var(--text-muted); font-size: 15px; }
.admin-service-check { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 8px 0 0; color: var(--text); font-size: 14px; }
.admin-service-side { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.admin-service-at { margin: 0; color: var(--text-muted); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.admin-stat-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.card.admin-stat-group { margin: 0; padding: 16px 18px 18px; }
.admin-stat-title { margin: 0 0 10px; color: var(--heading); font-size: 17px; font-weight: 600; }
.admin-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.admin-stat {
  display: flex;
  flex-direction: column-reverse;   /* Zahl oben, Beschriftung darunter; vorgelesen wird „Beschriftung, Zahl“ */
  justify-content: flex-end;
  padding: 10px 12px;
  border-radius: var(--radius-small);
  background: var(--surface-2);
}
.admin-stat dt { color: var(--text-muted); font-size: 13px; line-height: 1.3; }
.admin-stat dd { margin: 0; color: var(--heading); font-size: 26px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.admin-stat.is-notable { background: var(--status-warn-soft); }
.admin-stat.is-notable dt, .admin-stat.is-notable dd { color: var(--status-warn-ink); }

/* Filterzeilen (Konten, Protokoll) */
.admin-filters {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 12px;
  margin: 0 0 14px;
}
.admin-filters .field { margin: 0; }
.admin-filters label { margin-bottom: 4px; font-size: 13px; }
.admin-filters input[type="search"], .admin-filters select { min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
.admin-filters input[type="search"] { padding-left: 12px; padding-right: 12px; }
#view-protokoll .admin-filters { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
.admin-filter-actions { display: flex; gap: 8px; }
.admin-filter-actions .admin-btn-small.btn-primary, .admin-filter-actions .admin-btn-small.btn-secondary { min-height: 44px; }
.admin-field-hint { margin: 6px 0 0; font-size: 13px; }

/* Kontenliste: Tabelle am Arbeitsplatz */
.card.admin-table-wrap { padding: 0; margin: 0; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 11px 14px; text-align: left; vertical-align: top; white-space: nowrap; }
.admin-table thead th {
  padding-top: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--sep);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.admin-table tbody tr { cursor: pointer; }
.admin-table tbody tr + tr > * { border-top: 1px solid var(--sep); }
.admin-table tbody tr:hover > * { background: var(--surface-2); }
.admin-table th.num, .admin-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table .admin-col-name { min-width: 260px; white-space: normal; font-weight: 400; }
.admin-row-link { color: var(--heading); font-size: 15px; font-weight: 600; text-decoration: none; }
.admin-row-link:hover { text-decoration: underline; }
.admin-sub { display: block; margin-top: 2px; color: var(--text-muted); font-size: 13px; overflow-wrap: anywhere; }

.admin-role {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--fill-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  vertical-align: 1px;
}
.admin-role-admin { background: var(--accent); color: var(--on-accent); }
.admin-role-team { background: var(--brass-soft); color: var(--brass-ink); }
.admin-locked {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--status-bad-soft);
  color: var(--status-bad-ink);
  font-size: 12px;
  font-weight: 600;
  vertical-align: 1px;
}
.admin-state { color: var(--text-muted); }
.admin-state.is-readonly { color: var(--status-warn-ink); font-weight: 600; }

/* Kontenliste: Karten am Handy */
.admin-cards { display: none; margin: 0; padding: 0; overflow: hidden; border-radius: var(--radius); background: var(--surface); list-style: none; }
.admin-cards > li + li { border-top: 1px solid var(--sep); }
.admin-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 12px 14px 12px 16px;
  color: var(--text);
  text-decoration: none;
}
.admin-card:hover { background: var(--surface-2); }
.admin-card:focus-visible { outline-offset: -3px; }
.admin-card-body { display: flex; flex: 1; flex-direction: column; gap: 1px; min-width: 0; }
.admin-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; }
.admin-card-top .admin-locked { margin-left: 0; }
.admin-card-name { color: var(--heading); font-size: 17px; font-weight: 600; }
.admin-card-line { color: var(--text-muted); font-size: 14px; overflow-wrap: anywhere; }
.admin-card-chevron { color: var(--chevron); }

/* Protokoll und „Letzte Ereignisse“ */
.admin-event { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: start; gap: 4px 14px; padding: 12px 18px; }
.admin-event .admin-light { margin-top: 1px; }
.admin-event-text { margin: 0; color: var(--text); font-size: 15px; font-weight: 500; }
.admin-event-meta { margin: 2px 0 0; color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.admin-event-meta a { color: var(--link); }
.admin-more { margin-top: 14px; }

/* Konto-Detail */
.admin-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  margin: -10px 0 2px -6px;
  padding: 0 8px 0 2px;
  border-radius: 8px;
  color: var(--link);
  font-weight: 500;
  text-decoration: none;
}
.admin-back .ic { width: 22px; height: 22px; }
.admin-back:hover { text-decoration: underline; }
.admin-detail-head { margin-bottom: 16px; }
.admin-detail-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 0; color: var(--text-muted); font-size: 15px; }
.admin-detail-sub .admin-locked { margin-left: 0; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; }
.btn-secondary.admin-action {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--radius-small);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 15px;
}
.btn-secondary.admin-action:hover:not(:disabled) { background: var(--surface-2); }
.admin-action-danger { color: var(--status-bad-ink); }
.admin-own-hint { max-width: 60em; margin: 0 0 12px; }
.admin-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  align-items: start;
  gap: var(--gap);
  margin-top: 18px;
}
.card.admin-facts { margin: 0; padding: 14px 18px; }
.admin-facts-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
h2.admin-facts-title {
  display: block;
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.admin-facts dl { margin: 0; }
.admin-facts dl > div { display: grid; grid-template-columns: minmax(0, 12em) minmax(0, 1fr); gap: 10px; padding: 8px 0; font-size: 15px; }
.admin-facts dl > div + div { border-top: 1px solid var(--sep); }
.admin-facts dt { color: var(--text-muted); }
.admin-facts dd { margin: 0; color: var(--text); overflow-wrap: break-word; min-width: 0; }
.card.admin-detail-events { margin-top: var(--gap); padding-bottom: 4px; }
.admin-detail-events .admin-events { margin: 4px -18px 0; border-top: 1px solid var(--sep); }
.admin-detail-events .admin-empty { padding: 10px 0 12px; }

/* Dialoge: Zugangsdaten (einmal angezeigt), Löschen */
.admin-dialog .admin-dialog-body > p { margin: 0 0 14px; }
.admin-dialog .field { margin-bottom: 16px; }
.admin-credentials { margin: 0 0 12px; padding: 2px 14px; border-radius: var(--radius-small); background: var(--surface-2); }
.admin-credentials > div { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); align-items: baseline; gap: 10px; padding: 9px 0; }
.admin-credentials > div + div { border-top: 1px solid var(--sep); }
.admin-credentials dt { color: var(--text-muted); font-size: 14px; }
.admin-credentials dd { margin: 0; overflow-wrap: anywhere; }
.admin-password {
  color: var(--heading);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: clamp(16px, 4.6vw, 20px);
  font-weight: 600;
  letter-spacing: 0.03em;
  /* Darf umbrechen (bevorzugt an den Bindestrichen), sonst ragt ein langes Passwort aus dem Dialog. */
  overflow-wrap: anywhere;
  user-select: all;
}
.admin-result-note { margin: 0 0 12px; }
.btn-primary.admin-btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-primary.admin-btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

/* Einstellungen (admin-settings.js): Mailversand links, OPUS/Campus/Adressen rechts, schmal untereinander.
   Je Feld: Beschriftung, Herkunft (Messing = im Dashboard gesetzt), „Zurücksetzen“, Eingabe, Hinweis/Fehler. */
.admin-settings-intro { max-width: 60em; margin: -8px 0 18px; }
.admin-settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: var(--gap); }
.admin-settings-col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.card.admin-settings-card { margin: 0; padding: 18px 18px 20px; }
.admin-settings-card .notice { margin-bottom: 14px; }
h2.admin-settings-title { display: block; margin: 0 0 4px; font-size: 20px; }
.admin-settings-text { margin: 0 0 16px; font-size: 14px; }
.admin-settings-fields { display: flex; flex-direction: column; gap: 16px; }
.admin-settings-fields .field { margin: 0; }
.admin-setting-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.admin-setting-name { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; min-height: 28px; }
.admin-setting-name label { margin: 0; }
.admin-source {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.admin-source.is-dashboard { background: var(--brass-soft); color: var(--brass-ink); }
.admin-reset {
  flex: none;
  min-height: 28px;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.admin-reset:hover:not(:disabled) { text-decoration: underline; }
.admin-reset:disabled { opacity: 0.45; cursor: progress; }
.admin-setting input[aria-invalid="true"], .admin-testmail input[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: inset 0 0 0 1px var(--error);
}
.admin-secret-row { display: flex; gap: 8px; }
.admin-secret-row input { flex: 1; min-width: 0; }
.admin-secret-row .admin-secret-toggle { flex: none; }
/* Geheimfelder sind type=text (sonst füllt iPhone-Safari das Admin-Passwort ein) und werden hier maskiert */
.admin-secret { -webkit-text-security: disc; text-security: disc; }
.admin-secret.is-shown { -webkit-text-security: none; text-security: none; }
.admin-field-error { margin: 6px 0 0; color: var(--error); font-size: 14px; font-weight: 600; }
.admin-field-note { margin: 6px 0 0; color: var(--status-warn-ink); font-size: 14px; font-weight: 500; }
.admin-settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.admin-settings-dirty, .admin-settings-status { margin: 10px 0 0; font-size: 14px; }
.admin-settings-dirty { color: var(--status-warn-ink); }
.admin-settings-status { color: var(--heading); font-weight: 500; }
.admin-settings-status:empty { display: none; }
.admin-settings-check, .admin-testmail { margin: 18px -18px 0; padding: 16px 18px 0; border-top: 1px solid var(--sep); }
.admin-settings-check-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.admin-settings-check-hint { margin: 0; font-size: 13px; }
.admin-check-result { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 10px 0 0; color: var(--text); font-size: 14px; }
.admin-check-pending { color: var(--text-muted); }
h3.admin-settings-subtitle { margin: 0 0 10px; color: var(--heading); font-size: 17px; font-weight: 600; }
.admin-testmail-row { display: flex; gap: 10px; }
.admin-testmail-row input { flex: 1; min-width: 0; }
.admin-testmail-row .btn-secondary { flex: none; }

/* Anmeldeseite der Verwaltung */
.admin-login-body .admin-bar-inner { justify-content: center; }
.admin-login-page { padding-top: 40px; }
.admin-login-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: var(--admin-band);
  color: var(--brass);
}
.admin-login-mark .ic { width: 30px; height: 30px; }

/* Schmaler Arbeitsplatz: Name der App und des Kontos weglassen, Reiter enger, damit die vier Bereiche und das
   Menü ins Band passen (768 px) */
@media (min-width: 768px) and (max-width: 999px) {
  .admin-body:not(.admin-login-body) .admin-brand-name { display: none; }
  .admin-nav-link { gap: 6px; padding: 6px 10px; }
  .admin-bar .account-name, .admin-bar .account-caret { display: none; }
  .admin-bar .account-button { padding: 4px 10px; }
  .admin-bar .account-icon { display: block; }
  .admin-summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .admin-stat-groups { grid-template-columns: minmax(0, 1fr); }
  .admin-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Einstellungen: unter 1000 px eine Spalte (zwei wären für die Felder zu schmal) */
@media (max-width: 999px) {
  .admin-settings { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
}

/* Handy (< 768 px): Navigation als Reiterleiste unten, Liste als Karten, alles untereinander */
@media (max-width: 767px) {
  .admin-bar-inner { min-height: 52px; gap: 8px; padding: 0 max(4px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
  .admin-brand { flex: 1; min-width: 0; }
  .admin-brand-name { font-size: 15px; }
  .admin-bar .account-button,
  .admin-bar .account-button:hover,
  .admin-bar .account-button[aria-expanded="true"] { background: radial-gradient(circle, var(--admin-band-current) 17.5px, transparent 18px); }

  .admin-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    gap: 0;
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--tabs-glass);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line);
  }
  .admin-nav-link {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: var(--tabs);
    padding: 6px 4px 4px;
    border-radius: 0;
    color: var(--text-muted);
    font-size: 12px;
  }
  .admin-nav-link:hover { background: transparent; color: var(--text); }
  .admin-nav-link[aria-current="page"] { background: transparent; color: var(--text); }
  .admin-nav-icon { width: 40px; height: 26px; padding: 2px 8px; border-radius: 13px; }
  .admin-nav-link[aria-current="page"] .admin-nav-icon { background: var(--fill); }
  .admin-nav-link:focus-visible { outline-offset: -3px; }

  .admin-main { padding: 18px 16px calc(var(--tabs) + env(safe-area-inset-bottom) + 28px); }
  .admin-title { font-size: 30px; line-height: 36px; }
  .admin-summary { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .admin-service { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 14px 16px; }
  .admin-service-side { justify-content: space-between; }
  .admin-service-side:empty { display: none; }
  .admin-stat-groups { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .btn-primary.admin-btn-small, .btn-secondary.admin-btn-small { min-height: 44px; }

  .admin-filters, #view-protokoll .admin-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .admin-filters .field:first-child, #view-protokoll .admin-filters .field:nth-child(3),
  .admin-filter-actions { grid-column: 1 / -1; }
  #view-protokoll .admin-filters .field:first-child { grid-column: auto; }
  .admin-filter-actions > * { flex: 1; }

  .card.admin-table-wrap { display: none; }
  .admin-cards { display: block; }

  .admin-event { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px 16px; }
  .admin-detail-events .admin-events { margin: 4px -16px 0; }
  .card.admin-facts { padding: 14px 16px; }
  .admin-detail-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .admin-facts dl > div { grid-template-columns: minmax(0, 1fr); gap: 1px; padding: 7px 0; }   /* Beschriftung über dem Wert */
  .admin-facts dt { font-size: 13px; }
  .admin-actions > * { flex: 1 1 calc(50% - 5px); }
  .admin-dialog .actions > * { flex: 1 1 100%; }
  .admin-credentials > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }   /* Passwort ungebrochen in einer Zeile */

  .admin-settings, .admin-settings-col { gap: 12px; }
  .card.admin-settings-card { padding: 16px 16px 18px; }
  .admin-settings-check, .admin-testmail { margin: 16px -16px 0; padding: 14px 16px 0; }
  .admin-settings-actions > .btn-primary { flex: 1; }
  .admin-testmail-row { flex-direction: column; }
}
