/* Northstar Rewards Portal — modern storefront theme.
   Palette/fonts per Builder theme: navy #1e3a8a, ink #0f172a, off-white
   #f8fafc, steel #4b61a1 / pale #99a6ca, sky #448ec1 / #358dda, border
   #ebeced; headings Gabarito, body Inter, pill buttons. */
:root {
  --navy: #1e3a8a;
  --navy-dark: #14265c;
  --ink: #0f172a;
  --sky: #448ec1;
  --sky-dark: #358dda;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #4b61a1;
  --pale: #99a6ca;
  --border: #e8ebf2;
  --green: #1e7e46;
  --red: #c53030;
  --amber: #b7791f;
  --radius: 16px;
  --shadow: 0 12px 32px rgba(15, 23, 42, .06);
  --shadow-lift: 0 18px 40px rgba(15, 23, 42, .12);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
/* sticky footer: page fills the viewport, footer anchors to the bottom
   (embed pages excluded — their height is measured for the Builder iframe) */
body:not(.embed) { display: flex; flex-direction: column; min-height: 100vh; }
body:not(.embed) main { flex: 1 0 auto; }
h1, h2, h3 { font-family: 'Gabarito', 'Inter', sans-serif; color: var(--ink); font-weight: 600; letter-spacing: .01em; }
h1 { font-size: 2rem; margin: .35em 0 .55em; }
h2 { font-size: 1.25rem; margin: 0 0 .7em; }
h3 { margin: .35em 0; }
a { color: var(--sky-dark); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* top bar */
.topbar {
  background: linear-gradient(180deg, #21409b 0%, var(--navy) 55%, #1b3377 100%);
  color: #fff; padding: 0; position: sticky; top: 0; z-index: 20;
  box-shadow: 0 6px 24px rgba(15, 23, 42, .18);
}
.topbar-inner { display: flex; align-items: center; gap: 18px; padding: 12px 20px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-logo { height: 46px; width: auto; display: block; border-radius: 8px; }
.brand-logo-login { height: 52px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; background: #fff; color: var(--navy);
  font-weight: 800;
}
.brand-sub { font-weight: 400; opacity: .75; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: #dbe7f5; text-decoration: none; padding: 7px 13px; border-radius: 999px; font-size: .92rem; font-weight: 500; transition: background .15s ease, color .15s ease; }
.nav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.nav-sep { width: 1px; background: rgba(255,255,255,.25); margin: 4px 6px; }
.userchip { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.chip-name { font-weight: 600; }
.chip-role { background: rgba(255,255,255,.18); padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.chip-points { background: #fff; color: var(--navy); padding: 3px 12px; border-radius: 999px; font-weight: 700; box-shadow: 0 2px 8px rgba(15,23,42,.18); }
.chip-logout { color: #dbe7f5; text-decoration: none; }
.chip-logout:hover { color: #fff; text-decoration: underline; }
main { padding: 28px 0 48px; }
.footer { background: linear-gradient(180deg, #1b3377 0%, var(--navy-dark) 100%); color: #cfddf7; margin-top: 24px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; padding: 34px 0 26px; }
.footer-logo { height: 40px; width: auto; display: block; margin-bottom: 12px; }
.footer-brand p { margin: 0; font-size: .9rem; color: #aebfe4; max-width: 300px; }
.footer-col h4 { font-family: 'Gabarito', 'Inter', sans-serif; color: #fff; font-size: 1rem; margin: 0 0 12px; letter-spacing: .02em; }
.footer-col a { display: block; color: #cfddf7; text-decoration: none; font-size: .92rem; padding: 3px 0; }
.footer-col a:hover { color: #fff; text-decoration: underline; }
.footer-col p { margin: 0 0 10px; font-size: .92rem; color: #aebfe4; }
.footer-col p a { display: inline; padding: 0; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.16); padding: 16px 0 22px; font-size: .83rem; color: var(--pale); text-align: center; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; gap: 20px; padding: 28px 0 20px; } }
.login-foot { position: fixed; left: 0; right: 0; bottom: 14px; text-align: center; color: rgba(207, 221, 247, .65); font-size: .82rem; }

/* cards, stats */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin: 16px 0; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 18px 0; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.stat-num { font-family: 'Gabarito', 'Inter', sans-serif; font-size: 1.9rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .86rem; font-weight: 500; }
.stat-wallet { background: linear-gradient(135deg, var(--navy) 0%, #274ea6 55%, var(--sky) 130%); border: none; color: #fff; }
.stat-wallet .stat-num { color: #fff; font-size: 2.3rem; }
.stat-wallet .stat-label { color: #cfddf7; text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; font-weight: 600; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

/* forms */
label { display: block; margin: 10px 0; font-weight: 600; font-size: .92rem; color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 11px 14px;
  border: 1px solid #d9dfee; border-radius: 12px; font-size: 1rem; background: #fff; color: var(--text);
  font-family: inherit; transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 4px rgba(68, 142, 193, .18); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: auto; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; }
.grid-form .span-all { grid-column: 1 / -1; }
@media (max-width: 600px) { .grid-form { grid-template-columns: 1fr; } }
.btn {
  display: inline-block; padding: 11px 22px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; color: var(--ink); font-family: 'Inter', sans-serif; font-size: .95rem; font-weight: 500;
  cursor: pointer; text-decoration: none; transition: all .15s ease;
}
.btn:hover { border-color: var(--pale); transform: translateY(-1px); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #f8fafc; font-weight: 600; box-shadow: 0 8px 20px rgba(30, 58, 138, .28); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: #f8fafc; }
.btn-danger { background: #fff5f5; border-color: #feb2b2; color: var(--red); box-shadow: none; }
.btn-danger:hover { border-color: var(--red); }
.btn-small { padding: 6px 14px; font-size: .85rem; }
.btn-block { width: 100%; text-align: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-row { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 2px 4px 2px 0; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; margin: 0; padding: 6px 10px; font-size: .85rem; border-radius: 8px; }
.stack-form input[type=text] { margin-bottom: 6px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid #eef1f7; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #f8fafc; }
tr:last-child td { border-bottom: none; }
.pos { color: var(--green); font-weight: 700; }
.neg { color: var(--red); font-weight: 700; }
.thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 10px; vertical-align: middle; margin-right: 8px; }

/* badges */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: .78rem; font-weight: 600; text-transform: capitalize; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-denied { background: #fee2e2; color: #991b1b; }
.badge-needs_info { background: #ffedd5; color: #9a3412; }
.badge-queued { background: #ede9fe; color: #5b21b6; }
.badge-sent { background: #d1fae5; color: #065f46; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-open { background: #d1fae5; color: #065f46; }
.badge-closed { background: #e2e8f0; color: #475569; }
.badge-new { background: #dbeafe; color: #1e40af; }
.badge-reviewed { background: #ede9fe; color: #5b21b6; }
.badge-contacted { background: #d1fae5; color: #065f46; }
.badge-archived { background: #e2e8f0; color: #475569; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.badge-role-admin { background: var(--navy); color: #fff; }
.badge-role-manager { background: #6b46c1; color: #fff; }
.badge-role-user { background: #e2e8f0; color: #475569; }

/* catalog — storefront grid */
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 20px; margin-top: 18px; }
.item-card { margin: 0; padding: 0; overflow: hidden; display: flex; flex-direction: column; transition: transform .15s ease, box-shadow .15s ease; }
.item-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.item-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.item-img-ph { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eef3fb 0%, #dbe7f8 100%); }
.item-img-ph img { width: 92px; height: auto; opacity: .9; }
.item-body { padding: 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.item-body h3 { font-size: 1.12rem; margin: 0; }
.item-body p { margin: 0; }
.item-desc { font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.price-row { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.pts-pill { background: var(--navy); color: #fff; font-weight: 700; font-size: .88rem; padding: 4px 13px; border-radius: 999px; }
.stock-badge { font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #d1fae5; color: #065f46; }
.stock-badge.low { background: #fef3c7; color: #92400e; }
.stock-badge.out { background: #fee2e2; color: #991b1b; }
.item-body form { margin-top: auto; padding-top: 8px; }
a.item-link { display: block; text-decoration: none; color: inherit; }
h3 a.item-link { display: inline; }
h3 a.item-link:hover { color: var(--navy); text-decoration: underline; }
.item-card .item-link .item-img, .item-card .item-link .item-img-ph { transition: transform .2s ease; }
.item-card .item-link:hover .item-img { transform: scale(1.02); }

/* product detail */
.product-card { padding: 26px; }
.product-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 30px; align-items: start; }
.product-img { width: 100%; max-height: 520px; object-fit: contain; border-radius: 12px; background: #eef3fb; display: block; }
.product-img-ph { border-radius: 12px; min-height: 320px; }
.product-img-ph img { width: 140px; }
.product-zoom-hint { margin: 8px 0 0; text-align: center; }
.product-name { margin-top: 0; font-size: 1.8rem; }
.pts-pill-lg { font-size: 1rem; padding: 6px 18px; }
.product-desc { font-size: 1rem; margin: 14px 0; white-space: pre-wrap; }
.product-cta { margin: 16px 0 10px; max-width: 340px; }
@media (max-width: 700px) { .product-layout { grid-template-columns: 1fr; gap: 18px; } .product-cta { max-width: none; } }

/* photo lightbox */
.product-img-btn { display: block; width: 100%; padding: 0; border: none; background: none; cursor: zoom-in; border-radius: 12px; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, .9); display: flex; align-items: center; justify-content: center; padding: 24px; }
.lightbox[hidden] { display: none; }
.lightbox-img { max-width: 92vw; max-height: 88vh; object-fit: contain; border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.5); background: #fff; }
.lightbox-close { position: absolute; top: 18px; right: 22px; width: 44px; height: 44px; border-radius: 999px; border: none; background: #fff; color: var(--ink); font-size: 1.5rem; font-weight: 700; line-height: 1; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.lightbox-close:hover { background: var(--bg); }

/* lists */
.ledger-list { list-style: none; padding: 0; margin: 0; }
.ledger-list li { padding: 9px 0; border-bottom: 1px solid #eef1f7; }
.ledger-list li:last-child { border-bottom: none; }

/* flash */
.flash { padding: 13px 18px; border-radius: 12px; margin: 14px 0; font-weight: 500; box-shadow: var(--shadow); }
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* login */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(900px 480px at 85% -10%, rgba(68, 142, 193, .45), transparent 60%),
    radial-gradient(700px 420px at -10% 110%, rgba(68, 142, 193, .28), transparent 60%),
    linear-gradient(160deg, #1b3377 0%, var(--navy-dark) 70%);
}
.login-card { background: #fff; border-radius: 20px; padding: 34px; width: 100%; max-width: 400px; box-shadow: 0 32px 64px rgba(6, 12, 34, .45); }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 1.2rem; margin-bottom: 22px; background: linear-gradient(180deg, #21409b, var(--navy)); border-radius: 12px; padding: 16px 12px; }
.login-card h1 { margin-top: 0; }
.narrow { max-width: 560px; }

@media (max-width: 700px) {
  h1 { font-size: 1.65rem; }
  .topbar-inner { padding: 10px 14px; gap: 10px; }
  .brand-logo { height: 40px; }
  .userchip { margin-left: 0; }
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .item-body { padding: 14px; }
}
