:root {
  --ink: #242423;
  --paper: #f7f7f2;
  --blue: #3a86ff;
  --amber: #ffbe0b;
  --line: rgba(36, 36, 35, 0.14);
  --muted: rgba(36, 36, 35, 0.62);
  --dark-muted: rgba(247, 247, 242, 0.68);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    repeating-linear-gradient(90deg, rgba(247, 247, 242, 0.035) 0 2px, transparent 2px 18px),
    var(--ink);
  color: var(--ink);
  font-family: "Arial Narrow", "Roboto Condensed", "Inter Tight", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--paper);
  margin-bottom: 16px;
}

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

.brand strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.brand small,
.eyebrow {
  color: var(--dark-muted);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tab,
.icon-button,
.primary-action {
  border: 0;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.tab {
  min-height: 38px;
  padding: 0 14px;
  background: rgba(247, 247, 242, 0.1);
  color: var(--paper);
  border-left: 3px solid rgba(247, 247, 242, 0.3);
}

.tab:hover,
.tab.is-active {
  background: var(--paper);
  color: var(--ink);
  transform: translateY(-1px);
}

.scanner-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: rgba(247, 247, 242, 0.22);
  margin-bottom: 1px;
}

.scanner-strip > div {
  min-height: 74px;
  padding: 14px;
  background: var(--paper);
}

.scanner-strip strong {
  display: block;
  margin-top: 7px;
  font-size: clamp(22px, 4vw, 38px);
  line-height: 0.95;
}

.db-pill {
  display: flex;
  align-items: center;
  color: var(--blue);
  word-break: break-word;
}

.db-pill.is-fallback {
  color: #9a6b00;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
  animation: rise 240ms ease both;
}

.workspace {
  display: none;
  grid-template-columns: minmax(220px, 0.82fr) minmax(360px, 1.55fr) minmax(260px, 0.9fr);
  gap: 1px;
  background: rgba(247, 247, 242, 0.22);
  min-height: calc(100vh - 128px);
}

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

.queue-pane,
.record-pane,
.action-pane,
.analytics,
.import-screen,
.public-screen {
  background: var(--paper);
}

.queue-pane,
.action-pane,
.record-pane {
  padding: 16px;
  min-width: 0;
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  margin-bottom: 14px;
  color: var(--muted);
  text-transform: uppercase;
}

.icon-button {
  width: 34px;
  height: 34px;
  background: var(--ink);
  color: var(--paper);
}

.queue-list,
.deadline-list,
.note-feed,
.checklist,
.document-lane {
  display: grid;
  gap: 10px;
}

.queue-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 10px;
}

.queue-item:hover,
.queue-item.is-active {
  border-color: var(--blue);
  background: rgba(58, 134, 255, 0.08);
}

.queue-item strong,
.queue-item small,
.queue-item em {
  display: block;
  overflow-wrap: anywhere;
}

.queue-item small,
.queue-item em {
  color: var(--muted);
  font-style: normal;
}

.barcode {
  width: 18px;
  height: 48px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 5px, var(--ink) 5px 8px, transparent 8px 12px);
  opacity: 0.72;
}

.record-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

h1,
h2 {
  margin: 6px 0 8px;
  font-size: clamp(30px, 5vw, 62px);
  line-height: 0.95;
  letter-spacing: 0;
}

.record-top p,
.import-console p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  max-width: 720px;
}

.status-token {
  min-width: 76px;
  padding: 10px 12px;
  background: var(--amber);
  color: var(--ink);
  text-align: center;
  text-transform: uppercase;
}

.workflow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 18px 0;
  background: var(--line);
}

.workflow span {
  min-height: 44px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--muted);
}

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

.check-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  line-height: 1.35;
}

.check-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--blue);
}

.doc-chip,
.deadline,
.ops-row,
.public-row {
  border-left: 4px solid var(--blue);
  padding: 12px 14px;
  background: #fff;
}

.doc-chip {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.doc-chip span,
.doc-chip em,
.deadline span,
.ops-row span,
.ops-row em,
.public-row small,
.public-row em {
  color: var(--muted);
  font-style: normal;
}

.next-card {
  padding: 16px;
  background: var(--ink);
  color: var(--paper);
  margin-bottom: 16px;
}

.next-card span {
  display: block;
  color: var(--dark-muted);
  text-transform: uppercase;
  font-size: 11px;
}

.next-card strong {
  display: block;
  margin: 9px 0 14px;
  font-size: 23px;
  line-height: 1.1;
}

.next-card.is-done {
  background: var(--blue);
}

.primary-action {
  min-height: 42px;
  padding: 0 16px;
  background: var(--blue);
  color: #fff;
}

.primary-action:hover {
  transform: translateY(-1px);
  background: #1f6ee9;
}

.deadline {
  border-left-color: var(--amber);
}

.deadline strong,
.deadline span,
.note-feed p {
  display: block;
  margin: 0;
  overflow-wrap: anywhere;
}

.note-feed p {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.5;
}

.note-feed strong {
  color: var(--ink);
}

.pulse-dot {
  width: 12px;
  height: 12px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(255, 190, 11, 0.7);
  animation: pulse 1200ms infinite;
}

.analytics,
.import-screen,
.public-screen {
  min-height: calc(100vh - 128px);
  padding: 28px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr) minmax(260px, 1fr);
  gap: 1px;
  background: var(--line);
}

.analytics-grid > div,
.import-console,
.public-board {
  background: var(--paper);
  padding: 24px;
}

.big-number strong {
  display: block;
  margin: 14px 0;
  font-size: clamp(60px, 12vw, 132px);
  line-height: 0.8;
  color: var(--blue);
}

.big-number small {
  color: var(--muted);
  line-height: 1.5;
}

.barcode-chart {
  min-height: 320px;
  display: flex;
  align-items: end;
  gap: 16px;
}

.barcode-chart div {
  display: grid;
  align-content: end;
  gap: 8px;
  min-width: 58px;
}

.barcode-chart span {
  display: block;
  height: var(--h);
  background: repeating-linear-gradient(90deg, var(--ink) 0 5px, var(--amber) 5px 9px, var(--paper) 9px 14px);
}

.ops-list {
  display: grid;
  gap: 10px;
}

.ops-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 10px;
}

.import-console {
  max-width: 760px;
}

.import-console pre {
  overflow: auto;
  margin: 18px 0 0;
  padding: 16px;
  background: var(--ink);
  color: var(--paper);
  min-height: 150px;
}

.public-board {
  display: grid;
  gap: 18px;
}

.public-list {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.public-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border-left: 0;
}

.light {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--amber);
}

.light.green {
  background: #29b35a;
}

.light.red {
  background: #e44747;
}

.empty-line {
  color: var(--muted);
  padding: 14px 0;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 10px rgba(255, 190, 11, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 190, 11, 0);
  }
}

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

@media (max-width: 980px) {
  .workspace,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    min-height: auto;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .tabs {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 10px;
  }

  .scanner-strip {
    grid-template-columns: 1fr 1fr;
  }

  .record-top,
  .doc-chip,
  .ops-row,
  .public-row {
    grid-template-columns: 1fr;
  }

  .record-top {
    display: grid;
  }

  .workflow {
    grid-template-columns: 1fr 1fr;
  }

  .tab {
    flex: 1 1 130px;
  }
}
