:root {
  --primary-color: #0039ba;
  --success-color: #03bd50;
  --warning-color: #f59e0b;
  --danger-color: #c80028;
  --bg-light: #f8fafc;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.08);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-light);
  margin: 0;
  padding: 0;
}

/* Header Compacto */
.kanban-header {
  background: white;
  border-bottom: 2px solid #849ab89f;
  padding: 0.75rem 0;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
  sticky: top;
  z-index: 100;
}

/* Metrics Cards - Mais Compactos */
.metrics-card {
  background: linear-gradient(135deg, var(--primary-color), #6366f1);
  color: white;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  height: auto;
  min-height: 65px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid #ffffff;
  border-bottom: 4px solid #9bacc0af;
  
}

.metrics-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(79, 70, 229, 0.25);
}

.metrics-card.success {
  background: linear-gradient(135deg, var(--success-color), #34d399);
}

.metrics-card.warning {
  background: linear-gradient(135deg, var(--warning-color), #fbbf24);
}

.metrics-card.danger {
  background: linear-gradient(135deg, var(--danger-color), #f87171);
}

.metrics-number {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  line-height: 1;
}

.metrics-label {
  font-size: 0.75rem;
  opacity: 0.95;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.25rem;
  line-height: 1;
}

/* Filtros - Formato Horizontal Compacto */
.filters-container {
  background: white;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
  border-bottom: 2px solid #849ab89f;
}

.filter-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  margin-right: 0.5rem;
  white-space: nowrap;
}

.btn-filter {
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-weight: 500;
  font-size: 0.8rem;
  transition: all 0.2s;
  border: 1px solid var(--border-color);
  background: white;
  cursor: pointer;
  white-space: nowrap;
}

.btn-filter:hover {
  border-color: var(--primary-color);
  background: #f8fafc;
}

.btn-filter.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

/* Kanban Board - Otimizado */
.kanban-board {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.5rem;
  margin-bottom: 1rem;
  height: calc(100vh - 280px);
  min-height: 500px;
}

.kanban-column {
  background: white;
  border-radius: 8px;
  min-width: 300px;
  max-width: 300px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #849ab86b;
  
  display: flex;
  flex-direction: column;
  height: 100%;
}

.column-header {
  padding: 0.75rem 1rem;
  border-bottom: 2px solid #849ab8bb;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
  border-radius: 8px 8px 0 0;
}

.column-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.column-count {
  background: var(--primary-color);
  color: white;
  border-radius: 12px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

.column-body {
  padding: 0.75rem;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
}

/* Cards - Mais Compactos */
.ordem-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.ordem-card:last-child {
  margin-bottom: 0.7rem;
}

.ordem-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.ordem-card.atrasada {
  border-left: 4px solid var(--danger-color);
  background: #faf2f2;
}

.ordem-card.urgente {
  border-left: 4px solid var(--warning-color);
  background: #fffbeb;
}

.card-header-info {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.ordem-id {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.2;
}

.priority-badge {
  font-size: 0.65rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}

.badge-atrasada {
  background: var(--danger-color);
  color: white;
}

.badge-urgente {
  background: var(--warning-color);
  color: white;
}

.card-client {
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  line-height: 1.3;
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: #64748b;
}

.card-info-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1.3;
}

.card-footer {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: #94a3b8;
}

.data-entrega {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.75rem;
}

.data-entrega.atrasada {
  color: var(--danger-color);
}

.data-entrega.urgente {
  color: var(--warning-color);
}

/* Empty State */
.empty-column {
  text-align: center;
  padding: 2rem 1rem;
  color: #94a3b8;
}

.empty-column i {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.3;
}

.empty-column p {
  font-size: 0.85rem;
  margin: 0;
}

/* Loading */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.spinner-border {
  width: 2.5rem;
  height: 2.5rem;
  border-width: 0.25rem;
}

/* Scrollbar Personalizado */
.kanban-board::-webkit-scrollbar,
.column-body::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.kanban-board::-webkit-scrollbar-track,
.column-body::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

.kanban-board::-webkit-scrollbar-thumb,
.column-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.kanban-board::-webkit-scrollbar-thumb:hover,
.column-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ordem-card {
  animation: fadeIn 0.25s ease-out;
}

/* === RESPONSIVIDADE === */

/* Tablets e telas médias (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
  .kanban-board {
    height: calc(100vh - 260px);
  }
  
  .kanban-column {
    min-width: 280px;
    max-width: 280px;
  }
  
  .metrics-number {
    font-size: 1.3rem;
  }
}

/* Tablets pequenos e smartphones landscape (577px - 768px) */
@media (max-width: 768px) and (min-width: 577px) {
  .kanban-header {
    padding: 0.5rem 0;
  }
  
  .metrics-card {
    min-height: 55px;
    padding: 0.6rem 0.75rem;
  }
  
  .metrics-number {
    font-size: 1.2rem;
  }
  
  .metrics-label {
    font-size: 0.7rem;
  }
  
  .filters-container {
    padding: 0.6rem 0.75rem;
  }
  
  .filter-group {
    gap: 0.4rem;
  }
  
  .btn-filter {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
  }
  
  .kanban-board {
    height: calc(100vh - 240px);
    gap: 0.6rem;
  }
  
  .kanban-column {
    min-width: 260px;
    max-width: 260px;
  }
}

/* Smartphones portrait (até 576px) */
@media (max-width: 576px) {
  .kanban-header {
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
  }
  
  .metrics-card {
    min-height: 50px;
    padding: 0.5rem;
  }
  
  .metrics-number {
    font-size: 1.1rem;
  }
  
  .metrics-label {
    font-size: 0.65rem;
  }
  
  .filters-container {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
  }
  
  .filter-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
  }
  
  .filter-group label {
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
  }
  
  .btn-filter {
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
  }
  
  .kanban-board {
    flex-direction: column;
    height: auto;
    gap: 0.75rem;
    padding: 0.5rem;
  }
  
  .kanban-column {
    min-width: 100%;
    max-width: 100%;
    max-height: 450px;
  }
  
  .column-header {
    padding: 0.6rem 0.75rem;
  }
  
  .column-title {
    font-size: 0.85rem;
  }
  
  .column-body {
    padding: 0.6rem;
    max-height: 400px;
  }
  
  .ordem-card {
    padding: 0.6rem;
    margin-bottom: 0.6rem;
  }
  
  .ordem-id {
    font-size: 0.9rem;
  }
  
  .card-client {
    font-size: 0.8rem;
  }
  
  .card-info {
    font-size: 0.75rem;
  }
  
  .card-footer {
    font-size: 0.65rem;
  }
}

/* Smartphones muito pequenos (até 375px) */
@media (max-width: 375px) {
  .metrics-number {
    font-size: 1rem;
  }
  
  .metrics-label {
    font-size: 0.6rem;
  }
  
  .btn-filter {
    padding: 0.25rem 0.5rem;
    font-size: 0.65rem;
  }
  
  .column-body {
    max-height: 350px;
  }
  
  .ordem-card {
    padding: 0.5rem;
  }
}

/* Telas grandes (acima de 1400px) */
@media (min-width: 1400px) {
  .kanban-column {
    min-width: 340px;
    max-width: 340px;
  }
  
  .kanban-board {
    height: calc(100vh - 260px);
  }
}

/* Modo paisagem para smartphones */
@media (max-height: 600px) and (orientation: landscape) {
  .kanban-board {
    height: calc(100vh - 180px);
  }
  
  .metrics-card {
    min-height: 45px;
  }
  
  .filters-container {
    padding: 0.4rem 0.75rem;
  }
}