* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f6fb;
  color: #1f2937;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 36px 12px 36px;
}

main {
  padding: 0 36px 36px 36px;
}

.logo {
  height: 72px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
  margin: 10px 0 24px 0;
}

.kpi-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  border: 1px solid #e5e7eb;
}

.kpi-title {
  display: block;
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 8px;
}

.kpi-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: #111827;
}

.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.search-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-container input[type="text"] {
  width: 360px;
  max-width: 100%;
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  outline: none;
}

.search-container input[type="text"]:focus,
.filter-popup input[type="date"]:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.filter-btn,
.btn-buscar {
  border: none;
  background: #e5e7eb;
  color: #111827;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
}

.filter-btn:hover,
.btn-buscar:hover {
  background: #d1d5db;
}

.filter-popup {
  position: absolute;
  top: 52px;
  left: 0;
  width: 280px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
  padding: 14px;
  z-index: 20;
}

.hidden {
  display: none;
}

.date-filter-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.date-filter-group label {
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 6px;
}

.date-filter-group input[type="date"] {
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  outline: none;
}

.actions-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: #111827;
  color: #fff;
}

.btn-secondary:hover {
  background: #000000;
}

.btn-info {
  background: #0ea5e9;
  color: #fff;
}

.btn-info:hover {
  background: #0284c7;
}

.tabela-pedidos {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  border: 1px solid #e5e7eb;
}

.tabela-pedidos thead {
  background: #f9fafb;
}

.tabela-pedidos th,
.tabela-pedidos td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
  vertical-align: middle;
}

.tabela-pedidos th {
  color: #374151;
  font-weight: 700;
  white-space: nowrap;
}

.tabela-pedidos tbody tr:hover {
  background: #f9fbff;
}

.status-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-sucesso {
  background: #dcfce7;
  color: #166534;
}

.status-warning {
  background: #fef3c7;
  color: #92400e;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  min-width: 280px;
  max-width: 460px;
  background: #111827;
  color: #fff;
  padding: 14px 16px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 9999;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: #166534;
}

.toast-error {
  background: #b91c1c;
}

.toast-info {
  background: #1f2937;
}

@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 768px) {
  header,
  main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .actions-buttons {
    width: 100%;
  }

  .actions-buttons .btn {
    width: 100%;
  }

  .search-container {
    width: 100%;
  }

  .search-container input[type="text"] {
    width: 100%;
  }

  .tabela-pedidos {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}