:root {
  --brand: #7b2d8b;
  --brand-dark: #5c1f68;
  --accent: #e63946;
  --bg: #f7f3fa;
  --card: #ffffff;
  --text: #22152b;
  --muted: #7a6b80;
  --ok: #2a9d8f;
  --border: #e6dcea;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(91, 31, 104, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--brand); white-space: nowrap; }
.brand .dot { color: var(--accent); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  color: var(--muted); text-decoration: none;
  padding: 8px 12px; border-radius: 10px; font-size: 0.95rem; font-weight: 600;
}
.nav a.active { background: var(--brand); color: #fff; }
.nav a.admin-link { color: var(--brand); border: 1px solid var(--brand); }
.userbox { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.userbox .exit { cursor: pointer; color: var(--accent); margin-left: 8px; }

main { max-width: 860px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
  border: 1px solid var(--border);
}
.card h2 { font-size: 1.1rem; margin-bottom: 10px; color: var(--brand-dark); }

.video-wrap {
  position: relative; aspect-ratio: 16 / 9; background: #111;
  border-radius: var(--radius); overflow: hidden; margin-bottom: 12px;
}
.video-wrap video { width: 100%; height: 100%; object-fit: cover; }
.live-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 0.75rem;
  padding: 4px 10px; border-radius: 999px; letter-spacing: 1px;
}
.viewer-count {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 0.8rem;
  padding: 4px 10px; border-radius: 999px;
}

.drop-panel { text-align: center; }
.drop-panel .price {
  font-size: 2.2rem; font-weight: 900; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.drop-panel .name { font-size: 1.05rem; margin: 4px 0; font-weight: 700; }
.drop-panel .status-tag { font-size: 0.8rem; color: var(--muted); }
.drop-panel .stock { font-size: 0.9rem; margin-top: 6px; }

.btn {
  display: inline-block; border: none; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 700;
  padding: 14px 28px; border-radius: 12px; font-size: 1.05rem;
  transition: transform 0.08s, opacity 0.2s;
}
.btn:hover { opacity: 0.92; }
.btn:active { transform: scale(0.98); }
.btn:disabled { background: #b9a5bf; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.small { padding: 8px 14px; font-size: 0.85rem; }
.btn.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--accent); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 1rem; background: #fff;
}
.checkbox-line { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; color: var(--muted); }

.chat { display: flex; flex-direction: column; max-height: 220px; }
.chat-log { flex: 1; overflow-y: auto; margin-bottom: 10px; font-size: 0.9rem; }
.chat-log .row { padding: 4px 0; border-bottom: 1px dashed var(--border); }
.chat-log .who { color: var(--brand); font-weight: 700; }
.chat-input { display: flex; gap: 8px; }
.chat-input input { flex: 1; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; }

.reactions { display: flex; gap: 8px; justify-content: center; margin: 12px 0; }
.reaction-btn {
  font-size: 1.6rem; background: #fff; border: 1.5px solid var(--border);
  border-radius: 50%; width: 48px; height: 48px; cursor: pointer;
}
.reaction-btn:hover { transform: scale(1.15); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.sku-card { cursor: pointer; }
.sku-card .img {
  height: 150px; background: linear-gradient(135deg, #f3e8f7, #e9d7f0);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  color: var(--brand); font-weight: 800; font-size: 1.4rem; margin-bottom: 10px;
}
.sku-card .name { font-weight: 700; }
.sku-card .price { color: var(--accent); font-weight: 800; margin-top: 4px; }

.order-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 0.9rem; }
.tag { padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.tag.paid { background: #d3efe9; color: #1b6b60; }
.tag.new { background: #fff1c2; color: #8a6d00; }
.tag.cancelled, .tag.refunded { background: #fad9dd; color: #8f2a34; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #22152b; color: #fff; padding: 12px 20px; border-radius: 12px;
  font-size: 0.9rem; opacity: 0; transition: all 0.25s; z-index: 50;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.err { background: var(--accent); }

.modal { position: fixed; inset: 0; background: rgba(30, 15, 40, 0.55); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 16px; }
.modal-card {
  background: #fff; border-radius: var(--radius); max-width: 420px; width: 100%;
  padding: 22px; box-shadow: var(--shadow);
}
.modal-card h3 { margin-bottom: 12px; color: var(--brand-dark); }

.timer { font-weight: 800; color: var(--accent); font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
