/* =========================================
   HUNDETAGEBUCH v2 – Material Design 3
   ========================================= */

:root {
  --primary: #6750A4;
  --primary-container: #EADDFF;
  --on-primary: #FFFFFF;
  --secondary: #958DA5;
  --secondary-container: #E8DEF8;
  --surface: #FFFBFE;
  --surface-variant: #E7E0EC;
  --surface-dim: #F4EFF4;
  --on-surface: #1C1B1F;
  --on-surface-variant: #49454F;
  --outline: #79747E;
  --outline-variant: #CAC4D0;
  --error: #B3261E;
  --error-container: #F9DEDC;
  --success: #386A20;
  --success-container: #C3EFAD;
  --warning: #7D5700;
  --warning-container: #FFDDB3;
  --tertiary: #B58392;
  --card-bg: #FFFFFF;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --nav-height: 72px;
  --header-height: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #D0BCFF;
    --primary-container: #4F378B;
    --on-primary: #381E72;
    --surface: #1C1B1F;
    --surface-variant: #49454F;
    --surface-dim: #141218;
    --on-surface: #E6E1E5;
    --on-surface-variant: #CAC4D0;
    --outline: #938F99;
    --outline-variant: #49454F;
    --card-bg: #2B2930;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.4);
  }
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  color: var(--on-surface);
  background: var(--surface);
}

/* ===== App Shell ===== */
.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.hidden { display: none !important; }

/* ===== Header ===== */
.app-header {
  position: fixed;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--outline-variant);
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 100%;
}

#header-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--on-surface);
}

/* ===== Main ===== */
.app-main {
  flex: 1;
  margin-top: var(--header-height);
  margin-bottom: var(--nav-height);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== Pages ===== */
.page {
  display: none;
  animation: fadeIn 0.2s ease;
}
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-content {
  padding: 8px 16px 16px;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--outline-variant);
  display: flex;
  align-items: center;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  color: var(--on-surface-variant);
  transition: color 0.2s;
  min-height: 48px;
  justify-content: center;
}

.nav-item.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 24px;
  line-height: 1;
}

.nav-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ===== Dog Selector ===== */
.dog-selector {
  display: flex;
  gap: 8px;
  padding: 12px 16px 0;
}

.dog-tab {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-xl);
  background: var(--surface-variant);
  color: var(--on-surface-variant);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
  min-height: 48px;
}

.dog-tab.active {
  background: var(--primary-container);
  color: var(--primary);
}

/* ===== Date Nav ===== */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
}

.date-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--on-surface);
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--on-surface-variant);
  margin-bottom: 8px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* ===== Today Dashboard ===== */
.today-dog-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.today-dog-emoji { font-size: 2.5rem; }

.today-dog-photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--outline-variant);
}

.today-dog-info h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.today-dog-info p {
  font-size: 0.85rem;
  color: var(--on-surface-variant);
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 16px 12px;
}

.summary-chip {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow);
  text-align: center;
}

.summary-chip-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  display: block;
}

.summary-chip-label {
  font-size: 0.75rem;
  color: var(--on-surface-variant);
}

/* ===== Progress Bar ===== */
.progress-bar-wrap {
  background: var(--surface-variant);
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-bar {
  height: 100%;
  border-radius: 8px;
  transition: width 0.5s ease;
}

.progress-bar.green { background: #386A20; }
.progress-bar.yellow { background: #B17400; }
.progress-bar.red { background: #B3261E; }

/* ===== Feeding Hint ===== */
.feeding-hint {
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}
.feeding-hint.green { background: var(--success-container); color: var(--success); }
.feeding-hint.yellow { background: var(--warning-container); color: var(--warning); }
.feeding-hint.red { background: var(--error-container); color: var(--error); }

/* ===== Entry Cards ===== */
.entry-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.entry-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.entry-time {
  font-size: 0.8rem;
  color: var(--on-surface-variant);
  font-weight: 500;
}

.entry-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
}

.badge-fleisch { background: #FFDDB3; color: #7D5700; }
.badge-pflanze { background: #C3EFAD; color: #386A20; }
.badge-fasten { background: #BCD3F5; color: #1B4F8A; }
.badge-gemischt { background: var(--surface-variant); color: var(--on-surface-variant); }

.entry-foods {
  font-size: 0.9rem;
  color: var(--on-surface);
}

.entry-calories {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 4px;
}

/* ===== Consistency Pills (Kot) ===== */
.stool-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.stool-badge-flüssig { background: #BCD3F5; color: #1B4F8A; }
.stool-badge-weich { background: #FFDDB3; color: #7D5700; }
.stool-badge-normal { background: #C3EFAD; color: #386A20; }
.stool-badge-fest { background: #F9DEDC; color: #B3261E; }
.stool-badge-super { background: #E8DEF8; color: #6750A4; }

/* ===== Medication Cards ===== */
.medi-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.medi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.medi-name {
  font-size: 1rem;
  font-weight: 700;
}

.medi-dosage {
  font-size: 0.85rem;
  color: var(--on-surface-variant);
  margin-top: 2px;
}

.medi-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

.freq-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--secondary-container);
  color: var(--primary);
}

.give-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: opacity 0.2s;
}

.give-btn:active { opacity: 0.8; }
.give-btn.given { background: var(--success); }

/* ===== Reminder Cards ===== */
.reminder-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}

.reminder-icon { font-size: 1.5rem; }

.reminder-info { flex: 1; }

.reminder-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.reminder-meta {
  font-size: 0.8rem;
  color: var(--on-surface-variant);
  margin-top: 2px;
}

.reminder-overdue { color: var(--error); }

.complete-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.complete-btn:active { background: var(--success-container); }

/* ===== Weight Chart (SVG) ===== */
.weight-chart {
  width: 100%;
  height: 200px;
  overflow: visible;
}

.chart-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-area {
  fill: url(#chart-gradient);
  opacity: 0.3;
}

.chart-dot {
  fill: var(--primary);
  r: 4;
}

/* ===== Stats ===== */
.stat-section {
  margin-bottom: 20px;
}

.stat-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 16px;
  margin-bottom: 8px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--outline-variant);
}

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

.stat-label { font-size: 0.9rem; color: var(--on-surface-variant); }
.stat-value { font-size: 0.9rem; font-weight: 700; color: var(--on-surface); }

/* ===== Profile Cards ===== */
.profile-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

.profile-avatar {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 12px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-variant);
}

.profile-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-name {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
}

.profile-fields { display: flex; flex-direction: column; gap: 8px; }

.profile-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--outline-variant);
}

.profile-field:last-child { border-bottom: none; }

.field-label {
  font-size: 0.85rem;
  color: var(--on-surface-variant);
}

.field-value {
  font-size: 0.9rem;
  font-weight: 600;
}

/* ===== Editable Weight Fields ===== */
.editable-weight,
.editable-target-weight {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weight-input,
.target-weight-input {
  width: 80px;
  padding: 6px 10px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-container);
  color: var(--on-surface);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.weight-input:focus,
.target-weight-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.weight-unit {
  font-size: 0.85rem;
  color: var(--on-surface-variant);
  font-weight: 500;
}

.weight-save-btn,
.target-weight-save-btn {
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.weight-save-btn:hover,
.target-weight-save-btn:hover {
  background: color-mix(in srgb, var(--primary) 90%, black);
}

.weight-save-btn:active,
.target-weight-save-btn:active {
  transform: scale(0.95);
}

.weight-field,
.target-weight-field {
  border-bottom: none;
}

.profile-field:has(.editable-weight):last-child,
.profile-field:has(.editable-target-weight):last-child {
  border-bottom: none;
}

/* ===== FAB ===== */
.fab-group {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  right: max(16px, calc(50% - 260px + 16px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 50;
}

.fab {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: transform 0.15s, box-shadow 0.15s;
}

.fab-primary {
  background: var(--primary);
  color: var(--on-primary);
  font-size: 1.5rem;
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  right: max(16px, calc(50% - 260px + 16px));
  z-index: 50;
}

.fab-mini {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--secondary-container);
  color: var(--primary);
  font-size: 1.1rem;
  position: relative;
}

.fab:active { transform: scale(0.95); }

/* ===== Mehr Grid ===== */
.mehr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}

.mehr-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  min-height: 100px;
  transition: transform 0.15s;
}

.mehr-card:active { transform: scale(0.97); }

.mehr-card-icon { font-size: 2rem; }
.mehr-card-label { font-size: 0.9rem; font-weight: 600; color: var(--on-surface); }

/* ===== Subpages ===== */
.subpage {
  position: absolute;
  top: 0; left: 0; right: 0;
  min-height: 100%;
  background: var(--surface);
  z-index: 10;
  animation: slideIn 0.25s ease;
}

@keyframes slideIn {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
}

#page-mehr { position: relative; min-height: calc(100dvh - var(--header-height) - var(--nav-height)); }

/* ===== Bottom Sheets ===== */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.bottom-sheet {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 201;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(100%); }
  to { transform: translateX(-50%) translateY(0); }
}

.sheet-handle {
  width: 36px; height: 4px;
  background: var(--outline-variant);
  border-radius: 2px;
  margin: 12px auto 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--outline-variant);
}

.sheet-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.sheet-body { padding: 16px 20px 32px; }

/* ===== Forms ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--on-surface-variant);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-group.half { flex: 1; }

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--outline-variant);
  border-radius: var(--radius-md);
  font-size: 1rem;
  background: var(--surface);
  color: var(--on-surface);
  transition: border-color 0.2s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
}

textarea { resize: vertical; min-height: 60px; }

/* ===== Pill Selector ===== */
.pill-selector {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pill-selector.wrap { flex-wrap: wrap; }

.pill {
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--surface-variant);
  color: var(--on-surface-variant);
  white-space: nowrap;
  transition: all 0.15s;
  min-height: 36px;
}

.pill.active {
  background: var(--primary-container);
  color: var(--primary);
}

/* ===== Star Selector ===== */
.star-selector {
  display: flex;
  gap: 4px;
}

.star {
  font-size: 1.8rem;
  opacity: 0.3;
  transition: opacity 0.15s, transform 0.15s;
}

.star.active { opacity: 1; }
.star:active { transform: scale(1.2); }

/* ===== Food Rows ===== */
.food-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.food-row input[type="text"] { flex: 2; }
.food-row input[type="number"] { flex: 1; }

.food-row-remove {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--error-container);
  color: var(--error);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.add-row-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 600;
  padding: 8px 0;
}

/* ===== Calorie Preview ===== */
.calorie-preview {
  background: var(--primary-container);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.calorie-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 3px 0;
  color: var(--primary);
}

.calorie-row.total {
  font-weight: 700;
  border-top: 1px solid rgba(103,80,164,0.3);
  margin-top: 6px;
  padding-top: 8px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.1s;
  min-height: 48px;
}

.btn:active { transform: scale(0.98); opacity: 0.9; }

.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-full { width: 100%; }

.icon-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface-variant);
  transition: background 0.2s;
}

.icon-btn:active { background: var(--surface-variant); }

/* ===== PIN Overlay ===== */
.pin-overlay {
  position: fixed;
  inset: 0;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.pin-card {
  text-align: center;
  padding: 32px 24px;
  width: 100%;
  max-width: 340px;
}

.pin-icon { font-size: 3rem; margin-bottom: 8px; }

.pin-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.pin-card > p {
  color: var(--on-surface-variant);
  margin-bottom: 24px;
}

.pin-dots {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
}

.pin-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--outline-variant);
  transition: background 0.2s;
}

.pin-dot.filled { background: var(--primary); }

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 260px;
  margin: 0 auto;
}

.pin-key {
  height: 64px;
  border-radius: var(--radius-md);
  font-size: 1.4rem;
  font-weight: 600;
  background: var(--surface-variant);
  color: var(--on-surface);
  transition: background 0.1s, transform 0.1s;
}

.pin-key:active { background: var(--primary-container); transform: scale(0.96); }
.pin-key--empty { background: none !important; cursor: default; }
.pin-key--delete { font-size: 1.1rem; }

.pin-error { color: var(--error); margin-top: 12px; font-weight: 600; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #323232;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  z-index: 9998;
  max-width: 340px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== Spinner ===== */
.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 40px;
  color: var(--primary);
}

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Section Labels ===== */
.section-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--on-surface-variant);
  padding: 16px 16px 6px;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}

.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state-text { color: var(--on-surface-variant); font-size: 0.95rem; }

/* ===== Vet Visit Cards ===== */
.vet-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.vet-card-date {
  font-size: 0.8rem;
  color: var(--on-surface-variant);
  margin-bottom: 4px;
}

.vet-card-reason {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.vet-card-details {
  font-size: 0.85rem;
  color: var(--on-surface-variant);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 2px; }

/* ===== Safe Area ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  }
  .app-main {
    margin-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
  }
}

/* Wissensdatenbank */
.wissen-search { margin-bottom: 1rem; padding: 1rem; }
.search-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.search-row .input-field { flex: 1; }
.wissen-results { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.wissen-result { background: var(--surface-variant); border-radius: 8px; padding: 0.75rem; }
.wissen-title { font-weight: 600; margin-bottom: 0.25rem; }
.wissen-page { font-size: 0.75rem; color: var(--on-surface-variant); font-weight: 400; margin-left: 0.5rem; }
.wissen-snippet { font-size: 0.85rem; color: var(--on-surface-variant); line-height: 1.5; }
.wissen-snippet b { color: var(--primary); font-weight: 600; }

/* ===== Foto-Galerie ===== */
.gallery-group { margin-bottom: 8px; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 0 16px 8px;
}

.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-variant);
  cursor: pointer;
  aspect-ratio: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.15s ease;
}
.gallery-item:active { transform: scale(0.97); }

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-item-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  font-size: 0.75rem;
  padding: 20px 8px 6px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.gallery-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 600;
  background: rgba(0,0,0,0.55);
  color: #fff;
  backdrop-filter: blur(4px);
}


/* ===== Subpage Header ===== */
.subpage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  gap: 8px;
}
.subpage-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subpage-actions {
  flex-shrink: 0;
}
.filter-select {
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--outline-variant);
  background: var(--surface);
  color: var(--on-surface);
  min-width: 120px;
}


/* ===== Recipe Cards ===== */
.recipe-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.recipe-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.recipe-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--on-surface);
}
.recipe-meta {
  font-size: 0.8rem;
  color: var(--on-surface-variant);
  margin-top: 2px;
}
.recipe-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.recipe-desc {
  font-size: 0.88rem;
  color: var(--on-surface-variant);
  margin-bottom: 8px;
  font-style: italic;
}
.recipe-ingredients {
  font-size: 0.88rem;
  color: var(--on-surface);
  margin-bottom: 6px;
  padding: 8px 12px;
  background: var(--surface-dim);
  border-radius: var(--radius-sm);
}
.recipe-portions {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 6px;
}
.recipe-supplements {
  font-size: 0.82rem;
  color: var(--tertiary);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--secondary-container);
  border-radius: var(--radius-sm);
}
.recipe-instructions {
  margin-top: 8px;
}
.recipe-instructions summary {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.recipe-instructions-text {
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--on-surface);
  line-height: 1.6;
  white-space: pre-wrap;
}


/* ===== Knowledge Cards ===== */
.knowledge-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.knowledge-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.knowledge-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--on-surface);
}
.knowledge-meta {
  font-size: 0.8rem;
  color: var(--on-surface-variant);
  margin-top: 2px;
}
.knowledge-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.knowledge-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--primary-container);
  color: var(--primary);
}
.knowledge-content summary {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.knowledge-body {
  margin-top: 10px;
  font-size: 0.88rem;
  color: var(--on-surface);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ===== Ziel-Auswahl (Profil) ===== */
.goal-section {
  margin-top: 16px;
  padding: 14px;
  background: var(--surface-container, #f5f5f5);
  border-radius: 12px;
}
.goal-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--on-surface);
}
.goal-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.goal-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border: 2px solid var(--outline, #ccc);
  border-radius: 10px;
  background: var(--surface, #fff);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--on-surface-variant);
  transition: all 0.2s;
  text-align: center;
  line-height: 1.3;
}
.goal-btn .goal-cal {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.75;
}
.goal-btn:hover {
  border-color: var(--primary);
  background: var(--primary-container, #e8f5e9);
}
.goal-btn.active {
  border-color: var(--primary, #4CAF50);
  background: var(--primary-container, #e8f5e9);
  color: var(--primary, #4CAF50);
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}
.goal-current {
  font-size: 0.82rem;
  color: var(--on-surface-variant);
  text-align: center;
  margin-bottom: 10px;
  padding: 6px;
  background: var(--surface, #fff);
  border-radius: 8px;
}
.goal-save-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: var(--primary, #4CAF50);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.goal-save-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.goal-save-btn:not(:disabled):hover {
  opacity: 0.9;
}

/* ===== FUTTERPLAN ===== */
.weight-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface-dim, #F4EFF4);
  border-bottom: 1px solid var(--outline-variant, #CAC4D0);
}
.weight-search label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--on-surface-variant, #49454F);
  white-space: nowrap;
}
.weight-search input[type="number"] {
  width: 80px;
  padding: 6px 10px;
  border: 1px solid var(--outline, #79747E);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--surface, #FFFBFE);
  color: var(--on-surface, #1C1B1F);
}
.btn-sm {
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  background: var(--primary, #6750A4);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-sm:hover { opacity: 0.85; }

.futterplan-info-card {
  margin: 12px 16px;
  padding: 14px 16px;
  background: var(--primary-container, #EADDFF);
  border-radius: 12px;
}
.futterplan-info-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--on-surface, #1C1B1F);
  margin-bottom: 4px;
}
.futterplan-info-text {
  font-size: 0.8rem;
  color: var(--on-surface-variant, #49454F);
  line-height: 1.4;
}

.futterplan-table-wrapper {
  margin: 0 12px 16px;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--outline-variant, #CAC4D0);
}
.futterplan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.futterplan-table thead th {
  background: var(--surface-variant, #E7E0EC);
  color: var(--on-surface, #1C1B1F);
  font-weight: 700;
  padding: 10px 8px;
  text-align: center;
  white-space: nowrap;
  border-bottom: 2px solid var(--outline-variant, #CAC4D0);
}
.futterplan-table tbody td {
  padding: 8px;
  text-align: center;
  border-bottom: 1px solid var(--outline-variant, #CAC4D0);
  color: var(--on-surface, #1C1B1F);
}
.futterplan-table tbody tr:hover {
  background: var(--surface-dim, #F4EFF4);
}
.futterplan-table .fp-weight {
  font-weight: 700;
  white-space: nowrap;
}
.futterplan-table .fp-note {
  font-size: 0.75rem;
  color: var(--on-surface-variant, #49454F);
  text-align: left;
  max-width: 160px;
}

/* Futterplan Calc Result */
.futterplan-result {
  margin: 0 16px 16px;
  padding: 16px;
  background: var(--surface, #FFFFFF);
  border: 2px solid var(--primary, #6750A4);
  border-radius: 14px;
  box-shadow: var(--shadow-md, 0 4px 6px rgba(0,0,0,0.07));
}
.fp-calc-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--on-surface, #1C1B1F);
  margin-bottom: 12px;
}
.fp-calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.fp-calc-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  background: var(--surface-dim, #F4EFF4);
  border-radius: 10px;
}
.fp-calc-label {
  font-size: 0.75rem;
  color: var(--on-surface-variant, #49454F);
  margin-bottom: 4px;
}
.fp-calc-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary, #6750A4);
}
.fp-calc-total {
  text-align: center;
  font-size: 1.05rem;
  padding: 10px;
  background: var(--primary-container, #EADDFF);
  border-radius: 10px;
  margin-bottom: 8px;
  color: var(--on-surface, #1C1B1F);
}
.fp-calc-note {
  font-size: 0.85rem;
  color: var(--on-surface-variant, #49454F);
  margin-bottom: 6px;
}
.fp-calc-hinweis {
  font-size: 0.78rem;
  color: var(--on-surface-variant, #49454F);
  font-style: italic;
  text-align: center;
}
