:root {
  --bg: #0F1216;
  --surface: #171B21;
  --surface-2: #1D222A;
  --border: #2A2F38;
  --text: #F3F5F7;
  --muted: #8A93A3;
  --accent: #5B8CFF;
  --accent-2: #2FD1B0;
  --danger: #F87171;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  font-size: 14px;
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }
a { color: inherit; }
input:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

/* announce bar */
.announce-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, rgba(91,140,255,0.15), rgba(47,209,176,0.1));
  color: var(--text);
  padding: 8px 16px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
}
.announce-track { overflow: hidden; white-space: nowrap; flex: 1; }

/* header */
.header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(15,18,22,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px 10px;
  max-width: 1100px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #0F1216;
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 0.2px; }
.search-box {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 13px; max-width: 460px; margin-left: auto;
  color: var(--muted);
}
.search-box input {
  flex: 1; background: transparent; border: none; color: var(--text); font-size: 13.5px;
}
.cat-row {
  display: flex; gap: 8px; padding: 0 18px 12px; overflow-x: auto;
  max-width: 1100px; margin: 0 auto;
}
.cat-pill {
  flex-shrink: 0; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); font-size: 12.5px; font-weight: 500;
}
.cat-pill.active { background: var(--accent); border-color: var(--accent); color: #0F1216; font-weight: 700; }

/* main / grid */
.main { max-width: 1100px; margin: 0 auto; padding: 20px 18px 100px; min-height: 40vh; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 60px 0; text-align: center; color: var(--muted); }

.card {
  text-align: left; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; color: var(--text);
  display: flex; flex-direction: column; padding: 0; width: 100%;
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--accent); }
.card-img-wrap { position: relative; height: 150px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.card-tag { position: absolute; top: 8px; left: 8px; background: rgba(15,18,22,0.75); color: var(--text); font-size: 10.5px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border); }
.card-body { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 5px; }
.card-name { font-weight: 700; font-size: 14px; }
.card-desc { color: var(--muted); font-size: 12px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 32px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.card-price { color: var(--accent-2); font-weight: 800; font-size: 15px; }
.card-sku-count { color: var(--muted); font-size: 11px; }

/* fab */
.fab {
  position: fixed; bottom: 20px; right: 20px; display: flex; align-items: center; gap: 8px;
  background: var(--accent); color: #0F1216; border: none; border-radius: 999px;
  padding: 13px 19px; font-weight: 700; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(91,140,255,0.35); z-index: 8;
}

/* footer */
.footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px; border-top: 1px solid var(--border); color: var(--muted);
  font-size: 11.5px; max-width: 1100px; margin: 0 auto;
}
.admin-link { text-decoration: none; color: var(--muted); font-size: 11.5px; }
.admin-link:hover { color: var(--accent); }

/* overlay / modal */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: flex-end; justify-content: center; z-index: 20;
}
.modal {
  background: var(--surface); border-radius: 18px 18px 0 0; width: 100%; max-width: 480px;
  max-height: 88vh; overflow-y: auto; position: relative;
  border: 1px solid var(--border); border-bottom: none;
}
.modal-close {
  position: absolute; top: 12px; right: 12px; background: rgba(15,18,22,0.6);
  border: 1px solid var(--border); border-radius: 50%; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center; color: var(--text); z-index: 2;
}
.modal-img-wrap { height: 210px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.modal-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.modal-body { padding: 18px 20px 26px; }
.modal-cat { display: inline-block; font-size: 11px; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 2px 9px; margin-bottom: 8px; }
.modal-title { font-size: 19px; font-weight: 800; margin: 0 0 8px; }
.modal-desc { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 16px; white-space: pre-wrap; }
.modal-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.sku-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.sku-pill { padding: 7px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 12.5px; }
.sku-pill.active { border-color: var(--accent); background: rgba(91,140,255,0.15); color: var(--accent); font-weight: 700; }
.sku-info-row { display: flex; align-items: baseline; justify-content: space-between; background: var(--surface-2); border-radius: 10px; padding: 10px 14px; margin-bottom: 18px; }
.sku-price { font-size: 20px; font-weight: 800; color: var(--accent-2); }
.sku-stock { font-size: 12px; color: var(--muted); }
.modal-cta {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #0F1216; border: none; border-radius: 12px;
  padding: 13px 0; font-weight: 800; font-size: 14.5px;
}
.modal-cta-disabled { text-align: center; color: var(--muted); font-size: 12.5px; padding: 10px 0; }

/* contact sheet */
.sheet { background: var(--surface); border-radius: 18px 18px 0 0; width: 100%; max-width: 480px; padding: 10px 20px 24px; border: 1px solid var(--border); border-bottom: none; }
.sheet-handle { width: 40px; height: 4px; background: var(--border); border-radius: 999px; margin: 4px auto 14px; }
.sheet-title { font-weight: 800; font-size: 15px; margin-bottom: 12px; }
.sheet-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.sheet-item { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: var(--text); }
.sheet-label { flex: 1; font-weight: 700; font-size: 13.5px; }
.sheet-cancel { width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); border-radius: 12px; padding: 11px 0; font-weight: 600; font-size: 13.5px; }

@media (min-width: 640px) {
  .overlay { align-items: center; }
  .modal, .sheet { border-radius: 18px; border-bottom: 1px solid var(--border); }
}
[hidden] { display: none !important; }
