/* =========================================================================
   Componentes reutilizáveis. Regra: situação = ponto + texto (sem pílula colorida);
   uma superfície por bloco; verde só no que é ação primária ou estado positivo.
   ========================================================================= */

/* ---------- Botões ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: var(--control-h);
  padding: 0 var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--fs-md);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  transition: background-color var(--dur-1), border-color var(--dur-1), color var(--dur-1), opacity var(--dur-1);
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.btn--primary:hover {
  background: var(--accent-hover);
}

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

.btn--secondary:hover {
  background: var(--surface-3);
}

.btn--ghost {
  background: transparent;
  color: var(--text-2);
}

.btn--ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn--danger {
  background: var(--danger);
  color: var(--danger-ink);
  font-weight: 600;
}

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

.btn--sm {
  height: var(--control-h-sm);
  padding: 0 var(--sp-3);
  font-size: var(--fs-sm);
}

.btn--block {
  width: 100%;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.is-loading {
  cursor: progress;
}

.btn.is-loading > :not(.spinner) {
  visibility: hidden;
}

.btn.is-loading > .spinner {
  position: absolute;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-2);
  transition: background-color var(--dur-1), color var(--dur-1);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.text-action {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 500;
}

.text-action:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Formulários ---------- */
.form {
  display: grid;
  gap: var(--sp-4);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field__label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-2);
}

.field__hint {
  font-size: var(--fs-xs);
  color: var(--text-3);
}

/* Dica preenchida conforme a escolha (ex.: preço da oferta): vazia, não ocupa lugar. */
.field__hint:empty {
  display: none;
}

.field__error {
  font-size: var(--fs-xs);
  color: var(--danger);
}

.field__error:empty {
  display: none;
}

.input,
.select {
  width: 100%;
  height: var(--control-h);
  padding: 0 var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}

.input::placeholder {
  color: var(--text-3);
}

.input:hover,
.select:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.input:focus,
.select:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input:disabled,
.select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A1A1AA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.select option {
  background: var(--surface-2);
  color: var(--text);
}

.field.is-invalid .input,
.field.is-invalid .select {
  border-color: var(--danger-line);
}

.field.is-invalid .input:focus,
.field.is-invalid .select:focus {
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.input-group {
  position: relative;
}

.input-group .input {
  padding-right: 44px;
}

.input-group__action {
  position: absolute;
  top: 2px;
  right: 2px;
  bottom: 2px;
  width: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
}

.input-group__action:hover {
  color: var(--text);
}

/* Campo com unidade ao lado ("12 horas") */
.input-unit {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.input-unit .input {
  max-width: 140px;
}

.input-unit__label {
  color: var(--text-2);
}

.input-search {
  position: relative;
}

.input-search .icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.input-search .input {
  padding-left: 34px;
}

/* Interruptor (checkbox com role="switch") */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
}

.switch input {
  position: relative;
  width: 36px;
  height: 20px;
  margin: 0;
  flex: none;
  appearance: none;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  transition: background-color var(--dur-2);
  cursor: inherit;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform var(--dur-2) var(--ease), background-color var(--dur-2);
}

.switch input:checked {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.switch input:checked::after {
  transform: translateX(16px);
  background: var(--accent);
}

.switch input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-error {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: #FFC2C2;
  font-size: var(--fs-sm);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
}

/* ---------- Bloco e leitura de dados ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-3);
}

.panel__title {
  font-size: var(--fs-lg);
  font-weight: 600;
}

.panel__body {
  padding: 0 var(--sp-5) var(--sp-5);
}

/* Lugar das ações no cabeçalho do painel: a altura fica reservada quando o botão sai (sem "pulo"). */
.panel__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--control-h-sm);
}

.readouts {
  display: grid;
  gap: var(--sp-4);
}

.readout {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.readout__label {
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.readout__value {
  font-size: 0.9375rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* Situação: ponto + texto */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--text-3);
}

.status--ok::before {
  background: var(--accent);
}

.status--warn::before {
  background: var(--warning);
}

.status--danger::before {
  background: var(--danger);
}

.status--off {
  color: var(--text-3);
}

.status--off::before {
  background: #4D4D56;
}

/* Na tabela, o rótulo quebra linha em vez de empurrar a tabela para a rolagem ("Comprado, aguardando
   rastreio"); o ponto acompanha a primeira linha (altura de linha 1,5). */
.table .status {
  align-items: flex-start;
  white-space: normal;
}

.table .status::before {
  margin-top: calc(0.75em - 3.5px);
}

/* Avisos dentro da página */
.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}

.notice .icon {
  margin-top: 1px;
}

.notice--info {
  background: var(--info-soft);
}

.notice--info .icon {
  color: var(--info);
}

.notice--warning {
  background: var(--warning-soft);
}

.notice--warning .icon {
  color: var(--warning);
}

.notice--success {
  background: var(--accent-soft);
}

.notice--success .icon {
  color: var(--accent);
}

.notice__title {
  font-weight: 600;
  color: var(--text);
}

/* Senha temporária: mostrada uma vez, para copiar */
.secret {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px dashed var(--accent-line);
  border-radius: var(--radius);
  background: var(--bg);
}

.secret__value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  user-select: all;
  overflow-wrap: anywhere;
}

/* ---------- Tabelas ---------- */
.table-block {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--line);
}

.toolbar .field {
  flex: 0 1 180px;
}

.toolbar .field--grow {
  flex: 1 1 200px;
}

/* Filtro de poucas opções curtas (ex.: "Com problema"): ocupa menos, para a barra caber numa linha. */
.toolbar .field--narrow {
  flex: 0 1 140px;
}

.toolbar__actions {
  display: flex;
  gap: var(--sp-2);
  margin-left: auto;
}

.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  padding: 10px var(--sp-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 11px var(--sp-4);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.022);
}

.table tr.is-clickable {
  cursor: pointer;
}

.table tr.is-clickable:focus-visible {
  outline-offset: -2px;
}

.table .cell-end {
  text-align: right;
}

.table .cell-nowrap {
  white-space: nowrap;
}

.table .cell-muted {
  color: var(--text-2);
}

/* Linha fora de uso (oferta pausada): continua legível, mas recua. */
.table tr.is-muted td {
  color: var(--text-3);
}

.cell-sub {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.cell-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-1);
  white-space: nowrap;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
}

.sort-btn:hover {
  color: var(--text-2);
}

.sort-btn .icon {
  opacity: 0;
}

th[aria-sort] .sort-btn {
  color: var(--text-2);
}

th[aria-sort] .sort-btn .icon {
  opacity: 1;
}

/* Recarga com dados na tela: o conteúdo fica, clareia e uma linha corre no alto. */
.progress-line {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  overflow: hidden;
  opacity: 0;
  transition: opacity var(--dur-2);
  pointer-events: none;
}

.progress-line::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 35%;
  background: var(--accent);
  animation: progress-run 1.1s var(--ease) infinite;
}

@keyframes progress-run {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(290%);
  }
}

.is-loading > .progress-line {
  opacity: 1;
}

.is-loading .table tbody,
.is-loading .activity {
  opacity: 0.55;
  transition: opacity var(--dur-2);
}

/* Esqueleto: só na primeira carga, no formato do conteúdo */
.skeleton {
  display: block;
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -100% 0;
  }
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.pagination__controls {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.pagination__size {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.pagination__size .select {
  width: auto;
  height: var(--control-h-sm);
  font-size: var(--fs-sm);
}

/* ---------- Estado vazio e erro de carga ---------- */
.empty {
  display: grid;
  justify-items: center;
  gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
}

/* Vazio dentro de um painel: o mesmo recado, com menos respiro. */
.empty--compact {
  padding: var(--sp-5) var(--sp-4);
}

.empty__art {
  width: 120px;
  height: 84px;
  margin-bottom: var(--sp-2);
  color: rgba(255, 255, 255, 0.14);
}

.empty__title {
  font-size: var(--fs-lg);
  font-weight: 500;
}

.empty__hint {
  max-width: 46ch;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.empty__action {
  margin-top: var(--sp-2);
}

/* ---------- Diálogo ---------- */
.dialog {
  width: min(calc(100vw - 32px), var(--dialog-w, 560px));
  max-width: none;
  max-height: min(calc(100vh - 48px), 820px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--overlay);
  color: var(--text);
  box-shadow: var(--shadow-pop);
}

.dialog[open] {
  display: flex;
  flex-direction: column;
  animation: dialog-in var(--dur-2) var(--ease);
}

.dialog::backdrop {
  background: rgba(4, 4, 6, 0.66);
  animation: fade-in var(--dur-2) var(--ease);
}

.dialog.is-closing {
  animation: dialog-out var(--dur-1) ease-in forwards;
}

.dialog.is-closing::backdrop {
  animation: fade-out var(--dur-1) ease-in forwards;
}

.dialog--sm {
  --dialog-w: 440px;
}

.dialog--md {
  --dialog-w: 560px;
}

.dialog--lg {
  --dialog-w: 780px;
}

.dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-3);
}

.dialog__title {
  font-size: var(--fs-lg);
  font-weight: 600;
}

.dialog__description {
  margin-top: 4px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.dialog__close {
  margin: -6px -8px 0 0;
}

.dialog__body {
  flex: 1;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-5) var(--sp-5);
  overflow-y: auto;
}

.dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--line);
}

.dialog__footer:empty {
  display: none;
}

.dialog__error {
  margin: 0 var(--sp-5) var(--sp-4);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes dialog-out {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.99);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

/* ---------- Avisos flutuantes ---------- */
/* A área é um popover (camada de cima, acima de diálogo aberto): zera o que o navegador põe em todo popover. */
.toasts {
  position: fixed;
  inset: var(--sp-4) var(--sp-4) auto auto;
  z-index: 60;
  display: grid;
  gap: var(--sp-2);
  width: min(380px, calc(100vw - 32px));
  height: auto;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  color: inherit;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-2) var(--sp-3) var(--sp-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-3);
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity var(--dur-2), transform var(--dur-2) var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: none;
}

.toast__icon {
  margin-top: 2px;
}

.toast--success .toast__icon {
  color: var(--accent);
}

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

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

.toast__body {
  flex: 1;
  min-width: 0;
}

.toast__detail {
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.toast .icon-btn {
  width: 26px;
  height: 26px;
  margin-top: -2px;
}

/* ---------- Atividade (lista com data) ---------- */
.activity {
  display: grid;
}

.activity__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line);
}

.activity__item:last-child {
  border-bottom: 0;
}

a.activity__item:hover .activity__what {
  color: var(--accent);
}

.activity__what {
  color: var(--text);
}

.activity__who {
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.activity__when {
  grid-row: 1 / span 2;
  grid-column: 2;
  font-size: var(--fs-xs);
  color: var(--text-3);
  white-space: nowrap;
}

/* Lista de efeitos numa confirmação */
.confirm-list {
  display: grid;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.confirm-list li {
  position: relative;
  padding-left: var(--sp-4);
}

.confirm-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-3);
}

/* Mudanças antes/depois no detalhe do histórico */
.changes {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.changes th {
  padding: var(--sp-2) var(--sp-3) var(--sp-2) 0;
  color: var(--text-3);
  font-weight: 500;
  font-size: var(--fs-xs);
  text-align: left;
}

.changes td {
  padding: var(--sp-2) var(--sp-3) var(--sp-2) 0;
  border-top: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.changes .is-before {
  color: var(--text-2);
}

.toolbar__toggle {
  display: none;
}

/* "Ordenar por": só no celular, onde o cabeçalho clicável da tabela fica oculto. */
.field.table-sort,
.table-sort-bar {
  display: none;
}

@media (max-width: 640px) {
  .toolbar .field.table-sort {
    display: grid;
  }

  .table-sort-bar {
    display: flex;
  }

  /* Filtros: busca primeiro, demais campos atrás do botão "Filtros". */
  .toolbar .field--grow {
    order: -2;
  }

  .toolbar__toggle {
    display: inline-flex;
    order: -1;
  }

  .toolbar:not(.is-expanded) [data-secondary] {
    display: none;
  }

  /* Tabela: cada linha vira um bloco "rótulo: valor", sem rolagem lateral. */
  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--line);
  }

  .table tbody tr:last-child {
    border-bottom: 0;
  }

  .table td,
  .table tbody tr:last-child td,
  .table td.cell-end {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: var(--sp-3);
    padding: 3px 0;
    border: 0;
    text-align: left; /* inclusive colunas de valor: no bloco, rótulo e valor ficam alinhados à esquerda */
  }

  .table td::before {
    content: attr(data-label);
    padding-top: 2px;
    color: var(--text-3);
    font-size: var(--fs-xs);
  }

  .table td[data-label=""] {
    grid-template-columns: minmax(0, 1fr);
    padding-top: var(--sp-2);
  }

  /* Campo sem valor não ocupa linha (o rótulo sozinho só confunde). */
  .table td:empty {
    display: none;
  }

  .table td[data-label=""]::before {
    display: none;
  }

  .table .cell-actions {
    justify-content: flex-start;
  }

  .table tbody tr:hover td {
    background: transparent;
  }

  .dialog {
    width: 100vw;
    max-height: 94vh;
    margin: auto 0 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .dialog__footer {
    flex-direction: column-reverse;
  }

  .dialog__footer .btn {
    width: 100%;
  }

  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .toolbar .field {
    flex: 1 1 100%;
  }

  .toolbar .field--grow {
    flex: 1 1 0;
    min-width: 0;
  }

  .toolbar__actions {
    margin-left: 0;
  }

  .pagination {
    justify-content: center;
  }
}

@media (max-width: 1023px) {
  .toasts {
    top: 60px;
  }
}

/* ---------- Pedidos ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  margin-bottom: var(--sp-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.back-link:hover {
  color: var(--text);
}

/* Link dentro de linha clicável: na cor do texto (o verde fica para a ação principal). */
.row-link {
  color: inherit;
}

.row-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Link para fora do sistema (loja, anúncio): discreto, com o ícone de "abre em outra aba". */
.external-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-2);
}

.external-link:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cell-clip {
  max-width: 280px;
}

.cell-clip > span:first-child {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel__lead {
  margin-top: 2px;
  color: var(--text-2);
  font-size: var(--fs-sm);
}

/* Grade de campos: 12 colunas no computador, 2 por linha no tablet, 1 no celular. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start; /* campo com dica não estica os vizinhos (rótulos e campos alinhados na linha) */
  gap: var(--sp-4);
}

.form-grid > * {
  grid-column: span 12;
}

.form-grid > .col-2 {
  grid-column: span 2;
}

.form-grid > .col-3 {
  grid-column: span 3;
}

.form-grid > .col-4 {
  grid-column: span 4;
}

.form-grid > .col-6 {
  grid-column: span 6;
}

.form-grid > .col-8 {
  grid-column: span 8;
}

/* Campo de dinheiro com "R$" à esquerda */
.input-prefix {
  position: relative;
}

.input-prefix__text {
  position: absolute;
  top: 50%;
  left: var(--sp-3);
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: var(--fs-sm);
  pointer-events: none;
}

.input-prefix .input {
  padding-left: 36px;
}

textarea.input {
  height: auto;
  min-height: 64px;
  padding: var(--sp-2) var(--sp-3);
  line-height: 1.5;
  resize: vertical;
}

.icon-btn--sm {
  width: 26px;
  height: 26px;
  vertical-align: middle;
}

/* Itens no cadastro do pedido */
.order-items {
  display: grid;
  gap: var(--sp-4);
}

.order-item {
  display: grid;
  gap: var(--sp-3);
  min-width: 0;
  margin: 0;
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.order-item__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: var(--control-h-sm);
}

.order-item__title {
  color: var(--text-2);
  font-size: var(--fs-md);
  font-weight: 600;
}

/* Detalhe do pedido */
.order-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-5);
  margin-top: var(--sp-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.order-header__meta > .status {
  color: var(--text);
}

.order-header__item {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
}

.order-notices {
  display: grid;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.order-notices:empty {
  display: none;
}

/* Checklist de conclusão no topo do pedido (o que falta para fechar). O que falta fica claro, com o ponto
   vazado (é o que a pessoa procura); o cumprido fica apagado, com o check. Nada aqui ganha verde. */
.checklist {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2) var(--sp-5);
  margin-bottom: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
}

.checklist__title {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.checklist__items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
}

/* Marcador do tamanho da primeira linha e texto em coluna própria: a dica que quebra linha fica alinhada ao texto. */
.checklist__item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  color: var(--text);
}

.checklist__mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 1.5em;
}

.checklist__dot {
  width: 7px;
  height: 7px;
  border: 1px solid var(--text-2);
  border-radius: 50%;
}

.checklist__item.is-done {
  color: var(--text-3);
}

.checklist__hint {
  flex-basis: 100%;
  color: var(--text-3);
}

.readout__sub {
  display: block;
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.readout__action {
  margin-left: var(--sp-3);
  font-size: var(--fs-sm);
}

.readout__value .icon-btn--sm {
  margin-left: var(--sp-1);
}

.address {
  display: grid;
}

/* Tabela dentro de painel: alinhada ao respiro do painel, sem recuo duplo. */
.table--flush th:first-child,
.table--flush td:first-child {
  padding-left: 0;
}

.table--flush th:last-child,
.table--flush td:last-child {
  padding-right: 0;
}

.order-totals {
  display: grid;
  gap: var(--sp-1);
  max-width: 320px;
  margin: var(--sp-4) 0 0 auto;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
}

.order-totals__line {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
}

.order-totals dt {
  color: var(--text-2);
}

.order-totals .is-total {
  margin-top: var(--sp-1);
  font-size: var(--fs-lg);
  font-weight: 600;
}

.order-totals .is-total dt {
  color: var(--text);
}

.order-totals .is-muted,
.order-totals .is-muted dt {
  margin-top: var(--sp-2);
  color: var(--text-3);
}

/* Linha do tempo do pedido: a lista de atividade do Painel, com observação, mudanças e motivo. */
.activity__extra {
  grid-column: 1 / -1;
  margin-top: var(--sp-1);
}

.activity__note {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  background: var(--surface-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.activity__changes {
  display: grid;
  gap: 2px;
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

.activity__changes .is-before {
  color: var(--text-2);
}

.activity__reason {
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

/* Edição no lugar: o dado vira formulário no mesmo painel */
.inline-form {
  gap: var(--sp-3);
}

.inline-form .form-actions {
  margin-top: var(--sp-1);
}

.table tr.is-editing td,
.table tbody tr.is-editing:hover td {
  padding: var(--sp-4) 0;
  background: transparent;
}

/* Item sendo alterado ou incluído: a mesma caixa do cadastro do pedido. */
.item-editor {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.table-scroll + .item-editor {
  margin-top: var(--sp-4);
}

.item-editor__title {
  color: var(--text-2);
  font-size: var(--fs-md);
  font-weight: 600;
}

.item-editor__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
}

.item-editor__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

/* Compra e envio: quantas unidades de cada item vão */
.unit-lines {
  display: grid;
  gap: var(--sp-2);
}

.unit-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-1) var(--sp-4);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  background: var(--surface);
}

.unit-line .input {
  max-width: 88px;
}

.unit-line__error {
  grid-column: 1 / -1;
}

.purchase-unit {
  display: block;
}

.purchase-breakdown {
  margin-top: var(--sp-2);
  color: var(--text-2);
}

/* Caixa de marcar com texto (confirmação explícita, ex.: "Registrei no Seller Central") */
.check {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--sp-2);
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--accent);
  cursor: inherit;
}

/* Envio: código, os quatro níveis lado a lado e os eventos do rastreio */
.shipment {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-4) 0;
  border-top: 1px solid var(--line);
}

.shipment:first-child {
  padding-top: 0;
  border-top: 0;
}

.shipment__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
}

.shipment__code {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--text);
}

.shipment.is-invalid .shipment__code {
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-color: var(--text-3);
}

.levels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-2);
}

.level {
  display: grid;
  align-content: start;
  gap: var(--sp-1);
  padding: var(--sp-3);
  border-radius: var(--radius);
  background: var(--bg);
}

.level__title {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

/* Ponto do nível: vazado (pendente), cheio neutro (cumprido); só a entrega cumprida fica verde. */
.level__title::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border: 1px solid var(--text-3);
  border-radius: 50%;
}

.level.is-done .level__title {
  color: var(--text);
}

.level.is-done .level__title::before {
  border-color: var(--text-2);
  background: var(--text-2);
}

.level.is-done.is-final .level__title::before {
  border-color: var(--accent);
  background: var(--accent);
}

.level__meta {
  color: var(--text-3);
  font-size: var(--fs-xs);
  overflow-wrap: anywhere;
}

.level .btn {
  justify-self: start;
  margin-top: var(--sp-1);
}

.shipment__events-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--sp-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.shipment__add-event {
  margin-left: auto;
  font-size: var(--fs-sm);
}

.shipment__history summary {
  color: var(--text-2);
  font-size: var(--fs-sm);
  cursor: pointer;
}

.shipment__event-list {
  display: grid;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  padding-left: var(--sp-4);
  font-size: var(--fs-sm);
}

/* Problema do pedido: tipo e situação, o que aconteceu e, fechado, a solução ou o motivo. Fechado fica apagado. */
.issue {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-4) 0;
  border-top: 1px solid var(--line);
}

.issue:first-child {
  padding-top: 0;
  border-top: 0;
}

.issue__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
}

.issue__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
  color: var(--text);
  font-weight: 600;
}

.issue__title .status {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 400;
}

.issue__description {
  color: var(--text);
  overflow-wrap: anywhere;
}

.issue.is-closed .issue__title,
.issue.is-closed .issue__description {
  color: var(--text-2);
}

.issue__outcome {
  color: var(--text-2);
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

/* Tarefa: título e prioridade, de onde veio e com quem; à direita, o prazo e as ações. A do sistema diz quando
   fecha sozinha. Fechada fica apagada. */
.task-title {
  color: var(--text);
  font-weight: 500;
}

.table tr.is-muted .task-title {
  color: var(--text-2);
}

.task-list {
  display: grid;
}

.task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--sp-2) var(--sp-4);
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--line);
}

.task-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.task-row__main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.task-row__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
  color: var(--text);
  font-weight: 500;
}

.task-row__title .status {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 400;
}

.task-row__text {
  color: var(--text-2);
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

.task-row__meta {
  color: var(--text-3);
  font-size: var(--fs-xs);
}

.task-row__side {
  display: grid;
  justify-items: end;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  text-align: right;
}

.task-row.is-closed .task-row__title,
.task-row.is-closed .task-row__side {
  color: var(--text-2);
}

.task-history {
  margin-top: var(--sp-3);
}

.task-history summary {
  color: var(--text-2);
  font-size: var(--fs-sm);
  cursor: pointer;
}

.task-history .task-list {
  margin-top: var(--sp-3);
}

/* Painel: números que abrem a lista já filtrada. Zero fica apagado; o que pede atenção leva o ponto da situação. */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3);
}

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

.stat {
  display: grid;
  align-content: start;
  gap: var(--sp-1);
  min-width: 0;
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

a.stat:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.stat__count {
  font-size: var(--fs-2xl);
  font-weight: 600;
  line-height: 1.1;
}

.stat__label {
  color: var(--text-2);
  font-size: var(--fs-sm);
  white-space: normal;
}

.stat.is-zero .stat__count {
  color: var(--text-3);
}

.person-counts {
  margin-top: var(--sp-4);
}

.person-counts__title {
  margin-bottom: var(--sp-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.person-counts li + li {
  border-top: 1px solid var(--line);
}

.person-counts a {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  color: var(--text);
  text-decoration: none;
}

.person-counts a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dashboard-orders,
.dashboard-finance {
  margin-bottom: var(--sp-5);
}

/* Financeiro do Painel: os cinco valores numa fila só no computador largo */
@media (min-width: 1200px) {
  .dashboard-finance .stats:first-child {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Cartões de valor em dinheiro: o valor não se parte ("R$" sozinho numa linha); no celular, um por linha. */
.stats--money .stat__count {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .stats.stats--money {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Campo de arquivo: o botão nativo no tom dos botões secundários (o padrão do navegador é claro). */
.input[type="file"] {
  padding: 5px;
  cursor: pointer;
}

.input[type="file"]::file-selector-button {
  margin-right: var(--sp-3);
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.input[type="file"]::file-selector-button:hover {
  background: var(--surface-3);
}

/* Anexo: o tipo, o nome (imagem abre, PDF baixa), do que fala, tamanho, quando e quem. */
.attachment-list {
  display: grid;
}

.attachment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--line);
}

.attachment:first-child {
  padding-top: 0;
  border-top: 0;
}

.attachment__kind {
  margin-top: 2px;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
}

.attachment__main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.attachment__name {
  color: var(--text);
  font-weight: 500;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.attachment__name:hover {
  text-decoration-color: var(--text-2);
}

.attachment__text {
  color: var(--text-2);
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .task-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-row__side {
    justify-items: start;
    text-align: left;
  }
}

/* Custos das compras nos totais: ao lado do previsto, sem competir com o total da venda */
.order-totals .is-cost,
.order-totals .is-cost dt {
  color: var(--text-2);
}

.readout__inline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
}

/* Financeiro: saldo negativo de conta comum (alerta). A fatura do cartão é o normal do cartão e fica neutra. */
.is-negative {
  color: var(--danger);
}

/* Soma do conjunto filtrado, logo abaixo dos filtros de uma lista de dinheiro */
.list-sum {
  margin: 0;
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.list-sum:empty {
  display: none;
}

/* Título de uma seção que é uma lista (a lista já tem a própria moldura) */
.section-head {
  display: grid;
  gap: 2px;
  margin-bottom: var(--sp-3);
}

/* Leituras lado a lado (diálogos do financeiro) */
.readouts--grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

/* O número que a pessoa veio ver no diálogo (o que falta pagar, o valor da movimentação), com a situação ao lado */
.title-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2) var(--sp-4);
}

.title-headline__value {
  font-size: var(--fs-xl);
  font-weight: 600;
}

/* Pagamentos e recebimentos de uma conta */
.movements__title {
  margin-bottom: var(--sp-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.movement {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--control-h);
  padding: var(--sp-2) 0;
}

.movement + .movement {
  border-top: 1px solid var(--line);
}

.movement__main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.movement.is-muted .movement__main > span:first-child,
.movement.is-muted .movement__amount {
  color: var(--text-3);
}

/* Financeiro do pedido: margem em destaque, termos lado a lado (o estimado marcado) e as listas do dinheiro */
.finance-margin {
  display: grid;
  gap: var(--sp-3);
}

.order-totals--wide {
  max-width: none;
  margin: 0;
}

.order-totals .is-subtotal {
  font-weight: 600;
}

.order-totals .is-subtotal dt {
  color: var(--text);
}

.term-flag {
  margin-left: var(--sp-2);
  color: var(--text-3);
  font-size: var(--fs-xs);
}

.finance-pending {
  display: grid;
  gap: 2px;
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.finance-pending li::before {
  content: "· ";
}

.finance-section {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
}

.finance-add {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

/* Texto clicável que abre um diálogo (não navega): parece link, sem o azul */
.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Título de uma lista com a ação ao lado (ex.: Anexos + Anexar no diálogo da conta) */
.movements__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}

.movements__head .movements__title {
  margin-bottom: 0;
}

/* Painel: a segunda fila de números do financeiro (ações e o mês) e a linha de apoio de um número */
.dashboard-finance__more {
  margin-top: var(--sp-3);
}

.stat__sub {
  color: var(--text-2);
  font-size: var(--fs-sm);
}

/* Relatórios: título do relatório escolhido, a tabela com a linha de totais e as notas de como ler */
.report__head {
  display: grid;
  gap: 2px;
  margin-bottom: var(--sp-4);
}

.report__table {
  font-size: var(--fs-sm);
}

@media (min-width: 641px) {
  .report__table th,
  .report__table td {
    padding-right: var(--sp-2);
    padding-left: var(--sp-2);
  }
}

.report__table tfoot td {
  border-top: 1px solid var(--line-strong);
  font-weight: 600;
}

.report__notes {
  display: grid;
  gap: var(--sp-1);
  margin-top: var(--sp-4);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.report__notes:empty {
  display: none;
}

.report__notes li::before {
  content: "· ";
}

@media (max-width: 640px) {
  .report__table tfoot,
  .report__table tfoot tr {
    display: block;
    width: 100%;
  }

  /* Tabela "flush": a linha não tem recuo lateral (igual às do corpo). */
  .report__table tfoot tr {
    padding: var(--sp-3) 0;
    border-top: 1px solid var(--line);
  }

  .report__table tfoot td {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: var(--sp-3);
    padding: 3px 0;
    border: 0;
    text-align: left;
  }

  .report__table tfoot td:empty {
    display: none;
  }
}

/* Abas (ex.: Repasses registrados | Aguardando repasse): a ativa com o texto forte e um traço no verde */
.tabs {
  display: flex;
  gap: var(--sp-1);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--line);
}

.tabs__tab {
  position: relative;
  padding: var(--sp-2) var(--sp-3);
  border: 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tabs__tab:hover {
  color: var(--text);
}

.tabs__tab[aria-selected="true"] {
  color: var(--text);
}

.tabs__tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  right: var(--sp-3);
  bottom: -1px;
  left: var(--sp-3);
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.stats--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Incluir pedidos no repasse: uma linha por pedido, marcar e digitar os valores do extrato */
.add-orders {
  display: grid;
  max-height: min(55vh, 520px);
  overflow-y: auto;
  margin: var(--sp-3) 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.add-orders__row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(110px, 1fr)) minmax(90px, auto);
  align-items: end;
  gap: var(--sp-2) var(--sp-3);
  padding: var(--sp-3);
}

.add-orders__row + .add-orders__row {
  border-top: 1px solid var(--line);
}

.add-orders__row.is-selected {
  background: var(--surface-2);
}

.add-orders__pick {
  align-self: center;
}

.add-orders__pick > span {
  display: grid;
  gap: 2px;
}

.add-orders__field {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.add-orders__label {
  color: var(--text-2);
  font-size: var(--fs-xs);
}

.add-orders__result {
  justify-items: end;
  align-self: center;
}

.add-orders__error {
  grid-column: 1 / -1;
}

.add-orders__error:empty,
.add-orders__field .field__error:empty {
  display: none;
}

.add-orders__total {
  border-bottom: 0;
  padding-right: 0;
  padding-left: 0;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  min-height: var(--control-h);
  align-items: center;
}

@media (max-width: 640px) {
  .stats--three {
    grid-template-columns: minmax(0, 1fr);
  }

  /* No celular a lista rola junto com o diálogo (sem rolagem dentro de rolagem) e os valores ficam em 2 × 2. */
  .add-orders {
    max-height: none;
    overflow: visible;
  }

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

  .add-orders__pick {
    grid-column: 1 / -1;
  }

  .add-orders__result {
    justify-items: start;
    align-self: end;
    padding-bottom: var(--sp-2);
  }
}

/* Categorias do financeiro (Configurações): entradas e saídas lado a lado, uma linha por categoria */
.category-groups {
  display: grid;
  gap: var(--sp-5);
}

.category-groups > * {
  min-width: 0;
}

.category-group__title {
  margin-bottom: var(--sp-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.category {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--control-h);
  padding: var(--sp-2) 0;
}

.category__main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.category + .category {
  border-top: 1px solid var(--line);
}

.category__name {
  min-width: 0;
}

.category__badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
  font-size: var(--fs-sm);
}

.category.is-muted .category__name {
  color: var(--text-3);
}

@media (max-width: 1023px) {
  .form-grid > .col-2,
  .form-grid > .col-3,
  .form-grid > .col-4,
  .form-grid > .col-8 {
    grid-column: span 6;
  }
}

@media (max-width: 1199px) {
  .levels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .levels {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Campos curtos em pares (quantidade e preço, frete e desconto, telefone e CEP); os demais, linha inteira. */
  .form-grid > .col-2,
  .form-grid > .col-3 {
    grid-column: span 6;
  }

  .form-grid > .col-4,
  .form-grid > .col-6,
  .form-grid > .col-8 {
    grid-column: span 12;
  }

  .table--flush tr {
    padding-right: 0;
    padding-left: 0;
  }

  /* No bloco do celular há espaço para o nome inteiro: sem reticências. */
  .cell-clip {
    max-width: none;
  }

  .cell-clip > span:first-child {
    white-space: normal;
  }

  .order-totals {
    max-width: none;
  }

  .order-item {
    padding: var(--sp-3);
  }
}
