/* Gemeinsame Apple-orientierte Gestaltung der Hauptansichten und Formulare.
   Die native Pausenüberlagerung bleibt eine eigenständige Dialogebene. */
:root {
  color-scheme: light dark;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #eaeaef;
  --line: #e5e5ea;
  --line-strong: #c5c5cc;
  --text: #1c1c1e;
  --text-2: #63636b;
  --accent: #a7472c;
  --accent-hover: #923b22;
  --accent-graphic: #a7472c;
  --accent-soft: #faece3;
  --on-accent: #ffffff;
  --ok: #21703e;
  --ok-soft: #e5f3e9;
  --warn: #b92520;
  --warning-soft: #fff3dc;
  --nav-surface: rgba(250, 250, 252, .92);
  --r-card: 20px;
  --r-field: 12px;
  --shadow: 0 3px 18px rgba(0, 0, 0, .03);
  --shadow-nav: none;
  --text-main: var(--text);
  --text-muted: var(--text-2);
  --font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 64px;
  --bg-color: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --line: #38383a;
    --line-strong: #63636a;
    --text: #f5f5f7;
    --text-2: #ababB3;
    --accent: #ffa66b;
    --accent-hover: #ffbc8f;
    --accent-graphic: #ffa66b;
    --accent-soft: #3c261a;
    --on-accent: #2a160b;
    --ok: #79d495;
    --ok-soft: #183321;
    --warn: #ff938c;
    --warning-soft: #382b17;
    --nav-surface: rgba(28, 28, 30, .92);
  }
}
:root[data-theme="dark"] {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --line: #38383a;
    --line-strong: #63636a;
    --text: #f5f5f7;
    --text-2: #ababB3;
    --accent: #ffa66b;
    --accent-hover: #ffbc8f;
    --accent-graphic: #ffa66b;
    --accent-soft: #3c261a;
    --on-accent: #2a160b;
    --ok: #79d495;
    --ok-soft: #183321;
    --warn: #ff938c;
    --warning-soft: #382b17;
    --nav-surface: rgba(28, 28, 30, .92);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--text); font: 1.0625rem/1.5 var(--font); }
body.shellnav-room { padding-top: 0; padding-bottom: calc(84px + var(--safe-bottom)); }
button, input, select, textarea { font-family: inherit; }
input, textarea { caret-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-2); opacity: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: 4px; }
.app-header { display: flex; align-items: center; justify-content: space-between; max-width: 1120px; min-height: 76px; height: auto; padding: 12px 32px; margin: auto; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 1.0625rem; font-weight: 650; letter-spacing: -.02em; color: var(--text); text-decoration: none; }
.brand svg { width: 26px; height: 26px; fill: var(--accent); }
.profile { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; min-width: 44px; font-size: .9375rem; color: var(--accent); text-decoration: none; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: .8125rem; font-weight: 600; }
.preview-note, .tr-environment { height: auto; min-height: 30px; padding: 7px 20px; text-align: center; font-size: .75rem; line-height: 1.4; color: var(--text-2); background: var(--surface-2); }
main#main, .training-app { max-width: 1056px; margin: 24px auto 60px; padding: 0; }
.training-app { --tr-accent: var(--accent); --tr-line: var(--line); }
h1, .training-app h1 { font-size: 2.125rem; line-height: 1.15; letter-spacing: -.035em; font-weight: 700; }
h2, .training-app h2, #tr-dialog h2 { font-size: 1.25rem; line-height: 1.3; letter-spacing: -.02em; font-weight: 650; }
h3 { font-size: 1.0625rem; }
.page-heading, .tr-heading { margin-top: 0; margin-bottom: 26px; }
.sub, .page-heading .sub, .tr-section-heading p, .tr-prior, .tr-muted, .tr-empty { font-size: .9375rem; color: var(--text-2); }
.panel, .tr-card, .card { background: var(--surface); border: 0; border-radius: var(--r-card); padding: 26px; box-shadow: var(--shadow); }
.tr-active-card { border-top: 0; }
.tr-active-card h2 { font-size: 1.75rem; }
.section-head { margin-bottom: 20px; }
.btn, .training-app button, #tr-dialog button, .tr-button { border-radius: var(--r-field); min-height: 48px; font-size: .9375rem; font-weight: 600; }
.btn { background: var(--surface-2); border-color: transparent; }
.btn:hover, .training-app button:hover, #tr-dialog button:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn.primary, .training-app .tr-primary, #tr-dialog .tr-primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn.primary:hover, .training-app .tr-primary:hover, #tr-dialog .tr-primary:hover { background: var(--accent-hover); border-color: transparent; }
.btn.soft { color: var(--accent); background: var(--accent-soft); }
.btn.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn.btn-accent:hover { background: var(--accent-hover); border-color: transparent; }
.btn.btn-danger { background: var(--warn); color: var(--surface); }
.field > span { text-transform: none; letter-spacing: 0; font-size: .9375rem; font-weight: 500; }
.card p, .card li, .hint, .row .rowsub { font-size: .9375rem; }
.text-btn, .tr-link { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; font-size: .9375rem; }
.food-layout .entry-actions .text-btn { min-height: 44px; }
.day-strip .btn { min-width: 44px; }
.tr-detail-link { display: flex; }
details > summary { min-height: 44px; padding-block: 12px; cursor: pointer; }
.list-row strong, .food-choice strong, .tr-routine-row strong, .tr-exercise-row strong { font-size: 1rem; font-weight: 600; }
.list-row .detail, .food-choice small, .tr-routine-row small, .tr-exercise-row small, .field-hint { font-size: .8125rem; color: var(--text-2); }
.field, .training-app label, #tr-dialog label { font-size: .9375rem; font-weight: 500; }
.field input, .field select, .field textarea, .training-app input, .training-app select, #tr-dialog input, #tr-dialog select { font-size: 1.0625rem; background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-field); }
.tr-inputs input { font-size: 1.75rem; background: var(--bg); min-height: 70px; text-align: center; }
.tr-tag, .tag { color: var(--text-2); background: var(--surface-2); border-radius: 7px; letter-spacing: 0; }
.tag.neutral { color: var(--text-2); background: var(--surface-2); }
.tag.warm { color: var(--text); background: var(--warning-soft); }
.ring .track { stroke: var(--line); }
.bar { background: var(--line); }
.bar i { background: var(--ok); }
.routine-visual { background: var(--surface-2); }
.training-app input:focus, #tr-dialog input:focus, .training-app button:focus-visible, #tr-dialog button:focus-visible { outline-color: var(--accent); }
.tr-exercise-tabs button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.trend-tabs { padding: 3px; gap: 3px; background: var(--surface-2); border-radius: 11px; }
.trend-tabs button { flex: 1; border: 0; background: transparent; border-radius: 8px; font-weight: 500; }
.trend-tabs button[aria-pressed=true] { background: var(--surface); color: var(--text); box-shadow: 0 2px 5px rgba(0,0,0,.1); }
.chart text { fill: var(--text-2); }
.chart .gridline { stroke: var(--line); }
.chart .measurement { fill: var(--surface); }
.food-icon { background: var(--accent-soft); color: var(--accent); }
.error, .tr-message.tr-error, #tr-dialog .tr-error, button.tr-danger { color: var(--warn); }
.status-note, .pending-draft, .tr-queue-card { background: var(--warning-soft); color: var(--text); border-color: var(--line-strong); }
.tr-message { background: var(--ok-soft); color: var(--text); border-color: var(--line-strong); }
.tr-message.tr-error { background: var(--warning-soft); }
.source-row select, .inline-select, .photo-grid select { background: var(--surface-2); color: var(--text); font-size: 1rem; min-height: 44px; }
.shellnav { background: var(--nav-surface); backdrop-filter: saturate(160%) blur(20px); -webkit-backdrop-filter: saturate(160%) blur(20px); box-shadow: none; border-color: var(--line); }
.shellnav a { min-height: 64px; font-size: .75rem; font-weight: 500; }
.shellnav a[aria-current=page] { color: var(--accent); font-weight: 700; }
.shellnav a[aria-current=page]::before { display: none; }
#dialog, #tr-dialog { background: var(--surface); color: var(--text); border: 0; border-radius: 24px; box-shadow: 0 24px 90px rgba(0,0,0,.22); overscroll-behavior: contain; }
#dialog::backdrop, #tr-dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog-head { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.close-btn { background: var(--surface-2); color: var(--text-2); }
#tr-dialog { padding: 26px; }
#tr-dialog h2 { padding-right: 100px; min-height: 44px; display: flex; align-items: center; }
#tr-dialog .tr-dialog-close { position: absolute; top: 18px; right: 18px; margin: 0; min-height: 44px; padding: 8px 12px; background: var(--surface-2); color: var(--accent); border: 0; }
.pausentimer { background: var(--surface); }
.pausentimer-titel { font-size: .875rem; text-transform: none; letter-spacing: 0; }
.pausentimer-knopf { font-size: .875rem; }
.pausentimer-knopf[data-aktion^=plus] { background: var(--accent-soft); border-color: transparent; }
.pausentimer-gross .pausentimer-knopf[data-aktion^=plus] { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.pausentimer-gross .pausentimer-zeit { letter-spacing: -.04em; font-weight: 600; }
.pausentimer.fertig { display: flex; min-height: 64px; gap: 12px; background: var(--surface); border-color: var(--line); }
.pausentimer.fertig .pausentimer-titel { color: var(--ok); }
.pausentimer.fertig .pausentimer-zeit, .pausentimer.fertig .pausentimer-kontext { display: none; }
.pausentimer.fertig .pausentimer-knoepfe { margin-left: auto; }
.page { padding-top: 28px; }
.auth-link, .legal-foot a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; font-size: .9375rem; }
.form-input, .form-input:focus { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.form-input:focus { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.form-label { font-size: .9375rem; text-transform: none; font-weight: 500; }
.seg button[aria-pressed=true] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
@media (min-width: 768px) {
  .shellnav { position: static; max-width: 1056px; margin: 0 auto; padding: 8px 0; border: 0; background: transparent; gap: 6px; justify-content: flex-start; }
  .shellnav a { min-height: 44px; font-size: .9375rem; border-radius: 10px; padding: 0 18px; }
  .shellnav a[aria-current=page] { background: var(--surface); box-shadow: 0 2px 5px rgba(0,0,0,.04); }
}
@media (max-width: 1120px) and (min-width: 768px) {
  main#main, .training-app, .shellnav { margin-left: 32px; margin-right: 32px; }
}
@media (max-width: 767px) {
  .app-header { padding: calc(8px + var(--safe-top)) 20px 8px; min-height: 64px; }
  main#main, .training-app { margin: 20px 20px 40px; padding: 0; }
  .panel, .tr-card, .food-layout .panel { padding: 20px; border-radius: 18px; }
  .tr-section-heading { flex-wrap: wrap; }
  .tr-section-heading button, .tr-routine-row button, .tr-exercise-row button, .tr-set-row button, .tr-label-line button { font-size: .875rem; }
  .tr-label-line, .tr-session-top { flex-wrap: wrap; }
  .tr-heading h1 { font-size: 2.125rem; }
  .page-heading { flex-wrap: wrap; }
  .nutrition-copy p { font-size: .8125rem; }
  #dialog, #tr-dialog { top: auto; bottom: 0; left: 0; right: 0; transform: none; margin: 0; width: 100%; max-width: none; max-height: 92dvh; border-radius: 24px 24px 0 0; }
  #tr-dialog { padding: 24px 20px calc(24px + var(--safe-bottom)); }
  .dialog-body { padding-bottom: calc(24px + var(--safe-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* Geräteweite Auswahl, unabhängig von den Systemeinstellungen. */
.theme-choice { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: .875rem; }
.theme-choice select { min-height: 44px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
.app-header { flex-wrap: wrap; }
.app-header .theme-choice { margin-left: auto; }
.pagehead .theme-choice { margin-top: 12px; }
@media(max-width: 767px) { .app-header { gap: 8px; } .app-header .brand { font-size: .9375rem; } .app-header .theme-choice > span { display: none; } }

/* Sichtbare Rückmeldung beim Antippen; das graue Tipp-Highlight der Browser ist abgeschaltet. */
:is(button, .btn, a.text-btn, .tr-action-card, .shellnav a, .pausentimer-knopf, .pausentimer-satz):active:not(:disabled) { transform: scale(.97); opacity: .82; }

/* Seitenwechsel blenden weich über; Kopf und Navigation bleiben dabei stehen. */
@view-transition { navigation: auto; }
.app-header { view-transition-name: app-header; }
.shellnav { view-transition-name: shellnav; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none; }
  :is(button, .btn, a.text-btn, .tr-action-card, .shellnav a, .pausentimer-knopf, .pausentimer-satz):active { transform: none; }
}
