:root {
  --saffron: #FF9933;
  --white: #FFFFFF;
  --green: #138808;
  --navy: #0B3D91;
  --ink: #22252b;
  --muted: #6b7280;
  --bg: #FFFBF5;
  --card: #ffffff;
  --border: #ece5d8;
  --danger: #c0392b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.tricolor-bar { height: 6px; width: 100%; display: flex; }
.tricolor-bar span { flex: 1; }
.tricolor-bar .s1 { background: var(--saffron); }
.tricolor-bar .s2 { background: var(--white); border-top: 1px solid #eee; border-bottom: 1px solid #eee; }
.tricolor-bar .s3 { background: var(--green); }

header.hero {
  background: linear-gradient(135deg, #fff7ec 0%, #fff 40%, #f2fbf0 100%);
  padding: 28px 20px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}

.brand-row .brand-logo {
  height: 34px;
  width: auto;
}

.chakra {
  width: 26px;
  height: 26px;
  animation: spin 12s linear infinite;
}

.top-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.top-nav-logo {
  height: 20px;
  width: auto;
  filter: brightness(0) invert(1); /* render logo white on the navy top bar */
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.hero h1 {
  margin: 6px 0 2px;
  font-size: 34px;
  background: linear-gradient(90deg, var(--saffron), #b5860f 35%, var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
}

.hero .sub {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 4px;
}

.badge {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.5px;
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.card h2 {
  margin-top: 0;
  font-size: 18px;
  color: var(--navy);
}

.rules-banner {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  background: linear-gradient(90deg, rgba(255,153,51,0.1), rgba(19,136,8,0.08));
  border: 1px dashed var(--saffron);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
}

.rules-banner b { color: var(--navy); }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #333; }

input[type="text"], input[type="tel"], input[type="number"], input[type="email"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d7d2c6;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  color: #fff;
  background: var(--navy);
  transition: transform 0.06s ease, opacity 0.15s ease;
}
.btn:hover { opacity: 0.92; }
.btn:active { transform: scale(0.98); }
.btn.saffron { background: var(--saffron); color: #1a1a1a; }
.btn.green { background: var(--green); }
.btn.outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.small { padding: 6px 12px; font-size: 12.5px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.error { color: var(--danger); font-size: 13px; margin-top: 8px; }
.success { color: var(--green); font-size: 13px; margin-top: 8px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: #fbf7ef; color: var(--navy); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
tr.selected { background: #fbfff4; }
td.num, th.num { text-align: right; }
.sku-desc { color: #555; font-size: 12px; margin-top: 2px; }
.qty-input { width: 80px; padding: 6px 8px; }
.soh { font-size: 11px; color: var(--muted); }

/* ---- Product card grid ---- */
.sku-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.product-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
  display: flex;
  flex-direction: column;
}
.product-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.06); }
.product-card.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(19,136,8,0.12);
}

.product-media {
  background: linear-gradient(135deg, #fffaf2, #f4fbf2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.product-media img { width: 88px; height: 88px; object-fit: contain; }

.product-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-sku { font-weight: 700; font-size: 13.5px; color: var(--navy); }
.product-desc { font-size: 12px; color: #666; line-height: 1.4; min-height: 32px; }
.product-price { font-weight: 700; font-size: 14px; margin-top: 2px; }
.product-price .was { font-weight: 400; color: var(--muted); font-size: 11px; }

.product-qty-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.product-qty-row label { margin: 0; font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.product-qty-row input { padding: 7px 8px; font-size: 13.5px; }

.product-line-total { font-size: 12px; color: var(--green); font-weight: 700; text-align: right; min-height: 16px; }

/* ---- Section head row (title + view toggle) ---- */
.section-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.view-toggle { display: flex; gap: 6px; flex-shrink: 0; }
.view-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.view-btn.active { border-color: var(--navy); color: var(--navy); background: #eef3fc; }

/* ---- List view variant of the product grid ---- */
.sku-grid.view-list { grid-template-columns: 1fr; gap: 8px; }
.sku-grid.view-list .product-card { flex-direction: row; align-items: center; }
.sku-grid.view-list .product-media { padding: 8px; flex-shrink: 0; }
.sku-grid.view-list .product-media img { width: 52px; height: 52px; }
.sku-grid.view-list .product-body {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 14px;
}
.sku-grid.view-list .product-sku { min-width: 150px; }
.sku-grid.view-list .product-desc { min-height: auto; flex: 1; min-width: 180px; }
.sku-grid.view-list .product-price { min-width: 110px; }
.sku-grid.view-list .product-qty-row { margin-top: 0; }
.sku-grid.view-list .product-line-total { min-width: 100px; }

/* ---- Discount structure modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-box {
  background: #fff;
  border-radius: 14px;
  max-width: 460px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.modal-tricolor-bar { height: 8px; width: 100%; display: flex; position: sticky; top: 0; z-index: 2; }
.modal-tricolor-bar span { flex: 1; }
.modal-tricolor-bar .s1 { background: var(--saffron); }
.modal-tricolor-bar .s2 { background: #fff; }
.modal-tricolor-bar .s3 { background: var(--green); }

.modal-content {
  padding: 24px;
  background: linear-gradient(180deg, #fff8ee 0%, #ffffff 30%);
}

.modal-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.modal-chakra { width: 40px; height: 40px; flex-shrink: 0; opacity: 0.85; }
.modal-box h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
  background: linear-gradient(90deg, var(--saffron), #b5860f 40%, var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.85);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--navy);
  z-index: 3;
}
.modal-close:hover { background: #fff; color: var(--ink); }
.rules-banner a { color: var(--navy); font-weight: 700; text-decoration: underline; cursor: pointer; }

.discount-table { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.discount-table th { background: var(--navy); color: #fff; font-size: 11.5px; }
.discount-table tbody tr:nth-child(odd) { background: #fff8ee; }
.discount-table tbody tr:nth-child(even) { background: #f2fbf0; }
.discount-table td { border-bottom: 1px solid #fff; font-weight: 600; }
.discount-pct-pill {
  display: inline-block;
  min-width: 48px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  font-size: 13.5px;
  text-align: center;
}
.discount-table tr.current-tier { outline: 2.5px solid var(--saffron); outline-offset: -2px; }
.discount-table tr.current-tier .discount-pct-pill { background: var(--saffron); color: #1a1a1a; }
.discount-table tr.current-tier td:first-child::before { content: "⭐ "; }

.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; font-size: 14px; }
.summary-grid .label { color: var(--muted); }
.summary-grid .value { font-weight: 700; text-align: right; }
.summary-grid .net .value { color: var(--green); font-size: 18px; }
.summary-grid hr { grid-column: 1 / -1; border: none; border-top: 1px solid var(--border); margin: 4px 0; }

.otp-boxes { display: flex; gap: 10px; }
.otp-boxes input {
  width: 46px; height: 52px; text-align: center; font-size: 22px; font-weight: 700;
}

.whatsapp-box {
  background: #f6fdf5;
  border: 1px solid #cdeecb;
  border-radius: 10px;
  padding: 14px;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  max-height: 260px;
  overflow-y: auto;
}

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill.ok { background: #e6f6e4; color: var(--green); }
.pill.warn { background: #fff3e0; color: #b06a00; }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px 16px 40px;
}

.userbar {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--muted); margin-bottom: 8px;
}

.hidden { display: none !important; }

.admin-table-actions { display: flex; gap: 6px; }

.top-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px; background: var(--navy); color: #fff; font-size: 13px;
}
.top-nav a { color: #fff; text-decoration: none; opacity: 0.85; }
.top-nav a:hover { opacity: 1; text-decoration: underline; }
