:root {
  color-scheme: light;
  --bg: #f5f3ef;
  --bg-deep: #efe9e2;
  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --surface-border: rgba(12, 18, 28, 0.08);
  --text: #1f2937;
  --text-soft: #556070;
  --accent: #57c28f;
  --accent-ink: #0f3d2b;
  --accent-muted: rgba(87, 194, 143, 0.14);
  --warn: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;
  --radius: 20px;
  --shadow: 0 18px 36px rgba(19, 27, 45, 0.08);
  --shadow-soft: 0 10px 24px rgba(19, 27, 45, 0.08);
  --font-title: "Fraunces", serif;
  --font-body: "Spline Sans", system-ui, -apple-system, sans-serif;
  --page-bg: radial-gradient(circle at 15% 10%, #fef9f2 0%, transparent 45%),
    radial-gradient(circle at 90% 5%, #e6f6ed 0%, transparent 48%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  --topbar-bg: rgba(245, 243, 239, 0.85);
  --footer-bg: rgba(245, 243, 239, 0.6);
  --input-bg: rgba(255, 255, 255, 0.9);
  --secondary-bg: var(--surface);
  --secondary-text: var(--text);
  --danger-bg: #fee2e2;
  --danger-text: #7f1d1d;
  --status-info-bg: #e0f2fe;
  --status-info-text: #0c4a6e;
  --status-success-bg: #d1fae5;
  --status-success-text: #064e3b;
  --status-warn-bg: #fef3c7;
  --status-warn-text: #92400e;
  --status-error-bg: #fee2e2;
  --status-error-text: #7f1d1d;
  --chat-other-bg: #f3f4f6;
  --image-bg: #f1f5f9;
  --map-bg: #e9f2ec;
  --hero-bg: linear-gradient(140deg, rgba(87, 194, 143, 0.18), rgba(255, 255, 255, 0.9));
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1217;
  --bg-deep: #0b0f14;
  --surface: #151b22;
  --surface-glass: rgba(21, 27, 34, 0.78);
  --surface-border: rgba(148, 163, 184, 0.18);
  --text: #e2e8f0;
  --text-soft: #94a3b8;
  --accent: #5dd6a4;
  --accent-ink: #0c2b1f;
  --accent-muted: rgba(93, 214, 164, 0.16);
  --warn: #fbbf24;
  --danger: #f87171;
  --info: #38bdf8;
  --shadow: 0 18px 36px rgba(2, 6, 12, 0.5);
  --shadow-soft: 0 10px 24px rgba(2, 6, 12, 0.4);
  --page-bg: radial-gradient(circle at 15% 10%, rgba(34, 197, 94, 0.16) 0%, transparent 45%),
    radial-gradient(circle at 90% 5%, rgba(56, 189, 248, 0.12) 0%, transparent 48%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  --topbar-bg: rgba(13, 17, 23, 0.9);
  --footer-bg: rgba(13, 17, 23, 0.85);
  --input-bg: rgba(15, 18, 23, 0.85);
  --secondary-bg: rgba(21, 27, 34, 0.9);
  --secondary-text: var(--text);
  --danger-bg: rgba(239, 68, 68, 0.2);
  --danger-text: #fecaca;
  --status-info-bg: rgba(14, 116, 144, 0.25);
  --status-info-text: #e0f2fe;
  --status-success-bg: rgba(16, 185, 129, 0.2);
  --status-success-text: #ecfdf3;
  --status-warn-bg: rgba(245, 158, 11, 0.2);
  --status-warn-text: #fffbeb;
  --status-error-bg: rgba(239, 68, 68, 0.2);
  --status-error-text: #fee2e2;
  --chat-other-bg: #1f2732;
  --image-bg: #1f2937;
  --map-bg: #12181f;
  --hero-bg: linear-gradient(140deg, rgba(93, 214, 164, 0.2), rgba(15, 18, 23, 0.85));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--page-bg);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.text-soft {
  color: var(--text-soft);
}

.error {
  background: var(--status-error-bg);
  color: var(--status-error-text);
}
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 6vw;
  backdrop-filter: blur(18px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--surface-border);
}

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

.brand__mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1f2937 0%, #2f3545 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 1px;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand__name {
  font-family: var(--font-title);
  font-size: 20px;
}

.brand__tag {
  font-size: 12px;
  color: var(--text-soft);
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.nav a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-soft);
  background: transparent;
  transition: all 0.2s ease;
}

.nav a.active,
.nav a:hover {
  color: var(--text);
  background: var(--accent-muted);
}

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

.main {
  flex: 1;
  padding: 32px 6vw 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.section {
  display: grid;
  gap: 20px;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  align-items: center;
}

.hero__title {
  font-family: var(--font-title);
  font-size: clamp(32px, 3.4vw, 48px);
  margin: 0;
}

.hero__lead {
  font-size: 16px;
  color: var(--text-soft);
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow-soft);
}

.glass {
  background: var(--surface-glass);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  gap: 16px;
}

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

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-muted);
  color: var(--accent-ink);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 10px 16px;
  font-family: var(--font-body);
  cursor: pointer;
  font-weight: 600;
  background: var(--accent);
  color: #0b2b1c;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(87, 194, 143, 0.25);
}

.btn.secondary {
  background: var(--secondary-bg);
  color: var(--secondary-text);
  border: 1px solid var(--surface-border);
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px dashed var(--surface-border);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.btn.danger {
  background: var(--danger-bg);
  color: var(--danger-text);
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
  font-family: var(--font-body);
  background: var(--input-bg);
  color: var(--text);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.form {
  display: grid;
  gap: 12px;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  display: grid;
  gap: 8px;
}

.badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-muted);
  color: var(--accent-ink);
}

.status {
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--status-info-bg);
  color: var(--status-info-text);
  font-size: 14px;
}

.status.success { background: var(--status-success-bg); color: var(--status-success-text); }
.status.error { background: var(--status-error-bg); color: var(--status-error-text); }
.status.warn { background: var(--status-warn-bg); color: var(--status-warn-text); }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--surface-border);
  text-align: left;
}

.footer {
  padding: 24px 6vw 32px;
  border-top: 1px solid var(--surface-border);
  background: var(--footer-bg);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-soft);
}

.footer__links {
  display: flex;
  gap: 16px;
}

.hero-card {
  padding: 20px;
  border-radius: 22px;
  background: var(--hero-bg);
  border: 1px solid rgba(87, 194, 143, 0.35);
  display: grid;
  gap: 14px;
}

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

.gps-indicator {
  font-size: 13px;
  color: var(--text-soft);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-glass);
  border: 1px solid var(--surface-border);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.map-shell {
  height: 360px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  background: var(--map-bg);
}

.map-fallback {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  font-size: 14px;
}

.leaflet-container {
  font-family: var(--font-body);
}

.leaflet-control-attribution {
  font-size: 10px;
}

.item-card img {
  width: 100%;
  height: 160px;
  border-radius: 16px;
  object-fit: cover;
  background: var(--image-bg);
}

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

.chat-window {
  display: grid;
  gap: 12px;
}

.chat-bubble {
  padding: 10px 12px;
  border-radius: 16px;
  max-width: 70%;
}

.chat-bubble.me {
  background: var(--accent);
  color: #0b2b1c;
  margin-left: auto;
}

.chat-bubble.other {
  background: var(--chat-other-bg);
  color: var(--text);
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .topbar__actions {
    justify-content: flex-start;
  }
}

@media (max-width: 600px) {
  .nav {
    justify-content: flex-start;
  }

  .main {
    padding: 24px 5vw 60px;
  }
}
