/* NAGEVI Health Tracker */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #F4F1E9;
  --bg-soft: #EDE8DC;
  --bg-card: #FFFFFF;
  --bg-card2: #FBFAF4;
  --surface: #FFFFFF;
  --surface2: #FBFAF4;
  --border: #E5DFD0;
  --border-strong: #D6CFB9;
  --text: #1A2520;
  --text-soft: #3D4D44;
  --text-muted: #6E7D74;
  --accent: #3F8F5C;
  --accent-dark: #2D6E45;
  --accent-light: #E8F5EE;
  --accent2: #E89A6B;
  --red: #B84947;
  --red-light: #FDECEA;
  --orange: #C98A2C;
  --orange-light: #FEF3E2;
  --green: #3F8F5C;
  --green-light: #E8F5EE;
  --nav-height: 56px;
  --radius: 22px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(20,40,30,0.04), 0 8px 24px rgba(20,40,30,0.06);
  --shadow: 0 1px 4px rgba(20,40,30,0.08);
}

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

html {
  font-size: 16px;
  overflow-x: hidden; /* verhindert viewport-Expansion durch überlaufende Tabellen */
  max-width: 100%;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100%;
}

/* ── Navigation ─────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(20,40,30,0.06);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  margin-right: 8px;
}

.nav-logo img { height: 28px; width: auto; }

.nav-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.nav-brand-main {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.nav-brand-sub {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  position: relative;
}

.nav-indicator {
  position: absolute;
  bottom: -8px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  transition: left 320ms cubic-bezier(0.4, 0, 0.2, 1),
              width 320ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.nav-tab {
  height: 40px;
  padding: 0 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  min-width: 44px;
  min-height: 44px;
}

.nav-tab:hover { background: transparent; color: var(--text); }
.nav-tab.active { color: var(--accent); font-weight: 600; background: transparent; }

.nav-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.nav-bell {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-bell:hover { background: var(--accent-light); color: var(--accent); }

.nav-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-pill);
  transition: background 0.15s;
}
.nav-avatar-wrap:hover { background: var(--accent-light); }

.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.btn-logout { display: none; }

#greetingText {
  overflow: visible;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.main { padding: 24px 16px; max-width: 1200px; margin: 0 auto; }

.page { display: none; }
.page.active { display: block; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-family: 'JetBrains Mono', monospace;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  border-left: 4px solid;
}

.alert.red { background: var(--red-light); border-color: var(--red); color: var(--red); }
.alert.orange { background: var(--orange-light); border-color: var(--orange); color: var(--orange); }
.alert.green { background: var(--green-light); border-color: var(--green); color: var(--green); }

/* ── Stat Boxes ─────────────────────────────────────────────────────────── */
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: left;
  box-shadow: var(--shadow-card);
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  line-height: 1;
}
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }
.stat-unit { font-size: 14px; font-weight: 400; color: var(--text-muted); }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-section { margin-bottom: 32px; }
.form-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); }

input[type="text"], input[type="number"], input[type="date"], input[type="password"],
select, textarea {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  width: 100%;
  transition: border-color 0.15s;
}
textarea { height: 80px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Fokus-Chips ─────────────────────────────────────────────────────────── */
.fokus-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  background: var(--bg);
  transition: all 0.15s;
  user-select: none;
}
.fokus-chip input[type="checkbox"] { display: none; }
.fokus-chip:has(input:checked) {
  border-color: var(--accent);
  background: rgba(63,143,92,0.08);
  color: var(--accent);
  font-weight: 600;
}

/* ── Toggle Buttons ─────────────────────────────────────────────────────── */
.toggle-btn {
  height: auto;
  min-height: 52px;
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  justify-content: center;
  min-width: 80px;
}
.supp-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.supp-detail {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.3;
  text-align: left;
}
.toggle-btn.on .supp-name { color: var(--green); }
.toggle-btn.on .supp-detail { color: var(--green); opacity: 0.75; }
.toggle-btn.on {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green);
}
.toggle-btn.on-red {
  border-color: var(--red);
  background: var(--red-light);
  color: var(--red);
}

/* Star Rating */
.star-rating { display: flex; gap: 6px; }
.star {
  font-size: 24px;
  cursor: pointer;
  color: var(--border);
  line-height: 1;
  transition: color 0.1s;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.star.active { color: var(--accent); }

/* ── Supplement Toggles ─────────────────────────────────────────────────── */
.supp-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.supp-btn {
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.supp-btn.on { border-color: var(--green); background: var(--green-light); color: var(--green); }
.supp-check { font-size: 16px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 14px rgba(63,143,92,0.35);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(63,143,92,0.5);
}
.btn-secondary { background: var(--bg-card2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── Ampel Badges ───────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.badge-ok { background: var(--green-light); color: var(--green); }
.badge-warn { background: var(--orange-light); color: var(--orange); }
.badge-high { background: var(--red-light); color: var(--red); }
.badge-neutral { background: var(--bg-card2); color: var(--text-muted); }

/* ── Heatmap ────────────────────────────────────────────────────────────── */
.heatmap {
  display: grid;
  grid-template-columns: repeat(7, 30px) 22px;
  grid-auto-rows: auto;
  gap: 3px;
  margin-top: 8px;
}
.heatmap-label {
  height: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: var(--text-muted);
}
.heatmap-day {
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 500; cursor: default;
  border: 1px solid var(--border); color: var(--text-muted); background: var(--surface2);
}
.heatmap-day.green  { background: var(--green-light);  color: var(--green);  border-color: var(--green); }
.heatmap-day.orange { background: var(--orange-light); color: var(--orange); border-color: var(--orange); }
.heatmap-day.red    { background: var(--red-light);    color: var(--red);    border-color: var(--red); }
.heatmap-badge { display: flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; }

/* ── Chart Container ────────────────────────────────────────────────────── */
.chart-wrap { position: relative; height: 390px; margin-top: 12px; }

/* ── Fibroscan Zones ────────────────────────────────────────────────────── */
.fibro-stage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
}
.fibro-f01 { background: var(--green-light); color: var(--green); }
.fibro-f2  { background: #FFF9E6; color: #B7860B; }
.fibro-f3  { background: var(--orange-light); color: var(--orange); }
.fibro-f4  { background: var(--red-light); color: var(--red); }

/* ── Sections (Labor) ───────────────────────────────────────────────────── */
.section-header {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}
.section-header:first-child { margin-top: 0; }

/* ── Login Page ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-card);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.login-logo img { height: 36px; }
.login-title { font-size: 20px; font-weight: 700; }
.login-error {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid #f5c6c2;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* ── Spacers ────────────────────────────────────────────────────────────── */
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.gap-8 { gap: 8px; }
.flex  { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-12 { gap: 12px; }

/* ── Inline Alkohol-Warnung ─────────────────────────────────────────────── */
.alkohol-warning {
  display: none;
  background: var(--red-light);
  color: var(--red);
  border: 1px solid #f5c6c2;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  margin-top: 48px;
  padding: 20px 16px;
  border-top: 1px solid var(--border);
  text-align: left;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── KI-Analyse Result ───────────────────────────────────────────────────── */
.analyse-result { font-size: 13px; line-height: 1.65; color: var(--text); }
.analyse-web h2, .analyse-plan h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-dark);
  border-left: 3px solid var(--accent);
  padding: 10px 0 10px 10px;
  margin: 28px 0 8px;
  background: var(--bg-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  letter-spacing: 0.1px;
}
.analyse-web h2:first-child, .analyse-plan h2:first-child { margin-top: 4px; }
.analyse-web h3, .analyse-plan h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 12px 0 4px;
}
.analyse-web h4, .analyse-plan h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 8px 0 3px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.analyse-web p, .analyse-plan p { margin-bottom: 6px; }
.analyse-web ul, .analyse-web ol, .analyse-plan ul, .analyse-plan ol { padding-left: 18px; margin-bottom: 8px; }
.analyse-web li, .analyse-plan li { margin-bottom: 3px; }
.analyse-web table, .analyse-plan table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0 12px;
}
.analyse-web th, .analyse-plan th {
  background: var(--bg-card2);
  font-weight: 600;
  padding: 6px 10px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.analyse-web td, .analyse-plan td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.analyse-web tr:last-child td, .analyse-plan tr:last-child td { border-bottom: none; }
.analyse-truncated {
  color: var(--orange);
  font-size: 11px;
  margin-top: 12px;
}

/* ── Botanic v2 Heatmap Tab-Switcher ────────────────────────────────────── */
.hm-tab {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 180ms, color 180ms, box-shadow 180ms;
}
.hm-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(20,40,30,0.08);
}
.hm-tab:hover:not(.active) { color: var(--text-soft, var(--text)); }

/* ── Arztbesuch-Ansicht ─────────────────────────────────────────────────── */
.arzt-chart-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:16px; margin-bottom:16px; }
@media (max-width:700px) { .arzt-chart-grid { grid-template-columns:1fr; } }
.arzt-chart-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:18px 18px 14px; box-shadow:var(--shadow-card); }
.arzt-chart-card .eyebrow { margin-bottom:4px; }
.arzt-chart-canvas-wrap { position:relative; height:220px; margin-top:10px; }
#labArztbesuchBtn.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.lab-group-hdr td { font-size:10px; font-weight:700; letter-spacing:0.08em; text-transform:uppercase; color:var(--text-muted); background:var(--bg-soft); padding:8px 10px 4px !important; }
.lab-arzt-tbl { border-collapse:collapse; width:100%; min-width:600px; }
.lab-arzt-tbl th { font-size:10px; font-weight:700; letter-spacing:0.06em; color:var(--text-muted); text-transform:uppercase; padding:8px 10px; border-bottom:1px solid var(--border); white-space:nowrap; }
.lab-arzt-tbl td { font-size:13px; padding:7px 10px; border-bottom:1px solid var(--border); white-space:nowrap; }
.lab-arzt-tbl tr:hover td { background:var(--surface2); }
.lab-arzt-val-ok   { color:var(--accent); font-weight:600; }
.lab-arzt-val-warn { color:var(--orange); font-weight:700; background:var(--orange-light); }
.lab-arzt-val-crit { color:var(--red);    font-weight:700; background:var(--red-light); }
.arzt-data-row.selected { background:rgba(63,143,92,0.06) !important; }

@page { size: A4 portrait; margin: 12mm; }

@media print {
  .nav, .lab-header-actions, #pdfImportStatus, .arzt-print-btn,
  .arzt-topbar, #labArztbesuchEntry { display:none !important; }
  body, html { background:#fff !important; }
  .card { box-shadow:none !important; break-inside:avoid; }
  * { -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important; }

  /* Mobile-Overrides zurücksetzen → volle A4-Breite */
  html, body {
    width: 100% !important;
    max-width: none !important;
    overflow: visible !important;
    padding: 0 !important;
  }
  .main {
    padding: 12px !important;
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
  }
  /* 2-Spalten-Grid für Arzt-Charts auch auf Mobile */
  .arzt-chart-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    width: 100% !important;
  }
  .arzt-chart-canvas-wrap {
    height: 180px !important;
    width: 100% !important;
  }
  .arzt-chart-card {
    width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* ── Botanic v2 Animationen ─────────────────────────────────────────────── */
@keyframes v2draw   { to { stroke-dashoffset: 0; } }
@keyframes v2dotin  { to { opacity: 1; } }
@keyframes v2fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Analyse-Seite ──────────────────────────────────────────────────────── */
.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.eyebrow.mb-4 { margin-bottom: 4px; }
.analyse-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.analyse-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin: 4px 0 2px;
}
.analyse-sub {
  font-size: 13px;
  color: var(--accent);
  margin: 0;
}
.analyse-header-btns {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding-top: 6px;
}
.card-section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.card-section-title.mt-4 { margin-top: 4px; }

/* Insight Cards */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 580px) { .insight-grid { grid-template-columns: 1fr; } }
.insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: var(--shadow-card);
}
.insight-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 700;
}
.insight-icon.green  { background: var(--accent-light); color: var(--accent); }
.insight-icon.orange { background: var(--orange-light); color: var(--orange); }
.insight-icon.red    { background: var(--red-light);    color: var(--red); }
.insight-icon.neutral{ background: var(--bg-soft);      color: var(--text-muted); }
.insight-body { flex: 1; min-width: 0; }
.insight-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.insight-title { font-size: 14px; font-weight: 600; color: var(--text); }
.insight-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.insight-badge.fortschritt { background: var(--accent-light); color: var(--accent); }
.insight-badge.beachten    { background: var(--orange-light); color: var(--orange); }
.insight-badge.warnung     { background: var(--red-light);    color: var(--red); }
.insight-value { font-size: 20px; font-weight: 700; color: var(--accent); margin: 2px 0; }
.insight-desc  { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* Energie-Stat-Reihe */
.analyse-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 600px) { .analyse-stat-row { grid-template-columns: repeat(2, 1fr); } }
.analyse-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.analyse-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin: 4px 0 2px;
}
.analyse-stat-unit { font-size: 11px; color: var(--text-muted); }

/* Kalorienbalken */
.kal-bar-track {
  position: relative;
  height: 8px;
  background: var(--bg-soft);
  border-radius: 4px;
  overflow: visible;
}
.kal-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.7s ease;
  max-width: 100%;
}
.kal-bar-marker {
  position: absolute;
  top: -4px;
  width: 2px;
  height: 16px;
  background: var(--border-strong);
  border-radius: 1px;
}

/* Empfehlungs-Liste */
.empf-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.empf-item:last-child { border-bottom: none; }
.empf-nr {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.empf-nr.red    { background: var(--red-light);    color: var(--red); }
.empf-nr.orange { background: var(--orange-light); color: var(--orange); }
.empf-body { flex: 1; min-width: 0; }
.empf-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.empf-titel { font-size: 14px; font-weight: 600; color: var(--text); }
.prio-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 1px 7px;
}
.empf-text { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* Nav brand sub adjust for longer text */
.nav-brand-sub { max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Labor v2 ───────────────────────────────────────────────────────────── */
.lab-page-header { display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:wrap; }
.lab-page-title  { font-size:24px; font-weight:700; color:var(--text); margin:4px 0 2px; }
.lab-page-sub    { font-size:13px; color:var(--text-muted); margin:0; }
.lab-header-actions { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }

.lab-feat-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }
.lab-feat-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:18px 18px 14px; box-shadow:var(--shadow-card); display:flex; flex-direction:column; aspect-ratio:3/2; }
.lab-feat-top  { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:8px; flex-shrink:0; }
.lab-feat-label { font-size:12px; font-weight:700; color:var(--text); }
.lab-feat-badge { font-size:10px; font-weight:700; letter-spacing:0.06em; padding:2px 8px; border-radius:var(--radius-pill); }
.lab-badge-ok   { background:var(--accent-light); color:var(--accent); }
.lab-badge-warn { background:var(--orange-light); color:var(--orange); }
.lab-badge-crit { background:var(--red-light); color:var(--red); }
.lab-feat-value { font-size:32px; font-weight:700; color:var(--text); line-height:1; }
.lab-feat-unit  { font-size:14px; color:var(--text-muted); }
.lab-feat-trend { font-size:12px; font-weight:700; }
.lab-feat-trend.good { color:var(--accent); }
.lab-feat-trend.bad  { color:var(--orange); }
.lab-feat-ref     { font-size:11px; color:var(--text-muted); margin-bottom:0; }
.lab-feat-sparkline { margin-top:10px; flex:1; min-height:0; position:relative; }

.lab-fibro-scale  { position:relative; height:8px; border-radius:4px; background:linear-gradient(to right,#4caf50,#8bc34a,#ffc107,#ff7043,#c62828); margin-bottom:6px; }
.lab-fibro-dot    { position:absolute; top:50%; width:14px; height:14px; border-radius:50%; background:#fff; border:3px solid var(--text); transform:translate(-50%,-50%); }
.lab-fibro-labels { display:flex; justify-content:space-between; font-size:10px; color:var(--text-muted); }

.lab-all-ok   { display:inline-flex; padding:2px 9px; border-radius:var(--radius-pill); font-size:10px; font-weight:700; background:transparent; border:1px solid var(--accent); color:var(--accent); }
.lab-all-warn { display:inline-flex; padding:2px 9px; border-radius:var(--radius-pill); font-size:10px; font-weight:700; background:var(--orange); border:1px solid var(--orange); color:#fff; }

/* ── Tag v2 ─────────────────────────────────────────────────────────────── */
.tag-page-header { margin-bottom: 20px; }
.tag-page-title  { font-size: 26px; font-weight: 700; color: var(--text); margin: 4px 0 0; }

.tag-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tag-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tag-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 700px) {
  .tag-grid-4, .tag-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .tag-grid-2 { grid-template-columns: repeat(2, 1fr); }
}

.tag-input-tile { display: flex; flex-direction: column; gap: 6px; }
.tag-input-tile input,
.tag-input-tile select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: var(--bg-soft);
  color: var(--text);
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.tag-input-tile input:focus,
.tag-input-tile select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}
.tag-tile-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tag-toggle-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.toggle-btn-sm {
  min-height: 36px !important;
  padding: 5px 18px !important;
  font-size: 13px !important;
  width: auto !important;
  border-radius: var(--radius-sm) !important;
  flex: 0 0 auto;
}

/* Segmented Ja/Nein control — same visual weight as an input */
.tag-seg {
  display: flex;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-soft);
}
.tag-seg button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.tag-seg button + button { border-left: 1px solid var(--border); }
.tag-seg button.on     { background: var(--accent); color: #fff; }
.tag-seg button.on-red { background: var(--red);    color: #fff; }
.tag-star-group {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 120px;
}

/* Supplement list */
.supp-list { display: flex; flex-direction: column; gap: 6px; }
.supp-list .supp-btn {
  width: 100%;
  height: auto;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  justify-content: flex-start;
  text-align: left;
}

/* Mini calendar */
.tag-cal-month { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.tag-cal-grid  { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.tag-cal-hdr   { font-size: 10px; font-weight: 700; color: var(--text-muted); text-align: center; padding: 2px 0 4px; }
.tag-cal-day   {
  font-size: 12px;
  text-align: center;
  padding: 5px 2px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-soft);
  line-height: 1;
  transition: background 0.12s;
  user-select: none;
}
.tag-cal-day:hover          { background: var(--border); }
.tag-cal-day.has-entry      { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.tag-cal-day.is-today       { outline: 1.5px solid var(--accent); }
.tag-cal-day.is-selected    { background: var(--accent) !important; color: #fff !important; font-weight: 700; }
.tag-cal-day.is-empty       { cursor: default; }

.mb-12 { margin-bottom: 12px; }
.mb-20 { margin-bottom: 20px; }

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE OPTIMIERUNGEN  (≤ 768px)
   Desktop-Layout bleibt vollständig erhalten – alle Regeln stehen in
   @media-Blöcken und überschreiben nichts auf großen Bildschirmen.
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ── Root-Anpassungen ────────────────────────────────────────────────── */
  :root {
    --nav-height: 56px;
    --mob-nav-bottom: 60px; /* Höhe der Bottom-Nav */
    --radius: 16px;
    --radius-sm: 10px;
  }

  /* ── Body: Platz für Bottom-Navigation ──────────────────────────────── */
  body {
    padding-bottom: var(--mob-nav-bottom);
  }

  /* ── TOP-Navigation: nur Logo + User-Avatar, keine Tabs ─────────────── */
  .nav {
    padding: 0 14px;
    gap: 12px;
  }

  /* Tab-Leiste oben komplett ausblenden */
  .nav-tabs {
    display: none !important;
  }

  /* Subtitle unter NAGEVI ausblenden (spart Platz) */
  .nav-brand-sub {
    display: none;
  }

  /* Bell etwas kleiner */
  .nav-bell {
    width: 32px;
    height: 32px;
  }

  /* Avatar-Wrap: Name ausblenden, nur Avatar zeigen */
  .nav-avatar-wrap > div:last-child {
    display: none;
  }

  /* ── BOTTOM-Navigation ───────────────────────────────────────────────── */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--mob-nav-bottom) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(20,40,30,0.08);
    z-index: 9999;
    align-items: stretch;
    transform: translateZ(0);
    will-change: transform;
    transition: none !important;
  }

  body {
    padding-bottom: calc(var(--mob-nav-bottom) + env(safe-area-inset-bottom, 0px));
  }

  .mobile-bottom-nav .mob-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    padding: 6px 1px;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
    min-width: 0;
  }

  .mobile-bottom-nav .mob-tab svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .mobile-bottom-nav .mob-tab.active {
    color: var(--accent);
  }

  .mobile-bottom-nav .mob-tab.active svg {
    stroke: var(--accent);
  }

  /* "Mehr" Dropdown */
  .mob-more-menu {
    display: none;
    position: fixed;
    bottom: calc(var(--mob-nav-bottom) + 8px);
    right: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    z-index: 300;
    overflow: hidden;
    min-width: 160px;
  }
  .mob-more-menu.open {
    display: block;
  }
  .mob-more-item {
    display: block;
    width: 100%;
    padding: 13px 18px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    text-align: left;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
  }
  .mob-more-item:last-child { border-bottom: none; }
  .mob-more-item.active { color: var(--accent); font-weight: 700; }

  /* ── Hauptinhalt ─────────────────────────────────────────────────────── */
  .main {
    padding: 16px 12px;
  }

  /* ── Hero-Karte ──────────────────────────────────────────────────────── */
  #heroCard {
    padding: 22px 18px !important;
  }

  /* Greeting h1 kleiner */
  #greetingHello {
    font-size: 26px !important;
  }

  /* Greeting Text: weniger Abstand oben */
  #greetingText {
    margin-top: 6px !important;
  }

  /* Buttons-Reihe: weniger Abstand oben */
  .v2-hero div[style*="margin-top:20px"] {
    margin-top: 10px !important;
  }

  /* Hero-Buttons nebeneinander */
  .v2-hero .btn {
    flex: 1;
    justify-content: center;
  }

  /* ── Streak-Ring: eigene Kachel auf Mobile ───────────────────────────── */
  #streakRingCard {
    position: static !important;
    width: auto !important;
    height: auto !important;
    display: flex !important;
    justify-content: center;
    align-items: center;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    margin-top: 12px;
  }

  #streakRingSvg {
    width: 216px !important;
    height: 216px !important;
  }

  /* ── 4-Stat-Kacheln (Dashboard) ─────────────────────────────────────── */
  /* Das Grid ist ein Inline-Style im HTML — override via spezifischen Selektor */
  #page-dashboard > div[style*="grid-template-columns:repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ── Heatmap (auf Mobile nach oben verschoben via JS) ───────────────── */
  #heatmapCard {
    margin-bottom: 12px;
  }

  /* ── Foto + Heatmap ──────────────────────────────────────────────────── */
  #page-dashboard > div[style*="grid-template-columns:200px 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Foto-Karte: volle Bildhöhe, kein Beschnitt */
  #dashMotivationCard {
    min-height: unset !important;
    max-height: unset !important;
    height: auto !important;
  }
  #dashMotivationImg {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    object-fit: unset !important;
    inset: unset !important;
    display: block !important;
  }
  #dashMotivationPlaceholder {
    min-height: 160px !important;
    max-height: unset !important;
  }

  /* ── "Diese Woche" Trends ────────────────────────────────────────────── */
  #page-dashboard > div.card > div[style*="grid-template-columns:repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ── Tag-Grid auf 2 Spalten ──────────────────────────────────────────── */
  .tag-grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Stern-Bewertungen: kleiner */
  .star {
    font-size: 20px;
    min-width: 36px;
    min-height: 36px;
  }

  /* ── Gewichtsverlauf-Karte: Tabs umbrechen ───────────────────────────── */
  .chart-wrap {
    height: 220px !important;
  }

  /* Chart-Header: Buttons umbrechen */
  .card > div[style*="justify-content:space-between"] > div[style*="display:flex"][style*="align-items:center"] {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  /* hm-tab kleiner */
  .hm-tab {
    padding: 5px 10px;
    font-size: 11px;
  }

  /* ── Labor Featured Grid: 1 Spalte ──────────────────────────────────── */
  .lab-feat-grid {
    grid-template-columns: 1fr !important;
  }

  .lab-feat-card {
    aspect-ratio: unset !important;
    min-height: 120px;
  }

  /* Labor-Seite Header */
  .lab-page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .lab-header-actions {
    width: 100%;
  }

  .lab-header-actions .btn {
    flex: 1;
    justify-content: center;
  }

  /* ── Analyse-Seite ───────────────────────────────────────────────────── */
  .analyse-header {
    flex-direction: column;
    gap: 12px;
  }

  .analyse-header-btns {
    align-items: flex-start;
    width: 100%;
  }

  .analyse-title {
    font-size: 22px;
  }

  .analyse-stat-row {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ── Arzt-Chart-Grid ─────────────────────────────────────────────────── */
  .arzt-chart-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── grid-2, grid-3 bereits auf 1fr, grid-4 → 2fr ───────────────────── */
  .grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ── Einstellungen: tag-grid-4 Profilfelder ──────────────────────────── */
  /* schon durch .tag-grid-4 override abgedeckt */

  /* ── Buttons: volle Breite bei manchen Aktionsblöcken ───────────────── */
  .lab-header-actions {
    flex-wrap: wrap;
  }

  /* ── Insight-Grid: 1 Spalte ──────────────────────────────────────────── */
  .insight-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── Formulare ───────────────────────────────────────────────────────── */
  .form-grid {
    grid-template-columns: 1fr !important;
  }

  /* Span-2 in form-grid zurücksetzen */
  .form-group[style*="grid-column:span 2"] {
    grid-column: span 1 !important;
  }

  /* ── Modals ──────────────────────────────────────────────────────────── */
  #schnellModal > div,
  #pwChangeModal > div,
  #cropModal > div {
    width: 96% !important;
    max-width: 96% !important;
    padding: 20px 16px !important;
  }

  /* Schnell-Modal Grid: 1 Spalte */
  #schnellModal .card > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important; /* 2er bleibt ok auf Mobile */
  }

  /* ── Report-Karten ───────────────────────────────────────────────────── */
  #reportSelector > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* ── Section Header / Eyebrow ────────────────────────────────────────── */
  .section-header {
    font-size: 16px;
    margin: 20px 0 12px;
  }

  /* ── Footer ──────────────────────────────────────────────────────────── */
  .footer {
    margin-top: 24px;
    font-size: 11px;
  }

  /* ── Card padding etwas reduzieren ──────────────────────────────────── */
  .card {
    padding: 16px;
  }

  /* ── KI-Analyse Buttons ──────────────────────────────────────────────── */
  #kiAnalyseModeToggle {
    width: 100%;
  }
  #kiAnalyseModeToggle button {
    flex: 1;
  }
  #kiAnalyseBtn {
    width: 100%;
    justify-content: center;
  }

  /* ── Tabellen horizontal scrollbar (verhindert Viewport-Overflow) ──────── */
  .table-wrap,
  .analyse-result,
  #page-tag .card {
    overflow-x: hidden;
  }

  .analyse-web table,
  .analyse-plan table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── tag-star-group: umbrechen ───────────────────────────────────────── */
  .tag-star-group {
    min-width: 0;
  }

} /* end @media 768px */


/* ── Bottom-Nav auf Desktop verstecken ─────────────────────────────────── */
.mobile-bottom-nav {
  display: none;
}

/* ── Sehr kleine Bildschirme (≤ 380px) ──────────────────────────────────── */
@media (max-width: 380px) {
  .tag-grid-4 {
    grid-template-columns: 1fr !important;
  }

  #greetingHello {
    font-size: 22px !important;
  }

  .hm-tab {
    padding: 4px 7px;
    font-size: 10px;
  }

  .main {
    padding: 12px 10px;
  }
}
