:root {
  --bg: #fbf8f4;
  --surface: #ffffff;
  --ink: #1b1917;
  --muted: #736d64;
  --line: #e9e2d8;
  --accent: #b4532a;
  --accent-soft: #f6ece4;
  --ok: #2f7a52;
  --danger: #b3261e;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(27, 25, 23, 0.04), 0 10px 30px rgba(27, 25, 23, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 15px;
}

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

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

h1,
h2,
h3 {
  margin: 0 0 0.4em;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
}

h2 {
  font-size: 1.15rem;
}

h3 {
  font-size: 1rem;
}

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 18px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.82rem;
}

.center {
  text-align: center;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(251, 248, 244, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--ink);
  color: #f8f4ee;
  font-size: 0.9rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: rgba(27, 25, 23, 0.05);
  color: var(--ink);
}

.nav-link.active {
  background: var(--ink);
  color: #fbf8f4;
}

.cart-btn {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
}

.cart-btn.active {
  background: var(--ink);
}

.badge {
  display: none;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.badge.has-items {
  display: inline-block;
}

.cart-btn.active .badge {
  background: #f0b58c;
  color: #3a1c0c;
}

/* ---------- hero ---------- */
.hero {
  margin: 20px 0 22px;
  padding: 30px;
  border-radius: 22px;
  background: linear-gradient(135deg, #f3ece2 0%, #f8f3ec 45%, #fdf8f2 100%);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.eyebrow {
  display: inline-block;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
}

.hero h1 {
  max-width: 560px;
  margin-bottom: 10px;
}

.hero p {
  margin: 0 0 18px;
  color: var(--muted);
  max-width: 460px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  font-size: 0.86rem;
  color: var(--muted);
}

.hero-badge i {
  color: var(--accent);
}

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.search-inline {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  height: 46px;
  max-width: 460px;
  box-shadow: var(--shadow);
}

.search-inline i {
  color: var(--muted);
  font-size: 0.9rem;
}

.search-inline input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  padding: 0 10px;
  color: var(--ink);
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover {
  border-color: #d5cabb;
  color: var(--ink);
}

.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fbf8f4;
}

.chip-count {
  font-size: 0.72rem;
  opacity: 0.65;
}

/* ---------- product grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.16s, box-shadow 0.16s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-media {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  background: #f2ede6;
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s;
}

.card:hover .card-media img {
  transform: scale(1.04);
}

.card-media-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #c3b9ac;
  font-size: 1.6rem;
}

.tag-out {
  position: absolute;
  inset: auto 8px 8px auto;
  background: rgba(27, 25, 23, 0.82);
  color: #fff;
  font-size: 0.68rem;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
}

.card-body {
  padding: 12px 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.card-cat {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.card-title {
  font-size: 0.94rem;
  font-weight: 600;
  margin: 0;
}

.card-title a:hover {
  color: var(--accent);
}

.card-foot {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.price {
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #eee8df;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.15s, background 0.15s;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: var(--ink);
  color: #fbf8f4;
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn.ghost:hover {
  background: rgba(27, 25, 23, 0.04);
}

.btn.light {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--line);
  color: var(--ink);
}

.btn.small {
  padding: 7px 12px;
  font-size: 0.82rem;
}

.btn.full {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: #d5cabb;
}

.icon-btn.danger:hover {
  color: var(--danger);
  border-color: #e8c3bf;
}

.load-more {
  display: flex;
  justify-content: center;
  padding: 26px 0 10px;
}

/* ---------- states ---------- */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 54px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.state i {
  font-size: 1.7rem;
  color: #c3b9ac;
}

.state h3 {
  color: var(--ink);
  margin: 4px 0 0;
}

.state p {
  margin: 0 0 8px;
  max-width: 420px;
}

.state.error i {
  color: var(--danger);
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(27, 25, 23, 0.15);
  border-top-color: var(--ink);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- detail ---------- */
.page-title {
  margin: 6px 0 14px;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
}

.page-title .muted {
  font-size: 0.85rem;
  font-weight: 500;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  margin: 14px 0 16px;
}

.back-link:hover {
  color: var(--ink);
}

.detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-bottom: 40px;
}

.detail-media {
  aspect-ratio: 1 / 1;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f2ede6;
}

.detail-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-info h1 {
  margin-top: 6px;
}

.detail-price {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 6px 0 10px;
}

.detail-stock {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.86rem;
  color: var(--ok);
  margin: 0 0 14px;
}

.detail-stock.out {
  color: var(--danger);
}

.detail-desc {
  color: var(--muted);
  margin: 0 0 20px;
}

.qty-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.qty-row label {
  font-size: 0.86rem;
  color: var(--muted);
}

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
}

.stepper input {
  width: 52px;
  border: 0;
  text-align: center;
  font: inherit;
  font-weight: 600;
  background: transparent;
  -moz-appearance: textfield;
  appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stepper-value {
  min-width: 34px;
  text-align: center;
  font-weight: 600;
}

.step {
  border: 0;
  background: transparent;
  width: 36px;
  height: 38px;
  font-size: 1.05rem;
  cursor: pointer;
  color: var(--ink);
}

.step:hover {
  background: rgba(27, 25, 23, 0.05);
}

.stepper.small .step {
  width: 30px;
  height: 30px;
  font-size: 0.95rem;
}

.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.perks {
  list-style: none;
  padding: 16px 0 0;
  margin: 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 0.86rem;
  color: var(--muted);
}

.perks i {
  color: var(--accent);
  width: 18px;
}

/* ---------- panels / forms ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
}

.form input[type='text'],
.form input[type='tel'],
.form input[type='url'],
.form input[type='number'],
.form input[type='search'],
.form textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font: inherit;
  background: #fdfbf8;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form input:focus,
.form textarea:focus {
  border-color: #c9b9a6;
  box-shadow: 0 0 0 3px rgba(180, 83, 42, 0.12);
  background: #fff;
}

.form textarea {
  resize: vertical;
}

.form .btn {
  margin-top: 8px;
}

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

.checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 500 !important;
  color: var(--muted);
  margin: 6px 0;
}

.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--ink);
}

/* ---------- cart ---------- */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 44px;
}

.cart-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cart-row {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.cart-row:last-of-type {
  border-bottom: 0;
}

.cart-thumb {
  width: 74px;
  height: 74px;
  border-radius: 12px;
  overflow: hidden;
  background: #f2ede6;
}

.cart-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-row-main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.cart-row-name {
  font-weight: 600;
  font-size: 0.94rem;
}

.cart-row-name:hover {
  color: var(--accent);
}

.cart-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.summary {
  align-self: start;
  position: sticky;
  top: 78px;
}

.summary h2 {
  margin-bottom: 14px;
}

.totals {
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
}

.totals > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.totals dt,
.totals dd {
  margin: 0;
}

.totals dd {
  font-weight: 600;
}

.totals .free {
  color: var(--ok);
}

.totals .grand {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: 1.02rem;
  font-weight: 700;
}

/* ---------- orders ---------- */
.order-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 44px;
}

.order-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.order-head h3 {
  margin: 0 0 2px;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  background: #f1ece5;
  color: var(--muted);
}

.status-pending {
  background: #fdf1e3;
  color: #9a5b1a;
}

.status-shipping {
  background: #e8f0fb;
  color: #1f4f8f;
}

.status-done {
  background: #e9f5ee;
  color: var(--ok);
}

.status-cancelled {
  background: #f7eaea;
  color: var(--danger);
}

.order-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.9rem;
}

.order-items li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.order-item-name {
  color: var(--ink);
}

.order-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.order-ship {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

.order-ship p {
  margin: 0 0 5px;
}

.success-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #eef6f0;
  border: 1px solid #d5e8db;
  border-radius: var(--radius);
  padding: 20px;
  margin: 18px 0;
}

.success-banner i {
  font-size: 2rem;
  color: var(--ok);
}

.success-banner h1 {
  margin: 0 0 4px;
  font-size: 1.3rem;
}

.success-banner p {
  margin: 0;
  font-size: 0.9rem;
}

.center-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 20px 0 44px;
}

/* ---------- admin ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.admin-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 44px;
}

.admin-row {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.admin-row:last-child {
  border-bottom: 0;
}

.admin-thumb {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  overflow: hidden;
  background: #f2ede6;
  display: grid;
  place-items: center;
  color: #c3b9ac;
  font-size: 0.9rem;
}

.admin-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-row-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-row-main strong {
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  background: #f6f1ea;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 18px;
  padding-bottom: 18px;
  font-size: 0.84rem;
  color: var(--muted);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  width: 100%;
  padding-bottom: 20px;
}

/* ---------- responsive ---------- */
@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 18px;
  }

  .detail {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 30px;
    align-items: start;
  }

  .cart-row {
    grid-template-columns: 88px 1fr auto;
  }

  .cart-thumb {
    width: 88px;
    height: 88px;
  }

  .admin-row {
    grid-template-columns: 46px 1fr auto auto;
  }

  .admin-row-actions {
    grid-column: auto;
  }

  .hero {
    padding: 40px;
  }
}

@media (min-width: 768px) {
  .toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .search-inline {
    min-width: 320px;
  }
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
  }

  .detail {
    grid-template-columns: 1fr 1fr;
    gap: 48px;
  }

  .cart-layout {
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
    gap: 24px;
    align-items: start;
  }

  .admin-layout {
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.35fr);
    gap: 24px;
    align-items: start;
  }

  .hero {
    padding: 52px;
  }

  body {
    font-size: 16px;
  }
}

@media (max-width: 560px) {
  .nav-link span:not(.badge) {
    display: none;
  }

  .nav-link {
    padding: 9px 11px;
  }

  .nav-link i {
    font-size: 1rem;
  }

  .hero {
    padding: 24px 20px;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

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

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

  .summary {
    position: static;
  }
}
