/* Familylove USA — colours from the Muse app:
   --sale #d9232e, --accent #10304a, --bg #f7f9fb, text #1c2b39,
   dim #5b7186, border #dde5ec, radius 12px. */
:root {
  --sale: #d9232e;
  --accent: #10304a;
  --bg: #f7f9fb;
  --surface: #fff;
  --text: #1c2b39;
  --dim: #5b7186;
  --border: #dde5ec;
  --radius: 12px;
  --green: #1d7a3d;
  --amber: #9a6a00;
  --amber-bg: #fff6db;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--accent); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; }
img { display: block; max-width: 100%; }

/* Countdown strip (red) + white sticky header */
.countdown {
  background: var(--sale);
  color: #fff;
  padding: 10px 14px;
  text-align: center;
  font-weight: 600;
}
.countdown .cd-label { font-size: 14px; margin-bottom: 6px; }
.countdown .cd-boxes { display: flex; gap: 6px; justify-content: center; }
.countdown .cd-box {
  background: rgba(0, 0, 0, .35);
  border-radius: 8px;
  min-width: 56px;
  padding: 4px 6px;
}
.countdown .cd-box b { display: block; font-size: 20px; line-height: 1.1; }
.countdown .cd-box span { font-size: 11px; font-weight: 500; opacity: .9; }
.countdown.expired { font-size: 14px; padding: 12px 14px; }

header.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  gap: 8px;
}
header.topbar .tab {
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 700;
  color: var(--dim);
  padding: 4px 2px;
  white-space: nowrap;
}
header.topbar .tab.active { color: var(--sale); }
header.topbar .tab .badge {
  display: inline-block;
  background: var(--sale);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  padding: 0 4px;
  margin-left: 2px;
  vertical-align: 1px;
}

main { max-width: 1100px; margin: 0 auto; padding: 14px; }
main.narrow { max-width: 720px; }

/* Search + chips */
.search {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  outline: none;
  margin: 4px 0 14px;
}
.search:focus { border-color: var(--accent); }
.chip-heading {
  color: var(--sale);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  margin: 14px 0 8px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.count-line { color: var(--dim); font-size: 13px; margin: 12px 0 4px; }
.empty { text-align: center; color: var(--dim); padding: 32px 12px; }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* Product grid */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 10px;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.card .thumb { position: relative; aspect-ratio: 600 / 630; background: #eceff1; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.code-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  padding: 3px 7px;
}
.discount-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--sale);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  border-radius: 6px;
  padding: 3px 7px;
}
.card .body { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .name {
  font-size: 14px;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.card .price { color: var(--sale); font-weight: 800; font-size: 17px; }
.card .price .old {
  color: var(--dim);
  font-weight: 500;
  font-size: 13px;
  text-decoration: line-through;
  margin-left: 6px;
}
.btn {
  border: none;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 15px;
  font-weight: 700;
}
.btn-navy { background: var(--accent); color: #fff; width: 100%; }
.btn-red { background: var(--sale); color: #fff; width: 100%; }
.btn-green { background: var(--green); color: #fff; }
.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn:disabled { opacity: .6; cursor: default; }

/* Product detail */
.detail { max-width: 720px; margin: 0 auto; }
.detail .top-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.back-link { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 15px; padding: 4px 0; }
.detail .code { font-weight: 700; color: var(--dim); font-size: 13px; }
.detail .main-img { width: 100%; border-radius: var(--radius); background: #eceff1; aspect-ratio: 600 / 630; object-fit: cover; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.thumb-btn {
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0;
  background: #eceff1;
  width: 56px;
  height: 56px;
  overflow: hidden;
  position: relative;
}
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; }
.thumb-btn.sel { border-color: var(--sale); }
.thumb-btn span {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 10px;
  text-align: center;
  padding: 1px 0;
}
.detail h2 { font-size: 20px; margin: 12px 0 4px; }
.detail .price { color: var(--sale); font-weight: 800; font-size: 24px; }
.detail .price .old { color: var(--dim); font-size: 15px; font-weight: 500; text-decoration: line-through; margin-left: 8px; }
.field-label { font-weight: 700; margin: 14px 0 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 14px;
}
.pill.sel { background: var(--accent); border-color: var(--accent); color: #fff; }
.size-guide-link {
  background: none; border: none;
  color: var(--accent); font-weight: 700; font-size: 14px;
  margin-left: 8px; text-decoration: underline;
}
.qty-stepper { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.qty-stepper button { background: var(--surface); border: none; width: 38px; height: 38px; font-size: 18px; font-weight: 700; }
.qty-stepper span { min-width: 34px; text-align: center; font-weight: 700; }
.error { color: var(--sale); font-weight: 600; margin-top: 8px; }
.terms { color: var(--dim); font-size: 13px; margin-top: 18px; }

/* Footer */
footer.site-footer { max-width: 1100px; margin: 8px auto 0; padding: 18px 14px 26px; color: var(--dim); font-size: 13px; }
footer.site-footer .owner-entry { color: var(--dim); margin-top: 14px; user-select: none; }

/* Cart */
.cart-line {
  display: flex; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 10px;
  align-items: center;
}
.cart-line img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; background: #eceff1; }
.cart-line .info { flex: 1; min-width: 0; }
.cart-line .info .nm { font-weight: 600; font-size: 14px; }
.cart-line .info .meta { color: var(--dim); font-size: 13px; }
.cart-line .line-total { color: var(--sale); font-weight: 800; white-space: nowrap; }
.link-btn { background: none; border: none; color: var(--sale); font-size: 13px; padding: 2px 0; }
.section-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 14px 0;
}
.section-box h3 { margin: 0 0 10px; font-size: 16px; }
.choice-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
  text-align: left;
}
.choice-card.sel { border-color: var(--sale); }
.choice-card b { display: block; font-size: 15px; }
.choice-card span { color: var(--dim); font-size: 13px; }
.choice-card .amt { color: var(--sale); font-weight: 700; }
textarea.address {
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  resize: vertical;
}
.totals { margin-top: 6px; }
.totals .row { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .row.due { color: var(--sale); font-weight: 800; font-size: 17px; }
.note { color: var(--dim); font-size: 13px; margin-top: 8px; }

/* Done / bank screen */
.done-card, .order-card, .auth-card, .owner-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.done-card h2 { margin: 0 0 6px; font-size: 19px; }
.status-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 700;
}
.status-awaiting_payment { background: var(--amber-bg); color: var(--amber); }
.status-payment_reported { background: #e8edf1; color: var(--accent); }
.status-payment_confirmed { background: #e2f3e8; color: var(--green); }
.status-delivered { background: #e2f3e8; color: var(--green); }
.pay-tabs { display: flex; gap: 8px; margin: 10px 0; }
.pay-tab {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
}
.pay-tab.active { background: var(--sale); border-color: var(--sale); color: #fff; }
.pay-tab:disabled { opacity: .55; cursor: default; }
.copy-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.copy-row:last-child { border-bottom: none; }
.copy-row .k { color: var(--dim); font-size: 13px; }
.copy-row .v { font-weight: 700; text-align: right; word-break: break-all; }
.copy-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.warn-box {
  background: #fff8e1;
  border: 1px solid #f2d98c;
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
  font-size: 14px;
}
.green-box {
  background: #e2f3e8;
  border: 1px solid #b6dfc2;
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
  font-size: 14px;
}
.amber-box {
  background: var(--amber-bg);
  border: 1px solid #f2d98c;
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
  font-size: 14px;
}
.msg-row { display: flex; gap: 8px; margin-top: 10px; }
.msg-row .btn { flex: 1; }
.hint { color: var(--dim); font-size: 13px; margin-top: 8px; }
.order-lines { font-size: 14px; }
.order-lines .ol { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.btn-row .btn { flex: 1; }

/* Auth */
.auth-toggle { display: flex; gap: 8px; margin-bottom: 14px; }
.auth-toggle .btn { flex: 1; }
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 14px; }
.field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--surface);
}
.field input:focus { outline: none; border-color: var(--accent); }

/* Modal (size guide) */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 12px;
  overflow-y: auto;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 680px;
  width: 100%;
  padding: 18px;
}
.modal h2 { margin: 0 0 4px; }
.modal .sub { color: var(--dim); font-size: 13px; margin-bottom: 12px; }
.modal table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 14px; }
.modal th, .modal td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
.modal th { background: #f0f3f6; }
.modal h4 { margin: 14px 0 4px; }
.modal ul { margin: 6px 0; padding-left: 20px; }
.modal .close-row { text-align: right; margin-top: 12px; }

/* Owner */
.owner-intro { color: var(--dim); font-size: 14px; margin-bottom: 12px; }
.owner-order-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.owner-order-head b { font-size: 15px; }
.owner-meta { color: var(--dim); font-size: 13px; margin: 4px 0 8px; }
.sync-line { color: var(--dim); font-size: 13px; margin-top: 8px; }
.customer-row {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.customer-row:last-child { border-bottom: none; }
.customer-row .tot { color: var(--sale); font-weight: 800; white-space: nowrap; }
