/* ==========================================================================
   OrderFlow — Gestão de Pedidos (Design System & Styles)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS VARIABLES & THEMES
   -------------------------------------------------------------------------- */
:root[data-theme="dark"] {
  --bg-main: #0b0f19;
  --bg-card: rgba(21, 28, 44, 0.78);
  --bg-card-hover: rgba(28, 38, 60, 0.88);
  --bg-card-header: rgba(25, 34, 54, 0.85);
  --bg-input: rgba(16, 22, 37, 0.75);
  --bg-modal: rgba(21, 28, 46, 0.92);
  --bg-modal-overlay: rgba(5, 8, 15, 0.75);
  
  --border-color: rgba(255, 255, 255, 0.12);
  --border-color-hover: rgba(255, 255, 255, 0.25);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-light: rgba(79, 70, 229, 0.2);
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: rgba(239, 68, 68, 0.15);
  
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.15);
  
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(79, 70, 229, 0.25);
  
  --blur-bg: blur(16px);
  --table-stripe: rgba(255, 255, 255, 0.02);
  --table-hover: rgba(255, 255, 255, 0.06);
}

:root[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(241, 245, 249, 0.92);
  --bg-card-header: rgba(248, 250, 252, 0.9);
  --bg-input: rgba(241, 245, 249, 0.8);
  --bg-modal: rgba(255, 255, 255, 0.94);
  --bg-modal-overlay: rgba(15, 23, 42, 0.5);
  
  --border-color: rgba(226, 232, 240, 0.8);
  --border-color-hover: #cbd5e1;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-light: rgba(79, 70, 229, 0.08);
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: rgba(239, 68, 68, 0.1);
  
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.1);
  
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.1);
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.15);
  
  --blur-bg: blur(8px);
  --table-stripe: #f8fafc;
  --table-hover: #f1f5f9;
}

/* --------------------------------------------------------------------------
   2. BASE & RESET
   -------------------------------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Background Golden Retriever Image */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: url('golden_retriever.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  filter: brightness(0.7) contrast(1.1);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

:root[data-theme="light"] body::before {
  opacity: 0.22;
  filter: brightness(1.05) contrast(0.95);
}

/* Decorative Glow Backgrounds */
.bg-blur {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
}

.bg-blur-1 {
  width: 500px;
  height: 500px;
  background: #6366f1;
  top: -100px;
  left: -100px;
}

.bg-blur-2 {
  width: 450px;
  height: 450px;
  background: #ec4899;
  bottom: -100px;
  right: -100px;
}

/* Hidden Utility */
.hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   3. HEADER
   -------------------------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-modal-overlay);
  backdrop-filter: var(--blur-bg);
  -webkit-backdrop-filter: var(--blur-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.5rem;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Connection Status Badge */
.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: 9999px;
  background: var(--success-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* --------------------------------------------------------------------------
   4. BUTTONS & CONTROLS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca, #3730a3);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

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

/* Theme Icon Display */
:root[data-theme="dark"] .sun-icon { display: block; }
:root[data-theme="dark"] .moon-icon { display: none; }
:root[data-theme="light"] .sun-icon { display: none; }
:root[data-theme="light"] .moon-icon { display: block; }

/* --------------------------------------------------------------------------
   5. MAIN LAYOUT
   -------------------------------------------------------------------------- */
.app-main {
  position: relative;
  z-index: 1;
  padding: 1.5rem 1.5rem 4rem;
}

.main-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* --------------------------------------------------------------------------
   6. METRICS & KPI SECTION
   -------------------------------------------------------------------------- */
.kpi-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-bg);
  -webkit-backdrop-filter: var(--blur-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-md);
}

.kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.kpi-green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.kpi-purple { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.kpi-amber { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

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

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 0.1rem 0;
}

.kpi-trend {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   7. TOOLBAR & FILTERS
   -------------------------------------------------------------------------- */
.toolbar-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-card);
  backdrop-filter: var(--blur-bg);
  -webkit-backdrop-filter: var(--blur-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.search-box {
  position: relative;
  flex: 1 1 300px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 0.65rem 2.2rem 0.65rem 2.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
}

.search-box input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.btn-clear {
  position: absolute;
  right: 0.6rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
}

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

.filters-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

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

.select-icon {
  position: absolute;
  left: 0.8rem;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.select-wrapper select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0.65rem 2.2rem 0.65rem 2.3rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  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='%3A9ca3af' stroke-width='2' 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 0.7rem center;
}

.select-wrapper select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.view-toggle {
  display: inline-flex;
  background: var(--bg-input);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.toggle-btn {
  background: none;
  border: none;
  padding: 0.45rem 0.75rem;
  border-radius: 7px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background: var(--bg-card);
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

/* Rotating Refresh Animation */
.spinning {
  animation: spin 1s linear infinite;
}

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

/* --------------------------------------------------------------------------
   8. ACTIVE FILTERS TAG BAR
   -------------------------------------------------------------------------- */
.active-filters-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: 10px;
}

.active-filters-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.active-tags-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  background: var(--accent-light);
  color: var(--accent-primary);
  font-size: 0.75rem;
  font-weight: 600;
}

.filter-tag button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
}

/* --------------------------------------------------------------------------
   9. RESULTS AREA & STATES (LOADING, EMPTY, ERROR)
   -------------------------------------------------------------------------- */
.results-section {
  min-height: 400px;
}

.state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  background: var(--bg-card);
  backdrop-filter: var(--blur-bg);
  -webkit-backdrop-filter: var(--blur-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
}

.spinner-large {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s infinite linear;
  margin-bottom: 1.25rem;
}

.state-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-input);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.state-icon svg {
  width: 32px;
  height: 32px;
}

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

.state-container h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.state-container p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 400px;
  margin-bottom: 1.5rem;
}

/* --------------------------------------------------------------------------
   10. CARDS GRID VIEW
   -------------------------------------------------------------------------- */
.orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.order-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-bg);
  -webkit-backdrop-filter: var(--blur-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.order-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-md);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Badges System */
.badge-setor {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Custom Setor Colors */
.setor-pet-shop { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.setor-oficina { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.setor-confeitaria { background: rgba(236, 72, 153, 0.15); color: #ec4899; border: 1px solid rgba(236, 72, 153, 0.3); }
.setor-salao { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; border: 1px solid rgba(139, 92, 246, 0.3); }
.setor-grafica { background: rgba(6, 182, 212, 0.15); color: #06b6d4; border: 1px solid rgba(6, 182, 212, 0.3); }
.setor-default { background: rgba(107, 114, 128, 0.15); color: #9ca3af; border: 1px solid rgba(107, 114, 128, 0.3); }

/* Custom Status Colors */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-confirmado { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.status-agendado { background: rgba(99, 102, 241, 0.12); color: #6366f1; }
.status-pendente { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.status-em-andamento { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.status-em-producao { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.status-aguardando-orcamento { background: rgba(244, 63, 94, 0.15); color: #f43f5e; }
.status-aguardando-arte { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.status-default { background: rgba(107, 114, 128, 0.12); color: #9ca3af; }

.order-id-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.card-middle {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.client-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.client-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.service-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.service-title svg {
  width: 16px;
  height: 16px;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.card-meta-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.2rem;
  font-size: 0.825rem;
  color: var(--text-muted);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.meta-item svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.card-obs {
  background: var(--bg-input);
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent-primary);
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  margin-top: 0.25rem;
}

.price-tag {
  display: flex;
  flex-direction: column;
}

.price-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.price-amount {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* WhatsApp Direct Button */
.btn-wa {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: rgba(37, 211, 102, 0.15);
  color: #25d366;
  border: 1px solid rgba(37, 211, 102, 0.3);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-wa:hover {
  background: #25d366;
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   11. TABLE VIEW
   -------------------------------------------------------------------------- */
.orders-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.orders-table th {
  background: var(--bg-card-header);
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.orders-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

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

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

.text-right {
  text-align: right;
}

/* --------------------------------------------------------------------------
   12. MODALS
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-modal-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.modal-card {
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-slide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-slide {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card-header);
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-group label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.modal-footer-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Details Modal Custom Layout */
.detail-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.detail-price-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.detail-price-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.info-block {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.info-block.full {
  grid-column: span 2;
}

.info-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.info-label svg {
  width: 14px;
  height: 14px;
}

.info-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.info-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.phone-action-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.observacoes-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.85rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

/* --------------------------------------------------------------------------
   13. TOAST NOTIFICATIONS
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  animation: toast-in 0.3s ease forwards;
}

.toast-success {
  border-left: 4px solid var(--success);
}

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

.toast-error {
  border-left: 4px solid var(--danger);
}

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

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

/* --------------------------------------------------------------------------
   14. RESPONSIVE BREAKPOINTS
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .app-header {
    padding: 0.75rem 1rem;
  }
  
  .app-main {
    padding: 1rem 1rem 3rem;
  }

  .kpi-section {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-section {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    flex: 1 1 100%;
  }

  .filters-group {
    width: 100%;
    justify-content: space-between;
  }

  .select-wrapper {
    flex: 1 1 calc(50% - 0.5rem);
  }

  .select-wrapper select {
    width: 100%;
  }

  .form-grid,
  .detail-info-grid {
    grid-template-columns: 1fr;
  }

  .form-group.full-width,
  .info-block.full {
    grid-column: span 1;
  }

  .desktop-only {
    display: none;
  }
}

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

  .orders-grid {
    grid-template-columns: 1fr;
  }
}
