/* =========================================================
   TechFix — Mockup UI
   Paleta: slate (neutros) + emerald (acento NODO)
   Mobile-first, UI cuadrada (border-radius: 4-6px)
   Iconos: Lucide via CDN
   ========================================================= */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ---------- Variables ---------- */
:root {
  --emerald: #059669;
  --emerald-dark: #047857;
  --emerald-light: #d1fae5;
  --emerald-mid: #6ee7b7;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --red: #ef4444;
  --red-light: #fee2e2;
  --amber: #f59e0b;
  --amber-light: #fef3c7;
  --blue: #3b82f6;
  --blue-light: #dbeafe;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  --radius: 5px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.10);
  --shadow: 0 2px 8px rgba(0,0,0,.12);
  --header-h: 56px;
  --nav-h: 60px;
  --sidebar-w: 220px;
  --sidebar-w-collapsed: 64px;
}

/* ---------- App Shell ---------- */
#app { display: flex; flex-direction: column; min-height: 100dvh; }

/* ---------- Login Screen ---------- */
#screen-login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #064e3b 100%);
  padding: 24px;
}
.login-card {
  background: white;
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 40px rgba(0,0,0,.3);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.login-logo .logo-icon {
  width: 40px; height: 40px;
  background: var(--emerald);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: white;
}
.login-logo .logo-text { font-size: 20px; font-weight: 700; color: var(--slate-800); }
.login-subtitle { font-size: 13px; color: var(--slate-500); margin-bottom: 32px; }
.login-card h2 { font-size: 18px; font-weight: 600; margin-bottom: 20px; color: var(--slate-800); }

/* ---------- Form elements ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--slate-700); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--slate-800);
  background: white;
  transition: border-color .15s;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(5,150,105,.12);
}
.field textarea { resize: vertical; min-height: 72px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; border-radius: var(--radius);
  padding: 10px 16px; font-size: 14px; font-weight: 500;
  transition: background .15s, transform .08s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--emerald); color: white; }
.btn-primary:hover { background: var(--emerald-dark); }
.btn-secondary { background: var(--slate-100); color: var(--slate-700); border: 1.5px solid var(--slate-200); }
.btn-secondary:hover { background: var(--slate-200); }
.btn-danger { background: var(--red-light); color: var(--red); border: 1.5px solid #fca5a5; }
.btn-danger:hover { background: #fca5a5; }
.btn-outline { background: transparent; color: var(--emerald); border: 1.5px solid var(--emerald); }
.btn-outline:hover { background: var(--emerald-light); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 20px; font-size: 15px; font-weight: 600; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius); font-size: 18px;
}

/* ---------- Top Header (mobile) ---------- */
.top-header {
  height: var(--header-h);
  background: var(--slate-900);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  position: sticky; top: 0; z-index: 100;
  flex-shrink: 0;
}
.header-logo {
  width: 30px; height: 30px;
  background: var(--emerald);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: white;
}
.header-title { font-size: 15px; font-weight: 600; color: white; flex: 1; }
.header-title small { display: block; font-size: 11px; font-weight: 400; color: var(--slate-300); margin-top: 1px; }
.header-actions { display: flex; gap: 8px; }
.header-avatar {
  width: 32px; height: 32px;
  background: var(--emerald);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white; cursor: pointer;
}

/* ---------- Module Headers (color por módulo) ---------- */
.module-header {
  padding: 14px 16px 12px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  flex-shrink: 0;
}
.module-header.mod-dashboard { background: #064e3b; color: white; }
.module-header.mod-ot         { background: #1e3a5f; color: white; }
.module-header.mod-clientes   { background: #3b0764; color: white; }
.module-header.mod-productos  { background: #78350f; color: white; }
.module-header.mod-factura    { background: #1e1b4b; color: white; }
.module-header.mod-caja       { background: #14532d; color: white; }
.module-header.mod-reportes   { background: #1e3a5f; color: white; }
.module-header h1 { font-size: 17px; font-weight: 600; flex: 1; }

/* ---------- Bottom Nav (mobile) ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: white;
  border-top: 1.5px solid var(--slate-200);
  display: flex;
  z-index: 200;
}
.nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; cursor: pointer; border: none; background: none;
  font-size: 10px; font-weight: 500; color: var(--slate-500);
  padding: 6px 4px;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-item i { width: 20px; height: 20px; }
.nav-item.active { color: var(--emerald); }

/* ---------- Sidebar (desktop) ---------- */
.app-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  display: none; /* hidden on mobile */
  width: var(--sidebar-w);
  background: white;
  border-right: 1.5px solid var(--slate-200);
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 200ms ease;
  position: relative;
}

/* Colapsado: solo iconos */
.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 12px 14px;
  border-bottom: 1px solid var(--slate-100);
  flex-shrink: 0;
}

.sidebar-logo-wrap {
  display: flex; align-items: center; gap: 10px;
  overflow: hidden;
  flex: 1; min-width: 0;
}
.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: var(--emerald);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: white;
}
.sidebar-logo-text {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 150ms ease, max-width 150ms ease;
  max-width: 160px;
}
.sidebar.collapsed .sidebar-logo-text {
  opacity: 0;
  max-width: 0;
  pointer-events: none;
}
.logo-name { font-size: 14px; font-weight: 700; color: var(--slate-800); }
.logo-sub { font-size: 11px; color: var(--slate-500); }

/* Botón hamburguesa */
.btn-sidebar-toggle {
  background: none; border: none;
  padding: 6px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--slate-500);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.btn-sidebar-toggle:hover { background: var(--slate-100); color: var(--slate-700); }

/* Nav items */
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }

.sidebar-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--slate-600);
  border: none; background: none; width: 100%; text-align: left;
  white-space: nowrap;
  overflow: hidden;
  transition: background .12s, color .12s;
  position: relative;
}
.sidebar-nav-item i { flex-shrink: 0; width: 20px; height: 20px; }
.sidebar-nav-item .nav-label {
  transition: opacity 150ms ease, max-width 150ms ease;
  max-width: 160px;
  overflow: hidden;
}
.sidebar.collapsed .sidebar-nav-item .nav-label {
  opacity: 0;
  max-width: 0;
}

.sidebar-nav-item:hover { background: var(--slate-100); color: var(--slate-800); }

/* ACTIVO: fondo sólido emerald-600 */
.sidebar-nav-item.active {
  background: var(--emerald);
  color: white;
}
.sidebar-nav-item.active:hover {
  background: var(--emerald-dark);
}

/* Tooltip cuando está colapsado */
.sidebar.collapsed .sidebar-nav-item {
  justify-content: center;
  padding: 10px;
}
.sidebar.collapsed .sidebar-nav-item:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-w-collapsed) + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--slate-900);
  color: white;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius);
  white-space: nowrap;
  z-index: 999;
  pointer-events: none;
}

/* Footer del sidebar */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--slate-100);
  flex-shrink: 0;
}
.sidebar-user {
  font-size: 13px; font-weight: 500; color: var(--slate-700);
  white-space: nowrap; overflow: hidden;
  transition: opacity 150ms ease, max-height 150ms ease;
  max-height: 60px;
}
.sidebar-user small { display: block; font-size: 11px; color: var(--slate-500); font-weight: 400; }
.sidebar.collapsed .sidebar-user { opacity: 0; max-height: 0; pointer-events: none; }

.btn-logout {
  margin-top: 8px; font-size: 12px;
  overflow: hidden;
  transition: opacity 150ms ease, max-height 150ms ease;
  max-height: 40px;
}
.sidebar.collapsed .btn-logout { opacity: 0; max-height: 0; pointer-events: none; margin: 0; }

/* Logout icon solo cuando colapsado */
.sidebar-footer-icon {
  display: none;
}
.sidebar.collapsed .sidebar-footer-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  cursor: pointer;
  border: none; background: none;
  color: var(--slate-500);
  border-radius: var(--radius);
  width: 100%;
  transition: background .12s;
}
.sidebar.collapsed .sidebar-footer-icon:hover {
  background: var(--slate-100);
  color: var(--slate-700);
}

@media (min-width: 768px) {
  .sidebar { display: flex; }
  .bottom-nav { display: none; }
  .top-header { display: none; }
}

/* ---------- Main content area ---------- */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(var(--nav-h) + 8px);
  display: flex; flex-direction: column;
}
@media (min-width: 768px) {
  .main-content { padding-bottom: 24px; }
}

/* ---------- Screens ---------- */
.screen { display: none; flex-direction: column; flex: 1; }
.screen.active { display: flex; }

/* ---------- Cards ---------- */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
}
.card-body { padding: 16px; }
.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--slate-100);
  font-size: 14px; font-weight: 600; color: var(--slate-700);
}

/* ---------- Dashboard ---------- */
.dashboard-content { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card:active { transform: scale(.97); }
.stat-label { font-size: 12px; color: var(--slate-500); font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--slate-800); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--slate-500); margin-top: 4px; }
.stat-card.stat-green .stat-value { color: var(--emerald-dark); }
.stat-card.stat-amber .stat-value { color: #b45309; }
.stat-card.stat-blue  .stat-value { color: #1d4ed8; }
.stat-card.stat-red   .stat-value { color: var(--red); }

.section-title {
  font-size: 13px; font-weight: 600; color: var(--slate-500);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 8px; margin-top: 4px;
}

/* OT mini cards in dashboard */
.ot-mini-list { display: flex; flex-direction: column; gap: 8px; }
.ot-mini {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer; transition: box-shadow .12s;
}
.ot-mini:hover { box-shadow: var(--shadow); }
.ot-mini:active { background: var(--slate-50); }
.ot-mini-left { flex: 1; min-width: 0; }
.ot-mini-nro { font-size: 13px; font-weight: 700; color: var(--slate-800); }
.ot-mini-cliente { font-size: 13px; color: var(--slate-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ot-mini-equipo { font-size: 12px; color: var(--slate-500); margin-top: 2px; }
.ot-mini-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ot-mini-total { font-size: 13px; font-weight: 600; color: var(--slate-800); }

/* ---------- Status Chips ---------- */
.chip {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 3px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  white-space: nowrap;
}
.chip-agendada     { background: var(--slate-100); color: var(--slate-600); border: 1px solid var(--slate-300); }
.chip-encamino     { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.chip-diagnostico  { background: var(--blue-light); color: #1d4ed8; border: 1px solid #93c5fd; }
.chip-espera       { background: var(--amber-light); color: #92400e; border: 1px solid #fcd34d; }
.chip-aprobado     { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.chip-reparacion   { background: var(--purple-light); color: #5b21b6; border: 1px solid #c4b5fd; }
.chip-finalizada   { background: var(--emerald-light); color: var(--emerald-dark); border: 1px solid var(--emerald-mid); }
.chip-cobrada      { background: var(--slate-800); color: white; border: 1px solid var(--slate-700); }

/* ---------- Segmented Control (reemplaza los filter-chips de OT) ---------- */
.segmented-control {
  display: flex;
  gap: 0;
  padding: 10px 16px;
  background: white;
  border-bottom: 1px solid var(--slate-200);
  overflow-x: auto;
}
.segmented-btn {
  padding: 6px 16px;
  font-size: 13px; font-weight: 500;
  border: 1.5px solid var(--slate-200);
  background: white;
  cursor: pointer;
  color: var(--slate-600);
  white-space: nowrap;
  transition: all .12s;
  margin-right: -1px; /* solapado para el look pill */
}
.segmented-btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.segmented-btn:last-child  { border-radius: 0 var(--radius) var(--radius) 0; margin-right: 0; }
.segmented-btn.active {
  background: var(--emerald);
  color: white;
  border-color: var(--emerald);
  z-index: 1;
  position: relative;
}
.segmented-btn:hover:not(.active) {
  background: var(--slate-50);
  color: var(--slate-800);
}

/* ---------- Ubicación / Maps ---------- */
.btn-maps {
  display: inline-flex; align-items: center; gap: 8px;
  background: #1a73e8; color: white;
  border: none; border-radius: var(--radius);
  padding: 11px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s, transform .08s;
  text-decoration: none;
  width: 100%; justify-content: center;
}
.btn-maps:hover { background: #1558b0; }
.btn-maps:active { transform: scale(.97); }

.ubicacion-placeholder {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--slate-100); border: 1.5px dashed var(--slate-300);
  border-radius: var(--radius); padding: 12px 14px;
  font-size: 13px; color: var(--slate-500); line-height: 1.4;
}

.ubicacion-block { display: flex; flex-direction: column; gap: 8px; }
.ubicacion-dir {
  font-size: 14px; color: var(--slate-700); font-weight: 500;
  display: flex; align-items: center; gap: 4px;
}

/* Mini-mapa OSM embebido */
.osm-embed {
  width: 100%; height: 200px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  display: block;
}
@media (min-width: 768px) {
  .osm-embed { height: 280px; }
}

/* Placeholder cuando no hay coordenadas */
.mapa-sin-coords {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--slate-100); border: 1.5px dashed var(--slate-300);
  border-radius: var(--radius); padding: 12px 14px;
  font-size: 13px; color: var(--slate-500); line-height: 1.4;
}

/* Ícono de pin en la lista de OTs */
.pin-icon {
  display: inline-flex; align-items: center;
  opacity: 1;
}
.pin-icon.sin-ubicacion {
  opacity: .3;
  filter: grayscale(1);
}

/* Hint de campo */
.field-hint {
  font-size: 12px; color: var(--slate-500);
  margin-top: 4px; line-height: 1.4;
  background: #fffbeb; border-radius: 3px;
  padding: 5px 8px; border-left: 3px solid #fcd34d;
}

/* ---------- Dashboard — Visitas de hoy ---------- */
.visitas-list { display: flex; flex-direction: column; gap: 8px; }
.visita-card {
  background: white; border-radius: var(--radius);
  border: 1px solid var(--slate-200); box-shadow: var(--shadow-sm);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.visita-hora {
  font-size: 17px; font-weight: 700; color: #1a73e8;
  min-width: 48px; text-align: center; flex-shrink: 0;
}
.visita-info { flex: 1; min-width: 0; }
.visita-nro { font-size: 12px; font-weight: 700; color: var(--slate-500); }
.visita-cliente { font-size: 14px; font-weight: 600; color: var(--slate-800); }
.visita-dir { font-size: 12px; color: var(--slate-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-maps-sm {
  display: inline-flex; align-items: center; gap: 4px;
  background: #e8f0fe; color: #1a73e8;
  border: 1px solid #c5d8ff; border-radius: 4px;
  padding: 6px 10px; font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  text-decoration: none; transition: background .12s;
}
.btn-maps-sm:hover { background: #c5d8ff; }

/* ---------- OT List ---------- */
.list-toolbar {
  padding: 12px 16px;
  display: flex; gap: 8px;
  background: white;
  border-bottom: 1px solid var(--slate-200);
  flex-wrap: wrap;
  align-items: center;
}
.search-input {
  flex: 1; min-width: 160px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px; outline: none;
  color: var(--slate-800);
}
.search-input:focus { border-color: var(--emerald); }

.ot-list { display: flex; flex-direction: column; gap: 0; overflow-y: auto; flex: 1; }
.ot-row {
  background: white;
  border-bottom: 1px solid var(--slate-100);
  padding: 12px 16px;
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer; transition: background .1s;
}
.ot-row:hover { background: var(--slate-50); }
.ot-row:active { background: var(--emerald-light); }
.ot-row-info { flex: 1; min-width: 0; }
.ot-row-nro { font-size: 13px; font-weight: 700; color: var(--slate-800); display: flex; align-items: center; gap: 6px; }
.ot-row-cliente { font-size: 14px; font-weight: 500; color: var(--slate-800); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.ot-row-equipo { font-size: 12px; color: var(--slate-500); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ot-row-fecha { font-size: 11px; color: var(--slate-400); margin-top: 3px; }
.ot-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; min-width: 90px; }
.ot-row-total { font-size: 13px; font-weight: 600; color: var(--slate-800); }
.facturado-badge { font-size: 10px; font-weight: 600; color: var(--emerald-dark); background: var(--emerald-light); padding: 2px 7px; border-radius: 3px; }

/* ---------- OT Detail ---------- */
.detail-back {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: white; border-bottom: 1px solid var(--slate-200);
  cursor: pointer; font-size: 14px; font-weight: 500; color: var(--slate-600);
}
.detail-back:hover { color: var(--emerald); }

.detail-header {
  background: #1e3a5f; color: white;
  padding: 16px;
}
.detail-header-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.detail-nro { font-size: 20px; font-weight: 700; }
.detail-fecha { font-size: 12px; opacity: .75; margin-top: 2px; }

.detail-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.detail-section { }
.detail-section-title {
  font-size: 12px; font-weight: 600; color: var(--slate-500);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--slate-100);
}
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
@media (min-width: 600px) {
  .detail-grid { grid-template-columns: repeat(3, 1fr); }
}
.detail-field { }
.detail-field-label { font-size: 11px; color: var(--slate-500); font-weight: 500; }
.detail-field-value { font-size: 14px; color: var(--slate-800); font-weight: 500; margin-top: 2px; }
.detail-field-value.pass { font-family: monospace; background: var(--slate-100); padding: 2px 8px; border-radius: 3px; font-size: 13px; }

.items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.items-table th { background: var(--slate-50); padding: 8px 10px; text-align: left; font-size: 11px; font-weight: 600; color: var(--slate-500); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--slate-200); }
.items-table td { padding: 9px 10px; border-bottom: 1px solid var(--slate-100); vertical-align: middle; }
.items-table tr:last-child td { border-bottom: none; }
.items-table .td-right { text-align: right; font-weight: 600; }
.items-table .total-row td { background: var(--slate-50); font-weight: 700; font-size: 14px; }

.historial-list { display: flex; flex-direction: column; gap: 0; }
.historial-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--slate-50); }
.historial-item:last-child { border-bottom: none; }
.historial-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); margin-top: 5px; flex-shrink: 0; }
.historial-content { flex: 1; }
.historial-fecha { font-size: 11px; color: var(--slate-400); }
.historial-estado { font-size: 13px; font-weight: 600; color: var(--slate-700); }
.historial-nota { font-size: 12px; color: var(--slate-500); margin-top: 1px; }

.ot-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 16px; background: white; border-top: 1px solid var(--slate-200); }

.estado-selector {
  background: white; border-radius: var(--radius); padding: 14px 16px;
  border: 1.5px solid var(--slate-200);
}
.estado-selector label { font-size: 13px; font-weight: 600; color: var(--slate-700); margin-bottom: 8px; display: block; }
.estado-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.estado-btn {
  padding: 6px 12px; border-radius: 3px; font-size: 12px; font-weight: 500;
  border: 1.5px solid var(--slate-200); background: white; cursor: pointer; color: var(--slate-600);
  transition: all .12s;
}
.estado-btn:hover { border-color: var(--emerald); color: var(--emerald); }
.estado-btn.current { background: var(--emerald); color: white; border-color: var(--emerald); }

/* ---------- Timer de Atención ---------- */
.atencion-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1.5px solid;
}
.atencion-card.atencion-idle {
  background: #f0fdf4;
  border-color: var(--emerald-mid);
}
.atencion-card.atencion-running {
  background: #fffbeb;
  border-color: #fcd34d;
  animation: pulse-border 2s infinite;
}
.atencion-card.atencion-done {
  background: var(--slate-50);
  border-color: var(--slate-200);
}
@keyframes pulse-border {
  0%, 100% { border-color: #fcd34d; }
  50% { border-color: #f59e0b; }
}
.atencion-label { font-size: 12px; color: var(--slate-500); font-weight: 500; }
.atencion-crono {
  font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: #92400e; letter-spacing: .02em; font-family: 'Courier New', monospace;
}
.atencion-duracion {
  font-size: 18px; font-weight: 700; color: var(--emerald-dark);
  margin-top: 2px;
}

/* ---------- Clientes ---------- */
.cliente-list { display: flex; flex-direction: column; }
.cliente-row {
  background: white; border-bottom: 1px solid var(--slate-100);
  padding: 13px 16px; display: flex; align-items: center; gap: 12px;
  cursor: pointer; transition: background .1s;
}
.cliente-row:hover { background: var(--slate-50); }
.cliente-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--purple-light); color: var(--purple);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.cliente-row.empresa .cliente-avatar { background: #fef3c7; color: #92400e; }
.cliente-info { flex: 1; min-width: 0; }
.cliente-nombre { font-size: 14px; font-weight: 600; color: var(--slate-800); }
.cliente-detalle { font-size: 12px; color: var(--slate-500); margin-top: 2px; }
.cliente-tel { font-size: 13px; font-weight: 500; color: var(--slate-600); }

/* ---------- Productos ---------- */
.producto-list { display: flex; flex-direction: column; }
.producto-row {
  background: white; border-bottom: 1px solid var(--slate-100);
  padding: 12px 16px; display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.producto-row:hover { background: var(--slate-50); }
.prod-cat {
  padding: 3px 8px; border-radius: 3px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; flex-shrink: 0;
}
.prod-cat.servicio { background: var(--blue-light); color: #1d4ed8; }
.prod-cat.repuesto { background: var(--amber-light); color: #92400e; }
.prod-nombre { flex: 1; font-size: 14px; color: var(--slate-800); font-weight: 500; }
.prod-precio { font-size: 14px; font-weight: 700; color: var(--emerald-dark); }

/* ---------- Facturación ---------- */
.factura-form { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.factura-items-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.factura-items-title { font-size: 13px; font-weight: 600; color: var(--slate-700); }

.factura-item-row {
  display: grid; gap: 6px;
  grid-template-columns: 1fr 60px 90px 28px;
  align-items: end;
  padding: 8px;
  background: var(--slate-50);
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  margin-bottom: 6px;
}
.factura-item-row input, .factura-item-row select {
  border: 1.5px solid var(--slate-200); border-radius: 4px;
  padding: 7px 8px; font-size: 13px; outline: none; width: 100%; background: white; color: var(--slate-800);
}
.factura-item-row input:focus, .factura-item-row select:focus { border-color: var(--emerald); }
.btn-remove { background: var(--red-light); border: none; border-radius: 4px; width: 28px; height: 28px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; color: var(--red); }

.factura-totales { background: var(--slate-50); border-radius: var(--radius); border: 1px solid var(--slate-200); padding: 14px; }
.factura-total-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--slate-600); padding: 3px 0; }
.factura-total-row.total-final { font-size: 16px; font-weight: 700; color: var(--slate-900); border-top: 1.5px solid var(--slate-300); margin-top: 6px; padding-top: 8px; }

.sifen-toggle {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: #f0fdf4; border-radius: var(--radius);
  border: 1.5px solid var(--emerald-mid);
}
.sifen-toggle .toggle-label { flex: 1; }
.sifen-toggle .toggle-title { font-size: 14px; font-weight: 600; color: var(--slate-800); }
.sifen-toggle .toggle-sub { font-size: 12px; color: var(--slate-500); margin-top: 2px; }
/* Toggle switch */
.toggle-switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--slate-300);
  border-radius: 24px; cursor: pointer; transition: background .2s;
}
.toggle-slider::before {
  content: ""; position: absolute; width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: white; border-radius: 50%; transition: transform .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--emerald); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Factura Preview */
.factura-preview {
  display: none; flex-direction: column;
}
.factura-preview.show { display: flex; }
.preview-ticket {
  background: white; border: 2px dashed var(--slate-300);
  border-radius: var(--radius); padding: 20px; margin: 16px;
  max-width: 360px; align-self: center; width: 100%;
  font-family: 'Courier New', monospace;
}
.ticket-header { text-align: center; margin-bottom: 16px; }
.ticket-empresa { font-size: 16px; font-weight: 700; }
.ticket-ruc { font-size: 12px; color: var(--slate-500); }
.ticket-nro { font-size: 13px; font-weight: 600; margin-top: 8px; }
.ticket-divider { border: none; border-top: 1px dashed var(--slate-300); margin: 12px 0; }
.ticket-cliente { font-size: 13px; margin-bottom: 8px; }
.ticket-items { font-size: 12px; }
.ticket-item { display: flex; gap: 4px; margin-bottom: 4px; }
.ticket-item-desc { flex: 1; }
.ticket-item-total { font-weight: 600; }
.ticket-totales { font-size: 13px; margin-top: 12px; }
.ticket-total-row { display: flex; justify-content: space-between; }
.ticket-total-row.grand { font-size: 15px; font-weight: 700; border-top: 1px dashed var(--slate-300); padding-top: 8px; margin-top: 6px; }
.ticket-iva { font-size: 11px; color: var(--slate-500); margin-top: 6px; }
.ticket-footer { text-align: center; font-size: 11px; color: var(--slate-500); margin-top: 16px; }

/* ---------- Caja ---------- */
.caja-content { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.caja-resumen { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) {
  .caja-resumen { grid-template-columns: repeat(3, 1fr); }
}
.caja-card {
  background: white; border-radius: var(--radius); padding: 14px;
  border: 1px solid var(--slate-200); box-shadow: var(--shadow-sm);
}
.caja-card-label { font-size: 12px; color: var(--slate-500); font-weight: 500; }
.caja-card-value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.caja-card.efectivo .caja-card-value { color: var(--emerald-dark); }
.caja-card.transferencia .caja-card-value { color: #1d4ed8; }
.caja-card.total .caja-card-value { color: var(--slate-900); }

.cobro-list { display: flex; flex-direction: column; }
.cobro-row {
  background: white; border-bottom: 1px solid var(--slate-100);
  padding: 12px 16px; display: flex; align-items: center; gap: 12px;
}
.cobro-icon-svg { width: 24px; height: 24px; color: var(--slate-400); flex-shrink: 0; }
.cobro-info { flex: 1; min-width: 0; }
.cobro-desc { font-size: 14px; font-weight: 500; color: var(--slate-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cobro-meta { font-size: 12px; color: var(--slate-500); margin-top: 2px; }
.cobro-monto { font-size: 15px; font-weight: 700; color: var(--emerald-dark); }
.cobro-medio {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  padding: 2px 7px; border-radius: 3px;
}
.cobro-medio.efectivo { background: var(--emerald-light); color: var(--emerald-dark); }
.cobro-medio.transferencia { background: var(--blue-light); color: #1d4ed8; }
.cobro-medio.pos { background: var(--purple-light); color: var(--purple); }

/* ---------- Reportes ---------- */
.reportes-content { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.reportes-toolbar {
  display: flex; flex-direction: column; gap: 10px;
}
@media (min-width: 600px) {
  .reportes-toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
}

.reporte-resumen {
  display: flex; gap: 0;
  background: white;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.reporte-stat {
  flex: 1;
  padding: 14px 12px;
  text-align: center;
  border-right: 1px solid var(--slate-200);
}
.reporte-stat:last-child { border-right: none; }
.reporte-stat-val { font-size: 20px; font-weight: 700; color: var(--slate-900); }
.reporte-stat-label { font-size: 11px; color: var(--slate-500); margin-top: 2px; }

.reporte-table-wrap {
  background: white;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}
.reporte-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  min-width: 480px;
}
.reporte-table th {
  background: var(--slate-50);
  padding: 8px 12px;
  text-align: left;
  font-size: 11px; font-weight: 600; color: var(--slate-500);
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
}
.reporte-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}
.reporte-table tr:last-child td { border-bottom: none; }
.reporte-table tr:hover td { background: var(--slate-50); cursor: pointer; }
.td-center { text-align: center; }
.td-right { text-align: right; }
.reporte-td-cliente { min-width: 160px; }
.reporte-cliente-nombre { font-weight: 600; color: var(--slate-800); }
.reporte-cliente-sub { font-size: 11px; color: var(--slate-500); margin-top: 2px; }
.reporte-tiempo { font-weight: 600; color: var(--slate-700); font-variant-numeric: tabular-nums; }
.reporte-facturado { font-weight: 600; color: var(--emerald-dark); }

/* ---------- Modal ---------- */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 500;
  align-items: flex-end; justify-content: center;
}
.modal-overlay.show { display: flex; }
@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
}
.modal {
  background: white; border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 480px; max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp .2s ease;
}
@media (min-width: 600px) {
  .modal { border-radius: var(--radius); }
}
@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--slate-100);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--slate-800); }
.modal-close { font-size: 22px; color: var(--slate-400); cursor: pointer; border: none; background: none; line-height: 1; }
.modal-body { padding: 16px; }
.modal-footer { padding: 12px 16px; border-top: 1px solid var(--slate-100); display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Paso indicador (form OT) ---------- */
.steps {
  display: flex; gap: 0; padding: 12px 16px;
  background: white; border-bottom: 1px solid var(--slate-200);
  overflow-x: auto;
}
.step {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--slate-400);
  white-space: nowrap;
}
.step.active { color: var(--emerald); font-weight: 600; }
.step.done { color: var(--emerald-dark); }
.step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--slate-200); color: var(--slate-500);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.step.active .step-num { background: var(--emerald); color: white; }
.step.done .step-num { background: var(--emerald-dark); color: white; }
.step-sep { color: var(--slate-200); margin: 0 6px; font-size: 16px; }

.step-form { display: none; flex-direction: column; gap: 12px; padding: 16px; }
.step-form.active { display: flex; }

/* ---------- Empty state ---------- */
.empty-state {
  padding: 48px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty-icon-svg { width: 48px; height: 48px; opacity: .25; color: var(--slate-400); }
.empty-title { font-size: 16px; font-weight: 600; color: var(--slate-600); }
.empty-sub { font-size: 13px; color: var(--slate-400); }

/* ---------- Toast ---------- */
.toast-container { position: fixed; bottom: calc(var(--nav-h) + 16px); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 900; pointer-events: none; }
@media (min-width: 768px) { .toast-container { bottom: 24px; } }
.toast {
  background: var(--slate-900); color: white;
  padding: 10px 18px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow);
  animation: toastIn .2s ease;
  pointer-events: all;
}
.toast.success { background: var(--emerald-dark); }
.toast.error { background: var(--red); }
@keyframes toastIn { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 3px; }

/* ---------- Responsive desktop adjustments ---------- */
@media (min-width: 768px) {
  .dashboard-content { padding: 24px; }
  .stats-grid { gap: 16px; }
  .factura-form { padding: 24px; max-width: 680px; }
  .detail-body { padding: 24px; }
  .caja-content { padding: 24px; }
  .reportes-content { padding: 24px; }
}

/* =========================================================
   OBSERVACIONES DEL TÉCNICO — mini feed audit trail
   ========================================================= */

.obs-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.obs-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--slate-200);
  background: var(--white, #fff);
}
.obs-item:last-child { border-bottom: none; }
.obs-item:nth-child(even) { background: var(--slate-50); }

.obs-stamp {
  font-size: 11px;
  font-weight: 600;
  color: var(--emerald);
  margin-bottom: 3px;
  letter-spacing: .01em;
}

.obs-texto {
  font-size: 13px;
  color: var(--slate-700);
  line-height: 1.5;
}

.obs-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--slate-400);
  font-style: italic;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  background: var(--slate-50);
  margin-bottom: 12px;
}

.obs-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.obs-textarea {
  flex: 1;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  resize: vertical;
  min-height: 60px;
  background: var(--white, #fff);
  color: var(--slate-800);
  transition: border-color .15s;
}
.obs-textarea:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(5,150,105,.12);
}

.obs-add-btn {
  flex-shrink: 0;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
