@font-face {
  font-family: "DS-Digital";
  src: url("/fonts/DS-DIGI.TTF") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.84), transparent 42%),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  min-height: var(--touch);
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

button:hover:not(:disabled) {
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

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

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(47, 111, 237, 0.22);
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #5a8df3);
  box-shadow: 0 5px 14px rgba(47, 111, 237, 0.2);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: 0.01em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}

.dot.online {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(13, 159, 145, 0.12);
}

.dot.error {
  background: var(--danger);
}

.page {
  width: min(1440px, 100%);
  flex: 1;
  margin: 0 auto;
  padding: 30px 28px;
}

.page.narrow {
  display: grid;
  width: min(600px, 100%);
  place-items: center;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.login {
  width: 100%;
  padding: 34px;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.04;
}

h2 {
  margin-bottom: 6px;
  font-size: 24px;
}

h3 {
  margin-bottom: 6px;
}

.muted {
  color: var(--muted);
}

.error {
  color: var(--danger);
}

.warning {
  color: var(--warn);
}

.form {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}

label {
  color: var(--muted);
  font-size: 13px;
}

input {
  width: 100%;
  min-height: var(--touch);
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--ink);
  background: var(--surface-strong);
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14);
}

.primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 5px 12px rgba(47, 111, 237, 0.18);
  font-weight: 800;
}

.secondary {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.68);
}

.danger {
  border: 1px solid rgba(196, 71, 90, 0.28);
  color: var(--danger);
  background: var(--danger-soft);
}

.notice {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: var(--surface-soft);
}

.queue-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.queue-tools {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
}

.search-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-field input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: #fff;
}

.queue-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.queue-stage-filters {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.stage-filter-card {
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 800;
}

.stage-filter-card.selected {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 -3px 0 var(--primary);
}

.filter-chip {
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 800;
}

.filter-chip.selected {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.queue-count {
  font-size: 12px;
}

.actions,
.activity-actions,
.bottom-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.queue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}

.order-card {
  width: 100%;
  min-height: 170px;
  padding: 20px;
  border: 1px solid var(--line);
  text-align: left;
  background: var(--surface);
}

.order-card:hover {
  border-color: rgba(47, 111, 237, 0.55);
  background: var(--surface-strong);
}

.order-top,
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-number {
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
}

.pill {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  white-space: nowrap;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(420px, 1.7fr) minmax(270px, 0.9fr);
  align-items: start;
  gap: 18px;
}

.panel {
  padding: 22px;
}

.context {
  position: sticky;
  top: 86px;
}

.context dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 10px;
  margin: 22px 0 0;
}

.technical-observation {
  margin-top: 18px;
  padding: 16px;
}

.technical-observation textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  resize: vertical;
}

.technical-observation button {
  width: 100%;
  margin-top: 10px;
}

dt {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.timer-card {
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff, #edf2f6);
  box-shadow: var(--shadow);
}

.timer-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.timer {
  margin: 12px 0 14px;
}

.timer-display {
  display: block;
  width: 100%;
  padding: clamp(14px, 2.2vw, 24px);
  overflow: hidden;
  border: 1px solid #424b55;
  border-radius: 10px;
  background: #20262d;
  color: #edf4fa;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.32), 0 4px 10px rgba(32, 38, 45, 0.12);
  /* Exibe somente os algarismos reais, sem segmentos inativos translúcidos. */
  font-family: "DS-Digital", "DS-DIGIT", "DS Digital", "Courier New", monospace;
  font-size: clamp(52px, 8vw, 132px);
  font-kerning: none;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 0.86;
  text-align: center;
  text-shadow: 0 0 5px rgba(237, 244, 250, 0.42);
  white-space: nowrap;
}

.timer-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.timer-sub {
  color: var(--primary);
  font-weight: 700;
}

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

.stage-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.resources-column {
  min-width: 0;
}

.resources-panel {
  position: sticky;
  top: 86px;
}

.applied-resources {
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
}

.applied-resource {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  font-size: 12px;
}

.applied-resource button {
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 20px;
}

.resource-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.resource-categories .filter-chip {
  min-height: 40px;
  padding: 0 10px;
  font-size: 10px;
}

.resource-catalog {
  display: grid;
  gap: 9px;
}

.resource-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: left;
  background: var(--surface);
}

.resource-card strong,
.resource-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-card strong {
  color: var(--ink);
}

.resource-card span {
  color: var(--muted);
  font-size: 11px;
}

.activity {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
}

.activity.current {
  border-color: rgba(47, 111, 237, 0.68);
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.activity.done {
  opacity: 0.7;
}

.activity-index {
  color: var(--muted);
  font-weight: 800;
}

.activity-status {
  color: var(--muted);
  font-size: 12px;
}

.activity-actions button {
  min-height: 44px;
  padding: 0 13px;
}

.action-with-shortcut {
  display: grid;
  justify-items: center;
  gap: 3px;
}

.keyboard-hint {
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.04em;
}

.bottom-actions {
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.empty {
  padding: 44px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

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

  .context {
    position: static;
  }
}

@media (max-width: 700px) {
  .topbar,
  .page {
    padding: 14px 16px;
  }

  .queue-head {
    display: block;
  }

  .queue-head .actions {
    margin-top: 16px;
  }

  .panel,
  .timer-card {
    padding: 16px;
  }

  .timer-display {
    font-size: clamp(38px, 12vw, 64px);
  }

  .activity {
    grid-template-columns: 26px 1fr;
  }

  .activity-actions {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* Posto operacional: ocupa a viewport sem repetir a barra global. */
.workspace-screen {
  display: grid;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  padding: 10px 16px 12px;
}

.workspace-screen .workspace-grid {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}

/* O catálogo só aparece quando a etapa permitir edição de produtos. */
.workspace-screen .workspace-grid.without-resource-catalog {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace-screen .workspace-grid > * {
  min-width: 0;
  min-height: 0;
}

.context-column,
.resources-column,
.work-column {
  min-width: 0;
  min-height: 0;
}

.workspace-screen .context {
  position: static;
}

.context-panel {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  padding: 14px;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.context-panel h2 {
  margin-bottom: 4px;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-panel dl {
  gap: 8px 10px;
  margin: 12px 0 0;
}

.context-panel dt {
  font-size: 10px;
}

.context-panel dd {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  /* white-space: nowrap; */
}

.workspace-screen .technical-observation {
  flex: 0 0 auto;
  margin: 14px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
}

.workspace-screen .technical-observation h3 {
  margin: 3px 0 8px;
  font-size: 14px;
}

.order-fields-summary {
  flex: 0 0 auto;
  padding-top: 10px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.order-fields-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.order-fields-heading h3 {
  margin: 0;
  font-size: 13px;
}

.order-fields-heading p {
  margin: 2px 0 0;
  font-size: 10px;
}

.order-fields-heading button {
  display: inline-flex;
  min-height: 30px;
  min-width: 76px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 0 7px;
  line-height: 1.1;
  font-size: 10px;
}

.order-fields-heading .keyboard-hint {
  display: block;
  color: currentColor;
  font-size: 8px;
  letter-spacing: 0;
  line-height: 1;
}

.order-fields-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 9px 0 0;
}

.order-fields-values dd {
  margin-top: 2px;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-fields-values-location {
  grid-template-columns: minmax(0, 1fr);
}

.order-fields-overview,
.order-fields-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.order-fields-overview {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.order-fields-overview dt,
.order-fields-details dt {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.2;
}

.order-fields-overview dd,
.order-fields-details dd {
  margin: 2px 0 0;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-fields-modal-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 7px;
}

.order-fields-modal-section-heading h3 {
  margin: 0;
  font-size: 13px;
}

.order-fields-modal-section-heading .muted {
  font-size: 10px;
}

.order-fields-details {
  margin-bottom: 14px;
}

.order-fields-details > div {
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.observation-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 7px;
}

.observation-editor textarea {
  width: 100%;
  min-height: 66px;
  max-height: 78px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  resize: none;
  font-size: 11px;
}

.observation-editor button {
  min-height: 38px;
  padding: 0 10px;
  font-size: 11px;
}

.applied-resources-section {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  padding-top: 9px;
  margin-top: 9px;
  border-top: 1px solid var(--line);
}

.applied-resources-section h2 {
  margin: 2px 0 5px;
  font-size: 12px;
}

.workspace-screen .applied-resources {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 3px;
  margin: 0;
  overflow: hidden;
}

.workspace-screen .applied-resource {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  min-height: 28px;
  gap: 4px;
  padding: 3px 5px;
  border-radius: 6px;
  font-size: 9px;
}

.workspace-screen .applied-resource-info {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.workspace-screen .applied-resource-info strong,
.workspace-screen .applied-resource-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-screen .applied-resource-quantity {
  display: flex;
  align-items: center;
  gap: 3px;
}

.workspace-screen .applied-resource-quantity strong {
  min-width: 18px;
  color: var(--text);
  font-size: 10px;
  text-align: center;
}

.workspace-screen .applied-resource .quantity-button {
  min-width: 22px;
  min-height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  background: var(--surface);
  font-size: 14px;
  line-height: 1;
}

.workspace-screen .applied-resource .quantity-button:not(:disabled):hover {
  border-color: var(--primary);
  color: var(--primary);
}

.workspace-screen .applied-resource .resource-trash {
  display: inline-grid;
  min-width: 25px;
  min-height: 25px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(190, 43, 43, 0.28);
  border-radius: 5px;
  color: #bd2d2d;
  background: #fff5f5;
}

.workspace-screen .applied-resource .resource-trash:not(:disabled):hover {
  border-color: #bd2d2d;
  background: #ffe4e4;
}

.workspace-screen .applied-resource .resource-trash svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.workspace-screen .work-column {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 10px;
}

.group-summary-strip {
  display: flex;
  min-width: 0;
  gap: 6px;
  overflow-x: auto;
  padding: 1px 0 3px;
  scrollbar-width: none;
}

.group-summary-strip::-webkit-scrollbar {
  display: none;
}

.group-summary-card {
  display: grid;
  min-width: 150px;
  min-height: 48px;
  flex: 0 0 150px;
  gap: 3px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: left;
  background: var(--surface-soft);
}

.group-summary-card strong,
.group-summary-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-summary-card strong {
  font-size: 11px;
}

.group-summary-card span {
  color: var(--muted);
  font-size: 10px;
}

.group-summary-card.complete {
  border-color: rgba(29, 132, 90, 0.35);
  background: var(--success-soft, #edf8f2);
}

.group-summary-card.selected {
  border-color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
}

.mobile-workspace-tabs {
  display: none;
}

.workspace-screen .timer-card {
  min-height: 0;
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.workspace-screen .timer-label {
  font-size: 10px;
}

.workspace-screen .timer {
  margin: 8px 0 7px;
}

.workspace-screen .timer-display {
  padding: 14px 8px;
  border-radius: 7px;
  font-size: clamp(46px, 5vw, 82px);
}

.workspace-screen .timer-sub {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-screen .timer-card p {
  margin: 4px 0 0;
  font-size: 11px;
}

.workspace-screen .work-column > .card.panel {
  min-height: 0;
  overflow: hidden;
  padding: 14px;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.workspace-screen .work-column > .card.panel h2 {
  font-size: 18px;
}

.workspace-screen .activity-list {
  min-height: 0;
  overflow: hidden;
  gap: 6px;
}

.workspace-screen .activity {
  min-height: 0;
  padding: 7px 9px;
  border-radius: 7px;
  gap: 8px;
}

.workspace-screen .activity strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-screen .activity-status {
  font-size: 10px;
}

.workspace-screen .activity-actions {
  flex-wrap: nowrap;
  gap: 4px;
}

.workspace-screen .activity-actions button {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  font-size: 10px;
}

.workspace-screen .keyboard-hint {
  font-size: 9px;
}

.workspace-screen .activity-actions button .keyboard-hint {
  color: currentColor;
  font-size: 8px;
  letter-spacing: 0;
  opacity: 0.72;
}

.workspace-screen .stage-actions {
  padding-top: 10px;
  margin-top: 10px;
}

.workspace-screen .stage-actions button {
  min-height: 40px;
  font-size: 12px;
}

.workspace-screen .resources-column {
  overflow: hidden;
}

.workspace-screen .resources-panel {
  position: static;
  display: grid;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
  padding: 14px;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.resource-panel-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.resource-panel-heading h2 {
  margin: 3px 0 0;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-back {
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 10px;
  white-space: nowrap;
}

.resource-carousel {
  display: flex;
  height: 100%;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  cursor: grab;
  touch-action: pan-x;
  user-select: none;
}

.resource-carousel::-webkit-scrollbar {
  display: none;
}

.resource-carousel.dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}

.resource-page {
  display: grid;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 0;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  align-content: stretch;
  gap: 6px;
  scroll-snap-align: start;
}

/* Distribui as categorias reais pelas três linhas sem criar categorias artificiais. */
.resource-page.category-page .category-card {
  grid-column: span 3;
}

/* Produtos: três colunas por três linhas, com nove cards em cada página. */
.resource-page.product-page {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workspace-screen .resource-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
  padding: 7px;
  border-radius: 7px;
  text-align: center;
  background: var(--surface-soft);
  box-shadow: none;
  font-size: 10px;
}

.workspace-screen .resource-card .resource-key {
  position: absolute;
  top: 5px;
  left: 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.72;
}

.workspace-screen .resource-card.product-card {
  padding-top: 17px;
}

.workspace-screen .resource-card.resource-added {
  animation: resource-card-added 650ms ease-out;
}

@keyframes resource-card-added {
  0% {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 0 rgba(47, 111, 237, 0.4);
    transform: scale(1);
  }

  45% {
    border-color: var(--primary);
    background: #dce8ff;
    box-shadow: 0 0 0 7px rgba(47, 111, 237, 0.14);
    transform: scale(1.025);
  }

  100% {
    border-color: var(--line);
    background: var(--surface-soft);
    box-shadow: none;
    transform: scale(1);
  }
}

.workspace-screen .resource-card img {
  display: block;
  width: 100%;
  height: 58px;
  flex: 0 0 58px;
  object-fit: contain;
  border-radius: 4px;
}

.workspace-screen .resource-card strong,
.workspace-screen .resource-card span {
  display: block;
  width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-align: center;
  white-space: normal;
}

.workspace-screen .resource-card strong {
  font-size: 9px;
  line-height: 1.15;
}

.workspace-screen .resource-card span {
  font-size: 9px;
  line-height: 1.1;
}

.workspace-screen .category-card {
  border-color: rgba(47, 111, 237, 0.24);
  background: var(--primary-soft);
}

.workspace-screen .product-card:not(:disabled):hover,
.workspace-screen .category-card:hover {
  border-color: var(--primary);
  background: #fff;
}

.order-fields-modal-backdrop {
  position: fixed;
  z-index: 25;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 27, 36, 0.32);
}

.order-fields-modal {
  width: min(640px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 18px 46px rgba(18, 31, 48, 0.2);
}

.order-fields-modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.order-fields-modal-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
}

.order-fields-modal h2 {
  margin: 0;
  font-size: 19px;
}

.icon-button {
  display: inline-grid;
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 20px;
  line-height: 1;
}

.order-field-picker-grid,
.order-location-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.order-field-picker-card,
.order-location-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 78px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-soft);
  text-align: center;
}

.order-field-picker-card:hover,
.order-field-picker-card:focus-visible,
.order-location-card:hover,
.order-location-card:focus-visible {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.order-field-picker-card small,
.order-location-card small {
  position: absolute;
  top: 6px;
  left: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.order-field-picker-card strong,
.order-location-card strong,
.order-location-card span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-field-picker-card strong {
  font-size: 12px;
}

.order-location-card strong {
  font-size: 11px;
}

.order-location-card span {
  color: var(--muted);
  font-size: 10px;
}

.order-field-input-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
}

.order-field-input,
.order-field-textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
}

.order-field-input {
  min-height: 40px;
  padding: 0 10px;
  margin-bottom: 10px;
}

.order-field-textarea {
  min-height: 135px;
  padding: 9px;
  resize: vertical;
}

.order-fields-modal-footer,
.order-fields-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
}

.order-fields-editor-actions {
  justify-content: flex-end;
}

.order-fields-editor-actions button {
  display: inline-flex;
  min-width: 92px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1.1;
}

.order-fields-editor-actions .keyboard-hint {
  display: block;
  color: currentColor;
  font-size: 8px;
  letter-spacing: 0;
  line-height: 1;
  opacity: 0.72;
}

.order-fields-modal .notice {
  margin-top: 10px;
}

.stage-modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 27, 36, 0.32);
}

.stage-modal {
  width: min(620px, 100%);
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 46px rgba(18, 31, 48, 0.2);
}

.stage-modal h2 {
  margin: 0;
  font-size: 20px;
}

.stage-modal p {
  margin: 6px 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.stage-top-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(86px, 1fr));
  gap: 8px;
}

.stage-top-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 86px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 18px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-soft);
  text-align: center;
}

.stage-top-card:hover,
.stage-top-card:focus-visible {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.stage-top-card small {
  position: absolute;
  top: 6px;
  left: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.stage-top-card strong {
  font-size: 16px;
}

.stage-top-card span {
  width: 100%;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-top-card em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.stage-top-selected {
  display: grid;
  gap: 4px;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--primary-soft);
}

.stage-top-selected strong {
  font-size: 24px;
}

.stage-top-selected span,
.stage-top-selected small {
  color: var(--muted);
}

.stage-modal-actions,
.stage-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.stage-modal-footer {
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
}

.stage-modal-actions button,
.stage-modal-footer button {
  min-height: 40px;
}

.stage-modal .keyboard-hint {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  opacity: 0.75;
}

.stage-modal .notice {
  margin-top: 12px;
}

/* Linguagem visual B2B: superfícies sólidas, hierarquia compacta e estados
   discretos. A etapa continua sem topbar e mantém o cronômetro DS-Digital. */
body {
  background: var(--bg);
  font-size: 14px;
}

button {
  border-radius: var(--radius-sm);
  transition: transform 0.18s ease, background 0.18s ease,
    border-color 0.18s ease, box-shadow 0.18s ease;
}

.topbar {
  padding: 12px max(16px, calc((100% - 1480px) / 2));
  border-bottom-color: var(--line);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(24, 33, 43, 0.02);
  backdrop-filter: none;
}

.brand {
  gap: 10px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-color: rgba(49, 95, 114, 0.22);
  border-radius: 7px;
  background: var(--primary);
  box-shadow: none;
}

.brand strong {
  color: var(--ink);
  font-size: 14px;
}

.brand small,
.status {
  font-size: 11px;
}

.page {
  width: min(1480px, calc(100% - 32px));
  padding: 20px 0 28px;
}

.page.narrow {
  width: min(560px, calc(100% - 32px));
}

.card {
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: none;
}

.login {
  padding: 28px;
}

h1 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.12;
  letter-spacing: normal;
}

h2 {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: normal;
}

h3 {
  font-size: 15px;
  line-height: 1.25;
}

.primary {
  background: var(--primary);
  box-shadow: none;
}

.primary:hover:not(:disabled) {
  background: #294f60;
  box-shadow: 0 4px 10px rgba(49, 95, 114, 0.16);
}

.secondary {
  border-color: var(--line-strong);
  background: var(--surface);
}

.secondary:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--surface-soft);
}

.notice {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  font-size: 12px;
}

.notice.warning {
  border-color: #ead7ac;
  color: #805812;
  background: var(--warn-soft);
}

.queue-head {
  margin-bottom: 16px;
}

.queue-head h1 {
  margin-bottom: 4px;
}

.queue-head p {
  margin-bottom: 0;
  font-size: 12px;
}

.queue-tools {
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
}

.search-field input,
input {
  min-height: 44px;
  border-color: var(--line-strong);
  border-radius: var(--radius-sm);
}

.queue-filters {
  align-self: end;
  gap: 6px;
}

.filter-chip {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border-color: var(--line);
  background: var(--surface);
  font-size: 11px;
}

.filter-chip.selected {
  border-color: #9bb7c3;
  color: var(--primary);
  background: var(--primary-soft);
}

.queue-count {
  align-self: center;
  white-space: nowrap;
}

.queue {
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

.order-card {
  min-height: 150px;
  padding: 16px;
  border-color: var(--line);
  background: var(--surface);
}

.order-card:hover {
  border-color: #9bb7c3;
  background: var(--surface);
  box-shadow: 0 7px 18px rgba(24, 33, 43, 0.08);
}

.order-card-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}

.order-card-field {
  min-width: 0;
}

.order-card-field span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.order-card-field strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.order-card-category-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.order-card-category-row.is-empty {
  display: none;
}

.order-number {
  color: var(--primary);
  font-size: 12px;
}

.pill {
  padding: 5px 8px;
  border-color: var(--line);
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 700;
}

/* Ajuste fino do posto operacional em 1366x768. */
.workspace-screen {
  padding: 10px 16px 12px;
  background: var(--bg);
}

.workspace-screen .workspace-grid {
  gap: 12px;
}

.context-panel,
.workspace-screen .timer-card,
.workspace-screen .work-column > .card.panel,
.workspace-screen .resources-panel {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.context-panel h2,
.workspace-screen .work-column > .card.panel h2,
.resource-panel-heading h2 {
  letter-spacing: normal;
}

.context-panel .context-customer {
  font-size: 12px;
}

.workspace-screen .technical-observation,
.applied-resources-section {
  border-color: var(--line);
}

.workspace-screen .technical-observation textarea {
  border-color: var(--line-strong);
  background: var(--surface);
}

.workspace-screen .activity {
  border-color: var(--line);
  background: var(--surface-soft);
}

.workspace-screen .activity.current {
  border-color: #9bb7c3;
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.workspace-screen .activity.done {
  opacity: 0.78;
  background: #fbfcfd;
}

.workspace-screen .timer-card {
  background: var(--surface);
}

.workspace-screen .timer-sub {
  color: var(--primary);
}

.workspace-screen .timer-display {
  border-color: #26343d;
  background: #202b33;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.28),
    0 3px 8px rgba(24, 33, 43, 0.1);
}

.workspace-screen .resource-card {
  border-color: var(--line);
  background: var(--surface-soft);
}

.workspace-screen .category-card {
  border-color: #b5cbd4;
  background: var(--primary-soft);
}

.workspace-screen .product-card:not(:disabled):hover,
.workspace-screen .category-card:hover {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 4px 10px rgba(24, 33, 43, 0.07);
}

.stage-modal-backdrop {
  background: rgba(24, 33, 43, 0.26);
}

.stage-modal {
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(24, 33, 43, 0.16);
}

@media (max-width: 1100px) {
  .queue-tools {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .queue-count {
    align-self: start;
  }

  .workspace-screen {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .workspace-screen .workspace-grid {
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-screen .workspace-grid.without-resource-catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-screen .context-panel,
  .workspace-screen .resources-panel {
    height: 560px;
  }

  .workspace-screen .work-column {
    min-height: 560px;
  }
}

@media (max-width: 700px) {
  .topbar {
    padding: 10px 16px;
  }

  .page,
  .page.narrow {
    width: calc(100% - 24px);
    padding: 16px 0 22px;
  }

  .queue-head .actions,
  .queue-head .actions button {
    width: 100%;
  }

  .workspace-screen {
    padding: 8px 10px 16px;
  }

  .workspace-screen .workspace-grid {
    grid-template-columns: 1fr;
  }

  .workspace-screen .workspace-grid.without-resource-catalog {
    grid-template-columns: 1fr;
  }

  .workspace-screen .context-panel,
  .workspace-screen .resources-panel,
  .workspace-screen .work-column {
    height: auto;
    min-height: 0;
  }

  .workspace-screen .context-panel {
    max-height: none;
  }

  .workspace-screen .resources-panel {
    height: 500px;
  }

  /* Shell operacional mobile: cronômetro, abas e apenas um painel ativo. */
  .workspace-screen {
    height: 100dvh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: hidden;
    padding: calc(env(safe-area-inset-top) + 8px) 10px calc(env(safe-area-inset-bottom) + 10px);
  }

  .workspace-screen .workspace-grid {
    display: grid;
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
    overflow: hidden;
  }

  .workspace-screen .work-column {
    display: contents;
  }

  .workspace-screen .timer-card {
    position: sticky;
    z-index: 3;
    top: 0;
    order: 0;
    min-height: 0;
    padding: 9px 10px;
  }

  .workspace-screen .timer-label {
    font-size: 9px;
  }

  .workspace-screen .timer {
    margin: 5px 0;
  }

  .workspace-screen .timer-display {
    padding: 9px 6px;
    font-size: clamp(42px, 13vw, 68px);
  }

  .workspace-screen .timer-sub,
  .workspace-screen .timer-card p {
    font-size: 10px;
  }

  .workspace-screen .mobile-workspace-tabs {
    display: grid;
    order: 2;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    min-height: 44px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-soft);
  }

  .workspace-screen .mobile-workspace-tabs.without-resources {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-screen .mobile-workspace-tab {
    min-width: 0;
    min-height: 36px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--muted);
    background: transparent;
    font-size: 11px;
    font-weight: 700;
  }

  .workspace-screen .mobile-workspace-tab.selected,
  .workspace-screen .mobile-workspace-tab[aria-selected="true"] {
    border-color: var(--line-strong);
    color: var(--ink);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
  }

  .workspace-screen .context-column,
  .workspace-screen .resources-column,
  .workspace-screen .work-column > .card.panel {
    display: none;
    order: 2;
    min-width: 0;
    min-height: 0;
    height: 100%;
  }

  .workspace-screen[data-mobile-panel="data"] .context-column,
  .workspace-screen[data-mobile-panel="resources"] .resources-column,
  .workspace-screen[data-mobile-panel="checklist"] .work-column > .card.panel {
    display: block;
  }

  .workspace-screen .group-summary-strip {
    order: 1;
    min-height: 48px;
    overflow-x: auto;
    padding-bottom: 1px;
  }

  .workspace-screen .group-summary-card {
    min-height: 44px;
    min-width: 132px;
    flex-basis: 132px;
  }

  .workspace-screen[data-mobile-panel="checklist"] .work-column > .card.panel {
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    order: 3;
  }

  .workspace-screen[data-mobile-panel="data"] .context-panel {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .workspace-screen[data-mobile-panel="resources"] .resources-column {
    overflow: hidden;
  }

  .workspace-screen[data-mobile-panel="resources"] .resources-panel {
    height: 100%;
  }

  .workspace-screen[data-mobile-panel="checklist"] .activity-list {
    overflow: visible;
  }

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

  .stage-top-grid {
    grid-template-rows: repeat(3, minmax(76px, 1fr));
  }

  .order-fields-overview,
  .order-fields-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 701px) and (max-width: 1100px) {
  .workspace-screen .workspace-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
