:root {
  --navy-deep: #000e28;
  --navy: #072130;
  --navy-soft: #0f3d57;
  --orange: #f37321;
  --orange-soft: #fde8d9;
  --bg: #f3f9ff;
  --ink: #212529;
  --ink-muted: #6a7177;
  --line: #d7dadb;
  --white: #ffffff;
  --radius: 14px;
  --shadow: 0 4px 16px rgba(0, 14, 40, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: var(--navy);
  color: var(--white);
  padding: 14px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.brand-sub {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-wrap input {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--navy-soft);
  background: var(--navy-deep);
  color: var(--white);
  font-family: inherit;
  font-size: 0.9rem;
  min-width: 230px;
}

.search-wrap input::placeholder {
  color: #9fb3c0;
}

.search-wrap input:focus {
  outline: 2px solid var(--orange);
  outline-offset: 1px;
}

.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 9px 20px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border: 1px solid var(--white);
}

.btn-outline:hover {
  background: var(--white);
  color: var(--navy-deep);
}

.btn-orange {
  background: var(--orange);
  color: var(--white);
}

.btn-orange:hover {
  background: #d9620f;
}

.btn-danger {
  background: transparent;
  color: #b42318;
  border: 1px solid #b42318;
}

.btn-danger:hover {
  background: #fef2f2;
}

.rack-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 28px;
  background: var(--navy-deep);
}

.rack-tab {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--navy-soft);
  background: transparent;
  color: #c9d6de;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rack-tab:hover {
  border-color: var(--orange);
  color: var(--white);
}

.rack-tab.active {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--white);
}

.rack-tab .tab-count {
  font-weight: 400;
  opacity: 0.8;
  font-size: 0.75rem;
  margin-left: 4px;
}

.rack-tab .tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 7px;
  border-radius: 999px;
  background: #e5342a;
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.page {
  display: flex;
  gap: 20px;
  padding: 24px 28px;
  align-items: flex-start;
}

.content {
  flex: 1;
  min-width: 0;
  background: var(--white);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.view-header h1 {
  margin: 0;
  font-size: 1.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--navy);
}

.view-header .occupancy {
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.rack-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  background: var(--white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  font-family: inherit;
  text-align: left;
}

.rack-card:hover {
  border-color: var(--orange);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.rack-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rack-card .card-meta {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.fill-bar {
  height: 8px;
  border-radius: 999px;
  background: #e8eef4;
  overflow: hidden;
}

.fill-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--orange);
  transition: width 0.3s ease;
}

.rack-card .card-count {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
}

.stock-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stock-row {
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  background: var(--white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stock-row:hover {
  border-color: var(--orange);
  box-shadow: var(--shadow);
}

.stock-image {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
}

.stock-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.stock-no-image {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-align: center;
}

.stock-info {
  flex: 1;
  min-width: 0;
}

.stock-code {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.03em;
  margin-bottom: 8px;
  word-break: break-all;
}

.stock-locations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stock-location {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--navy);
  cursor: pointer;
  transition: all 0.15s ease;
}

.stock-location:hover {
  border-color: var(--orange);
  background: var(--orange-soft);
  color: #c25a10;
}

.stock-qty {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
}

.stock-qty .qty-number {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--orange);
  line-height: 1.1;
}

.stock-qty .qty-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.rack-grid {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.rack-cell {
  position: relative;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.rack-cell .cell-pos {
  position: absolute;
  top: 5px;
  left: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
  pointer-events: none;
}

.rack-cell:hover {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.rack-cell.armed {
  outline: 3px solid var(--orange);
  outline-offset: -1px;
  box-shadow: 0 0 0 4px var(--orange-soft);
  animation: armed-pulse 1.1s ease-in-out infinite;
}

@keyframes armed-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--orange-soft); }
  50% { box-shadow: 0 0 0 7px var(--orange-soft); }
}

.rack-cell.drag-over {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.rack-cell.has-epic {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 18px 6px 6px;
  text-align: center;
  overflow: hidden;
}

.rack-cell.has-epic .cell-pos {
  color: #9fb3c0;
}

.rack-cell.has-epic img {
  width: 100%;
  max-height: 110px;
  object-fit: contain;
  display: block;
  border-radius: 6px;
  background: var(--white);
}

.rack-cell.has-epic .epic-label {
  font-size: 0.72rem;
  line-height: 1.2;
  word-break: break-all;
}

.rack-cell.is-partial {
  border-style: dashed;
  border-color: var(--orange);
}

.partial-badge {
  position: absolute;
  top: 5px;
  right: 6px;
  z-index: 1;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--orange);
  color: var(--white);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.texstrip-badge {
  position: absolute;
  top: 5px;
  right: 6px;
  z-index: 1;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--navy-soft);
  color: var(--white);
  font-size: 0.5rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.rack-cell.has-epic .mm-label {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--orange);
  letter-spacing: 0.02em;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.reel-count-badge {
  position: absolute;
  top: 5px;
  right: 28px;
  z-index: 1;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.stock-location.is-partial {
  border-color: var(--orange);
}

.stock-partial {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--orange);
  color: var(--white);
  font-size: 0.62rem;
  font-weight: 700;
}

@keyframes pulse-cell {
  0%, 100% { outline: 3px solid transparent; }
  50% { outline: 3px solid var(--orange); }
}

.rack-cell.pulse {
  animation: pulse-cell 0.7s ease 3;
}

.empty-note {
  color: var(--ink-muted);
}

.epic-panel {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.epic-panel[hidden] {
  display: none;
}

.epic-panel h2 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy);
}

.epic-choose {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--orange);
  border-radius: 12px;
  background: var(--orange);
  color: var(--white);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.epic-choose:hover,
.epic-choose:active {
  background: #d9620f;
  border-color: #d9620f;
}

.epic-choose-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}

.epic-choose-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.epic-choose-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.epic-choose-sub {
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0.85;
}

.epic-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 2px solid var(--navy);
  border-radius: 12px;
  background: var(--white);
}

.epic-selected[hidden] {
  display: none;
}

.epic-selected-thumb {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
}

.epic-selected-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.epic-selected-noimg {
  color: var(--ink-muted);
}

.epic-selected-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.epic-selected-epic {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

.epic-selected-name {
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.epic-selected-clear {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.epic-selected-clear:hover,
.epic-selected-clear:active {
  border-color: #b42318;
  color: #b42318;
}

.epic-drag-chip {
  padding: 12px;
  border: 1px dashed var(--orange);
  border-radius: 10px;
  background: var(--orange-soft);
  color: #c25a10;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
  cursor: grab;
}

.epic-drag-chip:active {
  cursor: grabbing;
}

.trash-bin {
  padding: 14px;
  border: 2px dashed #b42318;
  border-radius: 10px;
  text-align: center;
  color: #b42318;
  font-weight: 700;
  font-size: 0.85rem;
  background: #fef2f2;
  cursor: pointer;
  transition: background 0.15s ease;
}

.trash-bin.drag-over,
.trash-bin:active {
  background: #fecaca;
}

.hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

kbd {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.72rem;
  font-family: inherit;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}

.toast {
  max-width: min(92vw, 560px);
  background: var(--navy-deep);
  color: var(--white);
  padding: 11px 22px;
  border-radius: 22px;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
}

.toast.warn {
  background: var(--orange);
}

.toast.has-action {
  display: flex;
  align-items: center;
  width: min(92vw, 560px);
  gap: 14px;
  text-align: left;
  padding: 8px 8px 8px 20px;
  pointer-events: auto;
}

.toast-text {
  flex: 1;
}

.toast-action {
  flex: none;
  border: 0;
  border-radius: 18px;
  background: var(--orange);
  color: var(--white);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 20px;
  min-height: 40px;
  cursor: pointer;
}

.toast-action:hover {
  background: #d9620f;
}

.toast-action:active {
  transform: scale(0.97);
}

.toast.warn .toast-action {
  background: var(--navy-deep);
}

.toast.warn .toast-action:hover {
  background: var(--navy-soft);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast.hide {
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.auth-locked {
  overflow: hidden;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 30%, var(--navy) 0%, var(--navy-deep) 70%);

  touch-action: manipulation;
}

.auth-overlay.hidden {
  display: none;
}

.auth-card {
  width: 100%;
  max-width: 340px;
  background: var(--white);
  border-radius: 20px;
  padding: 30px 26px 26px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.auth-card.shake {
  animation: auth-shake 0.4s ease;
}

@keyframes auth-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.auth-logo {
  height: 34px;
  width: auto;
  margin-bottom: 16px;
}

.auth-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-sub {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

.auth-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0 6px;
  min-height: 16px;
}

.auth-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.auth-dot.filled {
  background: var(--orange);
  border-color: var(--orange);
}

.auth-error {
  min-height: 18px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #b42318;
  margin-bottom: 10px;
}

.auth-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.auth-key {
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: 600;
  padding: 16px 0;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--navy);
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;

  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.auth-key:hover {
  background: var(--orange-soft);
  border-color: var(--orange);
}

.auth-key:active {
  transform: scale(0.95);
}

.auth-key-alt {
  color: var(--ink-muted);
  font-size: 1.6rem;
}

.auth-key-enter {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--white);
  font-size: 1.5rem;
}

.auth-key-enter:hover {
  background: #d9620f;
  color: var(--white);
}

.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--navy-deep);
  border: 1px solid var(--navy-soft);
}

.user-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--white);
  white-space: nowrap;
}

.user-role {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--navy-deep);
  background: var(--orange);
  padding: 2px 7px;
  border-radius: 999px;
}

.user-btn {
  padding: 7px 14px;
  font-size: 0.82rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  background: rgba(0, 14, 40, 0.55);
}

.modal {
  width: 100%;
  max-width: 620px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--navy);
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 0 4px;
}

.modal-close:hover {
  color: var(--navy);
}

.modal-body {
  padding: 20px 22px 24px;
}

.modal-subhead {
  margin: 22px 0 12px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy);
}

.modal-warning {
  padding: 10px 14px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #f3b0a9;
  color: #b42318;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 16px;
}

#productModal .modal {
  max-width: 880px;
}

.product-field-inline {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.product-field-inline input,
.product-field-inline select {
  width: 100%;
  min-width: 0;
  padding: 8px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--navy);
  background: var(--white);
}

.product-field-inline select {
  width: auto;
  min-width: 170px;
  max-width: 100%;
  justify-self: start;
}

.product-field-inline input:focus,
.product-field-inline select:focus {
  outline: 2px solid var(--orange);
  outline-offset: 1px;
  border-color: var(--orange);
}

.scanner-modal {
  max-width: 460px;
}

.scanner-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scanner-reticle {
  position: absolute;
  inset: 18% 12%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.scanner-hint {
  margin: 14px 0 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
  text-align: center;
}

.scanner-error:not(:empty) {
  margin-top: 12px;
}

.picker-modal {
  max-width: 480px;
}

.picker-search {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 0.95rem;
}

.picker-search:focus {
  outline: 2px solid var(--orange);
  outline-offset: 1px;
  border-color: var(--orange);
}

.picker-crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 12px 0;
  font-size: 0.8rem;
}

.picker-crumb {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--orange);
  cursor: pointer;
  padding: 2px 2px;
  touch-action: manipulation;
}

.picker-crumb.current {
  color: var(--ink-muted);
  cursor: default;
}

.picker-crumb-sep {
  color: var(--ink-muted);
}

.picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 52vh;
  overflow-y: auto;
}

.picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.picker-item:hover,
.picker-item:active {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.picker-thumb {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
}

.picker-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.picker-noimg {
  color: var(--ink-muted);
  font-size: 0.8rem;
}

.picker-item-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.picker-item-main {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy);
  word-break: break-word;
}

.picker-item-sub {
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.picker-item-count {
  flex-shrink: 0;
  min-width: 24px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.picker-epic .picker-item-body {
  flex: 1;
}

.chooser-overlay {
  align-items: center;
  padding: 3vh 3vw;
}

.chooser-modal {
  width: min(100%, 940px);
  max-width: 940px;
  min-height: min(74vh, 760px);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chooser-modal .modal-head h2 {
  font-size: 1.2rem;
}

.chooser-modal .modal-close {
  font-size: 2.2rem;
  padding: 0 10px;
  touch-action: manipulation;
}

.chooser-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex-shrink: 0;
}

.chooser-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 12px;
  border: none;
  border-bottom: 4px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.chooser-tab svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.chooser-tab:hover {
  color: var(--navy);
}

.chooser-tab.active {
  background: var(--white);
  color: var(--navy);
  border-bottom-color: var(--orange);
}

.chooser-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 26px;
}

.chooser-pane[hidden] {
  display: none;
}

.chooser-field-label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
}

.chooser-field {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font-family: inherit;
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--navy);
  text-align: center;
}

.chooser-field::placeholder {
  color: #b9c4cc;
  font-weight: 600;
}

.chooser-field:focus {
  outline: 3px solid var(--orange);
  outline-offset: 1px;
  border-color: var(--orange);
  background: var(--white);
}

.chooser-match {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.chooser-match.found {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.chooser-match.unknown {
  border-color: var(--line);
  background: var(--bg);
}

.chooser-match-thumb {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  overflow: hidden;
}

.chooser-match-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chooser-match-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chooser-match-main {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
}

.chooser-match-sub {
  font-size: 0.85rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.chooser-pane-epic {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.chooser-keypad {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(56px, 1fr);
  gap: 10px;
  margin-top: 16px;
  width: 100%;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

.keypad-key {
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  font-family: inherit;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.1s ease, border-color 0.1s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.keypad-key:hover,
.keypad-key:active {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.keypad-alt {
  font-size: 1.15rem;
  color: var(--ink-muted);
  background: var(--bg);
}

.chooser-search {
  width: 100%;
  padding: 15px 18px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1.15rem;
  color: var(--navy);
}

.chooser-search:focus {
  outline: 3px solid var(--orange);
  outline-offset: 1px;
  border-color: var(--orange);
}

.chooser-modal .picker-crumbs {
  margin: 16px 0;
  font-size: 1rem;
}

.chooser-modal .picker-crumb,
.chooser-modal .picker-crumb-sep {
  font-size: 1rem;
  padding: 6px 4px;
}

.picker-list-lg {
  max-height: none;
  gap: 12px;
}

.picker-list-lg .picker-item {
  padding: 16px 18px;
  border-width: 2px;
  border-radius: 12px;
  gap: 16px;
}

.picker-list-lg .picker-thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
}

.picker-list-lg .picker-item-main {
  font-size: 1.15rem;
}

.picker-list-lg .picker-item-sub {
  font-size: 0.9rem;
}

.picker-list-lg .picker-item-count {
  font-size: 0.9rem;
  padding: 6px 14px;
}

.picker-list-lg .picker-pack .picker-item-main {
  font-size: 1.35rem;
}

.picker-list-lg .picker-pack {
  padding: 22px 20px;
}

.chooser-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 16px 26px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.chooser-btn {
  padding: 15px 26px;
  border-radius: 999px;
  border: 2px solid transparent;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.chooser-btn[hidden] {
  display: none;
}

.chooser-btn svg {
  width: 22px;
  height: 22px;
}

.chooser-btn-ghost {
  background: var(--white);
  border-color: var(--line);
  color: var(--navy);
}

.chooser-btn-ghost:hover {
  border-color: var(--navy);
}

.chooser-btn-primary,
.chooser-btn-danger {
  margin-left: auto;
  background: var(--orange);
  color: var(--white);
}

.chooser-btn-danger {
  background: #b42318;
}

.chooser-btn-danger:hover:not([disabled]) {
  background: #8f1c13;
}

.chooser-btn-danger[disabled] {
  background: var(--line);
  color: #8b959b;
  cursor: not-allowed;
}

.chooser-btn-primary:hover:not([disabled]) {
  background: #d9620f;
}

.chooser-btn-primary[disabled] {
  background: var(--line);
  color: #8b959b;
  cursor: not-allowed;
}

#dbBlocker {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 14, 40, 0.82);
}

#dbBlocker[hidden] {
  display: none;
}

.db-blocker-card {
  width: min(100%, 460px);
  padding: 32px 28px;
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.db-blocker-icon {
  width: 54px;
  height: 54px;
  color: #b42318;
}

.db-blocker-card h2 {
  margin: 14px 0 8px;
  font-size: 1.25rem;
  color: var(--navy);
}

.db-blocker-card p {
  margin: 0 0 20px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.db-blocker-card .btn {
  padding: 14px 28px;
  font-size: 1rem;
}

.db-blocker-sub {
  margin: 16px 0 0 !important;
  font-size: 0.8rem !important;
}

.misc-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.misc-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--orange);
  border-radius: 12px;
  background: var(--white);
}

.misc-thumb {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
}

.misc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.misc-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 200px;
}

.misc-epic {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
}

.misc-product {
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.misc-where {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 220px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--orange-soft);
}

.misc-where-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #c25a10;
}

.misc-location {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  word-break: break-word;
}

.misc-note {
  font-size: 0.8rem;
  color: var(--ink-muted);
  word-break: break-word;
}

.misc-meta {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  text-align: right;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.misc-who {
  font-weight: 700;
  color: var(--navy);
}

.misc-remove {
  flex-shrink: 0;
}

@media (max-width: 860px) {
  .misc-row {
    flex-wrap: wrap;
    gap: 12px;
  }

  .misc-where {
    flex-basis: 100%;
    order: 3;
  }

  .misc-meta {
    text-align: left;
    flex-direction: row;
    gap: 8px;
    order: 4;
  }

  .misc-remove {
    order: 5;
    margin-left: auto;
  }
}

.rack-comments {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.rack-comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.rack-comments h2 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy);
}

.rack-comments-open {
  padding: 4px 12px;
  border-radius: 999px;
  background: #fef2f2;
  border: 1px solid #f3b0a9;
  color: #b42318;
  font-size: 0.78rem;
  font-weight: 700;
}

.rack-comments-hint {
  margin: 8px 0 14px;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.rack-comment-form {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.rack-comment-box {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--navy);
  resize: vertical;
}

.rack-comment-box:focus {
  outline: 3px solid var(--orange);
  outline-offset: 1px;
  border-color: var(--orange);
}

.rack-comment-btn {
  flex-shrink: 0;
  padding: 13px 20px;
}

.rack-comment-btn[disabled] {
  background: var(--line);
  color: #8b959b;
  cursor: not-allowed;
}

.rack-comment-list,
.issue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.rack-comments-more {
  margin: 12px 0 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.comment-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid #e5342a;
  border-radius: 10px;
  background: var(--bg);
}

.comment-card.reviewed {
  border-left-color: #12805c;
  background: var(--white);
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.comment-rack {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
}

.comment-who {
  font-weight: 700;
  color: var(--navy);
}

.comment-state {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.72rem;
}

.comment-state.open {
  background: #fef2f2;
  color: #b42318;
}

.comment-state.done {
  background: #e7f6f0;
  color: #12805c;
}

.comment-body {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-review-btn {
  margin-top: 10px;
  background: transparent;
  border: 1px solid var(--navy);
  color: var(--navy);
}

.comment-review-btn:hover {
  background: var(--navy);
  color: var(--white);
}

.issues-view {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.issue-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.issue-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.issue-chip:hover {
  border-color: var(--orange);
}

.issue-chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

.issue-chip-count {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.issue-chip-count.has-open {
  background: #e5342a;
  color: var(--white);
}

.issue-chip.active .issue-chip-count {
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
}

.issue-chip.active .issue-chip-count.has-open {
  background: #e5342a;
}

.btn-outline-navy {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--navy);
  color: var(--navy);
}

.btn-outline-navy:hover {
  background: var(--navy);
  color: var(--white);
}

@media (max-width: 760px) {
  .rack-comment-form {
    flex-direction: column;
  }

  .rack-comment-btn {
    width: 100%;
  }

  .comment-state {
    margin-left: 0;
  }
}

.removal-modal {
  width: min(100%, 620px);
  max-width: 620px;
  display: flex;
  flex-direction: column;
  max-height: 94vh;
}

.removal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.removal-what {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 2px solid var(--navy);
  border-radius: 12px;
  background: var(--bg);
}

.removal-thumb {
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  overflow: hidden;
}

.removal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.removal-what-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.removal-epic {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

.removal-sub {
  font-size: 0.85rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.removal-hint {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.dest-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.dest-pick {
  flex: 1 1 auto;
  min-width: 120px;
  min-height: 52px;
  padding: 12px 18px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.dest-pick:hover {
  border-color: var(--navy);
}

.dest-pick.is-selected {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--white);
}

.dest-pick:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.dest-other {
  border-style: dashed;
  color: var(--ink-muted);
}

.dest-other.is-selected {
  border-style: solid;
  color: var(--white);
}

.removal-note[hidden] {
  display: none;
}

.take-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.take-pick {
  min-width: 62px;
  min-height: 50px;
  padding: 10px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.take-pick:hover {
  border-color: var(--navy);
}

.take-pick.is-selected {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--white);
}

.take-pick:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.take-more {
  border-style: dashed;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.take-more.is-selected {
  border-style: solid;
  color: var(--white);
}

.take-more-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 12px;
}

.take-more-wrap[hidden] {
  display: none;
}

.take-more-input {
  flex: 1 1 auto;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--navy);
  -moz-appearance: textfield;
  appearance: textfield;
}

.take-more-input::-webkit-outer-spin-button,
.take-more-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.take-more-input:focus {
  outline: 3px solid var(--orange);
  outline-offset: 1px;
  border-color: var(--orange);
}

.dest-order {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.destination-admin {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.dest-move {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dest-move:hover:not([disabled]) {
  border-color: var(--navy);
  background: var(--bg);
}

.dest-move[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  .dest-pick {
    min-width: 104px;
    font-size: 0.95rem;
  }
}

.removal-note-label {
  display: block;
  margin: 22px 0 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
}

.removal-note {
  width: 100%;
  padding: 16px 18px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1.15rem;
  color: var(--navy);
}

.removal-note:focus {
  outline: 3px solid var(--orange);
  outline-offset: 1px;
  border-color: var(--orange);
}

@media (max-width: 760px) {
  .removal-overlay {
    padding: 16px;
  }

  .removal-modal {
    width: 100%;
    max-width: none;
  }
}

.reel-modal {
  width: min(100%, 620px);
  max-width: 620px;
  display: flex;
  flex-direction: column;
  max-height: 94vh;
}

.reel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.reel-question {
  margin: 22px 0 10px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
}

.reel-count-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reel-count-btn {
  flex: 1 1 0;
  min-width: 62px;
  min-height: 62px;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.reel-count-btn:hover {
  border-color: var(--navy);
}

.reel-count-btn.is-selected {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--white);
}

.reel-count-btn:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.reel-lengths[hidden] {
  display: none;
}

.reel-count-more {
  border-style: dashed;
  font-size: 1rem;
  color: var(--ink-muted);
}

.reel-count-more.is-selected {
  border-style: solid;
  color: var(--white);
}

.reel-more-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.reel-more-wrap[hidden] {
  display: none;
}

.reel-more-input {
  flex: 1 1 auto;
  padding: 14px 18px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--navy);
  -moz-appearance: textfield;
  appearance: textfield;
}

.reel-more-input::-webkit-outer-spin-button,
.reel-more-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.reel-more-input:focus {
  outline: 3px solid var(--orange);
  outline-offset: 1px;
  border-color: var(--orange);
}

.stock-qty-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.62rem;
  font-weight: 700;
}

.qty-sub {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.reel-length-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reel-length-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.reel-length-label {
  flex: 0 0 84px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
}

.reel-input-wrap {
  position: relative;
  flex: 1 1 auto;
}

.reel-mm-input {
  width: 100%;
  padding: 14px 58px 14px 18px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--navy);
}

.reel-mm-input::-webkit-outer-spin-button,
.reel-mm-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.reel-mm-input {
  -moz-appearance: textfield;
  appearance: textfield;
}

.reel-mm-input:focus {
  outline: 3px solid var(--orange);
  outline-offset: 1px;
  border-color: var(--orange);
}

.reel-unit {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-muted);
  pointer-events: none;
}

.reel-error {
  margin-top: 10px;
}

@media (max-width: 760px) {
  .reel-overlay {
    padding: 16px;
  }

  .reel-modal {
    width: 100%;
    max-width: none;
  }

  .reel-count-btn {
    min-width: 54px;
    min-height: 58px;
    font-size: 1.3rem;
  }

  .reel-length-label {
    flex-basis: 68px;
  }
}

@media (max-width: 760px), (max-height: 620px) {
  .chooser-overlay {
    padding: 0;
  }

  .chooser-modal {
    width: 100%;
    max-width: none;
    min-height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .chooser-tab {
    padding: 14px 8px;
    font-size: 0.92rem;
    gap: 8px;
  }

  .chooser-body {
    padding: 18px;
  }

  .chooser-field {
    font-size: 2rem;
  }

  .chooser-foot {
    padding: 12px 18px;
  }

  .chooser-btn {
    padding: 14px 18px;
    font-size: 0.95rem;
  }

  .chooser-scan span {
    display: none;
  }
}

@media (max-height: 560px) and (orientation: landscape) {

  .chooser-modal .modal-head {
    padding: 10px 18px;
  }

  .chooser-tab {
    padding: 10px 8px;
  }

  .chooser-body {
    padding: 14px 18px;
  }

  .chooser-field-label {
    margin-bottom: 6px;
  }

  .chooser-match {
    min-height: 0;
    margin-top: 8px;
  }

  .chooser-foot {
    padding: 10px 18px;
  }

  .chooser-pane-epic:not([hidden]) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto 1fr;
    gap: 0 18px;
    align-items: start;
  }

  .chooser-field-label,
  .chooser-field,
  .chooser-match {
    grid-column: 1;
  }

  .chooser-keypad {
    grid-column: 2;
    grid-row: 1 / span 3;
    margin-top: 0;
    gap: 8px;
    grid-auto-rows: minmax(38px, 1fr);
    max-width: none;
  }

  .keypad-key {
    font-size: 1.4rem;
  }

  .chooser-field {
    font-size: 1.8rem;
    padding: 12px 16px;
  }
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.team-table,
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.team-table th,
.audit-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

.team-table td,
.audit-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.team-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--white);
  margin-left: 6px;
}

.tag-warn {
  background: var(--orange);
}

.product-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}

.product-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.product-thumb {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.product-no-image {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-align: center;
}

.product-meta {
  flex: 1 1 260px;
  min-width: 0;
}

.product-epic {
  font-weight: 700;
  color: var(--navy);
  overflow-wrap: anywhere;
}

.product-code {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.product-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  align-items: center;
  margin-left: auto;
}

.product-move {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.product-move select {
  font: inherit;
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--navy);
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
}

.product-folder {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--white);
}

.product-folder > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
  color: var(--navy);
  background: var(--bg);
  list-style: none;
}

.product-folder > summary::-webkit-details-marker {
  display: none;
}

.product-folder > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: var(--ink-muted);
  transition: transform 0.15s ease;
}

.product-folder[open] > summary::before {
  transform: rotate(90deg);
}

.product-folder .folder-name {
  flex: 1;
}

.folder-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-muted);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}

.product-folder[open] > summary .folder-count {
  background: var(--bg);
}

.folder-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
}

.folder-body .product-row {
  background: var(--white);
}

.folder-admin {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.folder-admin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}

.folder-admin-name {
  flex: 1;
  font-weight: 700;
  color: var(--navy);
  min-width: 0;
  word-break: break-word;
}

.pin-reveal {
  border: 2px solid var(--orange);
  background: var(--orange-soft);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 18px;
  text-align: center;
}

.pin-reveal-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #c25a10;
}

.pin-reveal-code {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--navy);
  margin: 6px 0;
  font-variant-numeric: tabular-nums;
}

.pin-reveal-note {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.add-note {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin: 0 0 12px;
}

.add-user-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.add-user-form .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.add-user-form label {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--navy);
}

.add-user-form input[type="text"],
.add-user-form select {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--white);
  color: var(--ink);
}

.add-user-form input:focus,
.add-user-form select:focus {
  outline: 2px solid var(--orange);
  outline-offset: 1px;
  border-color: var(--orange);
}

.add-user-form .check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--ink);
}

.add-error {
  min-height: 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #b42318;
}

.audit-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.audit-scroll {
  max-height: 55vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.audit-table {
  font-size: 0.8rem;
}

.audit-table th {
  position: sticky;
  top: 0;
  background: var(--white);
}

.audit-time {
  white-space: nowrap;
  color: var(--ink-muted);
}

.audit-user {
  white-space: nowrap;
  font-weight: 600;
  color: var(--navy);
}

.audit-detail {
  color: var(--ink-muted);
}

@media (max-width: 860px) {
  .page {
    flex-direction: column;
    align-items: stretch;
  }

  .content {
    width: 100%;
  }

  .epic-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    z-index: 50;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -6px 20px rgba(0, 14, 40, 0.16);
  }

  .epic-panel h2,
  .epic-panel .epic-drag-chip {
    display: none;
  }

  .epic-choose {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
  }

  .epic-choose-sub {
    display: none;
  }

  .epic-selected {
    flex: 1;
    min-width: 0;
  }

  .epic-panel:has(.epic-selected:not([hidden])) .epic-choose {
    flex: 0 0 auto;
    width: auto;
  }

  .epic-panel:has(.epic-selected:not([hidden])) .epic-choose-text {
    display: none;
  }

  .trash-bin {
    flex: 0 0 auto;
    padding: 12px 14px;
  }

  .trash-bin .trash-label {
    display: none;
  }

  body.on-rack-page .page {
    padding-bottom: 96px;
  }

  .stock-row {
    flex-wrap: wrap;
  }

  .stock-qty {
    flex-direction: row;
    gap: 6px;
    align-items: baseline;
  }
}

.btn,
.rack-tab,
.rack-cell,
.stock-location,
.epic-drag-chip,
.trash-bin,
.rack-card {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.rack-cell {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

@media (pointer: coarse) {
  .rack-cell {
    min-height: 108px;
  }

  .rack-tab {
    padding: 10px 18px;
    font-size: 0.9rem;
  }

  .btn {
    padding: 11px 22px;
  }

  .stock-location {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .search-wrap input {
    font-size: 16px;
  }
}

@media (max-width: 1024px) {
  .page {
    padding: 18px;
  }

  .rack-tabs {
    padding: 12px 16px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .rack-tab {
    flex: 0 0 auto;
  }

  .content {
    padding: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .top-bar {
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-controls {
    flex: 1;
    justify-content: flex-end;
  }

  .search-wrap {
    flex: 1;
  }

  .search-wrap input {
    min-width: 0;
    width: 100%;
  }
}

#rotateNotice {
  display: none;
}

@media (orientation: portrait) and (max-width: 700px) {
  body.on-rack-page #rotateNotice {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 200;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 32px;
    text-align: center;
    background: var(--navy-deep);
    color: var(--white);
  }

  body.on-rack-page .epic-panel {
    display: none;
  }

  #rotateNotice .rotate-graphic {
    width: 84px;
    height: 84px;
    color: var(--orange);
    animation: rotate-hint 2.4s ease-in-out infinite;
  }

  #rotateNotice .rotate-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
  }

  #rotateNotice .rotate-sub {
    margin: 0;
    max-width: 26ch;
    color: #c9d6de;
    font-size: 0.95rem;
    line-height: 1.5;
  }

  #rotateNotice #rotateBack {
    margin-top: 8px;
  }
}

@keyframes rotate-hint {
  0%, 55% { transform: rotate(0deg); }
  75%, 100% { transform: rotate(-90deg); }
}

@media (max-width: 640px) {
  .rack-grid {
    --cell-min: 120px;
    gap: 6px;
    padding: 10px;
  }

  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .rack-card {
    padding: 12px;
  }

  .view-header h1 {
    font-size: 1.15rem;
  }

  .content {
    padding: 12px;
  }
}

.texstrip-badge {
  position: absolute;
  top: 5px;
  right: 6px;
  z-index: 1;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--navy-soft);
  color: var(--white);
  font-size: 0.5rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}