/* =========================================================
   VIVEIRO EMRA - EXECUTIVE DESIGN SYSTEM
   ========================================================= */

:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  --bg-app: #f8fafc;
  --surface-card: #ffffff;
  --surface-border: #e2e8f0;
  --surface-border-subtle: #f1f5f9;
  
  --primary-navy: #0f172a;
  --secondary-navy: #1e293b;
  --brand-blue: #2563eb;
  --brand-blue-hover: #1d4ed8;
  --brand-cyan: #0ea5e9;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --status-confirmada-bg: #fff7ed;
  --status-confirmada-text: #c2410c;
  --status-confirmada-border: #fed7aa;

  --status-pre-bg: #f0f9ff;
  --status-pre-text: #0369a1;
  --status-pre-border: #bae6fd;

  --status-entregue-bg: #f0fdf4;
  --status-entregue-text: #15803d;
  --status-entregue-border: #bbf7d0;

  --status-cancelado-bg: #fef2f2;
  --status-cancelado-text: #b91c1c;
  --status-cancelado-border: #fecaca;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.12), 0 4px 6px -2px rgba(15, 23, 42, 0.03);
  --shadow-modal: 0 24px 48px -12px rgba(15, 23, 42, 0.25);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  padding: 16px;
  min-height: 100vh;
}

/* =========================================================
   TELA DE LOGIN
   ========================================================= */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 32px);
  background: radial-gradient(circle at 50% 20%, #1e293b 0%, #0f172a 100%);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.login-glass-card {
  background: #ffffff;
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-brand-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  padding: 36px 24px 28px;
  text-align: center;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
  margin-bottom: 16px;
}

.login-logo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.login-brand-header h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.login-subtitle {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 4px;
}

.login-form {
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  opacity: 0.6;
}

.input-icon-wrapper input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  background-color: #f8fafc;
}

.input-icon-wrapper input:focus {
  border-color: var(--brand-blue);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.alert-box-danger {
  background-color: var(--status-cancelado-bg);
  border: 1px solid var(--status-cancelado-border);
  color: var(--status-cancelado-text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
}

/* =========================================================
   TOPBAR
   ========================================================= */
.app-container {
  max-width: 1780px;
  margin: 0 auto;
}

.app-topbar {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 14px 24px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-logo-box {
  width: 50px;
  height: 50px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.topbar-titles h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
}

.topbar-titles p {
  font-size: 12px;
  color: #94a3b8;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-alert-glow {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #ffffff;
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 10px rgba(234, 88, 12, 0.35);
  font-weight: 700;
}

.btn-alert-glow:hover {
  transform: translateY(-1px);
}

.selector-card-year {
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
}

.year-label {
  font-size: 11.5px;
  color: #cbd5e1;
  font-weight: 600;
}

.select-year-clean {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-size: 13px;
  font-weight: 800;
  outline: none;
  cursor: pointer;
}

.select-year-clean option {
  background-color: #0f172a;
  color: #ffffff;
}

.user-profile-badge {
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #f1f5f9;
}

.user-avatar-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.btn-logout-icon {
  background-color: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.btn-logout-icon:hover {
  background-color: #ef4444;
  color: #ffffff;
}

/* =========================================================
   NAVEGAÇÃO POR SEGMENTOS
   ========================================================= */
.segmented-navigation-bar {
  background-color: #0f172a;
  padding: 0 24px;
  border-bottom: 1px solid #334155;
}

.nav-pills-group {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-pills-group .nav-pill-btn { white-space: nowrap; }

.nav-divider {
  width: 1px;
  height: 22px;
  background-color: #334155;
  margin: 0 8px;
  flex-shrink: 0;
}

.nav-pill-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 14px 20px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  position: relative;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}

.nav-pill-btn:hover {
  color: #ffffff;
}

.nav-pill-btn.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
  background-color: rgba(255, 255, 255, 0.03);
}

.pill-counter {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
}

.nav-pill-btn.active .pill-counter {
  background-color: #38bdf8;
  color: #0f172a;
}

/* =========================================================
   CARDS EXECUTIVOS (KPIs)
   ========================================================= */
.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 14px;
  margin-bottom: 14px;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.kpi-icon-box {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.kpi-orange .kpi-icon-box { background-color: #fff7ed; color: #ea580c; border: 1px solid #ffedd5; }
.kpi-blue .kpi-icon-box { background-color: #eff6ff; color: #2563eb; border: 1px solid #dbeafe; }
.kpi-green .kpi-icon-box { background-color: #f0fdf4; color: #16a34a; border: 1px solid #dcfce7; }

.kpi-data {
  display: flex;
  flex-direction: column;
}

.kpi-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.kpi-number {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* =========================================================
   FILTRO DE DATAS E FERRAMENTAS
   ========================================================= */
.main-content-layout {
  background-color: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 18px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.surface-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
  background-color: #ffffff;
  overflow: hidden;
}

.surface-toolbar {
  padding: 14px 18px;
  background-color: #fbfcfd;
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-actions-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Filtro por Período */
.date-filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background-color: #ffffff;
  padding: 4px 10px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
}

.filter-label {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 700;
}

.date-input-sm {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 12px;
  outline: none;
}

.btn-ghost-sm {
  background: transparent;
  border: none;
  color: var(--brand-blue);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.btn-ghost-sm:hover {
  text-decoration: underline;
}

.section-badge-muted {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  background-color: var(--surface-border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
}

.toolbar-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-lens {
  position: absolute;
  left: 12px;
  font-size: 13px;
  opacity: 0.5;
}

.search-input-elegant {
  padding: 8px 14px 8px 36px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 280px;
  outline: none;
  background-color: #ffffff;
  transition: all 0.2s;
}

.search-input-elegant:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  width: 320px;
}

/* =========================================================
   TABELA EXECUTIVA
   ========================================================= */
.table-scroller {
  width: 100%;
  overflow-x: auto;
}

.premium-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1780px;
  font-size: 12px;
}

.premium-table thead th {
  background-color: #f8fafc;
  color: var(--text-secondary);
  padding: 10px 8px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--surface-border);
  text-align: center;
  white-space: nowrap;
}

.premium-table tbody tr {
  background-color: #ffffff;
  border-bottom: 1px solid var(--surface-border-subtle);
  transition: background-color 0.15s ease;
}

.premium-table tbody tr:nth-child(even) {
  background-color: #fafbfc;
}

.premium-table tbody tr:hover {
  background-color: #f1f5f9;
}

.premium-table tbody td {
  padding: 8px 6px;
  text-align: center;
  vertical-align: middle;
  color: var(--text-primary);
  white-space: nowrap;
}

.th-actions {
  width: 180px;
  min-width: 180px;
}

.cell-produtos-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.badge-item-produto {
  background: #ffffff;
  border: 1px solid var(--surface-border);
  border-left: 3px solid var(--brand-blue);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
}

.badge-confirmada { background-color: var(--status-confirmada-bg); color: var(--status-confirmada-text); border-color: var(--status-confirmada-border); }
.badge-preconfirmada { background-color: var(--status-pre-bg); color: var(--status-pre-text); border-color: var(--status-pre-border); }
.badge-entregue { background-color: var(--status-entregue-bg); color: var(--status-entregue-text); border-color: var(--status-entregue-border); }
.badge-cancelado { background-color: var(--status-cancelado-bg); color: var(--status-cancelado-text); border-color: var(--status-cancelado-border); }
.badge-disponivel { background-color: var(--status-entregue-bg); color: var(--status-entregue-text); border-color: var(--status-entregue-border); }
.badge-manutencao { background-color: #fefce8; color: #a16207; border-color: #fef08a; }
.badge-indisponivel { background-color: var(--status-cancelado-bg); color: var(--status-cancelado-text); border-color: var(--status-cancelado-border); }

/* Botões de Ação na Tabela */
.row-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.btn-action-highlight {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn-action-highlight:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.action-whats { background-color: #25d366; border: 1px solid #1ebe5d; color: #ffffff; }
.action-whats:hover { background-color: #1ebe5d; }
.action-print { background-color: #0284c7; border: 1px solid #0369a1; color: #ffffff; }
.action-print:hover { background-color: #0369a1; }
.action-edit { background-color: #f59e0b; border: 1px solid #d97706; color: #ffffff; }
.action-edit:hover { background-color: #d97706; }
.action-del { background-color: #ef4444; border: 1px solid #dc2626; color: #ffffff; }
.action-del:hover { background-color: #dc2626; }

/* =========================================================
   MONITOR DE CAPACIDADE DO CAMINHÃO
   ========================================================= */
.capacity-meter-card {
  background-color: #f8fafc;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.capacity-meter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.capacity-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.capacity-stat {
  font-size: 13px;
  font-weight: 900;
}

.capacity-progress-track {
  width: 100%;
  height: 8px;
  background-color: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.capacity-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.capacity-detail-text {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* =========================================================
   PAGINAÇÃO
   ========================================================= */
.pagination-footer-bar {
  padding: 12px 20px;
  background-color: #fbfcfd;
  border-top: 1px solid var(--surface-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.pagination-page-size {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select-clean-sm {
  padding: 4px 8px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 12.5px;
  background-color: #ffffff;
}

.pagination-count-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 6px;
}

.pagination-action-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pagination-page-display {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 12.5px;
}

/* =========================================================
   BOTÕES GERAIS
   ========================================================= */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  padding: 8px 16px;
  font-size: 13px;
}

.btn-primary-gradient {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-primary-gradient:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-outline-sm {
  background: #ffffff;
  border: 1px solid var(--surface-border);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 12px;
}

.btn-outline-sm:hover:not(:disabled) {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.btn-outline-sm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

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

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

.btn-danger-solid {
  background-color: #ef4444;
  color: #ffffff;
}

.btn-danger-solid:hover {
  background-color: #dc2626;
}

.btn-whatsapp-gradient {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp-gradient:hover {
  background: linear-gradient(135deg, #1ebe5d 0%, #075e54 100%);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  transform: translateY(-1px);
}

/* =========================================================
   MODAIS
   ========================================================= */
.modal-backdrop-blur {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-backdrop-blur.active {
  display: flex;
}

.modal-dialog-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  border: 1px solid rgba(255, 255, 255, 0.8);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-dialog-card.modal-md { max-width: 620px; }
.modal-dialog-card.modal-lg { max-width: 800px; }
.modal-dialog-card.modal-sm { max-width: 480px; }

.modal-dialog-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background-color: #fbfcfd;
}

.modal-category-tag {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--brand-blue);
  display: block;
  margin-bottom: 2px;
}

.modal-header-text h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-close-round {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.modal-close-round:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.modal-dialog-body {
  padding: 24px;
}

.form-grid-layout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.form-grid-layout.two-cols {
  grid-template-columns: repeat(2, 1fr);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

.form-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: 8px 12px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  outline: none;
  background-color: #ffffff;
  transition: all 0.2s;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.modal-dialog-footer {
  padding: 16px 24px;
  background-color: #fbfcfd;
  border-top: 1px solid var(--surface-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Itens Dinâmicos */
.items-builder-surface {
  background-color: #f8fafc;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.items-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.section-title-clean {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}

.section-subtitle-clean {
  font-size: 11.5px;
  color: var(--text-muted);
}

.items-dynamic-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-produto-linha {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #ffffff;
  padding: 8px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
}

.item-produto-linha input {
  padding: 6px 10px;
}

.item-produto-linha .input-hibrido { flex: 2; }
.item-produto-linha .input-qtde { flex: 1; }

.btn-remove-item {
  background-color: var(--status-cancelado-bg);
  color: var(--status-cancelado-text);
  border: 1px solid var(--status-cancelado-border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 700;
}

.btn-remove-item:hover {
  background-color: #fee2e2;
}

/* Dashboard Modal */
.dashboard-accent-header {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  color: #ffffff;
}

.dashboard-accent-header .modal-category-tag { color: #ffedd5; }
.dashboard-accent-header h3 { color: #ffffff; }

.white-close {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border: none;
}

.white-close:hover {
  background: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

.dashboard-hero-counter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1px solid #fed7aa;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.today-date-text { font-size: 14px; font-weight: 800; color: #9a3412; }
.today-helper-text { font-size: 12px; color: #c2410c; }
.counter-bubble {
  background-color: #ea580c;
  color: #ffffff;
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 13px;
}

.max-h-320 { max-height: 320px; }
.clean-theme thead th { background-color: #f1f5f9; }

/* Modal WhatsApp */
.whatsapp-accent-header {
  background: linear-gradient(135deg, #128c7e 0%, #075e54 100%);
  color: #ffffff;
}

.tag-whatsapp { color: #bbf7d0; }
.whatsapp-accent-header h3 { color: #ffffff; }

.whatsapp-recipient-selector {
  margin-bottom: 14px;
}

.recipient-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.recipient-chips {
  display: flex;
  gap: 8px;
}

.btn-chip {
  background: #f1f5f9;
  border: 1px solid var(--surface-border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-chip:hover {
  background-color: #e2e8f0;
}

.btn-chip.active {
  background-color: #128c7e;
  border-color: #075e54;
  color: #ffffff;
}

.whatsapp-phone-field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.whatsapp-phone-field label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.whatsapp-preview-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.whatsapp-preview-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.btn-copy-chip {
  background: #f1f5f9;
  border: 1px solid var(--surface-border);
  color: var(--brand-blue);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.whatsapp-preview-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background-color: #f8fafc;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-primary);
  outline: none;
  resize: vertical;
  font-family: monospace, var(--font-family);
}

/* Modal Exclusão Danger */
.modal-danger-border { border-top: 5px solid #ef4444; }
.tag-danger { color: #ef4444; }
.danger-preview-card {
  background-color: #f8fafc;
  border: 1px solid var(--surface-border);
  border-left: 4px solid #ef4444;
  padding: 12px;
  border-radius: var(--radius-sm);
  margin: 14px 0;
  font-size: 13px;
}

.irreversible-warning-note {
  font-size: 12px;
  font-weight: 700;
  color: #ef4444;
  text-align: center;
}

.empty-state-card {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 36px; margin-bottom: 8px; }
.empty-state-card h4 { font-size: 15px; color: var(--text-secondary); font-weight: 700; }
.empty-state-card p { font-size: 13px; margin-top: 4px; }

/* =========================================================
   V2: TOPBAR, CADASTROS, USUÁRIOS E RELATÓRIOS
   ========================================================= */
.btn-ghost-topbar {
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.btn-ghost-topbar:hover { background-color: rgba(255, 255, 255, 0.16); }

.btn:focus-visible,
.nav-pill-btn:focus-visible,
.btn-action-highlight:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

.badge-ativo { background-color: var(--status-entregue-bg); color: var(--status-entregue-text); border-color: var(--status-entregue-border); }
.badge-inativo { background-color: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.badge-admin { background-color: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-operador { background-color: #f8fafc; color: #475569; border-color: #e2e8f0; }

.cnh-vencida { color: #b91c1c; font-weight: 800; }
.cnh-vencendo { color: #a16207; font-weight: 800; }

.checkbox-line {
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-line input { width: 16px; height: 16px; }

.text-muted-sm { font-size: 11.5px; color: var(--text-muted); }

/* Relatório de viagens */
.report-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
}

.report-summary {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--surface-border);
}

.report-summary-item {
  flex: 1 1 160px;
  padding: 14px 18px;
  border-right: 1px solid var(--surface-border-subtle);
}

.report-summary-item:last-child { border-right: none; }

.report-summary-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-navy);
  line-height: 1.2;
}

.report-summary-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.premium-table.table-compact { min-width: 900px; }
.premium-table.report-table { min-width: 820px; }
.report-table td.num { font-variant-numeric: tabular-nums; }

.trip-count {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.trip-count strong { font-size: 15px; min-width: 24px; text-align: right; }

.trip-bar-track {
  width: 90px;
  height: 8px;
  background-color: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
}

.trip-bar-fill {
  height: 100%;
  background-color: var(--brand-blue);
  border-radius: 4px;
}

.linha-sem-motorista td:first-child strong { color: #b45309; }

.report-detail-row > td {
  background-color: #f8fafc !important;
  padding: 0 !important;
}

.report-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.premium-table .report-detail-table th {
  background-color: transparent;
  text-transform: none;
  letter-spacing: 0;
  text-align: left;
  padding: 8px 14px;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  border-bottom: 1px solid var(--surface-border);
}

.premium-table .report-detail-table td {
  padding: 7px 14px;
  border-bottom: 1px solid var(--surface-border-subtle);
  vertical-align: top;
  text-align: left;
  white-space: normal;
}

.premium-table .report-detail-table td.num { text-align: right; white-space: nowrap; }
.premium-table .report-detail-table tr { background-color: transparent; }

.report-footnote {
  padding: 12px 18px;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--surface-border);
  background-color: #fbfcfd;
}

.tag-inferido {
  font-size: 10.5px;
  color: #a16207;
  background: #fefce8;
  border: 1px solid #fef08a;
  border-radius: 4px;
  padding: 0 5px;
  margin-left: 4px;
  white-space: nowrap;
}

/* =========================================================
   V3: LAYOUT COMPACTO E PROFISSIONAL
   (sobrepõe os tamanhos anteriores para aproveitar melhor a tela)
   ========================================================= */
body { padding: 10px; }

/* Topo */
.app-topbar { padding: 10px 18px; gap: 12px; }
.topbar-logo-box { width: 40px; height: 40px; }
.topbar-brand { gap: 12px; }
.topbar-titles h1 { font-size: 16px; line-height: 1.2; }
.topbar-titles p { font-size: 11px; }
.topbar-actions { gap: 8px; }
.btn-alert-glow { padding: 6px 12px; font-size: 12px; box-shadow: none; }
.selector-card-year, .user-profile-badge { padding: 4px 10px; font-size: 12px; }
.btn-ghost-topbar, .btn-logout-icon { padding: 5px 10px; font-size: 12px; }

/* Abas: sempre em uma linha, sem quebrar o texto */
.segmented-navigation-bar { padding: 0 12px; border-radius: 0 0 var(--radius-md) var(--radius-md); }
.nav-pill-btn { padding: 10px 12px; font-size: 12.5px; gap: 7px; white-space: nowrap; }
.pill-counter { padding: 1px 7px; font-size: 10.5px; }

/* Indicadores */
.kpi-cards-grid { gap: 10px; margin: 10px 0; }
.kpi-card { padding: 10px 14px; gap: 12px; box-shadow: none; }
.kpi-icon-box { width: 38px; height: 38px; font-size: 18px; border-radius: var(--radius-sm); }
.kpi-title { font-size: 10.5px; }
.kpi-number { font-size: 17px; }
.kpi-desc { font-size: 11px; }

/* Área principal: um único cartão, sem moldura dupla */
.main-content-layout {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-top: 10px;
}
.surface-card { box-shadow: var(--shadow-sm); }
.surface-toolbar { padding: 10px 14px; gap: 10px; }
.btn { padding: 7px 14px; font-size: 12.5px; }
.btn-outline-sm { padding: 5px 10px; font-size: 12px; }
.search-input-elegant { padding: 6px 12px 6px 32px; font-size: 12.5px; width: 260px; }
.search-lens { left: 10px; font-size: 12px; }
.section-badge-muted { padding: 5px 10px; font-size: 12px; }
.date-filter-group { padding: 3px 8px; gap: 6px; }
.date-input-sm, .select-clean-sm { padding: 3px 6px; font-size: 12px; height: 28px; }

/* Tabelas */
.premium-table thead th {
  padding: 8px 10px;
  font-size: 10.5px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.premium-table tbody td { padding: 6px 10px; font-size: 12.5px; }
.btn-action-highlight { width: 28px; height: 28px; font-size: 12px; box-shadow: none; }
.row-actions { gap: 4px; }
.badge { padding: 2px 9px; font-size: 10.5px; }

/* Cadastros e relatório: alinhados à esquerda, largura natural */
.premium-table.table-compact,
.premium-table.report-table { min-width: 760px; }
.table-compact thead th,
.table-compact tbody td,
.report-table > thead > tr > th,
.report-table > tbody > tr > td { text-align: left; }
.table-compact .th-actions,
.report-table .th-actions { text-align: right; width: 1%; }
.table-compact .row-actions { justify-content: flex-end; }
.table-compact tbody td:first-child,
.table-compact thead th:first-child,
.report-table > tbody > tr > td:first-child,
.report-table > thead > tr > th:first-child { padding-left: 16px; }
.table-compact tbody td:last-child,
.table-compact thead th:last-child,
.report-table > thead > tr > th:last-child,
.report-table > tbody > tr > td:last-child { padding-right: 16px; text-align: right; }
.table-compact td .text-muted-sm { margin-left: 4px; }

.report-table > thead > tr > th:nth-child(2),
.report-table > thead > tr > th:nth-child(3),
.report-table > thead > tr > th:nth-child(4),
.report-table > thead > tr > th:nth-child(5),
.report-table > tbody > tr > td.num { text-align: right; }
.trip-count { justify-content: flex-end; }
.trip-bar-track { width: 70px; height: 6px; }
.trip-count strong { font-size: 13px; }

/* Relatório */
.report-title { font-size: 14px; }
.report-summary { background-color: #ffffff; }
.report-summary-item { flex: 1 1 130px; padding: 8px 16px; }
.report-summary-value { font-size: 17px; }
.report-summary-label { font-size: 11px; }
.report-footnote { padding: 8px 16px; font-size: 11px; }
.report-detail-row .btn { padding: 4px 10px; }
.premium-table .report-detail-table th { padding: 6px 16px; font-size: 10.5px; }
.premium-table .report-detail-table td { padding: 5px 16px; font-size: 12px; }

/* Estado vazio mais baixo */
.empty-state-card { padding: 24px 16px; }
.empty-state-icon { font-size: 28px; margin-bottom: 4px; }

/* Modais */
.modal-dialog-body { padding: 18px 20px; }
.form-grid-layout { gap: 10px 12px; }
.form-field { gap: 4px; }
.form-field label { font-size: 11.5px; }
.form-field input,
.form-field select,
.form-field textarea { padding: 7px 10px; font-size: 13px; }

@media (max-width: 1024px) {
  .kpi-cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-topbar { flex-direction: column; align-items: flex-start; }
  .form-grid-layout, .form-grid-layout.two-cols { grid-template-columns: 1fr; }
  .search-input-elegant { width: 100%; }
  .item-produto-linha { flex-direction: column; align-items: stretch; }
  .date-filter-group { width: 100%; justify-content: space-between; }
}