/* ------------------------------------------------------------------ *
 * Schriften – lokal ausgeliefert, kein CDN (CSP: font-src 'self')
 * ------------------------------------------------------------------ */

@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage-grotesque-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage-grotesque-latin-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Mono";
  src: url("/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Mono";
  src: url("/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

/* ------------------------------------------------------------------ *
 * Tokens
 * ------------------------------------------------------------------ */

:root {
  --night: #171f2b;
  --surface: #202b3a;
  --surface-light: #253243;
  --border: rgba(233, 238, 244, 0.1);
  --border-strong: rgba(233, 238, 244, 0.28);
  --fog: #8695a9;
  --chalk: #e9eef4;
  --apricot: #f2a96a;
  --apricot-light: #f7b87f;
  --moss: #86ae93;

  --display: "Bricolage", ui-sans-serif, system-ui, sans-serif;
  --text: "Atkinson", ui-sans-serif, system-ui, sans-serif;
  --mono: "Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--night);
  color: var(--chalk);
  font-family: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#app {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

.frame {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  padding: max(18px, env(safe-area-inset-top)) 22px
    max(20px, env(safe-area-inset-bottom));
  position: relative;
}

.stage {
  flex: 1;
  display: flex;
  align-items: center;
}

.card {
  width: 100%;
  animation: enter 0.32s cubic-bezier(0.2, 0.7, 0.3, 1);
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ------------------------------------------------------------------ *
 * Kopfzeile
 * ------------------------------------------------------------------ */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 18px;
}

.header-left {
  flex: 1;
  min-width: 0;
}

.header-buttons {
  display: flex;
  gap: 6px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fog);
  cursor: pointer;
  font-size: 15px;
  font-family: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.18s, color 0.18s;
}

.icon-button:hover {
  border-color: var(--border-strong);
  color: var(--chalk);
}

/* ------------------------------------------------------------------ *
 * Tagesband
 * ------------------------------------------------------------------ */

.band-line {
  position: relative;
  height: 2px;
  background: rgba(233, 238, 244, 0.12);
  border-radius: 2px;
}

.band-now {
  position: absolute;
  top: -3px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: var(--apricot);
  box-shadow: 0 0 0 4px rgba(242, 169, 106, 0.14);
  transition: left 0.6s ease;
}

.band-text {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--fog);
}

/* ------------------------------------------------------------------ *
 * Typografie
 * ------------------------------------------------------------------ */

.eyebrow {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fog);
}

.eyebrow.centered {
  text-align: center;
}

/*
 * Eine Zwischenueberschrift mitten im Text braucht Luft nach oben.
 *
 * .eyebrow hat nur einen unteren Abstand, weil sie normalerweise ganz oben
 * auf einer Karte steht. Im Impressum folgen mehrere Abschnitte
 * hintereinander, und dort klebte jede Ueberschrift am Absatz darueber.
 */
p + .eyebrow,
div + .eyebrow {
  margin-top: 24px;
}

.title,
.question,
.ramp-sentence {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.title {
  font-size: 38px;
  line-height: 1.07;
}

.title.muted {
  font-size: 27px;
  color: var(--fog);
  font-weight: 600;
}

.question {
  font-size: 32px;
  line-height: 1.12;
  margin-bottom: 28px;
}

.ramp-sentence {
  font-size: 28px;
  line-height: 1.22;
  font-weight: 600;
}

.duration {
  margin: 16px 0 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--fog);
}

/*
 * Dauer und Stift in einer Zeile.
 *
 * Der Stift bleibt leise: gleiche Farbe wie die Dauer, kein Rahmen, keine
 * Flaeche. Er soll auffindbar sein, nicht auffallen — auf dieser Karte ist
 * "Los" die Handlung, Bearbeiten die Nebensache.
 */
.duration-row {
  display: flex;
  align-items: center;
  gap: 6px;
  /*
   * Der Abstand gehoert an die ZEILE, nicht an den Text darin: sonst schiebt
   * das margin-top der Dauer den Text nach unten, waehrend der Knopf
   * mittig sitzt — und der Stift schwebt sichtbar darueber.
   */
  margin-top: 16px;
}

.duration-row .duration {
  margin: 0;
}

.edit-button {
  background: none;
  border: none;
  /*
   * Gross genug fuer einen Daumen, auch wenn das Zeichen klein ist.
   * Unter etwa 34 Pixeln trifft man auf dem Handy daneben — und danebentippen
   * heisst hier: versehentlich "Los" oder gar nichts.
   */
  min-width: 34px;
  min-height: 34px;
  padding: 0 8px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /*
   * Kraeftiger als die Dauer daneben.
   *
   * Mit --fog war er zwar da, aber nicht zu sehen: gleiche Farbe wie der
   * Text, duennes Zeichen, kleine Flaeche. Ein Bedienelement muss sich vom
   * Text abheben, sonst sucht man es nicht mal.
   */
  color: var(--chalk);
  opacity: 0.75;
  line-height: 1;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.edit-button:hover {
  opacity: 1;
  border-color: var(--border-strong);
  background: rgba(233, 238, 244, 0.06);
}

.edit-button:focus-visible {
  outline: 2px solid var(--apricot);
  outline-offset: 2px;
}

.footnote {
  margin: 18px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--fog);
}

/*
 * Der Hinweis kurz vor Schluss.
 *
 * Ruhig und mittig unter dem Titel. Bewusst KEIN Rot und kein Blinken: die
 * Meldung soll landen helfen, nicht hetzen.
 */
.footnote.soon {
  color: var(--apricot);
  animation: fade 0.4s ease;
}

/*
 * Der Hinweis auf eine Pause.
 *
 * Moos statt Apricot: das ist keine Warnung, sondern eine Fuersorge. Apricot
 * ist in dieser App die Farbe fuer "handle jetzt".
 */
.footnote.pause {
  color: var(--moss);
  margin-top: 22px;
}

.footnote.large {
  font-size: 15px;
  margin-top: 12px;
}

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

.button-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 32px;
}

/* Eine Knopfleiste, die noch zum Block darueber gehoert - etwa "Speichern"
   direkt unter den Feldern, die es speichert. */
.button-stack.tight {
  margin-top: 6px;
  margin-bottom: 26px;
}

.button {
  font-family: var(--text);
  font-size: 16px;
  padding: 17px 20px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  width: 100%;
  transition: transform 0.12s, background 0.18s, border-color 0.18s;
}

.button:active {
  transform: scale(0.985);
}

.button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
.energy-button:focus-visible {
  outline: 2px solid var(--apricot);
  outline-offset: 3px;
}

.button[disabled] {
  opacity: 0.5;
  cursor: default;
}

.primary {
  background: var(--apricot);
  color: #1a1108;
  font-weight: 700;
}

.primary:hover:not([disabled]) {
  background: var(--apricot-light);
}

.secondary {
  background: transparent;
  color: var(--chalk);
  border-color: var(--border);
}

.secondary:hover {
  border-color: var(--border-strong);
  background: rgba(233, 238, 244, 0.03);
}

.quiet {
  background: transparent;
  color: var(--fog);
  font-size: 14px;
  padding: 12px;
}

.quiet:hover {
  color: var(--chalk);
}

.narrow {
  width: auto;
  padding: 14px 18px;
  font-size: 14px;
}

/* ------------------------------------------------------------------ *
 * Formulare
 * ------------------------------------------------------------------ */

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fog);
  margin-bottom: 7px;
}

input {
  width: 100%;
  background: rgba(11, 16, 23, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px;
  color: var(--chalk);
  font-family: var(--text);
  font-size: 16px;
}

input::placeholder {
  color: var(--fog);
}

input:focus {
  outline: none;
  border-color: var(--apricot);
}

.message {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.45;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(242, 169, 106, 0.1);
  border: 1px solid rgba(242, 169, 106, 0.3);
  color: var(--apricot-light);
}

.message.good {
  background: rgba(134, 174, 147, 0.1);
  border-color: rgba(134, 174, 147, 0.3);
  color: var(--moss);
}

/* ------------------------------------------------------------------ *
 * Energie
 * ------------------------------------------------------------------ */

.energy-row {
  display: flex;
  gap: 10px;
}

.energy-button {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--chalk);
  transition: border-color 0.18s, background 0.18s;
}

.energy-button:hover,
.energy-button.active {
  border-color: var(--apricot);
  background: var(--surface-light);
}

.energy-icon {
  font-size: 17px;
  color: var(--apricot);
}

.energy-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
}

/* ------------------------------------------------------------------ *
 * Fokus-Scheibe
 * ------------------------------------------------------------------ */

.focus {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Auf schmalen Geraeten mitskalieren, statt fix 232 px zu bleiben. */
.disc-holder {
  position: relative;
  width: min(232px, 62vw);
  height: min(232px, 62vw);
  margin-bottom: 28px;
}

.disc {
  width: 100%;
  height: 100%;
}

.disc-base {
  fill: rgba(233, 238, 244, 0.045);
}

.disc-tick {
  stroke: rgba(233, 238, 244, 0.2);
  stroke-width: 1.5;
}

.disc-area {
  fill: var(--apricot);
}

/*
 * Die Restzeit in der Scheibe.
 *
 * Hier stand mix-blend-mode: difference mit weisser Schrift — der Gedanke war,
 * dass die Zahl sich automatisch vom Untergrund abhebt, egal ob sie gerade auf
 * der Apricot-Flaeche oder auf dem dunklen Rest steht.
 *
 * Das Ergebnis war ein kraeftiges Blau: Weiss minus Apricot (#F2A96A) ergibt
 * rechnerisch #0D5695. Eine Farbe, die im ganzen Farbsystem nicht vorkommt,
 * schlecht lesbar ist und nach einem Darstellungsfehler aussieht.
 *
 * Jetzt: helle Schrift mit dunklem Schatten. Lesbar auf beiden Untergruenden,
 * und die Farbe bleibt die der App.
 */
.disc-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-family: var(--display);
  pointer-events: none;
  color: var(--chalk);
  text-shadow: 0 1px 4px rgba(11, 16, 23, 0.55);
}

.number {
  font-size: min(56px, 15vw);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

/*
 * Die Sekunden standen mit align-self: flex-end und festem padding-bottom am
 * unteren Rand des Containers — nicht neben der Zahl. Auf schmalen Geraeten
 * rutschten sie damit sichtbar aus der Scheibe heraus.
 *
 * Jetzt haengen sie an der Grundlinie der grossen Zahl und wandern mit ihr.
 */
.seconds {
  font-size: min(21px, 5.6vw);
  font-weight: 600;
  opacity: 0.75;
  align-self: center;
  margin-top: 14px;
}

.focus-title {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
  text-align: center;
  margin: 0;
  letter-spacing: -0.01em;
}

/* ------------------------------------------------------------------ *
 * Schwung
 * ------------------------------------------------------------------ */

.momentum {
  margin-top: 32px;
}

.momentum-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fog);
  margin-bottom: 10px;
}

.momentum-value {
  color: var(--moss);
  font-size: 15px;
}

.momentum-track {
  height: 6px;
  background: rgba(233, 238, 244, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.momentum-fill {
  height: 100%;
  width: 0;
  background: var(--moss);
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* ------------------------------------------------------------------ *
 * Listen
 * ------------------------------------------------------------------ */

.list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
}

.list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}

.list li:last-child {
  border-bottom: none;
}

.entry-text {
  flex: 1;
  min-width: 0;
}

.entry-title {
  font-size: 16px;
  line-height: 1.3;
}

.entry-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fog);
  margin-top: 4px;
}

.mini {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fog);
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 12px;
  font-family: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.mini:hover {
  border-color: var(--border-strong);
  color: var(--chalk);
}

.scroll {
  max-height: 46dvh;
  overflow-y: auto;
}

/* ------------------------------------------------------------------ *
 * Parkplatz
 * ------------------------------------------------------------------ */

.park-button {
  position: fixed;
  right: max(22px, calc(50vw - 198px));
  bottom: max(22px, env(safe-area-inset-bottom));
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fog);
  cursor: pointer;
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: border-color 0.18s, color 0.18s;
}

.park-button:hover {
  border-color: var(--apricot);
  color: var(--apricot);
}

.park-count {
  position: absolute;
  top: -3px;
  right: -3px;
  background: var(--apricot);
  color: #1a1108;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  min-width: 19px;
  height: 19px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layer {
  position: fixed;
  inset: 0;
  background: rgba(11, 16, 23, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
  animation: fade 0.2s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.sheet {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 22px 22px 0 0;
  padding: 26px 22px max(22px, env(safe-area-inset-bottom));
  animation: slide-up 0.28s cubic-bezier(0.2, 0.7, 0.3, 1);
  max-height: 88dvh;
  overflow-y: auto;
}

@keyframes slide-up {
  from {
    transform: translateY(100%);
  }
}

.sheet-title {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}

.row {
  display: flex;
  gap: 8px;
}

.row input {
  flex: 1;
}

/* ------------------------------------------------------------------ *
 * Diverses
 * ------------------------------------------------------------------ */

.badge {
  font-family: var(--display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
  margin: 0;
}

.plan-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--fog);
}

.plan-badge.premium {
  border-color: var(--apricot);
  color: var(--apricot);
}

.loading {
  text-align: center;
  color: var(--fog);
  font-family: var(--mono);
  font-size: 12px;
  padding: 40px 0;
}

@media (max-width: 380px) {
  .title {
    font-size: 33px;
  }
  .question {
    font-size: 28px;
  }
  .ramp-sentence {
    font-size: 24px;
  }
  .disc-holder {
    width: 198px;
    height: 198px;
  }
  .number {
    font-size: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ------------------------------------------------------------------ *
 * Feldfehler
 *
 * Apricot statt Rot. Die App verwendet nirgends eine Alarmfarbe: Rot
 * beschaemt und motiviert hier nicht. Ein danebengegangenes Feld ist ein
 * Hinweis, keine Verfehlung.
 * ------------------------------------------------------------------ */

input.wrong {
  border-color: var(--apricot);
  background: rgba(242, 169, 106, 0.06);
}

/* ------------------------------------------------------------------ *
 * Trenner zwischen Passkey- und Passwortweg
 * ------------------------------------------------------------------ */

.separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fog);
}

.separator::before,
.separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ------------------------------------------------------------------ *
 * Diktierknopf
 * ------------------------------------------------------------------ */

.button-mic {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(11, 16, 23, 0.5);
  color: var(--chalk);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.button-mic:hover {
  border-color: var(--border-strong);
}

.button-mic:focus-visible {
  outline: 2px solid var(--apricot);
  outline-offset: 2px;
}

/* Waehrend der Aufnahme: ruhiges Pulsieren, kein Blinken. */
.button-mic.listening {
  border-color: var(--apricot);
  background: rgba(242, 169, 106, 0.12);
  animation: mic-pulse 1.8s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(242, 169, 106, 0.28);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(242, 169, 106, 0);
  }
}

/* Wer Bewegung reduziert haben will, bekommt keine. */
@media (prefers-reduced-motion: reduce) {
  .button-mic.listening {
    animation: none;
  }
  .card {
    animation: none;
  }
  .band-now {
    transition: none;
  }
}

/* ------------------------------------------------------------------ *
 * Abschnitt im Konto-Blatt (Passkeys)
 * ------------------------------------------------------------------ */

.section {
  margin: 22px 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.section .eyebrow {
  margin-bottom: 8px;
}

.section .list {
  margin: 12px 0;
}

/* ------------------------------------------------------------------ *
 * Kleinigkeiten
 * ------------------------------------------------------------------ */

.footnote.quiet {
  color: var(--fog);
  opacity: 0.75;
  font-size: 12px;
}

.text-link {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px 0;
  background: none;
  border: none;
  color: var(--fog);
  font-family: var(--text);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.text-link:hover {
  color: var(--chalk);
}

.text-link:focus-visible {
  outline: 2px solid var(--apricot);
  outline-offset: 2px;
}

/* Gezeichnetes Mikrofon — kein Emoji, damit es ueberall gleich aussieht. */
.mic-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.button-mic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button-mic.listening {
  color: var(--apricot);
}

/* Gezeichnetes Hirn auf dem Parkplatz-Knopf. Der Parkplatz ist der Ort fuer
   den Gedanken, der gerade dazwischenfunkt — ein Pfeil sagte das nicht. */
.park-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* "Das zuerst" — ruhig markiert, ohne Alarmfarbe. */
.eyebrow.first {
  color: var(--apricot);
}

.mini.active {
  border-color: var(--apricot);
  color: var(--apricot);
  background: rgba(242, 169, 106, 0.1);
}

/* Waehrend das Mikrofon geoeffnet wird - noch nicht aufnehmend. */
.button-mic.waiting {
  border-color: var(--border-strong);
  opacity: 0.7;
}

/* ==================================================================
 * Adminbereich (/admin)
 *
 * Bewusst dicht und nuechtern. Die Gestaltungsregeln der App - eine Karte,
 * viel Luft, keine Zahlenwand - schuetzen Menschen mit ADHS beim Arbeiten.
 * Die Verwaltung ist ein Werkzeug fuer den Betrieb; hier ist Uebersicht ueber
 * viele Konten wichtiger als Ruhe.
 * ================================================================== */

/*
 * Der Adminbereich uebernimmt #app selbst als Container.
 *
 * #app ist fuer die App ein zentrierender Flex-Container - dort haengt genau
 * ein schmaler Rahmen drin. Ohne diese Ueberschreibung wuerden hier alle
 * Abschnitte zu nebeneinanderliegenden Flex-Spalten, in voller Hoehe
 * gestreckt. Die ID in der Auswahl ist noetig, um #app zu ueberstimmen.
 */
#app.admin,
.admin {
  display: block;
  min-height: auto;
  max-width: 900px;
  margin: 0 auto;
  /*
   * Oben und unten den sicheren Bereich beruecksichtigen.
   *
   * Ohne das liegt die Ueberschrift auf dem iPhone unter der Uhr und dem
   * Dynamic Island — sichtbar wird das erst in der PWA vom Startbildschirm,
   * im Browsertab nicht. Die App selbst macht es in .frame genauso.
   */
  padding: max(20px, env(safe-area-inset-top)) 16px
    max(60px, calc(env(safe-area-inset-bottom) + 40px));
  font-family: var(--text);
}

.adm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.adm-title {
  margin: 0;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 800;
  color: var(--chalk);
}

/* -- Kennzahlen -- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
}

.metric-value {
  display: block;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 800;
  color: var(--chalk);
  line-height: 1.1;
}

.metric-text {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--fog);
}

/* -- Reiter -- */

.adm-tab-row {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.adm-tab {
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  color: var(--fog);
  font-family: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.adm-tab.active {
  border-color: var(--apricot);
  color: var(--apricot);
  background: rgba(242, 169, 106, 0.08);
}

/* -- Suche und Liste -- */

.adm-search {
  width: 100%;
  margin-bottom: 12px;
}

.adm-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.adm-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

/* Gesperrte Konten sind erkennbar, aber nicht rot - auch hier keine Alarmfarbe. */
.adm-row.is-blocked {
  opacity: 0.62;
  border-style: dashed;
}

.adm-row-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 5px;
}

.adm-mail {
  font-weight: 700;
  color: var(--chalk);
  word-break: break-all;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.badge {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  color: var(--fog);
}

.badge.admin {
  border-color: var(--apricot);
  color: var(--apricot);
}

.badge.premium {
  border-color: var(--moss);
  color: var(--moss);
}

.badge.blocked {
  border-style: dashed;
}

.adm-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fog);
  line-height: 1.6;
}

.adm-meta.base {
  color: var(--apricot);
  margin-top: 2px;
}

/* -- Aktionen -- */

.adm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.adm-button {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 6px 11px;
  color: var(--chalk);
  font-family: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.adm-button:hover:not([disabled]) {
  border-color: var(--chalk);
}

.adm-button[disabled] {
  opacity: 0.4;
  cursor: default;
}

.adm-button.good {
  border-color: var(--moss);
  color: var(--moss);
}

/* Loeschen ist die einzige Aktion, die sich nicht zuruecknehmen laesst -
   sie darf sich deshalb vom Rest abheben. Trotzdem kein Rot. */
.adm-button.danger {
  border-color: var(--apricot);
  color: var(--apricot);
}

.adm-button:focus-visible,
.adm-tab:focus-visible {
  outline: 2px solid var(--apricot);
  outline-offset: 2px;
}

/* -- Meldungen und Texte -- */

.adm-message {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  background: rgba(242, 169, 106, 0.1);
  border: 1px solid rgba(242, 169, 106, 0.3);
  color: var(--apricot-light);
}

.adm-message.good {
  background: rgba(134, 174, 147, 0.1);
  border-color: rgba(134, 174, 147, 0.3);
  color: var(--moss);
}

.adm-text {
  color: var(--fog);
  font-size: 13px;
  line-height: 1.6;
}

/* -- Protokoll -- */

.adm-log {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--mono);
  font-size: 11px;
}

/*
 * Vier Spalten, nicht drei: Zeitpunkt, Aktion, Konto, Details.
 *
 * Vorher standen hier drei — die vierte Spalte rutschte damit in eine neue
 * Rasterzeile und alles darunter war um eine Spalte verschoben.
 */
.adm-entry {
  display: grid;
  grid-template-columns: 110px 190px 200px 1fr;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--fog);
}

.adm-entry .adm-action {
  color: var(--chalk);
}

.adm-entry .adm-time,
.adm-entry .adm-who,
.adm-entry .adm-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Auf schmalen Geraeten untereinander statt vierspaltig gequetscht. */
@media (max-width: 720px) {
  .adm-entry {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 10px 8px;
  }

  .adm-entry .adm-detail {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

.adm-entry .adm-detail {
  word-break: break-all;
  opacity: 0.7;
}

@media (max-width: 640px) {
  .adm-entry {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* ==================================================================
 * Dialoge (public/dialog.js)
 *
 * Ersetzen window.prompt und window.confirm. Bewusst im Stil der App:
 * dunkel, ruhig, Apricot als einzige Signalfarbe - auch beim Loeschen kein
 * Rot. Eine Rueckfrage soll klar sein, nicht bedrohlich.
 * ================================================================== */

.dlg-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(11, 16, 23, 0.72);
  backdrop-filter: blur(3px);
  animation: dlg-fade 0.16s ease;
}

@keyframes dlg-fade {
  from {
    opacity: 0;
  }
}

.dlg-box {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(11, 16, 23, 0.55);
  animation: dlg-enter 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes dlg-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dlg-layer,
  .dlg-box {
    animation: none;
  }
}

.dlg-title {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--chalk);
}

.dlg-text {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fog);
}

.dlg-field {
  width: 100%;
  margin-bottom: 6px;
}

.dlg-field.choice {
  font-family: var(--mono);
  font-size: 12px;
}

.dlg-hint {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--fog);
  opacity: 0.8;
}

.dlg-error {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--apricot);
}

.dlg-buttons {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.dlg-button {
  flex: 1;
  border-radius: 12px;
  padding: 13px 16px;
  border: 1px solid var(--border-strong);
  background: none;
  color: var(--chalk);
  font-family: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dlg-button.primary {
  background: var(--apricot);
  border-color: var(--apricot);
  color: var(--night);
}

.dlg-button.primary:hover {
  background: var(--apricot-light);
}

/* Loeschen ist die einzige Aktion, die sich nicht zuruecknehmen laesst. Sie
   hebt sich ab - aber ohne Alarmfarbe, das bleibt Hauspolitik. */
.dlg-button.danger {
  border-color: var(--apricot);
  color: var(--apricot);
}

.dlg-button.danger:hover {
  background: rgba(242, 169, 106, 0.12);
}

.dlg-button.quiet {
  color: var(--fog);
  border-color: var(--border);
}

.dlg-button.quiet:hover {
  color: var(--chalk);
  border-color: var(--border-strong);
}

.dlg-button:focus-visible {
  outline: 2px solid var(--apricot);
  outline-offset: 2px;
}

/* Die eigene Zeile im Adminbereich. Dezent hervorgehoben - man soll auf einen
   Blick sehen, welches Konto das eigene ist, weil sich dort drei Aktionen
   anders verhalten. */
.adm-row.is-self {
  border-color: var(--border-strong);
  background: linear-gradient(rgba(242, 169, 106, 0.04), rgba(242, 169, 106, 0.04)), var(--surface);
}

.badge.self {
  border-color: var(--chalk);
  color: var(--chalk);
}

/* Abgeschaltete Knoepfe: erkennbar vorhanden, aber sichtbar nicht benutzbar. */
.adm-button[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ==================================================================
 * Ketten und Wiederholungen
 * ================================================================== */

/* Fortschritt einer Kette. Eine Ortsangabe ("Schritt 3 von 5"), keine
   Restschuld - und kein Balken, der sich leert. */
/* Der negative Abstand hier war zu gross: die Zeile schob sich in die
   Dauer-Angabe darueber und die beiden ueberlappten sichtbar. */
.chain-state {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.06em;
  color: var(--fog);
}

/* Zwischen Dauer und Kettenangabe etwas Luft, danach zum Knopfstapel mehr. */
.duration + .chain-state {
  margin-top: 10px;
}

.chain-state:last-of-type {
  margin-bottom: 20px;
}

/* Auswahl der Wiederholung */
.repeat-row,
.day-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.day-block {
  margin-top: 14px;
}

.day-label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fog);
  margin-bottom: 7px;
}

/*
 * display: flex sticht das hidden-Attribut aus — ohne diese Regel bliebe die
 * Tagesauswahl sichtbar, obwohl sie ausgeblendet sein soll.
 *
 * Das hidden sitzt am Block, nicht mehr an der Reihe: seit die Ueberschrift
 * dazugekommen ist, muessen beide zusammen verschwinden.
 */
.day-block[hidden] {
  display: none;
}

.repeat-button,
.day-button {
  background: rgba(11, 16, 23, 0.5);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--fog);
  font-family: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.day-button {
  min-width: 42px;
  text-align: center;
}

.repeat-button:hover,
.day-button:hover {
  border-color: var(--border-strong);
  color: var(--chalk);
}

.repeat-button.active,
.day-button.active {
  border-color: var(--apricot);
  color: var(--apricot);
  background: rgba(242, 169, 106, 0.1);
}

.repeat-button:focus-visible,
.day-button:focus-visible {
  outline: 2px solid var(--apricot);
  outline-offset: 2px;
}

/* Erledigte Schritte bleiben sichtbar, treten aber zurueck. Durchgestrichen
   bewusst nicht: das liest sich wie Streichung, nicht wie Erfolg. */
.list li.done {
  opacity: 0.45;
}

/* ==================================================================
 * Landeplatz, Rueckmeldung, Schaetzung
 * ================================================================== */

/* Wo man beim letzten Mal war. Ruhig gesetzt - es ist eine Hilfe, keine
   Mahnung, und schon gar kein "du hast das liegen lassen". */
.landing {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-left: 2px solid var(--border-strong);
  font-size: 13px;
  line-height: 1.55;
  color: var(--fog);
}

.feedback-field {
  width: 100%;
  min-height: 120px;
  background: rgba(11, 16, 23, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  color: var(--chalk);
  font-family: var(--text);
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
}

.feedback-field::placeholder {
  color: var(--fog);
}

.feedback-field:focus {
  outline: none;
  border-color: var(--apricot);
}

.feedback-field.wrong {
  border-color: var(--apricot);
}

/* ------------------------------------------------------------------ *
 * Schritte direkt beim Anlegen
 *
 * Bewusst schmaler und leiser als die Aufgabenliste: das hier ist eine
 * Nebensache im Formular und darf optisch nicht mit der Aufgabe selbst
 * konkurrieren.
 * ------------------------------------------------------------------ */

.step-list {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
}

.step-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.step-row:last-child {
  border-bottom: none;
}

/*
 * Die beiden Spans muessen die Beschriftungsregel von .field span
 * zuruecknehmen — sonst stuenden die Schritte in Grossbuchstaben und
 * gesperrt, wie eine Feldbeschriftung.
 *
 * Die Klasse der Zeile steht mit im Selektor, weil ".field span" mit (0,1,1)
 * spezifischer ist als ein einzelner Klassenname. Ohne sie gewinnt die
 * Beschriftungsregel und die Ruecknahme bleibt wirkungslos.
 */
.step-row .step-number,
.step-row .step-text {
  display: inline;
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
}

.step-row .step-number {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fog);
  min-width: 14px;
}

.step-row .step-text {
  flex: 1;
  min-width: 0;
  font-family: var(--text);
  font-size: 15px;
  line-height: 1.35;
  color: var(--chalk);
  overflow-wrap: anywhere;
}

/*
 * Ein Knopf neben einer Eingabe.
 *
 * .button ist auf volle Breite ausgelegt — in einer Zeile mit einem Feld
 * wuerde er es sonst erdruecken.
 */
.button.tight {
  width: auto;
  flex: 0 0 auto;
  padding: 0 18px;
  font-size: 15px;
}

/*
 * "Das schiebst du oefter."
 *
 * Steht als eigene Zeile unter der Karte, nicht als Knopf: ein Knopf waere
 * eine Aufforderung, und aufgefordert wird hier niemand. Moos statt Apricot,
 * weil es keine Handlung ist, die jetzt dran waere.
 */
.text-link.too-big {
  display: block;
  width: auto;
  margin: 14px 0 0;
  padding: 0;
  text-align: left;
  font-size: 13px;
  line-height: 1.5;
  color: var(--moss);
}

/* Ein Textlink mitten im Fliesstext, etwa "Dann 25". */
.text-link.tight {
  display: inline;
  width: auto;
  margin: 0;
  padding: 0;
  font-size: inherit;
  color: var(--apricot);
}

/* Rueckmeldungen im Adminbereich */
.feedback-text {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: rgba(11, 16, 23, 0.4);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--chalk);
  white-space: pre-wrap;
  word-break: break-word;
}

.adm-row.is-read {
  opacity: 0.6;
}

/* ==================================================================
 * Body Doubling
 *
 * Ein Raum zeigt nur Praesenz. Deshalb gibt es hier auch keine Balken,
 * Prozente oder Vergleiche - nur Namen und einen Punkt.
 * ================================================================== */

.room-list li {
  align-items: center;
}

/* Wer laeuft, bekommt einen ruhigen Punkt - kein Blinken, keine Farbe, die
   Dringlichkeit signalisiert. */
.room-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
}

.room-dot.on {
  background: var(--moss);
  border-color: var(--moss);
  box-shadow: 0 0 0 4px rgba(134, 174, 147, 0.15);
}

.room-list li.running .entry-title {
  color: var(--moss);
}

/* Der Code zum Weitergeben: gross und gut abzulesen. */
.room-code {
  margin: 0;
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--apricot);
  text-align: center;
  padding: 14px;
  background: rgba(11, 16, 23, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.room-code-field {
  font-family: var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* Abgeschaltete Mini-Knoepfe (etwa "Hoch" beim obersten Schritt). */
.mini[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Bei vielen Knoepfen pro Zeile umbrechen statt quetschen. */
.list li {
  flex-wrap: wrap;
}

/* Zwischen einem Erklaertext und dem folgenden Eingabefeld braucht es Luft -
   sonst liest sich die Feldbeschriftung wie eine Fortsetzung des Absatzes. */
.footnote + .field,
.message + .field {
  margin-top: 18px;
}
