:root {
  --ink: #1C1A17;
  --cream: #F7F3EC;
  --terracotta: #C75D3B;
  --sauge: #3F5C4E;
  --muted: #8A8370;
  --border: #E5E0D5;
  --white: #FFFFFF;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Public Sans', Arial, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select {
  font-family: inherit;
  font-size: 13.5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  background: var(--white);
  color: var(--ink);
}
input::placeholder, textarea::placeholder { color: #B5AFA0; }
table { border-collapse: collapse; width: 100%; }
img { max-width: 100%; display: block; }

/* ---------------------------------- NAV ---------------------------------- */

.nav {
  border-bottom: 1px solid var(--border);
  background: var(--cream);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font-family: Georgia, serif;
  font-size: 15px;
}
.brand-name { font-family: Georgia, 'Times New Roman', serif; font-size: 18px; }
.nav-links { display: flex; gap: 4px; flex: 1; justify-content: center; }
.nav-link {
  background: none; border: none; color: var(--muted);
  font-size: 13px; padding: 8px 16px; border-radius: 100px;
  display: inline-flex; align-items: center; gap: 6px;
}
.nav-link:hover { color: var(--ink); }
.nav-link.active { background: var(--ink); color: var(--cream); }
.cart-btn {
  position: relative; background: none; border: 1px solid var(--border);
  border-radius: 100px; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
}
.cart-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--terracotta); color: white;
  font-size: 10px; font-weight: 700; width: 17px; height: 17px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

/* --------------------------------- LAYOUT --------------------------------- */

.main { max-width: 1180px; margin: 0 auto; padding: 0 24px 64px; }
.main-narrow { max-width: 1100px; margin: 0 auto; padding: 28px 24px 72px; }

.hero {
  padding: 56px 0 40px; max-width: 620px;
  border-bottom: 1px solid var(--border); margin-bottom: 32px;
}
.hero h1 { font-family: Georgia, serif; font-size: 34px; line-height: 1.25; margin: 0 0 14px; font-weight: 400; }
.hero p { color: var(--muted); font-size: 14.5px; margin: 0; }

/* -------------------------------- TOOLBAR --------------------------------- */

.toolbar { display: flex; flex-direction: column; gap: 16px; margin-bottom: 28px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 100px;
  padding: 8px 16px; max-width: 320px; background: var(--white);
}
.search-box input { border: none; outline: none; flex: 1; padding: 0; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 100px; padding: 7px 16px; font-size: 12.5px; color: var(--ink);
}
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--cream); }

/* ---------------------------------- GRID ---------------------------------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 28px;
}
.product-card-link { display: block; }
.product-img-wrap {
  position: relative; aspect-ratio: 4/5; overflow: hidden;
  background: #EDE8DC; border-radius: 6px; margin-bottom: 12px;
}
.product-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.product-card-link:hover img { transform: scale(1.03); }
.like-btn {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(247,243,236,0.92); border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.out-badge {
  position: absolute; bottom: 10px; left: 10px;
  background: var(--ink); color: var(--cream);
  font-size: 10.5px; padding: 4px 10px; border-radius: 4px; letter-spacing: .03em;
}
.product-top-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.product-category { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.product-rating { font-size: 11px; color: var(--muted); }
.product-name { font-family: Georgia, serif; font-size: 16px; margin: 0 0 4px; font-weight: 400; }
.product-price { font-size: 13.5px; margin: 0; font-family: 'Courier New', monospace; }

.empty-state { text-align: center; padding: 60px 0; }
.empty-state h2 { font-family: Georgia, serif; font-size: 18px; margin: 0 0 6px; }
.empty-state p { color: var(--muted); font-size: 13.5px; margin: 0; }

/* -------------------------------- PRODUCT DETAIL --------------------------- */

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.detail-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; margin-bottom: 56px; }
.detail-img-wrap { position: relative; aspect-ratio: 4/5; background: #EDE8DC; border-radius: 8px; overflow: hidden; }
.detail-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.thumb-row { display: flex; gap: 8px; margin-top: 10px; }
.thumb { width: 56px; height: 70px; border-radius: 4px; overflow: hidden; border: 1px solid var(--border); padding: 0; background: none; }
.thumb.active { border-color: var(--ink); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.detail-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.detail-title-row h1 { font-family: Georgia, serif; font-size: 26px; margin: 4px 0 8px; font-weight: 400; }
.like-btn-large {
  background: none; border: 1px solid var(--border); border-radius: 50%;
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 17px;
}
.detail-rating { display: flex; align-items: center; gap: 2px; margin-bottom: 14px; font-size: 13px; }
.detail-rating .stars { color: var(--ink); margin-right: 6px; }
.detail-price { font-size: 19px; font-family: 'Courier New', monospace; margin: 0 0 18px; }
.detail-desc { color: var(--muted); line-height: 1.65; margin: 0 0 14px; }
.detail-material { font-size: 13.5px; margin: 0 0 24px; }

.option-block { margin-bottom: 22px; }
.option-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .04em; }
.swatch-row { display: flex; gap: 10px; }
.swatch-link { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); display: inline-block; }
.swatch-link.active { outline: 2px solid var(--ink); }
.size-row { display: flex; gap: 8px; }
.size-btn {
  min-width: 44px; height: 40px; border: 1px solid var(--border);
  background: var(--white); border-radius: 4px; font-size: 13px;
}
.size-btn.active { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.size-btn:disabled { opacity: .3; text-decoration: line-through; cursor: not-allowed; }
.stock-line { font-size: 12.5px; margin: -10px 0 18px; }
.stock-ok { color: var(--sauge); }
.stock-low { color: var(--terracotta); }
.stock-out { color: var(--muted); }

.qty-stepper { display: flex; align-items: center; gap: 16px; border: 1px solid var(--border); border-radius: 4px; padding: 6px 16px; width: fit-content; background: var(--white); }
.qty-stepper button { background: none; border: none; font-size: 15px; width: 20px; }
.qty-stepper input { border: none; width: 24px; text-align: center; padding: 0; }

.btn-primary {
  width: 100%; background: var(--ink); color: var(--cream); border: none;
  border-radius: 4px; padding: 15px; font-size: 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary {
  background: var(--white); border: 1px solid var(--border); border-radius: 4px;
  padding: 12px; font-size: 13.5px; flex: 1;
}
.btn-danger {
  background: var(--white); color: #A33; border: 1px solid #E5BDBD;
  border-radius: 4px; padding: 10px 16px; font-size: 13px;
}
.btn-sauge {
  background: var(--sauge); color: white; border: none; border-radius: 4px;
  padding: 11px 18px; font-size: 13.5px;
}

/* --------------------------------- REVIEWS --------------------------------- */

.review-section { border-top: 1px solid var(--border); padding-top: 40px; max-width: 640px; }
.review-section h2 { font-family: Georgia, serif; font-size: 20px; display: flex; align-items: center; gap: 8px; margin: 0 0 24px; font-weight: 400; }
.review-form { background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 20px; margin-bottom: 28px; display: flex; flex-direction: column; gap: 12px; }
.review-form input, .review-form textarea { width: 100%; }
.star-input { display: flex; gap: 4px; }
.star-input button { background: none; border: none; font-size: 19px; color: var(--ink); padding: 2px; }
.review-list { display: flex; flex-direction: column; gap: 18px; }
.review-item { border-bottom: 1px solid var(--border); padding-bottom: 16px; }
.review-item-head { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 13.5px; }
.review-author { font-weight: 500; }
.review-date { font-size: 12px; color: var(--muted); }
.review-stars { font-size: 12px; margin-bottom: 6px; }
.review-comment { font-size: 13.5px; line-height: 1.55; margin: 0; color: #3D3A34; }

/* ---------------------------------- CART ----------------------------------- */

.cart-page { max-width: 720px; margin: 0 auto; padding: 28px 24px 72px; }
.cart-item { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.cart-item img { width: 64px; height: 80px; object-fit: cover; border-radius: 4px; background: #EDE8DC; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 13.5px; margin: 0 0 2px; font-weight: 500; }
.cart-item-meta { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.cart-item-row { display: flex; justify-content: space-between; align-items: center; }
.cart-item-price { font-size: 13px; font-family: 'Courier New', monospace; }
.qty-stepper-small { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 4px; padding: 4px 10px; background: var(--white); }
.qty-stepper-small button { background: none; border: none; font-size: 13px; }
.remove-link { background: none; border: none; color: var(--muted); align-self: flex-start; font-size: 13px; }

.cart-summary { padding-top: 20px; }
.summary-row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.summary-row.total { font-size: 16px; font-weight: 500; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.shipping-note { font-size: 12px; color: var(--muted); margin: 0 0 16px; }

.empty-cart { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 60px 24px; text-align: center; }

/* -------------------------------- CHECKOUT ---------------------------------- */

.checkout-page { max-width: 520px; margin: 0 auto; padding: 28px 24px 72px; }
.checkout-steps { display: flex; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 20px; }
.checkout-steps .active { color: var(--ink); font-weight: 500; }
.form-group { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.payment-note { font-size: 12.5px; background: var(--white); border: 1px solid var(--border); border-radius: 4px; padding: 10px 14px; margin: 0 0 16px; }
.recap-row { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; }
.recap-actions { display: flex; gap: 10px; margin-top: 10px; }

.confirm-box {
  max-width: 420px; margin: 60px auto; text-align: center;
  background: var(--white); border: 1px solid var(--border); border-radius: 10px;
  padding: 40px 36px;
}
.confirm-icon {
  width: 52px; height: 52px; border-radius: 50%; background: #E3ECE6;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px;
  font-size: 22px; color: var(--sauge);
}
.confirm-box h2 { font-family: Georgia, serif; font-size: 20px; margin: 0 0 10px; font-weight: 400; }
.confirm-box p { font-size: 13.5px; color: var(--muted); line-height: 1.6; margin: 0 0 6px; }
.confirm-ref { font-size: 11.5px; font-family: 'Courier New', monospace; color: var(--muted); margin: 0 0 20px; }

/* --------------------------------- ALERTS ----------------------------------- */

.alert { padding: 12px 16px; border-radius: 4px; font-size: 13px; margin-bottom: 20px; }
.alert-error { background: #FCEBEB; color: #A32D2D; border: 1px solid #F0B8B8; }
.alert-success { background: #EAF3DE; color: #3B6D11; border: 1px solid #C0DD97; }

/* ---------------------------------- ADMIN ----------------------------------- */

.admin-tabs { display: flex; gap: 8px; margin-bottom: 28px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.admin-tab { background: none; border: none; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; padding: 8px 4px; }
.admin-tab.active { color: var(--ink); font-weight: 500; border-bottom: 2px solid var(--terracotta); }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 24px; }
.metric-card { background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 16px; display: flex; gap: 12px; align-items: center; }
.metric-icon { width: 34px; height: 34px; border-radius: 50%; background: #E3ECE6; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 15px; }
.metric-label { font-size: 11.5px; color: var(--muted); margin: 0 0 2px; }
.metric-value { font-size: 19px; margin: 0; font-weight: 500; }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card { background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 18px; }
.chart-card h3 { font-size: 13px; font-weight: 500; margin: 0 0 14px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12.5px; }
.bar-label { width: 110px; flex-shrink: 0; color: var(--muted); text-align: right; }
.bar-track { flex: 1; background: #EDE8DC; border-radius: 3px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--sauge); border-radius: 3px; }
.bar-value { width: 36px; flex-shrink: 0; font-family: 'Courier New', monospace; }
.stock-alert-row { display: flex; justify-content: space-between; font-size: 13px; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }

.table-wrap { background: var(--white); border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; }
th { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--muted); font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:last-child td { border-bottom: none; }
.mono { font-family: 'Courier New', monospace; font-size: 12px; }
.status-pill { border: 1px solid; border-radius: 100px; padding: 3px 10px; font-size: 11.5px; display: inline-block; }

.catalog-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.catalog-header h2 { font-family: Georgia, serif; font-size: 19px; margin: 0; font-weight: 400; }
.btn-create {
  background: var(--ink); color: var(--cream); border: none; border-radius: 4px;
  padding: 10px 18px; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px;
}

.new-product-card { background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 20px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 14px; }
.admin-hint { font-size: 12px; color: var(--muted); margin: 0; }

.catalog-list { display: flex; flex-direction: column; gap: 10px; }
.catalog-row { background: var(--white); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.catalog-row-head { display: flex; align-items: center; gap: 14px; padding: 14px; }
.catalog-thumb { width: 44px; height: 56px; object-fit: cover; border-radius: 4px; background: #EDE8DC; flex-shrink: 0; }
.catalog-row-info { flex: 1; }
.catalog-row-name { font-size: 14px; font-weight: 500; margin: 0 0 2px; }
.pill-on { background: #E3ECE6; color: var(--sauge); font-size: 11px; padding: 3px 10px; border-radius: 100px; }
.pill-off { background: #F0EAE0; color: var(--muted); font-size: 11px; padding: 3px 10px; border-radius: 100px; }
.catalog-row-expanded { border-top: 1px solid var(--border); padding: 18px; display: flex; flex-direction: column; gap: 22px; background: #FCFAF5; }
.image-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.image-thumb-wrap { position: relative; width: 64px; height: 80px; }
.image-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
.image-remove-btn {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--ink); color: white; border: none;
  font-size: 10px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.image-upload-box {
  width: 64px; height: 80px; border: 1px dashed var(--border); border-radius: 4px;
  background: var(--white); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; font-size: 9.5px; color: var(--muted); text-align: center;
}
.stock-input { width: 56px; padding: 4px 8px; font-size: 12.5px; }

.admin-login-box {
  max-width: 360px; margin: 80px auto; background: var(--white);
  border: 1px solid var(--border); border-radius: 8px; padding: 32px;
}
.admin-login-box h1 { font-family: Georgia, serif; font-size: 20px; margin: 0 0 20px; font-weight: 400; text-align: center; }
.admin-login-box form { display: flex; flex-direction: column; gap: 14px; }
.admin-login-box input { width: 100%; }

@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; gap: 28px; }
  .charts-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
