:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #65736f;
  --line: #dce4df;
  --paper: #f7faf7;
  --surface: #ffffff;
  --green: #16615a;
  --green-dark: #0d453f;
  --blue: #2f5d9f;
  --amber: #b86620;
  --rose: #b73b5a;
  --shadow: 0 18px 45px rgba(25, 43, 39, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(180deg, rgba(22, 97, 90, .08), rgba(47, 93, 159, .04) 38%, var(--paper) 100%),
    var(--paper);
}

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

button {
  cursor: pointer;
}

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

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

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

.top-link,
.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-dark);
  background: var(--surface);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(23, 33, 31, .06);
}

.back-button {
  margin: 0 0 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.18;
}

h3 {
  margin-bottom: 0;
  font-size: 17px;
  line-height: 1.2;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green);
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(23, 33, 31, .06);
}

.tabbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
  margin: 0 -2px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.tab.is-active {
  color: #fff;
  background: var(--green);
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.is-hidden {
  display: none;
}

.search-panel,
.owner-card,
.upgrade-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-panel label,
.field-grid label,
.photo-upload {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.search-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 0 14px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfdfb;
}

.search-row input,
.field-grid input,
.field-grid select,
.field-grid textarea {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.field-grid input,
.field-grid select,
.field-grid textarea {
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.field-grid textarea {
  padding-top: 12px;
}

.radius-row,
.location-strip,
.section-head,
.item-title-row,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.radius-row {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

output {
  color: var(--green);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.filter-row select {
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfdfb;
  font-weight: 800;
}

.text-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-dark);
  background: #f8fbfa;
  font-weight: 800;
}

.text-button.is-active {
  color: #fff;
  background: var(--rose);
}

.location-strip {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid rgba(47, 93, 159, .16);
  border-radius: 8px;
  color: var(--blue);
  background: rgba(47, 93, 159, .08);
  font-size: 14px;
  font-weight: 800;
}

.location-strip span {
  min-width: 0;
  flex: 1;
}

.location-strip button {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
}

.manual-location {
  margin: 14px 0 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.manual-location label {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  font-weight: 900;
}

.compact-search {
  margin-top: 0;
}

.results-block,
.inventory-block,
.ad-strip {
  padding: 4px 0 28px;
}

.ad-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(158px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.ad-card {
  display: grid;
  align-content: end;
  min-height: 168px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .08), rgba(0, 0, 0, .68)),
    var(--photo) center / cover,
    var(--green-dark);
  text-align: left;
  box-shadow: 0 10px 26px rgba(23, 33, 31, .12);
}

.ad-card span,
.ad-card strong,
.ad-card small {
  display: block;
}

.ad-card span {
  font-weight: 900;
}

.ad-card strong {
  margin-top: 4px;
  font-size: 20px;
}

.ad-card small {
  margin-top: 4px;
  opacity: .88;
  font-weight: 800;
}

.section-head {
  margin: 18px 0 12px;
}

.text-button {
  min-height: 38px;
  padding: 0 12px;
}

.result-list,
.inventory-list {
  display: grid;
  gap: 12px;
}

.item-card,
.inventory-item {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(23, 33, 31, .07);
}

.item-photo {
  min-height: 112px;
  border-radius: 8px;
  background-color: #e8f0eb;
  background-image: var(--photo);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}

.result-price {
  flex: 0 0 auto;
  color: var(--green-dark);
  display: grid;
  justify-items: end;
  min-width: 86px;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.05;
  text-align: right;
}

.price-sale {
  color: var(--rose);
}

.price-regular {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: line-through;
}

.address {
  margin: 5px 0 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--ink);
  background: #eef5f2;
  font-size: 12px;
  font-weight: 800;
}

.pill.warning {
  color: var(--amber);
  background: rgba(184, 102, 32, .1);
}

.pill.blocked {
  color: var(--rose);
  background: rgba(183, 59, 90, .1);
}

.pill.sale-price {
  color: #fff;
  background: var(--rose);
}

.pill.muted-price {
  color: var(--muted);
  text-decoration: line-through;
}

.contact-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-weight: 900;
}

.contact-button {
  flex: 1;
}

.contact-button.locked {
  color: var(--muted);
  background: #edf1ef;
}

.map-button {
  box-shadow: none;
}

.match-label {
  margin-bottom: 3px;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.store-line {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.product-description {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

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

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

.store-edit-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.store-edit-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.store-edit-panel input {
  min-height: 42px;
  width: 100%;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfdfb;
}

.store-edit-panel .inventory-actions {
  grid-column: 1 / -1;
}

.admin-note {
  margin: 10px 0 2px;
  padding: 11px 12px;
  border: 1px solid rgba(47, 93, 159, .16);
  border-radius: 8px;
  color: var(--blue);
  background: rgba(47, 93, 159, .08);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.owner-card {
  margin-top: 2px;
}

#adminView,
#contactView,
#storeOwnerView {
  max-width: 860px;
  margin: 0 auto;
}

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

.contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.contact-row span {
  color: var(--muted);
  font-weight: 900;
}

.contact-row a,
.store-social-link {
  color: var(--blue);
  font-weight: 900;
  word-break: break-word;
}

#adminLoginCard,
#storeLoginCard {
  max-width: 560px;
  margin: 12px auto 0;
}

#adminDashboard,
#storeDashboard {
  display: grid;
  gap: 14px;
}

#adminDashboard.is-hidden,
#storeDashboard.is-hidden,
.results-block.is-hidden {
  display: none;
}

#adminDashboard > .owner-card,
#storeDashboard.owner-card {
  box-shadow: 0 12px 34px rgba(23, 33, 31, .08);
}

.product-entry {
  margin-top: 18px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.product-entry .section-head {
  margin-top: 0;
}

.plan-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green-dark);
  background: #f8fbfa;
  font-weight: 900;
}

.plan-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.status-badge {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: 999px;
  color: var(--green-dark);
  background: rgba(22, 97, 90, .1);
  font-size: 12px;
  font-weight: 900;
}

.field-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.field-grid label {
  min-width: 0;
}

.primary-button {
  width: 100%;
  margin-top: 16px;
}

.photo-upload {
  margin-top: 14px;
}

.feature-check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  color: var(--green-dark);
  font-weight: 900;
}

.feature-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.photo-upload input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.photo-drop {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 116px;
  padding: 16px;
  border: 1px dashed rgba(22, 97, 90, .45);
  border-radius: 8px;
  color: var(--green-dark);
  background: rgba(22, 97, 90, .06);
  text-align: center;
}

.photo-drop svg {
  width: 28px;
  height: 28px;
}

#photoPreview,
#ownerPhotoPreview {
  display: none;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

#photoPreview.is-visible,
#ownerPhotoPreview.is-visible {
  display: block;
}

.upgrade-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  background:
    linear-gradient(135deg, rgba(22, 97, 90, .08), rgba(184, 102, 32, .08)),
    var(--surface);
}

.compact-upgrade {
  box-shadow: none;
}

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

.subsection {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.inline-action {
  margin-top: 12px;
}

.staff-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

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

.staff-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.owner-product-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.owner-product-item.is-hidden-product {
  opacity: .68;
}

.owner-product-main strong,
.owner-product-main span {
  display: block;
}

.owner-product-main span,
.owner-product-main p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.product-edit-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.product-edit-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.product-edit-panel input,
.product-edit-panel select,
.product-edit-panel textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.product-edit-panel textarea {
  padding-top: 11px;
}

.product-edit-panel .feature-check,
.product-edit-panel .inventory-actions {
  grid-column: 1 / -1;
}

.staff-item strong,
.staff-item span {
  display: block;
}

.staff-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.upgrade-grid div {
  min-height: 92px;
  padding: 12px;
  border: 1px solid rgba(22, 97, 90, .16);
  border-radius: 8px;
  background: rgba(255, 255, 255, .7);
}

.upgrade-grid strong,
.upgrade-grid span {
  display: block;
}

.upgrade-grid strong {
  margin-bottom: 6px;
}

.upgrade-grid span,
.empty-state {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.38;
}

.inventory-item {
  grid-template-columns: 1fr auto;
}

.inventory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-content: flex-start;
  max-width: 260px;
}

.inventory-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.plan-button {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(22, 97, 90, .22);
  border-radius: 8px;
  color: var(--green-dark);
  background: rgba(22, 97, 90, .08);
  font-size: 12px;
  font-weight: 900;
}

.premium-toggle,
.ad-toggle {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.disable-toggle {
  color: var(--amber);
  border-color: rgba(184, 102, 32, .22);
  background: rgba(184, 102, 32, .08);
}

.delete-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(183, 59, 90, .2);
  border-radius: 8px;
  color: var(--rose);
  background: rgba(183, 59, 90, .06);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 8;
  max-width: 724px;
  margin: auto;
  padding: 13px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--green-dark);
  box-shadow: var(--shadow);
  transform: translateY(140%);
  transition: transform .2s ease;
}

.toast.is-visible {
  transform: translateY(0);
}

@media (min-width: 680px) {
  .app-shell {
    padding: 28px;
  }

  h1 {
    font-size: 42px;
  }

  .field-grid {
    grid-template-columns: 1fr 1fr;
  }

  .primary-button {
    width: auto;
    padding: 0 18px;
  }
}

@media (max-width: 390px) {
  .app-shell {
    padding: 14px;
  }

  .topbar {
    display: grid;
  }

  .top-actions {
    justify-content: stretch;
    max-width: none;
  }

  .top-link {
    flex: 1 1 auto;
  }

  h1 {
    font-size: 30px;
  }

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

  .item-photo {
    min-height: 104px;
  }

  .upgrade-grid {
    grid-template-columns: 1fr;
  }

  .inventory-item,
  .staff-item {
    grid-template-columns: 1fr;
  }

  .store-edit-panel {
    grid-template-columns: 1fr;
  }

  .owner-product-item,
  .product-edit-panel {
    grid-template-columns: 1fr;
  }

  .inventory-actions {
    justify-content: stretch;
    max-width: none;
  }

  .inventory-actions button {
    flex: 1 1 110px;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }
}
