/* =========================================================================
   Generador de Pedidos - Numaris
   Estilos especificos de la app. Depende de numaris.css (paleta + tokens).
   ========================================================================= */

/* Scrollbar webkit */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #f8fafc; border-radius: 6px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; border: 2px solid #f8fafc; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Reset / base. Sobrescribe el font-family de numaris.css por Inter
   (la fuente brand del Generador). */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: #f8fafc;
  color: #1e293b;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}

/* =========================================================================
   Toolbar superior
   ========================================================================= */
.toolbar {
  background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-500) 100%);
  color: #fff;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 200;
  flex-wrap: wrap;
  box-shadow: 0 8px 24px rgba(24, 50, 90, .18);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.toolbar h1 { font-size: 22px; font-weight: 600; white-space: nowrap; letter-spacing: -0.3px; text-shadow: 0 2px 4px rgba(0, 0, 0, .1); }
.toolbar .sep { width: 1px; height: 28px; background: linear-gradient(180deg, rgba(255, 255, 255, .1) 0%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .1) 100%); margin: 0 4px; }
.toolbar .btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border: none; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .25s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 4px 12px rgba(0, 0, 0, .12); white-space: nowrap; }
.toolbar .btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, .16); }
.toolbar .btn-tb { background: var(--blue-500); color: #fff; border: 1px solid var(--blue-400); }
.toolbar .btn-tb:hover { background: var(--navy-500); }
.toolbar .badge { background: rgba(255, 255, 255, .2); color: #fff; padding: 8px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, .1); }

/* =========================================================================
   Grid de pedidos
   ========================================================================= */
.grid-wrap { padding: 28px; min-height: calc(100vh - 120px); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 20px; animation: fadeIn .4s ease-out; }
.grid.empty { display: flex; align-items: center; justify-content: center; min-height: 400px; flex-direction: column; gap: 16px; color: #94a3b8; }
.grid.empty [data-lucide] { width: 48px; height: 48px; opacity: .5; stroke-width: 1.5; }
.grid.empty-text { font-size: 14px; font-weight: 500; color: #64748b; }

.order-col {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  border-left: 4px solid var(--navy-700);
  transition: all .3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: fadeInUp .5s ease-out backwards;
  cursor: default;
  position: relative;
  overflow: hidden;
}
.order-col:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0, 0, 0, .12); border-color: #cbd5e1; }
.r-type { font-size: 12px; color: #94a3b8; margin-bottom: 4px; }
.r-sol { font-size: 13px; color: #475569; margin-bottom: 2px; }
.r-tec { font-size: 12px; color: #64748b; margin-bottom: 10px; }
.r-heads { display: grid; grid-template-columns: 50px 1fr 52px 52px; gap: 6px; padding: 8px 10px; font-size: 10px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid #e2e8f0; }
.r-dev { font-size: 12px; color: #475569; }
.order-col > *:first-child { font-size: 15px; font-weight: 700; color: var(--navy-700); margin: 8px 0 12px; word-break: break-all; }
.order-info { font-size: 12px; color: #64748b; margin-bottom: 12px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; display: flex; flex-direction: column; gap: 4px; }
.order-info-label { font-weight: 500; color: #475569; }
.r-mat { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; transition: all .2s ease; display: grid; grid-template-columns: 50px 1fr 52px 52px; gap: 6px; align-items: center; }
.r-mat:hover { background: #f1f5f9; border-color: #cbd5e1; }
.r-mat .nm { font-weight: 600; color: var(--navy-700); font-size: 12px; margin-bottom: 0; }
.r-mat .qty { text-align: center; font-weight: 700; color: var(--navy-700); font-size: 13px; }
.r-mat .ck { text-align: center; }
.r-del { display: flex; gap: 6px; margin-top: 12px; text-align: center; padding: 0; background: none; border-top: none; }
.r-del span { padding: 4px 8px; border-radius: 6px; font-size: 10px; cursor: pointer; font-weight: 600; transition: all .15s ease; border: 1px solid transparent; background: var(--blue-050); color: var(--navy-700); }
.r-del span:hover { background: var(--blue-100); border-color: var(--blue-500); }
.r-del span:nth-child(2) { background: #fee2e2; color: #991b1b; }
.r-del span:nth-child(2):hover { background: #fecaca; border-color: #ef4444; }

/* =========================================================================
   Modal generico (Nuevo Pedido / Editar)
   ========================================================================= */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 300; justify-content: center; align-items: center; animation: fadeIn .25s ease; backdrop-filter: blur(2px); }
.modal-bg.show { display: flex; }
.modal-bg.show .modal { animation: scaleIn .3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.modal { background: #fff; border-radius: 20px; border: 1px solid #e2e8f0; padding: 32px; width: 500px; max-width: 92vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 25px 80px rgba(0, 0, 0, .25); transform-origin: center; }
.modal h2 { font-size: 20px; font-weight: 700; color: var(--navy-700); padding-bottom: 16px; border-bottom: 2px solid #f1f5f9; margin-bottom: 24px; display: flex; align-items: center; gap: 8px; }
.modal label { font-size: 12px; font-weight: 600; color: #475569; text-transform: uppercase; display: block; margin: 18px 0 8px; letter-spacing: 0.5px; }
.modal input, .modal select { width: 100%; padding: 12px 14px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 13px; font-family: inherit; transition: all .2s ease; background: #f8fafc; }
.modal input:focus, .modal select:focus { outline: none; border-color: var(--blue-500); background: #fff; box-shadow: 0 0 0 3px rgba(50, 116, 186, .15); }
.modal .dr { display: grid; grid-template-columns: 1fr 80px 32px; gap: 8px; margin-bottom: 8px; align-items: end; }
.modal .acts { display: flex; gap: 10px; margin-top: 28px; justify-content: flex-end; }
.modal .btn { padding: 12px 28px; border: none; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .25s ease; min-width: 100px; }
.modal .btn-c { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.modal .btn-c:hover { background: #e2e8f0; border-color: #cbd5e1; }
.modal .btn-s { background: linear-gradient(135deg, var(--blue-500) 0%, var(--navy-500) 100%); color: #fff; box-shadow: 0 4px 12px rgba(50, 116, 186, .3); border: none; }
.modal .btn-s:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(50, 116, 186, .4); }
.modal .btn-a { background: var(--blue-050); color: var(--navy-700); padding: 8px 14px; font-size: 12px; border: 1px solid var(--blue-200); border-radius: 8px; cursor: pointer; margin-top: 4px; transition: all .2s ease; font-weight: 600; }
.modal .btn-a:hover { background: var(--blue-100); border-color: var(--blue-500); }

/* =========================================================================
   Autocomplete (origen, entrega, tecnico)
   ========================================================================= */
.dev-ac { position: relative; }
.dev-ac input[type="text"] { width: 100%; padding: 12px 14px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 13px; font-family: inherit; background: #f8fafc; transition: all .2s ease; }
.dev-ac input[type="text"]:focus { outline: none; border-color: var(--blue-500); background: #fff; box-shadow: 0 0 0 3px rgba(50, 116, 186, .15); }
.ac-list { position: fixed; background: #fff; border: 1px solid #e2e8f0; border-top: none; border-radius: 0 0 10px 10px; max-height: 200px; overflow-y: auto; z-index: 9999; display: none; box-shadow: 0 12px 32px rgba(0, 0, 0, .25); }
.ac-list.open { display: block; }
.ac-item { padding: 10px 14px; font-size: 12px; cursor: pointer; border-bottom: 1px solid #f1f5f9; transition: all .15s ease; }
.ac-item:hover, .ac-item.ac-hl { background: var(--blue-050); color: var(--navy-700); font-weight: 500; padding-left: 18px; }
.ac-item .ac-match { font-weight: 700; color: var(--blue-500); }
.ac-none { padding: 12px 14px; font-size: 12px; color: #94a3b8; font-style: italic; text-align: center; }

/* =========================================================================
   Modal Configuracion (admin)
   ========================================================================= */
.adm-bg { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 400; justify-content: center; align-items: center; animation: fadeIn .25s ease; backdrop-filter: blur(2px); }
.adm-bg.show { display: flex; }
.adm-bg.show .adm { animation: scaleIn .3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.adm { background: #fff; border-radius: 20px; border: 1px solid #e2e8f0; padding: 0; width: 950px; max-width: 96vw; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 25px 80px rgba(0, 0, 0, .25); overflow: hidden; }
.adm-header { background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-500) 100%); color: #fff; padding: 24px 28px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(0, 0, 0, .1); }
.adm-header h2 { font-size: 18px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 10px; }
.adm-x { background: rgba(255, 255, 255, .15); border: none; color: #fff; width: 36px; height: 36px; border-radius: 10px; font-size: 24px; cursor: pointer; transition: all .2s ease; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.adm-x:hover { background: rgba(255, 255, 255, .25); }
.adm-tabs { display: flex; border-bottom: 2px solid #e2e8f0; background: #f8fafc; padding: 0 28px; }
.adm-tab { background: none; border: none; padding: 14px 20px; font-size: 13px; font-weight: 600; color: #64748b; cursor: pointer; transition: all .3s ease; position: relative; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.adm-tab.active { color: var(--blue-500); border-bottom-color: var(--blue-500); }
.adm-tab:hover:not(.active) { color: #475569; }
.adm-body { flex: 1; overflow-y: auto; padding: 28px; }
.adm-search { width: 100%; padding: 12px 16px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 13px; font-family: inherit; background: #f8fafc; margin-bottom: 20px; transition: all .2s ease; }
.adm-search:focus { outline: none; border-color: var(--blue-500); background: #fff; box-shadow: 0 0 0 3px rgba(50, 116, 186, .15); }
.adm-table { width: 100%; border-collapse: collapse; background: #fff; }
.adm-table thead { background: #f8fafc; border-bottom: 2px solid #e2e8f0; }
.adm-table th { padding: 14px; text-align: left; font-size: 12px; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: 0.4px; }
.adm-table td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; font-size: 13px; color: #475569; }
.adm-table tbody tr:hover { background: #f8fafc; }
.adm-table input, .adm-table select { padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 12px; width: 100%; font-family: inherit; background: #fff; transition: all .2s ease; }
.adm-table input:focus, .adm-table select:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(50, 116, 186, .15); }
.adm-act { padding: 6px 12px; border: none; border-radius: 6px; font-size: 11px; font-weight: 600; cursor: pointer; transition: all .2s ease; }
.adm-act-del { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.adm-act-del:hover { background: #fecaca; border-color: #ef4444; }
.adm-act-add { background: var(--blue-050); color: var(--navy-700); border: 1px solid var(--blue-200); }
.adm-act-add:hover { background: var(--blue-100); border-color: var(--blue-500); }
.adm-footer { background: #f8fafc; padding: 20px 28px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #e2e8f0; flex-wrap: wrap; gap: 16px; }
.adm-btn { padding: 12px 24px; border: none; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .25s ease; }
.adm-btn-reset { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.adm-btn-reset:hover { background: #e2e8f0; border-color: #cbd5e1; }
.adm-btn-cancel { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.adm-btn-cancel:hover { background: #e2e8f0; border-color: #cbd5e1; }
.adm-btn-save { background: linear-gradient(135deg, var(--blue-500) 0%, var(--navy-500) 100%); color: #fff; box-shadow: 0 4px 12px rgba(50, 116, 186, .3); border: none; }
.adm-btn-save:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(50, 116, 186, .4); }
.adm-info { background: var(--blue-050); color: var(--navy-700); padding: 14px; border-radius: 10px; font-size: 12px; margin-bottom: 20px; border: 1px solid var(--blue-200); line-height: 1.6; }

/* =========================================================================
   Dashboard (KPIs, charts, ranking de tecnicos)
   ========================================================================= */
.dash-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.dash-kpi { background: linear-gradient(135deg, #f8fafc 0%, #fff 100%); border: 1px solid #e2e8f0; border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 1px 3px rgba(0, 0, 0, .04); }
.dash-kpi .lbl { font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .6px; }
.dash-kpi .val { font-size: 30px; font-weight: 800; color: var(--navy-700); line-height: 1.1; }
.dash-kpi .sub { font-size: 11px; color: #94a3b8; }
.dash-kpi.k-hoy { background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-500) 100%); color: #fff; border: none; }
.dash-kpi.k-hoy .lbl { color: rgba(255, 255, 255, .7); }
.dash-kpi.k-hoy .val { color: #fff; }
.dash-kpi.k-hoy .sub { color: rgba(255, 255, 255, .65); }
.dash-section { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 18px 20px; margin-bottom: 18px; }
.dash-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.dash-section-head h3 { font-size: 14px; font-weight: 700; color: var(--navy-700); margin: 0; display: flex; align-items: center; gap: 8px; }
.dash-section-head h3 i { width: 16px; height: 16px; color: var(--blue-500); }
.dash-chart-wrap { position: relative; height: 260px; }
.dash-period { display: inline-flex; gap: 4px; background: #f1f5f9; padding: 4px; border-radius: 10px; }
.dash-period button { background: none; border: none; padding: 6px 12px; font-size: 12px; font-weight: 600; color: #64748b; cursor: pointer; border-radius: 7px; transition: all .2s ease; font-family: inherit; }
.dash-period button.active { background: #fff; color: var(--navy-700); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.dash-period button:hover:not(.active) { color: #475569; }
.dash-tec-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-tec-table thead { background: #f8fafc; border-bottom: 2px solid #e2e8f0; }
.dash-tec-table th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .4px; }
.dash-tec-table td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; color: #475569; }
.dash-tec-table tbody tr:hover { background: #f8fafc; }
.dash-tec-table .rank { font-weight: 800; color: #94a3b8; width: 42px; }
.dash-tec-table .rank.r1 { color: #eab308; }
.dash-tec-table .rank.r2 { color: #94a3b8; }
.dash-tec-table .rank.r3 { color: #d97706; }
.dash-tec-table .bar { display: flex; align-items: center; gap: 8px; }
.dash-tec-table .bar-fill { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--blue-500), var(--blue-400)); min-width: 4px; transition: width .4s ease; }
.dash-tec-table .bar-count { font-weight: 700; color: var(--navy-700); min-width: 36px; text-align: right; }
.dash-empty { text-align: center; padding: 30px; color: #94a3b8; font-size: 13px; }

/* =========================================================================
   Historico (busqueda + lista expandible)
   ========================================================================= */
.hist-filters { display: grid; grid-template-columns: 1fr 160px 160px auto; gap: 10px; align-items: end; margin-bottom: 18px; background: #f8fafc; padding: 14px; border-radius: 12px; border: 1px solid #e2e8f0; }
.hist-filters .field { display: flex; flex-direction: column; gap: 4px; }
.hist-filters label { font-size: 10px; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .4px; }
.hist-filters input[type=text], .hist-filters input[type=date] { padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 9px; font-size: 13px; font-family: inherit; background: #fff; transition: all .2s ease; }
.hist-filters input:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(50, 116, 186, .15); }
.hist-filters .btn-clear { padding: 10px 14px; background: #fff; border: 1px solid #e2e8f0; border-radius: 9px; cursor: pointer; font-size: 12px; color: #64748b; font-family: inherit; font-weight: 600; transition: all .15s ease; }
.hist-filters .btn-clear:hover { background: #f1f5f9; color: var(--navy-700); }
.hist-summary { font-size: 12px; color: #64748b; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.hist-summary .badge { background: var(--blue-050); color: var(--navy-700); padding: 3px 10px; border-radius: 6px; font-weight: 700; font-size: 11px; }
.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-row { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: all .15s ease; }
.hist-row:hover { border-color: var(--blue-500); box-shadow: 0 2px 8px rgba(50, 116, 186, .1); }
.hist-row-head { display: grid; grid-template-columns: 90px 1fr 1fr 1fr auto; gap: 14px; align-items: center; }
.hist-row-head .h-date { font-size: 11px; color: #94a3b8; font-weight: 600; }
.hist-row-head .h-sol { font-size: 13px; color: var(--navy-700); font-weight: 800; }
.hist-row-head .h-tec { font-size: 12px; color: #475569; }
.hist-row-head .h-guia { font-size: 11px; color: #64748b; font-family: monospace; }
.hist-row-head .h-toggle { font-size: 18px; color: #94a3b8; transition: transform .2s; }
.hist-row.expanded .h-toggle { transform: rotate(90deg); color: var(--blue-500); }
.hist-row-body { display: none; margin-top: 14px; padding-top: 14px; border-top: 1px dashed #e2e8f0; }
.hist-row.expanded .hist-row-body { display: block; animation: slideDown .25s ease; }
.hist-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.hist-kv div { font-size: 12px; color: #475569; }
.hist-kv b { color: var(--navy-700); }
.hist-sub-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.hist-sub-table th { background: #f8fafc; text-align: left; padding: 8px 10px; font-size: 10px; color: #475569; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid #e2e8f0; }
.hist-sub-table td { padding: 7px 10px; border-bottom: 1px solid #f1f5f9; }
.hist-sub-table .chk { text-align: center; color: var(--success); font-weight: 700; }
.hist-sub-table .chk.off { color: #cbd5e1; }
.hist-section-title { font-size: 11px; font-weight: 700; color: var(--navy-700); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; margin-top: 14px; }
.hist-empty { text-align: center; padding: 40px 20px; color: #94a3b8; font-size: 13px; }

/* =========================================================================
   Modal Configuracion: chips de dispositivos por material
   ========================================================================= */
.adm-mat-devs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.adm-mat-devs .chip { background: var(--blue-050); color: var(--navy-700); font-size: 11px; padding: 4px 10px; border-radius: 6px; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--blue-200); transition: all .2s; }
.adm-mat-devs .chip input { width: 40px; text-align: center; border: 1px solid var(--blue-200); border-radius: 4px; padding: 2px 4px; font-size: 10px; }
.adm-mat-devs .chip-x { cursor: pointer; color: #ef4444; font-weight: 700; font-size: 12px; transition: all .2s; }
.adm-mat-devs .chip-x:hover { color: #c91f0d; font-size: 13px; }
.adm-add-dev-row { margin-top: 10px; display: flex; gap: 6px; align-items: center; }
.adm-add-dev-row select { font-size: 12px; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 8px; max-width: 160px; transition: border-color .2s; font-family: inherit; }
.adm-add-dev-row select:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(50, 116, 186, .15); }
.adm-add-dev-row input { width: 50px; font-size: 12px; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 8px; text-align: center; transition: border-color .2s; font-family: inherit; }
.adm-add-dev-row input:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(50, 116, 186, .15); }

/* =========================================================================
   Animaciones
   ========================================================================= */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; height: 0; } to { opacity: 1; height: auto; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }

/* =========================================================================
   Logos / branding inline
   ========================================================================= */
.toolbar-logo { height: 38px; width: auto; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .15)); flex-shrink: 0; }
.empty-logo { width: 120px; opacity: .15; margin-bottom: 8px; }
.modal-brand { width: 80px; opacity: .08; position: absolute; top: 20px; right: 20px; }

/* =========================================================================
   Responsive (media queries)
   ========================================================================= */
@media (max-width: 768px) {
  .hist-filters { grid-template-columns: 1fr; gap: 8px; }
  .hist-row-head { grid-template-columns: 1fr auto; }
  .hist-row-head .h-tec, .hist-row-head .h-guia, .hist-row-head .h-date { display: none; }
  .dash-kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-chart-wrap { height: 220px; }
  .toolbar { padding: 14px 16px; gap: 10px; }
  .toolbar h1 { font-size: 18px; }
  .toolbar .btn { padding: 8px 12px; font-size: 11px; }
  .grid-wrap { padding: 16px; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .modal { width: 95vw; padding: 24px; }
  .adm { width: 98vw; }
  .modal .dr { grid-template-columns: 1fr 60px 28px; }
}
@media (max-width: 480px) {
  .toolbar { padding: 12px 12px; }
  .toolbar .sep { display: none; }
  .toolbar h1 { font-size: 16px; width: 100%; }
  .toolbar .badge { font-size: 11px; padding: 6px 10px; }
  .grid-wrap { padding: 12px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .order-col { padding: 16px; }
  .modal { max-width: 98vw; padding: 20px; }
  .adm-tabs { overflow-x: auto; }
  .adm-tab { padding: 12px 14px; font-size: 12px; }
}

/* =========================================================================
   Login overlay (usa vars de numaris.css)
   ========================================================================= */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, var(--navy-500) 0%, var(--navy-700) 45%, var(--navy-900) 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  transition: opacity .5s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--navy-700);
  -webkit-font-smoothing: antialiased;
}
.login-overlay.hidden { opacity: 0; pointer-events: none; }
.login-overlay::before, .login-overlay::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(50, 116, 186, .18) 0%, rgba(50, 116, 186, 0) 70%);
  pointer-events: none;
  z-index: 0;
}
.login-overlay::before { width: 720px; height: 720px; top: -240px; right: -240px; }
.login-overlay::after { width: 520px; height: 520px; bottom: -160px; left: -160px; }
.login-card {
  background: #fff;
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(7, 11, 14, .28), 0 2px 6px rgba(7, 11, 14, .08);
  position: relative;
  z-index: 1;
  animation: scaleIn .35s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: left;
}
.login-brand { display: flex; justify-content: center; margin-bottom: 18px; }
.login-brand img { height: 44px; width: auto; }
.login-card h2 { font-size: 22px; font-weight: 700; text-align: center; margin: 0 0 28px 0; color: var(--navy-700); letter-spacing: -0.01em; }
.login-alert { margin: 0 0 18px 0; padding: 10px 14px; border-radius: 10px; font-size: 14px; line-height: 1.4; display: none; background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.login-alert.show { display: block; }
.login-field { margin-bottom: 16px; }
.login-field > label { display: block; font-size: 13px; font-weight: 600; color: var(--navy-700); margin-bottom: 6px; }
.login-input-wrap { position: relative; }
.login-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid #D6E0EC;
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
  color: var(--navy-700);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  font-family: inherit;
  text-align: left;
}
.login-input::placeholder { color: #9CA3AF; }
.login-input:hover { border-color: var(--blue-300); }
.login-input:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(50, 116, 186, .18); }
.login-input.has-toggle { padding-right: 46px; }
.login-eye { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); background: none; border: 0; padding: 6px; cursor: pointer; color: var(--blue-500); line-height: 0; border-radius: 6px; }
.login-eye:hover { background: var(--mist); }
.login-btn {
  width: 100%;
  height: 48px;
  margin-top: 8px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, var(--navy-700) 0%, var(--navy-800) 100%);
  box-shadow: 0 6px 16px rgba(24, 50, 90, .35);
  transition: transform .05s, box-shadow .15s, filter .15s;
  font-family: inherit;
}
.login-btn:hover { filter: brightness(1.08); }
.login-btn:active { transform: translateY(1px); }
.login-footer { position: absolute; bottom: 18px; left: 0; right: 0; z-index: 1; text-align: center; color: rgba(255, 255, 255, .72); font-size: 12.5px; letter-spacing: .02em; }
@media (max-width: 480px) {
  .login-card { padding: 32px 24px; border-radius: 14px; }
  .login-card h2 { font-size: 20px; margin-bottom: 22px; }
}

/* =========================================================================
   Sam 2026-06-10 — Banner QR para login rapido desde celular
   Fijo en esquina inferior derecha, siempre visible. Oculto en pantallas
   chicas (<768px) porque alli ya estamos en el cel.
   ========================================================================= */
.qr-banner {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 250;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .15);
  pointer-events: auto;
}
.qr-banner-canvas {
  width: 110px;
  height: 110px;
  background: #fff;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.qr-banner-canvas img,
.qr-banner-canvas canvas { display: block; width: 100% !important; height: 100% !important; }
.qr-banner-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.qr-banner-label strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-700);
  line-height: 1.2;
}
.qr-banner-label small {
  font-size: 11px;
  color: #64748b;
  line-height: 1.3;
}
@media (max-width: 768px) {
  .qr-banner { display: none; }
}

/* Toast de error de QR (si llega ?qr_error=expired al frontend). */
.qr-toast {
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  animation: fadeIn .25s ease;
}

/* ============================================================================
   Sam 2026-07-07 — MODO PICKING (vista tactil para tablets/celulares) + escaner N/S.
   z-index: picking 280 (bajo modal 300, sobre QR banner 250) · scanner 450
   (sobre modal 300 y admin 400, bajo login 500).
   ============================================================================ */
.picking-bg { display: none; position: fixed; inset: 0; background: #f1f5f9; z-index: 280; flex-direction: column; }
.picking-bg.show { display: flex; }
.pk-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--navy-700, #18325A); color: #fff; flex-wrap: wrap; }
.pk-top strong { font-size: 16px; }
.pk-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 14px; -webkit-overflow-scrolling: touch; }
.pk-empty { text-align: center; color: #64748b; padding: 40px 0; font-size: 15px; }
.pk-card { background: #fff; border: 1px solid #e2e8f0; border-left: 6px solid #3274BA; border-radius: 14px; padding: 14px; box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }
.pk-card.pk-done { border-left-color: #16a34a; }
.pk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.pk-sol { font-size: 18px; font-weight: 800; color: #18325A; }
.pk-sub { font-size: 13px; color: #475569; }
.pk-prog { font-size: 15px; font-weight: 800; color: #3274BA; background: #eff6ff; border-radius: 10px; padding: 6px 12px; white-space: nowrap; }
.pk-done .pk-prog { color: #16a34a; background: #f0fdf4; }
.pk-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #f1f5f9; flex-wrap: wrap; }
.pk-qty { min-width: 34px; text-align: center; font-weight: 800; font-size: 16px; color: #012750; background: #C6D9F1; border-radius: 8px; padding: 6px 4px; }
.pk-nm { flex: 1; min-width: 120px; font-size: 14px; font-weight: 600; color: #0f172a; }
.pk-ns { display: block; font-size: 11px; font-weight: 700; }
.pk-ns.ok { color: #16a34a; }
.pk-ns.falta { color: #b45309; }
/* Checkboxes de 24px con area tactil grande (todo el label es clickeable) */
.pk-ck { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #475569; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 14px; cursor: pointer; user-select: none; }
.pk-ck input { width: 24px; height: 24px; accent-color: #16a34a; margin: 0; }
.pk-ck.on { background: #f0fdf4; border-color: #16a34a; color: #166534; }
.pk-foto { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 10px; border-radius: 10px; font-size: 13px; font-weight: 700; }
.pk-foto-ok { background: #F0FDF4; border: 1px solid #16a34a; color: #166534; }
.pk-foto-no { background: #FEF9C3; border: 1px dashed #ca8a04; color: #854d0e; }
.pk-actions { display: flex; gap: 10px; margin-top: 10px; }
.pk-btn { border: none; border-radius: 10px; padding: 12px 16px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; }
.pk-btn-blue { background: #3274BA; color: #fff; }
.pk-btn-navy { background: #18325A; color: #fff; }
.pk-btn-gray { background: #e2e8f0; color: #0f172a; }
/* Escaner de N/S */
.scan-bg { display: none; position: fixed; inset: 0; background: #000; z-index: 450; align-items: center; justify-content: center; }
.scan-bg.show { display: flex; }
#scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: relative; width: min(70vw, 340px); height: min(40vh, 220px); border: 3px solid #22c55e; border-radius: 14px; box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .45); }
.scan-hint { position: absolute; bottom: 110px; left: 0; right: 0; text-align: center; color: #fff; font-size: 14px; font-weight: 600; text-shadow: 0 1px 4px #000; }
.scan-close { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); }
.ns-scan { border: 1px solid #cbd5e1; background: #f8fafc; border-radius: 6px; padding: 5px 9px; cursor: pointer; font-size: 14px; line-height: 1; }

/* Sam 2026-07-07 — fallback html5-qrcode: la libreria pinta su propio video +
   qrbox dentro de #scan-fallback; ocultamos el frame/hint nativos en ese modo. */
#scan-fallback { display: none; position: relative; width: 100%; max-width: 640px; }
#scan-fallback video { width: 100% !important; border-radius: 12px; }
.scan-bg.fallback .scan-frame, .scan-bg.fallback .scan-hint { display: none; }
