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

:root {
  --brand: #3B7DD8;
  --brand-light: #EAF1FB;
  --brand-dark: #2563B4;
  --accent: #F59E0B;
  --accent-light: #FEF3C7;
  --green: #10B981;
  --green-light: #D1FAE5;
  --red: #EF4444;
  --red-light: #FEE2E2;
  --purple: #8B5CF6;
  --purple-light: #EDE9FE;
  --orange: #F97316;
  --orange-light: #FFEDD5;

  --surface: #FFFFFF;
  --surface-2: #F8F9FB;
  --border: #E5E7EB;
  --text: #111827;
  --text-2: #6B7280;
  --text-3: #9CA3AF;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-full: 9999px;
  --shadow: 0 1px 4px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.07);

  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--surface-2);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ─── Layout ───────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  position: relative;
}

#main-content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
}

/* ─── Bottom Nav ───────────────────────────────────────────── */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  padding-top: 4px;
  padding-bottom: var(--safe-bottom);
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 500;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
}
.nav-btn span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.nav-btn svg { width: 22px; height: 22px; stroke-width: 1.8; flex-shrink: 0; }
.nav-btn.active { color: var(--brand); }
.nav-btn.active svg { stroke-width: 2.2; }

/* ─── Home Dashboard ───────────────────────────────────────── */
.dash-header {
  padding: 20px 16px 12px;
}
.dash-greeting {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.dash-date {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}
.dash-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px 4px;
}
.dash-card {
  border-radius: var(--radius);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,.06);
  transition: filter .12s, transform .1s;
  position: relative;
}
.dash-card:active { filter: brightness(.95); transform: scale(.98); }
.dash-card-icon { font-size: 20px; }
.dash-card-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.dash-card-value--urgent { color: #B45309; }
.dash-card-label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}
.dash-card-arrow {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 16px;
  color: rgba(0,0,0,.25);
  line-height: 1;
}
.dash-all-clear {
  text-align: center;
  padding: 16px;
  font-size: 14px;
  font-weight: 600;
  color: #065F46;
  background: #ECFDF5;
  border-radius: var(--radius);
}
/* Needs-attention dog rows */
.dash-dog-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid var(--border);
}
.dash-dog-row:last-child { border-bottom: none; }
.dash-dog-row:active { background: var(--surface-2); }
.dash-dog-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.dash-dog-info { flex: 1; min-width: 0; }
.dash-dog-name  { font-size: 15px; font-weight: 600; color: var(--text); }
.dash-dog-sub   { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.dash-dog-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.dash-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  background: #FEF3C7;
  color: #92400E;
}
.dash-pill--warn {
  background: #FEE2E2;
  color: #991B1B;
}
.dash-dog-chevron { font-size: 22px; color: var(--text-3); flex-shrink: 0; }
/* Low food stock alert banner */
.dash-low-stock-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #991B1B;
  margin-bottom: 10px;
}
.dash-low-stock-dogs {
  font-weight: 400;
  color: #7F1D1D;
}
/* Prep list low-stock row highlight */
.prep-row--low-stock { background: #FFF7ED; }
.low-stock-badge {
  font-size: 10px;
  font-weight: 700;
  background: #FEE2E2;
  color: #991B1B;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
}
/* Profile feeding row low-stock */
.med-dose-row--low-stock .dose-status { color: #B45309; }

/* Overdue dose highlighting — profile med checklist */
.dose-overdue--amber { background: #FFFBEB; }
.dose-overdue--amber .dose-slot-label { color: #92400E; }
.dose-overdue--red { background: #FEF2F2; }
.dose-overdue--red .dose-slot-label { color: #991B1B; }

/* Overdue dose highlighting — prep list rows */
.prep-row--overdue-amber { background: #FFFBEB; }
.prep-row--overdue-red   { background: #FEF2F2; }

/* Dashboard overdue pill */
.dash-pill--overdue { background: #FEE2E2; color: #991B1B; }
/* Upcoming events */
.dash-event-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.dash-event-row:last-child { border-bottom: none; }
.dash-event-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.dash-event-info { flex: 1; min-width: 0; }
.dash-event-title { font-size: 14px; font-weight: 600; color: var(--text); }
.dash-event-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  font-size: 12px;
  color: var(--text-2);
  margin-top: 3px;
}
.dash-event-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}
/* Recent activity dog label */
.dash-activity-dog {
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ─── Page Header ──────────────────────────────────────────── */
.page-header {
  padding: 16px 16px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  flex: 1;
}
.page-header .icon-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

/* ─── Dog Chips ────────────────────────────────────────────── */
#chip-strip {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
#chip-strip::-webkit-scrollbar { display: none; }

.dog-chip {
  flex-shrink: 0;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px 7px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  transition: border-color .15s, background .15s, color .15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.dog-chip .avatar {
  width: 28px; height: 28px;
  border-radius: var(--radius-full);
  background: var(--brand-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
}
.dog-chip.active {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand-dark);
}
.dog-chip.meds-badge::after {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red);
  display: inline-block;
  margin-left: 2px;
}

/* ─── Filter Bar ───────────────────────────────────────────── */
#filter-bar {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  overflow-x: auto;
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
#filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 5px 13px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all .15s;
}
.filter-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ─── Status Banner ────────────────────────────────────────── */
.status-banner {
  margin: 12px 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-banner.healthy   { background: var(--green-light); color: #065F46; }
.status-banner.on_treatment { background: var(--accent-light); color: #92400E; }
.status-banner.meds_due  { background: var(--red-light); color: #991B1B; }
.status-banner.board_train { background: var(--purple-light); color: #4C1D95; }
.status-banner.foster        { background: var(--orange-light); color: #9A3412; }
.status-banner.foster_placed { background: var(--orange-light); color: #9A3412; }
.status-banner.adopted       { background: var(--green-light);  color: #065F46; }
.status-banner.returned      { background: var(--red-light);    color: #991B1B; }
.status-banner.deceased      { background: #F3F4F6;             color: #374151; }
.status-banner .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-banner.healthy .dot   { background: var(--green); }
.status-banner.on_treatment .dot { background: var(--accent); }
.status-banner.meds_due .dot  { background: var(--red); }
.status-banner.board_train .dot { background: var(--purple); }
.status-banner.foster .dot        { background: var(--orange); }
.status-banner.foster_placed .dot { background: var(--orange); }
.status-banner.adopted .dot       { background: var(--green); }
.status-banner.returned .dot      { background: var(--red); }
.status-banner.deceased .dot      { background: #9CA3AF; }

/* ─── Treatment Card ────────────────────────────────────────── */
.treatment-card {
  margin: 0 16px 12px;
  padding: 14px 14px 14px 12px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: var(--radius-sm);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}
.tc-ring {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tc-ring svg {
  display: block;
}
.tc-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tc-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tc-meta {
  font-size: 11px;
  opacity: .72;
  line-height: 1.4;
}
.tc-progress {
  font-size: 12px;
  font-weight: 600;
  margin-top: 3px;
  opacity: .92;
}
.tc-phase {
  font-size: 11px;
  opacity: .65;
  margin-top: 1px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tc-edit-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,.15);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  letter-spacing: 1px;
}
.tc-edit-btn:hover {
  background: rgba(255,255,255,.28);
}

/* Green treatment card when ≤14 days remaining */
.treatment-card--milestone {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* Treatment milestone banners */
.treat-milestone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 16px 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}
.treat-milestone--near {
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}
.treat-milestone--complete {
  background: #FEF3C7;
  color: #78350F;
  border: 1px solid #FDE68A;
}
.treat-milestone-btn {
  flex-shrink: 0;
  background: #fff;
  border: 1px solid currentColor;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: inherit;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.treat-milestone-btn:active { opacity: .75; }

/* ─── Dog Switcher List ─────────────────────────────────────── */
#dog-switcher:empty { display: none; }

.dog-switcher {
  margin: 0 16px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-height: 212px; /* ~4 rows visible before scroll */
  overflow-y: auto;
  background: var(--surface);
}

.ds-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
  -webkit-tap-highlight-color: transparent;
}
.ds-row:last-child { border-bottom: none; }
.ds-row:active,
.ds-row:hover { background: var(--surface-2); }
.ds-row--active { background: var(--brand-light); }
.ds-row--active:hover,
.ds-row--active:active { background: var(--brand-light); }
.ds-row--inactive { opacity: .55; }

.ds-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-dark);
}
.ds-avatar .avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ds-info {
  flex: 1;
  min-width: 0;
}
.ds-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ds-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Section ──────────────────────────────────────────────── */
.section {
  padding: 0 16px 8px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  margin-top: 4px;
}
.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.section-action {
  font-size: 13px;
  color: var(--brand);
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
}
.card-body { padding: 12px 14px; }

/* ─── Med Checklist ────────────────────────────────────────── */
.med-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s;
}
.med-item:last-child { border-bottom: none; }
.med-item:active { background: var(--surface-2); }

.med-check {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .2s;
  background: var(--surface);
}
.med-item.checked .med-check {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.med-item.checked .med-name {
  text-decoration: line-through;
  color: var(--text-3);
}
.med-name { font-size: 15px; font-weight: 600; }
.med-sub  { font-size: 12px; color: var(--text-2); margin-top: 1px; }

/* ─── Quick Nav Grid ───────────────────────────────────────── */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 16px 12px;
}
.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 11px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background .12s;
  text-align: center;
  line-height: 1.2;
}
.quick-btn:active { background: var(--surface-2); }
.quick-btn--export {
  grid-column: 1 / -1;
  flex-direction: row;
  gap: 8px;
  padding: 10px 16px;
  font-size: 12px;
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand-dark);
}
.quick-btn--export:active { background: #d3e6f8; }
.quick-btn .qicon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}

/* ─── Per-dose Med Checklist ───────────────────────────────── */
.med-block {
  border-bottom: 1px solid var(--border);
}
.med-block:last-child { border-bottom: none; }

.med-block--done .med-header { opacity: .6; }

.med-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
  gap: 8px;
}

.all-done-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: var(--green-light);
  color: #065F46;
}

/* Individual dose row — tappable */
.med-dose-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s;
}
.med-dose-row:active { background: var(--surface-2); }
.med-dose-row.checked { cursor: pointer; } /* still tappable — undo */

.dose-slot-label {
  font-size: 14px;
  font-weight: 700;
  width: 60px;   /* fixed so AM/PM/Midday columns align */
  flex-shrink: 0;
  color: var(--text);
}
.med-dose-row.checked .dose-slot-label { color: var(--text-3); }

.dose-status {
  font-size: 13px;
  color: var(--text-3);
  flex: 1;
}
.med-dose-row.checked .dose-status { color: var(--green); font-weight: 500; }

/* ─── Log Entries ──────────────────────────────────────────── */
.log-entry {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.log-entry:last-child { border-bottom: none; }
.log-tag {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.tag-observation    { background: var(--brand-light);   color: var(--brand-dark); }
.tag-vet_visit      { background: var(--green-light);   color: #065F46; }
.tag-medication_given { background: var(--accent-light); color: #92400E; }
.tag-weight         { background: var(--purple-light);  color: #4C1D95; }
.tag-note           { background: var(--surface-2);     color: var(--text-2); }
.tag-behavior       { background: #EDE9FE;              color: #4C1D95; }
.tag-appetite       { background: #FEF3C7;              color: #92400E; }
.tag-energy         { background: #ECFDF5;              color: #065F46; }
.tag-training       { background: #DBEAFE;              color: #1E40AF; }
.tag-other          { background: var(--surface-2);     color: var(--text-2); }

.log-body  { font-size: 14px; line-height: 1.45; flex: 1; }
.log-time  { font-size: 11px; color: var(--text-3); margin-top: 3px; }

/* ─── Log Tab Filters ───────────────────────────────────────── */
.log-dog-selector {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 16px 8px;
  scrollbar-width: none;
}
.log-dog-selector::-webkit-scrollbar { display: none; }
.log-dog-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.log-dog-chip.active {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand-dark);
}
.log-dog-chip-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.log-filters {
  padding: 0 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.log-date-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.log-date-nav {
  width: 32px; height: 32px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  font-size: 18px;
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}
.log-date-input {
  flex: 1;
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
}
.log-all-dates {
  flex-shrink: 0;
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.log-all-dates.active {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand-dark);
}
.log-filter-tags {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.log-filter-tags::-webkit-scrollbar { display: none; }
.log-filter-pill {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.log-filter-pill.active {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand-dark);
}
.log-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
}
.log-search-input::placeholder { color: var(--text-3); }

/* ─── Log Entry v2 (full log tab) ───────────────────────────── */
.log-card {
  margin: 0 16px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.log-entry-v2 {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.log-entry-v2:last-child { border-bottom: none; }
.log-entry-dog-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.log-entry-dog-avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.log-entry-dog-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.log-entry-v2-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.log-del-btn {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  color: var(--text-3);
  line-height: 1;
}
.log-del-btn:hover { background: var(--surface-2); }

/* ─── Log Preview (home screen 3-entry strip) ───────────────── */
.log-preview-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.log-preview-row:last-child { border-bottom: none; }
.log-preview-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.log-preview-body {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.4;
}

/* ─── Log Tag Picker (modal sheet) ─────────────────────────── */
.log-tag-picker {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 16px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.log-tag-picker::-webkit-scrollbar { display: none; }

.log-tag-pill {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.log-tag-pill.active {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand-dark);
}
.log-tag-pill:hover:not(.active) {
  background: var(--surface-3, var(--surface-2));
  border-color: var(--text-3);
}

.log-textarea {
  min-height: 120px;
  resize: none;
}

/* ─── Calendar ─────────────────────────────────────────────── */
.cal-page { display: flex; flex-direction: column; height: 100%; }

/* Header row: month nav + Add Event button */
.cal-header-row {
  display: flex;
  align-items: center;
  padding: 10px 16px 6px;
  gap: 8px;
}
.cal-header-row .cal-nav {
  flex: 1;
  padding: 0;
}
.cal-add-btn {
  flex-shrink: 0;
  padding: 7px 13px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.cal-add-btn:active { opacity: .85; }

/* Dog filter chips */
.cal-dog-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 16px 8px;
  scrollbar-width: none;
}
.cal-dog-filter::-webkit-scrollbar { display: none; }
.cal-dog-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.cal-dog-chip.active {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand-dark);
}
.cal-dog-chip-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cal-nav-btn {
  font-size: 26px;
  font-weight: 300;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
}
.cal-month-label {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.cal-dow-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0 8px;
  margin-bottom: 2px;
}
.cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  padding: 4px 0;
}

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

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px 3px;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s;
  min-height: 44px;
}
.cal-cell:hover { background: var(--surface-2); }
.cal-cell--blank { cursor: default; }
.cal-cell--blank:hover { background: none; }
.cal-cell--today .cal-day-num {
  background: var(--brand);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-cell--selected { background: var(--brand-light); }
.cal-cell--selected:hover { background: var(--brand-light); }
.cal-cell--selected.cal-cell--today .cal-day-num { background: var(--brand-dark); }

.cal-day-num {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 24px;
  width: 24px;
  text-align: center;
}

.cal-dots {
  display: flex;
  gap: 3px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2px;
}
.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-dot-more {
  font-size: 9px;
  color: var(--text-3);
  font-weight: 600;
}

/* ── Day detail panel ──────────────────────────────────────── */
.cal-detail {
  margin: 8px 16px 0;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  padding-bottom: 100px; /* space above nav */
}
.cal-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cal-detail-date {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.cal-event-row {
  display: flex;
  align-items: flex-start;
  gap: 0;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.cal-event-row:last-child { border-bottom: none; }
.cal-event-pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}
.cal-event-body { flex: 1; min-width: 0; }
.cal-event-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}
.cal-event-meta {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.cal-event-type-label {
  background: var(--surface-2);
  border-radius: var(--radius-full);
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}
.cal-event-notes {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
  line-height: 1.4;
}
.cal-no-events {
  font-size: 13px;
  color: var(--text-3);
  padding: 12px 0;
  text-align: center;
}

/* Updated event row internals */
.cal-event-body { flex: 1; min-width: 0; }
.cal-event-top-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.cal-event-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.cal-event-dog {
  font-size: 11px;
  color: var(--text-2);
}
.cal-event-time {
  font-size: 11px;
  color: var(--text-3);
  margin-left: auto;
}
.cal-event-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  margin-left: 6px;
}
.cal-ev-btn {
  background: none;
  border: none;
  font-size: 15px;
  padding: 4px 5px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-3);
  line-height: 1;
}
.cal-ev-btn:hover { background: var(--surface-2); }
.cal-ev-btn--del:hover { background: #FEE2E2; }

/* ── Event modal extras ─────────────────────────────────────── */
.form-allday-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
}
.form-allday-toggle input { accent-color: var(--brand); }

.btn-danger {
  background: #FEE2E2;
  color: #DC2626;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-danger:active { background: #FECACA; }

/* ─── Form / Modal ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  padding: 0;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-sheet {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding-bottom: calc(var(--safe-bottom) + 16px);
  animation: slideUp .2s ease;
  max-height: 92dvh;
  overflow-y: auto;
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 16px;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-2); font-size: 22px; line-height: 1;
  padding: 2px 6px;
}

/* ─── Form Fields ──────────────────────────────────────────── */
.form-body { padding: 0 16px; }
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand);
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%236B7280' d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; padding-right: 36px; }

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s;
}
.btn:active { opacity: .8; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-danger  { background: var(--red); color: #fff; }
.btn-ghost   { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-full    { width: 100%; }
.btn-row { display: flex; gap: 8px; padding: 14px 16px 4px; }

/* ─── Tag Toggle ───────────────────────────────────────────── */
.tag-toggles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag-toggle {
  padding: 6px 13px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-2);
  -webkit-tap-highlight-color: transparent;
}
.tag-toggle.active {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand-dark);
}

/* ─── Dog List (Dogs tab) ──────────────────────────────────── */
.dog-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dog-list-item:active { background: var(--surface-2); }
.dog-avatar {
  width: 46px; height: 46px;
  border-radius: var(--radius-full);
  background: var(--brand-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  overflow: hidden;
}
.dog-info-name { font-size: 16px; font-weight: 700; }
.dog-info-sub  { font-size: 13px; color: var(--text-2); }
.status-pill {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  flex-shrink: 0;
}
.pill-healthy       { background: var(--green-light);  color: #065F46; }
.pill-on_treatment  { background: var(--accent-light); color: #92400E; }
.pill-meds_due      { background: var(--red-light);    color: #991B1B; }
.pill-board_train   { background: var(--purple-light); color: #4C1D95; }
.pill-foster        { background: var(--orange-light); color: #9A3412; }
.pill-foster_placed { background: var(--orange-light); color: #9A3412; }
.pill-adopted       { background: var(--green-light);  color: #065F46; }
.pill-returned      { background: var(--red-light);    color: #991B1B; }
.pill-deceased      { background: #F3F4F6;             color: #374151; }

/* ─── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-2);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }
.empty-state .empty-action { margin-top: 16px; }

/* ─── FAB ──────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  right: max(16px, calc(50% - 480px/2 + 16px));
  width: 52px; height: 52px;
  border-radius: var(--radius-full);
  background: var(--brand);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(59,125,216,.4);
  font-size: 24px;
  z-index: 90;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s;
}
.fab:active { transform: scale(.93); }

/* ─── Spinner ──────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 32px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast ────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  z-index: 10001;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Profile header ───────────────────────────────────────── */
.profile-header {
  padding: 16px 16px 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
}
.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.profile-avatar-wrap:active .profile-avatar { opacity: .75; }

.profile-avatar {
  width: 60px; height: 60px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--brand-light), #D4E8F9);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  overflow: hidden;
  transition: opacity .1s;
}

.avatar-cam-badge {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 22px;
  height: 22px;
  background: var(--brand);
  border: 2px solid var(--surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  pointer-events: none;
  line-height: 1;
}

.avatar-uploading {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.08);
}
.avatar-uploading::after {
  content: '';
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Shared avatar image + initials styles */
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-initials {
  font-size: .5em;   /* relative to container's font-size */
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--brand-dark);
  line-height: 1;
}
.profile-name { font-size: 20px; font-weight: 800; }
.profile-meta { font-size: 13px; color: var(--text-2); }

/* ─── Vet Instructions ─────────────────────────────────────── */
.vet-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.vet-card-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.vet-card-body  { font-size: 14px; color: var(--text-2); line-height: 1.5; white-space: pre-wrap; }
.vet-card-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn-sm { padding: 6px 13px; font-size: 13px; }

/* ─── Vaccination checklist ────────────────────────────────── */
.vax-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.vax-row:last-child { border-bottom: none; }

.vax-icon {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}
.vax-name  { font-size: 14px; font-weight: 600; flex: 1; }
.vax-label { font-size: 12px; text-align: right; white-space: nowrap; }

.vax-current  .vax-icon, .vax-given .vax-icon { background: var(--green-light); color: #065F46; }
.vax-current  .vax-label, .vax-given .vax-label { color: var(--green); font-weight: 500; }
.vax-expired  .vax-icon  { background: var(--red-light); color: #991B1B; }
.vax-expired  .vax-name  { color: var(--red); }
.vax-expired  .vax-label { color: var(--red); font-weight: 600; }
.vax-expiring .vax-icon  { background: var(--accent-light); color: #92400E; }
.vax-expiring .vax-label { color: var(--accent); font-weight: 600; }
.vax-none     .vax-icon  { background: var(--surface-2); color: var(--text-3); }
.vax-none     .vax-name  { color: var(--text-2); }
.vax-none     .vax-label { color: var(--text-3); }

/* ─── Vaccine form sub-section ─────────────────────────────── */
.form-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-3);
  padding: 4px 0 10px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.form-vax-group { margin-bottom: 14px; }
.form-vax-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-vax-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.form-vax-dates .form-group { margin-bottom: 0; }

/* ─── Active / Inactive toggle ────────────────────────────── */
.active-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, border-color .15s, color .15s;
}
.active-toggle__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-3);
  transition: background .15s;
  flex-shrink: 0;
}
.active-toggle.is-active {
  background: var(--green-light);
  border-color: var(--green);
  color: #065F46;
}
.active-toggle.is-active .active-toggle__dot { background: var(--green); }

.form-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 5px;
}

/* Inactive visual treatment in chips & lists */
.dog-chip.inactive { opacity: .55; }
.dog-list-item--inactive { opacity: .65; }

/* "Show inactive" pill distinct style */
.filter-chip--inactive { border-style: dashed; }
.filter-chip--inactive.active {
  background: var(--text-2);
  border-color: var(--text-2);
  border-style: solid;
  color: #fff;
}

/* ─── Section Panel (Behavior / Health / Goals bottom sheet) ── */
.modal-sheet--panel {
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
}
.panel-header {
  display: flex;
  align-items: center;
  padding: 4px 16px 12px;
  flex-shrink: 0;
}
.panel-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}
.modal-sheet--panel .panel-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* ─── Panel Edit Button ─────────────────────────────────────── */
.panel-edit-row {
  padding: 12px 16px 8px;
  flex-shrink: 0;
}
.panel-edit-btn {
  width: 100%;
  padding: 13px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.panel-edit-btn:active { opacity: .85; }

/* ─── Meds view toggle (Prep List / Manage) ─────────────────── */
.prep-toggle {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 3px;
  margin: 0 16px 4px;
  gap: 2px;
}
.prep-tab {
  flex: 1;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.prep-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* ─── Prep view filter toggle (Meds only / All / Feeding only) ── */
.prep-view-toggle {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 3px;
  margin: 8px 16px 12px;
  gap: 2px;
}
.prep-view-tab {
  flex: 1;
  padding: 7px 6px;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius) - 2px);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.prep-view-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* ─── Prep List ─────────────────────────────────────────────── */
.prep-all-done {
  text-align: center;
  padding: 12px 16px 4px;
  font-size: 14px;
  font-weight: 600;
  color: #065F46;
}
.prep-section { margin-bottom: 4px; }
.prep-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  padding: 14px 16px 6px;
}
.prep-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  transition: background .1s;
}
.prep-row:last-child { border-bottom: 1px solid var(--border); }
.prep-row--done { opacity: .55; }
.prep-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
}
.prep-info { flex: 1; min-width: 0; }
.prep-dog-name  { font-size: 11px; color: var(--text-2); margin-bottom: 1px; }
.prep-med-name  { font-size: 14px; font-weight: 600; color: var(--text); }
.prep-med-sub   { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.prep-check {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  color: transparent;
  padding: 0;
}
.prep-check.given {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.prep-check.given svg { width: 16px; height: 16px; }

/* ─── Med form time grid ─────────────────────────────────────── */
.time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.time-field .time-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
}

/* ─── Behavior Tab Content ──────────────────────────────────── */
.behavior-tab { padding-top: 4px; }

.behavior-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.behavior-row:last-child { border-bottom: none; }
.behavior-label { color: var(--text-2); }
.behavior-val   { font-weight: 500; text-align: right; }
.behavior-sublabel { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }

.behavior-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 4px;
}
.bpill {
  padding: 4px 10px;
  background: var(--brand-light);
  color: var(--brand-dark);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
}
.bpill--trigger {
  background: var(--accent-light);
  color: #92400E;
}

/* Resource guarding alert */
.rg-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #FEF9C3;
  border: 1.5px solid #FDE047;
  border-radius: var(--radius);
  padding: 12px 14px;
}
.rg-alert-icon  { font-size: 20px; line-height: 1; }
.rg-alert-title { font-size: 14px; font-weight: 700; color: #713F12; }
.rg-alert-notes { font-size: 13px; color: #92400E; margin-top: 2px; }

/* Badge in profile name */
.rg-badge {
  font-size: 14px;
  vertical-align: middle;
  cursor: default;
}

/* Known cues table */
.cues-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.cues-table th {
  text-align: left;
  padding: 8px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.cues-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}
.cues-table tr:last-child td { border-bottom: none; }
.cue-prof {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.cue-learning  { background: var(--accent-light);  color: #92400E; }
.cue-consistent{ background: var(--brand-light);   color: var(--brand-dark); }
.cue-fluent    { background: var(--green-light);   color: #065F46; }

/* ─── Health Tab ─────────────────────────────────────────────── */
.health-tab { padding-top: 4px; }

/* Food type badge */
.food-type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}
.food-type-dry   { background: #FEF3C7; color: #92400E; }
.food-type-wet   { background: #DBEAFE; color: #1E40AF; }
.food-type-raw   { background: #D1FAE5; color: #065F46; }
.food-type-mixed { background: var(--purple-light); color: #5B21B6; }

/* Allergy pills — red variant */
.bpill--allergy {
  background: var(--red-light);
  color: #991B1B;
}

/* ─── Goals Tab ──────────────────────────────────────────────── */
.goals-tab { padding-top: 4px; }

/* Contact card */
.contact-block { padding: 10px 14px; }
.contact-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  margin-bottom: 2px;
}
.contact-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.contact-relation {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-2);
}
.contact-phone { margin-top: 3px; font-size: 14px; }
.contact-address {
  margin-top: 3px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.4;
}
.contact-divider {
  height: 1px;
  background: var(--border);
  margin: 0 14px;
}

/* Tappable phone link */
.tel-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}
.tel-link:hover { text-decoration: underline; }

/* Training goals list */
.goals-list { padding: 4px 0; }
.goal-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.goal-row:last-child { border-bottom: none; }
.goal-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}
.goal-text { font-size: 14px; line-height: 1.4; }
.goals-empty {
  padding: 0 16px;
  font-size: 13px;
  color: var(--text-3);
  margin: 0;
}

/* House manners pills */
.bpill--manner    { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.bpill--destruct  { background: var(--accent-light); color: #92400E; }
.bpill--destruct-heavy { background: var(--red-light); color: #991B1B; }

/* ─── Behavior Modal ─────────────────────────────────────────── */
.b-opt-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.b-opt-pill {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.b-opt-pill.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.rg-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.rg-check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.triggers-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.trigger-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 14px;
}
.trigger-remove {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-3);
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.trigger-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.trigger-add-row .form-input { flex: 1; margin-bottom: 0; }

.cues-edit-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.cue-edit-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.cue-edit-name { flex: 1; font-size: 14px; }
.cue-prof-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--surface);
}

/* ─── Vet Attachments ──────────────────────────────────────── */
#vet-attachments-section {
  margin-top: 12px;
}
.att-empty {
  font-size: 13px;
  color: var(--text-3);
  margin: 0;
  padding: 4px 0;
}
.att-uploading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  padding: 8px 0;
}
.att-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.att-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.att-type-badge {
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.att-type-badge--pdf {
  background: #FEE2E2;
  color: #991B1B;
}
.att-type-badge--img {
  background: #DBEAFE;
  color: #1E40AF;
}
.att-type-badge--file {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.att-info {
  flex: 1;
  min-width: 0;
}
.att-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-1);
}
.att-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
}
.att-download-btn {
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
  color: var(--primary);
  padding: 4px;
  border-radius: var(--radius-sm);
}
.att-download-btn:hover { background: var(--surface); }
.att-delete-btn {
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
  color: var(--text-3);
  background: none;
  border: none;
  padding: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.att-delete-btn:hover { color: #DC2626; background: #FEE2E2; }

/* ─── Feeding Today view ────────────────────────────────────── */
.ft-time-group {
  margin-bottom: 4px;
}
.ft-time-header {
  padding: 10px 16px 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .04em;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.ft-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
  -webkit-tap-highlight-color: transparent;
}
.ft-row:last-child { border-bottom: none; }
.ft-row:active { background: var(--surface-2); }
.ft-row--done { opacity: .7; }
.ft-row--low-stock { background: #FFFBEB; }
.ft-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}
.ft-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ft-dog-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ft-meal-time {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}
.ft-detail {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.ft-set-schedule {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--brand);
  cursor: pointer;
  text-align: left;
  font-weight: 500;
}
.ft-fed-status {
  font-size: 12px;
  color: var(--green);
  font-weight: 600;
}
.ft-stock-warn {
  font-size: 11px;
  color: #B45309;
  font-weight: 600;
}
.ft-check-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  color: var(--text-3);
}
.ft-check-btn:active { transform: scale(.92); }
.ft-check-btn--done {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}
.ft-check-btn svg { width: 18px; height: 18px; stroke-width: 2.5; }

/* ─── Feeding Tab ──────────────────────────────────────────── */
.feed-history-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 16px 4px;
}
.feed-scope-toggle {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
}
.feed-scope-btn {
  padding: 4px 14px;
  border-radius: var(--radius-full);
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.feed-scope-btn.active {
  background: var(--brand);
  color: #fff;
}
.feed-hist-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.feed-hist-row:last-child { border-bottom: none; }
.feed-hist-info { flex: 1; min-width: 0; }
.feed-hist-dog {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.feed-hist-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.feed-hist-meta {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}
.feed-hist-notes {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 4px;
  font-style: italic;
}

/* ─── Food brand autocomplete ───────────────────────────────── */
.food-ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,.10);
  max-height: 220px;
  overflow-y: auto;
}
.food-ac-item {
  padding: 11px 14px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--surface-2);
}
.food-ac-item:last-child { border-bottom: none; }
.food-ac-item:hover,
.food-ac-item--active {
  background: var(--surface-2);
  color: var(--brand);
  font-weight: 600;
}

/* ─── Share / Public Profile Modal ─────────────────────────── */
.share-live-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #D1FAE5;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.share-live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(16,185,129,.25);
}
.share-live-text {
  font-size: 13px;
  font-weight: 700;
  color: #065F46;
}
.share-url-block {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.share-url-value {
  flex: 1;
  font-size: 12px;
  color: var(--brand);
  font-family: monospace;
  word-break: break-all;
  line-height: 1.4;
}
.share-promo {
  text-align: center;
  padding: 20px 8px 16px;
}
.share-promo-icon { font-size: 40px; margin-bottom: 10px; }
.share-promo-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.share-promo-sub {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.55;
}
.share-disable-btn {
  color: var(--text-2) !important;
  font-size: 13px !important;
}
.share-success-banner {
  background: #D1FAE5;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.share-success-title {
  font-size: 16px;
  font-weight: 700;
  color: #065F46;
  margin-bottom: 4px;
}
.share-success-sub {
  font-size: 13px;
  color: #065F46;
  opacity: 0.85;
}
.share-action-row {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}
.share-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.share-bio-saved {
  font-size: 12px;
  font-weight: 400;
  color: var(--green, #22c55e);
  margin-left: 6px;
  transition: opacity 0.3s;
}
.share-bio-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.share-save-bio-btn {
  padding: 8px 14px;
  background: var(--surface-2, #F3F4F6);
  color: var(--text, #111827);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.share-save-bio-btn:hover  { background: #E5E7EB; }
.share-save-bio-btn:disabled { opacity: .55; cursor: not-allowed; }
.share-generate-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #7C3AED 0%, #4F46E5 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.share-generate-btn:hover  { opacity: .88; }
.share-generate-btn:active { opacity: .75; }
.share-generate-btn:disabled { opacity: .55; cursor: not-allowed; }
/* Pulsing dot shown while generating */
.share-gen-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: rgba(255,255,255,.85);
  border-radius: 50%;
  animation: genPulse .8s ease-in-out infinite alternate;
}
@keyframes genPulse {
  from { opacity: .4; transform: scale(.85); }
  to   { opacity: 1;  transform: scale(1.1); }
}
.share-copy-btn {
  flex-shrink: 0;
  padding: 6px 14px !important;
  font-size: 13px !important;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

/* ─── Outcome Records ──────────────────────────────────────── */
.outcome-record {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.outcome-record:last-child { border-bottom: none; }
.outcome-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}
.outcome-meta {
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.outcome-notes {
  font-size: 13px;
  color: var(--text);
  margin-top: 6px;
  font-style: italic;
}

/* ─── Outcome type picker (modal) ───────────────────────────── */
.outcome-type-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.outcome-type-btn {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  color: var(--text-2);
  text-align: center;
}
.outcome-type-btn.active {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand-dark);
}

/* ─── Dashboard adopted banner ──────────────────────────────── */
.dash-adopted-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 16px 4px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%);
  border-radius: var(--radius);
  border: 1px solid #6EE7B7;
  cursor: pointer;
  transition: filter .12s, transform .1s;
}
.dash-adopted-banner:active { filter: brightness(.95); transform: scale(.98); }
.dash-adopted-icon { font-size: 28px; line-height: 1; }
.dash-adopted-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.dash-adopted-value {
  font-size: 24px;
  font-weight: 800;
  color: #065F46;
  line-height: 1;
}
.dash-adopted-label {
  font-size: 13px;
  font-weight: 500;
  color: #047857;
}

/* ─── Weight Tracking ────────────────────────────────────────── */
.weight-section {
  margin: 0 16px 4px;
  padding: 14px 0 4px;
  border-bottom: 1px solid var(--border);
}
.weight-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.weight-current-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-2);
  margin-bottom: 2px;
}
.weight-current-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
}
.weight-history {
  margin-top: 4px;
}
.weight-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.weight-row-date {
  color: var(--text-2);
  font-size: 13px;
  flex: 1;
}
.weight-row-val {
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}
.weight-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.weight-change {
  font-size: 12px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
}
.weight-change--up   { background: #FEE2E2; color: #991B1B; }
.weight-change--down { background: #D1FAE5; color: #065F46; }
.weight-change--same { background: var(--surface-2); color: var(--text-2); }
.weight-notes {
  font-size: 12px;
  color: var(--text-3);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.weight-row-del {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
}
.weight-row-del:hover { color: var(--red, #ef4444); }
.weight-hint {
  font-size: 13px;
  color: var(--text-2);
  padding: 8px 0 4px;
}
.weight-treatment-note {
  margin-top: 10px;
  padding: 10px 12px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #1E40AF;
  line-height: 1.4;
}

/* ─── Notification Permission Banner ────────────────────────── */
#notif-banner {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 448px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,.13);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 110;
  animation: slideUp .22s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0);    }
}
.notif-banner-text {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}
.notif-banner-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.notif-banner-btns button {
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}
#notif-enable  { background: var(--brand); color: #fff; }
#notif-dismiss { background: var(--surface-2); color: var(--text-2); }

/* ─── Utilities ────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.p-16   { padding: 16px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-2); }
.divider { height: 1px; background: var(--border); margin: 8px 0; }

/* ─── Login screen ─────────────────────────────────────────── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 16px;
  background: linear-gradient(145deg, #1e3a5f 0%, #3B7DD8 100%);
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px 28px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.login-logo {
  font-size: 52px;
  text-align: center;
  margin-bottom: 8px;
  line-height: 1;
}
.login-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  text-align: center;
  margin: 0 0 4px;
}
.login-sub {
  font-size: 14px;
  color: var(--text-2);
  text-align: center;
  margin: 0 0 28px;
  line-height: 1.45;
}
.login-submit-btn {
  margin-top: 12px;
}
.login-error {
  margin-top: 10px;
  padding: 10px 12px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 8px;
  font-size: 13px;
  color: #DC2626;
  line-height: 1.4;
}
.login-code-hint {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 14px;
  line-height: 1.5;
}
.login-code-input {
  font-size: 28px !important;
  font-weight: 700 !important;
  letter-spacing: 0.25em !important;
  text-align: center !important;
}
.login-trust-success {
  font-size: 18px;
  font-weight: 700;
  color: var(--green, #22c55e);
  text-align: center;
  margin-bottom: 20px;
}
.login-trust-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  padding: 14px 16px;
  background: var(--surface-2, #F3F4F6);
  border-radius: 10px;
  border: 2px solid transparent;
  transition: border-color .15s;
  user-select: none;
}
.login-trust-label:has(input:checked) {
  border-color: var(--brand, #3B7DD8);
  background: #EFF6FF;
}
.login-trust-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand, #3B7DD8);
  flex-shrink: 0;
}
.login-trust-sub {
  font-size: 12px;
  color: var(--text-2);
  margin: 8px 0 16px;
  text-align: center;
  line-height: 1.45;
  min-height: 2em;
}

/* ─── Account sheet ────────────────────────────────────────── */
.account-sheet-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.account-sheet-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.account-sheet-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.account-sheet-email {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
  word-break: break-all;
}
.account-sheet-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  padding: 2px 0 4px;
}
.account-sheet-role {
  color: var(--text-2);
  font-weight: 500;
  text-transform: capitalize;
}
.account-sheet-trust {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2, #F3F4F6);
  color: var(--text-2);
  font-weight: 600;
}
.account-sheet-trust.trusted {
  background: #DCFCE7;
  color: #166534;
}

/* ─── Nav user avatar ──────────────────────────────────────── */
.nav-user-btn { flex-shrink: 0; }
.nav-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2px;
}

/* ─── Admin panel ──────────────────────────────────────────── */
.admin-wrap { padding: 0 16px 80px; }
.admin-section { margin-bottom: 28px; }
.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.admin-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.admin-card-list { display: flex; flex-direction: column; gap: 8px; }
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background .12s;
}
.admin-card:hover { background: var(--surface-2); }
.admin-card[data-user-id]:active { background: var(--surface-2); }
.admin-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.admin-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-2);
}
.admin-badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
}
.admin-badge--super { background: #EDE9FE; color: #5B21B6; }
.admin-badge--inactive { background: #FEE2E2; color: #DC2626; }
.admin-no-org { color: var(--text-3, #9CA3AF); font-style: italic; }
.admin-empty { font-size: 14px; color: var(--text-2); padding: 12px 0; text-align: center; }

/* ─── CSV Import ────────────────────────────────────────────── */
.import-file-pick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.import-choose-btn {
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.import-filename-label {
  font-size: 13px;
  color: var(--text-2);
  word-break: break-all;
}
.import-ready-msg {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}
.import-preview-table-wrap { overflow-x: auto; }
.import-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.import-preview-table th {
  text-align: left;
  padding: 6px 8px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.import-preview-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.import-col-hint {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}
.import-success {
  padding: 10px 12px;
  background: #D1FAE5;
  border-radius: 8px;
  font-size: 14px;
  color: #065F46;
  font-weight: 600;
}
.dog-chip--import {
  border: 1.5px dashed var(--border);
  opacity: .8;
}
.dog-chip--import:hover { opacity: 1; border-color: var(--brand); }

/* ─── DEV environment banner ───────────────────────────────── */
.dev-env-banner {
  position: sticky;
  top: 0;
  z-index: 999;
  background: #FCD34D;
  color: #92400E;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 6px 12px;
  letter-spacing: .03em;
}
