/* RipTip Wholesale Portal — shared styles (v0.2, branded)
   Palette + type per the riptip-docs brand system:
   teal #1A6B5A / dark teal #0F5E4B / teal light #F2F9F7 / amber #F5A623
   charcoal #1D1D1D · Fonts: Bebas Neue (display), DM Mono (labels),
   Instrument Sans (body) */
:root {
  --teal: #1A6B5A;
  --teal-dark: #0F5E4B;
  --teal-light: #F2F9F7;
  --teal-notes: #EAF4F1;
  --amber: #F5A623;
  --ink: #1D1D1D;
  --paper: #f7f7f5;
  --card: #fff;
  --line: #E0E0E0;
  --grid: #D4D4D4;
  --muted: #666666;
  --green: #1A6B5A;
  --green-bg: #E8F5E9;
  --amber-text: #8a6100;
  --amber-bg: #FFF8E1;
  --red: #b3261e;
  --red-bg: #FBE9E7;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--teal); }

/* Header — dark teal bar with amber accent rule, white logo */
.topbar {
  background: var(--teal-dark); color: #fff;
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px; height: 60px;
  position: sticky; top: 0; z-index: 50;
  border-bottom: 3px solid var(--amber);
}
.topbar .brand { display: flex; align-items: baseline; gap: 10px; }
.topbar .brand img { height: 30px; display: block; align-self: center; }
.topbar .brand span {
  font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: .18em;
  color: var(--amber); text-transform: uppercase;
}
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav button {
  background: none; border: 0; color: #cfe3dd; font: inherit; font-weight: 600;
  padding: 8px 12px; cursor: pointer; border-radius: 6px;
}
.topbar nav button:hover { color: #fff; }
.topbar nav button.active { color: #fff; background: rgba(255,255,255,.14); }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.cart-btn {
  background: var(--amber); color: var(--ink); border: 0; font: inherit; font-weight: 700;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
.cart-btn:hover { filter: brightness(1.06); }
.signout { background: none; border: 0; color: #9dbfb6; cursor: pointer; font: inherit; }
.signout:hover { color: #fff; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 20px 80px; }
.page-title {
  font-family: 'Bebas Neue', 'Instrument Sans', sans-serif;
  font-size: 32px; font-weight: 400; letter-spacing: .04em; line-height: 1.1;
  margin-bottom: 4px;
}
.page-sub { color: var(--muted); margin-bottom: 20px; }

/* Cards / tables — teal header row, alternating teal-light rows */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--teal); color: #fff;
  text-align: left; font-family: 'DM Mono', monospace; font-weight: 500;
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  padding: 9px 10px;
}
thead th:first-child { border-radius: var(--radius) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius) 0 0; }
td { padding: 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tbody tr:nth-child(even) td { background: var(--teal-light); }
tr:last-child td { border-bottom: 0; }

/* Buttons + inputs */
.btn {
  background: var(--teal); color: #fff; border: 0; font: inherit; font-weight: 700;
  padding: 10px 18px; border-radius: 8px; cursor: pointer;
}
.btn:hover { background: var(--teal-dark); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.ghost { background: none; color: var(--teal); border: 1px solid var(--teal); }
.btn.ghost:hover { background: var(--teal-light); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #8e1d17; }
input, select, textarea {
  font: inherit; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: -1px; }
label {
  display: block; font-family: 'DM Mono', monospace; font-size: 12px;
  letter-spacing: .04em; font-weight: 500; margin: 12px 0 4px; color: var(--teal-dark);
}
.qty-input { width: 64px; text-align: center; }

/* Login / signup */
.auth-box { max-width: 400px; margin: 8vh auto 0; }
.auth-box .logo { text-align: center; margin-bottom: 8px; }
.auth-box .logo img { width: 190px; max-width: 70%; }
.auth-box .logo-tag {
  text-align: center; font-family: 'DM Mono', monospace; font-size: 13px;
  letter-spacing: .28em; color: var(--teal); text-transform: uppercase;
  margin-bottom: 24px;
}
.auth-box .card { border-top: 3px solid var(--amber); }

/* Shop */
.section-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.section-tabs button {
  background: #fff; border: 1px solid var(--line); font: inherit; font-weight: 600;
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
}
.section-tabs button:hover { border-color: var(--teal); color: var(--teal); }
.section-tabs button.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--teal-light); }
.msrp { color: var(--muted); text-decoration: line-through; font-size: 13px; }
.your-price { font-weight: 700; color: var(--teal-dark); }
.stock { font-size: 13px; color: var(--muted); }

/* Shop toolbar: section pills + view toggle */
.shop-toolbar { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.shop-toolbar .section-tabs { flex: 1; margin-bottom: 0; }
.view-toggle { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.view-toggle button {
  width: 44px; height: 38px; border: 0; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.view-toggle button:hover { color: var(--teal); }
.view-toggle button.active { background: var(--teal); color: #fff; }
.print-link {
  display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
  color: var(--teal-dark); text-decoration: none; font-weight: 600; font-size: 13px;
  white-space: nowrap;
}
.print-link:hover { border-color: var(--teal); background: var(--teal-light); }

/* Product grid (shop) */
.product-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}
.p-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.p-card:hover, .p-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(15,94,75,.14);
  border-color: var(--teal);
}
.p-card:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.p-img { position: relative; aspect-ratio: 1; background: var(--teal-light); }
.p-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-incart {
  position: absolute; top: 8px; right: 8px;
  background: var(--amber); color: var(--ink);
  font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 500;
  padding: 3px 9px; border-radius: 999px;
}
.p-body { padding: 12px 14px 14px; }
.p-name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.p-meta { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); margin: 3px 0 6px; }
.p-price { font-variant-numeric: tabular-nums; }
.p-price .your-price { font-size: 16px; }

/* Product detail modal */
.pm-bg {
  position: fixed; inset: 0; background: rgba(15,94,75,.5);
  z-index: 110; opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.pm-bg.open { opacity: 1; pointer-events: auto; }
.pm {
  position: fixed; z-index: 120; inset: 0; margin: auto;
  width: min(880px, calc(100vw - 32px)); height: min(600px, calc(100dvh - 48px));
  background: #fff; border-radius: 14px; border-top: 3px solid var(--amber);
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  opacity: 0; pointer-events: none; transform: scale(.97);
  transition: opacity .2s ease, transform .2s ease;
  overflow: hidden;
}
.pm.open { opacity: 1; pointer-events: auto; transform: scale(1); }
.pm-close {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 44px; height: 44px; border-radius: 999px; border: 0;
  background: rgba(255,255,255,.92); color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.pm-close:hover { background: #fff; color: var(--teal-dark); }
.pm-media { background: var(--teal-light); display: flex; flex-direction: column; min-height: 0; }
.pm-main { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.pm-thumbs { display: flex; gap: 8px; padding: 10px; overflow-x: auto; }
.pm-thumbs img {
  width: 52px; height: 52px; object-fit: cover; border-radius: 6px;
  cursor: pointer; border: 2px solid transparent; flex: 0 0 auto;
}
.pm-thumbs img.active { border-color: var(--teal); }
.pm-info { padding: 24px 24px 16px; display: flex; flex-direction: column; min-height: 0; }
.pm-info h2 {
  font-family: 'Bebas Neue', sans-serif; font-weight: 400; font-size: 28px;
  letter-spacing: .04em; line-height: 1.05; padding-right: 44px;
}
.pm-pricing { margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.pm-pricing .your-price { font-size: 18px; }
.pm-tier {
  font-family: 'DM Mono', monospace; font-size: 11px; color: var(--teal-dark);
  background: var(--teal-light); border-radius: 999px; padding: 2px 9px; margin-left: 4px;
}
.pm-desc {
  font-size: 13.5px; color: var(--muted); line-height: 1.55;
  max-height: 108px; overflow-y: auto; margin-bottom: 12px;
  padding-right: 6px;
}
.pm-desc p { margin-bottom: 6px; }
.pm-variants { flex: 1; overflow-y: auto; min-height: 0; border-top: 1px solid var(--grid); }
.pm-vrow {
  display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px;
  align-items: center; padding: 9px 0; border-bottom: 1px solid var(--grid);
}
.pm-vname { font-weight: 600; font-size: 14px; }
.pm-vprice { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pm-vstock { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); white-space: nowrap; }
.pm-vqty { display: flex; align-items: center; gap: 4px; }
.pm-vqty button {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 17px; font-weight: 700; cursor: pointer; color: var(--teal-dark);
}
.pm-vqty button:hover { background: var(--teal-light); border-color: var(--teal); }
.pm-vqty input {
  width: 52px; height: 34px; text-align: center; padding: 4px;
  font-variant-numeric: tabular-nums;
}
.pm-vqty input::-webkit-outer-spin-button, .pm-vqty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.pm-actions { padding-top: 12px; }
.pm-add { width: 100%; background: var(--amber); color: var(--ink); font-size: 15px; }
.pm-add:hover { background: var(--amber); filter: brightness(1.06); }

@media (max-width: 720px) {
  .pm {
    grid-template-columns: 1fr; grid-template-rows: 38% 1fr;
    width: 100vw; height: 100dvh; border-radius: 0; margin: 0; inset: 0;
  }
  .pm-info { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .p-card, .pm, .pm-bg, .drawer { transition: none; }
}

/* Cart drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(15,94,75,.45); z-index: 90; display: none; }
.drawer-bg.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw);
  background: #fff; z-index: 100; padding: 20px; overflow-y: auto;
  transform: translateX(100%); transition: transform .2s ease;
  box-shadow: -8px 0 30px rgba(0,0,0,.18);
  border-left: 3px solid var(--amber);
}
.drawer.open { transform: translateX(0); }
.drawer h2 { font-family: 'Bebas Neue', sans-serif; font-weight: 400; font-size: 26px; letter-spacing: .04em; margin-bottom: 12px; }
.cart-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.cart-line .info { flex: 1; }
.cart-line .info .name { font-weight: 600; font-size: 14px; }
.cart-line .info .meta { font-size: 12px; color: var(--muted); }
.shipto-summary {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--teal-light); border-radius: 8px; padding: 9px 12px; font-size: 13px;
}
.cart-sub { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); padding: 8px 0 0; font-variant-numeric: tabular-nums; }
.cart-total { display: flex; justify-content: space-between; font-weight: 800; font-size: 18px; padding: 10px 0 14px; color: var(--teal-dark); font-variant-numeric: tabular-nums; }
/* Status pills */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.amber { background: var(--amber-bg); color: var(--amber-text); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.gray { background: #eee; color: #555; }

/* Resources grid */
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.res-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.res-card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--teal-light); display: block; }
.res-card .body { padding: 10px 12px; }
.res-card .body .t { font-weight: 600; font-size: 13px; margin-bottom: 6px; }

/* Toast */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--teal-dark); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-weight: 600; z-index: 200; display: none; max-width: 90vw;
}
#toast.err { background: var(--red); }

.muted { color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.hidden { display: none !important; }
