@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ═══════════════════════════════════════════════════════════
   CRM ORIKATO — Design System (Dark Theme)
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Backgrounds */
  --bg-app:     #0b0f1a;
  --bg-sidebar: #0d1224;
  --bg-main:    #111827;
  --bg-card:    #1a2035;
  --bg-card-2:  #1f2847;
  --bg-input:   #151e30;
  --bg-hover:   rgba(255,255,255,0.04);
  --bg-active:  rgba(59,130,246,0.12);

  /* Text */
  --text-100: #f8fafc;
  --text-200: #e2e8f0;
  --text-300: #cbd5e1;
  --text-400: #94a3b8;
  --text-500: #64748b;

  /* Borders */
  --border:     rgba(148,163,184,0.1);
  --border-2:   rgba(148,163,184,0.06);
  --border-focus: rgba(59,130,246,0.5);

  /* Accent / Primary */
  --accent:       #3b82f6;
  --accent-dark:  #2563eb;
  --accent-light: rgba(59,130,246,0.15);
  --accent-glow:  rgba(59,130,246,0.25);

  /* Semantic */
  --success:       #10b981;
  --success-bg:    rgba(16,185,129,0.12);
  --success-border: rgba(16,185,129,0.3);
  --warning:       #f59e0b;
  --warning-bg:    rgba(245,158,11,0.12);
  --warning-border: rgba(245,158,11,0.3);
  --danger:        #ef4444;
  --danger-bg:     rgba(239,68,68,0.12);
  --danger-border: rgba(239,68,68,0.3);
  --info:          #06b6d4;
  --info-bg:       rgba(6,182,212,0.12);
  --purple:        #8b5cf6;
  --purple-bg:     rgba(139,92,246,0.12);

  /* Order status */
  --status-recibido:   #f59e0b;
  --status-en_proceso: #3b82f6;
  --status-repuesto_transito: #f59e0b;
  --status-listo:      #10b981;
  --status-entregado:  #059669;
  --status-cancelado:  #ef4444;

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-collapsed: 66px;
  --header-h: 64px;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --t: all 0.2s cubic-bezier(0.4,0,0.2,1);
  --t-slow: all 0.3s cubic-bezier(0.4,0,0.2,1);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.6);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 4px 12px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px var(--accent-glow);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-app);
  color: var(--text-200);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; outline: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ── App Layout ────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: var(--t-slow);
  overflow: hidden;
  position: relative;
  z-index: 100;
}
.sidebar.collapsed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  gap: 10px;
  flex-shrink: 0;
}
.sidebar-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.sidebar-logo-placeholder {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-100);
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  flex: 1;
  transition: var(--t-slow);
}
.sidebar.collapsed .sidebar-title { opacity: 0; width: 0; }

.hamburger-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-400);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--t);
  flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--bg-hover); color: var(--text-100); }

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 16px 8px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-500);
  letter-spacing: 1px;
  padding: 0 8px 8px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--t-slow);
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-400);
  font-size: 14px;
  font-weight: 500;
  transition: var(--t);
  white-space: nowrap;
  position: relative;
  margin-bottom: 2px;
}
.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-200);
}
.nav-link.active {
  background: var(--bg-active);
  color: var(--accent);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link span { transition: var(--t-slow); overflow: hidden; }
.sidebar.collapsed .nav-link span { opacity: 0; width: 0; margin: 0; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 10px; }

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  overflow: hidden;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-info { overflow: hidden; transition: var(--t-slow); }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-200);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.user-role {
  font-size: 11px;
  color: var(--text-500);
  white-space: nowrap;
  display: block;
}
.sidebar.collapsed .user-info { opacity: 0; width: 0; }
.sidebar.collapsed .user-card { justify-content: center; }

.btn-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  transition: var(--t);
  overflow: hidden;
}
.btn-logout:hover { background: var(--danger-bg); }
.btn-logout svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-logout span { transition: var(--t-slow); white-space: nowrap; }
.sidebar.collapsed .btn-logout { justify-content: center; padding: 10px; }
.sidebar.collapsed .btn-logout span { opacity: 0; width: 0; }

/* ── Main Content ────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--t-slow);
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  height: var(--header-h);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
  flex-shrink: 0;
  gap: 16px;
}
.header-left { display: flex; flex-direction: column; }
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-100);
  line-height: 1.2;
}
.page-subtitle {
  font-size: 12px;
  color: var(--text-500);
  margin-top: 1px;
}
.header-right { display: flex; align-items: center; gap: 10px; }

/* ── Page Body ───────────────────────────────────────────── */
.page-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.page-body::-webkit-scrollbar { width: 6px; }
.page-body::-webkit-scrollbar-track { background: transparent; }
.page-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card-header {
  padding: 18px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-100);
}
.card-body { padding: 16px 20px; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-card);
  transition: var(--t);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.6;
}
.stat-card:nth-child(2)::before { background: var(--success); }
.stat-card:nth-child(3)::before { background: var(--purple); }
.stat-card:nth-child(4)::before { background: var(--warning); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-md);
  background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.stat-label { font-size: 12px; color: var(--text-500); font-weight: 500; }
.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-100);
  line-height: 1;
}
.stat-value.revenue { font-size: 20px; }
.stat-trend { font-size: 11px; color: var(--text-500); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  transition: var(--t);
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }

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

.btn-ghost {
  background: transparent;
  color: var(--text-400);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-200); border-color: var(--border-focus); }

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-icon {
  width: 32px; height: 32px; padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-icon-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(6,182,212,0.2); }
.btn-icon-info:hover { background: rgba(6,182,212,0.2); }
.btn-icon-edit { background: var(--accent-light); color: var(--accent); border: 1px solid rgba(59,130,246,0.2); }
.btn-icon-edit:hover { background: rgba(59,130,246,0.25); }
.btn-icon-delete { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.btn-icon-delete:hover { background: rgba(239,68,68,0.2); }
.btn-icon-print { background: var(--purple-bg); color: var(--purple); border: 1px solid rgba(139,92,246,0.2); }
.btn-icon-pdf { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.btn-icon-whatsapp { background: rgba(22,163,74,0.1); color: #16a34a; border: 1px solid rgba(22,163,74,0.2); }

/* Tooltip on hover for icon buttons */
.btn-icon { position: relative; }
.btn-icon[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: var(--text-200);
  font-size: 11px;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  border: 1px solid var(--border);
  z-index: 200;
}
.btn-icon[data-tooltip]:hover::after { opacity: 1; }

/* ── Status Badges ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-recibido   { background: var(--warning-bg);  color: var(--warning);  border: 1px solid var(--warning-border); }
.badge-en_proceso { background: var(--accent-light); color: var(--accent);   border: 1px solid rgba(59,130,246,0.3); }
.badge-listo      { background: var(--success-bg);  color: var(--success);  border: 1px solid var(--success-border); }
.badge-entregado  { background: rgba(5,150,105,0.1); color: #059669; border: 1px solid rgba(5,150,105,0.3); }
.badge-cancelado  { background: var(--danger-bg);   color: var(--danger);   border: 1px solid var(--danger-border); }
.badge-repuesto_transito { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-true, .badge-activo   { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.badge-false, .badge-inactivo{ background: rgba(100,116,139,0.1); color: var(--text-500); border: 1px solid rgba(100,116,139,0.2); }

/* Type badges */
.badge-servicio  { background: var(--info-bg);    color: var(--info);    border: 1px solid rgba(6,182,212,0.3); }
.badge-repuesto  { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-producto  { background: var(--purple-bg);  color: var(--purple);  border: 1px solid rgba(139,92,246,0.3); }

/* ── Search Bar ──────────────────────────────────────────── */
.search-container {
  position: relative;
  flex: 1;
  max-width: 400px;
}
.search-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-200);
  font-size: 13px;
  transition: var(--t);
}
.search-input::placeholder { color: var(--text-500); }
.search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-500);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

/* Typeahead Dropdown */
.typeahead-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  max-height: 260px;
  overflow-y: auto;
  display: none;
}
.typeahead-dropdown.open { display: block; }
.typeahead-item {
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--t);
  border-bottom: 1px solid var(--border-2);
  font-size: 13px;
}
.typeahead-item:last-child { border-bottom: none; }
.typeahead-item:hover, .typeahead-item.focused { background: var(--bg-hover); }
.typeahead-item .item-name { font-weight: 500; color: var(--text-200); }
.typeahead-item .item-sub { font-size: 11px; color: var(--text-500); margin-top: 2px; }
.typeahead-empty { padding: 12px 14px; color: var(--text-500); font-size: 13px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-control {
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-200);
  font-size: 13px;
  transition: var(--t);
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: var(--bg-card);
}
.form-control::placeholder { color: var(--text-500); }
.form-control option { background: var(--bg-card-2, #1e2847); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  position: relative; display: inline-block;
  width: 44px; height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: var(--t);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 2px; bottom: 2px;
  background: var(--text-500);
  border-radius: 50%;
  transition: var(--t);
}
.toggle input:checked + .toggle-slider { background: var(--success); border-color: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); background: #fff; }
.toggle-label { font-size: 13px; color: var(--text-300); }

/* ── Table ───────────────────────────────────────────────── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-2);
  color: var(--text-300);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: var(--t); }
.table tbody tr:hover td { background: var(--bg-hover); }
.table-actions { display: flex; align-items: center; gap: 6px; }
.table-client-name { font-weight: 600; color: var(--text-100); }
.table-secondary { font-size: 11px; color: var(--text-500); margin-top: 2px; }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  color: var(--text-500);
}
.empty-state svg { width: 48px; height: 48px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.pagination-info { font-size: 12px; color: var(--text-500); }
.pagination-controls { display: flex; gap: 6px; }
.page-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-400);
  display: flex; align-items: center; justify-content: center;
  transition: var(--t);
}
.page-btn:hover { background: var(--bg-hover); color: var(--text-200); }
.page-btn.active { background: var(--accent); color: #fff; }
.page-btn:disabled { opacity: 0.3; pointer-events: none; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
.modal-overlay.closing { animation: fadeOut 0.15s ease forwards; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s cubic-bezier(0.34,1.56,0.64,1);
  display: flex;
  flex-direction: column;
}
.modal-lg { max-width: 840px; }
.modal-xl { max-width: 1100px; }
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text-100); }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-500);
  display: flex; align-items: center; justify-content: center;
  transition: var(--t);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-200); }
.modal-body { padding: 22px; flex: 1; overflow-y: auto; }
.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
  background: var(--bg-card);
}

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ── Filters Bar ─────────────────────────────────────────── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-select {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-300);
  font-size: 13px;
  cursor: pointer;
  transition: var(--t);
}
.filter-select:focus { outline: none; border-color: var(--border-focus); }
.filter-date {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-300);
  font-size: 13px;
  transition: var(--t);
}
.filter-date:focus { outline: none; border-color: var(--border-focus); }
.filter-date::-webkit-calendar-picker-indicator { filter: invert(0.5); }

/* Status counter buttons */
.status-counters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.status-counter-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-400);
  transition: var(--t);
  cursor: pointer;
}
.status-counter-btn .count {
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}
.status-counter-btn:hover { border-color: var(--border-focus); color: var(--text-200); }

/* ── Upload Drop Zone ─────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--t);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-500);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--text-300);
}
.drop-zone svg { width: 40px; height: 40px; opacity: 0.5; }
.drop-zone p { font-size: 13px; }
.drop-zone input[type=file] { display: none; }

.photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  background: rgba(0,0,0,0.7);
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--t);
}
.photo-thumb-remove:hover { background: var(--danger); }

/* ── Toast Notifications ─────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 420px;
  pointer-events: all;
  animation: slideInRight 0.3s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
  overflow: hidden;
}
.toast.removing { animation: slideOutRight 0.25s ease forwards; }
.toast-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-content { flex: 1; }
.toast-title { font-size: 13px; font-weight: 600; color: var(--text-100); }
.toast-message { font-size: 12px; color: var(--text-400); margin-top: 2px; }
.toast-close {
  color: var(--text-500);
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  padding: 2px;
}
.toast-close:hover { color: var(--text-200); }
.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.4;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  animation: shrink linear forwards;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.success .toast-progress { color: var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.error .toast-progress { color: var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.warning .toast-progress { color: var(--warning); }
.toast.info    { border-left: 3px solid var(--info); }
.toast.info .toast-progress { color: var(--info); }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); max-height: 200px; }
  to   { opacity: 0; transform: translateX(120%); max-height: 0; padding: 0; margin: 0; }
}
@keyframes shrink {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ── Loading Spinner ─────────────────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-row td {
  text-align: center;
  padding: 40px;
  color: var(--text-500);
}
.btn-loading { position: relative; pointer-events: none; opacity: 0.8; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

/* ── Multi-step form ─────────────────────────────────────── */
.step-indicator {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  position: relative;
}
.step-indicator::before {
  content: '';
  position: absolute;
  top: 16px; left: 16px; right: 16px;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.step-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
}
.step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: var(--text-500);
  transition: var(--t);
}
.step-item.active .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.step-item.done .step-num {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.step-label { font-size: 11px; color: var(--text-500); font-weight: 500; text-align: center; }
.step-item.active .step-label { color: var(--accent); font-weight: 600; }
.step-item.done .step-label { color: var(--success); }

.step-content { display: none; }
.step-content.active { display: block; }

/* ── Config Tabs ─────────────────────────────────────────── */
.config-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.config-tab {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-500);
  border-bottom: 2px solid transparent;
  transition: var(--t);
  cursor: pointer;
}
.config-tab:hover { color: var(--text-300); }
.config-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.config-panel { display: none; }
.config-panel.active { display: block; }

/* Roles & Permissions table */
.permissions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.permissions-table th {
  padding: 10px 14px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-500);
  text-transform: uppercase;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.permissions-table th:first-child { text-align: left; }
.permissions-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-2);
  text-align: center;
  color: var(--text-300);
}
.permissions-table td:first-child { text-align: left; font-weight: 500; color: var(--text-200); }
.permissions-table tbody tr:last-child td { border-bottom: none; }
.role-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.role-tab-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-400);
  background: var(--bg-input);
  border: 1px solid var(--border);
  transition: var(--t);
}
.role-tab-btn:hover { color: var(--text-200); }
.role-tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.perm-check {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Order Detail ─────────────────────────────────────────── */
.order-detail-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}
.status-btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.status-btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--t);
}
.status-btn-recibido   { background: var(--warning-bg);  color: var(--warning);  border-color: var(--warning-border); }
.status-btn-en_proceso { background: var(--accent-light); color: var(--accent);   border-color: rgba(59,130,246,0.3); }
.status-btn-listo      { background: var(--success-bg);  color: var(--success);  border-color: var(--success-border); }
.status-btn-entregado  { background: rgba(5,150,105,0.1);color: #059669; border-color: rgba(5,150,105,0.3); }
.status-btn-cancelado  { background: var(--danger-bg);   color: var(--danger);   border-color: var(--danger-border); }
.status-btn-repuesto_transito { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; border-color: rgba(139, 92, 246, 0.3); }
.status-btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.status-btn.current { filter: brightness(1.2); transform: scale(1.05); box-shadow: var(--shadow-md); }

/* History timeline */
.history-list { display: flex; flex-direction: column; gap: 0; }
.history-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  position: relative;
}
.history-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 13px; top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.history-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  border: 2px solid;
}
.history-content { flex: 1; }
.history-status { font-size: 13px; font-weight: 600; color: var(--text-200); }
.history-meta { font-size: 11px; color: var(--text-500); margin-top: 2px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .order-detail-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .page-body { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0; bottom: 0;
    z-index: 999;
    transition: var(--t-slow);
  }
  .sidebar.mobile-open { left: 0; }
}

/* ── Dashboard specific ──────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.chart-container {
  position: relative;
  height: 240px;
  padding: 4px;
}
.tech-load-list { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.tech-load-item { display: flex; flex-direction: column; gap: 6px; }
.tech-load-header { display: flex; justify-content: space-between; align-items: center; }
.tech-load-name { font-size: 13px; font-weight: 500; color: var(--text-200); }
.tech-load-count { font-size: 13px; font-weight: 700; color: var(--accent); }
.tech-load-bar { height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; }
.tech-load-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--purple)); border-radius: 3px; transition: width 0.8s cubic-bezier(0.4,0,0.2,1); }

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-500); }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }

/* PATTERN LOCK STYLES */
.pattern-lock-wrap {
  width: 280px;
  height: 280px;
  background: var(--bg-card-1);
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 15px;
  padding: 30px;
  position: relative;
  touch-action: none;
  border: 1px solid var(--border);
}
.pattern-lock-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-500);
  margin: auto;
  position: relative;
  z-index: 2;
  transition: all 0.2s ease;
}
.pattern-lock-dot.active {
  background: var(--accent);
  box-shadow: 0 0 0 10px rgba(74,108,247,0.2);
}
/* CHECKLIST STYLES */
.checklist-table th, .checklist-table td {
  text-align: center;
  padding: 8px;
}
.checklist-table td:first-child, .checklist-table th:first-child {
  text-align: left;
}

/* ── Printing Modal Animation ─────────────────────────────── */
.printing-animation {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.printing-animation svg {
  animation: printPulse 1.5s ease-in-out infinite;
}
@keyframes printPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.08); opacity: 0.85; }
}

.printing-dots {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.printing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: printBounce 1.4s ease-in-out infinite;
}
.printing-dots span:nth-child(2) { animation-delay: 0.16s; }
.printing-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes printBounce {
  0%, 80%, 100% { transform: scale(0.4); opacity: 0.3; }
  40%           { transform: scale(1);   opacity: 1; }
}
