/* ==========================================
   DESIGN SYSTEM & VARIABLES
   ========================================== */
:root {
  --bg-main: #f3f4f6;           /* Slate light grey background */
  --bg-panel: #ffffff;          /* White panel background */
  --bg-header: #121110;         /* Soft Black header */
  --bg-input: #ffffff;          
  --bg-muted: #f9fafb;          
  
  --primary: #ff551f;           /* Brand Vibrant Orange */
  --primary-hover: #e04616;     
  --secondary: #374151;         /* Charcoal gray */
  
  --text-dark: #111827;         
  --text-gray: #4b5563;         
  --text-muted: #9ca3af;        
  --text-light: #ffffff;        
  
  --border-color: #e5e7eb;      
  --border-focus: #ff551f;      
  
  --success-bg: #d1fae5;
  --success-text: #065f46;
  --pending-bg: #fef3c7;
  --pending-text: #92400e;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-gray);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.admin-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-dark);
}

a {
  color: inherit;
  text-decoration: none;
}

/* Common form controls */
.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-dark);
}

.form-control {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  color: var(--text-dark);
  font-family: var(--font-body);
  font-size: 0.85rem;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(255, 85, 31, 0.15);
}

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

.form-grid-three {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.w-full {
  width: 100%;
}

/* ==========================================
   LOGIN MODULE (OVERLAY)
   ========================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--bg-main);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-lg);
  animation: fadeInScale 0.3s ease-out;
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.login-logo {
  height: 65px;
  width: auto;
  margin: 0 auto 1.25rem auto;
  display: block;
}

.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-header h4 {
  font-size: 1.35rem;
  margin-bottom: 0.25rem;
}

.login-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.input-icon-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.input-icon-wrapper .form-control {
  padding-left: 2.25rem;
}

.login-error-msg {
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1rem;
  display: none;
}

/* ==========================================
   ADMIN LAYOUT
   ========================================== */
.admin-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top Nav */
.admin-header {
  background-color: var(--bg-header);
  border-bottom: 3px solid var(--primary);
  color: var(--text-light);
  padding: 0.75rem 0;
  box-shadow: var(--shadow-md);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.admin-logo {
  height: 50px;
  width: auto;
}

.app-mode-tag {
  background-color: var(--primary);
  color: var(--text-light);
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.user-greeting {
  font-size: 0.85rem;
}

.btn-logout {
  background: transparent;
  border: 1px solid #333333;
  color: #eeeeee;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-family: var(--font-display);
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-logout:hover {
  background-color: var(--primary);
  border-color: var(--primary);
  color: var(--text-light);
}

/* Content wrapper */
.admin-main {
  flex: 1;
  padding: 2rem 0;
}

/* PWA settings bar */
.notification-bar {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.bar-message {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-gray);
}

.bar-message i {
  font-size: 1.1rem;
}

/* ==========================================
   STATS CARD SYSTEM
   ========================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-card {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.bg-orange-light { background-color: rgba(255, 85, 31, 0.08); }
.bg-yellow-light { background-color: rgba(217, 119, 6, 0.08); }
.bg-green-light { background-color: rgba(16, 185, 129, 0.08); }

.text-orange { color: var(--primary); }
.text-yellow { color: #d97706; }
.text-green { color: #10b981; }

.stat-values {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.2;
}

/* ==========================================
   PANELS & GRIDS
   ========================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

@media (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1.2fr);
  }
}

.dashboard-panel {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.panel-title {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.panel-filters {
  display: flex;
  gap: 0.35rem;
}

.filter-badge {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-gray);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-badge:hover {
  background-color: var(--border-color);
}

.filter-badge.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: var(--text-light);
}

.chart-container {
  height: 280px;
  position: relative;
  margin-top: 1rem;
  width: 100%;
  overflow: hidden;
}

/* ==========================================
   TABLE DESIGN
   ========================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.admin-table th {
  background-color: var(--bg-muted);
  padding: 0.75rem 1rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-dark);
  border-bottom: 1px solid var(--border-color);
}

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

.admin-table tbody tr:hover {
  background-color: var(--bg-muted);
}

.table-loading {
  text-align: center;
  padding: 2rem !important;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.status-pill.pendiente {
  background-color: var(--pending-bg);
  color: var(--pending-text);
}

.status-pill.cotizado {
  background-color: var(--success-bg);
  color: var(--success-text);
}

/* Buttons style */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  text-decoration: none;
}

.btn-sm {
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-light);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: #f3f4f6;
  border: 1px solid var(--border-color);
  color: var(--text-gray);
}

.btn-secondary:hover {
  background-color: var(--border-color);
  color: var(--text-dark);
}

.btn-indigo {
  background-color: #4f46e5;
  color: var(--text-light);
}

.btn-indigo:hover {
  background-color: #4338ca;
  transform: translateY(-1px);
}

.btn-success {
  background-color: #10b981;
  color: var(--text-light);
}

.btn-success:hover {
  background-color: #059669;
  transform: translateY(-1px);
}

.btn-warning {
  background-color: #f59e0b;
  color: var(--text-light);
}

.btn-warning:hover {
  background-color: #d97706;
  transform: translateY(-1px);
}

/* ==========================================
   SIDE DRAWER (SLIDE-IN MODAL)
   ========================================== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(18, 17, 16, 0.4);
  backdrop-filter: blur(3px);
  z-index: 50;
  display: none;
  justify-content: flex-end;
  animation: fadeIn 0.25s ease-out;
}

.drawer {
  width: 100%;
  max-width: 480px;
  background-color: var(--bg-panel);
  height: 100%;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideInLeft 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

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

.drawer-title {
  font-size: 1.2rem;
}

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

.btn-close-drawer, .btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-gray);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
}

.btn-close-drawer:hover, .btn-close-modal:hover {
  color: var(--primary);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.drawer-section {
  margin-bottom: 1.75rem;
}

.border-top {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.section-title {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--secondary);
}

.part-description-text {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  color: var(--text-dark);
  white-space: pre-line;
}

.detail-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  background-color: var(--bg-muted);
}

.detail-badge.pendiente {
  background-color: var(--pending-bg);
  color: var(--pending-text);
}

.detail-badge.cotizado {
  background-color: var(--success-bg);
  color: var(--success-text);
}

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

.detail-item {
  display: flex;
  flex-direction: column;
}

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

.detail-val {
  font-size: 0.85rem;
  color: var(--text-dark);
  font-weight: 600;
}

.vin-box {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
}

.vin-code {
  display: block;
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-dark);
  margin-top: 0.15rem;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-list-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.contact-list-item i {
  color: var(--primary);
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.contact-lbl {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.contact-val {
  font-size: 0.85rem;
  color: var(--text-dark);
  font-weight: 600;
}

/* Quote details box */
.quote-summary-card {
  background-color: var(--bg-muted);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 1.15rem;
}

.quote-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.65rem;
}

.quote-number-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-dark);
}

.quote-total-price {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--primary);
}

.quote-action-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.quote-action-buttons .btn {
  width: 100%;
  box-sizing: border-box;
}

.drawer-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* ==========================================
   MODAL DIALOG (QUOTE BUILDER)
   ========================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(18, 17, 16, 0.4);
  backdrop-filter: blur(3px);
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease-out;
}

.modal {
  width: 100%;
  max-width: 800px;
  background-color: var(--bg-panel);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  animation: fadeInScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

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

.modal-title {
  font-size: 1.2rem;
}

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

.quote-client-card {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.quote-client-card h5 {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  color: var(--secondary);
}

.quote-parts-builder {
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

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

.builder-header h5 {
  font-size: 0.9rem;
  color: var(--secondary);
}

/* Builder Table */
.builder-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

.builder-table th {
  text-align: left;
  padding: 0.5rem 0.5rem;
  font-weight: 700;
  color: var(--text-dark);
  border-bottom: 1px solid var(--border-color);
}

.builder-table td {
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid var(--border-color);
}

.btn-remove-row {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
}

.btn-remove-row:hover {
  color: var(--danger);
}

.builder-totals {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.total-label {
  font-size: 0.9rem;
  font-weight: 700;
}

.total-amount {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--primary);
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ==========================================
   INSIGHTS CARDS (MONTHLY PERFORMANCE)
   ========================================== */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.insight-card {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

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

.insight-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background-color: var(--border-color);
}

.insight-card.primary::before { background-color: var(--primary); }
.insight-card.success::before { background-color: #10b981; }
.insight-card.warning::before { background-color: #f59e0b; }
.insight-card.info::before { background-color: #3b82f6; }
.insight-card.purple::before { background-color: #8b5cf6; }

.insight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.insight-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.insight-icon {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.insight-card:hover .insight-icon {
  color: var(--primary);
}

.insight-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.2;
}

.insight-footer {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ==========================================
   WORKFLOW PANEL & VERTICAL STEPPER IN DRAWER
   ========================================== */
.current-step-banner {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.step-badge {
  background-color: var(--primary);
  color: var(--text-light);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  text-transform: uppercase;
}

.step-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dark);
}

.workflow-details-card {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.workflow-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.8rem;
  border-bottom: 1px dashed var(--border-color);
}

.workflow-detail-row:last-child {
  border-bottom: none;
}

.workflow-detail-label {
  color: var(--text-gray);
  font-weight: 500;
}

.workflow-detail-value {
  color: var(--text-dark);
  font-weight: 700;
}

.workflow-detail-value.profit {
  color: #10b981;
}

/* Stepper Toggle Button */
.btn-toggle-stepper {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding: 0;
}

.btn-toggle-stepper:hover {
  text-decoration: underline;
}

/* Stepper container (collapsible) */
.workflow-stepper-container {
  display: none;
  margin-bottom: 1rem;
  border-left: 2px solid var(--border-color);
  padding-left: 1.25rem;
  margin-left: 0.5rem;
}

.workflow-stepper-container.open {
  display: block;
}

.stepper-step {
  position: relative;
  padding-bottom: 1rem;
}

.stepper-step:last-child {
  padding-bottom: 0;
}

.stepper-dot {
  position: absolute;
  left: -25px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--text-muted);
  border: 2px solid var(--bg-panel);
}

.stepper-step.completed .stepper-dot {
  background-color: var(--primary);
}

.stepper-step.active .stepper-dot {
  background-color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 85, 31, 0.2);
}

.stepper-step-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-gray);
}

.stepper-step.active .stepper-step-title {
  color: var(--primary);
}

.stepper-step.completed .stepper-step-title {
  color: var(--text-dark);
}

/* Custom styles for active state options */
.detail-badge.pendiente { background-color: #fef3c7; color: #92400e; }
.detail-badge.cotizado { background-color: #d1fae5; color: #065f46; }
.detail-badge.aceptada { background-color: #dbeafe; color: #1e40af; }
.detail-badge.adelantado { background-color: #e0e7ff; color: #3730a3; }
.detail-badge.comprado { background-color: #fae8ff; color: #86198f; }
.detail-badge.en_transito { background-color: #ffedd5; color: #9a3412; }
.detail-badge.en_bodega { background-color: #f3e8ff; color: #6b21a8; }
.detail-badge.delivery { background-color: #e0f2fe; color: #075985; }
.detail-badge.entregado { background-color: #ccfbf1; color: #115e59; }
.detail-badge.cerrado { background-color: #f3f4f6; color: #374151; }
.detail-badge.cancelada { background-color: #fee2e2; color: #991b1b; }

.status-pill.aceptada { background-color: #dbeafe; color: #1e40af; }
.status-pill.adelantado { background-color: #e0e7ff; color: #3730a3; }
.status-pill.comprado { background-color: #fae8ff; color: #86198f; }
.status-pill.en_transito { background-color: #ffedd5; color: #9a3412; }
.status-pill.en_bodega { background-color: #f3e8ff; color: #6b21a8; }
.status-pill.delivery { background-color: #e0f2fe; color: #075985; }
.status-pill.entregado { background-color: #ccfbf1; color: #115e59; }
.status-pill.cerrado { background-color: #f3f4f6; color: #374151; }
.status-pill.cancelada { background-color: #fee2e2; color: #991b1b; }

/* ==========================================
   MOBILE RESPONSIVENESS AND REFINEMENTS
   ========================================== */
@media (max-width: 767px) {
  /* Top Nav Bar */
  .admin-header {
    padding: 0.65rem 0;
  }
  .nav-container {
    flex-direction: column;
    gap: 0.65rem;
    align-items: center;
    text-align: center;
  }
  .brand-info {
    gap: 0.5rem;
  }
  .admin-logo {
    height: 40px;
  }
  .user-controls {
    width: 100%;
    justify-content: space-between;
    border-top: 1px solid #222222;
    padding-top: 0.65rem;
    gap: 0.5rem;
  }
  .user-greeting {
    font-size: 0.75rem;
  }
  .btn-logout {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
  }

  /* Stats grid */
  .stats-grid {
    margin-bottom: 1.5rem;
    gap: 0.75rem;
  }
  .stat-card {
    padding: 1rem;
  }
  .stat-number {
    font-size: 1.4rem;
  }

  /* Insights performance grid */
  .insights-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }
  .insight-card {
    padding: 0.85rem;
  }
  .insight-value {
    font-size: 1.2rem;
  }
  .insight-footer {
    font-size: 0.65rem;
  }

  /* Panel headers */
  .panel-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .panel-filters {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 0.5rem;
    display: flex;
  }
  #btn-manual-quote {
    width: 100%;
    margin-bottom: 0.25rem;
  }

  /* Table panel */
  .dashboard-panel {
    padding: 1rem;
  }

  /* Side Drawer slide-in modal */
  .drawer-overlay {
    align-items: flex-end;
  }
  .drawer {
    max-width: 100%;
    height: 94%;
    border-radius: 16px 16px 0 0;
    animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes slideInUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .drawer-body {
    padding: 1.25rem 1rem;
  }
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .quote-action-buttons {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  /* Modal Dialogs */
  .modal-overlay {
    padding: 0;
  }
  .modal {
    max-width: 100% !important;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  .modal-body {
    padding: 1.25rem 1rem;
  }
  .modal-footer {
    padding: 0.85rem 1rem;
    flex-direction: column;
    gap: 0.5rem;
  }
  .modal-footer .btn {
    width: 100%;
    margin: 0 !important;
  }

  /* Form layouts */
  .form-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .form-group {
    margin-bottom: 0.85rem;
  }

  /* Quote Builder Table card transformations */
  .builder-table, 
  .builder-table thead, 
  .builder-table tbody, 
  .builder-table tr, 
  .builder-table td {
    display: block;
    width: 100%;
  }
  .builder-table thead {
    display: none;
  }
  .builder-table tr {
    background-color: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 0.85rem;
  }
  .builder-table td {
    border-bottom: none;
    padding: 0.4rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
  }
  .builder-table td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-gray);
    text-transform: uppercase;
  }
  .builder-table td:not([data-label])::before {
    content: none;
  }
  /* Remove labels from actions cell and center it */
  .builder-table td.item-actions-td {
    justify-content: center;
    border-top: 1px dashed var(--border-color);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
  }
  /* Style inputs inside block tds */
  .builder-table td .form-control {
    width: 60%;
    text-align: right;
    padding: 0.4rem 0.6rem;
  }
  .builder-table td.item-subtotal-val {
    font-size: 0.95rem;
    color: var(--primary);
  }
  .btn-remove-row {
    color: #ef4444;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }
  .btn-remove-row::after {
    content: ' Eliminar Repuesto';
  }
  .builder-totals {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 0.5rem;
    margin-top: 1rem;
  }
}

.edit-step-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  font-size: 0.75rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.edit-step-btn:hover {
  color: var(--primary);
  background-color: var(--bg-muted);
}

/* ==========================================
   TABLE COLUMN HEADERS FILTERS
   ========================================== */
.filterable-th {
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s ease;
}

.filterable-th:hover {
  background-color: var(--bg-muted);
}

.th-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-start;
}

.th-content i.filter-icon {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: color 0.2s ease, transform 0.2s ease;
}

.filterable-th:hover .th-content i.filter-icon,
.filterable-th.active-filter .th-content i.filter-icon {
  color: var(--primary);
  transform: scale(1.1);
}

.table-header-filter {
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--bg-body);
  color: var(--text-dark);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.table-header-filter:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 85, 31, 0.15);
}

/* Excel Style Dropdown */
.excel-filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  width: 200px;
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 0.75rem;
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: default;
  font-weight: normal;
  text-align: left;
  animation: fadeIn 0.15s ease-out;
}

.excel-filter-dropdown label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-gray);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

.excel-filter-dropdown label:hover {
  background-color: var(--bg-muted);
  color: var(--text-dark);
}

.excel-filter-dropdown input[type="checkbox"] {
  accent-color: var(--primary);
  cursor: pointer;
}

.excel-filter-actions {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

.excel-filter-btn {
  background: none;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.excel-filter-btn.apply-btn {
  color: var(--primary);
}

.excel-filter-btn.apply-btn:hover {
  background-color: var(--bg-muted);
}

.excel-filter-btn.clear-btn {
  color: var(--text-muted);
}

.excel-filter-btn.clear-btn:hover {
  color: #ef4444;
  background-color: #fef2f2;
}

.excel-filter-options {
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Provider Link Badge */
.provider-link-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: #ffebe6;
  border: 1px solid var(--primary);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.provider-link-badge:hover {
  background-color: var(--primary);
  color: #fff;
}


