/* ============================================================================
   Transvida CRM — Prototipo navegable
   styles.css · tema de marca, layout responsive y componentes base
   ========================================================================== */

/* ----------------------------------------------------------------------------
   1. Tokens de marca (variables CSS)
   -------------------------------------------------------------------------- */
:root {
  /* Marca — verde ambiental (primario) */
  --tv-primary: #1F7A5C;          /* verde corporativo */
  --tv-primary-bright: #16a36f;   /* verde vivo (acentos / hover) */
  --tv-primary-dark: #155c45;
  --tv-primary-soft: #e3f1ec;     /* fondos suaves verdes */

  /* Marca — azul petróleo (secundario) */
  --tv-secondary: #0F3D52;
  --tv-secondary-bright: #16597a;
  --tv-secondary-soft: #e2edf2;

  /* Neutros / superficie / texto */
  --tv-bg: #F5F7F6;               /* fondo general de la app */
  --tv-surface: #ffffff;          /* tarjetas, paneles */
  --tv-surface-alt: #f0f3f2;      /* zonas alternas (filas, headers) */
  --tv-text: #1b2430;             /* texto principal */
  --tv-text-soft: #5b6572;        /* texto secundario */
  --tv-text-muted: #8a94a1;       /* texto atenuado */
  --tv-border: #dde3e1;           /* bordes */
  --tv-border-strong: #c3ccc8;

  /* Colores semánticos */
  --tv-success: #1f8f54;
  --tv-success-soft: #e4f4ea;
  --tv-warning: #c8871a;          /* ámbar advertencia */
  --tv-warning-soft: #fbf0da;
  --tv-danger: #c23b3b;           /* rojo peligro */
  --tv-danger-soft: #fae3e3;
  --tv-info: #2f6fb0;
  --tv-info-soft: #e2edf7;

  /* Sombra / radios / espaciado */
  --tv-shadow-sm: 0 1px 2px rgba(16, 36, 48, .08);
  --tv-shadow: 0 2px 10px rgba(16, 36, 48, .10);
  --tv-shadow-lg: 0 10px 40px rgba(16, 36, 48, .18);
  --tv-radius-sm: 6px;
  --tv-radius: 10px;
  --tv-radius-lg: 16px;

  /* Layout */
  --tv-sidebar-w: 248px;
  --tv-sidebar-w-collapsed: 68px;
  --tv-topbar-h: 60px;

  --tv-ring: 0 0 0 3px rgba(31, 122, 92, .30); /* anillo de foco */

  --tv-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ----------------------------------------------------------------------------
   2. Reset ligero y base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--tv-font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--tv-text);
  background: var(--tv-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 { margin: 0 0 .4em; font-weight: 700; line-height: 1.25; }

a { color: var(--tv-primary); text-decoration: none; }
a:hover { color: var(--tv-primary-dark); }

img { max-width: 100%; display: block; }

/* Utilidad de ocultación */
.is-hidden,
[hidden] { display: none !important; }

/* Foco accesible visible y consistente */
:focus-visible {
  outline: none;
  box-shadow: var(--tv-ring);
  border-radius: var(--tv-radius-sm);
}

/* ----------------------------------------------------------------------------
   3. Logo / marca
   -------------------------------------------------------------------------- */
.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--tv-primary-bright), var(--tv-primary));
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: .5px;
  box-shadow: var(--tv-shadow-sm);
}

.brand-name { font-weight: 800; font-size: 17px; color: var(--tv-text); white-space: nowrap; }
.brand-name span,
.login-brand-text h1 span { color: var(--tv-primary); }

/* ----------------------------------------------------------------------------
   4. Pantalla de login
   -------------------------------------------------------------------------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 15% 0%, rgba(22, 163, 111, .18), transparent 60%),
    radial-gradient(900px 500px at 100% 100%, rgba(15, 61, 82, .22), transparent 55%),
    linear-gradient(135deg, #0f3d52 0%, #114e5f 50%, #155c45 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--tv-surface);
  border-radius: var(--tv-radius-lg);
  box-shadow: var(--tv-shadow-lg);
  padding: 32px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.login-brand-text h1 { font-size: 22px; font-weight: 800; margin: 0; }
.login-brand-text p { margin: 2px 0 0; color: var(--tv-text-soft); font-size: 12.5px; }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-hint { text-align: center; color: var(--tv-text-muted); font-size: 12px; margin: 6px 0 0; }

/* ----------------------------------------------------------------------------
   5. Layout de la app (sidebar + topbar + contenido)
   -------------------------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: var(--tv-sidebar-w) 1fr;
  min-height: 100vh;
}
.app.sidebar-collapsed { grid-template-columns: var(--tv-sidebar-w-collapsed) 1fr; }

/* Sidebar fija */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--tv-secondary);
  color: #d7e2e8;
  overflow: hidden;
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  height: var(--tv-topbar-h);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-brand .brand-name { color: #fff; }
.sidebar-brand .brand-name span { color: var(--tv-primary-bright); }

.nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px 10px 16px;
  scrollbar-width: thin;
}
.nav-group { margin-top: 12px; }
.nav-group:first-child { margin-top: 2px; }
.nav-group-title {
  display: block;
  padding: 6px 12px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(215, 226, 232, .55);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--tv-radius-sm);
  color: #cdd9df;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-item .ico { width: 20px; text-align: center; font-size: 15px; flex: 0 0 auto; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(22, 163, 111, .28), rgba(22, 163, 111, .10));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--tv-primary-bright);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.user-mini { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-mini-text { min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11.5px; color: rgba(215, 226, 232, .65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Columna principal */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--tv-topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: var(--tv-surface);
  border-bottom: 1px solid var(--tv-border);
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: var(--tv-radius-sm);
  background: transparent;
  color: var(--tv-text-soft);
  font-size: 17px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--tv-surface-alt); color: var(--tv-text); }

.badge-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tv-danger);
  border: 2px solid var(--tv-surface);
}

.search-box {
  position: relative;
  flex: 1 1 auto;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 38px;
  background: var(--tv-surface-alt);
  border: 1px solid transparent;
  border-radius: var(--tv-radius);
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--tv-primary); box-shadow: var(--tv-ring); background: var(--tv-surface); }
.search-box .search-ico { color: var(--tv-text-muted); font-size: 14px; }
.search-box input {
  flex: 1 1 auto;
  border: none;
  background: transparent;
  outline: none;
  font: inherit;
  color: var(--tv-text);
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius);
  box-shadow: var(--tv-shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  z-index: 40;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.role-switch { display: flex; align-items: center; gap: 7px; }
.role-switch-label { font-size: 12px; color: var(--tv-text-muted); font-weight: 600; }

/* Área de contenido */
.content { flex: 1 1 auto; padding: 22px; min-width: 0; }
.content:focus { outline: none; }

/* ----------------------------------------------------------------------------
   6. Botones
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--tv-radius-sm);
  background: var(--tv-surface-alt);
  color: var(--tv-text);
  font: inherit;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--tv-border); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--tv-primary);
  border-color: var(--tv-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--tv-primary-dark); border-color: var(--tv-primary-dark); }

.btn-secondary {
  background: var(--tv-secondary);
  border-color: var(--tv-secondary);
  color: #fff;
}
.btn-secondary:hover { background: var(--tv-secondary-bright); border-color: var(--tv-secondary-bright); }

.btn-ghost {
  background: transparent;
  border-color: var(--tv-border-strong);
  color: var(--tv-text-soft);
}
.btn-ghost:hover { background: var(--tv-surface-alt); color: var(--tv-text); }

.btn-danger { background: var(--tv-danger); border-color: var(--tv-danger); color: #fff; }
.btn-danger:hover { filter: brightness(.93); }

/* dentro de la sidebar oscura, el botón ghost debe verse claro */
.sidebar .btn-ghost { color: #d7e2e8; border-color: rgba(255, 255, 255, .25); }
.sidebar .btn-ghost:hover { background: rgba(255, 255, 255, .10); color: #fff; }

.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; }

/* ----------------------------------------------------------------------------
   7. Formularios: inputs, labels, select, textarea
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label,
label.field > span:first-child { font-size: 12.5px; font-weight: 600; color: var(--tv-text-soft); }

input[type="text"],
input[type="search"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  font: inherit;
  color: var(--tv-text);
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 72px; }

input:hover,
select:hover,
textarea:hover { border-color: var(--tv-border-strong); }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--tv-primary);
  box-shadow: var(--tv-ring);
}

input::placeholder, textarea::placeholder { color: var(--tv-text-muted); }

/* Login y topbar select heredan los estilos de arriba */
.login-form .field input,
.login-form .field select { height: 40px; }

/* ----------------------------------------------------------------------------
   8. Tarjetas
   -------------------------------------------------------------------------- */
.card {
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius);
  box-shadow: var(--tv-shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--tv-border);
}
.card-header h2, .card-header h3 { margin: 0; font-size: 15px; }
.card-body { padding: 18px; }
.card-footer { padding: 14px 18px; border-top: 1px solid var(--tv-border); }

/* StatCard (KPI) */
.stat-card {
  padding: 16px 18px;
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius);
  box-shadow: var(--tv-shadow-sm);
}
.stat-card .stat-label { font-size: 12.5px; color: var(--tv-text-soft); font-weight: 600; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; margin-top: 4px; color: var(--tv-text); }
.stat-card .stat-trend { font-size: 12px; margin-top: 2px; color: var(--tv-text-muted); }

/* grid de tarjetas util */
.grid { display: grid; gap: 16px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ----------------------------------------------------------------------------
   9. Badges / etiquetas de estado (variantes semánticas)
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  background: var(--tv-surface-alt);
  color: var(--tv-text-soft);
  border: 1px solid var(--tv-border);
  white-space: nowrap;
}
.badge-success { background: var(--tv-success-soft); color: var(--tv-success); border-color: transparent; }
.badge-warning { background: var(--tv-warning-soft); color: var(--tv-warning); border-color: transparent; }
.badge-danger  { background: var(--tv-danger-soft);  color: var(--tv-danger);  border-color: transparent; }
.badge-info    { background: var(--tv-info-soft);    color: var(--tv-info);    border-color: transparent; }
.badge-primary { background: var(--tv-primary-soft); color: var(--tv-primary); border-color: transparent; }
.badge-neutral { background: var(--tv-surface-alt);  color: var(--tv-text-soft); }

/* punto de estado opcional dentro del badge */
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* semáforo SLA / actividad */
.sla { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; }
.sla::before { content: ""; width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.sla-green::before  { background: var(--tv-success); }
.sla-amber::before  { background: var(--tv-warning); }
.sla-red::before    { background: var(--tv-danger); }

/* ----------------------------------------------------------------------------
   10. Tablas
   -------------------------------------------------------------------------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius);
  background: var(--tv-surface);
}
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table thead th {
  position: sticky;
  top: 0;
  text-align: left;
  padding: 11px 14px;
  background: var(--tv-surface-alt);
  color: var(--tv-text-soft);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 1px solid var(--tv-border);
  white-space: nowrap;
}
table.data-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--tv-border);
  vertical-align: middle;
}
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr { transition: background .12s; }
table.data-table tbody tr:hover { background: var(--tv-primary-soft); }
table.data-table tbody tr.is-clickable { cursor: pointer; }

/* ----------------------------------------------------------------------------
   11. Avatar
   -------------------------------------------------------------------------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--tv-primary-soft);
  color: var(--tv-primary-dark);
  font-weight: 700;
  font-size: 13px;
  flex: 0 0 auto;
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }

/* ----------------------------------------------------------------------------
   12. Encabezado de página / breadcrumb util
   -------------------------------------------------------------------------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 20px; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--tv-text-soft); font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----------------------------------------------------------------------------
   13. Modales / toasts (base; detalle fino en components.js)
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 36, 48, .5);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: auto;
  background: var(--tv-surface);
  border-radius: var(--tv-radius-lg);
  box-shadow: var(--tv-shadow-lg);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--tv-border); }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--tv-border); }

.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}
.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: var(--tv-radius);
  background: var(--tv-text);
  color: #fff;
  box-shadow: var(--tv-shadow-lg);
  font-size: 13px;
}
.toast-success { background: var(--tv-success); }
.toast-warning { background: var(--tv-warning); }
.toast-danger  { background: var(--tv-danger); }
.toast-info    { background: var(--tv-info); }

/* ----------------------------------------------------------------------------
   14. Estado vacío / "no encontrado"
   -------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--tv-text-soft);
}
.empty-state .empty-ico { font-size: 40px; margin-bottom: 8px; }

/* ----------------------------------------------------------------------------
   15. Responsive (escritorio y tablet)
   -------------------------------------------------------------------------- */

/* backdrop para sidebar off-canvas en pantallas angostas */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 36, 48, .45);
  z-index: 25;
}

/* Tablet ancha: sidebar colapsada a íconos */
@media (max-width: 1100px) {
  .app { grid-template-columns: var(--tv-sidebar-w-collapsed) 1fr; }
  .sidebar .brand-name,
  .sidebar .nav-label,
  .sidebar .nav-group-title,
  .sidebar .user-mini-text,
  .sidebar .sidebar-footer .btn-block { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 10px 0; }
  .sidebar .sidebar-brand { justify-content: center; }
  .sidebar .user-mini { justify-content: center; }

  /* al forzar expansión (toggle) vuelve a mostrarse completa como overlay */
  .app.sidebar-open .sidebar {
    position: fixed;
    width: var(--tv-sidebar-w);
    box-shadow: var(--tv-shadow-lg);
  }
  .app.sidebar-open .sidebar .brand-name,
  .app.sidebar-open .sidebar .nav-label,
  .app.sidebar-open .sidebar .nav-group-title,
  .app.sidebar-open .sidebar .user-mini-text,
  .app.sidebar-open .sidebar .sidebar-footer .btn-block { display: block; }
  .app.sidebar-open .sidebar .nav-item { justify-content: flex-start; padding: 9px 12px; }
  .app.sidebar-open .sidebar .sidebar-brand { justify-content: flex-start; }
  .app.sidebar-open .sidebar .user-mini { justify-content: flex-start; }
}

/* Tablet / móvil: sidebar off-canvas (oculta por defecto) */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--tv-sidebar-w);
    transform: translateX(-100%);
    transition: transform .22s ease;
  }
  .app.sidebar-open .sidebar { transform: translateX(0); box-shadow: var(--tv-shadow-lg); }
  /* en móvil mostramos siempre las etiquetas al abrir */
  .sidebar .brand-name,
  .sidebar .nav-label,
  .sidebar .nav-group-title,
  .sidebar .user-mini-text,
  .sidebar .sidebar-footer .btn-block { display: block; }
  .sidebar .nav-item { justify-content: flex-start; padding: 9px 12px; }

  .role-switch-label { display: none; }
  .search-box { max-width: none; }
  .content { padding: 16px; }
}

/* en escritorio no mostramos el backdrop si la sidebar no está en overlay */
@media (min-width: 761px) {
  .app:not(.sidebar-open) .sidebar-backdrop { display: none; }
}

/* ----------------------------------------------------------------------------
   16. Accesibilidad / preferencias
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { transition: none !important; animation: none !important; }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ----------------------------------------------------------------------------
   Tarea 7 · Bandeja de solicitudes (PC-01)
   Formulario de registro rápido dentro del Modal: apila los .field con espacio
   y permite dos columnas en pantallas anchas.
   -------------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid > .field { min-width: 0; }
/* El banner de errores ocupa el ancho completo. */
.form-grid > .card { grid-column: 1 / -1; }
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ============================================================================
   Pipeline Kanban y detalle de oportunidad (Tarea 9 — PC-03/PC-04/PC-05)
   Prefijo .tvk- (Kanban) y .tvo- (oportunidad) para no colisionar.
   Drag & drop HTML5 nativo; scroll horizontal en pantallas angostas.
   ========================================================================== */
.tvk-board {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  overflow-y: visible;
  padding: 4px 2px 14px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.tvk-col {
  flex: 0 0 288px;
  width: 288px;
  background: var(--tv-surface-alt);
  border: 1px solid var(--tv-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
  scroll-snap-align: start;
}
.tvk-col-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  border-bottom: 1px solid var(--tv-border);
  border-top: 3px solid var(--tvk-col-accent, var(--tv-primary));
  border-radius: 12px 12px 0 0;
  background: var(--tv-surface);
}
.tvk-col-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  color: var(--tv-text);
  font-size: 14px;
}
.tvk-col-count {
  flex: 0 0 auto;
  min-width: 22px;
  text-align: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--tv-surface-alt);
  color: var(--tv-text-soft);
  font-size: 12px;
  font-weight: 700;
}
.tvk-col-metrics {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
  color: var(--tv-text-soft);
}
.tvk-col-metrics strong { color: var(--tv-text); font-weight: 700; }
.tvk-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 60px;
  flex: 1 1 auto;
}
.tvk-col.tvk-dragover { outline: 2px dashed var(--tv-primary); outline-offset: -4px; }
.tvk-col.tvk-dragover .tvk-col-body { background: var(--tv-primary-soft); border-radius: 8px; }

.tvk-card {
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-left: 4px solid var(--tvk-col-accent, var(--tv-primary));
  border-radius: 10px;
  padding: 10px 11px;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: box-shadow .15s ease, transform .05s ease;
}
.tvk-card:hover { box-shadow: 0 4px 12px rgba(16, 24, 40, 0.1); }
.tvk-card:focus-visible { outline: 2px solid var(--tv-primary); outline-offset: 2px; }
.tvk-card.tvk-dragging { opacity: .5; }
.tvk-card-code {
  font-weight: 700;
  color: var(--tv-text);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tvk-card-cuenta { font-size: 12.5px; color: var(--tv-text-soft); margin: 2px 0 6px; }
.tvk-card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--tv-text-soft);
  margin-bottom: 8px;
}
.tvk-card-valor { font-weight: 700; color: var(--tv-primary-dark); }
.tvk-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border-top: 1px solid var(--tv-border);
  padding-top: 7px;
}
.tvk-sem {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
}
.tvk-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.tvk-dot.ok { background: var(--tv-success, #2e9e5b); }
.tvk-dot.warn { background: var(--tv-warning, #d99100); }
.tvk-dot.danger { background: var(--tv-danger, #d14343); }
.tvk-quick { display: flex; gap: 3px; }
.tvk-quick button {
  border: 1px solid var(--tv-border);
  background: var(--tv-surface);
  border-radius: 7px;
  width: 26px; height: 26px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--tv-text-soft);
}
.tvk-quick button:hover { background: var(--tv-surface-alt); color: var(--tv-text); }
.tvk-flag { color: var(--tv-danger, #d14343); font-size: 13px; }

/* Stepper de etapas (detalle de oportunidad) */
.tvo-stepper {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 4px 0 10px;
  margin: 0 0 6px;
}
.tvo-step {
  flex: 1 1 0;
  min-width: 118px;
  text-align: center;
  position: relative;
  padding: 0 6px;
}
.tvo-step::before {
  content: "";
  position: absolute;
  top: 13px;
  left: -50%;
  width: 100%;
  height: 3px;
  background: var(--tv-border);
  z-index: 0;
}
.tvo-step:first-child::before { display: none; }
.tvo-step.done::before, .tvo-step.current::before { background: var(--tv-primary); }
.tvo-step-dot {
  position: relative;
  z-index: 1;
  width: 28px; height: 28px;
  margin: 0 auto 6px;
  border-radius: 50%;
  background: var(--tv-surface);
  border: 2px solid var(--tv-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: var(--tv-text-soft);
}
.tvo-step.done .tvo-step-dot { background: var(--tv-primary); border-color: var(--tv-primary); color: #fff; }
.tvo-step.current .tvo-step-dot { background: var(--tv-surface); border-color: var(--tv-primary); color: var(--tv-primary); box-shadow: 0 0 0 3px var(--tv-primary-soft); }
.tvo-step.lost .tvo-step-dot { background: var(--tv-danger, #d14343); border-color: var(--tv-danger, #d14343); color: #fff; }
.tvo-step-label { font-size: 12px; font-weight: 700; color: var(--tv-text); }
.tvo-step.current .tvo-step-label { color: var(--tv-primary); }
.tvo-step-req { font-size: 10.5px; color: var(--tv-text-muted); margin-top: 3px; line-height: 1.3; }

.tvo-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) { .tvo-grid { grid-template-columns: 1fr; } }

/* Calificación guiada 0-100 */
.tvo-score-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.tvo-score-badge {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #fff;
}
.tvo-score-badge.lo { background: var(--tv-danger, #d14343); }
.tvo-score-badge.mid { background: var(--tv-warning, #d99100); }
.tvo-score-badge.hi { background: var(--tv-success, #2e9e5b); }
.tvo-crit { margin: 8px 0; }
.tvo-crit-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 12.5px; }
.tvo-crit-label { flex: 0 0 150px; color: var(--tv-text-soft); }
.tvo-crit-bar { flex: 1 1 auto; height: 8px; border-radius: 999px; background: var(--tv-surface-alt); overflow: hidden; }
.tvo-crit-fill { height: 100%; background: var(--tv-primary); border-radius: 999px; }
.tvo-crit-val { flex: 0 0 34px; text-align: right; font-weight: 700; color: var(--tv-text); }

.tvo-alert {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 12.5px; margin-bottom: 10px;
  border: 1px solid transparent;
}
.tvo-alert.warn { background: #fff7e6; border-color: #f0d58a; color: #8a5a00; }
.tvo-alert.danger { background: #fdeced; border-color: #f0a7ab; color: #8a2a2d; }
.tvo-alert.ok { background: var(--tv-primary-soft); border-color: #bfe0d3; color: var(--tv-primary-dark); }

/* ----------------------------------------------------------------------------
   Levantamiento técnico (Tarea 10 · PC-07) — prefijo .tvlev-
   Programación, líneas de residuo y aviso de revisión ambiental.
   ------------------------------------------------------------------------- */
.tvlev-link { font-weight: 600; }

/* Marcas en la tabla de levantamientos */
.tvlev-warn-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--tv-warning);
}
.tvlev-ok-flag { color: var(--tv-text-muted); }
.tvlev-peligroso { color: var(--tv-danger); font-weight: 700; }

/* Formularios (programar / añadir línea) — grids locales para no colisionar */
.tvlev-form .grid-2 { display: grid; grid-template-columns: 1fr 1fr; }
.tvlev-form .grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 560px) {
  .tvlev-form .grid-2,
  .tvlev-form .grid-3 { grid-template-columns: 1fr; }
}
.tvlev-form .field { margin-bottom: 12px; }
.tvlev-hint {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--tv-text-soft);
}
.tvlev-check { justify-content: flex-end; }
.tvlev-check label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--tv-text);
  margin-right: 14px;
}

/* Aviso de revisión ambiental (Req. 7.3) */
.tvlev-warn {
  margin: 10px 0;
  padding: 10px 14px;
  border-radius: var(--tv-radius-sm);
  background: var(--tv-warning-soft);
  border: 1px solid #f0d58a;
  color: #8a5a00;
  font-weight: 600;
  font-size: 13px;
}

/* Detalle del levantamiento */
.tvlev-meta {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  line-height: 1.9;
  font-size: 13.5px;
}
.tvlev-lineas { margin-top: 10px; }
.tvlev-alta {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--tv-border);
}
.tvlev-alta-title { font-size: 14px; margin: 0 0 10px; }
.tvlev-alta-actions { margin-top: 8px; }
.tvlev-alta-aviso:empty { display: none; }

/* =============================================================================
 * Tarea 11 · Cotizaciones (CPQ) y Aprobaciones — prefijo .tvcot-
 * ========================================================================== */

/* Lista de cotizaciones */
.tvcot-ver { font-size: 11px; color: var(--tv-text-soft); font-weight: 600; }
.tvcot-mg { font-size: 11.5px; color: var(--tv-text-soft); }
.tvcot-si { color: var(--tv-success); font-weight: 600; }
.tvcot-no { color: var(--tv-text-soft); }
.tvcot-link { color: var(--tv-primary); font-weight: 600; text-decoration: none; }
.tvcot-link:hover { text-decoration: underline; }
.tvcot-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--tv-text-soft); }

/* Layout del constructor: contenido + panel lateral fijo */
.tvcot-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.tvcot-main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.tvcot-aside { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 980px) {
  .tvcot-layout { grid-template-columns: 1fr; }
  .tvcot-aside { position: static; }
}

/* Banner de inmutabilidad */
.tvcot-lock {
  background: color-mix(in srgb, var(--tv-warning) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tv-warning) 45%, transparent);
  color: var(--tv-text);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 10px 0 16px;
  font-size: 13.5px;
}

/* Cabecera editable */
.tvcot-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 720px) { .tvcot-grid3 { grid-template-columns: 1fr; } }

/* Tabla de líneas editable */
.tvcot-lineactions { display: flex; gap: 6px; flex-wrap: wrap; }
.data-table.tvcot-lineas th.r, .data-table.tvcot-lineas td.r { text-align: right; }
.data-table.tvcot-lineas th.c, .data-table.tvcot-lineas td.c { text-align: center; }
.data-table.tvcot-lineas input[type="text"],
.data-table.tvcot-lineas input[type="number"],
.data-table.tvcot-lineas select {
  width: 100%;
  min-width: 70px;
  padding: 5px 7px;
  font-size: 12.5px;
  border: 1px solid var(--tv-border);
  border-radius: 6px;
  background: var(--tv-surface, #fff);
}
.data-table.tvcot-lineas input[type="number"] { text-align: right; }
.data-table.tvcot-lineas .tvcot-importe { font-weight: 600; white-space: nowrap; }
.data-table.tvcot-lineas .tvcot-del { color: var(--tv-danger); }

/* Condiciones */
.tvcot-cond { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tvcot-cond li { display: flex; gap: 8px; align-items: center; }
.tvcot-cond li input[type="text"] {
  flex: 1 1 auto; padding: 6px 9px; border: 1px solid var(--tv-border);
  border-radius: 6px; font-size: 13px;
}
.tvcot-cond-empty { color: var(--tv-text-soft); font-size: 13px; }
.tvcot-cond-predef { border-top: 1px dashed var(--tv-border); padding-top: 10px; }
.tvcot-predef-lbl { font-size: 12.5px; color: var(--tv-text-soft); margin-right: 4px; }
.tvcot-chip { margin: 2px; }

/* Panel lateral: resumen */
.tvcot-asidecard .card-body { padding: 14px 16px; }
.tvcot-row { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; font-size: 13.5px; }
.tvcot-row span { color: var(--tv-text-soft); }
.tvcot-total { border-top: 1px solid var(--tv-border); margin-top: 4px; padding-top: 8px; font-size: 15px; }
.tvcot-total strong { color: var(--tv-primary); }
.tvcot-ver-badge {
  background: var(--tv-primary); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 2px 9px;
}
.tvcot-reglas-box { margin: 12px 0; border-top: 1px solid var(--tv-border); padding-top: 10px; }
.tvcot-reglas-h { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--tv-text-soft); margin-bottom: 6px; }
.tvcot-reglas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.tvcot-reglas li.warn { font-size: 12.5px; color: var(--tv-warning); background: color-mix(in srgb, var(--tv-warning) 12%, transparent); border-radius: 6px; padding: 5px 8px; }
.tvcot-reglas-ok { font-size: 12.5px; color: var(--tv-success); margin: 0; }
.tvcot-actions { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.btn-block { display: block; width: 100%; }

/* Vista previa PDF (maqueta en modal) */
.tvcot-pdf { font-size: 13px; color: var(--tv-text); }
.tvcot-pdf .muted { color: var(--tv-text-soft); }
.tvcot-pdf .r { text-align: right; }
.tvcot-pdf-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--tv-primary); padding-bottom: 10px; }
.tvcot-pdf-brand { font-size: 22px; font-weight: 800; color: var(--tv-primary); line-height: 1; }
.tvcot-pdf-cliente { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; margin: 14px 0; font-size: 12.5px; }
.tvcot-pdf-tabla { width: 100%; border-collapse: collapse; margin: 8px 0; }
.tvcot-pdf-tabla th, .tvcot-pdf-tabla td { border-bottom: 1px solid var(--tv-border); padding: 6px 8px; text-align: left; vertical-align: top; }
.tvcot-pdf-tabla th.r, .tvcot-pdf-tabla td.r { text-align: right; }
.tvcot-pdf-tabla small { color: var(--tv-text-soft); }
.tvcot-pdf-tot { margin: 10px 0 0 auto; width: 260px; }
.tvcot-pdf-tot div { display: flex; justify-content: space-between; padding: 3px 0; }
.tvcot-pdf-tot .tvcot-pdf-total { border-top: 1px solid var(--tv-border); margin-top: 4px; padding-top: 6px; font-size: 15px; }
.tvcot-pdf-tot .tvcot-pdf-total strong { color: var(--tv-primary); }
.tvcot-pdf-cond { margin-top: 16px; }
.tvcot-pdf-cond h4 { margin: 0 0 6px; font-size: 13px; }
.tvcot-pdf-cond ul { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--tv-text-soft); }
.tvcot-pdf-foot { margin-top: 18px; border-top: 1px dashed var(--tv-border); padding-top: 8px; font-size: 11.5px; text-align: center; }

/* ----------------------------------------------------------------------------
 * Aceptación del cliente (Tarea 12 · PC-11) — asistente de 3 pasos y detalle.
 * Prefijo .tvace-. No reescribe estilos existentes.
 * ------------------------------------------------------------------------- */
.tvace-form { display: flex; flex-direction: column; gap: 14px; }
.tvace-hint { margin: 0; font-size: 13px; color: var(--tv-text-soft); }
.tvace-sub { margin: 6px 0 2px; font-size: 13.5px; color: var(--tv-text); }
.tvace-grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.tvace-grid2 .tvace-full { grid-column: 1 / -1; }
@media (max-width: 560px) {
  .tvace-grid2 { grid-template-columns: 1fr; }
}

.tvace-adjunto {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--tv-surface-alt);
  border: 1px dashed var(--tv-border-strong);
  border-radius: var(--tv-radius-sm);
}
.tvace-adjname { font-size: 12.5px; color: var(--tv-text-muted); }
.tvace-adjname.ok { color: var(--tv-success); font-weight: 600; }

/* Tabla de comparación cotización vs documento */
.tvace-cmp {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius-sm);
  overflow: hidden;
  font-size: 13px;
}
.tvace-cmp thead th {
  background: var(--tv-surface-alt);
  color: var(--tv-text-soft);
  text-align: left;
  font-weight: 700;
  padding: 9px 12px;
  border-bottom: 1px solid var(--tv-border);
}
.tvace-cmp tbody th {
  text-align: left;
  font-weight: 600;
  color: var(--tv-text-soft);
  width: 160px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--tv-border);
  vertical-align: top;
}
.tvace-cmp tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--tv-border);
  vertical-align: top;
}
.tvace-cmp tbody tr:last-child th,
.tvace-cmp tbody tr:last-child td { border-bottom: none; }
.tvace-cmp tr.tvace-row-dif { background: var(--tv-warning-soft); }
.tvace-flag { color: var(--tv-danger); font-weight: 800; }

.tvace-ok {
  padding: 12px 14px;
  background: var(--tv-success-soft);
  color: var(--tv-success);
  border-radius: var(--tv-radius-sm);
  font-weight: 600;
  font-size: 13px;
}

/* Diferencias a resolver */
.tvace-difs { display: flex; flex-direction: column; gap: 10px; }
.tvace-dif-card {
  border: 1px solid var(--tv-warning);
  border-radius: var(--tv-radius-sm);
  background: var(--tv-warning-soft);
  padding: 12px 14px;
}
.tvace-dif-card.resuelta {
  border-color: var(--tv-success);
  background: var(--tv-success-soft);
}
.tvace-dif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13.5px;
}
.tvace-dif-estado { font-size: 12.5px; font-weight: 700; }
.tvace-dif-body {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tvace-dif-vs { font-size: 12.5px; color: var(--tv-text-soft); flex: 1 1 200px; }
.tvace-dif-res { flex: 0 0 auto; min-width: 180px; }
.tvace-dif-motivo { flex: 1 1 180px; }

/* Detalle de aceptación (modal) */
.tvace-detail { display: flex; flex-direction: column; gap: 8px; }
.tvace-detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}
.tvace-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  line-height: 1.9;
  font-size: 13px;
  color: var(--tv-text);
}
.tvace-detail-list li { border-bottom: 1px solid var(--tv-border); padding: 2px 0; }
.tvace-detail-list li:last-child { border-bottom: none; }

/* =============================================================================
 * Tarea 13 · Órdenes de servicio (OS) y órdenes de trabajo (OT)
 * Prefijos .tvos- / .tvot- (añadido al final, sin reescribir lo existente).
 * ========================================================================== */

/* -- Listas de detalle (clave/valor) compartidas OS/OT -- */
.tvos-detail-list,
.tvot-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  line-height: 1.9;
  font-size: 13px;
  color: var(--tv-text);
}
.tvos-detail-list li,
.tvot-detail-list li {
  border-bottom: 1px solid var(--tv-border);
  padding: 3px 0;
}
.tvos-detail-list li:last-child,
.tvot-detail-list li:last-child { border-bottom: none; }

/* -- Checklist de activación de la OS -- */
.tvos-checklist { list-style: none; margin: 0; padding: 0; }
.tvos-check-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--tv-border);
}
.tvos-check-item:last-child { border-bottom: none; }
.tvos-check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--tv-text);
}
.tvos-check-label input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.tvos-check-label input[type="checkbox"]:disabled { cursor: not-allowed; }
.tvos-check-ico { font-size: 15px; }

/* -- Botoneras de acciones OS/OT -- */
.tvos-actions,
.tvot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* -- Listas de error en los modales de validación -- */
.tvos-errlist,
.tvot-errlist {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--tv-danger);
  font-size: 13px;
  line-height: 1.7;
}

/* -- Stepper del ciclo de estados de la OT -- */
.tvot-stepper {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  counter-reset: tvot-step;
}
.tvot-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--tv-border);
  border-radius: 999px;
  background: var(--tv-surface, #fff);
  font-size: 12.5px;
  color: var(--tv-text-soft);
}
.tvot-step-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--tv-border);
  color: var(--tv-text);
  font-size: 11px;
  font-weight: 700;
}
.tvot-step.is-done {
  border-color: var(--tv-success);
  color: var(--tv-success);
}
.tvot-step.is-done .tvot-step-dot {
  background: var(--tv-success);
  color: #fff;
}
.tvot-step.is-current {
  border-color: var(--tv-primary);
  color: var(--tv-primary);
  font-weight: 700;
}
.tvot-step.is-current .tvot-step-dot {
  background: var(--tv-primary);
  color: #fff;
}
.tvot-step-extra { margin-top: 10px; font-size: 13px; }

/* -- Evidencias y subtítulos OT -- */
.tvot-sub {
  margin: 14px 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--tv-text);
}
.tvot-evidencias { list-style: none; margin: 0; padding: 0; font-size: 13px; line-height: 1.8; }
.tvot-evidencias li { color: var(--tv-text); }
.tvot-warn { color: var(--tv-warning); font-size: 12.5px; margin: 6px 0 0; }
.tvot-sinconf {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--tv-border);
}
.tvot-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
  margin-top: 6px;
}

/* ============================================================================
 * Planificador de OT (Tarea 14 · PC-14) — prefijo .tvpl-
 * Grilla recurso × día, drag & drop, semáforos de conflicto.
 * ========================================================================= */

/* -- Controles: filtros + leyenda -- */
.tvpl-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin: 14px 0 16px;
}
.tvpl-filtros {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.tvpl-filtros .field { min-width: 190px; }
.tvpl-leyenda {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--tv-text-soft);
}
.tvpl-leg { display: inline-flex; align-items: center; gap: 6px; }
.tvpl-leg-hint { font-style: italic; color: var(--tv-text-muted); }
.tvpl-chip {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid var(--tv-border);
}
.tvpl-chip-ok { background: var(--tv-surface); }
.tvpl-chip-doble { background: var(--tv-danger-soft); border-color: var(--tv-danger); }
.tvpl-chip-doc { background: var(--tv-warning-soft); border-color: var(--tv-warning); }

/* -- Layout: grilla + panel sin asignar -- */
.tvpl-layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.tvpl-col-grid { flex: 1 1 auto; min-width: 0; }
.tvpl-col-panel { flex: 0 0 268px; }

/* -- Grilla recurso × día -- */
.tvpl-grid-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius);
  background: var(--tv-surface);
}
table.tvpl-grid {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
}
.tvpl-grid th,
.tvpl-grid td {
  border-bottom: 1px solid var(--tv-border);
  border-right: 1px solid var(--tv-border);
  vertical-align: top;
}
.tvpl-grid th:last-child,
.tvpl-grid td:last-child { border-right: none; }
.tvpl-grid tr:last-child td { border-bottom: none; }

.tvpl-th-rec,
.tvpl-td-rec {
  width: 190px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--tv-surface-alt);
}
.tvpl-th-rec {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--tv-text-soft);
  z-index: 3;
}
.tvpl-th-dia {
  padding: 8px 6px;
  text-align: center;
  background: var(--tv-surface-alt);
  color: var(--tv-text-soft);
}
.tvpl-th-dia .tvpl-dow { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.tvpl-th-dia .tvpl-dnum { display: block; font-size: 18px; font-weight: 800; color: var(--tv-text); line-height: 1.1; }
.tvpl-th-dia .tvpl-dmes { display: block; font-size: 11px; color: var(--tv-text-muted); }
.tvpl-th-hoy {
  background: var(--tv-primary-soft);
  box-shadow: inset 0 -3px 0 var(--tv-primary);
}
.tvpl-th-hoy .tvpl-dnum { color: var(--tv-primary-dark); }

.tvpl-td-rec {
  padding: 10px 12px;
  display: table-cell;
}
.tvpl-rec-tipo { font-size: 16px; margin-right: 6px; }
.tvpl-rec-nombre { font-weight: 600; font-size: 12.5px; color: var(--tv-text); }

.tvpl-cell {
  width: 120px;
  min-height: 86px;
  height: 86px;
  padding: 6px;
  background: var(--tv-surface);
  transition: background .12s, box-shadow .12s;
}
.tvpl-cell-hoy { background: rgba(31, 122, 92, .045); }
.tvpl-cell.tvpl-dragover {
  background: var(--tv-primary-soft);
  box-shadow: inset 0 0 0 2px var(--tv-primary);
}
/* Semáforos de conflicto a nivel de celda */
.tvpl-cell-doc { background: var(--tv-warning-soft); }
.tvpl-cell-doble { box-shadow: inset 0 0 0 2px var(--tv-danger); }
.tvpl-cell-doble.tvpl-cell-doc { background: var(--tv-warning-soft); }

.tvpl-cell-alert {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--tv-danger);
  background: var(--tv-danger-soft);
  border-radius: 6px;
  padding: 2px 6px;
  margin-bottom: 5px;
  text-align: center;
}

/* -- Tarjeta (chip) de OT -- */
.tvpl-ot {
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-left: 3px solid var(--tv-primary);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
  cursor: grab;
  box-shadow: var(--tv-shadow-sm);
  transition: box-shadow .12s, transform .05s;
}
.tvpl-ot:last-child { margin-bottom: 0; }
.tvpl-ot:hover { box-shadow: var(--tv-shadow-lg); }
.tvpl-ot:focus-visible { outline: 2px solid var(--tv-primary); outline-offset: 1px; }
.tvpl-ot:active { cursor: grabbing; }
.tvpl-ot.tvpl-dragging { opacity: .55; transform: scale(.98); }
.tvpl-ot-code { font-size: 11.5px; font-weight: 800; color: var(--tv-text); }
.tvpl-ot-cuenta { font-size: 11.5px; color: var(--tv-text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvpl-ot-svc { font-size: 11px; color: var(--tv-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvpl-ot-foot { margin-top: 4px; }

.tvpl-flag { font-size: 10.5px; font-weight: 700; }
.tvpl-flag-doc { color: var(--tv-warning); }

/* -- Panel de OT sin asignar -- */
.tvpl-col-panel .card { position: sticky; top: 12px; }
.tvpl-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--tv-primary-soft);
  color: var(--tv-primary-dark);
  font-size: 12px;
  font-weight: 700;
}
#planSinAsignar { min-height: 60px; }
#planSinAsignar.tvpl-dragover {
  background: var(--tv-primary-soft);
  box-shadow: inset 0 0 0 2px var(--tv-primary);
  border-radius: 8px;
}
.tvpl-sin-vacio { margin: 0; font-size: 12.5px; color: var(--tv-text-muted); }

/* -- Responsive: panel debajo de la grilla en pantallas angostas -- */
@media (max-width: 960px) {
  .tvpl-layout { flex-direction: column; }
  .tvpl-col-panel { flex: 1 1 auto; width: 100%; }
  .tvpl-col-panel .card { position: static; }
}

/* =============================================================================
 * Liquidaciones (Tarea 15 · PC-18) — prefijo .tvliq-
 * ========================================================================== */

/* Aviso de "no hay OT cerrada disponible para liquidar" (RN-C-14). */
.tvliq-aviso {
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: var(--tv-radius-sm);
  background: var(--tv-warning-soft);
  border: 1px solid #f0d58a;
  color: #8a5a00;
  font-size: 13px;
  line-height: 1.5;
}
.tvliq-aviso strong { font-weight: 700; }

/* Formulario de creación de liquidación. */
.tvliq-form { display: flex; flex-direction: column; gap: 14px; }
.tvliq-preview {
  margin-top: 2px;
  padding: 12px 14px;
  border-radius: var(--tv-radius-sm);
  background: var(--tv-surface-alt);
  border: 1px solid var(--tv-border);
}
.tvliq-prev-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.tvliq-prev-list li { font-size: 13px; color: var(--tv-text-soft); }
.tvliq-prev-list li strong { color: var(--tv-text); font-weight: 600; }
.tvliq-prev-warn { margin: 8px 0 0; font-size: 12.5px; font-weight: 600; color: var(--tv-warning); }

/* Listas de errores (modal de validación). */
.tvliq-errlist { margin: 8px 0 0; padding-left: 18px; color: var(--tv-danger); font-size: 13px; line-height: 1.6; }

/* Detalle de la liquidación (modal). */
.tvliq-detalle { display: flex; flex-direction: column; gap: 4px; }
.tvliq-head { display: flex; flex-direction: column; gap: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--tv-border); }
.tvliq-head-code { font-size: 18px; font-weight: 800; color: var(--tv-text); margin-right: 6px; }
.tvliq-head-cta { font-size: 13.5px; font-weight: 600; color: var(--tv-text); }
.tvliq-head-meta { font-size: 12.5px; color: var(--tv-text-soft); }

.tvliq-obs {
  margin: 12px 0 4px;
  padding: 10px 14px;
  border-radius: var(--tv-radius-sm);
  background: var(--tv-warning-soft);
  border: 1px solid #f0d58a;
  color: #8a5a00;
  font-size: 12.5px;
  line-height: 1.5;
}

.tvliq-sub { font-size: 13px; margin: 16px 0 8px; color: var(--tv-text); }

.tvliq-ot-list, .tvliq-detail-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tvliq-ot-list li, .tvliq-detail-list li { font-size: 13px; color: var(--tv-text-soft); }
.tvliq-detail-list li strong { color: var(--tv-text); font-weight: 600; }
.tvliq-ot-list a { font-weight: 600; }

.tvliq-bitacora { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tvliq-bitacora li {
  font-size: 12.5px;
  color: var(--tv-text-soft);
  line-height: 1.5;
  padding: 6px 0;
  border-bottom: 1px dashed var(--tv-border);
}
.tvliq-bitacora li:last-child { border-bottom: 0; }
.tvliq-bit-fecha { color: var(--tv-text-muted); font-variant-numeric: tabular-nums; }
.tvliq-bit-accion { font-weight: 700; color: var(--tv-text); text-transform: uppercase; letter-spacing: .02em; font-size: 11.5px; }
.tvliq-bit-user { color: var(--tv-text-muted); }

/* ============================================================================
 * Actividades (Tarea 16.1 · PC-22) — prefijo .tvact-
 * ========================================================================= */

/* Barra de filtros + conmutador lista/calendario. */
.tvact-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin: 16px 0;
}
.tvact-field { min-width: 180px; }
.tvact-switch {
  margin-left: auto;
  display: inline-flex;
  border: 1px solid var(--tv-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--tv-surface, #fff);
}
.tvact-switch-btn {
  border: 0;
  background: transparent;
  padding: 8px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--tv-text-soft);
  cursor: pointer;
}
.tvact-switch-btn.is-active {
  background: var(--tv-primary, #0a7d5a);
  color: #fff;
}

.tvact-body { margin-top: 4px; }
.tvact-tipo { white-space: nowrap; }

/* Semáforo de vencidas. */
.tvact-dot-venc {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--tv-danger, #d64545);
  vertical-align: middle;
}
.tvact-fecha-venc { color: var(--tv-danger, #d64545); font-weight: 600; }

/* Calendario semanal. */
.tvact-cal { display: block; }
.tvact-cal-head {
  font-weight: 700;
  color: var(--tv-text);
  margin-bottom: 10px;
}
.tvact-cal-sub { font-weight: 400; color: var(--tv-text-muted); font-size: 12.5px; }
.tvact-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
.tvact-cal-col {
  border: 1px solid var(--tv-border);
  border-radius: 10px;
  background: var(--tv-surface, #fff);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tvact-cal-col.is-today { border-color: var(--tv-primary, #0a7d5a); box-shadow: 0 0 0 1px var(--tv-primary, #0a7d5a) inset; }
.tvact-cal-day {
  padding: 8px 10px;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--tv-text-soft);
  border-bottom: 1px solid var(--tv-border);
  background: var(--tv-bg-soft, #f6f8f7);
}
.tvact-cal-day span { float: right; color: var(--tv-text-muted); }
.tvact-cal-cells { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.tvact-cal-empty { color: var(--tv-text-muted); font-size: 12.5px; text-align: center; padding: 8px 0; }

.tvact-chip {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--tv-border);
  border-left: 3px solid var(--tv-primary, #0a7d5a);
  border-radius: 6px;
  background: var(--tv-bg-soft, #f6f8f7);
  padding: 6px 8px;
  font: inherit;
  font-size: 12px;
  line-height: 1.3;
  color: var(--tv-text);
  cursor: pointer;
}
.tvact-chip:hover { background: #eef3f1; }
.tvact-chip-h { font-weight: 700; font-variant-numeric: tabular-nums; }
.tvact-chip.is-done { opacity: .6; text-decoration: line-through; }
.tvact-chip.is-venc { border-left-color: var(--tv-danger, #d64545); background: #fdecec; }

/* Actividades fuera de la semana visible. */
.tvact-cal-otras { margin-top: 16px; }
.tvact-cal-otras h4 { margin: 0 0 8px; font-size: 13px; color: var(--tv-text-soft); }
.tvact-otra {
  padding: 8px 10px;
  border: 1px solid var(--tv-border);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13px;
}
.tvact-otra:hover { background: var(--tv-bg-soft, #f6f8f7); }
.tvact-otra.is-venc { border-color: var(--tv-danger, #d64545); }
.tvact-otra-fecha { color: var(--tv-text-muted); font-variant-numeric: tabular-nums; margin-right: 6px; }

/* Formulario + detalle de actividad. */
.tvact-form { display: flex; flex-direction: column; gap: 14px; }
.tvact-detalle { display: flex; flex-direction: column; gap: 14px; }
.tvact-det-head { display: flex; align-items: flex-start; gap: 12px; }
.tvact-det-ico { font-size: 26px; line-height: 1; }
.tvact-det-title { font-weight: 700; font-size: 16px; color: var(--tv-text); }
.tvact-det-meta { font-size: 13px; color: var(--tv-text-soft); margin-top: 4px; }
.tvact-badge-venc {
  display: inline-block;
  background: var(--tv-danger, #d64545);
  color: #fff;
  border-radius: 6px;
  padding: 1px 8px;
  font-size: 11.5px;
  font-weight: 700;
}
.tvact-det-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tvact-det-list li { font-size: 13.5px; color: var(--tv-text); }

/* ============================================================================
 * Tickets de post-venta (Tarea 16.1 · PC-25) — prefijo .tvtk-
 * ========================================================================= */

.tvtk-form { display: flex; flex-direction: column; gap: 14px; }
.tvtk-detalle { display: flex; flex-direction: column; gap: 14px; }
.tvtk-head { display: flex; flex-direction: column; gap: 6px; }
.tvtk-head-code { font-weight: 800; font-size: 16px; color: var(--tv-text); margin-right: 6px; }
.tvtk-head-asunto { font-size: 14.5px; color: var(--tv-text); font-weight: 600; }
.tvtk-det-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tvtk-det-list li { font-size: 13.5px; color: var(--tv-text); }
.tvtk-sub { margin: 6px 0 4px; font-size: 13px; color: var(--tv-text-soft); }

.tvtk-bitacora { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tvtk-bitacora li {
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--tv-text-soft);
  border-bottom: 1px dashed var(--tv-border);
}
.tvtk-bitacora li:last-child { border-bottom: 0; }
.tvtk-bit-fecha { color: var(--tv-text-muted); font-variant-numeric: tabular-nums; }
.tvtk-bit-accion { font-weight: 700; color: var(--tv-text); text-transform: uppercase; letter-spacing: .02em; font-size: 11.5px; }
.tvtk-bit-user { color: var(--tv-text-muted); }

/* Responsive: calendario a 1 columna por fila en pantallas angostas. */
@media (max-width: 900px) {
  .tvact-cal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tvact-switch { margin-left: 0; }
}
@media (max-width: 560px) {
  .tvact-cal-grid { grid-template-columns: 1fr; }
}

/* ============================================================================
 * Reportes (Tarea 16.2 · PC-23) — prefijo .tvrep-
 * Catálogo lateral de reportes + panel con gráfico y tabla de respaldo.
 * ========================================================================== */
.tvrep-filtros {
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--tv-primary-soft);
  color: var(--tv-primary-dark);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius);
  font-size: 13px;
}

.tvrep-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 18px;
  align-items: start;
}

.tvrep-catalogo {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tvrep-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius);
  cursor: pointer;
  font: inherit;
  color: var(--tv-text);
  box-shadow: var(--tv-shadow-sm);
  transition: border-color .15s, box-shadow .15s, background .15s, transform .05s;
}
.tvrep-card:hover {
  border-color: var(--tv-primary);
  box-shadow: var(--tv-shadow);
}
.tvrep-card:active { transform: translateY(1px); }
.tvrep-card.is-active {
  border-color: var(--tv-primary);
  background: var(--tv-primary-soft);
  box-shadow: inset 3px 0 0 var(--tv-primary);
}

.tvrep-card-ico { font-size: 20px; flex: 0 0 auto; line-height: 1.2; }
.tvrep-card-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tvrep-card-titulo { font-weight: 700; font-size: 14px; }
.tvrep-card-desc { font-size: 12px; color: var(--tv-text-soft); line-height: 1.35; }

.tvrep-main { min-width: 0; }

.tvrep-report .card-header { align-items: center; }
.tvrep-main-ico { font-size: 20px; margin-left: auto; }

.tvrep-chart {
  padding: 6px 0 4px;
  overflow-x: auto;
}

.tvrep-tabla { margin-top: 18px; }
.tvrep-sub {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--tv-text-soft);
  text-transform: uppercase;
  letter-spacing: .03em;
}

@media (max-width: 820px) {
  .tvrep-layout { grid-template-columns: 1fr; }
  .tvrep-catalogo {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .tvrep-card { flex: 1 1 220px; }
}

/* =============================================================================
 * Configuración (Tarea 16.3 · Req. 6.1) — prefijo .tvcfg-
 * ========================================================================== */
.tvcfg-tab { display: flex; flex-direction: column; gap: 16px; }

.tvcfg-note {
  font-size: 13px;
  color: var(--tv-text-soft);
  background: var(--tv-surface-2, #f6f8fa);
  border: 1px solid var(--tv-border);
  border-left: 3px solid var(--tv-primary);
  border-radius: 8px;
  padding: 10px 12px;
}

.tvcfg-hint {
  font-size: 12.5px;
  color: var(--tv-text-muted, var(--tv-text-soft));
  font-weight: 500;
}

.tvcfg-prob { font-weight: 700; color: var(--tv-primary); }

.tvcfg-reqs {
  list-style: disc;
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--tv-text-soft);
  line-height: 1.6;
}

/* Formularios de modales de configuración */
.tvcfg-form { display: flex; flex-direction: column; gap: 12px; }
.tvcfg-form-head { margin: 0 0 4px; font-size: 14px; color: var(--tv-text); }
.tvcfg-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--tv-text);
  cursor: pointer;
}
.tvcfg-check input { width: 16px; height: 16px; }

/* Matriz de permisos por rol */
.tvcfg-matriz-card { overflow: hidden; }
.tvcfg-matriz-wrap { overflow-x: auto; }
.tvcfg-matriz {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.tvcfg-matriz th,
.tvcfg-matriz td {
  border: 1px solid var(--tv-border);
  padding: 7px 10px;
  text-align: center;
  white-space: nowrap;
}
.tvcfg-matriz thead th {
  background: var(--tv-surface-2, #f6f8fa);
  color: var(--tv-text-soft);
  font-weight: 600;
  position: sticky;
  top: 0;
}
.tvcfg-matriz tbody th[scope="row"] {
  text-align: left;
  font-weight: 600;
  color: var(--tv-text);
  background: var(--tv-surface, #fff);
}
.tvcfg-matriz .tvcfg-cell.si { color: var(--tv-success, #1a7f37); font-weight: 700; }
.tvcfg-matriz .tvcfg-cell.no { color: var(--tv-text-muted, #9aa4ad); }
.tvcfg-matriz .tvcfg-row-costos th,
.tvcfg-matriz .tvcfg-row-costos td {
  background: var(--tv-surface-2, #f6f8fa);
  font-style: italic;
}

/* =============================================================================
 * Auditoría (Tarea 16.3 · PC-24 / Req. 12) — prefijo .tvaud-
 * ========================================================================== */
.tvaud-filtros { margin-bottom: 16px; }

.tvaud-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.tvaud-toolbar .field { margin-bottom: 0; min-width: 160px; }
.tvaud-search { flex: 1 1 240px; }
.tvaud-toolbar .btn { flex: 0 0 auto; }

.tvaud-count {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--tv-text-soft);
}

@media (max-width: 640px) {
  .tvaud-toolbar .field { min-width: 100%; }
}

/* ----------------------------------------------------------------------------
   Tarea 18 · Buscador global (dropdown de resultados)
   Estiliza los ítems insertados dentro de #searchResults (.search-results):
   cada resultado es un <a.search-result> con ícono + cuerpo (título + sub),
   y el estado vacío usa .search-empty.
   -------------------------------------------------------------------------- */
.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--tv-text);
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px solid var(--tv-border);
  transition: background .12s;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover {
  background: var(--tv-primary-soft);
  color: var(--tv-text);
}
.search-result:focus,
.search-result:focus-visible {
  outline: none;
  background: var(--tv-primary-soft);
  box-shadow: inset 0 0 0 2px var(--tv-primary);
  border-radius: var(--tv-radius-sm);
}

.search-result-ico {
  flex: 0 0 auto;
  width: 18px;
  font-size: 18px;
  line-height: 1;
  text-align: center;
  color: var(--tv-text-soft);
}

.search-result-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.search-result-title {
  font-weight: 600;
  color: var(--tv-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-sub {
  font-size: 12px;
  color: var(--tv-text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-empty {
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--tv-text-muted);
}
