:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #fbfcfe;
  --line: #e4e9f1;
  --line-strong: #d7dfe9;
  --text: #18243b;
  --muted: #66758f;
  --orange: #f48120;
  --orange-soft: #fff0e2;
  --blue: #2f80ed;
  --blue-soft: #eff5ff;
  --shadow: 0 18px 48px rgba(35, 55, 86, 0.08);
  --shadow-soft: 0 10px 26px rgba(33, 55, 84, 0.06);
  --radius: 22px;
  --radius-sm: 16px;
  --radius-xs: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #fcfdff 0%, #f7f9fc 100%);
  font-size: 14px;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.image-fallback {
  width: 100%;
  height: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.4;
  background: linear-gradient(135deg, #f5f7fb, #eef4ff);
}

.listing-image.is-image-failed,
.detail-main-image.is-image-failed,
.detail-thumbs button.is-image-failed {
  position: relative;
}

.listing-image.is-image-failed::after,
.detail-main-image.is-image-failed::after {
  content: 'Image unavailable';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  color: var(--muted);
  background: linear-gradient(135deg, #f5f7fb, #eef4ff);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.site-gradient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 0% 0%, rgba(244, 129, 32, 0.16), transparent 20%),
    radial-gradient(circle at 100% 0%, rgba(47, 128, 237, 0.14), transparent 24%),
    linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,0));
}

.container {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 18px 0 44px;
  position: relative;
}
.admin-container { width: min(1360px, calc(100% - 48px)); }

.topbar,
.surface {
  background: rgba(255,255,255,0.95);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbar {
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.brand-logo { width: 180px; height: auto; }
.brand-copy {
  display: none;
  flex-direction: column;
  gap: 2px;
}
.brand-copy strong { font-size: 1rem; font-weight: 800; }
.brand-copy span { color: var(--muted); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.text-link {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--text);
  background: linear-gradient(180deg, #fff, #fbfcfe);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  font-weight: 600;
}

.control-small,
.input,
textarea,
select {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.input:focus,
textarea:focus,
select:focus {
  border-color: rgba(47, 128, 237, .38);
  box-shadow: 0 0 0 4px rgba(47, 128, 237, .10);
  background: #fff;
}
.file-input { padding: 10px 12px; }

.hero-strip,
.filter-panel,
.side-card,
.list-card,
.form-card,
.auth-card {
  border-radius: var(--radius);
}

.hero-strip {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.hero-right { color: var(--muted); font-weight: 700; font-size: .95rem; }

.category-pills {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tab-button,
.ghost-button,
.primary-button,
.chip {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.tab-button:hover,
.ghost-button:hover,
.primary-button:hover,
.text-link:hover,
.chip:hover { transform: translateY(-1px); }

.tab-button,
.ghost-button,
.chip {
  background: linear-gradient(180deg, #fff, #fbfcfe);
  box-shadow: var(--shadow-soft);
  color: var(--text);
}
.tab-button.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--blue));
  box-shadow: 0 12px 28px rgba(47, 128, 237, 0.20);
}
.primary-button {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--blue));
  box-shadow: 0 14px 30px rgba(47, 128, 237, 0.18);
}
.danger { color: #c23d3d; }

.filter-panel { padding: 18px 20px; margin-bottom: 18px; }
.filters-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}
.field.full-span { grid-column: span 2; }
.field.actions { align-self: end; }
.search-select {
  position: relative;
}

.search-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.98);
  box-shadow: 0 20px 40px rgba(22, 38, 61, 0.12);
  -webkit-overflow-scrolling: touch;
}

.search-select-option {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.search-select-option:last-child {
  border-bottom: 0;
}

.search-select-option:hover,
.search-select-option:focus {
  background: var(--blue-soft);
}
.filter-title {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff7ef, #fefcfa);
  color: var(--orange);
  border: 1px solid #ffe1c0;
}

.content-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 260px minmax(0, 1fr);
}

.side-card {
  padding: 18px;
  align-self: start;
  position: sticky;
  top: 16px;
}
.summary-stack { display: grid; gap: 14px; }
.summary-item {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #fbfcfe);
  padding: 14px;
}
.summary-item strong {
  display: block;
  font-size: 1.45rem;
  margin-bottom: 6px;
}
.summary-item span {
  color: var(--muted);
  font-weight: 600;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.listing-card {
  background: linear-gradient(180deg, #fff, #fbfcfe);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.listing-image {
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #f5f7fb, #eef4ff);
  overflow: hidden;
}
.listing-image img { width: 100%; height: 100%; object-fit: cover; }
.listing-body {
  padding: 16px;
  display: grid;
  gap: 12px;
}
.listing-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  min-height: 32px;
  padding: 7px 11px;
  font-size: .82rem;
}
.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.price-tag {
  font-size: 1.3rem;
  font-weight: 800;
}
.listing-title {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.35;
}
.listing-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.empty-card {
  padding: 28px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #fbfcfe);
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  text-align: center;
}

.detail-modal {
  width: min(920px, calc(100% - 24px));
  border: 0;
  border-radius: 28px;
  padding: 0;
  background: #fff;
  box-shadow: 0 24px 64px rgba(22, 38, 61, 0.18);
}
.detail-modal::backdrop { background: rgba(14, 24, 42, 0.44); }
.modal-close {
  position: absolute;
  right: 16px;
  top: 12px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 1.5rem;
}
.detail-wrap {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 0;
}
.detail-gallery {
  padding: 18px;
  border-right: 1px solid var(--line);
}
.detail-main-image {
  aspect-ratio: 4 / 3;
  border-radius: 20px;
  overflow: hidden;
  background: #f6f8fb;
  margin-bottom: 12px;
}
.detail-main-image img { width: 100%; height: 100%; object-fit: cover; }
.detail-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.detail-thumbs button {
  padding: 0;
  background: transparent;
  border: 0;
}
.detail-thumbs img {
  width: 82px;
  height: 62px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.detail-copy {
  padding: 24px;
  display: grid;
  gap: 14px;
}
.detail-copy h2 { margin: 0; font-size: 1.5rem; }
.detail-copy p { margin: 0; color: var(--muted); line-height: 1.65; }
.detail-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.detail-spec {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fbfcfe;
}
.detail-spec span {
  display: block;
  color: var(--muted);
  font-size: .8rem;
  margin-bottom: 4px;
}
.detail-spec strong { font-size: .95rem; }

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.section-head h1,
.section-head h2 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.15;
}
.stack-form { display: grid; gap: 14px; }
.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 14px;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.full-span { grid-column: 1 / -1; }

.admin-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.15fr) 390px;
}
.form-card,
.list-card,
.auth-card { padding: 22px; }
.conditional-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #fbfcfe);
}
label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}
.textarea {
  min-height: 130px;
  resize: vertical;
}
.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.align-start { align-items: flex-start; }

.admin-list {
  display: grid;
  gap: 12px;
}
.admin-item {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #fbfcfe);
  display: grid;
  gap: 10px;
}
.admin-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.admin-item strong {
  font-size: 1rem;
}
.admin-thumb-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-thumb-row img,
.image-pill img {
  width: 72px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.image-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.image-pill {
  display: grid;
  gap: 8px;
}
.thumb-remove-btn {
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
}

@media (max-width: 1100px) {
  .filters-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .content-layout,
  .admin-layout { grid-template-columns: 1fr; }
  .side-card { position: static; }
  .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-wrap { grid-template-columns: 1fr; }
  .detail-gallery { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 760px) {
  .search-select-menu { max-height: 220px; }
  .container,
  .admin-container { width: min(100%, calc(100% - 24px)); }
  .topbar,
  .hero-strip,
  .filter-panel,
  .form-card,
  .list-card,
  .auth-card,
  .side-card { padding: 16px; }
  .filters-grid,
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }
  .listing-grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; }
  .control-small { width: 100%; }
  .brand-logo { width: 168px; }
}
.listing-area-full {
  width: 100%;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.detail-page-shell {
  padding: 22px;
}

.detail-page-wrap {
  min-height: unset;
}

.admin-search-wrap {
  width: min(100%, 260px);
}

.list-head-block {
  gap: 14px;
  align-items: flex-start;
}

.compact-head h2 {
  font-size: 1.05rem;
}

.thumb-remove-btn {
  cursor: pointer;
}

@media (max-width: 760px) {
  .admin-search-wrap {
    width: 100%;
  }
}
