:root {
  --bg: #0d111a;
  --surface: #131a27;
  --surface-2: #1b2537;
  --line: #293548;
  --text: #ebf1ff;
  --muted: #96a4ba;
  --accent: #46de9f;
  --accent-2: #35b7ff;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, #1f2f4f 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, #144c43 0%, transparent 35%),
    var(--bg);
  min-height: 100vh;
}

.app-shell {
  max-width: 860px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 14px calc(env(safe-area-inset-bottom) + 16px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 4px 8px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 2px 0 0;
  font-size: 27px;
}

h2 {
  margin: 0;
  font-size: 20px;
}

.content {
  flex: 1;
  padding-bottom: 14px;
}

.view {
  display: none;
  animation: rise 0.22s ease;
}

.view.active {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-wrap {
  margin: 8px 0 12px;
}

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

input,
textarea,
select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  border-color: var(--accent);
}

.category-list {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
}

.category-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  white-space: nowrap;
}

.category-chip.active {
  color: #052319;
  background: var(--accent);
  border-color: transparent;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.listings-grid {
  display: grid;
  gap: 10px;
}

.listing-card {
  background: linear-gradient(145deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  cursor: pointer;
}

.listing-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.badge {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(70, 222, 159, 0.16);
  color: var(--accent);
}

.title {
  margin: 0;
  font-size: 16px;
}

.price {
  margin: 6px 0;
  font-size: 20px;
  color: var(--accent-2);
  font-weight: 700;
}

.meta,
.muted {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.fav-btn {
  border: none;
  background: #243147;
  color: #d0dbec;
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.fav-btn.active {
  background: rgba(255, 107, 107, 0.2);
  color: var(--danger);
}

.post-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.post-form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.primary-btn {
  border: none;
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(110deg, var(--accent), #79ffaa);
  color: #032115;
  font-weight: 700;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 8px 0;
}

.nav-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 12px;
  min-height: 42px;
}

.nav-btn.active {
  border-color: transparent;
  color: #052319;
  background: var(--accent);
  font-weight: 700;
}

.profile-card {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 14px;
}

#listing-dialog {
  border: none;
  background: transparent;
  width: min(700px, 96vw);
}

#listing-dialog::backdrop {
  background: rgba(5, 9, 16, 0.66);
}

.dialog-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.close-btn {
  margin-bottom: 8px;
}

.contact {
  margin-top: 12px;
  background: rgba(53, 183, 255, 0.15);
  border-radius: 10px;
  padding: 10px;
}

.empty {
  border: 1px dashed var(--line);
  color: var(--muted);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

@media (min-width: 768px) {
  .listings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bottom-nav {
    max-width: 500px;
    margin: 0 auto;
    border-radius: 14px;
    padding: 8px;
  }
}
