/* Toy World Wholesale — mobile-first stylesheet */
:root {
  --navy: #1c2b4a;
  --navy-dark: #131e35;
  --orange: #ff6b1a;
  --orange-dark: #e05a10;
  --yellow: #ffc93c;
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #22304a;
  --muted: #6b7690;
  --green: #1d9e5b;
  --red: #d33f3f;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
a { color: var(--orange-dark); }
img { max-width: 100%; }

/* ---------- header ---------- */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--orange), var(--yellow));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--navy-dark); font-size: 17px;
}
.brand-text { font-weight: 800; font-size: 18px; letter-spacing: .2px; }
.brand-text em { font-style: normal; color: var(--yellow); font-weight: 600; font-size: 14px; display: block; line-height: 1.1; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a { color: #dbe3f5; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav .btn-nav { background: var(--orange); color: #fff; font-weight: 700; }
.nav .btn-nav:hover { background: var(--orange-dark); }

/* ---------- layout ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.banner {
  padding: 12px 16px; font-size: 14px; text-align: center;
}
.banner.warn { background: #fff4d6; color: #7a5b00; border-bottom: 1px solid #ecd27a; }
.banner.ok { background: #dcf5e7; color: #0c6b3c; border-radius: var(--radius); margin: 12px 16px 0; }
.banner.err { background: #fde3e3; color: #a02020; border-radius: var(--radius); margin: 12px 16px 0; }
h1 { font-size: 24px; margin: 8px 0 4px; }
h2 { font-size: 19px; margin: 18px 0 8px; }
.sub { color: var(--muted); margin: 0 0 14px; font-size: 14px; }

/* ---------- product grid ---------- */
.toolbar { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.toolbar input[type="search"] {
  flex: 1; min-width: 180px; padding: 12px 14px; font-size: 16px;
  border: 1px solid #d4dbea; border-radius: 10px; background: #fff;
}
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 2px 8px rgba(28,43,74,.08); display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
}
.card-img { aspect-ratio: 1/1; background: #eef1f7; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .noimg { color: var(--muted); font-size: 13px; padding: 10px; text-align: center; }
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-weight: 700; font-size: 14px; line-height: 1.3; }
.price-row { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
.price { font-weight: 800; font-size: 16px; color: var(--navy); }
.price small { font-weight: 500; color: var(--muted); font-size: 11px; }
.price.wholesale { color: var(--green); }
.price.call { color: var(--orange-dark); font-size: 13px; }
.stock { font-size: 12px; font-weight: 700; }
.stock.in { color: var(--green); }
.stock.low { color: var(--orange-dark); }
.stock.out { color: var(--red); }

/* ---------- product detail ---------- */
.detail { display: grid; gap: 18px; }
@media (min-width: 760px) { .detail { grid-template-columns: 1fr 1fr; } }
.detail-img { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 8px rgba(28,43,74,.08); }
.detail-img img { width: 100%; display: block; }
.thumbs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.thumbs img.on { border-color: var(--orange); }
.detail-info { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: 0 2px 8px rgba(28,43,74,.08); }
.price-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 15px; }
.price-table td { padding: 8px 4px; border-bottom: 1px solid #eef1f7; }
.price-table td:last-child { text-align: right; font-weight: 800; }
.desc { font-size: 14px; color: var(--muted); }
.desc img { max-width: 100%; height: auto; }

/* ---------- forms & buttons ---------- */
.form { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: 0 2px 8px rgba(28,43,74,.08); max-width: 520px; }
.form label { display: block; font-weight: 700; font-size: 14px; margin: 14px 0 6px; }
.form input, .form select, .form textarea {
  width: 100%; padding: 12px; font-size: 16px;
  border: 1px solid #d4dbea; border-radius: 10px; background: #fbfcff;
}
.form textarea { min-height: 90px; resize: vertical; }
.btn {
  display: inline-block; border: 0; cursor: pointer; text-decoration: none;
  background: var(--orange); color: #fff; font-weight: 800; font-size: 16px;
  padding: 13px 22px; border-radius: 10px; margin-top: 14px;
}
.btn:hover { background: var(--orange-dark); }
.btn.block { display: block; width: 100%; text-align: center; }
.btn.ghost { background: #e8edf6; color: var(--navy); }
.btn.small { font-size: 13px; padding: 8px 14px; margin-top: 0; }
.btn.danger { background: var(--red); }
.qty-row { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.qty-row input { width: 90px; padding: 12px; font-size: 16px; border: 1px solid #d4dbea; border-radius: 10px; }
.seg { display: flex; gap: 8px; margin: 6px 0 4px; }
.seg label {
  flex: 1; border: 2px solid #d4dbea; border-radius: 10px; padding: 12px;
  text-align: center; font-weight: 700; cursor: pointer; margin: 0;
}
.seg input { display: none; }
.seg input:checked + span { color: var(--orange-dark); }
.seg label:has(input:checked) { border-color: var(--orange); background: #fff6ef; }
.dealer-fields { display: none; }
.form.dealer .dealer-fields { display: block; }

/* ---------- cart / orders ---------- */
.cart-line {
  background: #fff; border-radius: var(--radius); padding: 12px;
  display: flex; gap: 12px; align-items: center; margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(28,43,74,.08);
}
.cart-line img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: #eef1f7; }
.cart-line .grow { flex: 1; }
.cart-line .t { font-weight: 700; font-size: 14px; }
.cart-line .p { font-size: 13px; color: var(--muted); }
.cart-line input[type="number"] { width: 64px; padding: 8px; font-size: 15px; border: 1px solid #d4dbea; border-radius: 8px; }
.totals { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 8px rgba(28,43,74,.08); margin-top: 12px; }
.totals .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 15px; }
.totals .grand { font-weight: 800; font-size: 18px; border-top: 1px solid #e5eaf3; margin-top: 8px; padding-top: 10px; }

/* ---------- admin ---------- */
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 8px rgba(28,43,74,.08); font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eef1f7; vertical-align: top; }
.admin-table th { background: var(--navy); color: #fff; font-size: 13px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.pill.pending { background: #fff4d6; color: #7a5b00; }
.pill.active { background: #dcf5e7; color: #0c6b3c; }
.pill.rejected { background: #fde3e3; color: #a02020; }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0; }
.stat { background: #fff; border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: 0 2px 8px rgba(28,43,74,.08); }
.stat .n { font-size: 28px; font-weight: 800; color: var(--navy); }
.stat .l { font-size: 13px; color: var(--muted); }

/* ---------- scanner ---------- */
#reader { width: 100%; max-width: 480px; margin: 0 auto; border-radius: var(--radius); overflow: hidden; }
.scan-result { margin-top: 14px; }

/* ---------- footer ---------- */
.footer { background: var(--navy-dark); color: #aeb9d4; padding: 26px 0; margin-top: 40px; font-size: 13px; }
.footer a { color: var(--yellow); }
.footer strong { color: #fff; }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.sync-note { font-size: 12px; color: var(--muted); margin-top: 18px; text-align: center; }
