/* Reflect -- dunkles Theme nach dem Muster von ADAPT, mit Beeren-Akzent.
   --accent ist der helle Ton des Logo-E (#A02B5A): dunkler waere auf --bg als Text zu schwach. */
:root {
  --bg: #08080b;
  --surface: #141419;
  --surface-2: #1e1e26;
  --border: #262630;
  --border-2: #363644;
  --text: #e2ddd6;
  --text-2: #7e7e90;
  --accent: #e0568f;
  --accent-ink: #2a0714;
  --danger: #f0615a;
  --success: #3ecf6e;
  --warn: #f2c230;

  /* Aktivitaeten im Diagramm. Bewusst nicht der Akzent: der ist die Kurve selbst. */
  --marker-session: #4a90e2;
  --marker-rehab: #a374f0;
  --marker-ride: #f59c48;
  --marker-sport: #3ecf6e;
  /* Sitzen: blau, gelb, orange -- ohne Gut/Schlecht-Wertung. */
  --seat-main: #4a90e2;
  --seat-partly: #f2c230;
  --seat-none: #f59c48;

  --radius-sm: 5px;
  --radius: 10px;
  --touch: 48px;
  --top: 58px;
  --nav: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  padding-top: var(--top);
  padding-bottom: var(--nav);
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Kopfleiste */
.top-bar {
  position: fixed; inset: 0 0 auto 0; height: var(--top); z-index: 10;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.top-bar-inner {
  max-width: 480px; height: 100%; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand-wordmark { height: 19px; width: auto; display: block; }
.logout-link { font-size: .78rem; color: var(--text-2); text-decoration: none; }
.logout-link:hover { color: var(--text); }

/* Inhalt */
main { max-width: 480px; margin: 0 auto; padding: 24px 20px 88px; }
h1 { font-size: 1.4rem; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 20px; }
h2 { font-size: .72rem; font-weight: 600; color: var(--text-2); margin: 28px 0 10px; }
h3 { font-size: .88rem; margin: 0 0 6px; }
p { margin: 0 0 12px; }

/* Navigation: unten auf dem Handy, links ab 900px */
.site-nav {
  position: fixed; inset: auto 0 0 0; height: var(--nav); z-index: 10; display: flex;
  background: var(--bg); border-top: 1px solid var(--border);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; font-size: .62rem; font-weight: 500; color: var(--text-2); text-decoration: none;
}
.nav-item svg {
  width: 21px; height: 21px; stroke: currentColor; stroke-width: 1.75; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}
.nav-item.active { color: var(--accent); }
.nav-item.disabled { opacity: .4; cursor: default; }
.nav-desktop-only { display: none; }
.nav-toggle { display: none; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.top-gear {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--touch); height: var(--touch); color: var(--text-2);
}
.top-gear:hover { color: var(--text); }
.top-gear svg {
  width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.75; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}

.fab {
  position: fixed; right: 16px; bottom: calc(var(--nav) + 16px); z-index: 9;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 56px; height: 56px; border-radius: 50%; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
  box-shadow: 0 4px 14px rgb(0 0 0 / .5);
}
.fab:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.fab-plus { font-size: 1.8rem; line-height: 1; }
.fab-label {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Karten, Listen, Kennzahlen */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.empty { color: var(--text-2); font-size: .88rem; padding: 28px 0; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.stat-value { font-size: 1.25rem; font-weight: 600; }
.stat-label { font-size: .72rem; color: var(--text-2); }

/* Schaltflaechen und Felder */
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: var(--touch);
  padding: 0 16px; border-radius: var(--radius); border: 1px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-2); }
.field { display: block; font-size: .78rem; color: var(--text-2); margin-bottom: 14px; }
input, select {
  display: block; width: 100%; min-height: var(--touch); margin-top: 6px; padding: 0 12px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font: inherit; font-size: .95rem;
}
input:focus, select:focus { border-color: var(--accent); }

/* Uebersicht */
.pain-filter { display: flex; gap: 8px; margin-bottom: 16px; }
.pain-filter select { flex: 1; margin-top: 0; }
.report-regions { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0 16px; }
.report-regions label { display: flex; align-items: center; gap: 6px; font-size: .85rem; cursor: pointer; }
.report-regions input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--accent); }
.chart-wrap { margin-bottom: 8px; }
.chart-title { font-size: .85rem; font-weight: 600; margin: 0 0 8px; }
.chart-box { position: relative; height: 210px; }
.pain-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .75rem; color: var(--text-2); margin-top: 8px; }
.pain-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
.pain-row { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.pain-row:last-child { border-bottom: 0; }
.pain-row-main { display: flex; align-items: baseline; gap: 10px; }
.pain-row-value { font-size: 1.1rem; font-weight: 600; }
.pain-kind { margin-left: auto; font-size: .7rem; text-transform: uppercase; color: var(--text-2); }
.pain-row-meta { font-size: .8rem; color: var(--text-2); }
.pain-status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pain-status-label { flex: 1 1 auto; min-width: 100px; font-size: .9rem; }
.pain-status-row .stepper { flex: 0 0 132px; }
.pain-status-row .btn-sm { flex: 0 0 auto; }

/* Sync-Status und Meldungen */
.status-line { font-size: .8rem; color: var(--text-2); margin: 0 0 16px; }
.status-line a { color: inherit; }
.status-ok { color: var(--text-2); }
.status-warn { color: var(--warn); }
.status-off { color: var(--text-2); }
.status-never { color: var(--text-2); }
.status-line-spaced { margin-top: 8px; }
.form-spaced { margin-top: 16px; }
.flash { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; font-size: .88rem; border: 1px solid var(--border-2); }
.flash-ok { border-color: var(--success); }
.flash-warn { border-color: var(--warn); }

/* Anmeldung */
.login-body { padding: 0; }
.login-body .login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 360px; }
.login-logo { display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto 32px; }

@media (min-width: 900px) {
  :root { --side: 208px; }
  body { padding-left: var(--side); padding-bottom: 0; }
  .login-body { padding-left: 0; }
  .top-bar-inner { max-width: none; }
  .site-nav {
    inset: var(--top) auto 0 0; width: var(--side); height: auto; flex-direction: column;
    padding-top: 12px; border-top: 0; border-right: 1px solid var(--border);
  }
  .nav-item {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; height: 42px;
    padding: 0 18px; font-size: .85rem; border-left: 3px solid transparent;
  }
  .nav-item:hover:not(.disabled) { background: var(--surface); }
  .nav-item.active { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
  main { max-width: 1100px; padding: 34px 32px 56px; }
  h1 { font-size: 1.75rem; }
  .chart-box { height: 300px; }
}

/* Formulare, Listen, Bestaetigung */
.stack > * + * { margin-top: 10px; }
.actions { display: flex; flex-direction: column; gap: 10px; }
.row-actions { display: flex; gap: 8px; margin-top: 10px; }
.row-actions > * { flex: 1 1 0; }
.row-actions form { display: flex; }
.row-actions form .btn { flex: 1; }

.btn-quiet { background: transparent; color: var(--text-2); font-weight: 400; }
.btn-quiet:hover { background: var(--surface-2); }
.btn-sm { width: auto; min-height: 36px; padding: 0 12px; font-size: .85rem; border-radius: var(--radius-sm); }
.btn-danger { background: var(--danger); color: var(--bg); }
.btn-danger-text { color: var(--danger); border-color: transparent; }
/* Tap-Ziele in Listen mindestens 48 px */
.pain-row .btn-sm { min-height: var(--touch); }

.pain-label { display: flex; flex-direction: column; gap: 6px; font-size: .8rem; color: var(--text-2); }
.pain-label input, .pain-label select { margin-top: 0; }
.pain-row-meta { margin: 4px 0 8px; }
.tag {
  display: inline-block; padding: 1px 8px; font-size: .68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .02em; color: var(--text-2);
  border: 1px solid var(--border-2); border-radius: 999px;
}
.pain-disclaimer { margin: 20px 0 8px; font-size: .8rem; color: var(--text-2); }
.timeline-section-head { margin-top: 32px; }
.timeline-day-head { display: flex; align-items: center; gap: 10px; margin-top: 24px; }
.timeline-item-deleted { opacity: .55; }
.timeline-checkins { list-style: none; margin: 8px 0 0; padding: 0; font-size: .85rem; }
.timeline-checkins li {
  display: flex; justify-content: space-between; gap: 12px; padding: 6px 0 6px 12px;
  border-left: 2px solid var(--border-2);
}
.timeline-checkins a { color: var(--text-2); }
/* Urteil in der Auswertung: immer Pfeil und Wort, die Farbe verstaerkt nur. */
.verdict { margin-left: auto; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.verdict-worse { color: var(--warn); }
.verdict-better { color: var(--success); }
.verdict-same { color: var(--text-2); }

.pain-fields { display: flex; flex-direction: column; gap: 12px; }
.pain-regions { display: flex; flex-direction: column; gap: 8px; }
.pain-region-toggle {
  display: flex; align-items: center; gap: 12px; min-height: var(--touch); padding: 0 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer;
}
.pain-region-toggle input {
  width: 22px; height: 22px; min-height: 0; margin: 0; padding: 0; flex-shrink: 0;
  accent-color: var(--accent);
}
.pain-region-controls { display: none; flex-direction: column; gap: 10px; padding: 12px 14px 4px; }
.pain-region:has(.pain-region-toggle input:checked) .pain-region-controls { display: flex; }
.pain-region-controls select, .pain-region-controls input { margin-top: 0; }

.pain-choice { display: flex; gap: 8px; }
.pain-choice label { flex: 1; position: relative; }
.pain-choice input {
  position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0;
  padding: 0; opacity: 0;
}
.pain-choice span {
  display: flex; align-items: center; justify-content: center; min-height: var(--touch);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.pain-choice input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pain-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.stepper {
  display: flex; align-items: stretch; height: var(--touch); overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
}
.stepper-btn {
  width: 44px; height: 100%; flex-shrink: 0; display: flex; align-items: center;
  justify-content: center; background: transparent; border: 0; color: var(--text);
  font: inherit; font-size: 1.25rem; line-height: 1; cursor: pointer;
}
.stepper-btn:active { background: var(--border-2); }
.stepper-input {
  flex: 1; min-width: 0; height: 100%; min-height: 0; margin: 0; padding: 0;
  border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  border-radius: 0; background: transparent; text-align: center; font: inherit;
  font-size: 1.1rem; font-weight: 600; font-feature-settings: "tnum" 1; color: var(--text);
  outline: none; appearance: textfield; -moz-appearance: textfield;
}
.stepper:focus-within { border-color: var(--accent); }
.stepper-input::-webkit-outer-spin-button, .stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.seat-buttons { display: flex; flex-direction: column; gap: 8px; }
.seat-btn { justify-content: flex-start; gap: 10px; }
.dot-seat-main { background: var(--seat-main); }
.dot-seat-partly { background: var(--seat-partly); }
.dot-seat-none { background: var(--seat-none); }

.section-tabs { display: flex; gap: 8px; margin: 12px 0 16px; }
.section-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; min-height: var(--touch);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-2); text-decoration: none;
}
.section-tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.confirm {
  width: min(360px, calc(100vw - 48px)); padding: 20px; background: var(--surface);
  color: var(--text); border: 1px solid var(--border-2); border-radius: var(--radius);
}
.confirm::backdrop { background: rgb(0 0 0 / .6); }
.confirm-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 8px; }
.confirm-note { font-size: .85rem; color: var(--text-2); margin: 0 0 16px; }
.confirm-actions { display: flex; gap: 8px; }
.confirm-actions .btn { flex: 1; }
@media (prefers-reduced-motion: no-preference) {
  .confirm[open] { animation: confirm-in 120ms ease-out; }
  @keyframes confirm-in { from { opacity: 0; transform: scale(0.96); } }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

@media (min-width: 900px) {
  .nav-item.nav-desktop-only { display: flex; }
  .nav-toggle {
    display: flex; align-items: center; justify-content: flex-end; height: 36px;
    margin: 0 8px 8px; padding: 0 10px; background: transparent; border: 0;
    color: var(--text-2); cursor: pointer;
  }
  .nav-toggle:hover { color: var(--text); }
  .nav-toggle svg {
    width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
  }
  .top-gear { display: none; }

  .fab {
    right: 24px; bottom: 24px; width: auto; height: var(--touch); padding: 0 20px;
    border-radius: 999px;
  }
  .fab-plus { font-size: 1.4rem; }
  .fab-label {
    position: static; width: auto; height: auto; margin: 0; overflow: visible;
    clip: auto; white-space: normal;
  }

  /* Eingeklappt: nur Symbole; der Name bleibt fuer Screenreader erhalten. */
  html.nav-collapsed { --side: 64px; }
  html.nav-collapsed .nav-item { padding: 0; justify-content: center; }
  html.nav-collapsed .nav-item span {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  html.nav-collapsed .nav-toggle { justify-content: center; margin: 0 0 8px; }
  html.nav-collapsed .nav-toggle svg { transform: rotate(180deg); }
}
