:root {
  --ink: #18201f;
  --muted: #66706c;
  --line: #dde5df;
  --paper: #ffffff;
  --surface: #f7faf8;
  --green: #1f7a4d;
  --green-strong: #0f5d38;
  --sun: #f2bd3d;
  --red: #c64242;
  --blue: #2d6cdf;
  --mint: #dff3e9;
  --soft: #f0f6f2;
  --button-ink: #ffffff;
  --shadow: 0 16px 40px rgba(24, 32, 31, 0.12);
}

[data-theme="dark"] {
  --ink: #edf6f1;
  --muted: #b5c3bd;
  --line: #355045;
  --paper: #102218;
  --surface: #07130d;
  --green: #45b879;
  --green-strong: #86e0ad;
  --mint: #183b2a;
  --soft: #172d21;
  --button-ink: #07130d;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background: var(--surface);
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--surface);
}

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

img {
  display: block;
  max-width: 100%;
}

p,
h1,
h2,
h3,
a,
span,
strong,
td,
th,
label {
  overflow-wrap: anywhere;
}

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

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.market-hero {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  color: #ffffff;
  background: #173c2a;
}

.hero-media {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(90deg, rgba(8, 30, 20, 0.9), rgba(13, 44, 30, 0.62), rgba(13, 35, 25, 0.18)), url("/assets/afyonkarahisar-kalesi.jpg");
  background-size: cover;
  background-position: center 42%;
}

.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 520px;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: 48px 0 76px;
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
}

.market-hero .eyebrow {
  color: #d6f4e4;
}

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

h1 {
  max-width: 780px;
  margin-bottom: 0;
  font-size: 56px;
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.search-row,
.inline-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: min(720px, 100%);
  gap: 8px;
}

.search-row input,
.inline-search input,
.form-surface input,
.form-surface textarea,
.form-surface select,
.admin-input,
.admin-select {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--paper);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

.form-surface textarea {
  padding-top: 12px;
  resize: vertical;
}

.search-row button,
.inline-search button,
.form-surface button,
.button,
.admin-button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  color: var(--button-ink);
  background: var(--green);
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button {
  background: #34403c;
  color: #ffffff;
}

.button.primary,
.admin-button.primary {
  background: var(--green);
  color: var(--button-ink);
}

.button.whatsapp {
  background: #25d366;
  color: #0f2b1d;
}

.button.danger,
.admin-button.danger {
  background: var(--red);
}

.admin-button.secondary {
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-stats span,
.badge-row span,
.ad-slots span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 7px 10px;
  color: #0f2b1d;
  background: #e7f6ec;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.market-hero .hero-stats span {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.page-flow {
  display: grid;
  gap: 34px;
  padding: 34px 0 56px;
}

.compact-top {
  padding-top: 30px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.category-tile {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 8px 20px rgba(24, 32, 31, 0.06);
}

.category-tile span {
  font-weight: 800;
}

.category-tile strong {
  color: var(--muted);
  font-size: 14px;
}

.category-animals {
  border-top: 4px solid var(--green);
}

.category-feed {
  border-top: 4px solid var(--sun);
}

.category-equipment {
  border-top: 4px solid var(--blue);
}

.category-machinery {
  border-top: 4px solid var(--red);
}

.notice-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #d0eadb;
  border-radius: 8px;
  padding: 18px 20px;
  background: var(--mint);
}

.notice-band a,
.section-title a {
  color: var(--green-strong);
  font-weight: 700;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

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

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

.banner-card {
  position: relative;
  overflow: hidden;
  min-height: 130px;
  border-radius: 8px;
  background: #dfeae4;
}

.banner-card img {
  width: 100%;
  height: 100%;
  min-height: 130px;
  object-fit: cover;
}

.banner-card span {
  position: absolute;
  left: 12px;
  bottom: 12px;
  border-radius: 999px;
  padding: 6px 10px;
  color: #ffffff;
  background: rgba(24, 32, 31, 0.78);
  font-weight: 700;
}

.listing-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 22px rgba(24, 32, 31, 0.07);
}

.listing-card.wide-card {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
}

.card-image {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: #e8efe9;
}

.wide-card .card-image {
  aspect-ratio: auto;
  min-height: 260px;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-image span {
  position: absolute;
  left: 10px;
  bottom: 10px;
  border-radius: 999px;
  padding: 6px 10px;
  color: #ffffff;
  background: rgba(24, 32, 31, 0.78);
  font-size: 13px;
}

.card-body {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.card-body h3,
.card-body p {
  margin: 0;
}

.card-body p {
  color: var(--muted);
}

.card-body strong,
.price {
  color: var(--green-strong);
  font-weight: 900;
}

.price {
  font-size: 30px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 96%, transparent);
  backdrop-filter: blur(8px);
}

.brand {
  font-weight: 900;
  color: var(--green-strong);
}

.topbar-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  min-width: 0;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.topbar-actions .button,
.topbar-actions .theme-chip {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}

.topbar-actions .theme-chip {
  display: inline-flex;
  align-items: center;
}

.admin-brand-link {
  display: inline-block;
  color: #ffffff;
}

.admin-brand-link h1 {
  margin-bottom: 0;
}

.list-header,
.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.65fr);
  gap: 24px;
  align-items: start;
}

.listing-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.75fr);
  gap: 24px;
  padding: 28px 0 56px;
}

.gallery-panel,
.detail-panel,
.form-surface,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 12px 28px rgba(24, 32, 31, 0.08);
}

.gallery-panel {
  overflow: hidden;
}

.gallery-panel > img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.thumb-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.thumb-row img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
}

.detail-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 20px;
}

.feature-list {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.feature-list dt {
  color: var(--muted);
}

.feature-list dd {
  margin: 0;
  font-weight: 700;
}

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

.seller-strip {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  padding: 12px;
  background: color-mix(in srgb, var(--green) 10%, var(--paper));
  color: var(--muted);
}

.seller-profile {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--paper);
}

.seller-profile > img {
  width: 112px;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
}

.profile-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.profile-metrics span {
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.seller-actions {
  display: grid;
  gap: 8px;
}

.seller-strip strong {
  color: var(--ink);
}

.similar-listings {
  grid-column: 1 / -1;
}

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

.form-surface label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.ad-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form-result {
  min-height: 20px;
  margin: 0;
  color: var(--green-strong);
  font-weight: 700;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: var(--paper);
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 24px 0;
  color: var(--muted);
}

.footer-grid strong {
  color: var(--green-strong);
}

.admin-body {
  background: var(--surface);
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  padding: 22px;
  color: #ffffff;
  background: #183b2a;
}

.admin-sidebar h1 {
  font-size: 26px;
}

.admin-tabs {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.admin-tabs button {
  width: 100%;
  justify-content: flex-start;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.admin-tabs button.active {
  color: #173c2a;
  background: #ffffff;
}

.admin-main {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 24px;
}

.admin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--paper);
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.admin-panel {
  overflow: hidden;
}

.panel-title {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: 13px;
  background: var(--soft);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.login-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 18px;
}

.mobile-app,
.app-body {
  min-height: 100vh;
  background: var(--surface);
}

.mobile-header {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.app-auth {
  display: grid;
  place-items: start center;
  padding: 18px 10px;
}

.mobile-tabs {
  position: sticky;
  top: 58px;
  z-index: 11;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  -webkit-overflow-scrolling: touch;
}

.mobile-tabs button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
}

.mobile-tabs button.active {
  border-color: var(--green);
  color: var(--button-ink);
  background: var(--green);
}

.theme-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
}

.theme-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.side-theme {
  margin-top: 18px;
}

.web-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  display: grid;
  gap: 6px;
  width: min(340px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.web-toast span {
  color: var(--muted);
}

.web-toast button {
  justify-self: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--paper);
}

.mobile-screen {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 12px 10px 80px;
}

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

.mobile-card {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--paper);
}

.mobile-card img {
  width: 116px;
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
}

.mobile-card h3,
.mobile-card p {
  margin: 6px 0;
}

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

.span-2 {
  grid-column: 1 / -1;
}

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

.toggle-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: var(--paper);
}

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

.message-list p {
  margin: 0;
  border-radius: 6px;
  padding: 10px;
  background: var(--soft);
}

.full {
  width: 100%;
  margin-top: 18px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #eef6f1;
    --muted: #b7c2bd;
    --line: #385246;
    --paper: #102118;
    --surface: #07130d;
    --soft: #172d21;
    --button-ink: #07130d;
  }
}

.login-wrap .form-surface {
  width: min(430px, 100%);
}

@media (max-width: 920px) {
  h1 {
    font-size: 42px;
  }

  .category-grid,
  .listing-grid,
  .banner-grid,
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .list-header,
  .form-layout,
  .listing-detail,
  .admin-shell,
  .listing-card.wide-card {
    grid-template-columns: 1fr;
  }

  .seller-profile {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .seller-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-sidebar {
    position: static;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1180px);
  }

  .market-hero,
  .hero-content {
    min-height: 430px;
  }

  h1 {
    font-size: 34px;
  }

  .search-row,
  .inline-search,
  .category-grid,
  .listing-grid,
  .banner-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 16px;
  }

  .topbar-main,
  .topbar-actions {
    width: 100%;
  }

  .topbar nav {
    gap: 10px;
    font-size: 14px;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .notice-band,
  .section-title,
  .admin-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .thumb-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mobile-card {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .mobile-card img {
    width: 92px;
  }

  .form-grid,
  .admin-form-grid,
  .toggle-grid {
    grid-template-columns: 1fr;
  }

  .admin-main {
    padding: 14px 10px 80px;
  }

  .admin-sidebar {
    padding: 16px 10px;
  }

  .admin-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
