/* ══════════════════════════════════════════════════════════════
   WAH Pro — Shared Design System
   ══════════════════════════════════════════════════════════════ */

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

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  /* Brand */
  --orange: #F4622A;
  --orange-hover: #e0551f;
  --offwhite: #FFF9F4;

  /* Text */
  --dark: #1a1a1a;
  --mid: #555;
  --light: #888;

  /* UI */
  --border: #e5e0d8;
  --card-bg: #fff;
  --error: #c0392b;
  --success: #16A34A;
  --danger: #B91C1C;
  --warn: #D97706;

  /* Spacing scale (8px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 48px;

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 50px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-orange: 0 4px 16px rgba(244, 98, 42, 0.4);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 24px;

  /* Z-index layers */
  --z-header: 100;
  --z-nav: 300;
  --z-sheet: 300;
  --z-drawer: 400;
  --z-toast: 500;
}

/* ── Body ────────────────────────────────────────────────── */
body {
  font-family: var(--font-family);
  background: var(--offwhite);
  color: var(--dark);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Typography ──────────────────────────────────────────── */
.text-xs  { font-size: var(--text-xs); }
.text-sm  { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md  { font-size: var(--text-md); }
.text-lg  { font-size: var(--text-lg); }
.text-xl  { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.font-bold   { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium  { font-weight: 500; }
.text-mid  { color: var(--mid); }
.text-light { color: var(--light); }
.text-orange { color: var(--orange); }
.text-center { text-align: center; }

/* ── Shared Header ───────────────────────────────────────── */
.header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) var(--space-4) var(--space-3);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.header-brand-wordmark {
  font-size: var(--text-lg);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--dark);
}
.org-name {
  font-size: var(--text-xs);
  color: var(--orange);
  font-weight: 700;
  margin-top: 1px;
}

.header-badge-preview {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  padding: 1px 7px;
  border-radius: 20px;
  letter-spacing: 0.02em;
  margin-left: 6px;
  white-space: nowrap;
  vertical-align: middle;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Status dot ──────────────────────────────────────────── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
}

/* ── Flow header variant (add-dog, first-dog) ──────────── */
.header-flow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}
.btn-back {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--dark);
  padding: 0 4px;
  line-height: 1;
}
.header-flow .btn-back {
  padding: 4px 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
}
.header-flow .btn-back:hover {
  background: #f5f5f5;
}
.header-flow .header-flow-title {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--dark);
  margin: 0;
}

/* ── Content container ───────────────────────────────────── */
.content {
  padding: 0;
  max-width: 700px;
  margin: 0 auto;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  font-family: var(--font-family);
  font-size: var(--text-base);
  font-weight: 600;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
  line-height: 1.3;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--orange);
  color: #fff;
  padding: 12px 20px;
}
.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
  background: #fff;
  color: var(--orange);
  border: 1.5px solid var(--orange);
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-family);
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-secondary:hover { background: #fff5f0; }

.btn-ghost {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--mid);
  padding: 8px 14px;
}
.btn-ghost:hover { border-color: var(--orange); color: var(--orange); }

.btn-danger {
  background: none;
  border: none;
  color: var(--danger);
  font-weight: 600;
}

.btn-sm {
  font-size: var(--text-sm);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  color: var(--light);
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
}
.btn-icon:hover { background: #f5f5f5; color: var(--mid); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-interactive {
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.card-interactive:active {
  transform: scale(0.98);
  box-shadow: none;
}

/* ── Inputs ──────────────────────────────────────────────── */
.input {
  width: 100%;
  font-family: var(--font-family);
  font-size: var(--text-md);
  padding: var(--space-3) var(--space-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: #fafaf8;
  color: var(--dark);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  -webkit-appearance: none;
}
.input:focus {
  border-color: var(--orange);
  background: #fff;
}
.input::placeholder { color: var(--light); }
.input.error { border-color: var(--error); }

/* ── Labels ──────────────────────────────────────────────── */
.label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--mid);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-amber {
  background: #fff3e6;
  color: #b85e00;
}
.badge-red {
  background: #fee2e2;
  color: var(--danger);
}
.badge-green {
  background: #d1fae5;
  color: #065f46;
}
.badge-blue {
  background: #dbeafe;
  color: #1d4ed8;
}
.badge-gray {
  background: #f0f0f0;
  color: #666;
}
.badge-orange {
  background: #fff3e6;
  color: #b85e00;
}

/* ── Bottom Sheet ────────────────────────────────────────── */
.sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: var(--z-sheet);
  align-items: flex-end;
  justify-content: center;
}
.sheet-overlay.open { display: flex; }

.sheet {
  background: #fff;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-4) var(--space-5) var(--space-6);
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  animation: sheetSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Flex-layout sheet variant: action bar stays at bottom, middle scrolls.
   Wrap content in <div class="sheet-scroll"> between header and .sheet-actions. */
.sheet--flex {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  max-height: 90vh;
  height: 90vh;
}
.sheet--flex .sheet-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  padding: var(--space-4) var(--space-5) var(--space-5);
}
.sheet--flex .sheet-actions {
  position: static;
  margin-top: 0;
  flex-shrink: 0;
  padding: var(--space-3) var(--space-5) var(--space-6);
}
@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: #ddd;
  border-radius: 4px;
  margin: 0 auto var(--space-4);
}

.sheet-title {
  font-size: var(--text-lg);
  font-weight: 800;
  margin-bottom: var(--space-4);
}

.sheet-field {
  margin-bottom: var(--space-3);
}

.sheet-actions {
  /* MUST be position: sticky so action bar is always reachable */
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-5);
  position: sticky;
  bottom: 0;
  background: #fff;
  z-index: 1;
  padding: var(--space-3) 0 0;
}

.sheet-btn-primary {
  background: var(--orange);
  color: #fff;
  border: none;
  font-family: var(--font-family);
  font-size: var(--text-base);
  font-weight: 700;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  flex: 1;
  transition: opacity 0.15s;
}
.sheet-btn-primary:active { opacity: 0.9; }

.sheet-btn-secondary {
  background: #f5f5f5;
  color: var(--mid);
  border: none;
  font-family: var(--font-family);
  font-size: var(--text-base);
  font-weight: 600;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  flex: 1;
  transition: opacity 0.15s;
}
.sheet-btn-secondary:active { opacity: 0.9; }

/* ── Inline dog notes ────────────────────────────────────── */
.dog-row-notes-collapsed { font-size: 12px; color: var(--mid); margin-top: 2px; cursor: text; }
.dog-row-notes-collapsed:hover { color: var(--orange); }
.add-note-hint { color: var(--light); font-style: italic; }
.dog-row-notes-expanded { margin-top: 6px; }
.dog-notes-input { width: 100%; font-family: 'Inter', sans-serif; font-size: 13px; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 8px; outline: none; resize: vertical; box-sizing: border-box; }
.dog-notes-input:focus { border-color: var(--orange); }
.dog-notes-actions { display: flex; gap: 6px; margin-top: 4px; }
.dog-notes-save { background: var(--orange); color: #fff; border: none; border-radius: 6px; padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer; }
.dog-notes-save:hover { opacity: 0.9; }
.dog-notes-cancel { background: transparent; color: var(--mid); border: 1px solid var(--border); border-radius: 6px; padding: 4px 12px; font-size: 12px; cursor: pointer; }
.dog-notes-cancel:hover { border-color: var(--light); color: var(--dark); }
.note-icon { cursor: pointer; font-size: 13px; opacity: 0.5; transition: opacity 0.15s; }
.note-icon:hover { opacity: 1; }

/* ── Status badges ─────────────────────────────────────── */
.status-badge { display: inline-flex; align-items: center; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 20px; vertical-align: middle; margin-left: 4px; line-height: 1.4; }
.status-badge.unavailable { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.status-badge.adopted { background: #f3e8ff; color: #7c3aed; border: 1px solid #d8b4fe; }
.status-badge.archived { background: #f5f5f4; color: #78716c; border: 1px solid #d6d3d1; }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 600;
  z-index: var(--z-toast);
  display: none;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  animation: toastFadeIn 0.2s ease-out;
}
@keyframes toastFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Loading & Empty States ──────────────────────────────── */
.loading-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--light);
  font-size: var(--text-base);
}

.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: var(--space-3);
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-6) var(--space-5);
}
.empty-state .empty-icon {
  font-size: 56px;
  margin-bottom: var(--space-4);
}
.empty-state h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
}
.empty-state p {
  font-size: var(--text-base);
  color: var(--mid);
  line-height: 1.6;
  margin-bottom: var(--space-5);
}
.empty-state .icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
  display: block;
}
.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 6px;
}
.empty-state button {
  background: var(--orange);
  color: #fff;
  border: none;
  font-weight: 700;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-family: var(--font-family);
}

.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--light);
  font-size: var(--text-base);
}
.loading .spinner,
.spinner.spinner--sm {
  width: 24px;
  height: 24px;
  border-width: 2px;
  animation-duration: 0.6s;
  margin-left: auto;
  margin-right: auto;
}

.banner-warning,
.geocode-banner {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: var(--text-sm);
  color: #92400e;
  line-height: 1.5;
}
.banner-warning a,
.geocode-banner a {
  color: var(--orange);
  font-weight: 600;
  text-decoration: underline;
}

.banner-error {
  background: #fee2e2;
  border: 1.5px solid #ef4444;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: var(--text-sm);
  color: #991b1b;
  line-height: 1.5;
}

.saving-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.92);
  z-index: 999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.saving-overlay.show {
  display: flex;
}
.saving-overlay .spinner {
  width: 32px;
  height: 32px;
  margin-bottom: var(--space-3);
}
.saving-overlay .saving-text {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--mid);
}

/* ── Error message block ─────────────────────────────────── */
.error-msg {
  background: #fdecea;
  border: 1px solid #f5c6cb;
  color: var(--error);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-3);
  font-size: var(--text-sm);
  display: none;
}
.error-msg.visible { display: block; }

/* ── Grid utilities ──────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }
.is-hidden { display: none !important; }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }

/* Full-width stacked action buttons (dog detail, etc.) */
.btn-stack .btn,
.btn-stack.btn { width: 100%; justify-content: center; }
.btn-stack .btn + .btn { margin-top: var(--space-2); }
.btn-compact { width: auto; padding: 8px 14px; font-size: var(--text-sm); }

/* ── Bottom Tab Bar ──────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0 env(safe-area-inset-bottom, 4px) 0;
  z-index: var(--z-nav);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

/* Hide bottom nav on mobile when keyboard is open (input focused) */
@media (hover: none) and (pointer: coarse) {
  .bottom-nav.hide-on-keyboard {
    display: none;
  }
}

/* Hide bottom nav on settings/trust-profile page */
body[data-active-page="settings"] .bottom-nav {
  display: none !important;
}
.bottom-nav-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  max-width: 500px;
  width: 100%;
}
.bottom-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 12px 4px;
  font-family: var(--font-family);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--light);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  cursor: pointer;
  background: none;
  border: none;
  flex: 1;
  min-width: 0;
  user-select: none;
}
.bottom-nav-btn .nav-icon {
  font-size: 20px;
  line-height: 1.2;
}
.bottom-nav-btn:hover {
  color: var(--dark);
  background: #f5f5f5;
}
.bottom-nav-btn.active {
  color: var(--orange);
}
.bottom-nav-btn.active:hover {
  background: #fff5f0;
}

/* ── Hamburger Button ────────────────────────────────────── */
.hamburger-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: var(--space-1);
  line-height: 1;
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.hamburger-btn:hover { background: #f0f0f0; }

/* ── Nav Back Button ──────────────────────────────────────── */
/* Shown on secondary pages (Chat, Billing, Staff) next to hamburger */
.nav-back-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: var(--space-1);
  line-height: 1;
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  flex-shrink: 0;
}
.nav-back-btn:hover { background: #f0f0f0; }

/* ── Hamburger Drawer ────────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: var(--z-drawer);
  display: none;
  animation: fadeIn 0.15s ease-out;
}
.drawer-overlay.open { display: block; }

.drawer-sheet {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 80vw;
  background: #fff;
  z-index: calc(var(--z-drawer) + 1);
  display: none;
  flex-direction: column;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  animation: slideInLeft 0.2s ease-out;
}
.drawer-sheet.open { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInLeft { from { transform: translateX(-100%); } to { transform: translateX(0); } }

.drawer-header {
  padding: var(--space-5) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.drawer-org-name {
  font-size: var(--text-md);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.drawer-org-type {
  font-size: var(--text-xs);
  color: var(--orange);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.drawer-body { flex: 1; overflow-y: auto; padding: var(--space-2) 0; }

.drawer-section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-3) var(--space-4) var(--space-1);
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--dark);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.1s;
}
.drawer-item:hover { background: #f5f5f5; }
.drawer-item .drawer-item-icon { font-size: 18px; width: 24px; text-align: center; }
.drawer-item.logout { color: var(--danger); border-top: 1px solid var(--border); margin-top: var(--space-2); }
.drawer-item.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.drawer-org-switcher {
  padding: var(--space-2) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--border);
}
.drawer-org-switcher select {
  width: 100%;
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--dark);
  appearance: auto;
  cursor: pointer;
}

/* ── Segmented Control ───────────────────────────────────── */
.segmented-control {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.segmented-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: #fafaf8;
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  color: var(--mid);
  transition: all 0.12s;
}
.segmented-btn.active {
  background: var(--orange);
  color: #fff;
}

/* ── Two-button toggle (sex, etc.) ───────────────────────── */
.toggle-group {
  display: flex;
  gap: var(--space-2);
}
.toggle-btn {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafaf8;
  font-family: var(--font-family);
  font-size: var(--text-md);
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  color: var(--mid);
  transition: all 0.12s;
}
.toggle-btn:active { opacity: 0.8; }
.toggle-btn.selected {
  border-color: var(--orange);
  background: #fff6f0;
  color: var(--orange);
}

/* ── Dog Row (roster) ────────────────────────────────────── */
.dog-row {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
}
.dog-row:active { transform: scale(0.98); box-shadow: none; }
.dog-row-wrap { position: relative; display: flex; align-items: flex-start; gap: 0; }

.dog-photo {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: #f0ebe4;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dog-photo img { width: 100%; height: 100%; object-fit: cover; }
.dog-photo-placeholder {
  font-size: 24px;
  opacity: 0.5;
}
.dog-info { flex: 1; min-width: 0; }
.dog-name {
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}
.dog-meta {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

/* ── List Header ─────────────────────────────────────────── */
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
}
.list-header .count {
  font-size: var(--text-sm);
  color: var(--light);
}
.list-header .add-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: var(--orange);
  color: #fff;
  border: none;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: var(--font-family);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}
.list-header .add-link:hover { opacity: 0.9; }

/* ── Inline filter input (roster) ─────────────────────────── */
.filter-input-inline {
  flex: 1;
  margin: 0 8px;
  padding: 8px 12px;
  border: 1.5px solid var(--border, #ddd);
  border-radius: 10px;
  font-family: var(--font-family);
  font-size: 14px;
  outline: none;
  background: #fafaf8;
  color: var(--dark);
  min-width: 0;
  box-sizing: border-box;
}
.filter-input-inline:focus {
  border-color: var(--orange, #e68a2e);
  box-shadow: 0 0 0 2px rgba(230, 138, 46, 0.15);
}

/* ── Publish dots (roster) ───────────────────────────────── */
.publish-dots {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e0d9d0;
}
.dot.live { background: var(--success); }
.dot.pending { background: var(--warn); }
.dot.failed { background: var(--danger); }

/* ── Content page title ──────────────────────────────────── */
.page-title {
  font-size: var(--text-xl);
  font-weight: 800;
  margin-bottom: var(--space-4);
  padding: 0 var(--space-4);
}

/* ── Section label (uppercase heading) ───────────────────── */
.section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-2) 0 var(--space-1);
}

/* ── Status badges ───────────────────────────────────────── */
.badge-planning { background: #f0f0f0; color: #555; }
.badge-confirmed { background: #d1fae5; color: #065f46; }
.badge-in-transit { background: #dbeafe; color: #1d4ed8; }
.badge-completed { background: #f0f0f0; color: #666; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-open { background: #f0f0f0; color: #555; }
.badge-available { background: #fff3e6; color: #b85e00; }
.badge-in_transit { background: #dbeafe; color: #1d4ed8; }

.status-open { background: #d1fae5; color: #065f46; }
.status-few-spots { background: #fffbeb; color: #92400e; }
.status-full { background: #fee2e2; color: #991b1b; }
.status-cancelled { background: #f0f0f0; color: #666; }
.status-planning { background: #f0f0f0; color: #555; }
.status-in-transit { background: #dbeafe; color: #1d4ed8; }
.status-completed { background: #f0f0f0; color: #666; }
.status-icon { font-size: 10px; }

/* ── Modal patterns ──────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200; align-items: flex-end; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-overlay.modal-overlay--center,
.review-modal-overlay {
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.modal-overlay.modal-overlay--center.open,
.review-modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 20px 20px 0 0; padding: 24px 20px 32px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal-overlay.modal-overlay--center .modal,
.modal.modal--center,
.review-modal {
  border-radius: 16px;
  padding: 24px;
  max-width: 420px;
  width: 90%;
  margin: auto;
  max-height: 85vh;
}
.modal-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 16px; }
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions button { flex: 1; padding: 12px; border-radius: 10px; font-weight: 600; font-size: 14px; cursor: pointer; border: none; font-family: var(--font-family); }
.modal-actions .btn-secondary { background: #f0ebe4; color: var(--dark); }
.modal-actions .btn-primary { background: var(--orange); color: #fff; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--mid); margin-bottom: 4px; }

/* ── Shared public link footer (/receive, /t) ─────────────── */
.wah-shared-footer {
  max-width: 480px;
  margin: 24px auto 32px;
  padding: 20px 20px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}
.wah-shared-footer .wah-wordmark {
  font-size: 15px;
  font-weight: 800;
  color: #F4622A;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.wah-shared-footer p {
  font-size: 13px;
  color: var(--mid);
  line-height: 1.55;
  margin: 0;
}

/* ── Timezone badge ───────────────────────── */
.tz-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #555;
  background: #eee;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
  text-transform: uppercase;
}

/* ── Breed Help Widget ── */
.breed-help-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--orange, #F4622A); cursor: pointer;
  margin-top: 6px; user-select: none;
}
.breed-help-link:hover { text-decoration: underline; }

.breed-help-panel {
  display: none; background: #fdfaf6; border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; margin-top: 12px;
}
.breed-help-panel.open { display: block; }

.breed-help-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.breed-help-title { font-size: 15px; font-weight: 700; color: var(--dark); }
.breed-help-close { font-size: 18px; cursor: pointer; color: var(--mid); }
.breed-help-close:hover { color: var(--dark); }

.breed-help-disclaimer {
  font-size: 11px; color: var(--mid); line-height: 1.5;
  padding: 10px 14px; background: #f9f7f3; border-radius: 8px;
  margin-bottom: 16px;
}
.breed-help-disclaimer strong { color: var(--dark); }

.breed-help-photo-area {
  text-align: center; margin-bottom: 16px;
}
.breed-help-photo {
  max-width: 200px; max-height: 200px; border-radius: 10px;
  object-fit: cover; border: 2px solid var(--border);
}

.breed-help-traits {
  font-size: 12px; color: var(--mid); margin-bottom: 16px;
  line-height: 1.6;
}
.breed-help-traits strong { color: var(--dark); }

.breed-help-mixed-banner {
  background: #fff6f0; border-radius: 8px; padding: 10px 14px;
  margin-bottom: 16px; font-size: 13px; color: var(--orange);
  display: flex; align-items: center; gap: 8px;
}

.breed-help-suggestion {
  padding: 12px 14px; margin-bottom: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.breed-help-suggestion:hover {
  border-color: var(--orange); box-shadow: 0 0 0 3px rgba(244,98,42,0.1);
}
.breed-help-suggestion.selected {
  border-color: var(--orange); background: #fff9f5;
}

.breed-help-name {
  font-size: 15px; font-weight: 700; color: var(--dark); margin-bottom: 6px;
}
.breed-help-justification {
  font-size: 12px; color: var(--mid); line-height: 1.5;
  font-style: italic;
}

.breed-help-actions {
  display: flex; gap: 10px; margin-top: 16px;
}
.breed-help-btn {
  padding: 10px 20px; border-radius: 8px; font-size: 13px;
  font-weight: 600; cursor: pointer; border: none;
  font-family: 'Inter', sans-serif;
}
.breed-help-btn-primary {
  background: var(--orange, #F4622A); color: #fff;
}
.breed-help-btn-primary:hover { opacity: 0.9; }
.breed-help-btn-secondary {
  background: #fff; color: var(--mid); border: 1px solid var(--border);
}
.breed-help-btn-secondary:hover { background: #f5f3f0; }

.breed-help-feedback {
  border-top: 1px solid var(--border);
  margin-top: 16px; padding-top: 12px;
  font-size: 11px; color: var(--mid);
}
.breed-help-feedback a { color: var(--orange); cursor: pointer; }
.breed-help-feedback a:hover { text-decoration: underline; }

.breed-help-loading {
  text-align: center; padding: 30px;
}
@keyframes breed-help-spin { to { transform: rotate(360deg); } }
.breed-help-spinner {
  width: 28px; height: 28px; border: 3px solid var(--border);
  border-top-color: var(--orange); border-radius: 50%;
  animation: breed-help-spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
.breed-help-loading-text { font-size: 13px; color: var(--mid); }

.breed-help-error {
  text-align: center; padding: 20px; color: #d43;
  font-size: 13px;
}

.breed-help-no-dog {
  text-align: center; padding: 20px; color: var(--mid);
  font-size: 13px; line-height: 1.5;
}
