:root {
  --ink: #242423;
  --paper: #f7f7f2;
  --blue: #3a86ff;
  --yellow: #ffbe0b;
  --line: rgba(36, 36, 35, .16);
  --soft: rgba(247, 247, 242, .72);
  --danger: #e5484d;
  --ok: #1b998b;
  --font: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--ink);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(36, 36, 35, .08) 1px, transparent 1px) 0 0 / 16px 16px,
    var(--paper);
  font-family: var(--font);
  line-height: 1.62;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(190px, 260px) 1fr auto;
  gap: 18px;
  align-items: center;
  min-height: 72px;
  padding: 12px 18px;
  color: var(--paper);
  background: var(--ink);
  border-bottom: 4px solid var(--yellow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand img {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}

.brand strong,
.brand small {
  display: block;
  white-space: nowrap;
}

.brand strong {
  font-size: 22px;
  letter-spacing: 0;
  line-height: 1;
}

.brand small,
.label,
.sync,
.scan-code {
  font-size: 11px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0;
}

.brand small {
  color: rgba(247, 247, 242, .72);
  margin-top: 5px;
}

.tabs {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab,
.icon-btn,
.primary,
.status-actions button {
  border: 1px solid rgba(247, 247, 242, .22);
  color: var(--paper);
  background: transparent;
  border-radius: 4px;
  min-height: 38px;
  transition: transform .16s ease, background .16s ease, color .16s ease, border-color .16s ease;
}

.tab {
  padding: 8px 12px;
  white-space: nowrap;
}

.tab:hover,
.tab.is-active,
.status-actions button:hover {
  color: var(--ink);
  background: var(--yellow);
  border-color: var(--yellow);
}

.sync {
  padding: 9px 10px;
  border: 1px solid rgba(247, 247, 242, .2);
  border-radius: 4px;
  white-space: nowrap;
}

.sync.is-warn {
  color: var(--yellow);
}

main {
  padding: 18px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: enter .24s ease both;
}

.workspace {
  display: none;
  grid-template-columns: minmax(250px, 330px) minmax(360px, 1fr) minmax(250px, 340px);
  gap: 14px;
  min-height: calc(100vh - 108px);
}

.workspace.is-active {
  display: grid;
}

.panel,
.wide-panel,
.metric,
.public-item {
  background: rgba(247, 247, 242, .92);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(36, 36, 35, .08);
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-head,
.record-head,
.section-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px;
}

.label {
  margin: 0 0 5px;
  color: rgba(36, 36, 35, .62);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0;
  line-height: 1.04;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 3vw, 46px);
}

h2 {
  font-size: clamp(24px, 2.2vw, 36px);
}

h3 {
  font-size: 18px;
  line-height: 1.2;
}

.icon-btn {
  width: 38px;
  min-width: 38px;
  color: var(--ink);
  border-color: var(--line);
}

.icon-btn:hover {
  color: var(--paper);
  background: var(--ink);
}

.filters {
  display: grid;
  gap: 8px;
  padding: 0 18px 14px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 10px;
}

input:focus,
select:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.barcode-strip,
.scan-lines {
  height: 28px;
  margin: 0 18px 14px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 3px, transparent 3px 8px, var(--ink) 8px 10px, transparent 10px 17px);
  opacity: .78;
}

.queue-list {
  display: grid;
  gap: 8px;
  padding: 0 10px 12px;
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.queue-item {
  position: relative;
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 120px;
  padding: 12px;
  overflow: hidden;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.queue-item strong {
  font-size: 20px;
  line-height: 1.1;
}

.queue-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.queue-item i {
  display: block;
  height: 4px;
  margin-top: 4px;
  background: var(--blue);
}

.queue-item:hover,
.queue-item.is-active {
  border-color: var(--blue);
  transform: translateY(-1px);
}

.scan-code {
  display: inline-flex;
  width: fit-content;
  padding: 4px 6px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 3px;
}

.pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  color: var(--ink);
  background: rgba(36, 36, 35, .08);
  border-radius: 3px;
  font-style: normal;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.2;
}

.pill.blocked,
.pill.missing {
  color: #fff;
  background: var(--danger);
}

.pill.attention,
.pill.pending {
  background: var(--yellow);
}

.pill.in_progress,
.pill.verified {
  color: #fff;
  background: var(--blue);
}

.pill.done {
  color: #fff;
  background: var(--ok);
}

.record-inner {
  padding: 0 18px 18px;
}

.record-head {
  padding-left: 0;
  padding-right: 0;
}

.record-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.record-meta span,
.metric {
  padding: 13px;
  background: #fff;
  border-radius: 4px;
  border: 1px solid var(--line);
  min-width: 0;
  overflow-wrap: anywhere;
}

.workflow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 20px;
}

.workflow span {
  min-height: 52px;
  display: grid;
  place-items: center;
  padding: 8px;
  color: rgba(36, 36, 35, .72);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  text-align: center;
}

.workflow .is-current {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

.split,
.analytics-body,
.import-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.check-list,
.note-list,
.command-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.check-list li,
.note-list li,
.command-list li {
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.check-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.check-list b {
  font-size: 11px;
  text-transform: uppercase;
}

.note-list time {
  display: block;
  margin-top: 4px;
  color: rgba(36, 36, 35, .56);
  font-size: 12px;
}

.note-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 16px;
}

.primary {
  padding: 9px 14px;
  color: var(--paper);
  background: var(--blue);
  border-color: var(--blue);
  border-radius: 4px;
}

.primary:hover {
  transform: translateY(-1px);
  filter: brightness(.95);
}

.next {
  background: var(--ink);
  color: var(--paper);
}

.next .label,
.next .muted {
  color: rgba(247, 247, 242, .68);
}

.status-dot {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  background: var(--yellow);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(255, 190, 11, .16);
}

#nextActionView {
  padding: 0 18px 18px;
}

.action-copy {
  padding: 16px;
  background: rgba(247, 247, 242, .08);
  border: 1px solid rgba(247, 247, 242, .14);
  border-radius: 6px;
}

.action-copy h3 {
  margin: 14px 0 0;
  font-size: 24px;
}

.status-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.subhead {
  color: rgba(247, 247, 242, .86);
}

.deadline-list {
  display: grid;
  gap: 8px;
}

.deadline {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 12px;
  color: var(--paper);
  background: rgba(247, 247, 242, .07);
  border: 1px solid rgba(247, 247, 242, .14);
  border-radius: 4px;
  text-align: left;
}

.deadline:hover {
  border-color: var(--yellow);
}

.deadline.is-done {
  opacity: .55;
  text-decoration: line-through;
}

.section-head {
  max-width: 1120px;
  margin: 0 auto 14px;
  padding-left: 0;
  padding-right: 0;
}

.metric-grid,
.analytics-body,
.import-grid,
.public-list {
  max-width: 1120px;
  margin: 0 auto;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric span,
.metric strong {
  display: block;
}

.metric strong {
  margin-top: 7px;
  font-size: clamp(22px, 3vw, 38px);
  line-height: 1;
}

.wide-panel {
  padding: 18px;
}

.wide-panel.yellow {
  background: var(--yellow);
}

.big-number {
  margin: 12px 0;
  font-size: clamp(46px, 8vw, 110px);
  line-height: .92;
  font-weight: 800;
}

.muted {
  color: rgba(36, 36, 35, .68);
}

.zone-bars {
  display: grid;
  gap: 12px;
}

.zone-row {
  display: grid;
  grid-template-columns: 100px 1fr 28px;
  gap: 10px;
  align-items: center;
}

.zone-row b {
  display: block;
  height: 18px;
  background: rgba(36, 36, 35, .09);
  border-radius: 2px;
  overflow: hidden;
}

.zone-row i {
  display: block;
  height: 100%;
  background: var(--blue);
}

.api-output {
  min-height: 180px;
  padding: 12px;
  overflow: auto;
  color: var(--paper);
  background: var(--ink);
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}

.public-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.public-item {
  padding: 18px;
}

.public-item p {
  min-height: 58px;
}

.public-item div {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.empty {
  padding: 20px;
  color: rgba(36, 36, 35, .62);
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .workspace,
  .workspace.is-active {
    grid-template-columns: 1fr;
  }

  .queue-list {
    max-height: none;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  main,
  .topbar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand strong {
    font-size: 20px;
  }

  .record-meta,
  .workflow,
  .split,
  .analytics-body,
  .import-grid,
  .public-list,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .note-form {
    grid-template-columns: 1fr;
  }

  .status-actions {
    grid-template-columns: 1fr;
  }

  .zone-row {
    grid-template-columns: 80px 1fr 24px;
  }
}
