/* =====================================================================
   Kitchen Center · Órdenes — Sistema de diseño
   Una sola hoja de estilos para toda la plataforma.
   ===================================================================== */

:root {
  /* Marca */
  --navy-900: #0E2035;
  --navy-800: #132A45;
  --navy-700: #1B3A5C;
  --navy-100: #E9EEF5;
  --accent: #2F6FED;
  --accent-600: #255BD1;
  --accent-50: #DEE8FD;
  --accent-100: #C6D8FB;

  /*
   * Contraste pensado para cualquier monitor.
   * Muchas salidas HDMI trabajan en «rango limitado» (16-235): todo color con los tres
   * canales por encima de ~235 se ve blanco puro. Por eso los fondos de tono tienen al
   * menos un canal ≤ 215 y los bordes son lo bastante oscuros para separar las tarjetas.
   */
  /* Superficies y texto */
  --bg: #E9EDF3;
  --surface: #FFFFFF;
  --surface-2: #F1F4F8;
  --border: #D3DAE4;
  --border-strong: #B9C3D1;
  --text: #1B2430;
  --text-2: #475467;
  --muted: #5F6B7E;
  --placeholder: #8E99AB;

  /* Tonos semánticos: fondo suave / texto / borde */
  --blue-bg: #D6E3FC;   --blue-fg: #1E4FC2;   --blue-bd: #A9C3F6;
  --green-bg: #D2EFDD;  --green-fg: #0F6E34;  --green-bd: #9FD6B4;
  --amber-bg: #FBE3BF;  --amber-fg: #8A4504;  --amber-bd: #EDC27E;
  --yellow-bg: #F9EAB0; --yellow-fg: #735300; --yellow-bd: #E6CD6A;
  --red-bg: #FAD6D3;    --red-fg: #A61F15;    --red-bd: #EFA7A0;
  --purple-bg: #E4D8FC; --purple-fg: #6128CC; --purple-bd: #C3A9F7;
  --teal-bg: #CDEDE8;   --teal-fg: #0A6A61;   --teal-bd: #93D3CA;
  --indigo-bg: #DAD7FA; --indigo-fg: #3D32B8; --indigo-bd: #B2ACF2;
  --pink-bg: #F8D6E7;   --pink-fg: #A81B5D;   --pink-bd: #EDA6C8;
  --orange-bg: #FCDCC6; --orange-fg: #A93F08; --orange-bd: #F2B28A;
  --gray-bg: #D8DEE7;   --gray-fg: #3F4958;   --gray-bd: #BCC5D2;

  --success: #16A34A;
  --danger: #DC2626;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .18), 0 4px 12px rgba(15, 23, 42, .08);
  --focus: 0 0 0 3px rgba(47, 111, 237, .22);

  --sidebar-w: 252px;
  --topbar-h: 62px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg, video { max-width: 100%; }
.icon { flex-shrink: 0; display: inline-block; vertical-align: middle; }
h1, h2, h3, h4 { margin: 0; color: var(--navy-800); line-height: 1.3; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
::selection { background: var(--accent-100); }

/* ---------------------------------------------------------------------
   Estructura general
   --------------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--navy-800); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(135deg, #2F6FED, #5B8DF6);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; letter-spacing: -.3px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.brand-name { font-weight: 700; font-size: 14.5px; letter-spacing: .1px; }
.brand-sub { font-size: 11.5px; color: #9FB0C8; margin-top: 1px; }

.nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.nav-section { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; color: #7F93B0; padding: 16px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 8px; margin-bottom: 2px;
  color: #C9D5E6; font-size: 13.5px; font-weight: 500; transition: background .15s, color .15s;
}
.nav-link .icon { opacity: .85; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #5B8DF6; }
.nav-link.active .icon { opacity: 1; }
.nav-count {
  margin-left: auto; min-width: 22px; text-align: center; font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.14); color: #fff;
}
.nav-count.hot { background: #F59E0B; color: #1B2430; }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11.5px; color: #7F93B0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 26px;
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar-title a { color: var(--muted); }
.topbar-title strong { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.menu-toggle { display: none; }

.page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 26px 26px 60px; }
.page-narrow { max-width: 880px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -.2px; }
.page-header .subtitle { color: var(--muted); margin-top: 4px; font-size: 13.5px; max-width: 720px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 10px; }
.back-link:hover { color: var(--accent); text-decoration: none; }

/* ---------------------------------------------------------------------
   Tarjetas y rejillas
   --------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-header h2, .card-title { font-size: 14.5px; font-weight: 700; color: var(--navy-800); display: flex; align-items: center; gap: 8px; }
.card-header .hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.card-body { padding: 20px; }
.card-body.tight { padding: 14px 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.card + .card, .card + .section, .section + .card { margin-top: 18px; }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card:not([open]) > summary { border-bottom: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-head .hint { font-size: 12.5px; color: var(--muted); }

/* Indicadores */
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; position: relative; }
a.stat { color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 25px; font-weight: 700; color: var(--navy-800); line-height: 1.2; margin-top: 2px; letter-spacing: -.3px; }
/* Montos: con más de una moneda («S/ … · US$ …») el texto puede pasar a dos líneas */
.stat-value.stat-money { font-size: 21px; line-height: 1.25; }
.stat-hint { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------------------------------------------------------------------
   Botones
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.2;
  padding: 9px 15px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
  box-shadow: var(--shadow-sm); text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: #B9C2D0; }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #12883D; border-color: #12883D; }
.btn-danger { background: var(--surface); border-color: var(--red-bd); color: var(--red-fg); }
.btn-danger:hover { background: var(--red-bg); border-color: #EFA9A3; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #B91C1C; border-color: #B91C1C; }
.btn-warning { background: var(--surface); border-color: var(--amber-bd); color: var(--amber-fg); }
.btn-warning:hover { background: var(--amber-bg); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--gray-bg); border-color: transparent; }
.btn-sm { font-size: 12.5px; padding: 6px 11px; border-radius: 7px; }
.btn-lg { font-size: 14.5px; padding: 11px 20px; }
.btn-block { width: 100%; }
.btn-icon { padding: 7px; }
.btn .spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------
   Formularios
   --------------------------------------------------------------------- */
/* Cada paso: el título arriba y su bloque debajo, a todo el ancho */
.form-section { padding: 20px 24px 22px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.form-section:last-of-type { border-bottom: 0; }
.form-section-head h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 9px; color: var(--navy-800); }
.form-section-head .step {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent-50); color: var(--accent);
  font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  flex: none; min-width: 0; /* no heredar el ancho de los pasos del indicador de progreso (.step) */
}
.form-section-head p { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field + .field { margin-top: 14px; }
.form-grid .field + .field { margin-top: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.label .req { color: var(--danger); font-weight: 700; }
.label .opt { color: var(--muted); font-weight: 400; font-size: 12px; }
.help { font-size: 12px; color: var(--muted); line-height: 1.45; }
/* Guía de qué escribir (cambia según el tipo de solicitud) */
.guide { background: var(--blue-bg); border: 1px solid var(--blue-bd); color: #1D3F8F; border-radius: 8px; padding: 9px 14px 9px 12px; margin-bottom: 8px; font-size: 13px; }
.guide-title { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.guide ul { margin: 4px 0 0; padding-left: 26px; line-height: 1.6; }
.help b { color: var(--text); font-weight: 600; }
/* Bloque opcional plegable (p. ej. activos en Nueva solicitud): cerrado muestra solo la pregunta y lo elegido */
.plegable { border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.plegable > summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; border-radius: 10px; }
.plegable > summary::-webkit-details-marker { display: none; }
.plegable > summary:hover { background: var(--surface-2); }
.plegable > summary:focus-visible { outline: none; box-shadow: var(--focus); }
.plegable-icon { flex: none; width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--teal-bg); color: var(--teal-fg); }
.plegable-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.plegable-titulo { font-weight: 600; font-size: 14px; color: var(--text); }
.plegable-titulo .opt { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.plegable-resumen { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plegable.con-seleccion { border-color: var(--accent); }
.plegable.con-seleccion .plegable-resumen { color: var(--accent); font-weight: 600; }
.plegable-flecha { flex: none; color: var(--muted); transition: transform .2s; display: flex; }
.plegable[open] > summary { border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0; }
.plegable[open] .plegable-flecha { transform: rotate(180deg); }
.plegable-cuerpo { padding: 12px 14px 14px; display: grid; gap: 8px; }
.plegable[open] .plegable-cuerpo { animation: plegable-in .18s ease-out; }
@keyframes plegable-in { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .plegable-flecha { transition: none; } .plegable[open] .plegable-cuerpo { animation: none; } }
@media (max-width: 760px) { .plegable-resumen { white-space: normal; } }

/* Selector de varios activos (casillas, agrupados por tipo) */
.ap { border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); overflow: hidden; }
.ap-tools { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.ap-buscar { flex: 1; min-width: 0; }
.ap-contador { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ap-list { max-height: 320px; overflow-y: auto; }
.ap-group + .ap-group { border-top: 1px solid var(--border); }
.ap-group-head { display: flex; align-items: center; justify-content: space-between; padding: 7px 12px 3px; font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; }
.ap-todos { background: none; border: 0; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 4px; text-transform: none; letter-spacing: 0; }
.ap-todos:hover { text-decoration: underline; }
.ap-item { display: flex; align-items: center; gap: 10px; padding: 2px 12px 2px 8px; }
.ap-item.on { background: var(--accent-50); }
.ap-check { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px 4px; cursor: pointer; }
.ap-check input { width: 17px; height: 17px; flex: none; accent-color: var(--accent); }
.ap-main { display: flex; flex-direction: column; min-width: 0; }
.ap-nombre { font-weight: 600; font-size: 13.5px; }
.ap-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-km { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.ap-km input { width: 110px; padding: 5px 8px; font-size: 13px; }
.ap-vacio { padding: 14px; font-size: 13px; color: var(--muted); }

/* Reparto del costo entre los activos de una visita */
.reparto-box { border: 1px solid var(--blue-bd); background: var(--blue-bg); border-radius: 10px; padding: 12px 14px; }
.reparto-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: #1D3F8F; }
.reparto-head .help { color: #1D3F8F; opacity: .85; }
.reparto-head .btn { flex: none; }
.reparto-filas { display: grid; gap: 6px; }
.reparto-fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px 6px 12px; }
.reparto-nombre { display: flex; flex-direction: column; min-width: 0; }
.reparto-nombre .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.input-group.input-sm { width: 180px; flex: none; }
.input-group.input-sm input { padding: 6px 10px; text-align: right; font-variant-numeric: tabular-nums; }
.input-group.input-sm .addon { padding: 0 9px; font-size: 12px; }
.reparto-pie { margin-top: 8px; text-align: right; }
.reparto-suma { font-size: 13px; color: var(--text-2); }
.reparto-suma.ok { color: var(--green-fg); font-weight: 600; }
.reparto-suma.bad { color: var(--red-fg); font-weight: 600; }
.check-list { display: grid; gap: 6px; }
.lista-equipos { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
@media (max-width: 760px) {
  .ap-item { flex-wrap: wrap; }
  .reparto-head { flex-direction: column; }
  .reparto-fila { flex-direction: column; align-items: stretch; }
  .input-group.input-sm { width: 100%; }
}

/* Contacto en sitio de la tienda (junto a la dirección) */
.contacto-sitio { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 2px; }
.contacto-sitio a { display: inline-flex; align-items: center; gap: 4px; }

/* Archivo recién elegido (aún sin guardar): se puede abrir en el visor */
.file-item.file-local { cursor: pointer; transition: border-color .15s, background .15s; }
.file-item.file-local:hover { border-color: var(--accent); background: var(--accent-50); }
.file-item.file-local:focus-visible { outline: none; box-shadow: var(--focus); }

/* Ayuda para elegir categoría: solo la de la opción elegida, bajo la lista */
.cat-select { max-width: 420px; }
.cat-help { margin-top: 8px; }
.cat-help-item { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 14px 10px 12px; font-size: 13px; }
.cat-help-item.cat-in { animation: cat-in .22s ease-out; }
@keyframes cat-in { from { opacity: 0; transform: translateY(-3px); } }
.cat-help-que { margin: 0; color: var(--text); }
.cat-help-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.cat-help-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 18px; color: var(--text-2); line-height: 1.45; }
.cat-help-list li { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.cat-area { flex: none; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; line-height: 17px; }
.cat-help-no { display: flex; gap: 6px; align-items: flex-start; margin: 8px 0 0; padding-top: 7px; border-top: 1px dashed var(--border); color: var(--text-2); font-size: 12.5px; }
.cat-help-no .icon { flex: none; margin-top: 2px; color: var(--accent); }
@media (max-width: 760px) { .cat-help-list { grid-template-columns: 1fr; } .cat-select { max-width: none; } }
@media (prefers-reduced-motion: reduce) { .cat-help-item.cat-in { animation: none; } }

/* Preguntas del proveedor y sus respuestas */
.qa { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.qa.qa-open { border-color: var(--blue-bd); box-shadow: 0 0 0 3px var(--blue-bg); }
.qa-q, .qa-a { padding: 10px 14px; }
.qa-q { background: var(--surface-2); }
.qa-a { border-top: 1px solid var(--border); }
.qa-who { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.qa-text { white-space: pre-line; font-size: 14px; line-height: 1.55; }
.qa-a .label { margin-bottom: 4px; }

.input, .select, .textarea,
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--text);
  padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
  transition: border-color .15s, box-shadow .15s; box-shadow: var(--shadow-sm);
}
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:hover, select:hover, textarea:hover { border-color: #B6C0CF; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
input:disabled, select:disabled, textarea:disabled { background: var(--gray-bg); color: var(--muted); cursor: not-allowed; }
.is-invalid, .is-invalid:hover { border-color: var(--danger) !important; background-color: #FFFBFB; }
.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .16) !important; }
.field-error { display: flex; align-items: flex-start; gap: 6px; color: var(--red-fg); font-size: 12.5px; font-weight: 500; }
.field-error .icon { margin-top: 1px; }

.input-group { display: flex; align-items: stretch; }
.input-group .addon {
  display: flex; align-items: center; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-right: 0; border-radius: 8px 0 0 8px; color: var(--muted); font-weight: 600; font-size: 13px;
}
.input-group input { border-radius: 0 8px 8px 0; }
/* Selector de moneda como prefijo del monto (Soles por defecto) */
.input-group select.addon-select {
  width: auto; flex: none; min-width: 0; padding: 0 30px 0 12px; background-color: var(--surface-2);
  /* .addon usa «background» abreviado y borraría la flecha de los select: se vuelve a poner */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
  border: 1px solid var(--border-strong); border-radius: 8px 0 0 8px; color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer;
}
.input-group select.addon-select:focus { position: relative; z-index: 1; }
.input-password { position: relative; }
.input-password input { padding-right: 42px; }
.input-password button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); padding: 6px; cursor: pointer; border-radius: 6px; }
.input-password button:hover { color: var(--text); background: var(--gray-bg); }

/* Tarjetas de opción (radio grande) */
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1.5px solid var(--border-strong); border-radius: 12px;
  background: var(--surface); transition: border-color .15s, background .15s, box-shadow .15s; height: 100%;
}
.choice:hover .choice-body { border-color: #A9B6CA; }
.choice input:checked + .choice-body { border-color: var(--accent); background: var(--accent-50); box-shadow: 0 0 0 1px var(--accent); }
.choice input:focus-visible + .choice-body { box-shadow: var(--focus); }
.choice-icon { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.choice-title { font-weight: 700; font-size: 14px; color: var(--navy-800); }
.choice-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.choice-check { margin-left: auto; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; }
.choice input:checked + .choice-body .choice-check { background: var(--accent); border-color: var(--accent); }

/* Casilla e interruptor */
.check { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: #CBD2DD; position: relative; transition: background .15s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }

/* Zona de archivos */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 18px; text-align: center; background: var(--surface-2);
  transition: border-color .15s, background .15s; cursor: pointer; position: relative;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-50); }
.dropzone.is-invalid { border-color: var(--danger); background: #FFFBFB; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; color: var(--accent); margin-bottom: 8px; }
.dropzone-title { font-weight: 600; font-size: 13.5px; }
.dropzone-title span { color: var(--accent); }
.dropzone-hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.file-list:empty { display: none; }
.file-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  font-size: 13px; min-width: 0;
}
a.file-item { color: inherit; transition: border-color .15s, background .15s; }
a.file-item:hover { text-decoration: none; border-color: var(--accent-100); background: var(--accent-50); }
.file-thumb { width: 34px; height: 34px; border-radius: 7px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--gray-bg); color: var(--gray-fg); overflow: hidden; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb.pdf { background: var(--red-bg); color: var(--red-fg); }
.file-thumb.img { background: var(--blue-bg); color: var(--blue-fg); }
.file-thumb.vid { background: var(--purple-bg); color: var(--purple-fg); }
.file-meta { min-width: 0; flex: 1; }
.file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-sub { font-size: 11.5px; color: var(--muted); }
.file-remove { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 5px; border-radius: 6px; display: flex; }
.file-remove:hover { color: var(--red-fg); background: var(--red-bg); }

/* ---------------------------------------------------------------------
   Avisos (alertas en página)
   --------------------------------------------------------------------- */
.alert { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; border: 1px solid; font-size: 13.5px; line-height: 1.5; }
.alert .icon { margin-top: 1px; }
.alert-title { font-weight: 700; }
.alert + .alert { margin-top: 10px; }
.alert-info { background: var(--blue-bg); border-color: var(--blue-bd); color: #1D3F8F; }
.alert-success { background: var(--green-bg); border-color: var(--green-bd); color: #0D5C2C; }
.alert-warning { background: var(--amber-bg); border-color: var(--amber-bd); color: #7A3D04; }
.alert-error { background: var(--red-bg); border-color: var(--red-bd); color: #8F1C13; }
.alert-neutral { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.alert a { color: inherit; text-decoration: underline; font-weight: 600; }

/* Toasts (mensajes tras una acción) */
.toasts { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 300; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 11px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 13px 14px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in .25s ease-out;
}
.toast.success { border-left-color: var(--success); } .toast.success > .icon { color: var(--success); }
.toast.error { border-left-color: var(--danger); } .toast.error > .icon { color: var(--danger); }
.toast.warning { border-left-color: #F59E0B; } .toast.warning > .icon { color: #D97706; }
.toast.info > .icon { color: var(--accent); }
.toast-close { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 5px; display: flex; }
.toast-close:hover { background: var(--gray-bg); color: var(--text); }
.toast.hide { opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------------------------------------------------------------------
   Badges y etiquetas
   --------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; line-height: 1.3;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-lg { font-size: 12.5px; padding: 5px 12px; }
.badge-blue { background: var(--blue-bg); color: var(--blue-fg); border-color: var(--blue-bd); }
.badge-green { background: var(--green-bg); color: var(--green-fg); border-color: var(--green-bd); }
.badge-amber { background: var(--amber-bg); color: var(--amber-fg); border-color: var(--amber-bd); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow-fg); border-color: var(--yellow-bd); }
.badge-red { background: var(--red-bg); color: var(--red-fg); border-color: var(--red-bd); }
.badge-purple { background: var(--purple-bg); color: var(--purple-fg); border-color: var(--purple-bd); }
.badge-teal { background: var(--teal-bg); color: var(--teal-fg); border-color: var(--teal-bd); }
.badge-indigo { background: var(--indigo-bg); color: var(--indigo-fg); border-color: var(--indigo-bd); }
.badge-pink { background: var(--pink-bg); color: var(--pink-fg); border-color: var(--pink-bd); }
.badge-orange { background: var(--orange-bg); color: var(--orange-fg); border-color: var(--orange-bd); }
.badge-gray { background: var(--gray-bg); color: var(--gray-fg); border-color: var(--gray-bd); }
.badge-navy { background: var(--navy-800); color: #fff; }
.tag-order { font-family: var(--mono); font-weight: 700; letter-spacing: .3px; font-size: 11px; padding: 2px 7px; border-radius: 5px; }

.tone-blue { background: var(--blue-bg); color: var(--blue-fg); }
.tone-green { background: var(--green-bg); color: var(--green-fg); }
.tone-amber { background: var(--amber-bg); color: var(--amber-fg); }
.tone-red { background: var(--red-bg); color: var(--red-fg); }
.tone-purple { background: var(--purple-bg); color: var(--purple-fg); }
.tone-teal { background: var(--teal-bg); color: var(--teal-fg); }
.tone-indigo { background: var(--indigo-bg); color: var(--indigo-fg); }
.tone-pink { background: var(--pink-bg); color: var(--pink-fg); }
.tone-orange { background: var(--orange-bg); color: var(--orange-fg); }
.tone-gray { background: var(--gray-bg); color: var(--gray-fg); }
.tone-yellow { background: var(--yellow-bg); color: var(--yellow-fg); }

.priority { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.priority .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---------------------------------------------------------------------
   Tablas
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
  padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th:first-child { border-top-left-radius: var(--radius-lg); }
.table th:last-child { border-top-right-radius: var(--radius-lg); }
.card-header + .table-wrap .table th { border-radius: 0; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: #EEF2F8; }
.table tr[data-href] { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn + .btn, .table .actions form + form, .table .actions .btn + form, .table .actions form + .btn { margin-left: 6px; }
.table .actions form { display: inline; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.code { font-family: var(--mono); font-weight: 700; font-size: 12.5px; color: var(--navy-800); white-space: nowrap; }
.table-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.search { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--placeholder); pointer-events: none; }
.search input { padding-left: 36px; }
.table-toolbar select { width: auto; min-width: 170px; }
.table-foot { padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Pestañas */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .count { font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 999px; background: var(--gray-bg); color: var(--gray-fg); line-height: 18px; }
.tab.active .count { background: var(--accent-50); color: var(--accent); }
.card > .tabs { padding: 0 12px; margin-bottom: 0; }

/* Estado vacío */
.empty { text-align: center; padding: 44px 24px; }
.empty-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--gray-bg); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.empty h3 { font-size: 15px; }
.empty p { color: var(--muted); font-size: 13px; margin: 5px auto 0; max-width: 420px; }
.empty .btn { margin-top: 16px; }
.empty-sm { padding: 24px 16px; }
.empty-sm .empty-icon { width: 40px; height: 40px; }

/* Lista clave–valor */
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 11px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* Avatar y menú de usuario */
.avatar { width: 34px; height: 34px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px; flex-shrink: 0; letter-spacing: .2px; }
.avatar-sm { width: 26px; height: 26px; font-size: 10.5px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid transparent; background: none; cursor: pointer; font-family: inherit; text-align: left; }
.user-chip:hover, .user-chip[aria-expanded=true] { background: var(--surface-2); border-color: var(--border); }
.user-chip .u-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.2; }
.user-chip .u-role { font-size: 11.5px; color: var(--muted); }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; display: none;
}
.dropdown.open .dropdown-menu { display: block; animation: toast-in .15s ease-out; }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); font-size: 13.5px; width: 100%; border: 0; background: none; cursor: pointer; font-family: inherit; text-align: left; }
.dropdown-item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-item.danger { color: var(--red-fg); }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.dropdown-head { padding: 10px 10px 8px; }

.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover, .icon-btn[aria-expanded=true] { background: var(--surface-2); border-color: var(--border); }
.icon-btn .dot-count { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }

.notif-menu { width: 380px; padding: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 13.5px; }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-item { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 13px; }
.notif-item:hover { background: var(--surface-2); text-decoration: none; }
.notif-item.unread { background: var(--blue-bg); }
.notif-item.unread .notif-title::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: middle; }
.notif-title { font-weight: 600; }
.notif-msg { color: var(--text-2); margin-top: 1px; }
.notif-time { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.notif-foot { padding: 10px 14px; text-align: center; font-size: 13px; }

/* ---------------------------------------------------------------------
   Modales (elemento <dialog>)
   --------------------------------------------------------------------- */
dialog.modal {
  border: 0; padding: 0; border-radius: 16px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  box-shadow: var(--shadow-lg); color: var(--text); background: var(--surface);
}
dialog.modal.modal-lg { width: min(760px, calc(100vw - 32px)); }
dialog.modal.modal-sm { width: min(440px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .55); }
dialog.modal[open] { animation: modal-in .2s ease-out; display: flex; flex-direction: column; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head .modal-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modal-head h3 { font-size: 16px; }
.modal-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.modal-close { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: flex; }
.modal-close:hover { background: var(--gray-bg); color: var(--text); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 16px 16px; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   Línea de progreso de la solicitud
   --------------------------------------------------------------------- */
.stepper { display: flex; align-items: flex-start; padding: 20px 22px 18px; overflow-x: auto; gap: 0; }
.step { flex: 1; min-width: 92px; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; }
.step::before { content: ""; position: absolute; top: 14px; left: calc(-50% + 18px); right: calc(50% + 18px); height: 2px; background: var(--border); }
.step:first-child::before { display: none; }
.step.done::before, .step.current::before { background: var(--success); }
.step-dot {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; position: relative; z-index: 1;
}
.step.done .step-dot { background: var(--success); border-color: var(--success); color: #fff; }
.step.current .step-dot { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 5px var(--accent-100); }
.step.warn .step-dot { background: #F59E0B; border-color: #F59E0B; color: #fff; box-shadow: 0 0 0 5px #FDEFC8; }
.step.fail .step-dot { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: 0 0 0 5px var(--red-bg); }
.step-label { font-size: 12px; color: var(--muted); margin-top: 9px; font-weight: 500; line-height: 1.3; padding: 0 4px; }
.step.done .step-label { color: var(--text-2); }
.step.current .step-label, .step.warn .step-label, .step.fail .step-label { color: var(--text); font-weight: 700; }
.step-when { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Barra "qué sigue" */
.next-step { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap; }
.next-step .ns-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.next-step .ns-text { flex: 1; min-width: 220px; font-size: 13.5px; }
.next-step .ns-text strong { display: block; color: var(--navy-800); }
.next-step .ns-text span { color: var(--text-2); }

/* ---------------------------------------------------------------------
   Historial (línea de tiempo)
   --------------------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 14px; position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 2px; width: 2px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.tl-body { flex: 1; min-width: 0; padding-top: 3px; }
.tl-title { font-weight: 600; font-size: 13.5px; color: var(--text); }
.tl-meta { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.tl-meta .who { color: var(--text-2); font-weight: 600; }
.tl-note { margin-top: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; font-size: 13px; color: var(--text-2); white-space: pre-line; }
.tl-note.warn { background: var(--yellow-bg); border-color: var(--yellow-bd); color: #5E4500; }
.tl-note.bad { background: var(--red-bg); border-color: var(--red-bd); color: #7D1B12; }
.tl-state { display: inline-flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 12px; color: var(--muted); }
.tl-file { margin-top: 8px; }
.tl-day { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 4px 0 14px; display: flex; align-items: center; gap: 10px; }
.tl-day::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.tl-system .tl-title { font-weight: 500; color: var(--text-2); }

/* Comparación de montos */
.compare { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.compare-box { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface); }
.compare-box .lbl { font-size: 12px; color: var(--muted); font-weight: 500; }
.compare-box .val { font-size: 21px; font-weight: 700; color: var(--navy-800); margin-top: 2px; font-variant-numeric: tabular-nums; }
.compare-result { margin-top: 12px; }

/* Barras simples (reportes) */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 110px; gap: 12px; align-items: center; font-size: 13px; }
.bar-label { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; border-radius: 999px; background: var(--gray-bg); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); min-width: 3px; }
.bar-val { text-align: right; font-weight: 700; color: var(--navy-800); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------
   Pantalla de acceso
   --------------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-aside {
  background: radial-gradient(120% 90% at 0% 0%, #1F4A7A 0%, var(--navy-800) 55%, var(--navy-900) 100%);
  color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-aside::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; border: 60px solid rgba(255,255,255,.04); }
.auth-aside h2 { color: #fff; font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -.5px; max-width: 460px; }
.auth-aside p.lead { color: #B9C7DB; font-size: 15px; margin-top: 14px; max-width: 460px; }
.auth-points { list-style: none; padding: 0; margin: 30px 0 0; display: flex; flex-direction: column; gap: 14px; max-width: 460px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; color: #D5DFEC; font-size: 14px; }
.auth-points .icon { color: #7FA7F8; margin-top: 2px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 24px; font-weight: 700; letter-spacing: -.3px; }
.auth-card .subtitle { color: var(--muted); margin: 6px 0 26px; }
.auth-foot { color: #7F93B0; font-size: 12px; }

/* Página de error */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.error-card { max-width: 520px; text-align: center; }
.error-code { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 1px; }
.error-card h1 { font-size: 24px; margin-top: 8px; }
.error-card p { color: var(--muted); margin-top: 10px; }
.error-debug { text-align: left; background: #0E2035; color: #D5DFEC; font-family: var(--mono); font-size: 12px; padding: 14px; border-radius: 10px; margin-top: 18px; max-height: 300px; overflow: auto; white-space: pre-wrap; }

/* ---------------------------------------------------------------------
   Visor de adjuntos (imágenes, PDF, videos) — assets/js/viewer.js
   --------------------------------------------------------------------- */
.file-open { color: var(--muted); display: inline-flex; padding: 4px; border-radius: 6px; transition: color .15s, background .15s; }
a.file-item:hover .file-open { color: var(--accent); background: var(--surface); }
html.vw-open { overflow: hidden; }
/* Computadora: recuadro amplio y centrado sobre la pantalla oscurecida.
   .vw-full (botón «Ampliar» o tecla F) lo lleva a toda la ventana. */
dialog.viewer {
  border: 0; padding: 0; margin: auto; inset: 0;
  width: min(1320px, calc(100vw - 96px));
  height: min(940px, calc(100vh - 80px)); height: min(940px, calc(100dvh - 80px));
  max-width: 100vw; max-height: 100vh; border-radius: 14px;
  background: #0E1826; color: #E8EEF6; display: none; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.07);
  transition: width .2s ease, height .2s ease, border-radius .2s ease;
}
@media (max-width: 1100px) {
  dialog.viewer { width: calc(100vw - 40px); height: calc(100vh - 40px); height: calc(100dvh - 40px); }
}
dialog.viewer.vw-full { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; }
dialog.viewer[open] { display: flex; animation: vw-in .18s ease-out; }
dialog.viewer::backdrop { background: rgba(8, 14, 24, .74); animation: vw-fade .18s ease-out; }
@keyframes vw-in { from { opacity: 0; transform: scale(.975); } }
@keyframes vw-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  dialog.viewer, dialog.viewer[open], dialog.viewer::backdrop { animation: none; transition: none; }
}
.vw-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 18px; border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(14, 32, 53, .9); flex-shrink: 0; min-height: 60px; }
.vw-title { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.vw-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: rgba(255,255,255,.08); color: #BFD3F7; }
.vw-name { font-weight: 600; font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-meta { font-size: 12px; color: #9FB0C8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-tools { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.vw-group { display: flex; align-items: center; gap: 2px; padding: 0 6px; margin-right: 4px; border-right: 1px solid rgba(255,255,255,.12); }
.vw-btn {
  width: 38px; height: 38px; border-radius: 9px; border: 0; background: transparent; color: #D5DFEC; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; transition: background .15s, color .15s;
}
.vw-btn:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.vw-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(91,141,246,.55); }
.vw-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.vw-close { background: rgba(255,255,255,.08); margin-left: 6px; }
.vw-close:hover { background: #DC2626; }
.vw-zoomval { min-width: 50px; text-align: center; font-size: 12.5px; font-weight: 600; color: #D5DFEC; font-variant-numeric: tabular-nums; background: none; border: 0; cursor: pointer; padding: 6px 4px; border-radius: 7px; }
.vw-zoomval:hover { background: rgba(255,255,255,.1); }
.vw-count { font-size: 12.5px; color: #9FB0C8; padding: 0 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.vw-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.vw-content { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px 72px; }
.vw-img { max-width: none; max-height: none; user-select: none; -webkit-user-drag: none; transform-origin: center center; box-shadow: 0 8px 40px rgba(0,0,0,.45); background: #fff; will-change: transform; }
.vw-img.dragging { cursor: grabbing; }
.vw-img.can-pan { cursor: grab; }
.vw-frame { width: 100%; height: 100%; max-width: 1100px; border: 0; border-radius: 6px; background: #fff; box-shadow: 0 8px 40px rgba(0,0,0,.45); }
.vw-video { max-width: 100%; max-height: 100%; border-radius: 8px; background: #000; box-shadow: 0 8px 40px rgba(0,0,0,.45); }
.vw-card { background: var(--surface); color: var(--text); border-radius: 16px; padding: 32px 30px 26px; max-width: 420px; width: 100%; text-align: center; box-shadow: 0 12px 50px rgba(0,0,0,.4); }
.vw-card .vw-card-icon { width: 60px; height: 60px; border-radius: 14px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; }
.vw-card h3 { font-size: 16px; word-break: break-word; }
.vw-card p { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.vw-card .row { justify-content: center; margin-top: 18px; }
.vw-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 46px; height: 46px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s, opacity .15s;
}
.vw-nav:hover { background: rgba(255,255,255,.22); }
.vw-nav:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(91,141,246,.55); }
.vw-prev { left: 14px; } .vw-next { right: 14px; }
.vw-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.vw-loading .spinner { width: 34px; height: 34px; border-width: 3px; color: #7FA7F8; }
.vw-hint { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); font-size: 12px; color: #9FB0C8; background: rgba(14,32,53,.85); padding: 5px 12px; border-radius: 999px; pointer-events: none; transition: opacity .4s; white-space: nowrap; }
.vw-strip { display: flex; gap: 8px; padding: 10px 14px; overflow-x: auto; justify-content: safe center; border-top: 1px solid rgba(255,255,255,.08); background: rgba(14, 32, 53, .9); flex-shrink: 0; }
.vw-thumb {
  width: 58px; height: 46px; border-radius: 8px; border: 2px solid transparent; background: rgba(255,255,255,.08); color: #BFD3F7;
  flex-shrink: 0; cursor: pointer; padding: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; opacity: .65; transition: opacity .15s, border-color .15s;
}
.vw-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vw-thumb:hover { opacity: 1; }
.vw-thumb.active { border-color: #5B8DF6; opacity: 1; }
.vw-thumb:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(91,141,246,.55); }
@media (max-width: 760px) {
  /* Celular: aprovecha toda la pantalla */
  dialog.viewer, dialog.viewer.vw-full { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; }
  .vw-bar { padding: 8px 8px 8px 12px; gap: 8px; min-height: 54px; }
  .vw-icon, .vw-group-zoom, .vw-open-tab, .vw-expand { display: none !important; }
  .vw-content { padding: 10px; }
  .vw-nav { width: 40px; height: 40px; background: rgba(14,32,53,.7); }
  .vw-prev { left: 6px; } .vw-next { right: 6px; }
  .vw-count { padding: 0 4px; }
}
@media (max-height: 560px) {
  dialog.viewer, dialog.viewer.vw-full { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; }
  .vw-expand { display: none !important; }
}
@media print { dialog.viewer { display: none !important; } }

/* Calendario de días trabajados (selección múltiple) */
.datepick { border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px; background: var(--surface); max-width: 340px; }
.datepick.is-invalid { border-color: var(--danger); }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-title { font-weight: 700; color: var(--navy-800); font-size: 14px; text-transform: capitalize; }
.dp-nav { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; }
.dp-nav:hover:not(:disabled) { background: var(--surface-2); }
.dp-nav:disabled { opacity: .35; cursor: not-allowed; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dp-wd { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; text-transform: uppercase; }
.dp-day {
  position: relative; height: 38px; border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 500; color: var(--text);
}
.dp-day:hover:not(:disabled) { background: var(--blue-bg); }
.dp-day:focus-visible { outline: none; box-shadow: var(--focus); }
.dp-day.today { border-color: var(--border-strong); font-weight: 700; }
.dp-day.sel { background: var(--accent); color: #fff; font-weight: 700; }
.dp-day.prev::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #D97706; }
.dp-day.sel.prev::after { background: #fff; }
.dp-day:disabled { color: #A3ADBD; cursor: not-allowed; }
.dp-foot { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12.5px; }
.dp-count { font-weight: 700; color: var(--navy-800); }
.dp-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; color: var(--muted); font-size: 11.5px; }
.dp-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.rondas { display: flex; flex-direction: column; gap: 6px; }
.ronda { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-weight: 400; }
.ronda b { font-weight: 700; }

/* Vista previa de correo */
.mail-frame { width: 100%; height: 560px; border: 1px solid var(--border); border-radius: 12px; background: #F3F5F9; }

/* ---------------------------------------------------------------------
   Utilidades
   --------------------------------------------------------------------- */
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); }
.hidden, [hidden] { display: none !important; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.w-100 { width: 100%; }
.inline { display: inline; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.divider-text { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin: 18px 0 12px; }
.divider-text::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------------------------------------------------------------
   Pantallas medianas y pequeñas
   --------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 35; }
  .menu-toggle { display: inline-flex; }
  .form-section { padding: 18px 16px 20px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
}
@media (max-width: 760px) {
  .page { padding: 18px 16px 48px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .user-chip .u-text { display: none; }
  .grid-2, .grid-3, .grid-4, .form-grid, .choice-grid { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .compare { grid-template-columns: minmax(0, 1fr); }
  .bar-row { grid-template-columns: 110px minmax(0, 1fr) 90px; }
  .notif-menu { width: calc(100vw - 24px); right: -60px; }
  .page-header h1 { font-size: 19px; }
  .toasts { right: 16px; left: 16px; bottom: 16px; }
}
@media print {
  .sidebar, .topbar, .page-actions, .toasts, .next-step .btn { display: none !important; }
  .page { padding: 0; max-width: none; }
  body { background: #fff; }
}
