:root {
  --bg: #f4f5fb;
  --card: #ffffff;
  --ink: #0f1222;
  --muted: #5b6178;
  --line: #e6e8f2;
  --accent: #5b5cff;
  --accent-2: #7c3aed;
  --green: #12b76a;
  --orange: #f97066;
  --shadow: 0 10px 40px rgba(28, 32, 72, .08);
  --radius: 18px;
  --cols: 4;
  --header: 72px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Sora", "Inter", system-ui, sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(124,58,237,.12), transparent 50%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; height: auto; }

.top-banner {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 12.5px;
  text-align: center;
  padding: 8px 16px;
  font-weight: 500;
  letter-spacing: .2px;
}
.top-banner[hidden] { display: none !important; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(255,255,255,.78);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1280px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 16px;
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); flex-shrink: 0; }
.logo img, .logo-img { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent); }
.logo-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 16px;
}
.logo-word { font-weight: 750; font-size: 18px; letter-spacing: -0.6px; }
.logo-word span { color: var(--accent); }

.search {
  flex: 1; display: flex; background: #fff; border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden; box-shadow: 0 1px 0 rgba(255,255,255,.8);
}
.search input { flex: 1; border: 0; outline: 0; padding: 12px 18px; font-size: 14px; background: transparent; }
.search button { border: 0; background: var(--accent); color: #fff; padding: 0 18px; cursor: pointer; }

.header-actions { display: flex; gap: 8px; align-items: center; }
.ha {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--ink); min-width: 64px; font-size: 11px; font-weight: 600;
}
.ha-icon {
  width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line); position: relative;
}
.ha-icon.pink { background: #fff0f6; color: #e11d74; border-color: #ffd6e7; }
.ha-icon.blue { background: color-mix(in srgb, var(--accent) 12%, #fff); color: var(--accent); }
.ha-icon.gold { background: #fff7e8; color: #c27803; }
.ha-icon.orange { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: 0; font-size: 13px; }
.ha-icon i { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; background: var(--green); border-radius: 50%; }

.header-links { border-top: 1px solid var(--line); }
.header-inner.sub { padding: 8px 20px; gap: 18px; font-size: 13.5px; font-weight: 600; overflow-x: auto; }
.header-inner.sub a, .dropdown > button {
  color: var(--muted); background: none; border: 0; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
}
.header-inner.sub a:hover, .dropdown > button:hover { color: var(--accent); }
.dropdown { position: relative; }
.drop-menu {
  display: none; position: absolute; top: 120%; left: 0; background: #fff;
  min-width: 220px; border-radius: 14px; box-shadow: var(--shadow); padding: 8px; z-index: 20; border: 1px solid var(--line);
}
.dropdown:hover .drop-menu { display: grid; }
.drop-menu a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.drop-menu a:hover { background: color-mix(in srgb, var(--accent) 10%, #fff); color: var(--accent); }

.chip-bar {
  max-width: 1280px; margin: 0 auto; padding: 12px 20px 0;
  display: flex; gap: 8px; overflow-x: auto;
}
.chip-bar a, .chip {
  white-space: nowrap; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--muted); background: #fff; border: 1px solid var(--line);
}
.chip-bar a.active, .chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

#app { max-width: 1280px; margin: 0 auto; padding: 22px 20px 80px; min-height: 58vh; }

.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.hero-row h1 { font-size: 28px; margin: 0; letter-spacing: -1px; }
.hero-row p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); color: var(--green);
  font-size: 12px; font-weight: 700; padding: 8px 12px; border-radius: 999px;
}
.live-pill b { width: 8px; height: 8px; background: var(--green); border-radius: 50%; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters select, .filters input, .btn, .field {
  border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 9px 12px; font-size: 13px;
}
.btn { cursor: pointer; font-weight: 700; }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: #fff; }
.btn.danger { background: #fff1f0; color: #d92d20; border-color: #ffd6d2; }

.layout { display: grid; grid-template-columns: 1fr 300px; gap: 22px; }
.layout.no-side { grid-template-columns: 1fr; }
.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 16px;
}
.grid.list { grid-template-columns: 1fr; }
.carousel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

.deal-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column;
  border: 1px solid #eef0f7; transition: transform .18s ease, box-shadow .18s ease;
}
.deal-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(28,32,72,.12); }
.grid.list .deal-card { flex-direction: row; align-items: stretch; }
.grid.list .thumb { width: 180px; height: auto; margin: 12px; }
.grid.list h3 { min-height: 0; }
.grid.compact { gap: 10px; }
.grid.compact .deal-card { border-radius: 14px; }
.grid.compact .thumb { height: 120px; }

.deal-card .meta { display: flex; align-items: center; gap: 8px; padding: 10px 12px 0; font-size: 11px; color: var(--muted); }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.thumb {
  margin: 8px 12px; background: linear-gradient(180deg, #fafbff, #f3f4fa); border-radius: 14px; height: 176px;
  display: grid; place-items: center; overflow: hidden; position: relative;
}
.thumb img { max-width: 100%; max-height: 176px; object-fit: contain; }
.badge {
  position: absolute; top: 8px; left: 8px; background: #efe7ff; color: #6d28d9;
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px;
}
.badge.fire { background: #fff1e6; color: #c2410c; }
.badge.auto { background: #e8edff; color: var(--accent); }
.badge.gone { background: #fee2e2; color: #b91c1c; }
.deal-card h3 { font-size: 14px; line-height: 1.35; margin: 0 12px 8px; font-weight: 650; min-height: 38px; }
.deal-card h3 a { color: var(--ink); }
.deal-card h3 a:hover { color: var(--accent); }
.prices { padding: 0 12px 8px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.now { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.was { color: var(--orange); text-decoration: line-through; font-weight: 600; }
.off { font-size: 12px; font-weight: 700; color: var(--green); background: #ecfdf3; padding: 2px 6px; border-radius: 6px; }
.storeline { padding: 0 12px 10px; font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.prime { color: #00a8e1; font-weight: 800; font-size: 11px; }
.card-foot {
  margin-top: auto; display: flex; align-items: center; gap: 12px;
  padding: 8px 12px 12px; color: var(--muted); font-size: 13px; font-weight: 600;
}
.vote { background: none; border: 0; cursor: pointer; color: inherit; display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.vote.on { color: var(--accent); }
.vote svg { width: 16px; height: 16px; }

.side-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; border: 1px solid #eef0f7; }
.side-card h3 { margin: 0 0 12px; font-size: 16px; }
.pop-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.pop-row:last-child { border-bottom: 0; }
.pop-row a { color: var(--ink); font-weight: 600; }
.score-chip { background: #eef0ff; color: var(--accent); font-weight: 800; padding: 2px 6px; border-radius: 6px; font-size: 12px; }

.detail { display: grid; grid-template-columns: 1.05fr 1fr; gap: 22px; }
.detail-img { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; display: grid; place-items: center; min-height: 360px; }
.detail-img img { max-width: 100%; max-height: 420px; object-fit: contain; }
.detail-info { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.detail-info h1 { margin: 0 0 8px; font-size: 24px; letter-spacing: -0.4px; }
.big-price { font-size: 36px; font-weight: 800; letter-spacing: -1px; }
.go-amazon {
  display: inline-block; margin-top: 12px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 800; padding: 12px 18px; border-radius: 999px; border: 0;
}
.spark { width: 100%; height: 180px; background: #f8fafc; border-radius: 12px; margin-top: 16px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 10px; font-size: 13px; margin-top: 14px; color: var(--muted); }
.kv b { color: var(--ink); }
.comments { margin-top: 22px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.composer { display: flex; gap: 8px; margin-top: 10px; }
.composer input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }

.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.table th { background: #f8fafc; font-size: 12px; color: var(--muted); text-transform: uppercase; }
.table img { width: 48px; height: 48px; object-fit: contain; background: #f8fafc; border-radius: 8px; }
.stock.ok { color: var(--green); font-weight: 700; }
.stock.no { color: #dc2626; font-weight: 700; }

.form { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; max-width: 720px; }
.form label { display: block; font-size: 12px; font-weight: 700; margin: 12px 0 6px; }
.form input, .form textarea, .form select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px;
}
.log { font-family: ui-monospace, Menlo, monospace; font-size: 12px; max-height: 420px; overflow: auto; }
.log .row { padding: 8px 0; border-bottom: 1px dashed var(--line); display: grid; grid-template-columns: 70px 70px 1fr; gap: 8px; }
.log .new { color: var(--green); }
.log .drop { color: #c2410c; }
.log .remove { color: #dc2626; }
.log .scan { color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat strong { display: block; font-size: 26px; margin-top: 4px; letter-spacing: -0.6px; }

.coupon { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 16px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.code { font-family: ui-monospace, Menlo, monospace; background: var(--ink); color: #c4b5fd; padding: 8px 12px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.alert-item { background: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; gap: 12px; }
.alert-item.unread { border-left: 4px solid var(--accent); }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: #111; color: #fff; padding: 12px 14px; border-radius: 12px; min-width: 260px; font-size: 13px; }

.site-footer { background: #0f1222; color: #9aa0b8; padding: 48px 0 20px; margin-top: 28px; }
.header-inner.foot { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 24px; }
.site-footer a, .site-footer h4 { color: #e8eaf4; display: block; margin: 6px 0; }
.aff-strip {
  max-width: 1280px; margin: 28px auto 0; padding: 16px 20px 0;
  border-top: 1px solid #2a2d44; font-size: 12.5px; line-height: 1.65; color: #8b91a8;
}
.legal-links { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; margin: 16px 20px 0; font-size: 13px; }
.legal-links a { color: #c4b5fd; display: inline; margin: 0; }
.copy { text-align: center; font-size: 12px; margin: 16px 20px 0; color: #6b7280; }
.legal {
  max-width: 800px; margin: 0 auto; background: #fff; border-radius: 20px;
  box-shadow: var(--shadow); padding: 32px 28px; line-height: 1.7; color: #374151; font-size: 15px;
}
.legal h1 { margin: 0 0 8px; letter-spacing: -0.6px; }
.legal h2 { margin: 22px 0 8px; font-size: 17px; }
.legal p, .legal li { color: #4b5563; }
.legal .updated { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }

/* Admin */
.admin-shell { display: grid; grid-template-columns: 230px 1fr; gap: 22px; }
.admin-nav { background: #fff; border-radius: 18px; padding: 12px; box-shadow: var(--shadow); height: fit-content; position: sticky; top: 92px; }
.admin-nav a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--ink); font-weight: 600; font-size: 14px; }
.admin-nav a.active, .admin-nav a:hover { background: color-mix(in srgb, var(--accent) 12%, #fff); color: var(--accent); }
.admin-card { background: #fff; border-radius: 18px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.admin-card h2 { margin: 0 0 6px; font-size: 18px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.login-box { max-width: 420px; margin: 40px auto; background: #fff; padding: 28px; border-radius: 20px; box-shadow: var(--shadow); }
.preview-logo { width: 64px; height: 64px; border-radius: 16px; object-fit: cover; border: 1px solid var(--line); }

.mobile-nav { display: none; }

@media (max-width: 1100px) {
  .grid, .carousel { grid-template-columns: repeat(3, 1fr); }
  .layout, .admin-shell, .detail { grid-template-columns: 1fr; }
  .stat-grid, .admin-grid { grid-template-columns: 1fr 1fr; }
  .admin-nav { position: static; display: flex; gap: 6px; overflow-x: auto; }
  .admin-nav a { white-space: nowrap; }
}
@media (max-width: 800px) {
  .header-actions .ha small { display: none; }
  .ha { min-width: auto; }
  .search { max-width: none; }
  .grid, .carousel, .detail { grid-template-columns: 1fr 1fr; }
  .header-inner.foot { grid-template-columns: 1fr 1fr; }
  .hero-row h1 { font-size: 22px; }
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); justify-content: space-around; padding: 8px 6px 10px;
  }
  .mobile-nav a { color: var(--muted); font-size: 11px; font-weight: 700; text-align: center; }
  #app { padding-bottom: 96px; }
}
@media (max-width: 560px) {
  .grid, .carousel, .detail, .stat-grid, .admin-grid { grid-template-columns: 1fr; }
  .header-inner.sub { display: none; }
  .logo-word { font-size: 15px; }
}
