:root {
  --ink: #2b241b;
  --muted: #756d61;
  --paper: #fbf7ef;
  --panel: #fffdf7;
  --soft: #f1eadf;
  --line: #e3d8c8;
  --earth: #6f4f32;
  --earth-dark: #2f251a;
  --leaf: #465f38;
  --leaf-dark: #24351f;
  --clay: #b96d3f;
  --danger: #9f2c28;
  --shadow: 0 18px 50px rgba(43, 36, 27, 0.12);
  --radius: 8px;
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.92), rgba(248, 240, 228, 0.94)),
    var(--paper);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

h1,
h2,
h3,
p {
  overflow-wrap: normal;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 84px;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 36px);
  border-bottom: 1px solid var(--line);
  background: rgba(251, 247, 239, 0.94);
  backdrop-filter: blur(18px);
}

.brand {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  line-height: 1;
  text-decoration: none;
  letter-spacing: 0;
}

.brand span {
  color: var(--leaf);
}

.desktop-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.desktop-nav button,
.bottom-nav button,
.filter-row button,
.producer-step {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-weight: 850;
}

.desktop-nav button {
  padding: 0 16px;
}

.desktop-nav button.active,
.bottom-nav button.active,
.filter-row button.active,
.producer-step.active {
  border-color: var(--leaf-dark);
  background: var(--leaf-dark);
  color: #fff;
}

.icon-button,
.primary-button,
.ghost-button {
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-weight: 850;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
}

.primary-button {
  padding: 0 18px;
  border-color: var(--leaf-dark);
  background: var(--leaf-dark);
  color: #fff;
}

.primary-button.compact {
  white-space: nowrap;
}

.ghost-button {
  padding: 0 16px;
}

.ghost-button.danger,
button.danger {
  color: var(--danger);
}

.app-main {
  width: min(1180px, calc(100vw - 28px));
  margin: 18px auto;
}

.app-view {
  display: none;
}

.app-view.active {
  display: block;
}

.screen-head,
.section-title,
.map-toolbar,
.profile-heading,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.screen-head {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--leaf);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 6vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.1;
}

h3 {
  margin: 0;
}

.control-panel,
.map-stage,
.near-strip,
.profile-panel,
.form-card,
.producer-side,
.product-admin-list {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.88);
  box-shadow: var(--shadow);
}

.control-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
}

.search-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
}

.search-field input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-row button {
  flex: 0 0 auto;
  padding: 0 14px;
  white-space: nowrap;
}

.manual-place {
  display: grid;
  grid-template-columns: auto minmax(160px, 240px);
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

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

.map-stage {
  overflow: hidden;
}

.map-toolbar {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.9);
}

.map-toolbar span,
.section-title span,
.muted {
  color: var(--muted);
}

.real-map,
.fallback-map {
  width: 100%;
  min-height: clamp(460px, 62vh, 720px);
  background: #e5dfcf;
}

.fallback-map {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(115deg, transparent 20%, rgba(70, 95, 56, 0.08) 20% 23%, transparent 23% 46%, rgba(70, 95, 56, 0.08) 46% 49%, transparent 49%),
    radial-gradient(circle at 24% 26%, rgba(255, 255, 255, 0.75), transparent 24%),
    radial-gradient(circle at 72% 72%, rgba(255, 255, 255, 0.6), transparent 24%),
    #e7e1d2;
}

.map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(43, 36, 27, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 36, 27, 0.06) 1px, transparent 1px);
  background-size: 58px 58px;
}

.nv-marker,
.map-pin {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--earth);
  color: #fff;
  box-shadow: 0 10px 26px rgba(43, 36, 27, 0.24);
  font-weight: 950;
}

.nv-marker img,
.map-pin img,
.nv-marker .neutral-logo,
.map-pin .neutral-logo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.nv-marker .neutral-logo,
.map-pin .neutral-logo {
  color: #fff;
  background: transparent;
}

.nv-marker .neutral-logo svg,
.map-pin .neutral-logo svg {
  width: 22px;
  height: 22px;
}

.nv-marker.nearest,
.map-pin.nearest {
  background: var(--clay);
}

.nv-marker.selected,
.map-pin.active {
  outline: 4px solid rgba(185, 109, 63, 0.28);
}

.map-pin {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
}

.user-marker {
  position: absolute;
  z-index: 1;
  transform: translate(-50%, -50%);
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--leaf-dark);
  box-shadow: 0 8px 20px rgba(43, 36, 27, 0.18);
  font-size: 0.82rem;
  font-weight: 950;
}

.near-strip {
  margin-top: 16px;
  padding: 16px;
}

.horizontal-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.actor-list {
  display: grid;
  gap: 10px;
}

.actor-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 84px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.actor-card.compact {
  min-height: 78px;
}

.actor-card.active {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(70, 95, 56, 0.12);
}

.actor-card img,
.actor-card .neutral-logo,
.product-card img,
.product-card .neutral-logo,
.product-admin-card img,
.product-admin-card .neutral-logo {
  width: 58px;
  height: 58px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--soft);
}

.neutral-logo {
  display: grid;
  place-items: center;
  color: var(--leaf-dark);
  background: var(--soft);
}

.neutral-logo svg {
  width: 26px;
  height: 26px;
  opacity: 0.82;
}

.actor-card span,
.product-card span {
  min-width: 0;
}

.actor-card small,
.product-card small,
.product-admin-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.profile-panel {
  overflow: hidden;
}

.profile-card {
  display: grid;
  grid-template-columns: minmax(260px, 38%) minmax(0, 1fr);
  min-height: 620px;
}

.profile-image {
  min-height: 320px;
  background: var(--earth-dark);
  color: #fff;
}

.profile-image img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
}

.profile-image .neutral-logo {
  display: grid;
  place-items: center;
  min-height: 320px;
  width: 100%;
  height: 100%;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent),
    var(--earth-dark);
}

.profile-image .neutral-logo svg {
  width: 82px;
  height: 82px;
}

.profile-body {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: clamp(18px, 4vw, 32px);
}

.profile-heading p {
  margin: 0 0 4px;
  color: var(--leaf);
  font-weight: 950;
}

.profile-body > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.favorite-button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  white-space: nowrap;
}

.favorite-button.active {
  border-color: var(--leaf);
  background: var(--soft);
  color: var(--leaf-dark);
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.profile-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 0;
}

.profile-meta div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.profile-meta dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.profile-meta dd {
  margin: 4px 0 0;
  font-weight: 900;
}

.profile-products {
  display: grid;
  gap: 10px;
}

.product-list {
  display: grid;
  gap: 10px;
}

.product-card,
.product-admin-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.product-card img,
.product-card .neutral-logo {
  width: 72px;
  height: 72px;
}

.product-card.soldout {
  opacity: 0.58;
}

.producer-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
}

.auth-card,
.user-bar {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow);
}

.auth-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  align-items: start;
  gap: 20px;
  padding: clamp(16px, 3vw, 26px);
}

.auth-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 850;
}

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

.producer-layout.locked {
  opacity: 0.46;
  pointer-events: none;
  user-select: none;
}

.producer-side {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
}

.producer-side p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.producer-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
}

.producer-step span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
}

.producer-form {
  display: grid;
  gap: 16px;
}

.producer-form.hidden,
.hidden {
  display: none;
}

.form-card {
  display: grid;
  gap: 16px;
  padding: clamp(16px, 3vw, 26px);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid label,
.image-first {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 850;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.file-field,
.image-first {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.image-first {
  min-height: 130px;
  place-items: center;
  text-align: center;
}

.form-status {
  margin: 0;
  color: var(--leaf);
  font-weight: 850;
}

.product-admin-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.product-admin-card {
  grid-template-columns: 72px minmax(0, 1fr) auto auto;
}

.product-admin-card img,
.product-admin-card .neutral-logo {
  width: 72px;
  height: 72px;
}

.product-admin-card button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-weight: 850;
}

.empty-map,
.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  min-height: 260px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.empty-map strong,
.empty-state strong {
  color: var(--ink);
  font-size: 1.1rem;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 40;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  width: min(430px, calc(100vw - 24px));
  transform: translateX(-50%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(47, 37, 26, 0.96);
  box-shadow: 0 16px 40px rgba(43, 36, 27, 0.28);
}

.bottom-nav button {
  min-height: 54px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-size: 0.78rem;
}

@media (max-width: 900px) {
  .desktop-nav {
    display: none;
  }

  .app-topbar {
    grid-template-columns: auto auto;
  }

  .bottom-nav {
    display: grid;
  }

  .app-main {
    width: 100%;
    margin: 0;
  }

  .app-view {
    padding: 16px;
  }

  .screen-head {
    align-items: flex-start;
  }

  h1 {
    font-size: clamp(2.45rem, 13vw, 3.8rem);
  }

  .manual-place {
    grid-template-columns: 1fr;
  }

  .real-map,
  .fallback-map {
    min-height: 520px;
  }

  .horizontal-list {
    grid-template-columns: 1fr;
  }

  .profile-card {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .auth-card,
  .profile-meta,
  .form-grid,
  .producer-layout {
    grid-template-columns: 1fr;
  }

  .producer-side {
    grid-template-columns: repeat(2, 1fr);
  }

  .producer-side p {
    grid-column: 1 / -1;
  }

  .product-admin-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}
