:root, [data-theme="dark"] {
  --red: #E54424; --dark: #1A1A1A; --surface: #242424; --surface2: #2E2E2E;
  --surface3: #363636; --border: rgba(255,255,255,0.10); --border-active: rgba(229,68,36,0.5);
  --text: #F2F2F2; --text-muted: #9E9E9E; --text-dim: #B8B8B8; --white: #FFFFFF;
  --glow-r:229; --glow-g:68; --glow-b:36;
}
[data-theme="light"] {
  --red: #C43B1E; --dark: #F2F2F2; --surface: #FFFFFF; --surface2: #E8E8E8;
  --surface3: #DEDEDE; --border: rgba(0,0,0,0.08); --border-active: rgba(212,46,6,0.4);
  --text: #1A1A1A; --text-muted: #6B6B6B; --text-dim: #505050; --white: #FFFFFF;
  --glow-r:212; --glow-g:46; --glow-b:6;
}

* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:'DM Sans',sans-serif; background:var(--dark); color:var(--text); min-height:100vh; overflow-x:hidden; }
body::before {
  content:''; position:fixed; inset:0; pointer-events:none; z-index:0;
  background: radial-gradient(ellipse 60% 40% at 80% 10%, rgba(var(--glow-r),var(--glow-g),var(--glow-b),0.06) 0%, transparent 60%),
              radial-gradient(ellipse 40% 60% at 10% 80%, rgba(var(--glow-r),var(--glow-g),var(--glow-b),0.04) 0%, transparent 50%);
}
.wrap { position:relative; z-index:1; max-width:1280px; margin:0 auto; padding:0 24px 80px; }

/* ── Topbar ── */
.topbar { display:flex; align-items:center; justify-content:space-between; padding:20px 0 32px; border-bottom:1px solid var(--border); margin-bottom:40px; }
.logo { font-family:'Syne',sans-serif; font-weight:800; font-size:18px; letter-spacing:-0.5px; display:flex; align-items:center; gap:10px; }

.topbar-links { display:flex; gap:16px; align-items:center; }
.topbar-link { font-family:'DM Mono',monospace; font-size:11px; color:var(--text-muted); text-decoration:none; letter-spacing:0.5px; transition:color 0.2s; }
.topbar-link:hover { color:var(--red); }
.logo-img { height:28px; width:auto; }
.theme-toggle { background:var(--surface); border:1px solid var(--border); color:var(--text-muted); font-size:16px; line-height:1; width:34px; height:34px; border-radius:6px; cursor:pointer; transition:all 0.2s; display:flex; align-items:center; justify-content:center; }
.theme-toggle:hover { border-color:var(--red); color:var(--text); }

/* ── Hero ── */
.hero { margin-bottom:28px; }
.hero h1 { font-family:'Syne',sans-serif; font-weight:800; font-size:clamp(28px,4vw,44px); line-height:1.1; letter-spacing:-1px; margin-bottom:6px; }
.hero h1 em { color:var(--red); font-style:normal; }
.hero p { color:var(--text-dim); font-size:14px; line-height:1.6; }

/* ── Controls ── */
.controls { display:flex; gap:12px; margin-bottom:16px; align-items:center; flex-wrap:wrap; }
.search-box { flex:1; min-width:250px; background:var(--surface2); border:1px solid var(--border); color:var(--text); font-family:'DM Sans',sans-serif; font-size:14px; padding:10px 14px; border-radius:6px; outline:none; transition:border 0.2s; }
.search-box:focus { border-color:var(--border-active); }
.search-box::placeholder { color:var(--text-muted); }
.count { font-family:'DM Mono',monospace; font-size:11px; color:var(--text-muted); white-space:nowrap; }

/* ── Category tabs ── */
.cat-tabs { display:flex; gap:6px; margin-bottom:12px; flex-wrap:wrap; }
.cat-tab { background:var(--surface); border:1px solid var(--border); color:var(--text-muted); font-size:12px; padding:7px 14px; border-radius:6px; cursor:pointer; transition:all 0.15s; user-select:none; }
.cat-tab:hover { border-color:rgba(255,255,255,0.15); color:var(--text); }
.cat-tab.active { border-color:var(--border-active); background:rgba(var(--glow-r),var(--glow-g),var(--glow-b),0.08); color:var(--text); }
.cat-tab .tab-count { font-size:10px; color:var(--text-muted); margin-left:4px; opacity:0.7; }

/* ── Filters ── */
.filter-row { display:flex; gap:16px; margin-bottom:20px; flex-wrap:wrap; align-items:flex-start; }
.filter-group { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.filter-label { font-family:'DM Mono',monospace; font-size:10px; color:var(--text-muted); letter-spacing:0.5px; text-transform:uppercase; margin-right:2px; }
.filter-chips { display:flex; gap:4px; flex-wrap:wrap; }
.filter-chip { background:var(--surface); border:1px solid var(--border); color:var(--text-muted); font-family:'DM Mono',monospace; font-size:11px; padding:4px 10px; border-radius:4px; cursor:pointer; transition:all 0.15s; }
.filter-chip:hover { border-color:rgba(255,255,255,0.15); color:var(--text); }
.filter-chip.active { border-color:var(--red); background:rgba(var(--glow-r),var(--glow-g),var(--glow-b),0.1); color:var(--red); }
.chip-count { font-size:9px; opacity:0.6; margin-left:3px; }
.filter-clear { background:none; border:none; color:var(--text-muted); font-family:'DM Mono',monospace; font-size:11px; cursor:pointer; padding:4px 10px; transition:color 0.15s; opacity:0.6; }
.filter-clear:hover { color:var(--red); opacity:1; }

/* ── Product grid ── */
.product-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(280px, 1fr)); gap:12px; }

/* ── Product card ── */
.product-card { background:var(--surface); border:1px solid var(--border); border-radius:10px; overflow:hidden; transition:all 0.15s; cursor:pointer; }
.product-card:hover { border-color:rgba(255,255,255,0.15); transform:translateY(-2px); }
.card-header { display:flex; align-items:center; gap:12px; padding:14px 16px; }
.card-img { width:52px; height:52px; object-fit:contain; background:var(--surface2); border-radius:8px; padding:4px; flex-shrink:0; }
.card-info { min-width:0; flex:1; }
.card-name { font-family:'Syne',sans-serif; font-weight:700; font-size:13px; margin-bottom:1px; }
.card-model { font-family:'DM Mono',monospace; font-size:10px; color:var(--text-muted); }
.card-cat { font-family:'DM Mono',monospace; font-size:9px; letter-spacing:0.5px; color:var(--red); text-transform:uppercase; }
.card-price { font-family:'DM Mono',monospace; font-size:12px; font-weight:500; color:var(--text); white-space:nowrap; text-align:right; }
.card-price .price-label { font-size:8px; color:var(--text-muted); display:block; font-weight:400; }
.card-apps { display:flex; gap:3px; margin-top:4px; flex-wrap:wrap; }
.app-badge { font-family:'DM Mono',monospace; font-size:8px; letter-spacing:0.3px; background:var(--surface2); color:var(--text-muted); padding:1px 5px; border-radius:3px; }

/* ── Modal ── */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.7); z-index:1000; align-items:center; justify-content:center; padding:24px; backdrop-filter:blur(4px); }
.modal-overlay.open { display:flex; animation:fadeIn 0.2s ease; }
.modal { background:var(--surface); border:1px solid var(--border); border-radius:14px; max-width:900px; width:100%; max-height:85vh; overflow-y:auto; position:relative; animation:slideUp 0.25s ease; }
.modal-close { position:absolute; top:12px; right:16px; background:none; border:none; color:var(--text-muted); font-size:28px; cursor:pointer; z-index:2; line-height:1; transition:color 0.15s; width:36px; height:36px; display:flex; align-items:center; justify-content:center; border-radius:6px; }
.modal-close:hover { color:var(--text); background:var(--surface2); }
.modal-body { padding:28px; }

.modal-header { display:flex; gap:24px; align-items:flex-start; margin-bottom:24px; }
.modal-img { width:160px; height:160px; object-fit:contain; background:var(--surface2); border-radius:12px; padding:12px; flex-shrink:0; }
.modal-title-area { flex:1; min-width:0; }
.modal-cat { font-family:'DM Mono',monospace; font-size:10px; letter-spacing:1px; color:var(--red); text-transform:uppercase; margin-bottom:4px; }
.modal-title { font-family:'Syne',sans-serif; font-weight:800; font-size:24px; letter-spacing:-0.5px; margin-bottom:4px; }
.modal-model { font-family:'DM Mono',monospace; font-size:12px; color:var(--text-muted); margin-bottom:8px; }
.modal-price { font-family:'DM Mono',monospace; font-size:20px; font-weight:500; color:var(--text); margin-bottom:8px; }
.modal-price span { font-size:11px; color:var(--text-muted); font-weight:400; }
.modal-apps { display:flex; gap:4px; flex-wrap:wrap; }
.app-badge-lg { font-family:'DM Mono',monospace; font-size:10px; letter-spacing:0.5px; background:var(--surface2); color:var(--text-muted); padding:3px 8px; border-radius:4px; }

.modal-specs { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.modal-specs-col { min-width:0; }
.specs-table { width:100%; border-collapse:collapse; }
.specs-table tr { border-bottom:1px solid var(--border); }
.specs-table tr:last-child { border-bottom:none; }
.specs-table td { padding:7px 0; font-size:12px; vertical-align:top; }
.specs-table td:first-child {
  color:var(--text-muted); font-family:'DM Mono',monospace; font-size:10px;
  width:45%; padding-right:12px; letter-spacing:0.3px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:200px;
}
.specs-table td:last-child { color:var(--text); font-weight:500; word-break:break-word; }
.spec-check { color:var(--red); }
.specs-link { display:inline-block; margin-top:16px; font-family:'DM Mono',monospace; font-size:11px; color:var(--red); text-decoration:none; letter-spacing:0.5px; }
.specs-link:hover { text-decoration:underline; }

/* ── Load more ── */
.load-more-row { text-align:center; padding:24px 0; }
.load-more-btn { background:var(--surface2); border:1px solid var(--border); color:var(--text-dim); font-family:'DM Mono',monospace; font-size:13px; padding:12px 32px; border-radius:6px; cursor:pointer; transition:all 0.15s; }
.load-more-btn:hover { border-color:var(--border-active); color:var(--text); }

/* ── Responsive ── */
@media (max-width:700px) {
  .product-grid { grid-template-columns:1fr; }
  .topbar-links { gap:8px; }
  .modal { margin:8px; max-height:95vh; }
  .modal-header { flex-direction:column; align-items:center; text-align:center; }
  .modal-img { width:120px; height:120px; }
  .modal-specs { grid-template-columns:1fr; }
  .filter-row { gap:8px; }
}

/* ── Loading & empty state ── */
.loading-msg, .empty-search {
  grid-column:1/-1; text-align:center; padding:40px 20px;
  font-family:'DM Mono',monospace; font-size:13px; color:var(--text-muted);
  letter-spacing:0.5px;
}
.loading-msg { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ── Modal actions ── */
.modal-actions { display:flex; gap:12px; align-items:center; margin-top:16px; flex-wrap:wrap; }
.modal-print-btn {
  background:var(--surface2); border:1px solid var(--border); color:var(--text-muted);
  font-family:'DM Mono',monospace; font-size:11px; padding:6px 14px; border-radius:5px;
  cursor:pointer; transition:all 0.15s; margin-left:auto;
}
.modal-print-btn:hover { border-color:var(--red); color:var(--text); }

/* ── Print ── */
@media print {
  body { background:white !important; color:#111 !important; }
  body::before { display:none; }
  .wrap, .topbar, .hero, .controls, .cat-tabs, .filter-row,
  .product-grid, .load-more-row { display:none !important; }
  .modal-overlay.open { display:flex !important; position:static; background:none; padding:0; }
  .modal { max-width:100%; max-height:none; border:none; box-shadow:none; overflow:visible; background:white; }
  .modal-close, .modal-print-btn { display:none; }
  .modal-body { padding:20px 0; }
  .modal-img { background:#f5f5f5; }
  .modal-title { color:#111; }
  .modal-model { color:#666; }
  .modal-price { color:#111; }
  .modal-price span { color:#666; }
  .modal-cat { color:#E54424; }
  .specs-table td:first-child { color:#666; }
  .specs-table td:last-child { color:#111; }
  .specs-table tr { border-bottom:1px solid #ddd; }
  .spec-check { color:#E54424; }
  .specs-link { color:#E54424; }
  .app-badge-lg { background:#eee; color:#333; }
}

/* ── Animations ── */
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:none; } }
