:root {
  --primary:   #34568B;
  --accent:    #0275D8;
  --success:   #5CB85C;
  --neutral:   #6C757D;
  --font:      0.875rem;
  --radius:    6px;
  --gap:       8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font: var(--font) 'Segoe UI', Arial, sans-serif;
  background: #f7f8fa;
  color: #333;
}

/* Header */
.header {
  background: var(--primary);
  color: #fff;
  padding: var(--gap);
  text-align: center;
}
.header h1 {
  font-size: 1.2rem;
}

/* Contenedor */
.container {
  max-width: 1200px;
  margin: var(--gap) auto;
  padding: 0 var(--gap);
}

/* Indicadores */
.indicators {
  display: flex;
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.indicator {
  padding: 6px 12px;
  border-radius: var(--radius);
  color: #fff;
  text-align: center;
  font-size: 0.85rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  min-width: 120px;
}
.indicator .label { display: block; }
.indicator .value {
  font-size: 1.1rem;
  font-weight: 600;
}
.indicator.etiqueta_creada { background: var(--neutral); }
.indicator.entregado       { background: var(--success); }

/* Búsqueda */
.controls { margin-bottom: var(--gap); }
.search {
  width: 100%;
  padding: 8px 12px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  transition: border-color .2s;
}
.search:focus {
  outline: none;
  border-color: var(--primary);
}

/* Tabla wrapper (sin scroll horizontal) */
.table-wrap {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);

  /* IMPORTANTE: no barra horizontal */
  overflow-x: visible;
}

/* Tabla */
.grid {
  width: 100%;
  border-collapse: collapse;

  /* Permite que la tabla se adapte y el texto haga wrap */
  table-layout: fixed;
}

.grid thead {
  background: var(--primary);
  color: #fff;
}

/* IMPORTANTE: headers NO sticky (no se “mueven pegados”) */
.grid th {
  position: static;   /* <- asegura que no sea sticky */
  top: auto;
  z-index: auto;
}

.grid th, .grid td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #eee;

  /* Wrap para evitar corte */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;

  font-size: 0.9rem;
  vertical-align: top;
}

.grid tbody tr:hover {
  background: #f1f3f5;
}

/* Anchos por columna (evita que se rompa feo) */
.grid th:nth-child(1), .grid td:nth-child(1) { width: 80px; }   /* Origen */
.grid th:nth-child(2), .grid td:nth-child(2) { width: 190px; }  /* Status+Fecha */
.grid th:nth-child(4), .grid td:nth-child(4) { width: 210px; }  /* Tracking */
.grid th:nth-child(5), .grid td:nth-child(5) { width: 120px; }  /* Enlace */
.grid th:nth-child(3), .grid td:nth-child(3) { width: auto; }   /* Título */

/* Celdas específicas */
.col-title { line-height: 1.25; }
.col-tracking { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge.etiqueta_creada { background: var(--neutral); }
.badge.entregado       { background: var(--success); }
.badge.neutral         { background: #adb5bd; }

/* Origen */
.badge.origen { background: var(--neutral); }
.badge.origen.dna  { background: var(--primary); }
.badge.origen.ebay { background: var(--accent); }

/* Status + Fecha inline */
.status-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.status-date {
  color: var(--neutral);
  font-size: 0.85rem;
  font-weight: 600;
}

/* Botones */
.btn {
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  transition: background .2s;
  display: inline-block;
  text-align: center;
}
.btn:hover:not(.disabled) { background: #025AA5; }
.btn.disabled {
  background: #ccc;
  cursor: default;
}

/* Empty */
.empty-row {
  padding: 16px;
  text-align: center;
  color: var(--neutral);
}

/* Responsive */
@media (max-width: 768px) {
  .grid thead { display: none; }
  .grid, .grid tbody, .grid tr, .grid td { display: block; width: 100%; }
  .grid tr { margin-bottom: var(--gap); }
  .grid td {
    padding-left: 50%;
    position: relative;
    text-align: right;
  }
  .grid td::before {
    content: attr(data-label);
    position: absolute;
    left: 8px;
    width: calc(50% - 16px);
    font-weight: 600;
    text-align: left;
  }
}
