/* Pedidos de insumo — histórico para o time de Workplace */

:root {
  --pd-accent: #14b8a6;
  --pd-accent-dark: #0f9488;
  --pd-bg: #f4f5f7;
  --pd-surface: #ffffff;
  --pd-border: #e5e7eb;
  --pd-text: #111827;
  --pd-muted: #6b7280;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--pd-bg);
  color: var(--pd-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.pd-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}

.pd-header h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.pd-subtitle {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--pd-muted);
}

/* ── Abas ─────────────────────────────────────────────────────────────────── */

.pd-tabs {
  display: flex;
  gap: 4px;
  margin: 26px 0 22px;
  border-bottom: 1px solid var(--pd-border);
}

.pd-tab {
  border: none;
  background: none;
  padding: 10px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--pd-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

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

.pd-tab--active {
  color: var(--pd-accent-dark);
  border-bottom-color: var(--pd-accent);
}

/* ── Filtros ──────────────────────────────────────────────────────────────── */

.pd-filters {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin: 26px 0 28px;
}

.pd-filter {
  display: grid;
  gap: 6px;
}

.pd-filter--grow {
  flex: 1;
  min-width: 220px;
}

.pd-filter--grow input {
  width: 100%;
}

.pd-filter__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--pd-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pd-filter input,
.pd-filter select {
  background: var(--pd-surface);
  border: 1px solid var(--pd-border);
  border-radius: 10px;
  padding: 0 14px;
  height: 44px;
  font: inherit;
  font-size: 14px;
  color: var(--pd-text);
  min-width: 190px;
}

.pd-filter input:focus,
.pd-filter select:focus {
  border-color: var(--pd-accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.pd-btn {
  border: none;
  border-radius: 10px;
  height: 44px;
  padding: 0 22px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.pd-btn--primary {
  background: var(--pd-accent);
  color: #ffffff;
}

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

/* ── Mensagens ────────────────────────────────────────────────────────────── */

.pd-message {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  border: 1px solid var(--pd-border);
  background: var(--pd-surface);
}

.pd-message--error {
  border-color: rgba(220, 38, 38, 0.35);
  background: #fef2f2;
  color: #b91c1c;
}

.hidden {
  display: none;
}

/* ── Painel/tabela ────────────────────────────────────────────────────────── */

.pd-panel {
  background: var(--pd-surface);
  border: 1px solid var(--pd-border);
  border-radius: 14px;
  overflow: hidden;
}

.pd-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--pd-border);
}

.pd-panel__header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.pd-panel__total {
  font-weight: 500;
  color: var(--pd-muted);
}

.pd-table-wrap {
  overflow-x: auto;
}

.pd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.pd-table th {
  text-align: left;
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--pd-muted);
  background: #fafafa;
  border-bottom: 1px solid var(--pd-border);
  white-space: nowrap;
}

.pd-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--pd-border);
  vertical-align: top;
}

.pd-table tr:last-child td {
  border-bottom: none;
}

.pd-table__who {
  font-weight: 600;
}

.pd-table__obs {
  color: var(--pd-muted);
  max-width: 240px;
}

.pd-empty {
  padding: 50px 20px;
  text-align: center;
  color: var(--pd-muted);
  font-size: 14px;
}

/* ── Status (badge/select) ────────────────────────────────────────────────── */
/* Correção estrutural anti-estouro: o mesmo componente serve span e select.
   line-height, altura mínima, box-sizing e nowrap garantem que "Pendente",
   "Desligado", "Falhou" e afins nunca rasguem a pílula, em qualquer tela. */

.pd-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--pd-border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  min-height: 26px;
  max-width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  cursor: pointer;
  background: #f3f4f6;
  color: var(--pd-text);
}

/* Select nativo: espaço extra à direita pra seta não cobrir o texto. */
select.pd-status {
  padding-right: 26px;
}

.pd-status--pendente {
  background: #fffbeb;
  color: #92400e;
  border-color: rgba(217, 119, 6, 0.35);
}

.pd-status--em_atendimento {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.3);
}

.pd-status--concluido {
  background: #ecfdf9;
  color: #0f766e;
  border-color: rgba(20, 184, 166, 0.35);
}

.pd-status--cancelado {
  background: #fef2f2;
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.3);
}

.pd-status--confirmada {
  background: #ecfdf9;
  color: #0f766e;
  border-color: rgba(20, 184, 166, 0.35);
}

.pd-status--neutro {
  background: #f3f4f6;
  color: var(--pd-muted);
  border-color: var(--pd-border);
}

/* ── Tabela de reservas: linha, ações e check-in ─────────────────────────── */

.pd-table__title {
  font-weight: 600;
}

.pd-table__series {
  display: block;
  font-size: 11px;
  color: var(--pd-muted);
  margin-top: 2px;
}

.pd-badge-checkin {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  min-height: 26px;
  max-width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
}

.pd-badge-checkin--feito {
  background: #ecfdf9;
  color: #0f766e;
}

.pd-badge-checkin--pendente {
  background: #f3f4f6;
  color: var(--pd-muted);
}

.pd-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pd-action-btn {
  border: 1px solid var(--pd-border);
  background: #ffffff;
  color: var(--pd-text);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.pd-action-btn:hover {
  background: var(--pd-bg);
}

.pd-action-btn--checkin {
  color: var(--pd-accent-dark);
  border-color: rgba(20, 184, 166, 0.35);
}

.pd-action-btn--checkin:hover {
  background: #ecfdf9;
}

.pd-action-btn--cancelar {
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.3);
}

.pd-action-btn--cancelar:hover {
  background: #fef2f2;
}

.pd-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Linha clicável (central de insumos) ─────────────────────────────────── */

.pd-row--clicavel {
  cursor: pointer;
}

.pd-row--clicavel:hover td {
  background: #f8fdfc;
}

.pd-row--clicavel:focus-visible {
  outline: 3px solid rgba(20, 184, 166, 0.5);
  outline-offset: -3px;
}

.pd-table__abrir {
  color: var(--pd-accent-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* ── Modal de detalhes (central de insumos) ──────────────────────────────── */

.pd-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.pd-overlay.hidden {
  display: none;
}

.pd-modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--pd-surface);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.pd-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.pd-modal__header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.pd-modal__meta {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--pd-muted);
}

.pd-modal__close {
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  color: var(--pd-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pd-modal__close:hover {
  background: var(--pd-bg);
  color: var(--pd-text);
}

.pd-detalhe {
  margin-top: 16px;
}

.pd-detalhe__linha {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--pd-border);
  font-size: 14px;
}

.pd-detalhe__linha:last-child {
  border-bottom: none;
}

.pd-detalhe__rotulo {
  color: var(--pd-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.pd-detalhe__valor {
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}

.pd-detalhe__valor a {
  color: var(--pd-accent-dark);
  font-weight: 700;
}

.pd-detalhe__id {
  font-size: 12px;
  background: var(--pd-bg);
  border: 1px solid var(--pd-border);
  border-radius: 6px;
  padding: 2px 6px;
}

.pd-detalhe__subtitulo {
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pd-muted);
}

.pd-detalhe__itens {
  display: grid;
  gap: 6px;
}

.pd-detalhe__item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--pd-bg);
  font-size: 14px;
}

/* ── Responsividade ───────────────────────────────────────────────────────── */

@media (max-width: 680px) {
  .pd-page {
    padding: 20px 14px 40px;
  }

  .pd-header h1 {
    font-size: 26px;
  }

  .pd-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .pd-filter input,
  .pd-filter select {
    width: 100%;
  }

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