:root {
  --bg: #0c0c0d;
  --surface: #151516;
  --surface-2: #1d1d1f;
  --surface-3: #252528;
  --text: #f7f3ea;
  --muted: #b7b1a5;
  --line: rgba(255, 255, 255, 0.10);
  --gold: #d7ad62;
  --gold-2: #f2d49c;
  --danger: #e06c75;
  --success: #68c98e;
  --warning: #e9b75d;
  --shadow: 0 24px 70px rgba(0,0,0,.32);
  --radius: 18px;
  --max: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 80% 0%, rgba(215,173,98,.08), transparent 34%), var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { max-width: 100%; display: block; }

.shell { min-height: 100vh; }
.header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(18px);
  background: rgba(12,12,13,.82);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 76px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(215,173,98,.7);
  display: grid; place-items: center;
  color: var(--gold-2); font-family: 'Playfair Display'; font-size: 23px;
  box-shadow: inset 0 0 0 4px rgba(215,173,98,.06);
}
.brand-name { font-family: 'Playfair Display'; letter-spacing: .13em; font-size: 18px; }
.nav-actions { display: flex; gap: 10px; align-items: center; }

.container { max-width: var(--max); margin: 0 auto; padding: 34px 22px 70px; }
.hero { padding: 42px 0 28px; }
.eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: .18em; font-size: 12px; font-weight: 700; }
h1,h2,h3 { margin-top: 0; }
h1 { font-family: 'Playfair Display'; font-size: clamp(40px, 6vw, 72px); line-height: .98; margin-bottom: 18px; }
.hero p { color: var(--muted); max-width: 680px; font-size: 18px; line-height: 1.7; }

.btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 15px;
  transition: .18s ease;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(215,173,98,.55); }
.btn-primary { background: linear-gradient(135deg, var(--gold), #b9883b); color: #19140d; border-color: transparent; font-weight: 800; }
.btn-danger { border-color: rgba(224,108,117,.4); color: #ffb8be; }
.btn-ghost { background: transparent; }
.btn-small { padding: 8px 10px; font-size: 13px; }
.icon-btn { width: 42px; height: 42px; padding: 0; display: grid; place-items: center; border-radius: 50%; }

.search-panel {
  background: rgba(21,21,22,.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.search-primary { margin-bottom: 12px; }
.search-primary .field { min-height: 52px; font-size: 16px; }
.filters-panel { border: 0; }
.filters-summary { display: none; }
.filter-grid { display: grid; grid-template-columns: repeat(3, minmax(140px, 1fr)); gap: 12px; }
.field, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #101011;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
.field:focus, .select:focus, .textarea:focus { border-color: rgba(215,173,98,.75); box-shadow: 0 0 0 3px rgba(215,173,98,.08); }
.textarea { min-height: 120px; resize: vertical; }
.label { display: block; color: var(--muted); font-size: 13px; margin: 0 0 7px; }
.filter-actions { display:flex; gap:10px; margin-top:12px; flex-wrap:wrap; }

.catalog-meta { display: flex; justify-content: space-between; gap: 18px; align-items: baseline; margin-bottom: 18px; }
.catalog-meta p { color: var(--muted); margin: 0; }
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.product-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease;
  cursor: pointer;
}
.product-card:hover { transform: translateY(-4px); border-color: rgba(215,173,98,.42); }
.product-image-wrap { aspect-ratio: 4/5; background: var(--surface-3); overflow:hidden; }
.product-image { width:100%; height:100%; object-fit:cover; transition: transform .35s ease; }
.product-card:hover .product-image { transform: scale(1.025); }
.product-placeholder { width:100%; height:100%; display:grid; place-items:center; color:#777; background: linear-gradient(145deg,#242426,#151516); }
.product-body { padding: 16px; }
.product-title { margin: 0 0 7px; font-size: 16px; }
.product-sub { color: var(--muted); font-size: 13px; min-height: 18px; }
.product-price { margin-top: 12px; font-weight: 800; color: var(--gold-2); font-size: 18px; }

.empty, .error-box, .loading {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 34px;
  text-align: center;
  color: var(--muted);
}
.error-box { border-color: rgba(224,108,117,.45); color: #ffc2c6; background: rgba(224,108,117,.06); }
.debug-detail { margin-top: 12px; font-family: ui-monospace, monospace; font-size: 12px; color: #e6b6ba; word-break: break-word; }

.detail-top { display:flex; justify-content:space-between; align-items:center; gap:14px; margin-bottom: 22px; }
.back-link { background:none; border:0; color: var(--muted); padding: 0; }
.back-link:hover { color: var(--gold-2); }
.product-detail { display:grid; grid-template-columns:minmax(0,1.18fr) minmax(340px,.82fr); gap:36px; }
.gallery-main { aspect-ratio: 4/5; border-radius: 20px; overflow:hidden; background:var(--surface-2); border:1px solid var(--line); cursor:zoom-in; }
.gallery-main img { width:100%; height:100%; object-fit:contain; background:#0d0d0e; }
.thumbs { display:grid; grid-template-columns: repeat(5,1fr); gap:10px; margin-top:10px; }
.thumb { aspect-ratio:1; border:1px solid var(--line); border-radius:10px; overflow:hidden; padding:0; background:var(--surface-2); }
.thumb.active { border-color:var(--gold); }
.thumb img { width:100%; height:100%; object-fit:cover; }
.detail-panel { position:sticky; top:110px; align-self:start; }
.detail-panel h1 { font-size: clamp(34px, 4vw, 54px); }
.detail-price { font-size:28px; font-weight:800; color:var(--gold-2); margin-bottom:18px; }
.detail-description { color:var(--muted); line-height:1.75; white-space:pre-wrap; }
.detail-list { display:grid; gap:10px; margin:24px 0; }
.detail-item { display:flex; justify-content:space-between; gap:20px; padding:12px 0; border-bottom:1px solid var(--line); }
.detail-item span:first-child { color:var(--muted); }

.lightbox {
  position:fixed; inset:0; z-index:100;
  background:rgba(0,0,0,.94);
  display:grid; grid-template-columns:70px 1fr 70px;
  align-items:center;
}
.lightbox-stage { min-width:0; height:100vh; display:grid; place-items:center; padding:28px 0; }
.lightbox-stage img { max-width:100%; max-height:92vh; object-fit:contain; }
.lightbox-close { position:absolute; top:18px; right:18px; }
.lightbox-count { position:absolute; bottom:18px; left:50%; transform:translateX(-50%); color:#ccc; font-size:13px; }

.admin-layout { display:grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 77px); }
.admin-sidebar { border-right:1px solid var(--line); padding:26px 18px; background:#101011; }
.admin-sidebar h3 { font-family:'Playfair Display'; }
.admin-menu { display:grid; gap:8px; }
.admin-content { padding:30px; min-width:0; }
.admin-title-row { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:22px; }
.admin-table-wrap { overflow:auto; border:1px solid var(--line); border-radius:16px; }
.admin-table { width:100%; border-collapse:collapse; min-width:820px; }
.admin-table th, .admin-table td { padding:13px 14px; border-bottom:1px solid var(--line); text-align:left; vertical-align:middle; }
.admin-table th { color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.08em; }
.admin-thumb { width:54px; height:64px; border-radius:8px; object-fit:cover; background:var(--surface-3); }
.badge { display:inline-flex; align-items:center; border:1px solid var(--line); border-radius:999px; padding:5px 9px; font-size:12px; }
.badge-active { color:#a7e9bd; border-color:rgba(104,201,142,.35); background:rgba(104,201,142,.08); }
.badge-off { color:#d7b0b3; }

.form-card { border:1px solid var(--line); background:var(--surface); border-radius:18px; padding:22px; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.form-grid .full { grid-column:1/-1; }
.checkbox-row { display:flex; align-items:center; gap:10px; }
.form-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:18px; flex-wrap:wrap; }

.image-manager { margin-top:24px; border-top:1px solid var(--line); padding-top:22px; }
.image-manager-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.admin-image-card { border:1px solid var(--line); border-radius:14px; overflow:hidden; background:var(--surface-2); }
.admin-image-card img { aspect-ratio:1; width:100%; object-fit:cover; }
.admin-image-controls { display:flex; gap:6px; padding:9px; flex-wrap:wrap; }
.upload-box { border:1px dashed rgba(215,173,98,.42); border-radius:14px; padding:18px; margin:14px 0; }

.login-wrap { min-height:calc(100vh - 77px); display:grid; place-items:center; padding:32px 20px; }
.login-card { width:min(440px,100%); border:1px solid var(--line); background:var(--surface); border-radius:22px; padding:28px; box-shadow:var(--shadow); }
.login-card h1 { font-size:38px; }
.login-card form { display:grid; gap:14px; }

.toast-root { position:fixed; right:18px; bottom:18px; z-index:130; display:grid; gap:10px; }
.toast { width:min(390px, calc(100vw - 36px)); background:#19191b; border:1px solid var(--line); border-radius:13px; padding:13px 15px; box-shadow:var(--shadow); }
.toast.success { border-color:rgba(104,201,142,.35); }
.toast.error { border-color:rgba(224,108,117,.45); }
.toast .code { display:block; margin-top:4px; color:var(--muted); font-size:11px; font-family:ui-monospace,monospace; }

.debug-ribbon { position:fixed; left:12px; bottom:12px; z-index:80; font-size:10px; letter-spacing:.08em; text-transform:uppercase; color:#d7b36f; opacity:.8; }

@media (max-width: 980px) {
  .product-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .filter-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .product-detail { grid-template-columns:1fr; }
  .detail-panel { position:static; }
  .admin-layout { grid-template-columns:1fr; }
  .admin-sidebar { border-right:0; border-bottom:1px solid var(--line); }
  .image-manager-grid { grid-template-columns:repeat(3,1fr); }
}
@media (max-width: 680px) {
  .header-inner { min-height:68px; padding:0 14px; }
  .container { padding:24px 14px 54px; }
  .hero { padding-top:26px; }
  .product-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .product-body { padding:12px; }
  .search-panel { padding:12px; }
  .search-primary { margin-bottom:0; }
  .search-primary .field { min-height:54px; }
  .filters-panel { margin-top:10px; border-top:1px solid var(--line); }
  .filters-summary {
    display:flex;
    align-items:center;
    gap:8px;
    padding:13px 2px 4px;
    color:var(--gold-2);
    font-weight:700;
    list-style:none;
    cursor:pointer;
  }
  .filters-summary::-webkit-details-marker { display:none; }
  .filters-summary span { margin-left:auto; color:var(--muted); font-size:12px; font-weight:500; }
  .filters-summary::after { content:'⌄'; color:var(--muted); font-size:18px; transition:transform .18s ease; }
  .filters-panel[open] .filters-summary::after { transform:rotate(180deg); }
  .filter-grid { grid-template-columns:1fr; padding-top:10px; }
  .form-grid { grid-template-columns:1fr; }
  .form-grid .full { grid-column:auto; }
  .admin-content { padding:20px 14px; }
  .image-manager-grid { grid-template-columns:repeat(2,1fr); }
  .thumbs { grid-template-columns:repeat(4,1fr); }
  .lightbox { grid-template-columns:48px 1fr 48px; }
  .brand-name { display:none; }
}
