:root {
  --bg:       #f6f4ec;
  --card:     #fffdf5;
  --line:     #d7cfb7;
  --ink:      #1d1b18;
  --accent:   #d9732f;
  --accent-2: #4caf82;
  --warn:     #f0a500;
  --danger:   #e05252;
  --muted:    #8a7f6e;
}

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

body {
  font-family: "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 10%, #fff6d6 0%, var(--bg) 36%, #efe9d5 100%);
  min-height: 100vh;
}

/* ── Nav ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,253,245,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  height: 52px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  text-decoration: none;
  margin-right: 0.5rem;
  white-space: nowrap;
}
.nav-logo img { width: 22px; height: 22px; }

.nav-tabs {
  display: flex;
  gap: 0.2rem;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-tab:hover { background: #f0ece0; color: var(--ink); }
.nav-tab.active { background: var(--accent); color: #fff; }

.nav-auth {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-user {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Buttons ── */
button, .btn {
  font: inherit;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
button:hover { filter: brightness(0.93); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1.2rem;
}
.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  padding: 0.55rem 1.1rem;
}
.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}
.btn-ghost {
  background: #f0ece0;
  color: var(--ink);
  padding: 0.5rem 1rem;
}

/* ── Hero ── */
.hero {
  display: flex;
  align-items: center;
  gap: 2rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
}
.hero-text { flex: 1; }
.hero-text h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.25;
  color: var(--ink);
}
.hero-text h1 span { color: var(--accent); }
.hero-text p {
  margin: 0.8rem 0 1.4rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}
.hero-ctas { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.hero-img {
  flex: 0 0 340px;
  text-align: center;
}
.hero-img img { width: 100%; max-width: 320px; }

/* ── Section layout ── */
.section {
  max-width: 1100px;
  margin: 0 auto 2rem;
  padding: 0 1rem;
}
.section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.section-header img { width: 22px; height: 22px; opacity: 0.7; }
.section-header h2 { font-size: 1.2rem; }
.section-badge {
  font-size: 0.7rem;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  margin-left: 0.3rem;
}

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.2rem;
  box-shadow: 0 6px 18px rgba(90,70,20,0.07);
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(90,70,20,0.12); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }

/* ── AI section ── */
.ai-wrap {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.ai-form-col { flex: 1; }
.ai-img-col {
  flex: 0 0 220px;
  text-align: center;
  padding-top: 0.5rem;
}
.ai-img-col img { width: 100%; max-width: 200px; }

.pet-type-btns { display: flex; gap: 0.4rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.pet-type-btn {
  background: #f0ece0;
  color: var(--ink);
  border: 1.5px solid transparent;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
}
.pet-type-btn.active {
  border-color: var(--accent);
  background: #fff3ea;
  color: var(--accent);
}

/* Severity cards */
.severity-card {
  border-radius: 10px;
  padding: 1rem;
  margin-top: 1rem;
  border-left: 4px solid;
}
.severity-green  { background: #f0faf5; border-color: var(--accent-2); }
.severity-yellow { background: #fffbf0; border-color: var(--warn); }
.severity-red    { background: #fff5f5; border-color: var(--danger); }

.severity-label {
  font-weight: 700;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.severity-advice { line-height: 1.6; white-space: pre-wrap; }
.severity-disclaimer {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Service section ── */
.service-wrap {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.service-main { flex: 1; }
.service-img-col {
  flex: 0 0 240px;
  text-align: center;
}
.service-img-col img { width: 100%; max-width: 220px; }

.sub-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
}
.sub-tab {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.3rem 0.8rem;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
}
.sub-tab.active { background: var(--accent); color: #fff; }

.filter-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}
.filter-row select, .filter-row input {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.provider-card, .request-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem;
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}
.provider-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 1.1rem;
}
.provider-info { flex: 1; }
.provider-name { font-weight: 600; font-size: 0.95rem; }
.provider-meta { font-size: 0.82rem; color: var(--muted); margin-top: 0.2rem; }
.provider-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.4rem; }
.tag {
  font-size: 0.75rem;
  background: #f0ece0;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  color: var(--muted);
}

/* ── Forms ── */
.stack { display: flex; flex-direction: column; gap: 0.55rem; }
input, textarea, select {
  font: inherit;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { min-height: 72px; resize: vertical; }
.form-row { display: flex; gap: 0.5rem; }
.form-row input, .form-row select { flex: 1; }

/* ── Posts ── */
.post-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem;
  background: #fffdf9;
}
.post-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.3rem; }
.post-content { line-height: 1.55; }
.post-actions { margin-top: 0.5rem; display: flex; gap: 0.4rem; align-items: center; }
.like-count { font-size: 0.85rem; color: var(--muted); }

.comments { margin-top: 0.5rem; padding: 0.5rem; border-radius: 6px; border: 1px solid var(--line); background: #faf6e9; }
.comment-row { font-size: 0.85rem; padding: 0.2rem 0; border-bottom: 1px solid #ede9d8; }
.comment-row:last-child { border-bottom: none; }
.comment-form { margin-top: 0.4rem; display: flex; gap: 0.4rem; }
.comment-form input { flex: 1; font-size: 0.85rem; padding: 0.35rem 0.6rem; }

/* ── Pet modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--card);
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-box h3 { margin-bottom: 1rem; font-size: 1.1rem; }
.modal-footer { margin-top: 1rem; display: flex; gap: 0.5rem; justify-content: flex-end; }

/* ── Auth modal ── */
.auth-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
  padding: 1rem;
}
.auth-modal.hidden { display: none; }
.auth-box {
  background: var(--card);
  border-radius: 16px;
  padding: 1.8rem;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.auth-box h3 { margin-bottom: 0.3rem; }
.auth-box p { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
.auth-toggle { margin-top: 0.8rem; font-size: 0.85rem; text-align: center; color: var(--muted); }
.auth-toggle button { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.85rem; }

/* ── Messages float ── */
.msg-float {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  z-index: 150;
}
.msg-toggle {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(217,115,47,0.4);
}
.msg-toggle img { width: 22px; height: 22px; filter: invert(1); }
.msg-panel {
  position: absolute;
  bottom: 60px; right: 0;
  width: 300px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  overflow: hidden;
}
.msg-panel.hidden { display: none; }
.msg-panel-header { padding: 0.7rem 1rem; background: var(--accent); color: #fff; font-weight: 600; font-size: 0.9rem; }
.msg-panel-body { padding: 0.8rem; }
.msg-list { max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.6rem; }
.msg-item { font-size: 0.82rem; padding: 0.3rem; border-radius: 4px; background: #f5f0e4; }
.msg-item.mine { background: #fff3ea; text-align: right; }

/* ── List utils ── */
.list { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.6rem; }
.empty { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 1rem 0; }

/* ── Divider ── */
.section-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1.5rem 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .hero { flex-direction: column; padding: 1.5rem 1rem 1rem; gap: 1rem; }
  .hero-img { display: none; }
  .ai-wrap { flex-direction: column; }
  .ai-img-col { display: none; }
  .service-wrap { flex-direction: column; }
  .service-img-col { display: none; }
  .nav-tab { font-size: 0.8rem; padding: 0.3rem 0.5rem; }
}
