/* Primal look (the redesign): black, white and Primal green, a DIN-like face, flat square cards on thin grey
   lines, black pill buttons. Loaded by both shells (manager_shell.html for the Office, base.html for the Warehouse)
   after their own styles, so it replaces their defaults; a page's own <style> still wins over it.

   The face is Barlow (free, SIL Open Font License), hosted here. The older faces the pages name in their own styles
   (Oswald, Inter) are pointed at it too, so every page changes without being edited. */

@font-face { font-family: 'Barlow'; font-weight: 300; font-display: block; src: url('fonts/barlow-300.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 400; font-display: block; src: url('fonts/barlow-400.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-display: block; src: url('fonts/barlow-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: block; src: url('fonts/barlow-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 700; font-display: block; src: url('fonts/barlow-700.woff2') format('woff2'); }
@font-face { font-family: 'Oswald'; font-weight: 400 700; font-display: block; src: url('fonts/barlow-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 300 400; font-display: block; src: url('fonts/barlow-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: block; src: url('fonts/barlow-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600 900; font-display: block; src: url('fonts/barlow-600.woff2') format('woff2'); }

/* ---------- tokens: the names every page already uses ---------- */
html[data-pair="primal"] {
  --paper: #ffffff; --bg: #ffffff; --card: #ffffff;
  --line: #e5e5e5; --line-top: #e5e5e5; --line-strong: #000000;
  --text: #000000; --steel: #555555;
  --ink: #000000; --ink-soft: #1c1c1c; --ink-border: #2a2a2a;
  --nav-text: #000000; --nav-text-active: #000000;
  --amber: #000000; --amber-dim: #f2f2f2; --accent-ink: #ffffff; --amber-glow: transparent;
  --green: #00e178; --green-deep: #00b862; --green-text: #007a42;
  --ok: #007a42; --ok-bg: #00e1781f; --alert: #d42020; --alert-bg: #d420201a;
  --muted-bg: #f4f4f4; --card-shadow: none; --topbar-bg: #ffffff;
  --band: #000000; --band-ink: #ffffff;
  color-scheme: light;
}
html[data-pair="primal"][data-scheme="dark"] {
  --paper: #0d0d0d; --bg: #0d0d0d; --card: #141414;
  --line: #2b2b2b; --line-top: #2b2b2b; --line-strong: #f5f5f5;
  --text: #f5f5f5; --steel: #b5b5b5;
  --nav-text: #f5f5f5; --nav-text-active: #ffffff;
  --amber: #ffffff; --amber-dim: #1f1f1f; --accent-ink: #000000; --amber-glow: transparent;
  --green-text: #3df29a;
  --ok: #3df29a; --ok-bg: #00e17826; --alert: #ff5a52; --alert-bg: #ff5a5226;
  --muted-bg: #1b1b1b; --topbar-bg: #0d0d0d;
  color-scheme: dark;
}

/* ---------- base ---------- */
html[data-pair="primal"] body { font-family: 'Barlow', 'DIN Pro', Arial, sans-serif; background: var(--bg); color: var(--text); font-variant-numeric: tabular-nums; }
::selection { background: #00e178; color: #000; }
:focus-visible { outline: 2px solid #00e178; outline-offset: 2px; }

h1, .pagehead h1 { font-family: 'Barlow', Arial, sans-serif; font-weight: 400; text-transform: uppercase; letter-spacing: .01em; text-wrap: balance; }
.pagehead h1 { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.05; }
.pagehead .sub { font-family: 'Barlow', Arial, sans-serif; font-size: 14px; color: var(--steel); }
.back-link { font-size: 13px; color: var(--steel); text-decoration: underline; text-underline-offset: 3px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.flash { background: var(--muted-bg); border: 0; border-left: 3px solid #00e178; border-radius: 0; backdrop-filter: none; -webkit-backdrop-filter: none; color: var(--text); }

button { font-family: 'Barlow', Arial, sans-serif; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: 13px;
  border-radius: 50px; border: 1px solid var(--amber); background: var(--amber); color: var(--accent-ink); box-shadow: none; padding: 11px 20px; }
button:hover { opacity: .88; }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--text); backdrop-filter: none; -webkit-backdrop-filter: none; }
button.secondary:hover { background: var(--muted-bg); opacity: 1; }
button.danger { background: transparent; color: var(--alert); border: 1px solid var(--alert); }
button.small { padding: 8px 14px; font-size: 12px; }
button:disabled { opacity: .4; cursor: not-allowed; }

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  font-family: 'Barlow', Arial, sans-serif; border-radius: 0; border: 1px solid #bbbbbb; background: var(--card); color: var(--text);
  backdrop-filter: none; -webkit-backdrop-filter: none; }
html[data-scheme="dark"] input:not([type="checkbox"]):not([type="radio"]), html[data-scheme="dark"] select, html[data-scheme="dark"] textarea { border-color: #444; }
input[type="checkbox"], input[type="radio"] { accent-color: #00b862; }

table { font-size: 14.5px; }
th { font-family: 'Barlow', Arial, sans-serif; font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--steel);
  border-bottom: 2px solid var(--line-strong); }
td { border-bottom: 1px solid var(--line); }

.badge { font-family: 'Barlow', Arial, sans-serif; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid currentColor; border-radius: 40px; padding: 3px 10px; }
.badge.pending { background: transparent; color: var(--steel); }

.tile { border-radius: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; border: 1px solid var(--line);
  border-top: 3px solid var(--tile-accent, var(--line-strong)); background: var(--card); }
.tile .num { font-family: 'Barlow', Arial, sans-serif; font-weight: 300; font-size: 34px; }
.tile .label { font-size: 11.5px; letter-spacing: .12em; }
.progress-track { border-radius: 0; height: 6px; background: var(--line); }
.progress-fill { border-radius: 0; background: #00e178; }
.pick-row { border-radius: 0; }
.pick-row:has(input:checked) { border-color: var(--text); background: var(--muted-bg); }
.loc-row { border-radius: 0; }

/* ---------- Office shell: header, black band of pages, phone drawer ---------- */
.ph-top { position: sticky; top: 0; z-index: 30; background: var(--topbar-bg); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 26px; min-height: 70px; padding: 0 clamp(16px, 3vw, 44px); }
.ph-logo { display: inline-flex; align-items: center; flex: none; }
.ph-logo img { width: 150px; height: 34px; object-fit: cover; display: block; filter: invert(1); }
html[data-scheme="dark"] .ph-logo img { filter: none; }
/* PRIMAL HUB as one wordmark (static/logo-hub.svg: the logo's letters plus H, U, B drawn alike; black, so the
   dark theme turns it white) */
.ph-logo img.ph-wordmark, .ph-drawer .ph-panel img.ph-wordmark { height: auto; aspect-ratio: 261.7 / 24; object-fit: contain; filter: none; }
.ph-logo img.ph-wordmark { width: 230px; }
.ph-drawer .ph-panel img.ph-wordmark { width: 190px; }
html[data-scheme="dark"] .ph-logo img.ph-wordmark, html[data-scheme="dark"] .ph-drawer .ph-panel img.ph-wordmark { filter: invert(1); }
.ph-envs { display: flex; gap: 24px; align-self: stretch; }
.ph-envs a { display: flex; align-items: center; font-weight: 600; font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text); border-top: 3px solid transparent; border-bottom: 3px solid transparent; white-space: nowrap; }
.ph-envs a.on { border-bottom-color: #00e178; }
.ph-envs a:hover { color: var(--steel); }
.ph-spacer { flex: 1; }
.ph-wh select { width: auto; margin: 0; padding: 7px 10px; font-size: 13px; }
.ph-account { position: relative; }
.ph-account summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 13px;
  letter-spacing: .1em; text-transform: uppercase; }
.ph-account summary::-webkit-details-marker { display: none; }
.ph-avatar { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--text); display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; letter-spacing: 0; }
.ph-menu { position: absolute; right: 0; top: calc(100% + 12px); min-width: 220px; background: var(--card); border: 1px solid var(--text); z-index: 40; padding: 6px 0; }
.ph-menu a, .ph-menu button { display: block; width: 100%; text-align: left; padding: 11px 16px; font-size: 14px; font-weight: 500; letter-spacing: 0;
  text-transform: none; background: none; border: 0; border-radius: 0; color: var(--text); cursor: pointer; }
.ph-menu a:hover, .ph-menu button:hover { background: var(--muted-bg); opacity: 1; }
.ph-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.ph-burger { display: none; background: none; border: 0; padding: 8px; margin: 0 -8px 0 0; color: var(--text); border-radius: 0; }
.ph-burger svg { width: 24px; height: 24px; display: block; }
.ph-band { background: var(--band); padding: 14px clamp(16px, 3vw, 44px); }
.ph-pills { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; }
.ph-pills::-webkit-scrollbar { display: none; }
.ph-pills a { flex: none; border: 1px solid var(--band-ink); color: var(--band-ink); padding: 9px 15px; border-radius: 3px; font-size: 14px; white-space: nowrap; }
.ph-pills a:hover { background: #ffffff1f; }
.ph-pills a.on { background: var(--band-ink); color: #000; }
/* a tab answers the tap at once: pressed while the finger is down, and lit while its page comes */
.ph-pills a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.ph-pills a:active, .ph-pills a.psc-going { background: var(--band-ink); color: #000; opacity: 1; }
.ph-main { padding: 28px clamp(16px, 3vw, 44px) 90px; max-width: 1440px; }
.ph-drawer { position: fixed; inset: 0; z-index: 60; display: flex; }
.ph-drawer[hidden] { display: none; }
.ph-drawer .ph-panel { width: min(320px, 86vw); background: #000; color: #fff; overflow-y: auto; padding: 18px 0 24px; }
.ph-drawer .ph-shade { flex: 1; background: #0008; }
.ph-drawer .ph-panel img { width: 140px; height: 32px; object-fit: cover; margin: 0 20px 18px; display: block; }
.ph-drawer h4 { font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: #9a9a9a; margin: 14px 20px 6px; }
.ph-drawer a, .ph-drawer button { display: block; width: 100%; text-align: left; color: #e6e6e6; padding: 10px 20px; font-size: 15px; background: none;
  border: 0; border-left: 3px solid transparent; border-radius: 0; text-transform: none; letter-spacing: 0; font-weight: 500; cursor: pointer; }
.ph-drawer a.on { color: #fff; border-left-color: #00e178; background: #ffffff14; }
@media (max-width: 899px) {
  .ph-envs, .ph-account .ph-name, .ph-wh { display: none; }
  .ph-burger { display: inline-flex; }
  .ph-top { gap: 12px; min-height: 58px; }
  .ph-logo { position: absolute; left: 50%; transform: translateX(-50%); }
  .ph-logo img { width: 120px; height: 28px; }
  .ph-logo img.ph-wordmark { width: 170px; height: auto; }
}

/* ---------- Warehouse shell ---------- */
.wh-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -16px -16px 0; padding: 10px 16px; min-height: 56px;
  background: var(--topbar-bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.wh-top .ph-logo img { width: 120px; height: 28px; }
.wh-top .ph-logo img.ph-wordmark { width: 180px; height: auto; }
.demo-bar ~ .wh-top { margin-top: 0; }
body:has(> .wh-top) > .demo-bar { margin: -16px -16px 0; }
.wh-top a.wh-out { margin-left: auto;  font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text); text-decoration: none; }
.wh-band { background: var(--band); margin: 0 -16px 16px; padding: 12px 16px; }
.wh-band .ph-pills a { font-size: 14px; padding: 9px 13px; text-decoration: none; }
.wh-title { font-size: 26px; font-weight: 400; text-transform: uppercase; letter-spacing: .01em; margin: 6px 0 14px; }
html[data-pair="primal"] .settings-fab { border-radius: 50%; background: var(--card); border: 1px solid var(--text); }

/* ---------- the pages' own pieces, brought into line ---------- */
.ph-main .rt-tabs { display: none; }  /* the black band already lists these pages */
body .hub-tile, body .wh-tile, body .ib-tile, body .rt-card, body .rt-tablecard, body .ib-card, body .rt-lcard { border-radius: 0; box-shadow: none; }
body .hub-tile:hover, body .wh-tile:hover, body .ib-tile:hover { border-color: var(--text); box-shadow: none; transform: none; }
body .hub-chip, body .wh-chip, body .ib-chip, body .rt-pill { font-family: 'Barlow', Arial, sans-serif; font-weight: 600; font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase; border: 1px solid currentColor; }
body .rt-btn { font-family: 'Barlow', Arial, sans-serif; text-transform: uppercase; letter-spacing: .1em; font-size: 12px; box-shadow: none; }
body .rt-btn.primary { background: var(--amber); color: var(--accent-ink); }
