:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #191c1a;
  --ink-soft: #6b7069;
  --line: #e8e6e0;
  --accent: #1f7a5c;
  --accent-soft: #e2f2ec;
  --danger: #d94f3d;
  --danger-soft: #fdeae7;
  --amber: #f5a623;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(20, 24, 22, 0.08);
  --tabbar-h: 68px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
    "Helvetica Neue", sans-serif;
  background: #dedcd6;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

/* ===== App shell (phone frame on desktop, full-bleed on mobile) ===== */
#app {
  position: relative;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.18);
}

@media (min-width: 520px) {
  #app {
    height: min(100dvh, 940px);
    margin-top: calc((100dvh - min(100dvh, 940px)) / 2);
    border-radius: 28px;
  }
}

/* ===== Top bar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 10px 14px 9px;
  background: rgba(246, 245, 242, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.topbar.search-hidden {
  padding-bottom: 8px;
}

.topbar.search-hidden .topbar-row {
  margin-bottom: 0;
}

.topbar.search-hidden .searchbar {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 16px;
  letter-spacing: -0.2px;
}

.location {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--ink-soft);
  padding: 0;
}

.location svg {
  width: 13px;
  height: 13px;
}

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  transition: transform 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.icon-btn .dot {
  position: absolute;
  top: 10px;
  right: 11px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid #fff;
}

/* Search bar */
.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  height: 44px;
  box-shadow: 0 2px 10px rgba(20, 24, 22, 0.05);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.searchbar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.searchbar > svg {
  width: 18px;
  height: 18px;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.searchbar input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  min-width: 0;
}

.searchbar input::-webkit-search-cancel-button {
  display: none;
}

.clear-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--line);
  display: none;
  place-items: center;
  flex-shrink: 0;
}

.clear-btn svg {
  width: 14px;
  height: 14px;
}

.searchbar.has-text .clear-btn {
  display: grid;
}

/* ===== Views ===== */
#views {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding-bottom: calc(var(--tabbar-h) + 24px);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Chips */
.chips {
  display: flex;
  gap: 8px;
  padding: 14px 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.18s ease;
}

.chip:active {
  transform: scale(0.94);
}

.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* Promo banner */
.promo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 16px 4px;
  padding: 16px 0 16px 18px;
  border-radius: var(--radius);
  background: linear-gradient(115deg, #124b39, #1f7a5c 60%, #2f9a76);
  color: #fff;
  overflow: hidden;
}

.promo-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 1;
}

.promo-copy strong {
  font-size: 16px;
}

.promo-copy span {
  font-size: 12.5px;
  opacity: 0.85;
}

.promo-btn {
  margin-top: 8px;
  align-self: flex-start;
  background: #fff;
  color: #124b39;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 999px;
  transition: transform 0.15s ease;
}

.promo-btn:active {
  transform: scale(0.94);
}

.promo img {
  width: 132px;
  height: 108px;
  object-fit: cover;
  border-radius: 14px 0 0 14px;
  margin-left: 8px;
  opacity: 0.95;
}

/* Section titles */
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 20px 16px 10px;
}

.section-title h2 {
  font-size: 17px;
  letter-spacing: -0.2px;
}

.count {
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* ===== Pet cards grid ===== */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px;
}

.pet-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(20, 24, 22, 0.06);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  animation: cardIn 0.3s ease both;
}

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

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.pet-photo {
  position: relative;
  height: 128px;
  display: grid;
  place-items: center;
  font-size: 52px;
  overflow: hidden;
}

.pet-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pet-photo .badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent);
}

.pet-photo .badge.sale {
  color: #a06008;
}

.pet-photo .photo-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(25, 28, 26, 0.68);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.pet-photo .photo-badge svg {
  width: 12px;
  height: 12px;
}

.heart-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  display: grid;
  place-items: center;
  transition: transform 0.15s ease;
}

.heart-btn:active {
  transform: scale(1.25);
}

.heart-btn svg {
  width: 15px;
  height: 15px;
  color: var(--ink-soft);
}

.heart-btn.saved svg {
  color: var(--danger);
  fill: var(--danger);
}

.pet-body {
  padding: 10px 12px 12px;
}

.pet-body h3 {
  font-size: 14.5px;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pet-body h3 svg {
  width: 13px;
  height: 13px;
  color: var(--accent);
  flex-shrink: 0;
}

.pet-body .sub {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.price {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
}

.dist {
  font-size: 11.5px;
  color: var(--ink-soft);
}

/* ===== Service list ===== */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px;
}

.service-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 2px 12px rgba(20, 24, 22, 0.06);
  transition: transform 0.15s ease;
  animation: cardIn 0.3s ease both;
}

.service-card:active {
  transform: scale(0.98);
}

.service-avatar {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 26px;
  flex-shrink: 0;
}

.service-info {
  flex: 1;
  min-width: 0;
}

.service-info h3 {
  font-size: 14.5px;
  letter-spacing: -0.2px;
}

.service-info .sub {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  font-size: 12px;
}

.rating {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
}

.rating svg {
  width: 12px;
  height: 12px;
  color: var(--amber);
  fill: var(--amber);
}

.service-price {
  color: var(--ink-soft);
}

.book-btn {
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  transition: transform 0.15s ease, background 0.2s ease;
}

.book-btn:active {
  transform: scale(0.93);
}

.book-btn.booked {
  background: var(--accent);
  color: #fff;
}

/* ===== Forms (Sell / Lost) ===== */
.sell-head {
  padding: 20px 16px 0;
}

.sell-head h2 {
  font-size: 20px;
  letter-spacing: -0.3px;
}

.sell-head p {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-top: 3px;
}

.segmented {
  display: flex;
  gap: 4px;
  margin: 14px 16px 0;
  background: #ecebe6;
  border-radius: 14px;
  padding: 4px;
}

.segment {
  flex: 1;
  padding: 9px 0;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: all 0.2s ease;
}

.segment.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(20, 24, 22, 0.08);
}

.app-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.card-form {
  margin: 0 16px 8px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: viewIn 0.25s ease;
}

.form-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-title strong {
  font-size: 15px;
}

.app-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.app-form label > span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.app-form input,
.app-form select,
.app-form textarea {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 13px;
  padding: 12px 14px;
  font-size: 14.5px;
  outline: none;
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-form input,
.card-form select,
.card-form textarea {
  background: var(--bg);
}

.app-form input:focus,
.app-form select:focus,
.app-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.app-form textarea {
  resize: none;
}

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

.photo-picker {
  cursor: pointer;
}

.photo-preview {
  position: relative;
  height: 120px;
  border: 1.5px dashed #cfcdc5;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  transition: border-color 0.2s ease;
}

.photo-preview:active {
  border-color: var(--accent);
}

.photo-preview.has-img {
  border-style: solid;
  border-color: var(--accent);
}

.photo-preview.has-img > * {
  display: none;
}

.photo-preview.is-loading {
  opacity: 0.72;
  pointer-events: none;
}

.photo-preview .photo-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex !important;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(25, 28, 26, 0.68);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.photo-preview .photo-count svg {
  width: 14px;
  height: 14px;
}

.photo-preview svg {
  width: 24px;
  height: 24px;
}

.photo-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: -6px;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}

.photo-thumb.cover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(31, 122, 92, 0.14);
}

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

.photo-remove {
  position: absolute;
  right: 3px;
  top: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(25, 28, 26, 0.72);
  color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.photo-remove svg {
  width: 13px;
  height: 13px;
}

.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  padding: 15px;
  border-radius: 16px;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.primary-btn:active {
  transform: scale(0.97);
}

.primary-btn.danger {
  background: var(--danger);
}

.primary-btn svg {
  width: 18px;
  height: 18px;
}

/* ===== Lost & Found ===== */
.lost-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px;
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(115deg, #7c2418, #b8402e 60%, #d94f3d);
  color: #fff;
}

.lost-hero h2 {
  font-size: 18px;
  letter-spacing: -0.2px;
}

.lost-hero p {
  font-size: 12.5px;
  opacity: 0.85;
  margin-top: 3px;
  max-width: 210px;
}

.report-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  color: #b8402e;
  font-weight: 700;
  font-size: 13px;
  padding: 11px 14px;
  border-radius: 999px;
  transition: transform 0.15s ease;
}

.report-btn:active {
  transform: scale(0.94);
}

.report-btn svg {
  width: 16px;
  height: 16px;
}

.lost-card {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 2px 12px rgba(20, 24, 22, 0.06);
  animation: cardIn 0.3s ease both;
}

.lost-card.found {
  opacity: 0.62;
}

.lost-photo {
  position: relative;
  width: 86px;
  height: 96px;
  border-radius: 14px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 36px;
  overflow: hidden;
}

.lost-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lost-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
}

.lost-tag.found-tag {
  background: var(--accent);
}

.lost-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.lost-info h3 {
  font-size: 15px;
  letter-spacing: -0.2px;
}

.lost-info .sub {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.lost-info .area {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.lost-info .area svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.reward-chip {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #a06008;
  background: #fdf3e0;
  padding: 4px 9px;
  border-radius: 999px;
}

.lost-actions {
  display: flex;
  gap: 8px;
  margin-top: 9px;
}

.lost-actions button {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  transition: transform 0.15s ease;
}

.lost-actions button:active {
  transform: scale(0.94);
}

.seen-btn {
  background: var(--danger-soft);
  color: var(--danger);
}

.found-btn {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Empty states */
.empty {
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  padding: 48px 24px;
}

/* ===== Tab bar ===== */
.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tabbar-h);
  display: flex;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: color 0.2s ease, transform 0.1s ease;
}

.tab:active {
  transform: scale(0.92);
}

.tab svg {
  width: 21px;
  height: 21px;
}

.tab.active {
  color: var(--accent);
}

.tab-sell .fab {
  width: 50px;
  height: 50px;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  margin-top: -22px;
  box-shadow: 0 8px 20px rgba(31, 122, 92, 0.4);
  transition: transform 0.15s ease;
}

.tab-sell:active .fab {
  transform: scale(0.9);
}

.tab-sell .fab svg {
  width: 24px;
  height: 24px;
}

.tab-sell.active .fab {
  background: var(--ink);
}

/* ===== Bottom sheet ===== */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 16, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 40;
}

.sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(105%);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.3, 1);
  z-index: 50;
  max-height: 82%;
  overflow-y: auto;
}

.sheet.open {
  transform: none;
}

.sheet-grab {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin: 4px auto 14px;
}

.sheet-photo {
  position: relative;
  height: 190px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 84px;
  overflow: hidden;
  margin-bottom: 16px;
}

.sheet-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sheet-gallery {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 64px;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin: -8px 0 16px;
  scrollbar-width: none;
}

.sheet-gallery::-webkit-scrollbar {
  display: none;
}

.sheet-thumb {
  height: 58px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid transparent;
  background: var(--surface);
}

.sheet-thumb.active {
  border-color: var(--accent);
}

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

.sheet-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sheet-topline h2 {
  font-size: 21px;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sheet-topline h2 svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.sheet-price {
  font-size: 19px;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}

.sheet-sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.sheet-desc {
  font-size: 14px;
  line-height: 1.55;
  color: #3c403d;
  margin-top: 12px;
}

.sheet-facts {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.fact {
  background: var(--bg);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink-soft);
}

.fact strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.sheet-actions .chat-btn {
  flex-shrink: 0;
  width: 52px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  transition: transform 0.15s ease;
}

.sheet-actions .chat-btn:active {
  transform: scale(0.93);
}

.sheet-actions .chat-btn svg {
  width: 20px;
  height: 20px;
}

.sheet-actions .primary-btn {
  flex: 1;
}

/* City picker (location sheet) */
.city-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.city-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  transition: transform 0.15s ease, background 0.2s ease;
}

.city-row:active {
  transform: scale(0.97);
}

.city-row.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.city-row.gps {
  border-style: dashed;
}

/* ===== Toast ===== */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 18px);
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
  z-index: 60;
  max-width: 86%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* =====================================================
   Polish layer — richer shades, springier motion
   ===================================================== */

/* Soft ambient color washes behind the whole app */
#app {
  background:
    radial-gradient(1100px 420px at 110% -8%, rgba(31, 122, 92, 0.08), transparent 62%),
    radial-gradient(820px 460px at -18% 112%, rgba(217, 79, 61, 0.06), transparent 60%),
    var(--bg);
}

/* Top bar gains depth once the feed scrolls under it */
.topbar {
  transition: box-shadow 0.3s ease;
}

.topbar.scrolled {
  box-shadow: 0 10px 28px -14px rgba(20, 24, 22, 0.28);
}

/* Springier view + card entrances (staggered via JS animation-delay) */
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.pet-card,
.service-card,
.lost-card {
  animation: cardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  box-shadow:
    0 1px 2px rgba(20, 24, 22, 0.04),
    0 12px 28px -14px rgba(20, 24, 22, 0.18);
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.28s ease;
}

@media (hover: hover) {
  .pet-card:hover,
  .service-card:hover,
  .lost-card:hover {
    transform: translateY(-3px);
    box-shadow:
      0 2px 4px rgba(20, 24, 22, 0.05),
      0 20px 40px -16px rgba(20, 24, 22, 0.3);
  }
}

.pet-card:active,
.service-card:active {
  transform: scale(0.97);
}

/* Pet emojis gently float */
.ph-emoji {
  display: block;
  animation: floaty 3.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.14));
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* Chips: gradient active state + springy press */
.chip {
  transition:
    transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.chip.active {
  background: linear-gradient(140deg, #2b312d, #14171a 75%);
  box-shadow: 0 6px 16px -6px rgba(20, 24, 22, 0.4);
}

/* Promo banner: periodic shine sweep */
.promo {
  position: relative;
  box-shadow: 0 14px 32px -14px rgba(18, 75, 57, 0.55);
}

.promo::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 32%,
    rgba(255, 255, 255, 0.16) 46%,
    rgba(255, 255, 255, 0.05) 52%,
    transparent 64%
  );
  transform: translateX(-130%);
  animation: shine 5.5s ease-in-out infinite;
}

@keyframes shine {
  0%,
  55% {
    transform: translateX(-130%);
  }
  85%,
  100% {
    transform: translateX(130%);
  }
}

/* Lost hero shares the deep shadow treatment */
.lost-hero {
  box-shadow: 0 14px 32px -14px rgba(124, 36, 24, 0.55);
}

.lost-tag {
  animation: tagPulse 1.6s ease-in-out infinite;
}

.lost-tag.found-tag {
  animation: none;
}

@keyframes tagPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Floating action button: gradient + breathing glow */
.tab-sell .fab {
  background: linear-gradient(145deg, #2f9a76, #1f7a5c 55%, #14563f);
  animation: fabGlow 3.2s ease-in-out infinite;
}

@keyframes fabGlow {
  0%,
  100% {
    box-shadow: 0 8px 20px rgba(31, 122, 92, 0.35);
  }
  50% {
    box-shadow: 0 12px 30px rgba(31, 122, 92, 0.6);
  }
}

/* Tabs: springy icon lift + indicator dot */
.tab {
  position: relative;
}

.tab svg {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tab.active svg {
  transform: translateY(-2px) scale(1.12);
}

.tab::after {
  content: "";
  position: absolute;
  bottom: 5px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tab.active::after {
  opacity: 1;
  transform: scale(1);
}

.tab-sell::after {
  display: none;
}

/* Heart pop when saving */
@keyframes heartPop {
  0% {
    transform: scale(0.5);
  }
  55% {
    transform: scale(1.4);
  }
  100% {
    transform: scale(1);
  }
}

.heart-btn.pop svg {
  animation: heartPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Book button smooth state change */
.book-btn {
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.3s ease,
    color 0.3s ease,
    box-shadow 0.3s ease;
}

.book-btn.booked {
  box-shadow: 0 6px 16px -6px rgba(31, 122, 92, 0.5);
}

/* Primary buttons: deep shadow + gradient sheen */
.primary-btn {
  background: linear-gradient(150deg, #2b302c, #14171a 70%);
  box-shadow: 0 10px 24px -10px rgba(20, 24, 22, 0.5);
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.25s ease;
}

.primary-btn.danger {
  background: linear-gradient(150deg, #e5654f, #c2412e 70%);
  box-shadow: 0 10px 24px -10px rgba(217, 79, 61, 0.55);
}

/* Bottom sheet: gentle overshoot + blurred backdrop */
.sheet {
  transition: transform 0.42s cubic-bezier(0.3, 1.18, 0.36, 1);
  box-shadow: 0 -18px 50px rgba(15, 18, 16, 0.22);
}

.sheet-backdrop {
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* Toast: springy pop-in */
.toast {
  transition:
    opacity 0.3s ease,
    transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Segmented control: smoother slide feel */
.segment {
  transition:
    background 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.2s ease;
}

.segment:active {
  transform: scale(0.96);
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =====================================================
   v3 — floating pill tab bar, chat, filters
   ===================================================== */

:root {
  --tabbar-h: 78px; /* pill (64) + bottom gap (14) */
}

/* Floating pill nav */
.tabbar {
  left: 14px;
  right: 14px;
  bottom: 14px;
  height: 64px;
  border-radius: 999px;
  border: 1px solid rgba(20, 24, 22, 0.06);
  border-top: 1px solid rgba(20, 24, 22, 0.06);
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    0 2px 6px rgba(20, 24, 22, 0.06),
    0 18px 40px -12px rgba(20, 24, 22, 0.35);
  padding: 6px;
  align-items: center;
}

.tab {
  height: 52px;
  border-radius: 999px;
  margin: 0 1px;
  transition:
    color 0.25s ease,
    background 0.3s ease,
    transform 0.1s ease;
}

.tab.active {
  background: var(--accent-soft);
}

.tab::after {
  display: none; /* pill highlight replaces the indicator dot */
}

.tab-sell .fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin-top: 0;
}

#views {
  padding-bottom: calc(var(--tabbar-h) + 34px);
}

.toast {
  bottom: calc(var(--tabbar-h) + 16px);
}

/* Unread badge on the Chat tab */
.tab-badge {
  position: absolute;
  top: 6px;
  right: 22%;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  animation: badgeIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badgeIn {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

/* ===== Filter row (radius + sort) ===== */
.filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-label {
  flex-shrink: 0;
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  margin-right: 2px;
}

.filter-label svg {
  width: 15px;
  height: 15px;
}

.filter-chip {
  flex-shrink: 0;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.filter-chip:active {
  transform: scale(0.93);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(31, 122, 92, 0.5);
}

.filter-divider {
  flex-shrink: 0;
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 4px;
}

/* ===== Chat list ===== */
.chat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 13px;
  box-shadow:
    0 1px 2px rgba(20, 24, 22, 0.04),
    0 12px 28px -14px rgba(20, 24, 22, 0.18);
  animation: cardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: transform 0.2s ease;
  cursor: pointer;
}

.chat-card:active {
  transform: scale(0.98);
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--bg);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}

.chat-info {
  flex: 1;
  min-width: 0;
}

.chat-info h3 {
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-info .sub {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-info .preview {
  color: #4a4f4b;
}

.unread-dot {
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
}

.pill {
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.pill-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill-pending {
  background: #fdf3e0;
  color: #a06008;
}

/* ===== Chat thread ===== */
.thread-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(246, 245, 242, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.thread-avatar {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 19px;
}

.thread-title {
  flex: 1;
  min-width: 0;
  line-height: 1.2;
}

.thread-title strong {
  font-size: 14.5px;
  display: block;
}

.thread-title small {
  font-size: 11.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.msgs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 76px;
}

.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
  animation: cardIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
  position: relative;
  word-wrap: break-word;
}

.msg time {
  display: block;
  font-size: 10px;
  opacity: 0.65;
  margin-top: 3px;
  text-align: right;
}

.msg.me {
  align-self: flex-end;
  background: linear-gradient(150deg, #2f9a76, #1f7a5c 70%);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 6px 16px -8px rgba(31, 122, 92, 0.6);
}

.msg.them {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}

.msg.sys {
  align-self: center;
  max-width: 92%;
  background: #eceae4;
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
  padding: 7px 14px;
  border-radius: 999px;
}

/* Composer floats above the pill bar */
.chat-composer {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(var(--tabbar-h) + 8px);
  display: flex;
  gap: 8px;
  z-index: 25;
  animation: viewIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-composer input {
  flex: 1;
  height: 48px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 0 18px;
  font-size: 14.5px;
  outline: none;
  box-shadow: 0 10px 26px -12px rgba(20, 24, 22, 0.35);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-composer input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chat-composer input:disabled {
  opacity: 0.65;
}

.chat-composer button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2f9a76, #1f7a5c 60%);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 10px 22px -8px rgba(31, 122, 92, 0.6);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-composer button:active {
  transform: scale(0.9);
}

.chat-composer button:disabled {
  opacity: 0.55;
}

.chat-composer button svg {
  width: 19px;
  height: 19px;
}

/* Requested (pending) state on service Book buttons */
.book-btn.requested {
  background: #fdf3e0;
  color: #a06008;
  opacity: 1;
}

/* =====================================================
   v4 — brand splash, photo blur-up, shimmer
   ===================================================== */

.brand-mark img {
  width: 26px;
  height: 26px;
}

/* Splash */
#splash {
  position: absolute;
  inset: 0;
  z-index: 100;
  background:
    radial-gradient(700px 420px at 50% -10%, rgba(31, 122, 92, 0.1), transparent 65%),
    linear-gradient(165deg, #f8f7f4, #eaf3ee);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease, transform 0.5s ease;
}

#splash.hide {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.04);
  pointer-events: none;
}

.splash-logo {
  position: relative;
  width: 116px;
  height: 116px;
  animation: splashLogoIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes splashLogoIn {
  from {
    opacity: 0;
    transform: scale(0.55) translateY(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.splash-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 20px 34px rgba(18, 75, 57, 0.35));
}

.sp-toe,
.sp-pad {
  transform-box: fill-box;
  transform-origin: center;
}

.sp-toe {
  animation: toePop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.sp-toe-1 { animation-delay: 0.3s; }
.sp-toe-2 { animation-delay: 0.42s; }
.sp-toe-3 { animation-delay: 0.54s; }
.sp-toe-4 { animation-delay: 0.66s; }

@keyframes toePop {
  from {
    opacity: 0;
    transform: scale(0);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.sp-pad {
  animation: padRise 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.78s both;
}

@keyframes padRise {
  from {
    opacity: 0;
    transform: translateY(46px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.splash-ring {
  position: absolute;
  inset: -16px;
  border: 3px solid rgba(31, 122, 92, 0.35);
  border-radius: 40px;
  animation: ringPulse 1.7s ease-out 1.1s infinite;
  opacity: 0;
}

@keyframes ringPulse {
  0% {
    transform: scale(0.88);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    transform: scale(1.28);
    opacity: 0;
  }
}

.splash-name {
  margin-top: 24px;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.6px;
  animation: fadeUp 0.5s ease 0.95s both;
}

.splash-name span {
  color: var(--accent);
}

.splash-tag {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 6px;
  animation: fadeUp 0.5s ease 1.1s both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Photo blur-up: shimmer placeholder only while an image is loading */
.pet-photo:has(img:not(.loaded)),
.lost-photo:has(img:not(.loaded)),
.sheet-photo:has(img:not(.loaded)) {
  background: linear-gradient(110deg, #ecebe6 8%, #f7f6f2 22%, #ecebe6 38%);
  background-size: 220% 100%;
  animation: shimmerBg 1.3s linear infinite;
}

@keyframes shimmerBg {
  to {
    background-position: -220% 0;
  }
}

.pet-photo img,
.lost-photo img,
.sheet-photo img {
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.5s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.pet-photo img.loaded,
.lost-photo img.loaded,
.sheet-photo img.loaded {
  opacity: 1;
  transform: none;
}

/* =====================================================
   v5 — top bar redesign, drawer, full-screen chat, desktop
   ===================================================== */

/* --- Top bar: brand opens the drawer, location is a pill --- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  margin-left: -4px;
  border-radius: 14px;
  transition: background 0.2s ease, transform 0.15s ease;
}

.brand:active {
  transform: scale(0.96);
  background: rgba(20, 24, 22, 0.05);
}

.brand-name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.brand-name svg {
  width: 15px;
  height: 15px;
  color: var(--ink-soft);
}

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

.loc-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 11px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  max-width: 150px;
  transition: transform 0.15s ease, border-color 0.2s ease;
}

.loc-pill:active {
  transform: scale(0.95);
}

.loc-pill svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

.loc-pill span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Drawer --- */
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 16, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  z-index: 70;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(310px, 86%);
  background: var(--surface);
  z-index: 80;
  display: flex;
  flex-direction: column;
  border-radius: 0 26px 26px 0;
  box-shadow: 30px 0 70px -30px rgba(15, 18, 16, 0.45);
  transform: translateX(-105%);
  transition: transform 0.34s cubic-bezier(0.3, 1.1, 0.35, 1);
  padding: 18px 14px calc(16px + env(safe-area-inset-bottom));
}

.drawer.open {
  transform: none;
}

.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 14px;
  border-bottom: 1px solid var(--line);
}

.drawer-logo {
  width: 42px;
  height: 42px;
  border-radius: 13px;
}

.drawer-brand {
  flex: 1;
  line-height: 1.2;
}

.drawer-brand strong {
  font-size: 16px;
  letter-spacing: -0.3px;
  display: block;
}

.drawer-brand small {
  font-size: 11px;
  color: var(--ink-soft);
}

.drawer-user {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 14px 2px 6px;
  padding: 12px;
  border-radius: 16px;
  background: var(--bg);
}

.drawer-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.drawer-user div {
  flex: 1;
  line-height: 1.25;
}

.drawer-user strong {
  font-size: 14px;
  display: block;
}

.drawer-user small {
  font-size: 11.5px;
  color: var(--ink-soft);
}

.drawer-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  overflow-y: auto;
}

.drawer-menu button {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 12px;
  border-radius: 14px;
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  transition: background 0.2s ease, transform 0.15s ease;
}

.drawer-menu button:active {
  transform: scale(0.97);
  background: var(--accent-soft);
}

.drawer-menu button svg {
  width: 19px;
  height: 19px;
  color: var(--accent);
  flex-shrink: 0;
}

.drawer-menu button span:first-of-type {
  flex: 1;
}

.menu-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.drawer-sep {
  height: 1px;
  background: var(--line);
  margin: 8px 12px;
}

.drawer-foot {
  border-top: 1px solid var(--line);
  padding: 13px 8px 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.drawer-foot span {
  font-size: 12.5px;
}

.drawer-foot small {
  font-size: 11px;
  color: var(--ink-soft);
}

/* --- Full-screen chat thread --- */
#app.chat-full .topbar,
#app.chat-full .tabbar {
  display: none;
}

#app.chat-full #views {
  padding-bottom: 84px;
}

#app.chat-full .chat-composer {
  bottom: calc(12px + env(safe-area-inset-bottom));
}

#app.chat-full .thread-head {
  padding-top: max(14px, env(safe-area-inset-top));
}

/* --- Thread head extras --- */
.presence {
  display: flex;
  align-items: center;
  gap: 5px;
}

.presence-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #35c789;
  box-shadow: 0 0 0 3px rgba(53, 199, 137, 0.2);
  flex-shrink: 0;
}

.presence-dot.off {
  background: #c9c6be;
  box-shadow: none;
}

/* --- Kind-tinted avatars --- */
.kind-buy { background: #fdf3e0 !important; }
.kind-adopt { background: var(--accent-soft) !important; }
.kind-service { background: #e4e9ff !important; }
.kind-lost { background: var(--danger-soft) !important; }

/* --- Chat list refinements --- */
.chat-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.chat-time {
  font-size: 11px;
  color: var(--ink-soft);
  flex-shrink: 0;
}

/* --- Ticks, typing, photo messages --- */
.ticks {
  font-size: 10px;
  letter-spacing: -1.5px;
  opacity: 0.75;
  margin-left: 4px;
}

.ticks.read {
  color: #7df0c0;
  opacity: 1;
}

.msg.them .ticks,
.preview .ticks {
  color: var(--accent);
}

.msg.typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 14px 16px;
  width: 64px;
}

.msg.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b9beb8;
  animation: typingDot 1.1s ease-in-out infinite;
}

.msg.typing span:nth-child(2) { animation-delay: 0.18s; }
.msg.typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.msg-img {
  display: block;
  max-width: 210px;
  border-radius: 12px;
  margin: -3px -6px 3px;
}

.msg.sys.lock {
  background: #fdf6e3;
  color: #8a6d1a;
}

/* --- Composer upgrades --- */
.comp-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 10px 26px -12px rgba(20, 24, 22, 0.35);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.comp-btn:active {
  transform: scale(0.9);
}

.comp-btn:disabled {
  opacity: 0.55;
}

.comp-btn svg {
  width: 19px;
  height: 19px;
  color: var(--accent);
}

.composer-box {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

.composer-box input {
  padding-right: 46px;
  width: 100%;
}

.comp-emoji {
  margin-left: -42px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 17px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1;
}

.comp-emoji:active {
  transform: scale(1.25);
}

.emoji-strip {
  position: absolute;
  bottom: 58px;
  left: 0;
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  box-shadow: 0 14px 34px -14px rgba(20, 24, 22, 0.4);
  animation: viewIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.emoji-strip button {
  font-size: 19px;
  padding: 4px 6px;
  border-radius: 10px;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.emoji-strip button:active {
  transform: scale(1.4);
}

/* =====================================================
   Desktop / large screens — true full-screen layout
   ===================================================== */
@media (min-width: 760px) {
  #app {
    max-width: none;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .topbar {
    padding: 10px 28px 9px;
  }

  .topbar-row,
  .searchbar {
    max-width: 1080px;
    margin-left: auto;
    margin-right: auto;
  }

  .topbar-row {
    margin-bottom: 8px;
  }

  .view {
    max-width: 1112px;
    margin: 0 auto;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 16px;
  }

  .pet-photo {
    height: 168px;
  }

  .list {
    max-width: 860px;
    margin: 0 auto;
    width: 100%;
  }

  .section-title,
  .chips,
  .filter-row {
    padding-left: 16px;
    padding-right: 16px;
  }

  .tabbar {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 540px;
  }

  .chat-composer {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(760px, calc(100% - 28px));
  }

  .msgs {
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
  }

  .thread-head {
    padding-left: max(16px, calc((100% - 760px) / 2));
    padding-right: max(16px, calc((100% - 760px) / 2));
  }

  .sheet {
    left: 50%;
    right: auto;
    transform: translate(-50%, 105%);
    width: min(560px, 100%);
    border-radius: 26px 26px 0 0;
  }

  .sheet.open {
    transform: translate(-50%, 0);
  }

  .toast {
    bottom: calc(var(--tabbar-h) + 18px);
  }
}

/* =====================================================
   v6 — compact chips row: filter dialog + More sheet
   ===================================================== */

.filter-btn {
  position: relative;
  width: 42px;
  display: grid;
  place-items: center;
  padding: 9px 0;
}

.filter-btn svg {
  width: 16px;
  height: 16px;
}

.filter-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg);
  animation: badgeIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.more-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-weight: 600;
}

.more-chip svg {
  width: 14px;
  height: 14px;
}

/* Filter dialog groups */
.sheet-group {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-top: 18px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.filter-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.sheet .filter-chip {
  padding: 10px 16px;
  font-size: 13.5px;
}

/* "More" category grid */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0 8px;
}

.cat-grid .city-row {
  justify-content: flex-start;
}

/* =====================================================
   v7 — Messages screen polish
   ===================================================== */

#chat-head {
  padding: 20px 16px 4px;
}

.chat-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-title-row h2 {
  font-size: 22px;
  letter-spacing: -0.4px;
}

.enc-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.enc-badge svg {
  width: 12px;
  height: 12px;
}

.chat-tabs {
  margin: 14px 0 12px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 44px 32px 24px;
  animation: viewIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.empty-art {
  position: relative;
  height: 120px;
  max-width: 240px;
  margin: 0 auto;
}

.empty-bubble {
  position: absolute;
  width: 62px;
  height: 62px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow:
    0 2px 4px rgba(20, 24, 22, 0.05),
    0 16px 32px -14px rgba(20, 24, 22, 0.25);
  display: grid;
  place-items: center;
  font-size: 27px;
  animation: floaty 3.6s ease-in-out infinite;
}

.empty-bubble.b1 {
  left: 12px;
  top: 34px;
  transform: rotate(-8deg);
}

.empty-bubble.b2 {
  left: 50%;
  margin-left: -31px;
  top: 4px;
  width: 72px;
  height: 72px;
  border-radius: 26px;
  font-size: 32px;
  background: linear-gradient(145deg, #2f9a76, #1f7a5c 70%);
  box-shadow: 0 18px 36px -12px rgba(31, 122, 92, 0.55);
  animation-delay: 0.5s;
  z-index: 1;
}

.empty-bubble.b3 {
  right: 12px;
  top: 44px;
  transform: rotate(8deg);
  animation-delay: 1s;
}

.empty-state h3 {
  font-size: 17.5px;
  letter-spacing: -0.3px;
  margin-top: 20px;
}

.empty-state p {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 8px auto 0;
  max-width: 300px;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.empty-actions button {
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(20, 24, 22, 0.06);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease;
}

.empty-actions button:active {
  transform: scale(0.94);
  border-color: var(--accent);
}

/* =====================================================
   Mobile gesture polish
   ===================================================== */

.brand-name {
  gap: 0;
}

.loc-pill {
  justify-content: center;
  min-width: 112px;
}

#views {
  touch-action: pan-y;
}

#views.swiping {
  transition: transform 0.12s ease-out;
  transform: translateX(calc(var(--swipe-x, 0px) * 0.18));
}

@keyframes slideFromRight {
  from {
    opacity: 0;
    transform: translateX(42px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slideFromLeft {
  from {
    opacity: 0;
    transform: translateX(-42px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

#views.page-slide-left .view.active {
  animation: slideFromRight 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#views.page-slide-right .view.active {
  animation: slideFromLeft 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pet-card,
.service-card,
.lost-card,
.chat-card {
  will-change: transform;
}

.pressable {
  position: relative;
  overflow: hidden;
}

.is-pressing {
  transform: scale(0.965) translateY(1px) !important;
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.swipe-hint {
  transform: translateX(var(--card-drag-x, 0px)) rotate(calc(var(--card-drag-x, 0px) * 0.015deg)) !important;
  transition: none !important;
}

.tap-ripple {
  position: absolute;
  width: 18px;
  height: 18px;
  left: var(--tap-x, 50%);
  top: var(--tap-y, 50%);
  margin-left: -9px;
  margin-top: -9px;
  border-radius: 50%;
  pointer-events: none;
  background: rgba(31, 122, 92, 0.18);
  animation: tapRipple 0.48s ease-out forwards;
}

@keyframes tapRipple {
  to {
    opacity: 0;
    transform: scale(14);
  }
}

/* Bottom nav: four tabs with a soft glass selection mark */
.tabbar {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.64);
  border-color: rgba(255, 255, 255, 0.74);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 18px 44px -14px rgba(20, 24, 22, 0.32);
}

.tab {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: rgba(25, 28, 26, 0.62);
}

.tab::before {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: -1;
  border-radius: 999px;
  opacity: 0;
  transform: scale(0.88);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(226, 242, 236, 0.52)),
    rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.86);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(31, 122, 92, 0.08),
    0 8px 22px -12px rgba(31, 122, 92, 0.55);
  transition:
    opacity 0.26s ease,
    transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tab.active {
  background: transparent;
  color: var(--accent);
}

.tab.active::before {
  opacity: 1;
  transform: scale(1);
}
