/* HB Ops — styles */
:root {
  --bg: #f6f5f7;
  --card: #ffffff;
  --text: #1d1a22;
  --muted: #6e6878;
  --line: #ebe8ef;
  --line-strong: #dcd8e2;
  --accent: #c2255c;
  --accent-hover: #a51d4d;
  --accent-soft: #fdf0f4;
  --ok: #12805c;
  --ok-soft: #e8f6f0;
  --warn: #9a5b00;
  --warn-soft: #fff5e1;
  --info: #3b5bdb;
  --info-soft: #edf1ff;
  --danger: #c92a2a;
  --danger-soft: #fff0f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 26, 34, .04), 0 2px 8px rgba(29, 26, 34, .04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 4px; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 16px; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
kbd {
  font: 600 12px/1 ui-monospace, Menlo, monospace; padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; background: #fff;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 24px 20px 120px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 18px; }
.brandmark { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; }
.logo {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 800; letter-spacing: .02em;
}
.logo-lg { width: 52px; height: 52px; border-radius: 14px; font-size: 19px; }
.topnav { display: flex; gap: 2px; }
.topnav a { padding: 7px 12px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.topnav a:hover { color: var(--text); background: #f3f1f5; }
.topnav a.on { color: var(--accent); background: var(--accent-soft); }
.topbar .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #efe9f3; color: #5f3d77; font-size: 12px; font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; cursor: pointer;
  padding: 9px 16px; font: inherit; font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap;
  background: var(--accent); color: #fff; transition: background .15s, box-shadow .15s;
}
.btn:hover { background: var(--accent-hover); }
.btn:focus-visible { outline: 3px solid rgba(194, 37, 92, .3); outline-offset: 2px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-light { background: #fff; color: var(--text); border-color: var(--line-strong); }
.btn-light:hover { background: #f6f5f8; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f3f1f5; color: var(--text); }
.btn-danger-light { background: #fff; color: var(--danger); border-color: #f1c9c9; }
.btn-danger-light:hover { background: var(--danger-soft); }
.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.link-danger { background: none; border: 0; color: var(--danger); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; padding: 4px 6px; border-radius: 6px; }
.link-danger:hover { background: var(--danger-soft); }

/* ---------- Layout pieces ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head > div:first-child { max-width: 680px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.back:hover { color: var(--text); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card.pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.collapsible > summary { cursor: pointer; list-style: none; }
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible:not([open]) > summary { border-bottom: 0; }
.collapsible[open] > summary .muted.small:last-child { visibility: hidden; }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; background: var(--ok-soft); color: var(--ok); font-weight: 600; border: 1px solid #c8eadb; }
.error { padding: 10px 14px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-weight: 600; }

/* ---------- Forms ---------- */
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
input {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: #fff; color: var(--text); width: 100%;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194, 37, 92, .15); }

/* ---------- Login ---------- */
body.guest { background: radial-gradient(1200px 600px at 50% -10%, #fbe3ec, var(--bg)); min-height: 100vh; }
.login { max-width: 380px; margin: 10vh auto 0; padding: 28px; display: grid; gap: 16px; }
.login-head { text-align: center; display: grid; justify-items: center; gap: 6px; margin-bottom: 4px; }
.login-head h1 { margin: 6px 0 0; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .v { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; }
.stat .l { color: var(--muted); font-size: 13px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card .table-wrap { border: 0; border-radius: 0; }
.table-wrap + h2, .stats + h2, .monthpick + .stats { margin-top: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #faf9fb; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fcfbfd; }
.num { text-align: right; }
.sku { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; white-space: nowrap; color: #4b4555; }
.pname { overflow-wrap: anywhere; }
tfoot td { font-weight: 700; background: #faf9fb; border-top: 1px solid var(--line); border-bottom: 0; }
.empty { padding: 20px; margin: 0; text-align: center; }

/* ---------- Tags ---------- */
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: #f1eff4; color: var(--muted); white-space: nowrap; }
.tag-pending { background: var(--warn-soft); color: var(--warn); }
.tag-exported { background: var(--ok-soft); color: var(--ok); }
.tag-partial { background: var(--info-soft); color: var(--info); }
h1 .tag { font-size: 13px; }

.tabs { display: inline-flex; gap: 2px; padding: 3px; background: #f3f1f5; border-radius: 10px; font-size: 13px; font-weight: 600; }
.tabs a { padding: 5px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); }
.tabs a.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- Request list ---------- */
.batch-list { list-style: none; margin: 0; padding: 0; }
.batch-list li + li { border-top: 1px solid var(--line); }
.batch {
  display: grid; grid-template-columns: 1fr auto auto 16px; align-items: center; gap: 18px;
  padding: 14px 18px; color: var(--text); text-decoration: none; transition: background .12s;
}
.batch:hover { background: #fcf8fa; }
.batch-no { font-weight: 700; font-size: 15px; }
.batch-nums { display: flex; gap: 18px; font-size: 15px; }
.batch-nums > div { min-width: 70px; text-align: right; }
.chev { color: #b8b2c0; font-size: 22px; line-height: 1; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty-icon { font-size: 34px; margin-bottom: 6px; }

/* ---------- Staff: brand chips, search, entry table ---------- */
.brandbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: border-color .12s, background .12s;
}
.chip:hover { border-color: #c9c2d1; }
.chip .cnt { color: var(--muted); font-size: 12px; }
.chip.on { background: var(--text); border-color: var(--text); color: #fff; }
.chip.on .cnt { color: rgba(255,255,255,.7); }
.chip .filled {
  min-width: 18px; padding: 0 5px; border-radius: 99px; text-align: center;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px;
}
.searchbox { position: relative; margin-bottom: 16px; }
.searchbox svg { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.searchbox input { padding-left: 40px; height: 44px; border-radius: 12px; }

.sub { display: none; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* Entry list: one card-row per product with On hand + Request boxes */
.plist-head, .prow { display: grid; grid-template-columns: 1fr 110px 110px; gap: 12px; align-items: center; padding: 0 18px; }
.plist-head { padding-top: 8px; padding-bottom: 8px; background: #faf9fb; border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.plist-head span:not(:first-child) { text-align: center; }
.prow { padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); transition: background .12s; }
.prow:last-child { border-bottom: 0; }
.pinfo { min-width: 0; }
.prow .pname { font-weight: 500; line-height: 1.35; }
.pbrand { color: var(--muted); font-size: 12px; margin-top: 2px; }
.plist.one-brand .pbrand { display: none; }
.field { display: block; margin: 0; font-weight: 400; }
.field > span { display: none; }
.field input { text-align: center; font-weight: 700; font-size: 16px; padding: 8px 6px; height: 42px; }
.field input::placeholder { color: #c4bfcb; font-weight: 500; }
.onhand { background: #faf9fb; }
.prow.has-qty { background: var(--accent-soft); }
.prow.has-qty .qty { border-color: var(--accent); color: var(--accent); background: #fff; }
.prow.needs-qty .qty { border-color: #e8b04a; background: var(--warn-soft); }
/* hide number spinners */
.field input::-webkit-outer-spin-button, .field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field input[type=number] { -moz-appearance: textfield; }
.submit-sum { display: flex; flex-direction: column; line-height: 1.25; }
.dup-list-info li { background: #faf9fb; border-color: var(--line); }

.submitbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  background: rgba(255,255,255,.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(29,26,34,.05);
  padding-bottom: env(safe-area-inset-bottom);
}
.submitbar-inner { max-width: 1120px; margin: 0 auto; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; gap: 14px; }

/* ---------- Duplicate confirmation ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(29, 26, 34, .45); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 18px; max-width: 520px; width: 100%; max-height: 85vh; overflow: auto; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-box h2 { font-size: 20px; margin-bottom: 4px; }
.dup-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.dup-list li { padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); border: 1px solid #f6e2b8; }
.dup-name { font-weight: 600; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- Stock movement ---------- */
.monthpick { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.monthpick input { width: auto; padding: 8px 10px; }
.bar { height: 8px; background: var(--accent); border-radius: 4px; min-width: 2px; opacity: .85; }
tr.current td { background: var(--accent-soft); }
.wrap > h2 { margin: 26px 0 10px; }

/* ---------- Phones ---------- */
@media (max-width: 720px) {
  .wrap { padding: 18px 14px 120px; }
  .topbar-inner { padding: 8px 14px; gap: 10px; flex-wrap: wrap; }
  .appname, .who-name { display: none; }
  .topnav { order: 3; width: calc(100% + 28px); margin: 0 -14px; padding: 0 14px 2px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { flex: 1 0 auto; text-align: center; white-space: nowrap; font-size: 13.5px; padding: 7px 10px; }
  input, select, textarea { font-size: 16px; } /* stops iOS zooming into inputs */
  .confirm-actions .btn { flex: 1; }
  h1 { font-size: 21px; }
  th, td { padding: 10px 12px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat .v { font-size: 22px; }
  .page-head .actions, .page-head > .btn { width: 100%; }
  .page-head .actions .btn, .page-head .actions form { flex: 1; }
  .page-head .actions form .btn { width: 100%; }

  .brandbar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; scrollbar-width: none; }
  .chip { white-space: nowrap; flex: 0 0 auto; }
  .table .col-wide { display: none; }
  .table .sub { display: block; }

  /* Entry list on phones: name on top, two big boxes underneath */
  .plist-head { display: none; }
  .prow { grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px 14px; }
  .pinfo { grid-column: 1 / -1; }
  .field > span { display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
  .field-qty > span { color: var(--accent); }
  .field input { height: 48px; font-size: 18px; border-radius: 12px; }
  .submitbar-inner { padding: 10px 14px; }
  .submitbar .btn-lg { padding: 13px 20px; }

  .batch { grid-template-columns: 1fr auto 12px; gap: 6px 12px; padding: 14px; }
  .batch .batch-nums { grid-column: 1; grid-row: 2; gap: 14px; font-size: 14px; }
  .batch-nums > div { min-width: 0; text-align: left; }
  .batch .tag { grid-column: 2; grid-row: 1 / span 2; }
  .batch .chev { grid-column: 3; grid-row: 1 / span 2; }
}

/* ---------- Accounts, backups (v5) ---------- */
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.login-foot { text-align: center; font-size: 14px; margin-top: 2px; }
.who { color: var(--text); text-decoration: none; padding: 4px 8px 4px 4px; border-radius: 99px; }
.who:hover, .who.on { background: #f3f1f5; }
.count-badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; vertical-align: 1px; }
.mb { margin-bottom: 18px; }
.mt { margin-top: 12px; }
.pb { padding-bottom: 16px; }
.pad-x { padding-left: 18px; padding-right: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.grid-2 > .card { margin-bottom: 20px; }
.form-stack { display: grid; gap: 14px; }
.form-stack h2 { margin-bottom: 2px; }
.narrow { max-width: 360px; }
.label { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; padding: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
select {
  font: inherit; font-size: 14px; padding: 7px 30px 7px 10px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff;
  color: var(--text); appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #8a8394 50%), linear-gradient(135deg, #8a8394 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a61e1e; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); border-color: #f5d0d0; }
.btn-danger-soft:hover { background: #ffe3e3; }
.confirm-actions.left { justify-content: flex-start; }
.danger-zone { border-color: #f1c9c9; background: #fffafa; }
.danger-zone h2 { color: var(--danger); margin-bottom: 6px; }
.danger-zone p { margin-bottom: 14px; }
.error-text { color: var(--danger); margin-top: 6px; }
.big-num { font-size: 26px; font-weight: 750; letter-spacing: -.02em; margin: 14px 0 12px; }
.big-num .small { font-weight: 500; letter-spacing: 0; }
.by-table { padding-top: 12px; padding-bottom: 4px; }
.by-table summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
.by-table .table { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.table.compact th, .table.compact td { padding: 7px 12px; }
.link { font-weight: 600; font-size: 13px; text-decoration: none; padding: 4px 6px; border-radius: 6px; }
.link:hover { background: var(--accent-soft); }
.link-danger-text { color: var(--danger); }
.link-danger-text:hover { background: var(--danger-soft); }
.steps { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; }
code.copy { font: 12.5px/1.6 ui-monospace, Menlo, monospace; background: #f6f1f4; color: #8a1b45; padding: 2px 6px; border-radius: 6px; word-break: break-all; cursor: copy; }

.tag-main { background: var(--accent-soft); color: var(--accent); }
.tag-role-admin { background: #f1ebf8; color: #6a3d9a; }
.tag-role-staff { background: #f1eff4; color: var(--muted); }
.tag-disabled, .tag-rejected { background: #f1eff4; color: #8a8394; }
.tag-bk-nightly { background: var(--info-soft); color: var(--info); }
.tag-bk-manual { background: var(--ok-soft); color: var(--ok); }
.tag-bk-restore { background: var(--warn-soft); color: var(--warn); }

.user-list { list-style: none; margin: 0; padding: 0; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; flex-wrap: wrap; }
.user-row + .user-row { border-top: 1px solid var(--line); }
.user-main { min-width: 0; flex: 1 1 260px; }
.user-name { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-name .muted { font-weight: 500; }
.user-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-actions form.inline { display: contents; }
.pw-reset { position: relative; }
.pw-reset > summary { list-style: none; }
.pw-reset > summary::-webkit-details-marker { display: none; }
.pw-form { display: flex; gap: 6px; margin-top: 8px; }
.pw-form input { width: 220px; padding: 7px 10px; }
.pw-reset[open] { flex-basis: 100%; order: 5; }

@media (max-width: 720px) {
  .who { padding: 2px; }
  .user-row { padding: 14px; }
  .user-actions { width: 100%; }
  .pw-form { flex-wrap: wrap; }
  .pw-form input { flex: 1; width: auto; }
  .grid-2 { gap: 0; }
}
.bk-date { white-space: nowrap; }
@media (max-width: 720px) {
  .bk-date { white-space: normal; }
  .bk-actions a { display: block; text-align: right; }
}
