/*
 * Woodland Retail Partner Portal — design tokens + auth screens (FRONTEND_REFERENCE).
 */

@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --pine: #004648;
  --pine-ink: #002f30;
  --karaka: #00a079;
  --karaka-deep: #007a5c;
  --beige-1: #f7f2e8;
  --beige-2: #d4ccb8;
  --beige-3: #efe6d6;
  --beige-line: #e4d9c4;
  --stone: #6b6055;
  --ink: #1b1f1f;
  --ink-2: #3d4544;
  --ink-3: #5c6463;
  --ink-4: #8a8f8e;
  --white: #ffffff;
  --warn: #b45309;
  --err: #b91c1c;
  --err-bg: #fee2e2;
  --ok-bg: #ecfdf5;
  --platinum: #bdbec1;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

html:has(.portal-page) {
  height: 100%;
}

body:has(.portal-page) {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body {
  font-family: "Manrope", system-ui, sans-serif;
  background: var(--beige-3);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.mono { font-family: "JetBrains Mono", monospace; }

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-3);
}

.eyebrow.accent { color: var(--karaka-deep); }

.portal-env-banner {
  flex-shrink: 0;
  background: #9a6700;
  color: #fff;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 8px 12px;
}

.flash {
  max-width: 1280px;
  margin: 16px auto 0;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}

.flash.notice {
  background: var(--ok-bg);
  color: var(--pine);
  border: 1px solid rgba(0, 160, 121, 0.25);
}

.flash.alert {
  background: var(--err-bg);
  color: var(--err);
  border: 1px solid rgba(185, 28, 28, 0.2);
}

.auth-page {
  min-height: 100vh;
  padding: 24px 16px 40px;
}

.auth {
  max-width: 1280px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--beige-line);
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 520px;
}

.auth-brand {
  position: relative;
  background: var(--pine);
  color: var(--beige-1);
  padding: 40px;
  overflow: hidden;
}

.auth-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background: repeating-linear-gradient(135deg, #fff 0 1px, transparent 1px 11px);
}

.auth-brand::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -80px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, var(--karaka) 0%, transparent 70%);
  opacity: 0.18;
}

.auth-brand-inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.mark {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.brand-logo {
  height: 64px;
  width: auto;
  display: block;
}

.brand-logo-mini {
  height: 40px;
  width: auto;
  display: block;
}

.mark-box {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--karaka);
  color: var(--pine-ink);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
}

.mark-name { font-weight: 800; letter-spacing: 0.3px; }
.mark-sub { font-size: 11px; color: rgba(247, 242, 232, 0.7); letter-spacing: 0.4px; }

.auth-hero { margin-top: auto; margin-bottom: auto; }
.auth-hero h2 { font-size: 30px; line-height: 1.15; margin: 8px 0 0; font-weight: 800; }
.auth-eyebrow { color: var(--karaka); }

.auth-foot {
  font-size: 11px;
  color: rgba(247, 242, 232, 0.65);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-form {
  padding: 40px;
  display: flex;
  flex-direction: column;
}

.auth-form-top {
  display: flex;
  justify-content: flex-end;
  font-size: 13px;
  color: var(--karaka-deep);
  font-weight: 600;
}

.auth-form-top a { text-decoration: none; }
.auth-form-top a:hover { text-decoration: underline; }

.auth-mini-mark {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-mini-mark .mark-box { width: 28px; height: 28px; font-size: 15px; }
.auth-mini-mark .mark-name { color: var(--ink); font-size: 14px; }

.auth-body { margin: auto 0; }
.auth-body h1 { font-size: 26px; font-weight: 800; margin: 6px 0 6px; }
.auth-body .subtitle { color: var(--ink-2); margin: 0 0 22px; }

.field { margin-bottom: 18px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }

.field-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--beige-2);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  background: var(--white);
}

.field-input:focus {
  outline: none;
  border-color: var(--pine);
  box-shadow: 0 0 0 3px rgba(0, 70, 72, 0.1);
}

.btn {
  height: 48px;
  width: 100%;
  border: none;
  border-radius: 6px;
  background: var(--pine);
  color: var(--beige-1);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover { background: var(--pine-ink); }
.btn:disabled { cursor: wait; opacity: 0.92; }
.btn.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn.is-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--beige-1);
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

.auth-meta { margin-top: 16px; font-size: 12px; color: var(--ink-3); }
.auth-meta a { color: var(--karaka-deep); font-weight: 600; text-decoration: none; }
.auth-meta a:hover { text-decoration: underline; }

.access-request {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--beige-1);
  border: 1px solid var(--beige-line);
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-3);
}

.access-request-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.access-request p { margin: 4px 0 0; }
.access-request a { color: var(--karaka-deep); font-weight: 600; text-decoration: none; }
.access-request a:hover { text-decoration: underline; }

.pin-row { display: flex; gap: 10px; margin: 6px 0 18px; }

.pin-box {
  width: 56px;
  height: 64px;
  border: 1px solid var(--beige-2);
  border-radius: 6px;
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 26px;
  background: var(--white);
}

.pin-box:focus {
  outline: none;
  border-color: var(--pine);
  box-shadow: 0 0 0 3px rgba(0, 70, 72, 0.1);
}

.countdown {
  font-family: "JetBrains Mono", monospace;
  color: var(--ink-3);
  font-size: 13px;
}

.portal-placeholder {
  max-width: 720px;
  margin: 48px auto;
  padding: 32px;
  background: var(--white);
  border: 1px solid var(--beige-line);
  border-radius: 10px;
}

.portal-placeholder h1 { margin: 0 0 8px; font-size: 22px; }
.portal-placeholder p { color: var(--ink-3); margin: 0 0 20px; }

/* ───────── Stock portal ───────── */
.portal-page {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--white);
  overflow: hidden;
}

.topbar {
  flex-shrink: 0;
  height: 64px;
  background: var(--pine);
  color: var(--beige-1);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--pine-ink);
}

.topbar-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.topbar-logo {
  height: 52px;
  width: auto;
  display: block;
}
.topbar-logo-icon { display: none; }

.topbar-divider { width: 1px; height: 26px; background: rgba(247, 242, 232, 0.25); flex-shrink: 0; }
.topbar-context {
  font-size: 12px;
  color: rgba(247, 242, 232, 0.85);
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.3;
}
.topbar-context strong { color: var(--beige-1); font-size: 13px; }
.topbar-company { color: rgba(247, 242, 232, 0.7); font-size: 11px; }
.topbar-spacer { flex: 1; }
.topbar-nav { display: flex; gap: 18px; font-size: 13px; font-weight: 600; }
.topbar-nav a,
.topbar-nav span { text-decoration: none; padding: 4px 0; color: rgba(247, 242, 232, 0.8); }
.topbar-nav a.active { color: var(--beige-1); border-bottom: 2px solid var(--karaka); }
.topbar-nav .future {
  opacity: 0.4;
  cursor: not-allowed;
  position: relative;
}
.topbar-nav .future[data-tooltip]:hover::after,
.topbar-nav .future[data-tooltip]:focus::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--pine-ink);
  color: var(--beige-1);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 60;
  opacity: 1;
  pointer-events: none;
}
.acct-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--karaka); color: var(--pine-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.sign-out-btn {
  appearance: none;
  margin: 0;
  background: transparent;
  border: 1px solid rgba(247, 242, 232, 0.35);
  border-radius: 6px;
  color: rgba(247, 242, 232, 0.92);
  font: 600 12px/1 Manrope, system-ui, sans-serif;
  letter-spacing: 0.02em;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.sign-out-btn:hover {
  background: rgba(247, 242, 232, 0.1);
  border-color: rgba(247, 242, 232, 0.55);
  color: var(--beige-1);
}

/* ───────── Platinum Retail Partner ─────────
   Markup is server-gated in shared/_platinum_mark; these rules only style it.
   body.theme-platinum carries the accent tweaks. */
.platinum-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 4px;
  padding-left: 14px;
  border-left: 1px solid rgba(189, 190, 193, 0.28);
  flex-shrink: 0;
}

.platinum-mark-icon {
  width: 22px;
  height: 24px;
  display: block;
  flex-shrink: 0;
}

.platinum-mark-copy {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.2;
}

.platinum-mark-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--platinum);
}

.platinum-mark-sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--platinum);
}

.platinum-chip-icon {
  display: none;
  width: 16px;
  height: 18px;
  flex-shrink: 0;
}

body.theme-platinum .topbar {
  border-bottom-color: rgba(189, 190, 193, 0.35);
}

body.theme-platinum .topbar-nav a.active {
  border-bottom-color: var(--platinum);
}

body.theme-platinum .subbar {
  border-bottom: 1px solid rgba(189, 190, 193, 0.45);
}

.subbar {
  flex-shrink: 0;
  height: 44px;
  background: var(--beige-1);
  border-bottom: 1px solid var(--beige-line);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  font-size: 13px;
}
.subbar .crumb { color: var(--ink); font-weight: 600; }

.shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}
.sidebar {
  min-height: 0;
  border-right: 1px solid var(--beige-line);
  padding: 0 14px 18px;
  background: var(--beige-1);
  overflow-y: auto;
}
.sidebar-head {
  padding: 18px 6px 14px;
  border-bottom: 1px solid var(--beige-line);
  margin-bottom: 14px;
}
.sidebar-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}
.sidebar-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.4;
}
.side-label {
  font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--ink-3); margin: 4px 6px 8px; display: flex; justify-content: space-between;
}
.side-item {
  display: flex; justify-content: space-between; align-items: center; padding: 7px 10px;
  border-radius: 6px; cursor: pointer; font-size: 13px; text-decoration: none; color: inherit;
}
.side-item:hover { background: var(--beige-3); }
.side-item.active { background: var(--pine); color: var(--beige-1); }
.side-item .qty { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--ink-3); }
.side-item.active .qty { color: rgba(247, 242, 232, 0.8); }
.cat-group { margin-bottom: 2px; }
.cat-header {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
}
.cat-header.active .cat-link { color: var(--beige-1); }
.cat-header.active .caret { color: rgba(247, 242, 232, 0.85); }
.cat-header.active .cat-toggle:hover { background: rgba(247, 242, 232, 0.12); }
.cat-header.child-active .cat-label { color: var(--pine); font-weight: 700; }
.cat-header.child-active .qty { color: var(--ink); font-weight: 600; }
.cat-link {
  flex: 1;
  min-width: 0;
  padding: 7px 4px;
  text-decoration: none;
  color: inherit;
  border-radius: 6px;
}
.cat-link:hover { background: var(--beige-3); }
.cat-header.active .cat-link:hover { background: transparent; }
.cat-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  padding: 7px 0 7px 6px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: inherit;
  cursor: pointer;
  border-radius: 6px;
}
.cat-toggle:hover { background: var(--beige-3); }
.cat-header .qty { padding-right: 10px; flex-shrink: 0; }
.caret { display: inline-block; width: 14px; color: var(--ink-3); transition: transform 0.12s; flex-shrink: 0; }
.caret.open { transform: rotate(90deg); }
.side-sub { padding-left: 8px; }
.side-item-sub { padding-left: 28px !important; font-size: 12.5px; }
.side-section { margin-bottom: 18px; }
.checkrow {
  display: flex; align-items: center; gap: 9px; padding: 6px 10px; cursor: pointer;
  font-size: 13px; border-radius: 6px; text-decoration: none; color: inherit;
}
.checkrow:hover { background: var(--beige-3); }
.checkrow.active { background: rgba(0, 70, 72, 0.08); font-weight: 600; }
.check {
  width: 15px; height: 15px; border: 1px solid var(--beige-2); border-radius: 4px; display: inline-block;
}
.check.on { background: var(--pine); border-color: var(--pine); position: relative; }
.check.on::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px;
  border: solid var(--beige-1); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.side-count { margin-left: auto; font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--ink-3); }

.main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.main-pad {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 18px 24px 0;
}
.stock-sticky-head { flex-shrink: 0; }
.stock-table-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 24px;
}
.page-head h1 { font-size: 22px; font-weight: 800; margin: 0; }
.page-head .sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.page-head-mobile { display: none; }

.controls {
  display: grid; grid-template-columns: minmax(240px, 1fr) auto auto auto; gap: 12px;
  margin: 16px 0 12px; align-items: center;
}
.search { position: relative; min-height: 44px; }
.search input {
  width: 100%; height: 44px; padding: 0 38px; border: 1px solid var(--beige-2); border-radius: 6px;
  font-family: inherit; font-size: 14px; box-sizing: border-box;
}
.search input:focus { outline: none; border-color: var(--pine); box-shadow: 0 0 0 3px rgba(0, 70, 72, 0.1); }
.search-ic {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}
.search-hint {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px;
  border: 1px solid var(--beige-2); border-radius: 4px; display: grid; place-items: center;
  color: var(--ink-4); font-family: "JetBrains Mono", monospace; font-size: 12px;
}
.search-clear {
  position: absolute; right: 36px; top: 50%; transform: translateY(-50%);
  text-decoration: none; color: var(--ink-3); font-size: 18px; line-height: 1;
}
.seg {
  display: flex; align-items: center; flex-wrap: nowrap; gap: 2px; border: 1px solid var(--beige-2);
  border-radius: 6px; padding: 3px; background: var(--white); height: 44px; box-sizing: border-box;
}
.seg-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--ink-3); padding: 0 8px;
}
.seg-opt {
  padding: 6px 12px; border-radius: 4px; font-size: 13px; font-weight: 600; line-height: 1.2;
  color: var(--ink-2); cursor: pointer; white-space: nowrap; text-decoration: none;
}
.seg-opt.on { background: var(--pine); color: var(--beige-1); }

.chips {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; font-size: 12px;
}
.chips .label { font-weight: 700; letter-spacing: 1px; color: var(--ink-3); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--beige-1);
  border: 1px solid var(--beige-line); border-radius: 999px; padding: 4px 10px;
}
.chip .x { cursor: pointer; color: var(--ink-3); text-decoration: none; }
.chip-clear { color: var(--karaka-deep); font-weight: 600; cursor: pointer; text-decoration: none; }
.result-count { margin-left: auto; color: var(--ink-3); }
.result-count strong { color: var(--ink); }

.table-wrap { border: 1px solid var(--beige-line); border-radius: 8px; overflow: visible; }
table.stock { width: 100%; border-collapse: collapse; }
table.stock thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--pine); color: var(--beige-1); font-size: 11px; font-weight: 700;
  letter-spacing: 0.8px; text-transform: uppercase; text-align: left; padding: 11px 12px; white-space: nowrap;
}
table.stock thead th.num { text-align: right; }
/* box-shadow (not border-bottom) so the karaka underline sticks with the sticky th */
table.stock thead th.wh-on { background: var(--pine-ink); box-shadow: inset 0 -2px 0 var(--karaka); }
table.stock tbody td {
  padding: 8px 12px; border-bottom: 1px solid var(--beige-line); height: 40px; vertical-align: middle;
}
table.stock tbody tr:hover td { background: rgba(0, 70, 72, 0.025); }
table.stock td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.stock td.wh-on { background: rgba(0, 160, 121, 0.04); }
table.stock td.sku { font-family: "JetBrains Mono", monospace; font-size: 12.5px; color: var(--pine); font-weight: 500; }
table.stock td.name { font-weight: 600; }
.name-sub { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 400; font-family: "JetBrains Mono", monospace; }
table.stock td.cat { font-size: 12.5px; }
table.stock td.cat .range { display: block; font-weight: 600; color: var(--ink); font-size: 13px; }
table.stock td.cat .category { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 1px; }
.av { font-weight: 700; font-size: 13px; }
.av .unit { font-weight: 500; color: var(--ink-3); font-size: 11px; margin-left: 2px; }
.av.t-high, .av.t-mid { color: var(--pine); }
.av.t-low { color: var(--ink); }
.av.t-low::before { content: "▲ "; color: var(--warn); font-size: 10px; }
.av.t-low[data-tooltip] { position: relative; cursor: help; }
.av.t-low[data-tooltip]:hover::after,
.av.t-low[data-tooltip]:focus::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  padding: 6px 10px;
  border-radius: 4px;
  white-space: normal;
  width: max-content;
  max-width: 220px;
  text-align: center;
  z-index: 60;
  opacity: 1;
  pointer-events: none;
}
.av.t-out { color: var(--stone); text-decoration: line-through; }
.av.t-indent { color: var(--ink-3); font-style: italic; }
.av.wh-qty { font-weight: 600; color: var(--ink-2); }
.av.wh-qty .unit { font-weight: 500; color: var(--ink-3); font-size: 11px; margin-left: 2px; }
.next-arr .d { font-weight: 600; font-size: 12.5px; }
.next-arr .q { display: block; font-size: 11px; color: var(--ink-3); }
.next-arr .none { color: var(--ink-4); }

.cards { display: none; }
.card {
  border: 1px solid var(--beige-line); border-radius: 8px; padding: 12px; margin-bottom: 10px; background: var(--white);
}
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card-sku { font-family: "JetBrains Mono", monospace; font-size: 12.5px; color: var(--pine); font-weight: 500; }
.card-name { font-weight: 600; margin-top: 4px; }
.card-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.card-wh {
  display: flex; gap: 18px; margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--beige-line); font-size: 12px;
}
.card-wh .k { color: var(--ink-3); display: block; font-size: 10.5px; letter-spacing: 0.6px; text-transform: uppercase; }
.card-next { margin-top: 6px; font-size: 12px; color: var(--ink-3); }

.filter-btn {
  display: none; height: 44px; box-sizing: border-box; border: 1px solid var(--beige-2); border-radius: 6px; background: var(--white);
  font-family: inherit; font-weight: 600; font-size: 13px; align-items: center; justify-content: center;
  gap: 6px; cursor: pointer;
}
.filter-drawer-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 40;
}
.filter-drawer-backdrop.open { display: block; }

.empty-state {
  border: 1px dashed var(--beige-2); border-radius: 8px; padding: 32px; text-align: center; color: var(--ink-3);
}
.empty-state h2 { margin: 0 0 8px; color: var(--ink); font-size: 18px; }
.empty-clear { color: var(--karaka-deep); font-weight: 600; text-decoration: none; }

@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .page-head-mobile { display: block; margin-bottom: 4px; }
  .sidebar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 88vw);
    z-index: 50;
    overflow-y: auto;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.12);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0.2s;
  }
  .sidebar.open {
    transform: translateX(0);
    visibility: visible;
  }
  .filter-btn { display: flex; }
  .controls { grid-template-columns: 1fr auto auto auto; }
}

body.filter-drawer-open { overflow: hidden; }

@media (max-width: 640px) {
  .topbar {
    height: 52px;
    padding: 0 14px;
    gap: 10px;
  }
  .topbar-logo-full { display: none; }
  .topbar-logo-icon {
    display: block;
    height: 34px;
    width: 34px;
    object-fit: contain;
  }
  .topbar-divider,
  .topbar-context { display: none; }
  .platinum-mark { display: none; }
  .platinum-chip-icon { display: block; }
  .topbar-nav { gap: 12px; font-size: 12px; }
  .topbar-nav .future { display: none; }
  .acct-chip .nm { display: none; }
  .sign-out-btn { font-size: 11px; padding: 7px 10px; }
  .controls { grid-template-columns: 1fr; gap: 8px; }
  .seg { flex-wrap: wrap; height: auto; min-height: 44px; }
  .seg-opt { padding: 5px 10px; font-size: 12px; }
  .search-hint { display: none; }
  .table-wrap { border: none; background: transparent; }
  table.stock { display: none; }
  .cards { display: block; }
  .main-pad { padding: 14px 14px 0; }
  .stock-table-scroll { padding-bottom: 14px; }
}

@media (max-width: 1024px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-mini-mark { display: flex; }
}

@media (max-width: 640px) {
  .auth-form { padding: 26px; }
  .auth-body h1 { font-size: 22px; }
  .pin-box { width: 44px; height: 52px; font-size: 22px; }
  .pin-row { gap: 7px; }
}

/* Orders — master/detail (design brief 2a) */
:root {
  --wl-muted: #9A8F84;
  --wl-rule: #D4CCB8;
  --wl-tint: #EFE6D6;
  --wl-list: #FBFAF7;
  --od-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.orders-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}
.orders-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.orders-picker-pad {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 24px;
}
.orders-md {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 336px 1fr;
  background: var(--white);
}
.orders-list-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--beige-line);
  background: var(--beige-1);
  position: relative;
}
.orders-list-head {
  flex-shrink: 0;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--beige-line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.orders-page-head h1 {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
  color: var(--ink);
}
.orders-page-head .sub {
  color: var(--ink-3);
  font-size: 13px;
  margin-top: 2px;
}
.orders-context-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: rgba(0, 70, 72, 0.75);
}
.orders-change-customer {
  color: var(--pine);
  font-weight: 700;
  text-decoration: none;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.orders-list-head .search.od-search {
  margin: 0;
  min-height: 44px;
}
.orders-list-head .od-filters.seg {
  width: 100%;
  height: auto;
  min-height: 44px;
  flex-wrap: wrap;
}
.od-status-hint {
  margin: 0;
  font: 400 11px/1.45 Manrope, system-ui, sans-serif;
  color: var(--ink-3);
}
.od-status-hint strong {
  color: var(--ink);
  font-weight: 700;
}
.orders-list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--white);
}
.orders-list-rows { display: flex; flex-direction: column; }
.od-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--beige-line);
  border-left: 3px solid var(--beige-2);
  text-decoration: none;
  color: var(--pine);
  background: transparent;
  transition: background 160ms var(--od-ease), box-shadow 160ms var(--od-ease);
}
.od-row:hover { background: rgba(0, 70, 72, 0.03); }
.od-row.is-selected {
  background: rgba(0, 70, 72, 0.07);
  box-shadow: inset 0 0 0 1px var(--pine);
}
.od-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.od-row-po {
  font: 700 14.5px/1.15 Manrope, system-ui, sans-serif;
  color: var(--pine);
}
.od-row-status {
  font: 600 11px/1.15 Manrope, system-ui, sans-serif;
  flex-shrink: 0;
  color: var(--ink-3);
}
.od-row-builder {
  font: 400 12px/1.3 Manrope, system-ui, sans-serif;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.od-row-bottom {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.od-row-date {
  font: 400 11.5px/1.3 Manrope, system-ui, sans-serif;
  color: var(--ink-3);
}
.od-row-so {
  font: 400 11px/1.3 "JetBrains Mono", ui-monospace, Menlo, monospace;
  color: var(--ink-3);
}
.od-list-empty, .od-empty {
  padding: 28px 20px;
  color: var(--ink-3);
  font-size: 13.5px;
}
.od-clear-link {
  color: var(--pine);
  font-weight: 700;
  font-size: 12px;
}
.od-back-list {
  display: none;
  align-items: center;
  flex-shrink: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--beige-line);
  background: var(--white);
  color: var(--pine);
  font: 700 12px/1 Manrope, system-ui, sans-serif;
  text-decoration: none;
}
.orders-load-more {
  margin: 16px 0 24px;
  display: flex;
  justify-content: center;
}
.orders-load-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 16px;
  background: var(--pine);
  color: #fff;
  font: 800 10.5px/1 Manrope, system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 200ms var(--od-ease);
}
.orders-load-link:hover { background: #1A5658; color: #fff; }
.orders-load-link.is-loading {
  pointer-events: none;
  opacity: 0.7;
  background: #336A6C;
}

.orders-detail-pane {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--white);
}
#order-detail {
  min-height: 100%;
  position: relative;
}
#order-detail.is-loading > * {
  visibility: hidden;
}
#order-detail.is-loading::after {
  content: "Loading…";
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font: 700 12px/1 Manrope, system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pine);
  background: rgba(255, 255, 255, 0.96);
  padding: 8px 12px;
  border: 1px solid var(--beige-line);
  border-radius: 6px;
}
.orders-md.is-loading {
  position: relative;
  pointer-events: none;
}
.orders-md.is-loading::after {
  content: "Loading…";
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font: 700 12px/1 Manrope, system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pine);
  background: rgba(255, 255, 255, 0.96);
  padding: 8px 12px;
  border: 1px solid var(--beige-line);
  border-radius: 6px;
}
.orders-md.is-loading .orders-list-scroll,
.orders-md.is-loading .orders-detail-pane {
  opacity: 0.35;
}
.od-detail { min-height: 100%; }
.od-header {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--wl-rule);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.od-header-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.od-header-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.od-po {
  margin: 0;
  font: 700 34px/1 Manrope, system-ui, sans-serif;
  letter-spacing: -0.02em;
  color: var(--pine);
}
.od-header-sub {
  font: 400 13px/1.4 Manrope, system-ui, sans-serif;
  color: rgba(0, 70, 72, 0.75);
}
.od-mono {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
}
.od-header-total {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.od-eyebrow {
  font: 800 10px/1 Manrope, system-ui, sans-serif;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--wl-muted);
}
.od-total {
  font: 700 26px/1 Manrope, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--pine);
}

.od-fulfilment {
  padding: 20px 28px;
  border-bottom: 1px solid var(--wl-rule);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}
.od-step {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 16px;
}
.od-step:last-child { padding-right: 0; }
.od-step-bar {
  height: 4px;
  display: block;
  background: var(--wl-tint);
}
.od-step-bar.is-done { background: var(--karaka); }
.od-step-bar.is-partial {
  background: linear-gradient(
    to right,
    var(--karaka) 0,
    var(--karaka) var(--od-fill, 0%),
    var(--wl-tint) var(--od-fill, 0%),
    var(--wl-tint) 100%
  );
}
.od-step-label {
  font: 800 10px/1 Manrope, system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pine);
}
.od-step-detail {
  font: 400 12px/1.3 Manrope, system-ui, sans-serif;
  color: var(--wl-muted);
}

.od-body {
  padding: 22px 28px 32px;
  display: grid;
  grid-template-columns: 1fr 252px;
  gap: 32px;
  align-items: start;
}
.od-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.od-section { display: flex; flex-direction: column; gap: 10px; }
.od-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}
.od-section-label {
  font: 800 10px/1 Manrope, system-ui, sans-serif;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--wl-muted);
}
.od-section-meta {
  font: 400 11.5px/1 Manrope, system-ui, sans-serif;
  color: var(--wl-muted);
}
.od-muted { color: var(--wl-muted); font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.od-lines { border: 1px solid var(--beige-line); border-radius: 8px; overflow: hidden; }
.od-lines-head,
.od-line {
  display: grid;
  grid-template-columns: 1fr 92px 92px 104px;
  gap: 12px;
  padding: 13px 14px;
  align-items: baseline;
}
.od-lines-head {
  padding: 9px 14px;
  background: var(--beige-1);
  font: 800 10px/1 Manrope, system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0, 70, 72, 0.7);
}
.od-line { border-bottom: 1px solid var(--beige-line); }
.od-line:last-child { border-bottom: none; }
.od-line-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.od-line-name { font: 600 13.5px/1.2 Manrope, system-ui, sans-serif; color: var(--pine); }
.od-line-sku {
  font: 400 11px/1 "JetBrains Mono", ui-monospace, Menlo, monospace;
  color: var(--ink-3);
}
.od-line-note {
  display: block;
  margin-top: 2px;
  font: 400 12px/1.4 Manrope, system-ui, sans-serif;
  color: var(--ink-3);
  white-space: pre-line;
}
.od-line-note br + br { display: none; }
.od-qty { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font: 600 13px/1.35 Manrope, system-ui, sans-serif; }
.od-line-description {
  grid-template-columns: 1fr;
  background: var(--beige-1);
  padding: 10px 14px;
}
.od-line-description-text {
  font: 700 12.5px/1.35 Manrope, system-ui, sans-serif;
  color: var(--pine);
  letter-spacing: 0.01em;
  white-space: pre-line;
}
.od-line-freight,
.od-line-discount {
  background: var(--beige-1);
  font-weight: 400;
}
.od-freight-label {
  font: 800 9.5px/1 Manrope, system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-right: 8px;
}
.od-line-freight .od-line-item,
.od-line-discount .od-line-item {
  flex-direction: row;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.od-shipments { display: flex; flex-direction: column; gap: 10px; }
.od-shipment {
  border: 1px solid var(--wl-rule);
  border-left: 3px solid var(--karaka);
  background: var(--wl-list);
  overflow: hidden;
}
.od-shipment-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--wl-tint);
}
.od-shipment-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.od-shipment-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.od-shipment-id { font: 700 13.5px/1 Manrope, system-ui, sans-serif; color: var(--pine); }
.od-shipment-carrier {
  font: 400 12.5px/1.4 Manrope, system-ui, sans-serif;
  color: rgba(0, 70, 72, 0.8);
}
.od-track-btn {
  font: 800 10.5px/1 Manrope, system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--pine);
  padding: 9px 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 200ms var(--od-ease);
}
.od-track-btn:hover { background: #1A5658; color: #fff; }
.od-shipment-lines { background: #fff; }
.od-shipment-line {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--wl-tint);
  font: 600 12.5px/1.3 Manrope, system-ui, sans-serif;
  color: var(--pine);
}
.od-shipment-line:last-child { border-bottom: none; }
.od-outstanding {
  border: 1px dashed var(--wl-muted);
  background: #fff;
  padding: 13px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.od-outstanding-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font: 600 12.5px/1.3 Manrope, system-ui, sans-serif;
  color: var(--pine);
}

.od-rail {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.od-rail-block {
  padding: 0 0 16px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--wl-tint);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.od-rail-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.od-rail-value {
  font: 400 13px/1.45 Manrope, system-ui, sans-serif;
  color: var(--pine);
}

.orders-alert {
  border: 1px solid rgba(245, 166, 35, 0.35);
  background: rgba(245, 166, 35, 0.08);
  color: var(--ink);
  border-radius: 0;
  padding: 14px 16px;
  font-size: 14px;
  margin: 20px;
}
.orders-alert-list { margin: 16px; }

.customer-picker {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--wl-rule);
  background: var(--white);
  padding: 24px;
  max-width: 560px;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 4px 14px rgba(0, 70, 72, 0.08);
}
.customer-picker-head,
.customer-picker-form { flex-shrink: 0; }
.customer-picker-head h2 { margin: 0 0 6px; font-size: 20px; }
.customer-picker-head p { margin: 0 0 16px; color: var(--wl-muted); font-size: 14px; }
.customer-picker-form {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.customer-picker-search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
}
.customer-picker-search .search-ic {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  line-height: 1;
  color: var(--wl-muted);
  pointer-events: none;
}
.customer-picker-input {
  width: 100%;
  height: 44px;
  box-sizing: border-box;
  border: 1px solid var(--wl-muted);
  padding: 0 12px 0 40px;
  font-family: inherit;
  font-size: 14px;
}
.customer-picker-input:focus {
  outline: none;
  border-color: var(--pine);
  box-shadow: 0 0 0 3px rgba(0, 70, 72, 0.1);
}
.customer-picker-form .btn.customer-picker-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 96px;
  height: 44px;
  padding: 0 18px;
  font-size: 14px;
  white-space: nowrap;
  background: var(--pine);
  color: #fff;
  border: 0;
}
.customer-picker-results-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 4px;
}
.customer-picker-results-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin: 16px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--wl-rule);
}
.customer-picker-results-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--wl-muted);
}
.customer-picker-results-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--pine);
  background: rgba(0, 70, 72, 0.08);
  padding: 2px 8px;
}
.customer-picker-results {
  list-style: none;
  margin: 0;
  padding: 0 4px 0 0;
  overflow-y: auto;
  max-height: min(50vh, 420px);
  -webkit-overflow-scrolling: touch;
}
.customer-picker-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--wl-rule);
  margin-bottom: 8px;
  text-decoration: none;
  color: var(--ink);
  background: var(--white);
  transition: background 200ms var(--od-ease), border-color 200ms var(--od-ease);
}
.customer-picker-result:hover {
  background: rgba(0, 70, 72, 0.04);
  border-color: var(--pine);
}
.customer-picker-result-name { font-weight: 600; font-size: 14px; line-height: 1.35; }
.customer-picker-result-arrow {
  flex-shrink: 0;
  color: var(--karaka-deep);
  font-weight: 700;
  font-size: 14px;
}
.customer-picker-empty {
  flex-shrink: 0;
  margin: 16px 0 0;
  padding: 16px;
  color: var(--wl-muted);
  font-size: 14px;
  text-align: center;
  border: 1px dashed var(--wl-muted);
  background: var(--white);
}

@media (max-width: 1100px) {
  .od-body { grid-template-columns: 1fr; }
  .od-rail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding-top: 8px;
    border-top: 1px solid var(--wl-rule);
  }
  .od-rail-block { border-bottom: none; margin: 0; padding: 0; }
  .od-lines-head,
  .od-line {
    grid-template-columns: 1fr 72px 72px 88px;
    gap: 8px;
  }
  .od-line-description {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .orders-md { grid-template-columns: 1fr; }
  .orders-page.is-detail .orders-list-pane { display: none; }
  .orders-page:not(.is-detail) .orders-detail-pane { display: none; }
  .od-back-list { display: flex; }
  .od-po { font-size: 26px; }
  .od-header { padding: 18px 16px 14px; flex-direction: column; gap: 14px; }
  .od-header-total { text-align: left; }
  .od-fulfilment { padding: 16px; }
  .od-body { padding: 16px; gap: 20px; }
  .od-lines-head { display: none; }
  .od-line,
  .od-line-freight,
  .od-line-discount {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "item total"
      "ordered ordered"
      "unit unit";
    gap: 6px 12px;
    align-items: start;
  }
  .od-line-description {
    grid-template-columns: 1fr;
    grid-template-areas: "item";
  }
  .od-line > :nth-child(1) { grid-area: item; min-width: 0; }
  .od-line > :nth-child(2) {
    grid-area: ordered;
    text-align: left;
    align-items: flex-start;
  }
  .od-line > :nth-child(3) {
    grid-area: unit;
    text-align: left;
    align-items: flex-start;
  }
  .od-line > :nth-child(4) {
    grid-area: total;
    text-align: right;
    justify-self: end;
  }
  .od-qty { align-items: flex-start; }
  .customer-picker-form { flex-direction: column; }
  .customer-picker-form .btn.customer-picker-btn { width: 100%; min-width: 0; }
}
