:root {
  --ink: #12141a;
  --ink-soft: #4b4f5a;
  --line: #e4e5e9;
  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --accent: #d3ff33;
  --accent-ink: #12141a;
  --danger: #e0403a;
  --success: #1e8e5a;
  --radius: 10px;
  --max: 1240px;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Helvetica Neue", Arial, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
}

.site-header .bar {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 68px;
}

.logo {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.logo span { color: var(--accent-ink); background: var(--accent); padding: 0 6px; border-radius: 4px; }

.main-nav { display: flex; gap: 20px; flex: 1; flex-wrap: wrap; }
.main-nav a { font-weight: 600; font-size: 0.95rem; color: var(--ink-soft); }
.main-nav a:hover { color: var(--ink); }

.header-actions { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.header-actions a { font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 6px; }

.cart-badge {
  background: var(--ink);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  min-width: 18px;
  text-align: center;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius);
  padding: 12px 22px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform .06s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { opacity: 0.85; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { opacity: 0.85; }
.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-outline:hover { border-color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Hero ---------- */

.hero {
  background: var(--ink);
  color: #fff;
  padding: 72px 0;
  margin-bottom: 48px;
}
.hero .wrap { display: flex; flex-direction: column; gap: 18px; max-width: 640px; }
.hero h1 { font-size: 2.6rem; margin: 0; line-height: 1.1; letter-spacing: -0.02em; }
.hero p { font-size: 1.05rem; color: #cfd1d8; margin: 0; }

/* ---------- Sections ---------- */

section { margin-bottom: 56px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.section-head h2 { font-size: 1.4rem; margin: 0; }
.section-head a { font-weight: 600; font-size: 0.9rem; color: var(--ink-soft); }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.cat-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4/3;
  background: var(--bg-soft);
  display: flex;
  align-items: flex-end;
  padding: 16px;
}
.cat-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cat-card span {
  position: relative; z-index: 1; color: #fff; font-weight: 700; font-size: 1.1rem;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.cat-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.55) 100%);
}

/* ---------- Product grid / card ---------- */

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }

.product-card { display: flex; flex-direction: column; gap: 8px; }
.product-card .thumb {
  aspect-ratio: 3/4; background: var(--bg-soft); border-radius: var(--radius);
  overflow: hidden; position: relative;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .badge {
  position: absolute; top: 10px; left: 10px; background: var(--danger); color: #fff;
  font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 4px;
}
.product-card h3 { font-size: 0.95rem; margin: 0; font-weight: 600; }
.product-card .cat { font-size: 0.78rem; color: var(--ink-soft); }
.product-card .price { font-weight: 800; font-size: 1.05rem; }
.product-card .swatches { display: flex; gap: 5px; margin-top: 2px; }
.swatch-dot { width: 13px; height: 13px; border-radius: 50%; border: 1px solid var(--line); }

/* ---------- Filters ---------- */

.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 24px; }
.filter-bar select {
  border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 12px; font-size: 0.9rem;
  font-family: inherit; background: #fff;
}

/* ---------- Product detail ---------- */

.product-detail { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; }
.product-gallery-main { aspect-ratio: 3/4; background: var(--bg-soft); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
.product-gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.product-thumbs { display: flex; gap: 8px; }
.product-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 1.5px solid var(--line); }
.product-thumbs img.active { border-color: var(--ink); }

.product-info h1 { font-size: 1.7rem; margin: 0 0 6px; }
.product-info .cat-link { color: var(--ink-soft); font-size: 0.9rem; font-weight: 600; }
.product-info .price { font-size: 1.6rem; font-weight: 800; margin: 14px 0; }
.option-group { margin-bottom: 20px; }
.option-group label.title { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 8px; }
.opt-list { display: flex; gap: 8px; flex-wrap: wrap; }
.opt-btn {
  border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 16px; font-weight: 600;
  font-size: 0.88rem; background: #fff; cursor: pointer;
}
.opt-btn.selected { border-color: var(--ink); background: var(--ink); color: #fff; }
.opt-btn[disabled] { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }
.stock-msg { font-size: 0.85rem; margin-bottom: 16px; }
.stock-msg.ok { color: var(--success); }
.stock-msg.low { color: #b8860b; }
.stock-msg.out { color: var(--danger); }
.qty-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.qty-stepper { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 8px; }
.qty-stepper button { border: none; background: none; width: 36px; height: 38px; font-size: 1.1rem; cursor: pointer; }
.qty-stepper input { width: 40px; text-align: center; border: none; font-size: 1rem; }
.product-desc { margin-top: 28px; color: var(--ink-soft); white-space: pre-line; line-height: 1.7; }

/* ---------- Cart ---------- */

.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 40px; align-items: start; }
.cart-line { display: grid; grid-template-columns: 84px 1fr auto; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.cart-line img { width: 84px; height: 100px; object-fit: cover; border-radius: 8px; background: var(--bg-soft); }
.cart-line .meta { font-size: 0.8rem; color: var(--ink-soft); }
.cart-line .row-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.cart-line .remove-link { color: var(--danger); font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.cart-line .line-total { font-weight: 700; text-align: right; }

.summary-box { background: var(--bg-soft); border-radius: var(--radius); padding: 22px; position: sticky; top: 90px; }
.summary-row { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 0.92rem; }
.summary-row.total { font-size: 1.15rem; font-weight: 800; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.summary-row .muted { color: var(--ink-soft); }
.empty-state { text-align: center; padding: 60px 0; color: var(--ink-soft); }

/* ---------- Forms ---------- */

.form-card { max-width: 440px; margin: 60px auto; background: #fff; }
.form-card h1 { font-size: 1.5rem; margin-bottom: 6px; }
.form-card .sub { color: var(--ink-soft); margin-bottom: 26px; font-size: 0.92rem; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 8px;
  font-size: 0.95rem; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 0.88rem; margin-bottom: 16px; }
.alert-error { background: #fdeceb; color: var(--danger); }
.alert-success { background: #e9f7ef; color: var(--success); }

.foot-link { text-align: center; margin-top: 18px; font-size: 0.9rem; color: var(--ink-soft); }
.foot-link a { font-weight: 700; color: var(--ink); }

/* ---------- Address / order cards ---------- */

.card-list { display: flex; flex-direction: column; gap: 12px; }
.mini-card { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; }
.mini-card .top-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tag { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg-soft); }
.tag.status-pending { background: #fff3cd; color: #8a6d00; }
.tag.status-paid { background: #e9f7ef; color: var(--success); }
.tag.status-preparing { background: #e3ecff; color: #2952cc; }
.tag.status-shipped { background: #e3ecff; color: #2952cc; }
.tag.status-delivered { background: #e9f7ef; color: var(--success); }
.tag.status-cancelled { background: #fdeceb; color: var(--danger); }

/* ---------- Account / Admin shell ---------- */

.dash-layout { display: grid; grid-template-columns: 220px 1fr; gap: 40px; align-items: start; }
.side-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 90px; }
.side-nav a { padding: 10px 14px; border-radius: 8px; font-weight: 600; font-size: 0.9rem; color: var(--ink-soft); }
.side-nav a:hover { background: var(--bg-soft); }
.side-nav a.active { background: var(--ink); color: #fff; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 30px; }
.stat-box { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat-box .num { font-size: 1.6rem; font-weight: 800; }
.stat-box .lbl { font-size: 0.82rem; color: var(--ink-soft); }

table.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data-table th { text-align: left; color: var(--ink-soft); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1.5px solid var(--line); }
table.data-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data-table tr:hover td { background: var(--bg-soft); }
.table-wrap { overflow-x: auto; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.toolbar h1 { margin: 0; font-size: 1.4rem; }

.variant-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.variant-row .sku { font-size: 0.75rem; color: var(--ink-soft); }

.img-thumb-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.img-thumb { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-thumb button { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 0.7rem; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); margin-top: 80px; padding: 40px 0; color: var(--ink-soft); font-size: 0.85rem; }
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ---------- Utility ---------- */

.muted { color: var(--ink-soft); }
.center { text-align: center; }
.loading { text-align: center; padding: 60px 0; color: var(--ink-soft); }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .product-detail, .cart-layout, .dash-layout { grid-template-columns: 1fr; }
  .side-nav { flex-direction: row; overflow-x: auto; position: static; }
  .main-nav { display: none; }
  .hero h1 { font-size: 2rem; }
}
