/* ============================================================
   app.css — Komponenten der Tierheim-App.
   Verwenden ausschließlich Tokens aus tokens.css.
   ============================================================ */

* { box-sizing: border-box; }

/* Icon-Wrapper: SVG füllt immer exakt die gesetzte Größe des Spans */
.ic { display: inline-flex; align-items: center; justify-content: center; flex: none; line-height: 0; }
.ic svg { width: 100%; height: 100%; display: block; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--ff-body);
  background: var(--c-backdrop);
  color: var(--c-ink);
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 0;
}

/* ---------- Geräterahmen (Desktop) / Vollbild (Handy) ---------- */
.device {
  width: 390px;
  height: 844px;
  max-height: 100vh;
  background: var(--c-page);
  border-radius: var(--r-device);
  border: 9px solid var(--c-bezel);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-device);
}

@media (max-width: 480px) {
  body { padding: 0; }
  .device {
    width: 100vw;
    height: 100vh;
    max-height: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
}

.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 26px 6px;
  font-size: var(--fz-base);
  font-weight: 800;
  color: var(--c-ink);
  flex: none;
  z-index: 2;
}
.statusbar .battery {
  width: 17px; height: 11px;
  border: 1.6px solid var(--c-ink);
  border-radius: 3px;
}

/* ---------- Screen-Gerüst ---------- */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.scrollarea { overflow-y: auto; }
.scrollarea::-webkit-scrollbar { width: 0; height: 0; }
.scroll-x { overflow-x: auto; }
.scroll-x::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- Typo-Helfer ---------- */
.display { font-family: var(--ff-display); font-weight: 700; color: var(--c-ink); }
.page-title { font-family: var(--ff-display); font-weight: 700; font-size: var(--fz-h); color: var(--c-ink); letter-spacing: -.01em; }
.form-title { font-family: var(--ff-display); font-weight: 700; font-size: var(--fz-title); color: var(--c-ink); white-space: nowrap; }
.section-caption {
  font-size: var(--fz-xs); font-weight: 800; color: var(--c-muted);
  letter-spacing: .04em; text-transform: uppercase;
}

/* ---------- Knöpfe ---------- */
.btn {
  font-family: var(--ff-body);
  border: none;
  cursor: pointer;
  border-radius: var(--r-md);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
}
.btn--primary {
  background: var(--c-primary);
  color: #fff;
  padding: 15px;
  font-size: var(--fz-lg);
  box-shadow: var(--shadow-btn);
}
.btn--secondary {
  background: var(--c-surface);
  color: var(--c-muted);
  border: var(--bd) solid var(--c-line);
  padding: 14px;
  font-size: var(--fz-md);
  font-weight: 700;
}
.btn--block { width: 100%; }

/* Icon-Knopf (z. B. Zurück, Theme-Umschalter) */
.icon-btn {
  flex: none;
  width: var(--touch); height: var(--touch);
  border-radius: var(--r-md);
  border: var(--bd) solid var(--c-line);
  background: var(--c-surface);
  color: var(--c-ink);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ff-body);
}
.icon-btn--ghost { border: none; }

/* FAB */
.fab {
  position: absolute;
  right: var(--sp-8);
  background: var(--c-accent);
  color: #fff;
  border: none;
  border-radius: var(--r-xl);
  padding: 13px 18px;
  font-size: var(--fz-md);
  font-weight: 800;
  box-shadow: var(--shadow-fab);
  display: flex; align-items: center; gap: 7px;
  font-family: var(--ff-body);
  cursor: pointer;
  z-index: 5;
}

/* ---------- Eingaben ---------- */
.input, .textarea {
  width: 100%;
  padding: 13px 14px;
  border: var(--bd) solid var(--c-line);
  border-radius: var(--r-input);
  background: var(--c-surface);
  color: var(--c-ink);
  font-size: var(--fz-md);
  font-family: var(--ff-body);
  outline: none;
}
.input:focus, .textarea:focus { border-color: var(--c-primary); }
.textarea { min-height: 110px; line-height: 1.5; resize: vertical; }
.field-label { display: block; font-size: var(--fz-base); font-weight: 700; color: var(--c-ink); margin-bottom: var(--sp-3); }
.field-label .opt { color: var(--c-faint); font-weight: 600; }
.field { display: flex; flex-direction: column; }

/* ---------- Suchleiste ---------- */
.searchbar {
  display: flex; align-items: center; gap: 11px;
  background: var(--c-surface);
  border: var(--bd) solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 13px 15px;
}
.searchbar input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: var(--fz-lg); color: var(--c-ink); font-family: var(--ff-body);
}

/* ---------- Chips / Filter / Tabs ---------- */
.chip {
  flex: none;
  border: var(--bd) solid var(--c-line);
  background: var(--c-surface);
  color: var(--c-muted);
  border-radius: var(--r-pill);
  padding: 9px 14px;
  font-size: var(--fz-base);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--ff-body);
  white-space: nowrap;
}
.chip--active { background: var(--c-chipsel-bg); color: var(--c-chipsel-text); border-color: var(--c-chipsel-bg); }

.tab-pill {
  flex: none; border: none;
  background: var(--c-footer);
  color: var(--c-muted);
  border-radius: var(--r-pill);
  padding: 9px 14px;
  font-size: var(--fz-base);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--ff-body);
}
.tab-pill--active { background: var(--c-primary); color: #fff; }

/* ---------- Karten ---------- */
.card {
  background: var(--c-surface);
  border: var(--bd) solid var(--c-line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
}
.section {
  background: var(--c-surface);
  border: var(--bd) solid var(--c-line);
  border-radius: var(--r-xl);
  padding: 13px 14px;
}

/* Hundekarte */
.dog-card {
  flex: none;
  background: var(--c-surface);
  border: var(--bd) solid var(--c-line);
  border-radius: var(--r-card);
  overflow: hidden;
  display: flex;
  box-shadow: var(--shadow-card);
}
.dog-card .stripe { width: var(--stripe-w); flex: none; }
.dog-card .body { flex: 1; min-width: 0; }
.dog-head { padding: 13px 14px 11px; display: flex; gap: var(--sp-5); align-items: flex-start; }

.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  color: #fff; font-size: 21px; font-weight: 800;
  font-family: var(--ff-display);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.avatar--lg { width: 72px; height: 72px; font-size: 30px; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.avatar--sm { width: 44px; height: 44px; border-radius: var(--r-md); font-size: var(--fz-md); }

.dog-main { flex: 1; min-width: 0; cursor: pointer; }
.dog-name { font-size: var(--fz-name); font-weight: 700; font-family: var(--ff-display); color: var(--c-ink); }
.dog-sub { font-size: var(--fz-label); color: var(--c-muted); margin-top: 3px; }

/* Badges */
.badge {
  font-size: var(--fz-xs); font-weight: 800;
  padding: 3px 9px; border-radius: var(--r-pill);
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: var(--sp-1);
}
.badge--ok { background: var(--c-ok-bg); color: var(--c-ok-text); }
.badge--warn { background: var(--c-warn-bg); color: var(--c-warn-text); }
.badge--care { background: var(--c-care-bg); color: var(--c-care-text); }
.badge--blue { background: var(--c-blue-bg); color: var(--c-blue-text); }
.badge--grey { background: var(--c-grey-bg); color: var(--c-grey-text); }
.badge--tag { background: var(--c-tag-bg); color: var(--c-tag-fg); font-weight: 700; padding: 3px 10px; }

.due-pill {
  margin-top: var(--sp-3);
  display: inline-flex; align-items: center; gap: var(--sp-2);
  background: var(--c-warn-bg); color: var(--c-warn-text);
  font-size: 12.5px; font-weight: 800;
  padding: 5px 10px; border-radius: var(--r-sm);
  white-space: nowrap;
}

.star-btn {
  flex: none; width: 32px; height: 32px;
  border: none; background: transparent; cursor: pointer; padding: 0;
  display: flex; align-items: flex-start; justify-content: center;
  font-family: var(--ff-body);
}

.recents { padding: 0 14px 11px; display: flex; flex-direction: column; gap: var(--sp-1); cursor: pointer; }
.recent { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fz-sm); color: var(--c-body); }
.recent .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.recent .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .when { flex: none; color: var(--c-faint); font-size: var(--fz-xs); font-weight: 600; }
.recents .empty { font-size: 12.5px; color: var(--c-faint); font-style: italic; }

.card-foot {
  width: 100%; border: none;
  border-top: var(--bd) solid var(--c-line-soft);
  background: var(--c-footer);
  color: var(--c-primary-text);
  padding: 11px;
  font-size: var(--fz-base); font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--ff-body); cursor: pointer;
  min-height: var(--touch);
}

/* ---------- Untere Tab-Leiste ---------- */
.tabbar {
  flex: none; display: flex;
  background: var(--c-surface);
  border-top: var(--bd) solid var(--c-line);
  padding: 9px 8px 20px;
}
.tab-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-1);
  color: var(--c-faint); font-size: var(--fz-xs); font-weight: 700;
  background: none; border: none; cursor: pointer; font-family: var(--ff-body);
}
.tab-item--active { color: var(--c-primary); font-weight: 800; }

/* ---------- Detail-Hero ---------- */
.hero { background: var(--c-hero); padding: 4px 14px 16px; flex: none; }
.hero-top { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.hero-row { display: flex; gap: var(--sp-6); align-items: center; }
.hero-name { font-size: var(--fz-hero); font-weight: 700; font-family: var(--ff-display); color: var(--c-ink); }
.tags { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-2); }

.detail-tabs {
  display: flex; gap: 7px; padding: 10px 14px;
  background: var(--c-surface);
  border-bottom: var(--bd) solid var(--c-line);
  flex: none;
}

/* ---------- Info-Box (Wichtige Hinweise) ---------- */
.infobox {
  background: var(--c-info-bg);
  border: var(--bd) solid var(--c-info-border);
  border-radius: var(--r-xl);
  padding: 14px;
}
.infobox-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.infobox-head .lbl {
  display: flex; align-items: center; gap: 7px;
  font-size: var(--fz-label); font-weight: 800; color: var(--c-info-head); letter-spacing: .02em;
}
.infobox-edit {
  flex: none; border: none; background: var(--c-info-btn-bg); color: var(--c-info-head);
  border-radius: var(--r-input); width: 32px; height: 32px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-family: var(--ff-body);
}
.ichips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: var(--sp-4); }
.ichip {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: 12.5px; font-weight: 700; padding: 5px 10px; border-radius: var(--r-pill);
}
.ichip--warn { background: var(--c-care-bg); color: var(--c-care-text); }
.ichip--ok { background: var(--c-ok-bg); color: var(--c-ok-text); }
.info-text { font-size: var(--fz-base); line-height: 1.55; color: var(--c-info-text); }
.info-futter { margin-top: var(--sp-4); font-size: var(--fz-sm); color: var(--c-info-text); display: flex; gap: 7px; }

/* ---------- Aufgaben / Aktivität ---------- */
.row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.mini-add {
  border: var(--bd) solid var(--c-line); background: var(--c-footer); color: var(--c-primary-text);
  border-radius: var(--r-pill); padding: 6px 12px; font-size: 12.5px; font-weight: 800;
  cursor: pointer; font-family: var(--ff-body);
}
.task-row { display: flex; align-items: center; gap: var(--sp-4); padding: 9px 0; border-top: var(--bd) solid var(--c-line-soft); }
.task-ic {
  flex: none; width: 34px; height: 34px; border-radius: var(--r-sm);
  background: var(--c-footer); color: var(--c-primary-text);
  display: flex; align-items: center; justify-content: center;
}
.task-ic--due { background: var(--c-warn-bg); color: var(--c-warn-text); }
.task-body { flex: 1; min-width: 0; }
.task-label { font-size: 14.5px; font-weight: 700; color: var(--c-ink); }
.task-meta { font-size: var(--fz-xs); color: var(--c-faint); font-weight: 600; margin-top: 1px; }
.task-meta--due { color: var(--c-warn-text); }
.task-done {
  flex: none; border: none; background: var(--c-primary); color: #fff;
  border-radius: var(--r-sm); padding: 8px 12px; font-size: 12.5px; font-weight: 800;
  cursor: pointer; font-family: var(--ff-body);
}
.task-del, .row-del {
  flex: none; border: none; background: transparent; color: var(--c-faint);
  width: 28px; height: 28px; border-radius: var(--r-sm); cursor: pointer;
  font-family: var(--ff-body); font-size: var(--fz-lg);
}

.act-row { display: flex; align-items: flex-start; gap: var(--sp-4); padding: 9px 0; border-top: var(--bd) solid var(--c-line-soft); cursor: pointer; }
.act-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-top: 5px; }
.act-text { font-size: var(--fz-base); line-height: 1.4; color: var(--c-body); }
.act-by { font-size: var(--fz-meta); color: var(--c-faint); margin-top: 3px; }
.empty-note { font-size: var(--fz-sm); color: var(--c-faint); font-style: italic; padding-top: 4px; }

/* ---------- Eckdaten-Grid ---------- */
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.fact { background: var(--c-surface); border: var(--bd) solid var(--c-line); border-radius: var(--r-md); padding: 10px 13px; }
.fact-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--c-faint); font-weight: 700; }
.fact-val { font-size: 14.5px; font-weight: 700; color: var(--c-ink); margin-top: 2px; }

/* ---------- Kategorie-Einträge ---------- */
.quick-btn {
  width: 100%; border: var(--bd) solid var(--c-line);
  background: var(--c-footer); color: var(--c-primary-text);
  border-radius: var(--r-lg); padding: 13px; font-size: 14.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
  cursor: pointer; font-family: var(--ff-body);
}
.entry-card { background: var(--c-surface); border: var(--bd) solid var(--c-line); border-radius: var(--r-lg); padding: 12px 13px; }
.entry-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-2); }
.entry-text { font-size: 14.5px; line-height: 1.45; color: var(--c-body); }
.entry-by { display: flex; align-items: center; gap: 7px; margin-top: 9px; }
.entry-by .ava { width: 22px; height: 22px; border-radius: 7px; background: var(--c-footer); color: var(--c-primary-text); font-size: 10px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.entry-by .who { font-size: var(--fz-xs); color: var(--c-faint); }

/* ---------- Formulare: Optionen / Segmente ---------- */
.form { flex: 1; padding: 6px 16px 20px; display: flex; flex-direction: column; gap: var(--sp-7); }
.form-head { padding: 4px 14px 12px; flex: none; display: flex; align-items: center; gap: var(--sp-4); }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.opt-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.opt-btn {
  padding: 12px; border-radius: var(--r-input);
  border: var(--bd) solid var(--c-line); background: var(--c-surface); color: var(--c-muted);
  font-size: var(--fz-base); font-weight: 700; cursor: pointer; font-family: var(--ff-body);
}
.opt-btn--active { background: var(--c-footer); color: var(--c-primary-text); border-color: var(--c-primary); }
.opt-btn--warn-active { background: var(--c-care-bg); color: var(--c-care-text); border-color: var(--c-care-stripe); }
.opt-btn--ok-active { background: var(--c-ok-bg); color: var(--c-ok-text); border-color: var(--c-ok-stripe); }
.opt-btn--status { display: flex; align-items: center; gap: var(--sp-4); text-align: left; color: var(--c-ink); padding: 12px 13px; }
.opt-btn--status .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }

.mic {
  position: absolute; right: 10px; bottom: 12px;
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: var(--c-footer); color: var(--c-primary-text); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-family: var(--ff-body);
}
.photo-drop {
  width: 100%; border: var(--bd) dashed var(--c-dash); border-radius: var(--r-input);
  padding: 18px; text-align: center; color: var(--c-muted); font-size: var(--fz-base);
  background: var(--c-footer); cursor: pointer; font-family: var(--ff-body);
  display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
}
.tip {
  background: var(--c-info-bg); border: var(--bd) solid var(--c-info-border); color: var(--c-info-text);
  font-size: var(--fz-sm); border-radius: 11px; padding: 11px 13px; line-height: 1.45;
}

/* ---------- Login ---------- */
.login {
  flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: var(--sp-7); padding: 24px 30px 60px;
}
.login-logo {
  width: 88px; height: 88px; border-radius: 26px;
  background: var(--c-surface); border: var(--bd) solid var(--c-line);
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-card);
}
.text-link {
  background: none; border: none; color: var(--c-muted); font-size: var(--fz-sm); font-weight: 700;
  cursor: pointer; font-family: var(--ff-body); display: flex; align-items: center; gap: var(--sp-2);
}

/* ---------- Benutzer / Admin ---------- */
.user-row {
  display: flex; align-items: center; gap: var(--sp-5);
  background: var(--c-surface); border: var(--bd) solid var(--c-line);
  border-radius: var(--r-lg); padding: 12px 14px;
}
.user-row .name { font-size: 15.5px; font-weight: 700; color: var(--c-ink); }
.user-row .handle { font-size: var(--fz-sm); color: var(--c-faint); }
.q-row {
  display: flex; align-items: center; gap: 11px;
  background: var(--c-surface); border: var(--bd) solid var(--c-line);
  border-radius: var(--r-input); padding: 11px 13px;
}

/* ---------- Schnell-Eintrag-Sheet ---------- */
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15,20,18,.5); z-index: 40; animation: fade .18s ease; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--c-surface);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: 16px 18px 26px; z-index: 41; box-shadow: var(--shadow-sheet);
  animation: sheet-up .24s cubic-bezier(.2,.8,.2,1);
}
.sheet-handle { width: 42px; height: 4px; border-radius: 2px; background: var(--c-line); margin: 0 auto 14px; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.sheet-btn {
  padding: 15px 10px; border-radius: var(--r-lg);
  border: var(--bd) solid var(--c-line); background: var(--c-footer); color: var(--c-ink);
  font-size: var(--fz-base); font-weight: 700; cursor: pointer; font-family: var(--ff-body);
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); text-align: center;
}

/* ---------- Toast ---------- */
.toast {
  position: absolute; left: 50%; bottom: 86px; transform: translateX(-50%);
  background: var(--c-toast-bg); color: var(--c-toast-fg);
  padding: 12px 18px; border-radius: var(--r-md);
  font-size: var(--fz-base); font-weight: 700; z-index: 60;
  box-shadow: var(--shadow-toast); white-space: nowrap;
  animation: toast-in .2s ease;
}

/* ---------- Hilfsklassen ---------- */
.spacer { flex: 1; }
.bottom-pad { height: 70px; flex: none; }
.center-empty { text-align: center; color: var(--c-faint); font-size: var(--fz-md); padding: 30px 0; }
.muted { color: var(--c-muted); }
.faint { color: var(--c-faint); }

/* ---------- Animationen ---------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
