:root {
  --bg: #0b0f14;
  --surface: #141a22;
  --surface-2: #1b232e;
  --border: #26303c;
  --text: #e7ecf2;
  --muted: #9aa7b6;
  --brand: #e63946;
  --brand-2: #1d3557;
  --accent: #2a9d8f;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,15,20,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .bar { display: flex; align-items: center; gap: 22px; height: 66px; }
.brand img { height: 34px; }
.main-nav { display: flex; gap: 18px; margin-left: 8px; flex-wrap: wrap; }
.main-nav a { color: var(--muted); font-weight: 600; font-size: .95rem; }
.main-nav a:hover { color: var(--text); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.cart-link { position: relative; font-weight: 700; }
.cart-count {
  position: absolute; top: -10px; right: -14px;
  background: var(--brand); color: #fff; font-size: .72rem;
  min-width: 19px; height: 19px; border-radius: 19px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: #fff; border: 0; cursor: pointer;
  padding: 12px 20px; border-radius: 10px; font-weight: 700; font-size: .95rem;
  transition: transform .05s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface-2); border: 1px solid var(--border); }
.btn.ghost { background: transparent; border: 1px solid var(--border); }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 14px; font-size: .85rem; }
.btn.danger { background: #b3261e; }

/* Hero */
.hero {
  background: radial-gradient(1100px 500px at 20% -10%, rgba(230,57,70,.25), transparent 60%),
              linear-gradient(160deg, var(--brand-2), var(--bg));
  border-bottom: 1px solid var(--border);
}
.hero .inner { padding: 72px 0; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.08; margin: 0 0 14px; }
.hero p { font-size: 1.15rem; color: #d7deea; max-width: 540px; }
.hero .cta { display: flex; gap: 14px; margin-top: 26px; flex-wrap: wrap; }
.hero-art { display: flex; justify-content: center; }
.hero-art img { width: min(360px, 80%); filter: drop-shadow(0 24px 40px rgba(0,0,0,.5)); border-radius: 24px; }

/* Sections */
.section { padding: 56px 0; }
.section h2 { font-size: 1.7rem; margin: 0 0 6px; }
.section .sub { color: var(--muted); margin: 0 0 26px; }
.section-head { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom: 24px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }

/* Product grid */
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-4px); border-color: #38465a; }
.card .thumb { aspect-ratio: 1 / 1; background: var(--surface-2); position: relative; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.badge {
  position: absolute; top: 10px; left: 10px; background: var(--brand);
  color: #fff; font-size: .72rem; font-weight: 700; padding: 4px 9px; border-radius: 999px;
}
.badge.sale { background: var(--accent); }
.card .body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .cat { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
.card h3 { font-size: 1.02rem; margin: 0; }
.card .price { margin-top: auto; font-weight: 800; font-size: 1.1rem; }
.card .price .was { color: var(--muted); font-weight: 500; text-decoration: line-through; font-size: .9rem; margin-left: 6px; }
.card .actions { margin-top: 10px; }

/* Product detail */
.product { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; padding: 40px 0; }
.product .media img { border-radius: var(--radius); border: 1px solid var(--border); width: 100%; }
.gallery { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.gallery img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; }
.product h1 { margin: 6px 0 8px; font-size: 2rem; }
.price-lg { font-size: 1.8rem; font-weight: 800; }
.price-lg .was { color: var(--muted); font-weight: 500; text-decoration: line-through; font-size: 1.1rem; margin-left: 10px; }
.qty { display: flex; align-items: center; gap: 10px; margin: 18px 0; }
.qty input { width: 70px; }
.stock-ok { color: var(--accent); font-weight: 600; }
.stock-low { color: #e9c46a; font-weight: 600; }
.stock-out { color: var(--brand); font-weight: 700; }
.prose { color: #d7deea; }
.prose p { margin: 0 0 12px; }

/* Forms */
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .92rem; }
input, textarea, select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 11px 13px; font-size: .95rem; font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); border-color: transparent; }
textarea { min-height: 110px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkbox-row { display:flex; align-items:center; gap:10px; }
.checkbox-row input { width:auto; }
.checkbox-row label { margin: 0; }

/* Breadcrumb */
.crumbs { display: flex; gap: 8px; color: var(--muted); font-size: .85rem; padding: 18px 0 0; flex-wrap: wrap; }
.crumbs a:hover { color: var(--text); }

/* Cart */
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td { padding: 14px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.cart-table img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.cart-summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.cart-summary .row { display: flex; justify-content: space-between; margin: 8px 0; }
.cart-summary .total { font-size: 1.3rem; font-weight: 800; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.layout-2 { display: grid; grid-template-columns: 1.6fr .9fr; gap: 30px; align-items: start; }

/* Flash / notices */
.notice { padding: 12px 16px; border-radius: 10px; margin: 16px 0; border: 1px solid var(--border); }
.notice.success { background: rgba(42,157,143,.12); border-color: var(--accent); }
.notice.error { background: rgba(230,57,70,.12); border-color: var(--brand); }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 60px; }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; padding: 50px 0 30px; }
.site-footer h4 { margin: 0 0 12px; font-size: .95rem; }
.site-footer a { display: block; color: var(--muted); padding: 4px 0; }
.site-footer a:hover { color: var(--text); }
.site-footer .legal { border-top: 1px solid var(--border); padding: 18px 0; color: var(--muted); font-size: .85rem; display:flex; justify-content:space-between; flex-wrap: wrap; gap: 10px; }

/* Admin */
.admin-shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.admin-side { background: var(--surface); border-right: 1px solid var(--border); padding: 22px 16px; }
.admin-side .brand { margin-bottom: 24px; }
.admin-side nav a { display:block; padding: 10px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.admin-side nav a:hover, .admin-side nav a.active { background: var(--surface-2); color: var(--text); }
.admin-main { padding: 28px 32px; }
.admin-topbar { display:flex; justify-content: space-between; align-items:center; margin-bottom: 24px; }
.stat-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 18px; margin-bottom: 30px; }
.stat { background: var(--surface); border:1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat .k { color: var(--muted); font-size: .85rem; }
.stat .v { font-size: 1.9rem; font-weight: 800; margin-top: 6px; }
.table { width:100%; border-collapse: collapse; background: var(--surface); border:1px solid var(--border); border-radius: var(--radius); overflow:hidden; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: .92rem; }
.table th { background: var(--surface-2); color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.table img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.table .row-actions { display:flex; gap:8px; }
.pill { padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.pill.on { background: rgba(42,157,143,.16); color: var(--accent); }
.pill.off { background: rgba(154,167,182,.16); color: var(--muted); }
.pill.paid { background: rgba(42,157,143,.16); color: var(--accent); }
.pill.pending { background: rgba(233,196,106,.16); color: #e9c46a; }
.login-wrap { max-width: 380px; margin: 10vh auto; }
.card-pad { background: var(--surface); border:1px solid var(--border); border-radius: var(--radius); padding: 26px; }
.bars { display:flex; align-items:flex-end; gap: 8px; height: 160px; padding-top: 10px; }
.bars .bar { flex:1; background: linear-gradient(var(--brand), var(--brand-2)); border-radius: 6px 6px 0 0; min-height: 3px; position: relative; }
.bars .bar span { position:absolute; bottom:-22px; left:0; right:0; text-align:center; font-size:.7rem; color:var(--muted); }

@media (max-width: 900px) {
  .hero .inner, .product, .layout-2, .site-footer .cols { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { border-right: 0; border-bottom: 1px solid var(--border); }
  .field-row { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
}
