/* =========================================================
   Mein Management – Design-System
   Ton: Navy aus dem Logo (#003079) als Akzent, blaugraue Neutraltöne.
   Typografie: Bricolage Grotesque (Überschriften/Zahlen) + Inter (Fließtext).
   ========================================================= */

:root {
  --css-build: "2026080946";   /* dient der Versionsanzeige im Seitenfuß */
  /* Variablennamen bleiben stabil – sie werden in vielen Seiten inline genutzt */
  --color-bg: #eff2f7;
  --color-surface: #ffffff;
  --color-primary: #003079;
  --color-primary-dark: #002357;
  --color-primary-light: #e6ecf6;
  --color-text: #171826;
  --color-muted: #66708a;
  --color-border: #dfe4ee;
  --color-danger: #c0483f;
  --color-danger-bg: #fbeceb;
  --color-success: #2f7d55;
  --color-success-bg: #e7f2ea;
  --color-success-border: #c3ddcd;
  --color-warning: #c8862f;
  --color-warning-bg: #fbf1e2;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 18px;
  --radius-sm: 11px;
  --radius-pill: 999px;

  --shadow: 0 1px 2px rgba(23, 24, 38, 0.04), 0 8px 24px rgba(23, 24, 38, 0.06);
  --shadow-hover: 0 2px 6px rgba(23, 24, 38, 0.07), 0 14px 32px rgba(23, 24, 38, 0.11);
  --shadow-soft: 0 1px 3px rgba(23, 24, 38, 0.05);
  font-size: 16px;
}

[data-theme="dark"] {
  --color-bg: #0d111c;
  --color-surface: #161c2b;
  --color-primary: #6f9de6;
  --color-primary-dark: #93b8ef;
  --color-primary-light: #1d2740;
  --color-text: #e4e9f4;
  --color-muted: #939db6;
  --color-border: #28324a;
  --color-danger: #e88b82;
  --color-danger-bg: #38201d;
  --color-success: #5fbc86;
  --color-success-bg: #16301f;
  --color-success-border: #2a5a3c;
  --color-warning: #e0ab5f;
  --color-warning-bg: #362a15;
  --shadow: 0 1px 2px rgba(0,0,0,0.35), 0 8px 24px rgba(0,0,0,0.4);
  --shadow-hover: 0 2px 6px rgba(0,0,0,0.4), 0 14px 32px rgba(0,0,0,0.5);
  --shadow-soft: 0 1px 3px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }

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

a { color: var(--color-primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, .brand, .stat .value, .week-card .week-title, .week-stat-box .n {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
h1 { font-size: 1.75rem; margin-top: 0; margin-bottom: 0.2rem; font-weight: 700; }
h2 { font-size: 1.12rem; font-weight: 700; margin-bottom: 0.7rem; }
h3 { font-size: 0.98rem; font-weight: 600; }

/* ---------- Grundgerüst ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 1rem;
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0.85rem 1.5rem;
  position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid var(--color-border);
}
.topbar .brand {
  font-weight: 700; font-size: 1.12rem; margin-right: auto;
  display: flex; align-items: center; gap: 0.6rem;
}
.brand-logo { height: 26px; width: auto; max-height: 26px; display: block; flex-shrink: 0; }
.brand-logo-dunkel { display: none; }
[data-theme="dark"] .brand-logo-hell { display: none; }
[data-theme="dark"] .brand-logo-dunkel { display: block; }
.topbar-user { display: flex; align-items: center; gap: 0.85rem; font-size: 0.88rem; color: var(--color-muted); }
.btn-link { color: var(--color-primary-dark); font-weight: 500; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }
.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--color-bg); border: 1px solid var(--color-border); color: var(--color-text);
  font-size: 1.05rem; cursor: pointer; border-radius: var(--radius-sm);
  width: 36px; height: 36px; flex-shrink: 0; line-height: 1;
  transition: background 0.15s ease;
}
.nav-toggle:hover { background: var(--color-primary-light); }
.theme-toggle {
  background: var(--color-bg); border: 1px solid var(--color-border); color: var(--color-text);
  font-size: 0.95rem; cursor: pointer; border-radius: var(--radius-pill);
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease; flex-shrink: 0;
}
.theme-toggle:hover { background: var(--color-primary-light); border-color: var(--color-primary-light); }

.layout { display: flex; flex: 1; min-height: 0; position: relative; }

/* ---------- Navigation: ausklappbares Menue auf allen Geraeten ---------- */
.nav-scrim { position: fixed; inset: 57px 0 0 0; background: rgba(23, 24, 38, 0.35); z-index: 8; }
.sidebar {
  position: fixed; top: 57px; left: 0; bottom: 0; width: 264px;
  background: var(--color-surface); border-right: 1px solid var(--color-border);
  padding: 0.9rem 0.8rem; overflow-y: auto; z-index: 9;
  transform: translateX(-100%); transition: transform 0.2s ease;
  box-shadow: var(--shadow-hover);
}
.sidebar.open { transform: translateX(0); }

.nav-group { margin-bottom: 0.25rem; }
.nav-group-title {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.85rem; font-weight: 700; color: var(--color-text);
  padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); cursor: pointer;
  list-style: none; transition: background 0.15s ease;
}
.nav-group-title::-webkit-details-marker { display: none; }
.nav-group-title:hover { background: var(--color-bg); }
.nav-group-icon { font-size: 1rem; width: 1.3rem; text-align: center; flex-shrink: 0; }
.nav-caret { margin-left: auto; color: var(--color-muted); font-size: 0.72rem; transition: transform 0.18s ease; }
.nav-group[open] > .nav-group-title .nav-caret { transform: rotate(180deg); }

.sidebar ul { list-style: none; margin: 0 0 0.5rem; padding: 0 0 0 0.5rem; }
.sidebar a {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.5rem 0.8rem; border-radius: var(--radius-pill);
  color: var(--color-text); font-size: 0.9rem; font-weight: 500;
  margin-bottom: 0.12rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar a:hover { background: rgba(0, 48, 121, 0.08); text-decoration: none; }
.sidebar a.active {
  background: var(--color-primary); color: #fff; font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 48, 121, 0.28);
}
[data-theme="dark"] .sidebar a.active { color: #0d111c; }
.sidebar a .nav-icon { font-size: 1rem; width: 1.25rem; text-align: center; flex-shrink: 0; }

.content { flex: 1; padding: 2rem 2.25rem; max-width: 1160px; margin: 0 auto; width: 100%; }

/* ---------- Karten & Raster ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 1.5rem;
  margin-bottom: 1.15rem;
  transition: box-shadow 0.18s ease;
}
.card:hover { box-shadow: var(--shadow); }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ---------- Kennzahlen ---------- */
.stat {
  text-align: left; padding: 1.15rem 1.25rem; border-radius: var(--radius);
  background: var(--color-surface); border: 1px solid var(--color-border);
  box-shadow: var(--shadow-soft);
}
.stat .value {
  font-size: 1.75rem; font-weight: 700; color: var(--color-text);
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.stat .label {
  font-size: 0.7rem; color: var(--color-muted); text-transform: uppercase;
  letter-spacing: 0.09em; margin-top: 0.3rem; font-weight: 600;
}

/* ---------- Formulare ---------- */
form.inline { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; }
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.9rem; }
.field label { font-size: 0.8rem; color: var(--color-muted); font-weight: 600; }
input, select, textarea {
  font: inherit; padding: 0.62rem 0.8rem;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: #111726; }
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 48, 121, 0.16);
}

/* ---------- Schaltflächen ---------- */
.btn {
  display: inline-block; padding: 0.62rem 1.25rem; border-radius: var(--radius-pill); border: none;
  background: var(--color-primary); color: #fff; font: inherit; font-weight: 600; font-size: 0.92rem;
  cursor: pointer; text-align: center;
  transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 48, 121, 0.24);
}
.btn:hover { background: var(--color-primary-dark); text-decoration: none; box-shadow: 0 5px 14px rgba(0, 48, 121, 0.3); }
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: var(--color-surface); color: var(--color-text);
  border: 1px solid var(--color-border); box-shadow: none;
}
.btn.secondary:hover { background: var(--color-primary-light); border-color: var(--color-primary-light); box-shadow: none; }
.btn.danger { background: var(--color-danger); box-shadow: 0 2px 6px rgba(192, 72, 63, 0.24); }
.btn.danger:hover { background: #9d3a32; }
.btn.small { padding: 0.36rem 0.85rem; font-size: 0.84rem; }
[data-theme="dark"] .btn { color: #0d111c; }
[data-theme="dark"] .btn.secondary { background: var(--color-surface); color: var(--color-text); }

.fab {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; background: var(--color-primary); color: #fff;
  font-size: 1.4rem; border: none; cursor: pointer; text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 48, 121, 0.35); transition: background 0.15s ease, transform 0.1s ease;
}
.fab:hover { background: var(--color-primary-dark); text-decoration: none; transform: translateY(-2px); }

.icon-btn {
  border: none; background: none; cursor: pointer; font-size: 1.05rem;
  padding: 0.3rem 0.45rem; border-radius: var(--radius-sm); transition: background 0.15s ease;
}
.icon-btn:hover { background: var(--color-bg); }
.icon-btn.danger { color: var(--color-danger); }

.header-row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.header-actions { display: flex; gap: 0.5rem; }

/* ---------- Tabellen ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.7rem 0.7rem; border-bottom: 1px solid var(--color-border); }
th {
  color: var(--color-muted); font-weight: 700; font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.09em;
}
td { font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--color-primary-light); }
.table-actions { display: flex; gap: 0.5rem; }
.table-wrap { overflow-x: auto; }

/* ---------- Dialoge ---------- */
dialog.popup {
  border: none; border-radius: var(--radius); padding: 1.6rem;
  max-width: 560px; width: 92vw; box-shadow: var(--shadow-hover);
  background: var(--color-surface); color: var(--color-text);
}
dialog.popup::backdrop { background: rgba(23, 24, 38, 0.5); }
dialog.popup .header-row { margin-bottom: 1rem; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(23, 24, 38, 0.5);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem;
}
.modal-box {
  background: var(--color-surface); border-radius: var(--radius); padding: 1.75rem;
  width: 100%; max-width: 420px; box-shadow: var(--shadow-hover);
}
.modal-box h2 { margin-top: 0; }
.goal-row { display: flex; justify-content: space-between; align-items: center; padding: 0.65rem 0; border-bottom: 1px solid var(--color-border); }
.goal-row:last-of-type { border-bottom: none; }
.goal-row .ring-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 0.5rem; }

/* ---------- Arbeitszeit: Kategorien ---------- */
.cat-grid { display: grid; gap: 0.6rem 0.7rem; align-items: center; margin-bottom: 0.5rem; }
.cat-grid-presence { grid-template-columns: 3.2rem 1fr auto auto auto auto; }
.cat-grid-absence { grid-template-columns: 3.2rem 1fr auto auto auto auto auto; }
.cat-grid-head {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--color-muted);
  font-weight: 700; padding-bottom: 0.45rem; border-bottom: 1px solid var(--color-border);
}
.cat-row-wrap, .cat-row, .cat-row-inline { display: contents; }
.cat-row input[type="text"], .cat-row select { padding: 0.45rem 0.6rem; }
/* Beschriftungen nur in der Handy-Ansicht – am Desktop stehen die Spaltentitel in der Kopfzeile.
   Ohne dieses Ausblenden würden sie als zusätzliche Rasterzelle die Spalten verschieben. */
.cat-mobile-label { display: none; }

@media (max-width: 640px) {
  .cat-grid { display: block; }
  .cat-grid-head { display: none; }
  .cat-row-wrap {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
    padding: 0.9rem; margin-bottom: 0.7rem;
    border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface);
    box-shadow: var(--shadow-soft);
  }
  .cat-row-wrap input[type="text"] { flex: 1 1 120px; min-width: 0; }
  .cat-row-wrap input[type="text"][maxlength="4"] { flex: 0 0 3.2rem; }
  .cat-row-wrap select { flex: 1 1 auto; }
  .cat-row-wrap label.cat-mobile-label {
    display: block;
    flex-basis: 100%; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--color-muted); font-weight: 700; margin: 0.35rem 0 -0.2rem;
  }
}

/* ---------- Hinweise & Marker ---------- */
.flash {
  padding: 0.85rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1.1rem;
  font-size: 0.9rem; border: 1px solid transparent;
}
.flash-success { background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success-border); }
.flash-error { background: var(--color-danger-bg); color: var(--color-danger); border-color: #f0cdc9; }

.badge {
  display: inline-block; padding: 0.22rem 0.65rem; border-radius: var(--radius-pill);
  font-size: 0.76rem; font-weight: 500;
  background: var(--color-bg); border: 1px solid var(--color-border);
}
.badge.ok { background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success-border); }
.badge.warn { background: var(--color-warning-bg); color: var(--color-warning); border-color: #eeddbe; }
.badge.danger { background: var(--color-danger-bg); color: var(--color-danger); border-color: #f0cac6; }

.muted { color: var(--color-muted); font-size: 0.85rem; }

/* ---------- Wetter (Dashboard) ---------- */
.weather-card { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.weather-icon {
  font-size: 4.5rem; line-height: 1; flex-shrink: 0;
  /* Systemschriften für Emoji explizit vorziehen, damit Wetter-Symbole in jedem
     Browser (Chrome, Safari, Firefox, Edge) gleich zuverlässig farbig dargestellt werden. */
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.weather-temp {
  font-family: var(--font-display); font-size: 2.9rem; font-weight: 700;
  color: var(--color-primary-dark); line-height: 1; letter-spacing: -0.01em;
}
.weather-desc { font-size: 1.05rem; }
.weather-meta { font-size: 0.95rem; margin-top: 0.35rem; }
.weather-forecast { display: flex; gap: 1.4rem; margin-top: 1rem; flex-wrap: wrap; }
.weather-forecast-day { text-align: center; font-size: 0.88rem; }
.weather-forecast-icon {
  font-size: 1.9rem; display: inline-block; margin: 0.15rem 0;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
@media (max-width: 480px) {
  .weather-icon { font-size: 3.4rem; }
  .weather-temp { font-size: 2.2rem; }
}

.progress-bar { background: var(--color-border); border-radius: var(--radius-pill); height: 8px; overflow: hidden; }
.progress-bar-fill { background: var(--color-primary); height: 100%; border-radius: var(--radius-pill); transition: width 0.25s ease; }

/* ---------- Anmeldung ---------- */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background:
    radial-gradient(1000px 600px at 15% 0%, rgba(0, 48, 121, 0.14), transparent 60%),
    radial-gradient(800px 500px at 100% 100%, rgba(200, 134, 47, 0.12), transparent 55%),
    var(--color-bg);
}
.login-box {
  width: 100%; max-width: 380px; background: var(--color-surface); padding: 2.4rem;
  border-radius: var(--radius); box-shadow: var(--shadow-hover); border: 1px solid var(--color-border);
}
.login-box h1 { text-align: center; font-size: 1.4rem; margin-bottom: 1.2rem; }
.login-logo { display: block; height: 84px; width: auto; margin: 0 auto 1rem; }
[data-theme="dark"] .login-logo { filter: brightness(0) invert(1); }

/* ---------- Tagebuch: Wochenkarten ---------- */
.week-card {
  display: block; padding: 1.3rem 1.45rem; border-radius: var(--radius); color: #fff;
  margin-bottom: 0.9rem; text-decoration: none; box-shadow: var(--shadow);
  transition: box-shadow 0.18s ease, transform 0.12s ease;
}
.week-card:hover { text-decoration: none; box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.week-card .week-top { display: flex; justify-content: space-between; align-items: baseline; }
.week-card .week-title { font-size: 1.35rem; font-weight: 700; }
.week-card .week-range { opacity: 0.85; font-size: 0.88rem; margin-top: 0.2rem; }
.week-card .week-count { text-align: right; font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.week-card .week-count .label { display: block; font-size: 0.72rem; font-weight: 400; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.08em; }
.week-card .week-badges { margin-top: 0.75rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.week-card .badge-light { background: rgba(255,255,255,0.2); color: #fff; border: none; }
.week-color-0 { background: linear-gradient(135deg, #002357, #003079); }
.week-color-1 { background: linear-gradient(135deg, #143a70, #22539b); }
.week-color-2 { background: linear-gradient(135deg, #26506e, #3a76a6); }
.week-color-3 { background: linear-gradient(135deg, #8d6a1f, #b8902f); }
.week-color-4 { background: linear-gradient(135deg, #8e3730, #b3453d); }
.week-color-5 { background: linear-gradient(135deg, #3b4560, #5a6685); }

/* ---------- Tagebuch: Tageskarte ---------- */
.day-card { margin-bottom: 1rem; }
.day-card .day-head {
  display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap;
  padding-bottom: 0.9rem; margin-bottom: 0.9rem; border-bottom: 1px solid var(--color-border);
}
.day-card .day-head .day-name { font-weight: 700; font-size: 1.05rem; font-family: var(--font-display); }
.day-card .day-head .day-date { color: var(--color-muted); font-size: 0.85rem; }

.ring-badge {
  width: 92px; height: 92px; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; font-size: 0.76rem;
  border: 3px solid; line-height: 1.25;
}
.ring-badge strong { font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.ring-energy { border-color: var(--color-warning); background: var(--color-warning-bg); color: #8a5a12; }
.ring-move { border-color: var(--color-danger); background: var(--color-danger-bg); color: #8a2c28; }
.ring-exercise { border-color: var(--color-primary); background: var(--color-primary-light); color: var(--color-primary-dark); }
.ring-stand { border-color: #3a76a6; background: #e8eff6; color: #26506e; }

.entry-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.entry-mood { font-size: 1.05rem; font-weight: 700; }
.entry-mood .mood-label { font-weight: 400; color: var(--color-muted); font-size: 0.9rem; margin-left: 0.3rem; }

/* ---------- Training ---------- */
.week-stats { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.85rem; }
.week-stat-box { background: rgba(255,255,255,0.18); border-radius: var(--radius-sm); padding: 0.65rem 0.95rem; text-align: center; min-width: 92px; }
.week-stat-box .n { font-size: 1.3rem; font-weight: 700; display: block; font-variant-numeric: tabular-nums; }
.week-stat-box .l { font-size: 0.7rem; opacity: 0.88; text-transform: uppercase; letter-spacing: 0.07em; }
.week-card.on-white { color: var(--color-text); background: var(--color-primary-light); }
.week-card.on-white .week-stat-box { background: var(--color-surface); border: 1px solid var(--color-border); }

.exercise-toggle-row { display: flex; gap: 0.6rem; margin: 0.85rem 0; flex-wrap: wrap; }
.exercise-toggle-row button {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-pill);
  padding: 0.5rem 1.05rem; cursor: pointer; font: inherit; font-weight: 500; transition: background 0.15s ease;
}
.exercise-toggle-row button:hover { background: var(--color-primary-light); }
.exercise-toggle-row button.strength { color: var(--color-text); }
.exercise-toggle-row button.endurance { color: var(--color-primary-dark); border-color: var(--color-primary); }

.exercise-block {
  background: var(--color-bg); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1rem;
  border-left: 3px solid var(--color-primary);
}
.exercise-block.endurance-block { border-left-color: #3a76a6; }
.exercise-block .block-head { display: flex; justify-content: space-between; align-items: center; }
.set-row { display: grid; grid-template-columns: 1.5rem repeat(4, 1fr) auto; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.set-row .set-no { font-weight: 700; color: var(--color-muted); font-variant-numeric: tabular-nums; }
.remove-row-btn { background: none; border: none; color: var(--color-danger); cursor: pointer; font-size: 1rem; }
.add-set-btn { background: none; border: none; color: var(--color-primary-dark); cursor: pointer; font: inherit; font-weight: 600; }

.log-exercise { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--color-border); }
.log-exercise:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.log-exercise .ex-title { font-weight: 700; }
.log-exercise .ex-sub { color: var(--color-muted); font-size: 0.85rem; }
.log-exercise .ex-detail { color: var(--color-muted); font-size: 0.87rem; margin: 0.1rem 0; }
.set-count-badge { background: var(--color-warning-bg); color: #8a5a12; border-radius: var(--radius-pill); padding: 0.22rem 0.75rem; font-size: 0.8rem; }

/* ---------- Reiter ---------- */
.tab-row {
  display: flex; gap: 0.3rem; background: var(--color-bg); border-radius: var(--radius-pill);
  padding: 0.3rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.tab-row a, .tab-row button {
  flex: 1; text-align: center; padding: 0.5rem 0.9rem; border-radius: var(--radius-pill);
  border: none; background: transparent; color: var(--color-muted); font: inherit; font-size: 0.9rem;
  font-weight: 500; cursor: pointer; white-space: nowrap; transition: background 0.15s ease, color 0.15s ease;
}
.tab-row a:hover, .tab-row button:hover { color: var(--color-text); text-decoration: none; }
.tab-row a.active, .tab-row button.active {
  background: var(--color-surface); box-shadow: var(--shadow-soft);
  font-weight: 600; text-decoration: none; color: var(--color-primary-dark);
}

/* ---------- Ernährung ---------- */
.meal-card { border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 0.75rem; border: 1px solid; }
.meal-card .meal-type-label { text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.09em; font-weight: 700; opacity: 0.75; }
.meal-card .meal-name { font-weight: 600; font-size: 1.02rem; }
.meal-card.type-fruehstueck { background: #fbf1e2; border-color: #eeddbe; color: #8a5f18; }
.meal-card.type-mittagessen { background: #f6efe4; border-color: #e6d8c0; color: #7d5a24; }
.meal-card.type-abendessen { background: var(--color-primary-light); border-color: #c9e3dd; color: var(--color-primary-dark); }
.meal-card.type-snack { background: var(--color-success-bg); border-color: var(--color-success-border); color: var(--color-success); }

/* ---------- Medikamente ---------- */
.med-row { display: flex; align-items: center; gap: 0.9rem; padding: 0.95rem 0; border-bottom: 1px solid var(--color-border); }
.med-row:last-child { border-bottom: none; }
.med-row-status { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--color-border); flex-shrink: 0; }
.med-row-status.ok { background: var(--color-success); border-color: var(--color-success); }
.med-row-status.skip { background: var(--color-danger); border-color: var(--color-danger); }

/* ---------- Einstellungen ---------- */
.settings-nav { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1.6rem; }
.settings-nav a {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-pill);
  padding: 0.45rem 0.95rem; font-size: 0.86rem; font-weight: 500; color: var(--color-text);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.settings-nav a:hover { background: var(--color-primary-light); text-decoration: none; border-color: var(--color-primary-light); }
.settings-section { scroll-margin-top: 1rem; }
.settings-section h2 { display: flex; align-items: center; gap: 0.5rem; }

/* ---------- Kalenderansicht ---------- */
.cal-day {
  display: flex; gap: 1rem; align-items: flex-start;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow-soft);
  padding: 1.1rem 1.25rem; margin-bottom: 0.9rem;
}
.cal-day.is-today { border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary), var(--shadow-soft); }
.cal-day.is-weekend .cal-day-badge { background: var(--color-bg); color: var(--color-muted); }

.cal-day-badge {
  flex-shrink: 0; width: 58px; text-align: center; line-height: 1.1;
  background: var(--color-primary-light); color: var(--color-primary-dark);
  border-radius: var(--radius-sm); padding: 0.5rem 0.25rem;
}
.cal-day.is-today .cal-day-badge { background: var(--color-primary); color: #fff; }
[data-theme="dark"] .cal-day.is-today .cal-day-badge { color: #0d111c; }
.cd-weekday { display: block; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.85; }
.cd-day { display: block; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cd-month { display: block; font-size: 0.66rem; font-weight: 600; text-transform: uppercase; opacity: 0.8; }

.cal-day-body { flex: 1; min-width: 0; }
.cal-day-head {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding-bottom: 0.6rem; margin-bottom: 0.7rem; border-bottom: 1px solid var(--color-border);
}
.cal-day-head strong { font-family: var(--font-display); font-size: 1rem; }
.cal-day-head .muted { font-size: 0.85rem; }
.cal-day-count { margin-left: auto; font-size: 0.74rem; color: var(--color-muted); font-weight: 600; }

/* Ganztägige und mehrtägige Termine: durchgehendes Band */
.cal-band {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  background: var(--color-bg);
  background: color-mix(in srgb, var(--feed, #003079) 10%, transparent);
  border-left: 4px solid var(--feed, var(--color-primary));
  border-radius: 6px; padding: 0.5rem 0.75rem; margin-bottom: 0.4rem;
}
.cal-band-title { font-weight: 600; }

/* Termine mit Uhrzeit */
.cal-item {
  display: flex; gap: 0.9rem; align-items: flex-start;
  padding: 0.55rem 0 0.55rem 0.8rem; margin-bottom: 0.25rem;
  border-left: 3px solid var(--feed, var(--color-primary));
}
.cal-item-time {
  min-width: 52px; flex-shrink: 0; display: flex; flex-direction: column;
  line-height: 1.2; font-variant-numeric: tabular-nums;
}
.cal-item-time .t-start { font-weight: 700; font-size: 0.95rem; color: var(--color-text); }
.cal-item-time .t-end { font-size: 0.8rem; color: var(--color-muted); }
.cal-item-body { min-width: 0; flex: 1; }
.cal-item-title { font-weight: 600; }
.cal-item-meta { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 0.1rem; }
.cal-meta { font-size: 0.8rem; color: var(--color-muted); }
.cal-feed { font-size: 0.74rem; }

.allday-mark {
  display: inline-block; padding: 0.12rem 0.5rem; border-radius: 5px;
  background: var(--feed, var(--color-primary)); color: #fff;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em;
}
.span-tag {
  display: inline-block; padding: 0.12rem 0.55rem;
  background: var(--color-danger); color: #fff;
  border-radius: 5px; font-size: 0.68rem; font-weight: 700; white-space: nowrap;
}

.range-nav {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.range-nav strong { font-family: var(--font-display); font-size: 1.02rem; }
/* Datumsauswahl: Beschriftung sichtbar, das Eingabefeld liegt unsichtbar darüber */
.range-picker { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.range-picker:hover strong { color: var(--color-primary-dark); text-decoration: underline dotted; }
.range-picker input[type="date"] {
  position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%;
  border: none; padding: 0; cursor: pointer;
}

/* ---------- Monatsraster ---------- */
.cal-grid-month {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px;
  background: var(--color-border); border: 1px solid var(--color-border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem;
}
.cgm-head {
  background: var(--color-surface); padding: 0.5rem; text-align: center;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--color-muted);
}
.cgm-cell { background: var(--color-surface); min-height: 104px; padding: 0.35rem 0.4rem; }
.cgm-cell.is-outside { background: var(--color-bg); }
.cgm-cell.is-outside .cgm-num { opacity: 0.4; }
.cgm-cell.is-today { box-shadow: inset 0 0 0 2px var(--color-primary); }
.cgm-num { font-weight: 700; font-size: 0.82rem; font-variant-numeric: tabular-nums; margin-bottom: 0.2rem; }
.cgm-cell.is-today .cgm-num { color: var(--color-primary-dark); }
.cgm-ev {
  font-size: 0.7rem; line-height: 1.25; margin-bottom: 0.15rem; padding: 0.1rem 0.3rem;
  border-left: 3px solid var(--feed, var(--color-primary)); border-radius: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cgm-ev.is-allday { background: var(--feed, var(--color-primary)); color: #fff; border-left: none; }
.cgm-time { font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 0.2rem; }
.cgm-more { font-size: 0.66rem; color: var(--color-muted); }

/* ---------- Wochenkalender ---------- */
.cal-grid-week {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px;
  background: var(--color-border); border: 1px solid var(--color-border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem;
}
.cgw-col { background: var(--color-surface); display: flex; flex-direction: column; min-height: 260px; }
.cgw-col.is-weekend { background: var(--color-bg); }
.cgw-col.is-today { box-shadow: inset 0 0 0 2px var(--color-primary); }
.cgw-head {
  padding: 0.5rem 0.4rem; text-align: center; border-bottom: 1px solid var(--color-border);
}
.cgw-wd { display: block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); }
.cgw-date { display: block; font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.cgw-col.is-today .cgw-date { color: var(--color-primary-dark); }
.cgw-body { padding: 0.35rem; flex: 1; }
.cgw-ev {
  font-size: 0.72rem; line-height: 1.3; margin-bottom: 0.3rem; padding: 0.25rem 0.4rem;
  border-left: 3px solid var(--feed, var(--color-primary));
  background: var(--color-bg); border-radius: 4px;
}
.cgw-ev.is-allday { background: var(--feed, var(--color-primary)); color: #fff; border-left: none; font-weight: 600; }
.cgw-time { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.cgw-title { display: block; }
.cgw-loc { display: block; opacity: 0.75; font-size: 0.66rem; }
.cgw-empty { color: var(--color-muted); font-size: 0.75rem; text-align: center; padding: 0.5rem 0; }

.print-head { display: none; }

@media (max-width: 760px) {
  /* Raster auf schmalen Geräten waagerecht scrollbar statt gequetscht */
  .cal-grid-month, .cal-grid-week { display: block; overflow-x: auto; white-space: nowrap; }
  .cal-grid-month { display: grid; grid-template-columns: repeat(7, minmax(84px, 1fr)); }
  .cal-grid-week { display: grid; grid-template-columns: repeat(7, minmax(140px, 1fr)); }
}

@media (max-width: 560px) {
  .cal-day { gap: 0.75rem; padding: 0.9rem; }
  .cal-day-badge { width: 46px; }
  .cd-day { font-size: 1.25rem; }
  .cal-day-head strong { font-size: 0.92rem; }
  .cal-day-count { flex-basis: 100%; margin-left: 0; }
}

/* Kalender drucken: schlicht, ohne Bedienelemente, farbige Marker bleiben erhalten */
@media print {
  .print-head { display: block; margin-bottom: 1rem; }
  .print-head h1 { font-size: 1.4rem; margin: 0 0 0.2rem; }
  .print-head p { margin: 0; color: #555; font-size: 0.9rem; }
  .cal-day {
    box-shadow: none; border: 1px solid #ccc; padding: 0.6rem 0.8rem;
    margin-bottom: 0.45rem; break-inside: avoid;
  }
  .cal-day.is-today { box-shadow: none; }
  .cal-day-badge, .cal-band, .allday-mark, .span-tag, .badge,
  .cgm-cell, .cgm-ev, .cgw-col, .cgw-ev, .cal-grid-month, .cal-grid-week {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .cal-day-count { display: none; }
  /* Raster im Ausdruck vollständig zeigen, nicht scrollen */
  .cal-grid-month { display: grid !important; grid-template-columns: repeat(7, 1fr) !important; overflow: visible !important; }
  .cal-grid-week { display: grid !important; grid-template-columns: repeat(7, 1fr) !important; overflow: visible !important; }
  .cgm-cell { min-height: 74px; break-inside: avoid; }
  .cgw-col { min-height: 0; break-inside: avoid; }
  .cgm-ev, .cgw-ev { white-space: normal; }
}

/* ---------- PDF-Export ---------- */
.pdf-hinweis {
  position: fixed; left: 50%; top: 1.2rem; transform: translateX(-50%);
  background: var(--color-primary); color: #fff;
  padding: 0.6rem 1.2rem; border-radius: var(--radius-pill);
  font-size: 0.86rem; font-weight: 600; z-index: 200;
  box-shadow: 0 6px 20px rgba(0, 48, 121, 0.35);
}
.pdf-hinweis.is-fehler { background: var(--color-danger); box-shadow: 0 6px 20px rgba(192, 72, 63, 0.35); }
/* Während der Aufnahme dieselben Elemente ausblenden wie beim Drucken */
body.pdf-exporting .topbar,
body.pdf-exporting .sidebar,
body.pdf-exporting .nav-scrim,
body.pdf-exporting .no-print,
body.pdf-exporting .header-actions,
body.pdf-exporting .build-stamp,
body.pdf-exporting .tab-row,
body.pdf-exporting .pdf-hinweis { display: none !important; }
body.pdf-exporting .print-head { display: block !important; }
body.pdf-exporting .content { padding: 0; max-width: none; }
body.pdf-exporting .cal-grid-month,
body.pdf-exporting .cal-grid-week { display: grid !important; grid-template-columns: repeat(7, 1fr) !important; overflow: visible !important; }

/* ---------- Offline-Status ---------- */
.offline-indicator {
  position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%);
  background: var(--color-primary); color: #fff;
  padding: 0.55rem 1.1rem; border-radius: var(--radius-pill);
  font-size: 0.84rem; font-weight: 500; z-index: 60;
  box-shadow: 0 6px 20px rgba(0, 48, 121, 0.35);
  max-width: calc(100vw - 2rem); text-align: center;
}
.offline-indicator.is-offline {
  background: var(--color-warning);
  box-shadow: 0 6px 20px rgba(200, 134, 47, 0.35);
}

.offline-toast {
  position: fixed; left: 50%; bottom: 4.2rem; transform: translate(-50%, 12px);
  background: var(--color-text); color: #fff;
  padding: 0.7rem 1.2rem; border-radius: var(--radius-sm);
  font-size: 0.86rem; z-index: 61; max-width: calc(100vw - 2rem);
  opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: var(--shadow-hover);
}
.offline-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Barrierefreiheit & Ausgabe ---------- */
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  .topbar, .sidebar, .nav-scrim, .no-print, .fab, .header-actions, .icon-btn, .build-stamp, .tab-row { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card, .week-card, .day-card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

@media (max-width: 780px) {
  .topbar { padding: 0.75rem 1.1rem; gap: 0.7rem; }
  .topbar .brand span { display: none; }   /* auf schmalen Geräten nur das Signet zeigen */
  .topbar-user .user-name { display: none; }
  .content { padding: 1.15rem; }
  h1 { font-size: 1.45rem; }
}

.build-stamp {
  text-align: center; font-size: 0.68rem; color: var(--color-muted);
  opacity: 0.6; margin: 0.5rem 0 1rem;
}
