:root {
  --blue: #1677ff;
  --blue-deep: #0f5fe0;
  --ink: #1c2430;
  --muted: #6d7785;
  --line: #e6ebf2;
  --bg: #f3f6fa;
  --card: #ffffff;
  --sell: #e85d04;
  --sell-bg: #fff1e8;
  --buy: #0f7b4c;
  --buy-bg: #e7f6ee;
  --car: #0b6bcb;
  --car-bg: #e8f2fc;
  --room: #6941c6;
  --room-bg: #f3edff;
  --badge: #d46b08;
  --badge-bg: #fff6e8;
  --font: "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Droid Sans Fallback", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-max: 480px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #d5e0ec;
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button, select, input { font-family: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

.app {
  width: min(var(--app-max), 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 0 1px rgba(16, 40, 72, 0.06);
}

.top {
  background: linear-gradient(180deg, var(--blue-deep), var(--blue));
  color: #fff;
  padding: calc(12px + var(--safe-top)) 16px 0;
  position: sticky;
  top: 0;
  z-index: 5;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  font-size: 20px;
  font-weight: 760;
  letter-spacing: 0.02em;
}

.sub {
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.85;
  line-height: 1.35;
}

.wx-btn {
  border: 0;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 999px;
  min-height: 40px;
  min-width: 56px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 650;
  flex-shrink: 0;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 0 10px;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

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

.tab {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.tab.active {
  background: #fff;
  color: var(--blue);
  font-weight: 720;
}

.filters {
  margin: -2px 12px 0;
  background: #fff;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(22, 60, 110, 0.06);
  position: relative;
  z-index: 4;
}

.date-chips {
  margin-top: 0;
  margin-bottom: 2px;
}

.date-picker-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
  border: 0;
}

.more-date-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}

.more-date-menu button {
  border: 0;
  background: #eef3fa;
  color: #2f3a4a;
  border-radius: 999px;
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.selects {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selects:empty {
  display: none;
}

.selects select {
  appearance: none;
  border: 0;
  background: #f2f5f9 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236d7785' d='M1 1l5 5 5-5'/></svg>") no-repeat right 10px center;
  color: var(--ink);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 28px 0 12px;
  font-size: 14px;
  max-width: 100%;
  flex: 1 1 140px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 10px;
  scrollbar-width: none;
}

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

.chip {
  border: 0;
  background: #f2f5f9;
  color: #3c4654;
  border-radius: 999px;
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.chip.active {
  background: var(--blue);
  color: #fff;
  font-weight: 680;
}

.count {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  min-height: 16px;
}

main {
  padding: 8px 12px calc(32px + var(--safe-bottom));
}

.day {
  margin: 12px 2px 8px;
  font-size: 14px;
  font-weight: 760;
}

.day-link {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
}

.day-link:active,
.day-link:hover {
  color: var(--blue);
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.card {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: var(--card);
  border-radius: 14px;
  padding: 12px 12px 11px;
  margin-bottom: 0;
  box-shadow: 0 6px 18px rgba(28, 39, 59, 0.05);
  color: inherit;
  cursor: pointer;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 720;
}

.tag-sell { color: var(--sell); background: var(--sell-bg); }
.tag-buy { color: var(--buy); background: var(--buy-bg); }
.tag-car { color: var(--car); background: var(--car-bg); }
.tag-room { color: var(--room); background: var(--room-bg); }

.badge {
  color: var(--badge);
  background: var(--badge-bg);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

.card h3 {
  margin: 8px 0 0;
  font-size: 17px;
  line-height: 1.35;
}

.summary {
  margin: 6px 0 0;
  color: #3d4654;
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  margin-top: 8px;
}

.price {
  color: var(--sell);
  font-size: 16px;
  font-weight: 780;
}

.price.pending { color: var(--muted); font-size: 14px; font-weight: 650; }

.qty, .meetup {
  color: #3d4654;
  font-size: 13px;
}

.meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.empty, .error, .loading {
  background: #fff;
  border-radius: 14px;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  margin-top: 12px;
}

.empty h2, .error h2 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 16px;
}

.empty p, .error p { margin: 0; font-size: 13px; line-height: 1.5; }

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

.primary, .ghost {
  border-radius: 999px;
  min-height: 44px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 680;
}

.primary {
  border: 0;
  background: var(--blue);
  color: #fff;
}

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.skel {
  height: 92px;
  border-radius: 14px;
  margin-top: 10px;
  background: linear-gradient(90deg, #e8edf3 25%, #f7f9fb 37%, #e8edf3 63%);
  background-size: 400% 100%;
  animation: shine 1.2s ease infinite;
}

@keyframes shine {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 28, 42, 0.45);
  z-index: 20;
}

.drawer, .sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(var(--app-max), 100%);
  background: #fff;
  border-radius: 18px 18px 0 0;
  z-index: 21;
  max-height: min(82vh, 720px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px calc(24px + var(--safe-bottom));
}

.grab {
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: #d5dbe3;
  margin: 6px auto 10px;
}

.drawer h2, .sheet h2 {
  margin: 0;
  font-size: 18px;
}

.drawer .route {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 720;
}

.block { margin-top: 12px; }
.block .k {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.contact-row, .peer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.peer {
  align-items: flex-start;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.peer p { margin: 4px 0 0; font-size: 13px; line-height: 1.45; }

.reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.reasons span {
  background: #f3f6fa;
  color: #3c4654;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}

.score { color: var(--muted); font-size: 12px; white-space: nowrap; }

.copy {
  border: 0;
  background: var(--blue);
  color: #fff;
  border-radius: 999px;
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

.sheet p { color: #3d4654; font-size: 13px; line-height: 1.55; }
.sheet .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  background: #1c2430;
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  z-index: 30;
  max-width: calc(100vw - 32px);
}

.hidden { display: none !important; }

/* Phone / small H5: full bleed single column */
@media (max-width: 520px) {
  body { background: var(--bg); }
  .app { width: 100%; box-shadow: none; }
  .drawer, .sheet { width: 100%; }
  .brand { font-size: 18px; }
  .selects select { flex: 1 1 calc(50% - 8px); font-size: 13px; }
}

/* Narrow phones */
@media (max-width: 380px) {
  .top { padding-left: 12px; padding-right: 12px; }
  .filters { margin-left: 8px; margin-right: 8px; padding: 10px; }
  main { padding-left: 8px; padding-right: 8px; }
  .tab { padding: 0 12px; font-size: 13px; min-height: 38px; }
  .card h3 { font-size: 16px; }
}

/* Tablet / desktop: wider canvas, optional 2-col cards */
@media (min-width: 768px) {
  :root { --app-max: 720px; }
  .card-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .brand { font-size: 22px; }
  .sub { font-size: 13px; }
}

@media (min-width: 1100px) {
  :root { --app-max: 960px; }
  body {
    background:
      radial-gradient(1200px 420px at 50% -80px, rgba(22, 119, 255, 0.18), transparent 60%),
      #cfd9e6;
  }
  .app {
    border-radius: 0 0 18px 18px;
    min-height: calc(100vh - 0px);
  }
  .card-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .filters {
    margin-left: 16px;
    margin-right: 16px;
  }
  main { padding-left: 16px; padding-right: 16px; }
  .drawer, .sheet {
    width: min(560px, 100%);
    border-radius: 18px;
    bottom: 24px;
    max-height: min(78vh, 760px);
    box-shadow: 0 18px 48px rgba(16, 30, 50, 0.22);
  }
}
