:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --danger: #dc2626;
  --ok: #059669;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 16px; }
.nav { display: flex; gap: 6px; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a:hover, .nav a.active { background: #eef2ff; color: var(--accent); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; }

main { padding-top: 28px; padding-bottom: 48px; min-height: 70vh; }
.page-title { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--muted); margin-bottom: 20px; }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-small { padding: 7px 12px; font-size: 14px; }
.btn-ghost { background: #eef2ff; color: var(--accent); }
.btn-ghost:hover { background: #e0e7ff; }
.btn-block { width: 100%; }
.icon-btn { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 16px; cursor: pointer; }
.icon-btn:hover { border-color: #cbd5e1; color: var(--text); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; font-weight: 600; }
.field input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
.field input:focus, .search:focus { outline: 2px solid #c7d2fe; border-color: var(--accent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Shop */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.search { flex: 1 1 240px; max-width: 360px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: inherit; font-size: 14px; cursor: pointer; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.product-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow 0.15s, transform 0.15s; }
.product-card:hover { box-shadow: 0 8px 24px rgba(17, 24, 39, 0.08); transform: translateY(-2px); }
.product-art { display: grid; place-items: center; height: 150px; background: var(--tint, #eef2ff); font-size: 64px; }
.product-body { padding: 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product-category { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.product-name { font-size: 16px; font-weight: 600; }
.product-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; }
.price { font-weight: 700; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty .btn { margin-top: 14px; }

/* Product page */
.back { display: inline-block; margin-bottom: 16px; color: var(--muted); }
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.detail-art { display: grid; place-items: center; min-height: 280px; border-radius: 10px; background: var(--tint, #eef2ff); font-size: 120px; }
.detail-info { display: flex; flex-direction: column; gap: 12px; }
.detail-info h1 { font-size: 28px; }
.detail-price { font-size: 24px; font-weight: 700; }
.detail-actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }

/* Quantity stepper */
.qty { display: inline-flex; align-items: center; gap: 8px; }
.qty-value { min-width: 24px; text-align: center; font-weight: 600; }

/* Cart and checkout */
.layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel h2 { font-size: 18px; margin-bottom: 12px; }
.cart-list { list-style: none; margin: 0; padding: 0; }
.cart-row { display: grid; grid-template-columns: 44px 1fr auto 70px 32px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-row:last-child { border-bottom: 0; }
.cart-emoji { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--tint, #eef2ff); font-size: 24px; }
.cart-name { font-weight: 600; display: block; }
.line-total { text-align: right; font-weight: 600; }
.summary-line { display: flex; justify-content: space-between; padding: 6px 0; }
.summary-line.total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; font-size: 18px; font-weight: 700; }
.notice { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #f0fdf4; color: #166534; font-size: 14px; }
.form-error { margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; background: #fef2f2; color: var(--danger); font-size: 14px; }
.form-error ul { margin: 0; padding-left: 18px; }

/* Orders */
.confirmation { text-align: center; padding: 28px 20px; }
.confirmation .tick { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; background: #d1fae5; color: var(--ok); font-size: 28px; }
.order-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.order-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.order-id { font-weight: 700; }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #e0e7ff; color: var(--accent); font-size: 13px; font-weight: 600; }
.order-items { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }

.site-footer { padding: 20px 0 32px; color: var(--muted); font-size: 14px; text-align: center; }

@media (max-width: 760px) {
  .detail, .layout { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .cart-row { grid-template-columns: 44px 1fr auto 32px; }
  .line-total { display: none; }
}
