/*
   TRACFISH premium marine interface system.
   Domain: cold chain, stainless steel plant surfaces, export traceability.
*/
:root {
  --tf-ink: #071426;
  --tf-ink-soft: #102033;
  --tf-ocean: #0f4c81;
  --tf-ocean-strong: #123f73;
  --tf-ice: #f5f9fc;
  --tf-frost: #e8f1f7;
  --tf-steel: #d7e3ec;
  --tf-line: rgba(15, 45, 71, 0.12);
  --tf-line-strong: rgba(15, 45, 71, 0.2);
  --tf-text: #102033;
  --tf-muted: #64778b;
  --tf-accent: #2857ff;
  --tf-trace: #08a779;
  --tf-dock: #c98924;
  --tf-risk: #e14d5d;
  --tf-surface: rgba(255, 255, 255, 0.86);
  --tf-surface-solid: #ffffff;
  --tf-shadow: 0 18px 50px rgba(9, 28, 48, 0.08);
  --tf-shadow-soft: 0 10px 24px rgba(9, 28, 48, 0.06);
  --tf-radius: 12px;
  --tf-radius-sm: 8px;
  --tf-font: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

.dark {
  --tf-ink: #020817;
  --tf-ink-soft: #071426;
  --tf-ice: #08111f;
  --tf-frost: #0f1d2d;
  --tf-steel: #203448;
  --tf-line: rgba(219, 234, 254, 0.11);
  --tf-line-strong: rgba(219, 234, 254, 0.18);
  --tf-text: #eaf4ff;
  --tf-muted: #9fb0c3;
  --tf-surface: rgba(10, 23, 38, 0.86);
  --tf-surface-solid: #0b1726;
  --tf-shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
  --tf-shadow-soft: 0 12px 28px rgba(0, 0, 0, 0.24);
  color-scheme: dark;
}

html {
  background: var(--tf-ice);
}

.tf-body {
  min-height: 100vh;
  color: var(--tf-text);
  background:
    linear-gradient(180deg, rgba(232, 241, 247, 0.9), rgba(245, 249, 252, 0.95) 42%, rgba(232, 241, 247, 0.75)),
    radial-gradient(circle at 78% 0%, rgba(15, 76, 129, 0.1), transparent 28%);
  font-family: var(--tf-font);
  font-feature-settings: "tnum" 1, "cv02" 1, "cv03" 1, "cv04" 1;
}

.dark .tf-body {
  background:
    linear-gradient(180deg, #07101d, #091524 44%, #08111f),
    radial-gradient(circle at 82% 0%, rgba(40, 87, 255, 0.12), transparent 28%);
}

.tf-body ::selection {
  background: rgba(40, 87, 255, 0.18);
}

.tf-body * {
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 76, 129, 0.35) transparent;
}

.tf-body ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.tf-body ::-webkit-scrollbar-track {
  background: transparent;
}

.tf-body ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(15, 76, 129, 0.35), rgba(40, 87, 255, 0.3));
  border-radius: 999px;
}

#sidebar-menu {
  background:
    linear-gradient(180deg, #081426 0%, #0c1728 48%, #07111f 100%) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 18px 0 60px rgba(2, 8, 23, 0.18);
}

#sidebar-menu::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04), transparent 35%),
    radial-gradient(circle at 24px 18px, rgba(8, 167, 121, 0.18), transparent 18%);
  opacity: 0.75;
}

#sidebar-menu > * {
  position: relative;
  z-index: 1;
}

.tf-brand-mark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: #eff6ff;
  background: linear-gradient(135deg, #0f4c81, #08a779);
  box-shadow: 0 12px 24px rgba(8, 167, 121, 0.18);
}

.tf-nav-section {
  margin: 18px 10px 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(190, 210, 230, 0.52);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tf-nav-link {
  position: relative;
  min-height: 40px;
  border: 1px solid transparent;
  color: #9fb4ca !important;
}

.tf-nav-link:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #f8fbff !important;
  border-color: rgba(255, 255, 255, 0.07);
}

.tf-nav-link.is-active {
  background: rgba(226, 241, 250, 0.12) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: inset 3px 0 0 var(--tf-trace);
}

.tf-nav-link i,
.tf-nav-link svg {
  color: currentColor;
  opacity: 0.9;
}

/* Botón flotante de colapso del sidebar (patrón DocVersion).
   Vive en el borde derecho del <aside>, FUERA del flujo del header,
   evitando que se apriete contra el brand-mark cuando el sidebar se
   contrae a iconos. Solo visible en escritorio (lg+). En móvil, el
   sidebar usa el hamburguesa, así que el botón se oculta. */
.tf-sidebar-collapse {
  position: absolute !important;
  right: -12px !important;
  top: 20px !important;
  z-index: 1001 !important;
  background: linear-gradient(135deg, #0f4c81, #08a779) !important;
  border: 1px solid rgba(8, 167, 121, 0.45) !important;
}

.tf-sidebar-collapse:hover {
  background: linear-gradient(135deg, #0d4372, #07936a) !important;
  border-color: rgba(8, 167, 121, 0.6) !important;
}

@media (max-width: 1023px) {
  .tf-sidebar-collapse {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  /* Ancho colapsado: solo iconos, padding cómodo para tap targets. */
  .sidebar-collapsed #sidebar-menu {
    width: 84px !important;
  }

  /* Todo lo textual desaparece al colapsar:
     labels de nav, secciones, version-pill, nombre+rol y acciones. */
  .sidebar-collapsed .tf-sidebar-label-group,
  .sidebar-collapsed .tf-sidebar-label,
  .sidebar-collapsed .tf-sidebar-meta,
  .sidebar-collapsed .tf-nav-section,
  .sidebar-collapsed #sidebar-menu .tf-version-pill,
  .sidebar-collapsed #sidebar-footer-user-text,
  .sidebar-collapsed #sidebar-footer-actions {
    display: none !important;
  }

  /* Links del nav y toggles de acordeón: centrados (solo icono visible). */
  .sidebar-collapsed .tf-nav-link,
  .sidebar-collapsed .tf-nav-group-toggle {
    justify-content: center;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  /* Ocultar el contenido desplegable para no romper el ancho de 84px */
  .sidebar-collapsed .tf-nav-group-content {
    display: none !important;
  }

  /* Brand-wrap: el icono queda perfectamente centrado en el header
     contraído porque el botón de colapso ya no le disputa espacio. */
  .sidebar-collapsed #sidebar-menu .tf-brand-wrap {
    justify-content: center;
  }

  /* Footer (avatar + acciones): solo avatar centrado al colapsar. */
  .sidebar-collapsed #sidebar-footer-container {
    justify-content: center !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  /* El chevron del botón flotante rota 180° cuando el sidebar está
     colapsado: ▸ apunta a la derecha = "expandir";
                ◂ apunta a la izquierda = "contraer". */
  #sidebar-collapse-icon {
    transition: transform 0.3s ease;
  }
  .sidebar-collapsed #sidebar-collapse-icon {
    transform: rotate(180deg);
  }

  /* Transición suave de ancho al alternar estado. */
  #sidebar-menu {
    transition:
      transform 0.25s ease-in-out,
      width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
}

.tf-main-shell {
  min-height: 100vh;
  background: transparent;
}

.tf-topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  backdrop-filter: blur(20px);
  background: rgba(245, 249, 252, 0.76);
  border-bottom: 1px solid var(--tf-line);
}

.dark .tf-topbar {
  background: rgba(8, 17, 31, 0.76);
}

.tf-topbar-search {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: min(360px, 42vw);
  height: 40px;
  padding: 0 14px;
  color: var(--tf-muted);
  background: var(--tf-surface);
  border: 1px solid var(--tf-line);
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(8, 20, 38, 0.04);
}

.tf-icon-button {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--tf-muted);
  background: var(--tf-surface);
  border: 1px solid var(--tf-line);
  border-radius: 14px;
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.tf-icon-button:hover {
  color: var(--tf-ocean);
  border-color: rgba(15, 76, 129, 0.28);
  transform: translateY(-1px);
}

.tf-content {
  width: 100%;
  padding: 24px 28px 34px;
}

@media (max-width: 640px) {
  .tf-content {
    padding: 20px 14px 28px;
  }
}

.tf-page-header,
.tf-panel,
.tf-data-panel,
.tf-filter-toolbar,
.tf-empty-state {
  background: var(--tf-surface);
  border: 1px solid var(--tf-line);
  box-shadow: var(--tf-shadow-soft);
}

.tf-page-header {
  border-radius: var(--tf-radius);
  padding: 20px;
}

.tf-kicker {
  color: var(--tf-ocean);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.tf-title {
  color: var(--tf-text);
  font-size: 1.75rem;
  line-height: 1.08;
  font-weight: 850;
  letter-spacing: 0;
}

@media (max-width: 640px) {
  .tf-title {
    font-size: 1.45rem;
  }
}

.tf-subtitle {
  color: var(--tf-muted);
  font-size: 0.93rem;
  line-height: 1.55;
}

.tf-primary-btn,
.tf-secondary-btn,
.tf-danger-btn,
.tf-action-link,
.tf-pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 38px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 760;
  line-height: 1;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.tf-primary-btn {
  color: #ffffff !important;
  background: linear-gradient(135deg, var(--tf-ocean), var(--tf-accent));
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 14px 28px rgba(40, 87, 255, 0.18);
  padding: 0 16px;
}

.tf-primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(40, 87, 255, 0.24);
}

.tf-secondary-btn,
.tf-pagination-btn {
  color: var(--tf-text) !important;
  background: var(--tf-surface-solid);
  border: 1px solid var(--tf-line-strong);
  padding: 0 14px;
}

.tf-secondary-btn:hover,
.tf-pagination-btn:hover {
  color: var(--tf-ocean) !important;
  border-color: rgba(15, 76, 129, 0.32);
  transform: translateY(-1px);
}

.tf-danger-btn {
  color: #fff !important;
  background: linear-gradient(135deg, #be123c, var(--tf-risk));
  padding: 0 15px;
}

.tf-action-link {
  color: var(--tf-accent) !important;
  background: rgba(40, 87, 255, 0.07);
  border: 1px solid rgba(40, 87, 255, 0.12);
  padding: 0 12px;
  white-space: nowrap;
}

.tf-action-link:hover {
  background: rgba(40, 87, 255, 0.12);
  transform: translateY(-1px);
}

.tf-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px 8px 14px;
  margin-bottom: 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--tf-ocean), var(--tf-accent));
  color: #ffffff !important;
  font-size: 0.85rem;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 16px rgba(40, 87, 255, 0.2);
  transition: transform 200ms ease, box-shadow 200ms ease;
  text-decoration: none;
}

.tf-back-link i {
  font-size: 0.8rem;
  color: #ffffff;
  transition: transform 200ms ease;
}

.tf-back-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(40, 87, 255, 0.3);
}

.tf-back-link:hover i {
  transform: translateX(-3px);
}

.tf-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.tf-row-action {
  box-sizing: border-box;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--tf-line-strong);
  border-radius: 10px;
  background: var(--tf-surface-solid);
  color: var(--tf-muted) !important;
  font-size: 0.76rem;
  font-weight: 820;
  line-height: 1;
  text-decoration: none !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.tf-row-action i {
  width: 14px;
  text-align: center;
  flex: 0 0 auto;
}

.tf-row-action:hover,
.tf-row-action:focus-visible {
  transform: translateY(-1px);
  box-shadow: var(--tf-shadow-soft);
}

.tf-row-action:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(40, 87, 255, 0.12), var(--tf-shadow-soft);
}

.tf-row-action-edit {
  color: var(--tf-ocean) !important;
  background: rgba(15, 76, 129, 0.08);
  border-color: rgba(15, 76, 129, 0.2);
}

.tf-row-action-view {
  color: var(--tf-accent) !important;
  background: rgba(40, 87, 255, 0.07);
  border-color: rgba(40, 87, 255, 0.17);
}

.tf-row-action-delete {
  color: #be123c !important;
  background: rgba(225, 77, 93, 0.09);
  border-color: rgba(225, 77, 93, 0.2);
}

.tf-row-action-cold {
  color: #0369a1 !important;
  background: rgba(14, 165, 233, 0.09);
  border-color: rgba(14, 165, 233, 0.22);
}

.tf-row-action-warn {
  color: #9a5b00 !important;
  background: rgba(201, 137, 36, 0.11);
  border-color: rgba(201, 137, 36, 0.25);
}

.tf-row-action-trace {
  color: #047857 !important;
  background: rgba(8, 167, 121, 0.1);
  border-color: rgba(8, 167, 121, 0.22);
}

.tf-filter-toolbar {
  border-radius: var(--tf-radius);
  padding: 12px;
  margin-bottom: 18px;
}

.tf-filter-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 768px) {
  .tf-filter-form {
    grid-template-columns: repeat(auto-fit, minmax(190px, max-content)) 1fr;
    align-items: end;
  }
}

.tf-filter-field {
  min-width: 180px;
}

.tf-filter-label,
.tf-field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--tf-muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tf-select-wrap,
.tf-input-wrap {
  position: relative;
}

.tf-select,
.tf-input,
.tf-body input[type="text"],
.tf-body input[type="number"],
.tf-body input[type="date"],
.tf-body input[type="password"],
.tf-body input[type="email"],
.tf-body textarea,
.tf-body select {
  min-height: 40px;
  color: var(--tf-text);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--tf-line-strong);
  border-radius: 12px;
  box-shadow: inset 0 1px 2px rgba(8, 20, 38, 0.035);
}

.dark .tf-select,
.dark .tf-input,
.dark .tf-body input[type="text"],
.dark .tf-body input[type="number"],
.dark .tf-body input[type="date"],
.dark .tf-body input[type="password"],
.dark .tf-body input[type="email"],
.dark .tf-body textarea,
.dark .tf-body select {
  background: rgba(8, 17, 31, 0.72);
}

.tf-select,
.tf-input {
  width: 100%;
  padding: 0 38px 0 12px;
  font-size: 0.85rem;
  font-weight: 660;
  outline: none;
  appearance: none;
}

.tf-select:focus,
.tf-input:focus,
.tf-body input:focus,
.tf-body textarea:focus,
.tf-body select:focus {
  border-color: rgba(40, 87, 255, 0.5) !important;
  box-shadow: 0 0 0 4px rgba(40, 87, 255, 0.1) !important;
}

.tf-select-wrap::after {
  content: "\f078";
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tf-muted);
  font-family: "Font Awesome 6 Free";
  font-size: 10px;
  font-weight: 900;
  pointer-events: none;
}

.tf-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

@media (min-width: 768px) {
  .tf-filter-actions {
    justify-content: flex-end;
  }
}

.tf-report-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -4px 0 14px;
  padding: 10px 12px;
  background: var(--tf-surface);
  border: 1px solid var(--tf-line);
  border-radius: var(--tf-radius);
  box-shadow: var(--tf-shadow-soft);
}

.tf-report-count {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--tf-muted);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--tf-line);
  border-radius: 11px;
  font-size: 0.78rem;
  font-weight: 800;
}

.tf-report-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tf-report-btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--tf-text) !important;
  background: var(--tf-surface-solid);
  border: 1px solid var(--tf-line-strong);
  border-radius: 11px;
  font-size: 0.78rem;
  font-weight: 820;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.tf-report-btn:hover,
.tf-report-btn:focus-visible {
  color: var(--tf-ocean) !important;
  border-color: rgba(15, 76, 129, 0.3);
  transform: translateY(-1px);
  outline: none;
}

.tf-report-btn-export:hover {
  color: #047857 !important;
  border-color: rgba(8, 167, 121, 0.28);
  background: rgba(8, 167, 121, 0.08);
}

.tf-report-menu {
  position: relative;
}

.tf-report-menu summary {
  list-style: none;
}

.tf-report-menu summary::-webkit-details-marker {
  display: none;
}

.tf-report-menu-panel {
  position: absolute;
  right: 0;
  z-index: 20;
  width: 250px;
  margin-top: 8px;
  padding: 12px;
  background: var(--tf-surface-solid);
  border: 1px solid var(--tf-line);
  border-radius: 14px;
  box-shadow: var(--tf-shadow);
}

.tf-report-menu-title {
  margin: 0 4px 8px;
  color: var(--tf-muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tf-report-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 6px;
  color: var(--tf-text);
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 680;
}

.tf-report-check:hover {
  background: rgba(15, 76, 129, 0.06);
}

.tf-report-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--tf-accent);
}

.tf-data-panel {
  border-radius: var(--tf-radius);
  overflow: hidden;
}

.tf-body table {
  width: 100%;
  border-collapse: collapse;
}

.tf-body thead {
  background: linear-gradient(180deg, rgba(232, 241, 247, 0.84), rgba(232, 241, 247, 0.48)) !important;
}

.dark .tf-body thead {
  background: rgba(255, 255, 255, 0.045) !important;
}

.tf-body th {
  color: #44586d !important;
  font-size: 10px !important;
  font-weight: 850 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  white-space: nowrap;
}

.dark .tf-body th {
  color: #9fb0c3 !important;
}

.tf-body td {
  border-color: var(--tf-line) !important;
}

.tf-body tbody tr {
  transition: background 140ms ease, transform 140ms ease;
}

.tf-body tbody tr:hover {
  background: rgba(15, 76, 129, 0.04) !important;
}

.dark .tf-body tbody tr:hover {
  background: rgba(255, 255, 255, 0.045) !important;
}

.tf-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--tf-line);
  font-size: 0.72rem;
  font-weight: 760;
  white-space: nowrap;
}

.tf-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.7;
}

.tf-status-success {
  color: #047857;
  background: rgba(8, 167, 121, 0.1);
  border-color: rgba(8, 167, 121, 0.22);
}

.tf-status-warning {
  color: #9a5b00;
  background: rgba(201, 137, 36, 0.12);
  border-color: rgba(201, 137, 36, 0.28);
}

.tf-status-danger {
  color: #be123c;
  background: rgba(225, 77, 93, 0.11);
  border-color: rgba(225, 77, 93, 0.24);
}

.tf-status-info {
  color: #0f4c81;
  background: rgba(15, 76, 129, 0.1);
  border-color: rgba(15, 76, 129, 0.24);
}

.tf-status-neutral {
  color: #475569;
  background: rgba(100, 116, 139, 0.1);
  border-color: rgba(100, 116, 139, 0.22);
}

.tf-empty-state {
  border-radius: var(--tf-radius);
  padding: 46px 28px;
  text-align: center;
}

.tf-empty-icon {
  width: 62px;
  height: 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--tf-ocean);
  background: rgba(15, 76, 129, 0.08);
  border: 1px solid rgba(15, 76, 129, 0.14);
  border-radius: 20px;
}

.tf-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--tf-muted);
  font-size: 0.86rem;
}

.tf-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  background: var(--tf-surface);
  border: 1px solid var(--tf-line);
  border-radius: 16px;
  box-shadow: var(--tf-shadow-soft);
}

.tf-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 13px;
  color: var(--tf-muted);
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 800;
}

.tf-tab:hover,
.tf-tab.is-active {
  color: var(--tf-ocean);
  background: rgba(15, 76, 129, 0.09);
}

.tf-inventory-filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
}

.tf-inventory-filter-form .tf-filter-actions {
  grid-column: 1 / -1;
}

@media (min-width: 1180px) {
  .tf-inventory-filter-form {
    grid-template-columns: repeat(8, minmax(106px, 1fr)) auto;
  }

  .tf-inventory-filter-form .tf-filter-actions {
    grid-column: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
  }
}

.tf-search-input {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  background: var(--tf-surface-solid);
  border: 1px solid var(--tf-line-strong);
  border-radius: 12px;
}

.tf-metric-card {
  position: relative;
  overflow: hidden;
  min-height: 146px;
  padding: 20px;
  color: #ffffff;
  border-radius: var(--tf-radius);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--tf-shadow);
}

.tf-metric-card::after {
  content: "";
  position: absolute;
  inset: auto -22px -38px auto;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.tf-metric-ocean {
  background: linear-gradient(135deg, #0f4c81, #123f73);
}

.tf-metric-trace {
  background: linear-gradient(135deg, #047857, #08a779);
}

.tf-metric-risk {
  background: linear-gradient(135deg, #be123c, #e14d5d);
}

.tf-metric-dock {
  background: linear-gradient(135deg, #9a5b00, #c98924);
}

.tf-metric-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
}

.tf-module-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  min-height: 148px;
  padding: 18px;
  background: var(--tf-surface);
  border: 1px solid var(--tf-line);
  border-radius: var(--tf-radius);
  box-shadow: var(--tf-shadow-soft);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tf-module-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 76, 129, 0.24);
  box-shadow: var(--tf-shadow);
}

.tf-module-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid var(--tf-line);
}

.tf-module-ocean {
  color: var(--tf-ocean);
  background: rgba(15, 76, 129, 0.09);
}

.tf-module-trace {
  color: #047857;
  background: rgba(8, 167, 121, 0.1);
}

.tf-module-dock {
  color: #9a5b00;
  background: rgba(201, 137, 36, 0.12);
}

.tf-module-ice {
  color: #0369a1;
  background: rgba(14, 165, 233, 0.1);
}

.tf-module-enter {
  grid-column: 2;
  align-self: end;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--tf-accent);
  font-size: 0.78rem;
  font-weight: 850;
}

.tf-chain {
  position: relative;
}

.tf-chain::before {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  top: 26px;
  height: 2px;
  background: linear-gradient(90deg, rgba(15, 76, 129, 0.18), rgba(8, 167, 121, 0.36), rgba(40, 87, 255, 0.22));
}

.tf-chain-step {
  position: relative;
  z-index: 1;
  background: var(--tf-surface);
  border: 1px solid var(--tf-line);
  box-shadow: var(--tf-shadow-soft);
}

@media (max-width: 1279px) {
  .tf-chain::before {
    display: none;
  }
}

.premium-select-container button {
  color: var(--tf-text) !important;
  background: rgba(255, 255, 255, 0.78) !important;
  border-color: var(--tf-line-strong) !important;
}

.premium-select-container > div {
  background: var(--tf-surface-solid) !important;
  border-color: var(--tf-line) !important;
}

.dark .premium-select-container button,
.dark .premium-select-container > div {
  background: var(--tf-surface-solid) !important;
  color: var(--tf-text) !important;
}

#confirm-modal-box,
#general-modal-box {
  border-radius: 20px !important;
  background: var(--tf-surface-solid) !important;
  border-color: var(--tf-line) !important;
  box-shadow: var(--tf-shadow) !important;
}

#general-modal-body {
  color: var(--tf-text);
}

#general-modal-footer {
  position: sticky;
  bottom: 0;
  background: rgba(232, 241, 247, 0.58) !important;
  border-color: var(--tf-line) !important;
}

.dark #general-modal-footer {
  background: rgba(255, 255, 255, 0.04) !important;
}

.tf-body .bg-white.border.border-slate-200.rounded-xl.shadow-sm.overflow-hidden,
.tf-body .bg-white.rounded-3xl,
.tf-body .bg-white.rounded-xl {
  background: var(--tf-surface) !important;
  border-color: var(--tf-line) !important;
  box-shadow: var(--tf-shadow-soft) !important;
}

.dark .tf-body .bg-white,
.dark .tf-body .bg-slate-50 {
  background-color: var(--tf-surface-solid) !important;
}

.dark .tf-body .text-slate-900,
.dark .tf-body .text-slate-800,
.dark .tf-body .text-slate-700 {
  color: var(--tf-text) !important;
}

.dark .tf-body .text-slate-600,
.dark .tf-body .text-slate-500,
.dark .tf-body .text-slate-400 {
  color: var(--tf-muted) !important;
}

/* =====================================================================
   Dark-mode adapter for Tailwind pastel pills / badges / KPI cards.

   Templates across the app use Tailwind utility combos like
   `bg-emerald-50 text-emerald-700 border-emerald-200`. Those pastels
   were chosen for the light theme; in dark mode they remain almost
   white and clash with the deep canvas (some even render invisible
   because the global `text-slate-*` overrides above bleach the label).

   Rather than touching every template, we swap pastel utility classes
   for translucent same-hue tints + a brighter same-hue label, scoped
   to `.dark .tf-body`. Semantics, borders and intent are preserved.
   ===================================================================== */

.dark .tf-body .bg-emerald-50,
.dark .tf-body .bg-emerald-100,
.dark .tf-body .bg-green-50,
.dark .tf-body .bg-green-100   { background-color: rgba(16, 185, 129, 0.16) !important; }
.dark .tf-body .border-emerald-100,
.dark .tf-body .border-emerald-200,
.dark .tf-body .border-emerald-300,
.dark .tf-body .border-green-200 { border-color: rgba(16, 185, 129, 0.34) !important; }
.dark .tf-body .text-emerald-600,
.dark .tf-body .text-emerald-700,
.dark .tf-body .text-emerald-800,
.dark .tf-body .text-emerald-900,
.dark .tf-body .text-green-600,
.dark .tf-body .text-green-700  { color: #6ee7b7 !important; }

.dark .tf-body .bg-rose-50,
.dark .tf-body .bg-rose-100,
.dark .tf-body .bg-red-50,
.dark .tf-body .bg-red-100     { background-color: rgba(244, 63, 94, 0.16) !important; }
.dark .tf-body .border-rose-100,
.dark .tf-body .border-rose-200,
.dark .tf-body .border-rose-300,
.dark .tf-body .border-red-200  { border-color: rgba(244, 63, 94, 0.36) !important; }
.dark .tf-body .text-rose-600,
.dark .tf-body .text-rose-700,
.dark .tf-body .text-rose-800,
.dark .tf-body .text-rose-900,
.dark .tf-body .text-red-600,
.dark .tf-body .text-red-700    { color: #fda4af !important; }

.dark .tf-body .bg-amber-50,
.dark .tf-body .bg-amber-100,
.dark .tf-body .bg-yellow-50,
.dark .tf-body .bg-yellow-100,
.dark .tf-body .bg-orange-50,
.dark .tf-body .bg-orange-100  { background-color: rgba(245, 158, 11, 0.18) !important; }
.dark .tf-body .border-amber-100,
.dark .tf-body .border-amber-200,
.dark .tf-body .border-amber-300,
.dark .tf-body .border-yellow-200,
.dark .tf-body .border-orange-200 { border-color: rgba(245, 158, 11, 0.38) !important; }
.dark .tf-body .text-amber-600,
.dark .tf-body .text-amber-700,
.dark .tf-body .text-amber-800,
.dark .tf-body .text-amber-900,
.dark .tf-body .text-yellow-600,
.dark .tf-body .text-yellow-700,
.dark .tf-body .text-orange-600,
.dark .tf-body .text-orange-700 { color: #fcd34d !important; }

.dark .tf-body .bg-sky-50,
.dark .tf-body .bg-sky-100,
.dark .tf-body .bg-cyan-50,
.dark .tf-body .bg-cyan-100,
.dark .tf-body .bg-blue-50,
.dark .tf-body .bg-blue-100    { background-color: rgba(14, 165, 233, 0.16) !important; }
.dark .tf-body .border-sky-100,
.dark .tf-body .border-sky-200,
.dark .tf-body .border-sky-300,
.dark .tf-body .border-cyan-200,
.dark .tf-body .border-blue-200 { border-color: rgba(14, 165, 233, 0.36) !important; }
.dark .tf-body .text-sky-600,
.dark .tf-body .text-sky-700,
.dark .tf-body .text-sky-800,
.dark .tf-body .text-sky-900,
.dark .tf-body .text-cyan-600,
.dark .tf-body .text-cyan-700,
.dark .tf-body .text-blue-600,
.dark .tf-body .text-blue-700   { color: #7dd3fc !important; }

.dark .tf-body .bg-indigo-50,
.dark .tf-body .bg-indigo-100,
.dark .tf-body .bg-violet-50,
.dark .tf-body .bg-violet-100,
.dark .tf-body .bg-purple-50,
.dark .tf-body .bg-purple-100  { background-color: rgba(99, 102, 241, 0.18) !important; }
.dark .tf-body .border-indigo-100,
.dark .tf-body .border-indigo-200,
.dark .tf-body .border-indigo-300,
.dark .tf-body .border-violet-200,
.dark .tf-body .border-purple-200 { border-color: rgba(99, 102, 241, 0.38) !important; }
.dark .tf-body .text-indigo-600,
.dark .tf-body .text-indigo-700,
.dark .tf-body .text-indigo-800,
.dark .tf-body .text-indigo-900,
.dark .tf-body .text-violet-600,
.dark .tf-body .text-violet-700,
.dark .tf-body .text-purple-600,
.dark .tf-body .text-purple-700 { color: #a5b4fc !important; }

.dark .tf-body .bg-teal-50,
.dark .tf-body .bg-teal-100    { background-color: rgba(20, 184, 166, 0.16) !important; }
.dark .tf-body .border-teal-200 { border-color: rgba(20, 184, 166, 0.36) !important; }
.dark .tf-body .text-teal-600,
.dark .tf-body .text-teal-700   { color: #5eead4 !important; }

.dark .tf-body .bg-pink-50,
.dark .tf-body .bg-pink-100    { background-color: rgba(236, 72, 153, 0.16) !important; }
.dark .tf-body .border-pink-200 { border-color: rgba(236, 72, 153, 0.36) !important; }
.dark .tf-body .text-pink-600,
.dark .tf-body .text-pink-700   { color: #f9a8d4 !important; }

/* Neutral / slate pills — the most common "estado cerrada / despachado"
   case. In dark mode the bg-slate-100 was rendering as a near-white blob
   that swallowed its own label (text bleached white by the override
   above). We give it a translucent steel tint and a readable label. */
.dark .tf-body .bg-slate-100,
.dark .tf-body .bg-slate-200,
.dark .tf-body .bg-gray-100,
.dark .tf-body .bg-gray-200    { background-color: rgba(148, 163, 184, 0.14) !important; }
.dark .tf-body .border-slate-200,
.dark .tf-body .border-slate-300,
.dark .tf-body .border-gray-200,
.dark .tf-body .border-gray-300 { border-color: rgba(148, 163, 184, 0.28) !important; }

/* Mini bullets / decorative dots inside legends should keep their solid
   color in dark mode (they are 8×8 squares without label, used in cost
   mix legends). The bg-*-400 utilities are bright enough already; we
   only need to ensure the swatches below don't get neutralized by the
   pastel adapter above. They use -400 which we have NOT overridden, so
   they survive — no extra rules needed.  */


.tf-filter-toolbar-combined {
  background: var(--tf-surface);
  border: 1px solid var(--tf-line);
  box-shadow: var(--tf-shadow-soft);
  border-radius: var(--tf-radius);
  padding: 10px 14px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.tf-filter-toolbar-combined .tf-filter-toolbar {
  flex: 1 1 auto;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.tf-filter-toolbar-combined .tf-filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.tf-filter-toolbar-combined .tf-filter-field {
  min-width: 150px;
  max-width: 220px;
}

.tf-filter-toolbar-combined .tf-filter-label {
  margin-bottom: 4px;
}

.tf-filter-toolbar-combined .tf-report-tools {
  flex: 0 0 auto;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

/* =====================================================================
   CONSOLA OPERATIVA FLUIDA: Split-Pane & High-Density Layout
   ===================================================================== */

/* Contenedor principal del split panel */
.tf-split-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  align-items: stretch;
}

@media (min-width: 1024px) {
  .tf-split-container {
    flex-direction: row;
  }
}

/* Panel maestro: listados de alta densidad */
.tf-split-master {
  width: 100%;
  flex: 1 1 0%;
  min-width: 0;
}

@media (min-width: 1024px) {
  .tf-split-master {
    width: 60%;
    flex: 0 0 60%;
  }
}

@media (min-width: 1280px) {
  .tf-split-master {
    width: 64%;
    flex: 0 0 64%;
  }
}

/* Panel de detalle: información lateral interactiva */
.tf-split-detail {
  width: 100%;
  flex: 1 1 auto;
}

@media (min-width: 1024px) {
  .tf-split-detail {
    width: 40%;
    flex: 0 0 40%;
    position: sticky;
    top: 80px;
    align-self: start;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
  }
}

@media (min-width: 1280px) {
  .tf-split-detail {
    width: 36%;
    flex: 0 0 36%;
  }
}

/* Panel detallado con bordes definidos de acero inoxidable */
.tf-split-detail-card {
  background: var(--tf-surface-solid);
  border: 1px solid var(--tf-line-strong);
  border-radius: 16px;
  box-shadow: var(--tf-shadow-soft);
  padding: 24px;
}

/* Indicador de ayuda cuando no hay selección */
.tf-split-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  border: 2px dashed var(--tf-line-strong);
  border-radius: 16px;
  color: var(--tf-muted);
  min-height: 320px;
}

/* SKU Badge: estilo etiqueta física industrial de alto contraste */
.tf-sku-badge {
  display: inline-flex;
  align-items: center;
  font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.725rem;
  font-weight: 750;
  color: var(--tf-text) !important;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--tf-line-strong);
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.dark .tf-sku-badge {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Foco de inputs con resplandor sólido del océano profundo */
.tf-body input:focus,
.tf-body textarea:focus,
.tf-body select:focus {
  border-color: var(--tf-ocean) !important;
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.22) !important;
}

/* Tablas compactas de alta densidad para planta */
.tf-table-compact th {
  padding: 6px 10px !important;
  font-size: 9px !important;
}

.tf-table-compact td {
  padding: 6px 10px !important;
  font-size: 0.8rem !important;
}

/* Barras de progreso de alto contraste inline */
.tf-progress-container {
  width: 100%;
  height: 6px;
  background: var(--tf-steel);
  border-radius: 999px;
  overflow: hidden;
}

.tf-progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Colores de barra sólidos */
.tf-progress-ocean { background: var(--tf-ocean); }
.tf-progress-trace { background: var(--tf-trace); }
.tf-progress-dock { background: var(--tf-dock); }
.tf-progress-risk { background: var(--tf-risk); }

/* Pipeline de trazabilidad en panel robusto */
.tf-pipeline-flow {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  padding: 10px 0;
}

@media (min-width: 768px) {
  .tf-pipeline-flow {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .tf-pipeline-flow::before {
    content: "";
    position: absolute;
    left: 20px;
    right: 20px;
    top: 22px;
    height: 3px;
    background: var(--tf-steel);
    z-index: 0;
  }
}

.tf-pipeline-node {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--tf-surface-solid);
  border: 1px solid var(--tf-line-strong);
  border-radius: 12px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  flex: 1;
}

@media (min-width: 768px) {
  .tf-pipeline-node {
    flex-direction: column;
    text-align: center;
    padding: 12px 6px;
    min-height: 108px;
    justify-content: center;
  }
}

.tf-pipeline-node:hover {
  transform: translateY(-2px);
  border-color: var(--tf-ocean);
  box-shadow: var(--tf-shadow-soft);
}

.tf-pipeline-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 900;
}

/* Indicador de items activos */
.tf-pipeline-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  background: var(--tf-steel);
  color: var(--tf-text);
  border: 1px solid var(--tf-line-strong);
}

.tf-pipeline-active {
  border-color: var(--tf-trace) !important;
  box-shadow: 0 0 0 2px rgba(8, 167, 121, 0.12);
}

.tf-pipeline-active .tf-pipeline-icon {
  background: rgba(8, 167, 121, 0.16) !important;
  color: var(--tf-trace) !important;
}

.tf-pipeline-active .tf-pipeline-badge {
  background: var(--tf-trace) !important;
  color: #fff !important;
  border-color: transparent !important;
}

/* ── Mobile & Desktop list cards ─────────────────────────────────────── */
.tf-list-card {
  background: var(--tf-surface);
  border-bottom: 1px solid var(--tf-line);
  padding: 14px 16px;
  cursor: pointer;
  transition: background 160ms ease;
}
.tf-list-card:last-child { border-bottom: none; }
.tf-list-card:active { background: rgba(15, 76, 129, 0.04); }

.tf-list-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}
.tf-list-card-title {
  font-weight: 600;
  color: var(--tf-text);
  font-size: 0.9rem;
  line-height: 1.3;
}
.tf-list-card-subtitle {
  font-size: 0.72rem;
  color: var(--tf-muted);
  margin-top: 2px;
}
.tf-list-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin-bottom: 12px;
}
.tf-list-card-field {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
@media (max-width: 767px) {
  .tf-list-card-field.full { grid-column: 1 / -1; }
}
.tf-list-card-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tf-muted);
}
.tf-list-card-value {
  font-size: 0.82rem;
  color: var(--tf-text);
}
.tf-list-card-footer {
  border-top: 1px solid var(--tf-line);
  padding-top: 10px;
  display: flex;
  justify-content: flex-end;
}

@media (min-width: 768px) {
  .tf-list-card {
    display: grid;
    align-items: center;
    padding: 12px 20px;
    gap: 16px;
  }
  .tf-list-card:hover {
    background: rgba(15, 76, 129, 0.03);
  }
  .tf-list-card-header {
    display: contents;
  }
  .tf-list-card-body {
    display: contents;
  }
  .tf-list-card-footer {
    display: flex;
    border-top: none;
    padding-top: 0;
    justify-content: flex-end;
  }
  .tf-list-card-label {
    display: none; /* Ocultar labels en escritorio, usa el header row */
  }
  
  .tf-list-header-row {
    display: grid;
    align-items: center;
    padding: 10px 20px;
    gap: 16px;
    background: linear-gradient(180deg, rgba(232, 241, 247, 0.84), rgba(232, 241, 247, 0.48));
    border-bottom: 1px solid var(--tf-line);
    color: #44586d;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .dark .tf-list-header-row {
    background: rgba(255, 255, 255, 0.045);
    color: #9fb0c3;
  }
}

/* ── Deep Sea analytics premium components ─────────────────────────────── */
.bc { font-family: 'Barlow Condensed', sans-serif; }

.kpi-band {
  background: linear-gradient(135deg, #0a1829 0%, #0e2540 55%, #0a1322 100%);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(40, 87, 255, 0.14);
}
.kpi-band::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(40,87,255,.055) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}
.kpi-cell {
  position: relative;
  padding: 22px 24px;
  z-index: 1;
}
.kpi-top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.kpi-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(163, 195, 225, 0.58);
  margin-bottom: 7px;
}
.kpi-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: clamp(1.7rem, 2.8vw, 2.25rem);
  line-height: 1;
  color: #e8f2ff;
  letter-spacing: -0.02em;
}
.kpi-hint {
  font-size: 0.59rem;
  color: rgba(163, 195, 225, 0.38);
  margin-top: 6px;
  line-height: 1.35;
}

.kpi-mini {
  border-radius: 12px;
  border: 1px solid var(--tf-line);
  background: var(--tf-surface);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.kpi-mini-label {
  font-size: 0.59rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--tf-muted);
  margin-bottom: 5px;
}
.kpi-mini-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 1.45rem;
  line-height: 1;
  letter-spacing: -0.01em;
}
.kpi-mini-sub {
  font-size: 0.59rem;
  color: var(--tf-muted);
  margin-top: 4px;
}

.al-card {
  display: block;
  padding: 11px 14px;
  border-radius: 10px;
  border-top: 1px solid;
  border-right: 1px solid;
  border-bottom: 1px solid;
  border-left: 4px solid;
  transition: transform 140ms, box-shadow 140ms;
}
.al-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,.07); }
.al-critical { border-color: rgba(225,77,93,.2); border-left-color: #e14d5d; background: rgba(225,77,93,.03); }
.al-warning  { border-color: rgba(201,137,36,.2); border-left-color: #c98924; background: rgba(201,137,36,.03); }
.al-info     { border-color: rgba(15,76,129,.2);  border-left-color: #0f4c81; background: rgba(15,76,129,.02); }

.sec { background: var(--tf-surface); border: 1px solid var(--tf-line); border-radius: 14px; overflow: hidden; }
.sec-hd { padding: 14px 20px; border-bottom: 1px solid var(--tf-line); display: flex; align-items: center; gap: 10px; }
.sec-ico {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; flex-shrink: 0;
}
.sec-title { font-size: 0.85rem; font-weight: 700; color: var(--tf-text); letter-spacing: -0.01em; line-height: 1.25; }
.sec-sub { font-size: 0.67rem; color: var(--tf-muted); margin-top: 1px; }

.t-head th {
  padding: 9px 14px;
  font-size: 0.61rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--tf-muted);
  background: rgba(0,0,0,.025);
  border-bottom: 1px solid var(--tf-line);
}
.dark .t-head th { background: rgba(255,255,255,.025); }
.t-row td { padding: 9px 14px; font-size: 0.8rem; color: var(--tf-text); border-bottom: 1px solid var(--tf-line); }
.t-row:last-child td { border-bottom: none; }
.t-row:hover td { background: rgba(15,76,129,.022); }

.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--tf-line); }
.rank-row:last-child { border-bottom: none; }
.rank-pos { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 1.25rem; line-height: 1; width: 24px; text-align: center; flex-shrink: 0; color: var(--tf-muted); opacity: .4; }
.rank-pos.gold   { color: #c98924; opacity: 1; }
.rank-pos.silver { color: #64748b; opacity: .85; }
.rank-pos.bronze { color: #92400e; opacity: .75; }
.rank-bar  { flex: 1; height: 5px; background: var(--tf-line); border-radius: 99px; overflow: hidden; }
.rank-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #0f4c81, #2857ff); }

.sec-num { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 1.1rem; line-height: 1; color: var(--tf-accent); opacity: .3; flex-shrink: 0; }


/* =====================================================================
   AUTO-CARDS RESPONSIVAS: tabla → "card alargada" en móvil.

   Marca una <table> con la clase `tf-table-auto`. En pantallas < 768px
   (breakpoint `md` de Tailwind) cada fila se vuelve una tarjeta y cada
   celda una línea "Etiqueta: valor". La etiqueta sale del <th> del
   encabezado, que `tracfish-ui.js` copia a cada <td> como `data-label`
   (no hace falta duplicar HTML ni tocar cada celda).

   Pensada para las tablas que se ven en móvil y se desbordaban (costos
   de fileteros, picking, auditoría, agente de impresión...). Las tablas
   que ya tienen su propio bloque de cards (`md:hidden`) NO necesitan
   esta clase: siguen ocultándose con `hidden md:table`.
   ===================================================================== */
@media (max-width: 767px) {
  table.tf-table-auto,
  table.tf-table-auto > tbody {
    display: block;
    width: 100%;
  }

  table.tf-table-auto > thead {
    /* El encabezado se oculta: su texto ya vive en cada celda como label. */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  table.tf-table-auto > tbody > tr {
    display: block;
    margin-bottom: 12px;
    padding: 4px 2px;
    background: var(--tf-surface-solid);
    border: 1px solid var(--tf-line-strong);
    border-radius: 12px;
    box-shadow: var(--tf-shadow-soft);
    overflow: hidden;
  }

  table.tf-table-auto > tbody > tr:last-child {
    margin-bottom: 0;
  }

  table.tf-table-auto > tbody > tr:hover {
    /* Anula el hover de fila de escritorio dentro de la card. */
    background: var(--tf-surface-solid) !important;
  }

  table.tf-table-auto > tbody > tr > td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    width: auto !important;
    max-width: none !important;
    min-height: 0;
    padding: 8px 14px !important;
    text-align: right !important;
    white-space: normal !important;   /* mata truncate/nowrap heredados */
    overflow: visible !important;
    text-overflow: clip !important;
    border: 0 !important;
    border-bottom: 1px solid var(--tf-line) !important;
  }

  table.tf-table-auto > tbody > tr > td:last-child {
    border-bottom: 0 !important;
  }

  /* Etiqueta (desde el <th>) a la izquierda de cada línea. */
  table.tf-table-auto > tbody > tr > td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 40%;
    text-align: left;
    color: var(--tf-muted);
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.4;
  }

  /* Celda de acciones (encabezado vacío): botones alineados a la derecha. */
  table.tf-table-auto > tbody > tr > td.tf-cell-actions {
    justify-content: flex-end;
    background: rgba(15, 76, 129, 0.03);
  }

  table.tf-table-auto > tbody > tr > td.tf-cell-actions .tf-row-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  /* Filas de estado vacío / totales que ocupan todo el ancho (colspan). */
  table.tf-table-auto > tbody > tr > td[colspan] {
    display: block;
    text-align: center !important;
    border-bottom: 0 !important;
  }
}


