/* ---------- Ícone ---------- */
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--sm {
  width: 16px;
  height: 16px;
}

.icon--lg {
  width: 24px;
  height: 24px;
}

/* ---------- Button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  min-height: var(--control-height);
  padding: 0 var(--spacing-lg);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease), color var(--duration) var(--ease);
}

.btn--primary {
  background: var(--brand-fill);
  color: var(--text-on-brand);
}

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

.btn--secondary {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn--secondary:hover {
  border-color: var(--brand-primary);
  background: var(--brand-wash);
}

.btn--ghost {
  color: var(--text-secondary);
  padding: 0 var(--spacing-sm);
}

.btn--ghost:hover {
  color: var(--text-primary);
  background: var(--neutral-wash);
}

.btn--danger {
  border-color: rgba(224, 122, 110, 0.45);
  color: var(--danger);
}

.btn--danger:hover {
  background: var(--danger-wash);
}

.btn--sm {
  min-height: var(--control-height-sm);
  padding: 0 var(--spacing-md);
  font-size: var(--text-sm);
}

.btn--lg {
  min-height: 52px;
  padding: 0 var(--spacing-xl);
}

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

.btn--caps {
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.btn--icon {
  width: var(--control-height);
  padding: 0;
}

.btn--icon.btn--sm {
  width: var(--control-height-sm);
}

.btn[disabled],
.btn[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn.is-loading {
  color: transparent;
  position: relative;
  pointer-events: none;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--text-on-brand);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn--secondary.is-loading::after {
  border-color: var(--text-primary);
  border-right-color: transparent;
}

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

.text-action {
  display: inline-flex;
  align-items: center;
  min-height: 24px; /* alvo de toque mínimo (WCAG 2.5.8) */
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 2px;
  transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.text-action:hover {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

/* ---------- Campos ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field__label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.field__label--caps {
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
}

.field__optional {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

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

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

.control {
  position: relative;
  display: flex;
  align-items: center;
}

.control > .icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.control > .icon ~ .input {
  padding-left: 44px;
}

.control__action {
  position: absolute;
  right: 6px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

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

.input,
.select,
.textarea {
  width: 100%;
  min-height: var(--control-height);
  padding: 0 14px;
  background: var(--surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--border-strong);
}

.input:focus,
.input:focus-within, /* data e hora: o botão do calendário fica dentro do campo */
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  /* Além da borda, um anel fino: o foco aparece mesmo para quem não distingue a cor da borda. */
  box-shadow: 0 0 0 1px var(--brand-primary);
  background: var(--surface-secondary);
}

.input[aria-invalid='true'],
.select[aria-invalid='true'],
.textarea[aria-invalid='true'] {
  border-color: var(--danger);
}

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

.input--sm,
.select--sm {
  min-height: var(--control-height-sm);
  font-size: var(--text-sm);
}

.textarea {
  padding: 12px 14px;
  min-height: 96px;
  resize: vertical;
  line-height: var(--leading-normal);
}

.select {
  appearance: none;
  padding-right: 40px;
  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='%2394877a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

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

input[type='date'].input,
input[type='time'].input,
input[type='month'].input {
  color-scheme: dark;
}

input[type='color'].swatch-input {
  width: var(--control-height);
  height: var(--control-height);
  padding: 3px;
  background: var(--surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.form-grid {
  display: grid;
  gap: var(--spacing-md);
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
}

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

.form-grid > .span-full {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .form-grid > .span-2 {
    grid-column: auto;
  }
}

/* ---------- Checkbox / Radio / Switch ---------- */
.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--text-base);
  color: var(--text-secondary);
  cursor: pointer;
}

.check input {
  appearance: none;
  flex: none;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-primary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.check input[type='radio'] {
  border-radius: 50%;
}

.check input:checked {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

.check input[type='checkbox']:checked::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--text-on-brand);
  border-bottom: 2px solid var(--text-on-brand);
  transform: translateY(-1px) rotate(-45deg);
}

.check input[type='radio']:checked::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-on-brand);
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.switch input {
  appearance: none;
  flex: none;
  width: 40px;
  height: 24px;
  margin: 0;
  border-radius: var(--radius-full);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.switch input::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 4px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--duration) var(--ease), background var(--duration) var(--ease);
}

.switch input:checked {
  background: var(--brand-secondary);
  border-color: var(--brand-secondary);
}

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

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

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  background: var(--neutral-wash);
  color: var(--text-secondary);
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--plain::before {
  display: none;
}

.badge--success {
  background: var(--success-wash);
  color: var(--success);
}

.badge--warning {
  background: var(--warning-wash);
  color: var(--warning);
}

.badge--danger {
  background: var(--danger-wash);
  color: var(--danger);
}

.badge--info {
  background: var(--info-wash);
  color: var(--info);
}

.badge--brand {
  background: var(--brand-wash);
  color: var(--brand-primary);
}

/* ---------- Avatar ---------- */
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  color: var(--brand-primary);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--sm {
  width: 32px;
  height: 32px;
  font-size: var(--text-2xs);
}

.avatar--lg {
  width: 64px;
  height: 64px;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
}

/* ---------- Card / Panel ---------- */
.card {
  background: var(--surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
}

.card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm) var(--spacing-md);
  padding: var(--spacing-lg) var(--spacing-lg) 0;
}

.card__title {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  line-height: 1.15;
}

.card__title .icon {
  color: var(--brand-primary);
}

.card__body {
  padding: var(--spacing-lg);
}

.card__body--flush {
  padding: var(--spacing-md) 0 0;
}

/* ---------- StatCard ---------- */
.stats {
  display: grid;
  gap: var(--spacing-md);
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.stat {
  padding: var(--spacing-lg);
  background: var(--surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  min-width: 0;
}

.stat__label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-secondary);
}

.stat__label .icon {
  color: var(--brand-primary);
}

.stat__value {
  margin-top: var(--spacing-sm);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-medium);
  line-height: 1.1;
  font-variant-numeric: lining-nums;
  white-space: nowrap;
}

.stat__meta {
  margin-top: 6px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.delta--up {
  color: var(--success);
}

.delta--down {
  color: var(--danger);
}

.delta--flat {
  color: var(--text-muted);
}

/* ---------- Tabela ---------- */
.table-wrap {
  position: relative;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-primary);
  white-space: nowrap;
}

.table td {
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--border-primary);
  vertical-align: middle;
  color: var(--text-secondary);
}

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

.table tbody tr {
  transition: background var(--duration) var(--ease);
}

.table tbody tr:hover {
  background: var(--surface-hover);
}

.table tr.is-selected {
  background: var(--brand-wash);
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table .strong {
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}

.cell-main {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  min-width: 0;
}

.cell-main__text {
  min-width: 0;
}

.cell-main__title,
.cell-main__sub {
  display: block;
}

.cell-main__title {
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}

.cell-main__sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Em telas pequenas a tabela vira uma lista de cartões. */
@media (max-width: 760px) {
  .table--stack thead {
    display: none;
  }
  .table--stack,
  .table--stack tbody,
  .table--stack tr,
  .table--stack td {
    display: block;
    width: 100%;
  }
  .table--stack tr {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-primary);
  }
  .table--stack td {
    padding: 3px 0;
    border: 0;
  }
  .table--stack td[data-label]::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 116px;
    font-size: var(--text-xs);
    color: var(--text-muted);
  }
  .table--stack .num {
    text-align: left;
  }
  .table--stack td.cell-actions {
    padding-top: var(--spacing-sm);
  }
}

/* ---------- Tabs / Segmented ---------- */
.tabs {
  display: flex;
  gap: var(--spacing-lg);
  border-bottom: 1px solid var(--border-primary);
  overflow-x: auto;
}

.tabs__tab {
  position: relative;
  padding: var(--spacing-sm) 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--duration) var(--ease);
}

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

.tabs__tab[aria-selected='true'],
.tabs__tab.is-active {
  color: var(--brand-primary);
}

.tabs__tab[aria-selected='true']::after,
.tabs__tab.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--brand-primary);
}

/* Em telas estreitas as opções rolam dentro do próprio controle, nunca empurram a página. */
.segmented {
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 3px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--surface-primary);
}

.segmented__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 34px;
  padding: 0 var(--spacing-md);
  border-radius: 6px;
  font-size: var(--text-sm);
  white-space: nowrap;
  color: var(--text-muted);
  transition: color var(--duration) var(--ease), background var(--duration) var(--ease);
}

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

.segmented__item.is-active,
.segmented__item[aria-pressed='true'] {
  background: var(--brand-fill);
  color: var(--text-on-brand);
}

/* ---------- Overlay: modal e drawer ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  background: rgba(5, 4, 3, 0.72);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration) var(--ease), visibility 0s linear var(--duration);
}

.overlay.is-open {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.overlay--modal {
  /* Um formulário aberto a partir de um painel lateral fica sempre por cima dele. */
  z-index: 110;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
}

#confirm-dialog {
  z-index: 120;
}

.overlay--drawer {
  justify-content: flex-end;
}

.modal,
.drawer {
  display: flex;
  flex-direction: column;
  background: var(--surface-secondary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  max-height: 100%;
}

.modal {
  width: min(100%, var(--modal-width, 560px));
  max-height: calc(100vh - 32px);
  border-radius: var(--radius-lg);
  transform: translateY(8px);
  transition: transform var(--duration) var(--ease);
}

.overlay.is-open .modal {
  transform: none;
}

.drawer {
  width: min(100%, var(--drawer-width, 440px));
  height: 100%;
  border-width: 0 0 0 1px;
  transform: translateX(24px);
  transition: transform var(--duration) var(--ease);
}

.overlay.is-open .drawer {
  transform: none;
}

.modal__head,
.drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-primary);
}

.modal__title,
.drawer__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-medium);
  line-height: 1.15;
}

.modal__body,
.drawer__body {
  padding: var(--spacing-lg);
  overflow-y: auto;
  flex: 1 1 auto;
}

.modal__foot,
.drawer__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--border-primary);
}

@media (max-width: 640px) {
  .overlay--modal {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .modal__foot,
  .drawer__foot {
    flex-direction: column-reverse;
  }
  .modal__foot .btn,
  .drawer__foot .btn {
    width: 100%;
  }
}

/* ---------- Dropdown ---------- */
.dropdown {
  position: relative;
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 208px;
  padding: 6px;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.dropdown__menu--left {
  right: auto;
  left: 0;
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-align: left;
}

.dropdown__item:hover,
.dropdown__item:focus-visible {
  background: var(--neutral-wash);
  color: var(--text-primary);
}

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

.dropdown__sep {
  height: 1px;
  margin: 6px 0;
  background: var(--border-primary);
}

/* ---------- Toast ---------- */
/* No topo e ao centro: nunca cobre os botões de ação (rodapé de modais e painéis laterais). */
.toasts {
  position: fixed;
  top: var(--spacing-md);
  left: 50%;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  cursor: pointer;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 12px var(--spacing-md);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-left: 2px solid var(--success);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: var(--text-sm);
  animation: toast-in var(--duration) var(--ease);
}

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

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

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

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

/* ---------- Alert ---------- */
.alert {
  display: flex;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.alert--danger {
  border-color: rgba(224, 122, 110, 0.4);
  background: var(--danger-wash);
  color: var(--text-primary);
}

.alert--success {
  border-color: rgba(109, 187, 138, 0.4);
  background: var(--success-wash);
  color: var(--text-primary);
}

.alert--brand {
  border-color: var(--border-brand);
  background: var(--brand-wash);
}

/* ---------- Empty state ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-2xl) var(--spacing-lg);
  text-align: center;
}

.empty__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--brand-primary);
}

.empty__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
}

.empty__text {
  max-width: 42ch;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.empty--compact {
  padding: var(--spacing-xl) var(--spacing-md);
}

/* ---------- Skeleton ---------- */
.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-secondary) 25%, var(--surface-raised) 50%, var(--surface-secondary) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.4s ease-in-out infinite;
}

@keyframes skeleton {
  to {
    background-position: -200% 0;
  }
}

/* ---------- Paginação ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  flex-wrap: wrap;
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--border-primary);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.pagination__pages {
  display: flex;
  gap: 4px;
}

.pagination__page {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: 6px;
  color: var(--text-secondary);
}

.pagination__page:hover {
  background: var(--neutral-wash);
}

.pagination__page.is-current {
  background: var(--brand-fill);
  color: var(--text-on-brand);
}

.pagination__page.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ---------- Upload ---------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 132px;
  padding: var(--spacing-lg);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease);
}

.dropzone:hover,
.dropzone.is-dragover,
.dropzone:focus-within {
  border-color: var(--brand-primary);
  background: var(--brand-wash);
}

.dropzone .icon {
  color: var(--brand-primary);
}

.dropzone__title {
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.dropzone__hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.dropzone.is-busy {
  opacity: 0.6;
  pointer-events: none;
}

/* ---------- Progresso ---------- */
.progress {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--surface-raised);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  border-radius: inherit;
  background: var(--brand-fill);
}

/* ---------- Chip (seleção múltipla) ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease), color var(--duration) var(--ease);
}

.chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.chip:has(input:checked) {
  border-color: var(--brand-primary);
  background: var(--brand-wash);
  color: var(--brand-accent);
}

.chip:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

/* ---------- Lista de definição ---------- */
.deflist {
  display: grid;
  gap: 0;
}

.deflist__row {
  display: flex;
  justify-content: space-between;
  gap: var(--spacing-md);
  padding: 10px 0;
  border-bottom: 1px solid var(--border-primary);
  font-size: var(--text-sm);
}

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

.deflist dt {
  color: var(--text-muted);
}

.deflist dd {
  color: var(--text-primary);
  text-align: right;
}

.divider {
  height: 1px;
  border: 0;
  margin: var(--spacing-lg) 0;
  background: var(--border-primary);
}

/* ---------- Formulário dentro de modal/drawer ---------- */
.form-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.thumb {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--border-primary);
}

.input--file {
  padding: 9px 12px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.input--file::file-selector-button {
  margin-right: var(--spacing-sm);
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}

.inline-icon {
  display: inline-block;
  vertical-align: -3px;
}

/* ---------- Ajuda de campo ---------- */
.help {
  position: relative;
  display: inline-block;
}

.help summary {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
}

.help summary::-webkit-details-marker {
  display: none;
}

.help summary:hover,
.help[open] summary {
  border-color: var(--brand-primary);
  color: var(--brand-accent);
}

.help__text {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  width: min(280px, 72vw);
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-secondary);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  letter-spacing: 0;
  line-height: 1.5;
  text-transform: none;
  color: var(--text-secondary);
}

/* Botão que é um rótulo de arquivo: mesmo estado de carregamento dos botões. */
label.btn.is-loading {
  pointer-events: none;
  opacity: 0.6;
}

/* No celular a ajuda abre como um cartão preso à base da tela: nunca sai da largura. */
@media (max-width: 599px) {
  .help__text {
    position: fixed;
    top: auto;
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: auto;
    z-index: 60;
  }
}

/* Lista simples dentro de um detalhe (ex.: serviços de uma solicitação) */
.plain-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
