/* LiveSale – mobile-first styles (customer pages + admin) */
:root {
  --brand: #e4405f;
  --brand-dark: #c1304b;
  --ink: #1d2330;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f6f8;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--brand); }
h1, h2 { margin: .2em 0 .3em; line-height: 1.2; }
img { max-width: 100%; display: block; }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar .shop { font-weight: 700; color: var(--ink); text-decoration: none; }
.wrap { max-width: 560px; margin: 0 auto; padding: 16px; }

.card { background: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.badge { font-size: .75rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; letter-spacing: .04em; }
.badge-live { background: var(--brand); color: #fff; animation: pulse 1.6s infinite; }
.badge-off { background: var(--line); color: var(--muted); }
@keyframes pulse { 50% { opacity: .6; } }

.session-title { margin: 0 0 12px; color: var(--muted); font-weight: 600; }

.product { padding: 0; overflow: hidden; }
.product img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--line); }
.product-body { padding: 16px; }
.product.flash { animation: flash .8s ease; }
@keyframes flash { from { box-shadow: 0 0 0 4px var(--brand); } to { box-shadow: 0 1px 3px rgba(0,0,0,.06); } }

.code-row { display: flex; justify-content: space-between; align-items: center; }
.code { display: inline-block; background: var(--ink); color: #fff; font-weight: 700; padding: 3px 10px; border-radius: 8px; font-size: .9rem; }
.stock { font-weight: 600; color: var(--ok); }
.stock.low { color: var(--warn); }
.stock.sold { color: var(--brand); }
.price { font-size: 1.4rem; font-weight: 800; margin: 4px 0; }
.desc { color: var(--muted); white-space: pre-line; }

.qty { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.qty button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 1.4rem; cursor: pointer; }
.qty input { width: 70px; height: 44px; text-align: center; font-size: 1.1rem; border: 1px solid var(--line); border-radius: 10px; }

.btn { display: inline-block; width: 100%; padding: 14px 18px; border: 0; border-radius: 12px; background: var(--ink); color: #fff; font-size: 1rem; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer; }
.btn-buy { background: var(--brand); font-size: 1.15rem; }
.btn-buy:hover { background: var(--brand-dark); }
.btn-wa { background: #25d366; }
.btn-outline { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { background: #c7cbd1; cursor: not-allowed; }
.btn-sm { width: auto; padding: 8px 12px; font-size: .85rem; border-radius: 8px; }

.watch-link { display: block; text-align: center; margin: 8px 0 24px; font-weight: 600; }

.summary { display: flex; gap: 14px; align-items: center; }
.summary img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; }
.summary .price { font-size: 1.1rem; }

.form label { display: block; font-weight: 600; margin-bottom: 12px; font-size: .95rem; }
.form input, .form textarea, .form select { display: block; width: 100%; margin-top: 4px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.total { margin: 8px 0 12px; }

.alert { background: #fdecef; color: #9b1c33; border-radius: 10px; padding: 8px 14px; margin-bottom: 16px; }
.alert p { margin: 6px 0; }
.notice { background: #e8f6ee; color: #14532d; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; }

.ref { font-family: ui-monospace, monospace; letter-spacing: .05em; }
.items { width: 100%; border-collapse: collapse; margin: 12px 0; }
.items td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.items .num { text-align: right; white-space: nowrap; }
.total-row td { font-weight: 800; border-bottom: 0; }
.bank { background: var(--bg); padding: 12px; border-radius: 10px; font-family: inherit; white-space: pre-wrap; }

.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--line); }
.status-pending_payment { background: #fff4e0; color: #92400e; }
.status-paid { background: #e0f2fe; color: #075985; }
.status-packed { background: #ede9fe; color: #5b21b6; }
.status-shipped { background: #dcfce7; color: #166534; }
.status-cancelled { background: #f3f4f6; color: #6b7280; text-decoration: line-through; }

/* ---------- Admin ---------- */
.admin .wrap { max-width: 1200px; }
.admin .topbar { flex-wrap: wrap; gap: 6px; }
.admin nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.admin nav a { color: var(--ink); text-decoration: none; font-weight: 600; }
.admin .card { overflow-x: auto; }
@media (max-width: 600px) { .admin .wrap { padding: 10px; } .table .thumb { display: none; } }
.admin nav a.active { color: var(--brand); }
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid { grid-template-columns: 3fr 2fr; } }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; }
.table img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.table tr.on-air { background: #fff1f3; }
.table .num { text-align: right; }
.inline { display: inline; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 140px; }
.on-air-box { display: flex; gap: 14px; align-items: center; }
.on-air-box img { width: 80px; height: 80px; object-fit: cover; border-radius: 10px; }
.stat { font-size: 1.8rem; font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
