:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #64707d;
  --line: #e5e8ec;
  --paper: #f5f6f7;
  --card: #ffffff;
  --brand: #b8893e;
  --brand-dark: #8d642b;
  --blue: #1f3528;
  --soft-blue: #edf4ef;
  --green: #047857;
  --shadow: 0 18px 44px rgba(18, 29, 43, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.app-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 18px 92px;
}

.language-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(245, 246, 247, .94);
  backdrop-filter: blur(14px);
}

.language-gate.hidden { display: none; }

.language-card {
  width: min(520px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.language-card h2 { margin-top: 6px; }

.language-copy {
  margin-top: 10px;
  color: var(--muted);
}

.language-search {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.language-results {
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
}

.language-results button, .language-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  font-weight: 900;
}

.language-results button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
}

.language-results button.active {
  border-color: var(--brand);
  background: #fbf7ef;
}

.language-results small {
  color: var(--muted);
  font-weight: 800;
}

.topbar, .hero-panel, .tabs, .filters, .map-toolbar, .section-heading, .bottom-nav, .top-actions {
  display: flex;
  align-items: center;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  justify-content: space-between;
  gap: 16px;
  margin: -18px -18px 0;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(229, 232, 236, .88);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px);
}

h1 { font-size: 30px; line-height: 1; color: var(--blue); }
h2 { font-size: clamp(30px, 5vw, 58px); line-height: 1.02; max-width: 780px; }
h3 { font-size: 18px; line-height: 1.22; }

.brand-logo {
  display: block;
  width: 76px;
  height: 58px;
  object-fit: cover;
  object-position: center;
  border-radius: 6px;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions {
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  height: 44px;
  line-height: 1;
  white-space: nowrap;
}

.register-button {
  background: var(--brand);
  color: #fff;
}

.admin-login-button {
  background: #eef1f4;
  color: var(--muted);
}

.language-button {
  width: 58px;
  height: 44px;
  padding: 0 8px;
}

.icon-button, .avatar-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--blue);
  font-weight: 900;
}

.hero-panel {
  position: relative;
  min-height: 420px;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-top: 18px;
  padding: 34px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(31, 53, 40, .9), rgba(31, 53, 40, .25)),
    url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1600&q=80") center/cover;
  color: #fff;
  box-shadow: var(--shadow);
}

.hero-panel .eyebrow { color: #f3d09b; }

.hero-panel h2 {
  max-width: 650px;
  color: #fff;
}

.hero-search {
  width: min(430px, 100%);
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
}

.hero-search label {
  color: var(--muted);
}

.primary-action, .ghost-action, .small-button {
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

.primary-action {
  min-height: 48px;
  padding: 0 18px;
  color: #fff;
  background: var(--brand);
  white-space: nowrap;
}

.primary-action:hover { background: var(--brand-dark); }

.small-button {
  min-height: 38px;
  padding: 0 12px;
  color: var(--blue);
  background: var(--soft-blue);
}

.ghost-action {
  min-height: 42px;
  padding: 0 16px;
  color: var(--blue);
  background: #eef1f4;
}

.destination-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 16px 0 4px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 16px 0 2px;
}

.quick-action {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 210px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(18, 29, 43, .08);
}

.quick-action h3 {
  font-size: 24px;
}

.quick-action p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.45;
}

.quick-action .primary-action {
  align-self: end;
  margin-top: auto;
}

.destination-strip button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  font-weight: 900;
  white-space: nowrap;
}

.tabs, .filters {
  gap: 8px;
  overflow-x: auto;
  padding: 14px 0 0;
}

.tab, .chip, .nav-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--muted);
  font-weight: 900;
}

.tab {
  min-height: 42px;
  padding: 0 16px;
}

.chip {
  min-height: 34px;
  padding: 0 12px;
  font-size: 14px;
  white-space: nowrap;
}

.tab.active, .chip.active, .nav-item.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.view { display: none; padding-top: 18px; }
.view.active { display: block; }

.map-card, .selected-place, .form-panel, .place-card, .admin-card, .match-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 10px 28px rgba(18, 29, 43, .08);
}

.map-card { overflow: hidden; }

.map-toolbar {
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.map-toolbar span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.map-stage {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  background: #f1f7f9;
}

.professional-map-stage {
  min-height: 520px;
}

.professional-map {
  width: 100%;
  height: 100%;
  min-height: 520px;
  z-index: 1;
}

.map-fallback {
  min-height: 520px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
  background:
    linear-gradient(90deg, rgba(31, 53, 40, .08) 1px, transparent 1px),
    linear-gradient(rgba(31, 53, 40, .08) 1px, transparent 1px);
  background-size: 32px 32px;
}

.leaflet-container {
  font: inherit;
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
}

.pin {
  position: absolute;
  width: 38px;
  height: 38px;
  transform: translate(-50%, -100%);
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 4px;
  rotate: -45deg;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 17px;
  box-shadow: 0 10px 22px rgba(16, 34, 29, .25);
}

.pin span {
  rotate: 45deg;
  display: block;
  font-weight: 900;
}

.selected-place {
  margin-top: 14px;
  padding: 14px;
}

.selected-layout {
  display: grid;
  grid-template-columns: 240px 1fr auto;
  gap: 18px;
  align-items: center;
}

.media-thumb {
  min-height: 170px;
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--blue), var(--brand));
  background-position: center;
  background-size: cover;
}

.media-thumb span {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .48);
}

.place-meta, .tag-row, .card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.place-meta {
  margin: 10px 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.tag {
  padding: 6px 9px;
  border-radius: 8px;
  background: #fff4ec;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
}

.section-heading {
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 14px;
}

.place-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.place-card, .admin-card, .match-card { padding: 14px; }
.place-card .media-thumb { margin: -14px -14px 14px; min-height: 190px; border-radius: 8px 8px 0 0; }

.form-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.place-wizard {
  gap: 18px;
}

.wizard-progress {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.wizard-progress span {
  min-height: 8px;
  border-radius: 8px;
  background: #e6e9ed;
  color: transparent;
}

.wizard-progress span.active {
  background: var(--brand);
}

.wizard-step {
  display: none;
  gap: 14px;
}

.wizard-step.active {
  display: grid;
}

.wizard-step h3 {
  max-width: 720px;
  font-size: 24px;
}

.wizard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.route-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf7ef;
}

.route-map-line {
  position: relative;
  height: 84px;
  border-radius: 8px;
  background: linear-gradient(135deg, #eef4ef, #fff);
  overflow: hidden;
}

.route-map-line span {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 48%;
  height: 5px;
  border-radius: 999px;
  background: var(--brand);
  transform: rotate(-7deg);
}

.route-map-line i, .route-map-line strong {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--blue);
}

.route-map-line i:nth-of-type(1) { left: 16%; top: 52%; }
.route-map-line i:nth-of-type(2) { left: 42%; top: 44%; }
.route-map-line i:nth-of-type(3) { left: 66%; top: 38%; }
.route-map-line strong { right: 12%; top: 30%; background: var(--brand); }

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

.photo-preview span {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--soft-blue);
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.ai-question-list {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(255, 92, 0, .14);
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ai-box, .payment-strip, .category-builder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.category-builder {
  display: grid;
  border: 1px dashed rgba(255, 92, 0, .34);
}

.category-builder p, .ai-box p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.category-builder-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.payment-strip {
  background: #fff4ec;
  color: #7b3000;
}

.match-list, .admin-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.private-match-card {
  border-color: rgba(184, 137, 62, .34);
  background: linear-gradient(180deg, #fff, #fbf7ef);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.admin-stats div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.admin-stats span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.admin-stats strong { font-size: 28px; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 20;
  width: min(680px, calc(100% - 24px));
  transform: translateX(-50%);
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.nav-item {
  flex: 1;
  min-height: 44px;
}

dialog {
  width: min(560px, calc(100% - 30px));
  border: 0;
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(15, 23, 42, .38); }

.dialog-body {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.auth-form {
  margin-bottom: 0;
}

.auth-form h2 {
  font-size: 28px;
}

.qr-box {
  width: 180px;
  height: 180px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-box i { background: var(--ink); border-radius: 2px; }

.notice {
  padding: 10px;
  border-radius: 8px;
  background: #fff4ec;
  color: #7b3000;
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 860px) {
  .app-shell { padding: 14px 12px 88px; }
  .topbar { margin: -14px -12px 0; padding: 12px; }
  .top-actions { width: 100%; justify-content: stretch; }
  .top-actions button { flex: 1; min-width: 0; }
  .language-button { flex: 0 0 54px; }
  .hero-panel {
    min-height: 520px;
    align-items: flex-end;
    flex-direction: column;
    justify-content: flex-end;
    padding: 22px;
  }
  .hero-panel > div:first-child { width: 100%; }
  .hero-search { width: 100%; }
  .map-stage { min-height: 380px; }
  .selected-layout, .place-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
  .form-row, .admin-stats, .category-builder-row { grid-template-columns: 1fr; }
  .selected-layout .primary-action { width: 100%; }
  .wizard-actions { flex-direction: column; }
  .wizard-actions button { width: 100%; }
  .tabs { display: none; }
}
