:root {
  --color-bg: #f4f8f8;
  --color-surface: #ffffff;
  --color-surface-alt: #eaf3f2;
  --color-border: #d7e4e2;
  --color-border-strong: #9fc4c0;
  --color-text: #17262a;
  --color-heading: #164e63;
  --color-text-muted: #52666a;

  --color-primary: #0891b2;
  --color-primary-hover: #0e7490;
  --color-primary-shadow: #155e75;
  --color-on-primary: #052e33;

  --color-accent: #047857;
  --color-accent-hover: #059669;
  --color-accent-shadow: #065f46;
  --color-on-accent: #ffffff;

  --color-destructive: #dc2626;
  --color-destructive-hover: #c11f1f;
  --color-destructive-shadow: #9c1a1a;
  --color-on-destructive: #ffffff;

  --color-success-bg: #dcfce7;
  --color-success-text: #166534;
  --color-danger-bg: #fee2e2;
  --color-danger-text: #b91c1c;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --border-w: 2px;

  --shadow-outer: 0 6px 16px rgba(15, 61, 74, 0.08), 0 2px 4px rgba(15, 61, 74, 0.05);
  --font-heading: 'Varela Round', 'Nunito Sans', sans-serif;
  --font-body: 'Nunito Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0f1b1d;
    --color-surface: #17272a;
    --color-surface-alt: #1e3234;
    --color-border: #2c4548;
    --color-border-strong: #3e6367;
    --color-text: #e7f1f0;
    --color-heading: #67e8f9;
    --color-text-muted: #a9c0bd;

    --color-primary: #22d3ee;
    --color-primary-hover: #67e8f9;
    --color-primary-shadow: #0e7490;
    --color-on-primary: #04252a;

    --color-accent: #34d399;
    --color-accent-hover: #6ee7b7;
    --color-accent-shadow: #047857;
    --color-on-accent: #052e1f;

    --color-destructive: #f87171;
    --color-destructive-hover: #fca5a5;
    --color-destructive-shadow: #7f1d1d;
    --color-on-destructive: #2b0a0a;

    --color-success-bg: #14301f;
    --color-success-text: #86efac;
    --color-danger-bg: #3a1717;
    --color-danger-text: #fca5a5;

    --shadow-outer: 0 6px 18px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.28);
  }
}

:root[data-theme="dark"] {
  --color-bg: #0f1b1d;
  --color-surface: #17272a;
  --color-surface-alt: #1e3234;
  --color-border: #2c4548;
  --color-border-strong: #3e6367;
  --color-text: #e7f1f0;
  --color-heading: #67e8f9;
  --color-text-muted: #a9c0bd;
  --color-primary: #22d3ee;
  --color-primary-hover: #67e8f9;
  --color-primary-shadow: #0e7490;
  --color-on-primary: #04252a;
  --color-accent: #34d399;
  --color-accent-hover: #6ee7b7;
  --color-accent-shadow: #047857;
  --color-on-accent: #052e1f;
  --color-destructive: #f87171;
  --color-on-destructive: #2b0a0a;
  --shadow-outer: 0 6px 18px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
}

h1, h2, h3 { margin: 0; font-family: var(--font-heading); color: var(--color-heading); }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

.hidden { display: none !important; }

button, .pet-list-item, summary, .auth-tab, .tab-btn {
  cursor: pointer;
  font-family: inherit;
}

/* ---------- Focus ---------- */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: var(--border-w) solid var(--color-border);
  background: var(--color-surface);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand h1 { font-size: 21px; letter-spacing: 0.2px; }
.tagline { margin: 0; font-size: 12px; color: var(--color-text-muted); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.settings-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.settings-row input { flex: 1; min-width: 220px; }

.bulk-breed-form { flex-direction: column; align-items: stretch; }
.bulk-breed-form select { align-self: flex-start; min-width: 160px; }
.bulk-breed-form textarea { width: 100%; resize: vertical; font-family: inherit; }
.breed-columns { margin-bottom: 16px; }
.breed-group-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-text-muted);
  font-weight: 800;
  padding: 4px 2px 0;
}
.breed-group-label:first-child { padding-top: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--color-destructive);
  color: var(--color-on-destructive);
  font-size: 11px;
  font-weight: 800;
}

#adminView .card { margin-bottom: 14px; }
.admin-user-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: var(--border-w) solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  flex-wrap: wrap;
}
.admin-user-actions { display: flex; gap: 8px; }
.admin-user-actions button { padding: 6px 12px; min-height: 32px; font-size: 13px; }

.banner {
  margin: 12px 20px 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
  font-size: 14px;
  font-weight: 600;
}
.banner.success { background: var(--color-success-bg); color: var(--color-success-text); }

main { padding: 20px; max-width: 1100px; margin: 0 auto; }

.site-footer {
  padding: 24px 20px 40px;
  text-align: center;
  font-size: 13px;
}
.site-footer a {
  color: var(--color-text-muted);
  text-decoration: underline;
}
.site-footer a:hover { color: var(--color-primary); }

/* ---------- Rechtstexte (Datenschutz, Impressum) ---------- */
.legal-page { max-width: 760px; margin: 0 auto; padding: 32px 20px 60px; }
.legal-page .back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}
.legal-page .back-link:hover { text-decoration: underline; }
.legal-page h1 { font-size: 24px; }
.legal-page .legal-updated { color: var(--color-text-muted); font-size: 13px; margin: 4px 0 24px; }
.legal-page h2 { font-size: 17px; margin-top: 30px; margin-bottom: 8px; }
.legal-page h3 { font-size: 14px; margin-top: 18px; margin-bottom: 4px; color: var(--color-text); }
.legal-page p, .legal-page li { font-size: 14px; line-height: 1.65; color: var(--color-text); }
.legal-page ul { padding-left: 20px; margin: 8px 0; }
.legal-page li + li { margin-top: 4px; }
.legal-page .legal-note {
  background: var(--color-surface-alt);
  border: var(--border-w) solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 28px;
}
.legal-page .legal-placeholder {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}

/* ---------- Cards (claymorphism-lite) ---------- */
.card {
  background: var(--color-surface);
  border: var(--border-w) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-outer);
  padding: 16px;
  margin-bottom: 16px;
}

/* ---------- Auth ---------- */
.auth-card { max-width: 380px; margin: 40px auto; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 16px; background: var(--color-surface-alt); padding: 4px; border-radius: var(--radius-md); }
.auth-tab {
  flex: 1;
  padding: 9px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-weight: 700;
  color: var(--color-text-muted);
  transition: background-color 150ms ease, color 150ms ease;
}
.auth-tab.active { background: var(--color-primary); color: var(--color-on-primary); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-link { align-self: center; font-size: 13px; padding: 4px 8px; }
.auth-hint { margin: 0; font-size: 13px; color: var(--color-text-muted); }

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
}
label.checkbox { flex-direction: row; align-items: center; gap: 8px; }
label.inline-label { flex-direction: row; align-items: center; gap: 8px; }

input, select {
  padding: 9px 11px;
  border: var(--border-w) solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 150ms ease;
  min-height: 40px;
}
input:hover, select:hover { border-color: var(--color-border-strong); }
input[type="checkbox"] { min-height: auto; width: 18px; height: 18px; accent-color: var(--color-primary); }

/* ---------- Buttons ---------- */
.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  border: var(--border-w) solid transparent;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 150ms ease;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
  box-shadow: 0 4px 0 var(--color-primary-shadow);
}
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--color-primary-shadow); }

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-accent);
  border-color: var(--color-accent);
  box-shadow: 0 3px 0 var(--color-accent-shadow);
}
.btn-secondary:hover { background: var(--color-surface-alt); }
.btn-secondary:active { transform: translateY(3px); box-shadow: 0 0 0 var(--color-accent-shadow); }

.btn-danger {
  background: transparent;
  color: var(--color-destructive);
  border-color: var(--color-destructive);
}
.btn-danger:hover { background: var(--color-danger-bg); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: none;
  min-height: 40px;
  padding: 8px 10px;
}
.btn-ghost:hover { background: var(--color-surface-alt); color: var(--color-text); }

.icon-text-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: background-color 150ms ease, color 150ms ease;
}
.icon-btn:hover { background: var(--color-surface-alt); color: var(--color-text); }
.icon-btn svg { width: 20px; height: 20px; }

button:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* Inline button spinner, shown while a form submit is in flight */
.btn-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2.5px solid rgba(0, 0, 0, 0.2);
  border-top-color: currentColor;
  border-radius: 50%;
}
button.is-loading .btn-label { visibility: hidden; position: absolute; }
button.is-loading { position: relative; }
button.is-loading .btn-spinner { display: block; animation: spin 0.7s linear infinite; position: absolute; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- App layout ---------- */
.layout { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }

.pet-sidebar {
  width: 100%;
  flex-shrink: 0;
  background: var(--color-surface);
  border: var(--border-w) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-outer);
  padding: 14px;
}
.pet-sidebar h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--color-text-muted); margin-bottom: 10px; font-family: var(--font-body); font-weight: 800; }

.pet-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pet-list-item {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  min-height: 40px;
  transition: background-color 150ms ease, color 150ms ease;
}
.pet-list-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.pet-list-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.pet-list-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.pet-list-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-list-progress { height: 4px; border-radius: 999px; background: rgba(127, 127, 127, 0.25); overflow: hidden; }
.pet-list-progress-fill { height: 100%; border-radius: 999px; background: currentColor; opacity: 0.85; }
.pet-list-item:hover { background: var(--color-surface-alt); }
.pet-list-item.active { background: var(--color-primary); color: var(--color-on-primary); }

.new-pet summary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 8px;
  list-style: none;
  min-height: 40px;
  border-radius: var(--radius-sm);
  padding: 0 6px;
}
.new-pet summary::-webkit-details-marker { display: none; }
.new-pet summary svg:not(.chevron) { width: 18px; height: 18px; }
.chevron { width: 16px; height: 16px; transition: transform 150ms ease; flex-shrink: 0; }
details[open] > summary .chevron { transform: rotate(90deg); }
.new-pet summary:hover { background: var(--color-surface-alt); }
.new-pet form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

.content { flex: 1; min-width: 0; width: 100%; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 16px;
  color: var(--color-text-muted);
  text-align: center;
  background: var(--color-surface);
  border: var(--border-w) dashed var(--color-border);
  border-radius: var(--radius-lg);
}
.empty-state svg { width: 40px; height: 40px; color: var(--color-primary); opacity: 0.7; }
.empty-state p { margin: 0; font-weight: 600; }

.pet-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--color-surface);
  border: var(--border-w) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-outer);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.pet-avatar-upload {
  position: relative;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: var(--color-surface-alt);
  border: var(--border-w) solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pet-avatar-upload:hover { border-color: var(--color-primary); }
.pet-avatar { width: 100%; height: 100%; object-fit: cover; }
.pet-avatar-fallback { width: 28px; height: 28px; color: var(--color-text-muted); }
.pet-avatar-fallback svg { width: 100%; height: 100%; }

.pet-header h2 { font-size: 20px; }
.pet-meta { margin: 2px 0 0; color: var(--color-text-muted); font-size: 13px; font-weight: 600; }
.kcal-summary { flex: 1; min-width: 180px; }
.kcal-bar { height: 10px; border-radius: 999px; background: var(--color-surface-alt); overflow: hidden; border: 1px solid var(--color-border); }
.kcal-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--color-primary), var(--color-primary-hover)); width: 0%; transition: width 300ms ease; }
.kcal-text { margin: 6px 0 0; font-size: 13px; color: var(--color-text-muted); font-weight: 600; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: var(--border-w) solid var(--color-border);
  background: var(--color-surface);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-muted);
  min-height: 40px;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.tab-btn svg { width: 18px; height: 18px; }
.tab-btn.active { background: var(--color-primary); color: var(--color-on-primary); border-color: var(--color-primary); }

.log-toolbar { margin-bottom: 12px; }
.log-toolbar .inline-label { font-size: 13px; }
.log-toolbar input { max-width: 200px; }

.search-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.input-icon { position: relative; flex: 1; min-width: 200px; display: flex; align-items: center; }
.input-icon svg { position: absolute; left: 11px; width: 18px; height: 18px; color: var(--color-text-muted); pointer-events: none; }
.input-icon input { padding-left: 38px; width: 100%; }
.search-row select { min-width: 140px; }

.food-results, .food-recent, .log-entries, .weight-entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.food-recent { margin-bottom: 10px; }
.food-recent-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-text-muted);
  font-weight: 800;
  margin: 4px 0 6px;
}

.log-group-header {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-text-muted);
  font-weight: 800;
  padding: 4px 2px 0;
}
.log-group-header:first-child { padding-top: 0; }

.food-result, .log-entry, .weight-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: var(--border-w) solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  flex-wrap: wrap;
}

.food-name { color: var(--color-text); }
.food-meta { display: block; font-size: 12px; color: var(--color-text-muted); font-weight: 600; }
.food-log-action { display: flex; gap: 8px; align-items: center; }
.food-amount { width: 76px; }
.food-note { width: 130px; }
.food-info { flex: 1; min-width: 0; }

.food-photo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: var(--border-w) solid var(--color-border);
  flex-shrink: 0;
}

.custom-food-form, #adminProductForm { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.edit-pet-form-card { margin-bottom: 14px; }
.edit-pet-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.edit-pet-form .settings-row { margin-bottom: 0; margin-top: 4px; }
.product-photo-preview {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: var(--border-w) solid var(--color-border);
}
.custom-food summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 700;
  color: var(--color-accent);
  list-style: none;
}
.custom-food summary::-webkit-details-marker { display: none; }

.weight-form { display: flex; flex-direction: column; gap: 8px; }

.entry-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-destructive);
  flex-shrink: 0;
}
.entry-delete svg { width: 18px; height: 18px; }
.entry-delete:hover { background: var(--color-danger-bg); }

.paywall-hint { font-size: 12px; margin-top: 8px; }

/* ---------- Barcode-Scanner ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(36, 28, 18, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal-dialog { width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-header h3 { font-size: 16px; }

.confirm-body { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.confirm-body p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--color-text); }
.confirm-body p.confirm-hint { color: var(--color-text-muted); font-size: 13px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.scanner-video {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--radius-md);
  object-fit: cover;
}
.scanner-status { margin: 10px 0; font-size: 13px; color: var(--color-text-muted); text-align: center; }
.scanner-manual summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 700;
  color: var(--color-accent);
  list-style: none;
  font-size: 13px;
}
.scanner-manual summary::-webkit-details-marker { display: none; }
.scanner-manual-row { display: flex; gap: 8px; margin-top: 8px; }
.scanner-manual-row input { flex: 1; }

/* ---------- Gewichts-Chart ---------- */
.weight-chart { position: relative; width: 100%; }
.weight-chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-empty-hint { color: var(--color-text-muted); font-size: 13px; margin: 8px 0; }

.chart-gridline { stroke: var(--color-border); stroke-width: 1; }
.chart-axis-label {
  fill: var(--color-text-muted);
  font-size: 10px;
  font-family: var(--font-body);
}

.chart-target-line { stroke: var(--color-text-muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart-target-label { fill: var(--color-text-muted); font-size: 10px; font-family: var(--font-body); font-weight: 700; }

.chart-area { fill: var(--color-primary); opacity: 0.12; }
.chart-line { fill: none; stroke: var(--color-primary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: var(--color-primary); stroke: var(--color-surface); stroke-width: 2; }

.chart-hit { fill: transparent; cursor: pointer; }
.chart-hit:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 1px; fill: transparent; }

.chart-tooltip {
  position: absolute;
  transform: translate(-50%, -100%) translateY(-10px);
  background: var(--color-surface);
  border: var(--border-w) solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-outer);
  padding: 6px 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
  white-space: nowrap;
}
.chart-tooltip strong { color: var(--color-text); font-size: 13px; }
.chart-tooltip span { color: var(--color-text-muted); }

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---------- Skeletons ---------- */
.skeleton-item {
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--color-border) 25%, var(--color-surface-alt) 37%, var(--color-border) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  list-style: none;
}
@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (min-width: 768px) {
  .layout { flex-direction: row; }
  .pet-sidebar { width: 240px; }
}

@media (max-width: 480px) {
  .topbar { padding: 12px 14px; }
  main { padding: 14px; }
  .pet-header { flex-direction: column; align-items: stretch; }
  .delete-pet-btn { align-self: flex-start; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
