/* ============================================================
   R.L. Schreiber Product Library — design system
   Brand: navy + gold, PT Sans body, Pathway Gothic One display
   ============================================================ */
:root {
  --navy: #1b365d;
  --navy-deep: #10233f;
  --navy-soft: #2c4c7c;
  --gold: #b99245;
  --gold-soft: #e6d4a8;
  --gold-wash: #faf6ec;
  --green: #6f9e20;
  --ink: #22303f;
  --ink-soft: #5b6a7a;
  --paper: #f6f4ef;
  --card: #ffffff;
  --line: #e4dfd4;
  --ok: #2e7d43;
  --ok-wash: #e8f3ea;
  --warn: #a86e14;
  --warn-wash: #fdf3e0;
  --muted: #6b7280;
  --muted-wash: #eef0f2;
  --danger: #b3452f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 35, 63, .06), 0 6px 18px rgba(16, 35, 63, .07);
  --font-body: "PT Sans", "Segoe UI", sans-serif;
  --font-display: "Pathway Gothic One", "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.topbar {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #fff;
  border-bottom: 3px solid var(--gold);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; gap: 28px; height: 74px;
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: #fff; }
.brand img { height: 52px; width: auto; background: #fff; border-radius: 6px; padding: 4px 8px; }
.brand-name { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name b { font-family: var(--font-display); font-size: 1.28rem; letter-spacing: .14em; font-weight: 400; }
.brand-name span { font-size: .68rem; letter-spacing: .22em; color: var(--gold-soft); text-transform: uppercase; }

.mainnav { display: flex; gap: 4px; margin-left: auto; }
.mainnav a {
  font-family: var(--font-display); font-size: 1.02rem; letter-spacing: .1em;
  text-transform: uppercase; color: #cfd9e6; text-decoration: none;
  padding: 8px 14px; border-radius: 6px; transition: background .15s, color .15s;
}
.mainnav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.mainnav a.active { color: #fff; background: rgba(185, 146, 69, .28); box-shadow: inset 0 -2px 0 var(--gold); }

.demo-chip {
  font-size: .66rem; letter-spacing: .18em; font-weight: 700;
  color: var(--navy-deep); background: var(--gold-soft);
  padding: 4px 10px; border-radius: 99px; text-transform: uppercase;
}

/* ---------- Page scaffolding ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 34px 28px 70px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 {
  font-family: var(--font-display); font-weight: 400; letter-spacing: .06em;
  font-size: 2.1rem; margin: 0; color: var(--navy);
  text-transform: uppercase;
}
.page-head .sub { color: var(--ink-soft); margin: 4px 0 0; max-width: 62ch; }
.kicker {
  font-size: .72rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold); font-weight: 700; margin-bottom: 4px;
}

/* ---------- Cards & panels ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px 24px; }
.panel-title {
  font-family: var(--font-display); font-weight: 400; letter-spacing: .1em; text-transform: uppercase;
  font-size: 1.06rem; color: var(--navy); margin: 0 0 12px;
  padding-bottom: 8px; border-bottom: 2px solid var(--gold-soft);
}

/* ---------- Stat tiles (dashboard) ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.9rem; color: var(--navy); font-family: var(--font-display); font-weight: 400; letter-spacing: .04em; }
.stat span { color: var(--ink-soft); font-size: .86rem; }
.stat .accent { color: var(--gold); }

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th {
  text-align: left; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-soft); padding: 10px 14px; border-bottom: 2px solid var(--line);
  background: #fbfaf7;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--gold-wash); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: Consolas, "SF Mono", monospace; font-size: .86em; color: var(--navy-soft); }

/* ---------- Chips & badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; letter-spacing: .04em; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { color: var(--ok); background: var(--ok-wash); }
.chip.warn { color: var(--warn); background: var(--warn-wash); }
.chip.muted { color: var(--muted); background: var(--muted-wash); }
.tag { display: inline-block; font-size: .72rem; color: var(--navy-soft); background: #eef2f8; border: 1px solid #dbe3ef; padding: 2px 9px; border-radius: 5px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--font-body); font-weight: 700; font-size: .9rem;
  padding: 10px 20px; border-radius: 7px; border: 1px solid transparent;
  text-decoration: none; transition: filter .15s, background .15s;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { filter: brightness(1.15); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { filter: brightness(1.08); }
.btn-outline { background: #fff; color: var(--navy); border-color: var(--navy-soft); }
.btn-outline:hover { background: #f0f4fa; }
.btn-ghost { background: transparent; color: var(--navy-soft); }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger-outline { background: #fff; color: var(--danger); border-color: var(--danger); }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; margin-bottom: 5px; }
input[type=text], input[type=search], input[type=number], select, textarea {
  width: 100%; font-family: var(--font-body); font-size: .95rem; color: var(--ink);
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
.filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.filters input[type=search] { width: 300px; }
.filters select { width: auto; }

/* ---------- Product grid ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; text-decoration: none; color: var(--ink); transition: transform .12s, box-shadow .12s; }
.pcard:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(16,35,63,.1), 0 12px 28px rgba(16,35,63,.12); }
.pcard .imgwrap { background: #fff; height: 190px; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); }
.pcard img { max-height: 165px; max-width: 85%; object-fit: contain; }
.pcard .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.pcard h3 { margin: 0; font-size: 1rem; color: var(--navy); line-height: 1.3; }
.pcard .meta { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }

/* ---------- Allergen matrix ---------- */
.allergens { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.allergen { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .84rem; padding: 8px 12px; border-radius: 7px; border: 1px solid var(--line); background: #fbfaf7; }
.allergen b { font-weight: 400; }
.allergen .st { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.allergen.free .st { color: var(--ok); }
.allergen.may { background: var(--warn-wash); border-color: #ecd9b0; } .allergen.may .st { color: var(--warn); }
.allergen.contains { background: #fdeae5; border-color: #eec4b8; } .allergen.contains .st { color: var(--danger); }

/* ---------- Nutrition facts (FDA style) ---------- */
.nutrition { border: 2px solid var(--ink); padding: 10px 12px; max-width: 300px; background: #fff; font-family: Helvetica, Arial, sans-serif; }
.nutrition h4 { font-size: 1.6rem; margin: 0; font-weight: 900; letter-spacing: -.02em; }
.nutrition .serv { font-size: .8rem; border-bottom: 8px solid var(--ink); padding-bottom: 6px; margin-bottom: 4px; }
.nutrition .cal { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 4px solid var(--ink); padding: 4px 0; }
.nutrition .cal b { font-size: 1.5rem; font-weight: 900; }
.nutrition table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.nutrition td { padding: 3px 0; border-bottom: 1px solid #999; }
.nutrition td:last-child { text-align: right; font-weight: 700; }

/* ---------- Detail layout ---------- */
.detail-grid { display: grid; grid-template-columns: 340px 1fr; gap: 22px; align-items: start; }
.detail-grid .heroimg { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.detail-grid .heroimg img { max-width: 100%; max-height: 320px; object-fit: contain; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 22px; font-size: .92rem; }
.kv dt { color: var(--ink-soft); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; padding-top: 2px; }
.kv dd { margin: 0; }
.section { margin-top: 26px; }

/* ---------- Approval diff ---------- */
.diff { display: grid; grid-template-columns: 1fr 40px 1fr; gap: 10px; align-items: center; font-size: .92rem; }
.diff .before { background: #fdeae5; border: 1px solid #eec4b8; border-radius: 7px; padding: 10px 14px; text-decoration: line-through; color: #7c3a2b; }
.diff .after { background: var(--ok-wash); border: 1px solid #bcd9c3; border-radius: 7px; padding: 10px 14px; color: #1d5a2f; font-weight: 700; }
.diff .arrow { text-align: center; color: var(--ink-soft); font-size: 1.2rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy-deep); color: #fff; padding: 14px 26px; border-radius: 9px;
  border-left: 4px solid var(--gold); box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 90;
  font-size: .94rem;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Footer ---------- */
.foot {
  border-top: 1px solid var(--line); margin-top: 60px; padding: 22px 28px; text-align: center;
  color: var(--ink-soft); font-size: .8rem;
}
.foot b { color: var(--navy); }

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  .topbar-inner { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .mainnav { margin-left: 0; flex-wrap: wrap; }
}
