/* =========================================================
   FIXES TALLER — Sistema de Diseño Unificado
   ========================================================= */

/* --- Variables ------------------------------------------ */
:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface-2:   #1c2128;
  --border:      #30363d;
  --text:        #c9d1d9;
  --text-muted:  #8b949e;
  --primary:     #2196F3;
  --primary-dk:  #0b79d0;
  --success:     #2ea043;
  --danger:      #f85149;
  --warning:     #d29922;
  --info:        #58a6ff;
  --whatsapp:    #25d366;
  --radius:      8px;
  --shadow:      0 2px 12px rgba(0,0,0,.35);
  --transition:  .2s ease;
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* --- Reset ---------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  font-size: 15px;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dk); }

/* --- Scrollbar ------------------------------------------ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* =========================================================
   NAVEGACIÓN
   ========================================================= */
.topnav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.topnav-left { display: flex; align-items: center; gap: 16px; }
.topnav-right { display: flex; align-items: center; gap: 12px; }
.nav-logo { height: 36px; width: auto; }
.nav-title {
  font-size: 1rem; font-weight: 600; color: var(--text);
  border-left: 1px solid var(--border); padding-left: 16px;
}
.nav-user { font-size: .85rem; color: var(--text-muted); }
.nav-user i { margin-right: 4px; }

/* =========================================================
   LAYOUT
   ========================================================= */
.page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px;
}
.page-wrapper-wide {
  max-width: 1600px;
  margin: 0 auto;
  padding: 28px 20px;
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-title {
  font-size: 1.4rem; font-weight: 600; color: var(--text);
}
.page-subtitle { font-size: .9rem; color: var(--text-muted); margin-top: 2px; }

/* =========================================================
   CARDS
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
}
.card-header-title {
  font-size: 1rem; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}

/* =========================================================
   BOTONES
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  font-size: .9rem; font-weight: 500;
  border: none; border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
  line-height: 1;
}
.btn:hover { transform: translateY(-1px); opacity: .92; }
.btn:active { transform: translateY(0); }
.btn-primary   { background: var(--primary);   color: #fff; }
.btn-primary:hover { background: var(--primary-dk); color: #fff; }
.btn-secondary { background: #3d444d;          color: var(--text); }
.btn-secondary:hover { background: #484f58; color: var(--text); }
.btn-danger    { background: var(--danger);    color: #fff; }
.btn-success   { background: var(--success);   color: #fff; }
.btn-whatsapp  { background: var(--whatsapp);  color: #fff; }
.btn-ghost     { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-sm        { padding: 6px 12px; font-size: .82rem; }
.btn-lg        { padding: 12px 24px; font-size: 1rem; }
.btn-icon      { padding: 8px; border-radius: 6px; }
.btn-block     { width: 100%; justify-content: center; }

/* =========================================================
   FORMULARIOS
   ========================================================= */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: .85rem; font-weight: 500; color: var(--text);
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%; padding: 9px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .9rem; font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(33,150,243,.2);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
.form-control[readonly] { opacity: .6; cursor: default; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }

/* =========================================================
   TABLA
   ========================================================= */
.table-wrapper { overflow-x: auto; }
.table {
  width: 100%; border-collapse: collapse;
  font-size: .9rem;
}
.table th {
  padding: 11px 14px;
  background: var(--bg); color: var(--info);
  font-weight: 600; font-size: .82rem; text-transform: uppercase;
  letter-spacing: .4px; border-bottom: 1px solid var(--border);
  text-align: left; white-space: nowrap;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table-clickable tbody tr { cursor: pointer; }
.table-compact th,
.table-compact td { padding: 8px 12px; }
.table-center th, .table-center td { text-align: center; }

/* =========================================================
   BADGES / ESTADOS
   ========================================================= */
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px; white-space: nowrap;
}
/* Estados de orden */
.badge-pendiente         { background: rgba(210,153,34,.15);  color: #d29922; }
.badge-en-revision       { background: rgba(88,166,255,.15);  color: #58a6ff; }
.badge-esperando-confirmacion { background: rgba(248,81,73,.15); color: #f85149; }
.badge-en-reparacion     { background: rgba(33,150,243,.15);  color: #2196F3; }
.badge-finalizado        { background: rgba(46,160,67,.15);   color: #3fb950; }
.badge-entregado         { background: rgba(46,160,67,.2);    color: #2ea043; }
.badge-baja              { background: rgba(110,118,129,.15); color: #8b949e; }
/* Estados de presupuesto */
.badge-pres-pendiente    { background: rgba(210,153,34,.15);  color: #d29922; }
.badge-pres-aprobado     { background: rgba(46,160,67,.15);   color: #3fb950; }
.badge-pres-rechazado    { background: rgba(248,81,73,.15);   color: #f85149; }
.badge-pres-sin          { background: rgba(110,118,129,.15); color: #8b949e; }

/* =========================================================
   ALERTS
   ========================================================= */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: .9rem; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
}
.alert i { margin-top: 2px; flex-shrink: 0; }
.alert-success { background: rgba(46,160,67,.12); border: 1px solid rgba(46,160,67,.3); color: #3fb950; }
.alert-danger  { background: rgba(248,81,73,.12); border: 1px solid rgba(248,81,73,.3); color: #f85149; }
.alert-warning { background: rgba(210,153,34,.12); border: 1px solid rgba(210,153,34,.3); color: #d29922; }
.alert-info    { background: rgba(88,166,255,.12); border: 1px solid rgba(88,166,255,.3); color: #58a6ff; }

/* =========================================================
   MODAL
   ========================================================= */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 1000; display: none;
  align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 520px;
  position: relative;
  animation: modalIn .25s ease;
}
.modal-box-lg { max-width: 720px; }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header-title { font-size: 1rem; font-weight: 600; }
.modal-close {
  background: none; border: none;
  color: var(--text-muted); font-size: 1.4rem;
  cursor: pointer; line-height: 1; padding: 4px;
  border-radius: 4px; transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* =========================================================
   STATS CARDS
   ========================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 6px; text-transform: uppercase; letter-spacing: .4px; }
.stat-primary { color: var(--primary); }
.stat-warning { color: var(--warning); }
.stat-success { color: var(--success); }
.stat-info    { color: var(--info); }
.stat-danger  { color: var(--danger); }

/* =========================================================
   SELECT2 OVERRIDES
   ========================================================= */
.select2-container--default .select2-selection--single {
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  height: 38px !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text) !important; line-height: 36px !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px !important; }
.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--text-muted) transparent transparent !important;
}
.select2-dropdown {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
}
.select2-results__option { color: var(--text) !important; }
.select2-results__option--highlighted[aria-selected] { background: var(--primary) !important; }
.select2-container--default .select2-search--dropdown .select2-search__field {
  background: var(--bg) !important; color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

/* =========================================================
   UTILIDADES
   ========================================================= */
.d-flex  { display: flex; }
.d-grid  { display: grid; }
.d-none  { display: none; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.gap-3 { gap: 20px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-primary{ color: var(--primary); }
.text-success{ color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning{ color: var(--warning); }
.fw-bold { font-weight: 700; }
.fs-sm   { font-size: .85rem; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.p-0  { padding: 0; }
.w-100 { width: 100%; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 768px) {
  .page-wrapper, .page-wrapper-wide { padding: 16px; }
  .topnav { padding: 0 16px; }
  .nav-title { display: none; }
  .card-header, .card-body, .card-footer { padding: 14px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .hide-mobile { display: none !important; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .btn-lg { padding: 10px 16px; font-size: .9rem; }
}

/* =========================================================
   PÁGINA DE LOGIN
   ========================================================= */
.login-wrapper {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 40px; width: 100%; max-width: 380px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-logo { height: 60px; margin: 0 auto 24px; }
.login-title { font-size: 1.3rem; font-weight: 600; margin-bottom: 8px; }
.login-subtitle { font-size: .85rem; color: var(--text-muted); margin-bottom: 28px; }
.login-error {
  background: rgba(248,81,73,.12); border: 1px solid rgba(248,81,73,.3);
  color: #f85149; padding: 10px 14px; border-radius: var(--radius);
  font-size: .88rem; margin-bottom: 16px;
}

/* =========================================================
   DASHBOARD / MENU
   ========================================================= */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.menu-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 20px;
  text-align: center; transition: all var(--transition);
  text-decoration: none; color: var(--text);
}
.menu-card:hover {
  border-color: var(--primary); transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(33,150,243,.2); color: var(--text);
}
.menu-card-icon { font-size: 2rem; margin-bottom: 14px; }
.menu-card-label { font-size: .95rem; font-weight: 600; }
.menu-card-desc { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }

/* =========================================================
   VISUAL / KANBAN
   ========================================================= */
.kanban-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}
.kanban-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: all var(--transition); text-decoration: none; color: var(--text);
  display: block;
}
.kanban-card:hover {
  border-color: var(--primary); transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,.3); color: var(--text);
}
.kanban-card-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.kanban-card-body { padding: 14px 16px; }
.kanban-card-footer {
  padding: 10px 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg);
}
.kanban-order-id { font-weight: 700; color: var(--info); font-size: .95rem; }
.kanban-date { font-size: .8rem; color: var(--text-muted); }
.kanban-client { font-weight: 600; margin-bottom: 6px; }
.kanban-equipment { font-size: .88rem; color: var(--text-muted); margin-bottom: 10px; }
.kanban-falla {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 12px;
  font-size: .85rem; line-height: 1.5;
}
.kanban-falla-label {
  font-size: .7rem; text-transform: uppercase;
  letter-spacing: .5px; color: var(--info); font-weight: 600;
  margin-bottom: 4px;
}
