:root {
  --primary-blue: #1e40af;
  --secondary-blue: #3b82f6;
  --dark-blue: #1e3a8a;
  --light-blue: #dbeafe;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
  color: #1f2937;
}

.batch-header {
  background: linear-gradient(135deg, #1a3a6a 0%, #2a5298 100%);
  color: white;
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgb(255 255 255 / 0.1);
}

.batch-header__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.batch-header__logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.batch-header__logo {
  width: 100%;
  height: 50px;
  margin-right: 20px;
}

.batch-header__title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.batch-header__title {
  margin-bottom: 6px;
}

.batch-header__subtitle {
  margin: 0;
  opacity: 0.9;
}

.batch-header__actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.batch-header__link {
  color: white;
  text-decoration: none;
  padding: 0.65rem 1rem;
  border: 1px solid rgb(255 255 255 / 0.25);
  border-radius: 8px;
  background: rgb(255 255 255 / 0.08);
}

.batch-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.batch-layout > * {
  min-width: 0;
}

.batch-column {
  display: grid;
  gap: 20px;
  align-content: start;
  min-width: 0;
}

.batch-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 28px rgb(15 23 42 / 0.08);
  padding: 20px;
  min-width: 0;
  overflow: hidden;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.muted {
  color: #64748b;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--light-blue);
  color: var(--primary-blue);
}

.field {
  margin-bottom: 16px;
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

.batch-file-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.batch-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 220px;
  padding: 24px;
  border: 2px dashed #93c5fd;
  border-radius: 24px;
  background:
    radial-gradient(circle at top, rgb(219 234 254 / 0.95), transparent 55%),
    linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
  color: #0f172a;
  text-align: center;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    outline-color 0.18s ease;
  outline: 3px solid transparent;
}

.batch-dropzone:hover,
.batch-dropzone.is-dragover {
  transform: translateY(-2px);
  border-color: #2563eb;
  box-shadow: 0 16px 36px rgb(37 99 235 / 0.14);
  background:
    radial-gradient(circle at top, rgb(191 219 254 / 1), transparent 58%),
    linear-gradient(180deg, #fafdff 0%, #e8f1ff 100%);
}

.batch-dropzone:focus-visible {
  outline-color: rgb(37 99 235 / 0.25);
}

.batch-dropzone.has-file {
  border-style: solid;
  border-color: #0f766e;
  box-shadow: 0 14px 30px rgb(15 118 110 / 0.12);
  background:
    radial-gradient(circle at top, rgb(204 251 241 / 0.95), transparent 58%),
    linear-gradient(180deg, #f6fefc 0%, #ecfdf5 100%);
}

.batch-dropzone.has-error {
  border-style: solid;
  border-color: #dc2626;
  box-shadow: 0 14px 30px rgb(220 38 38 / 0.12);
  background:
    radial-gradient(circle at top, rgb(254 226 226 / 0.95), transparent 58%),
    linear-gradient(180deg, #fffafa 0%, #fef2f2 100%);
}

.batch-dropzone__badge {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.9);
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.batch-dropzone__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 78px;
  height: 78px;
  border-radius: 24px;
  background: linear-gradient(135deg, #2563eb 0%, #0f766e 100%);
  color: white;
  font-size: 2.2rem;
  font-weight: 700;
  box-shadow: 0 12px 28px rgb(37 99 235 / 0.25);
}

.batch-dropzone__title {
  font-size: 1.3rem;
  font-weight: 700;
}

.batch-dropzone__subtitle {
  color: #475569;
}

.batch-dropzone__cta {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  background: #0f172a;
  color: white;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 24px rgb(15 23 42 / 0.16);
}

.batch-dropzone__file {
  margin-top: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.78);
  border: 1px solid #dbeafe;
  color: #1e3a8a;
  font-size: 0.95rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
}

.btn-primary {
  background: #0f766e;
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: #115e59;
}

.btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

.btn-sm {
  padding: 8px 10px;
  font-size: 0.85rem;
  border-radius: 8px;
}

.batch-note {
  margin-top: 16px;
  padding: 14px;
  background: #ecfeff;
  border-left: 4px solid #0891b2;
  border-radius: 8px;
  color: #0f172a;
}

.batch-note__text {
  margin: 8px 0 0;
}

.batch-note--error {
  background: #fef2f2;
  border-left-color: #dc2626;
}

.batch-tracking-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: 12px;

  & p {
    margin-bottom: 0;
  }
}

.batch-tracking-title {
  margin-bottom: 6px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
}

.summary-item strong {
  display: block;
  font-size: 1.4rem;
  color: #0f172a;
}

.batch-bulk-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 18px;
  margin-bottom: 18px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
}

.batch-bulk-panel__content {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.batch-bulk-panel__heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.batch-bulk-panel__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.batch-bulk-panel__actions--excel .btn-primary,
.batch-bulk-panel__actions--excel .btn-secondary {
  width: auto;
  flex: 1;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
}

.status--recibido,
.status--preparando,
.status--procesando,
.status--clasificado {
  background: #dbeafe;
  color: #1d4ed8;
}

.status--asociado,
.status--completado {
  background: #dcfce7;
  color: #166534;
}

.status--pendiente_validacion,
.status--completado_con_errores {
  background: #fef3c7;
  color: #92400e;
}

.status--fallido {
  background: #fee2e2;
  color: #b91c1c;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
  font-size: 0.95rem;
}

.traceability-cell {
  min-width: 240px;
  font-size: 0.84rem;
  color: #334155;
  display: grid;
  gap: 4px;
}

th {
  background: #eff6ff;
  color: #1e3a8a;
  position: sticky;
  top: 0;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  max-height: 560px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}

.table-wrap--history {
  max-height: 420px;
}

.table-wrap--group {
  margin: 0;
  max-height: 420px;
  border: 0;
  border-top: 1px solid #e2e8f0;
  border-radius: 0 0 18px 18px;
}

.batch-groups {
  display: grid;
  gap: 18px;
}

.batch-file-group {
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 6px 18px rgb(15 23 42 / 0.05);
}

.batch-file-group--unassigned {
  border-color: #f3d39b;
}

.batch-file-group__summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: #f8fbff;
  cursor: pointer;
  list-style: none;
}

.batch-file-group__summary::-webkit-details-marker {
  display: none;
}

.batch-file-group--unassigned .batch-file-group__summary {
  background: #fffbf3;
}

.batch-file-group__summary::after {
  content: "▾";
  flex: 0 0 auto;
  color: #64748b;
  font-size: 0.95rem;
  line-height: 1;
  transition: transform 0.18s ease;
}

.batch-file-group:not([open]) .batch-file-group__summary::after {
  transform: rotate(-90deg);
}

.batch-file-group__summary-main {
  min-width: 0;
  flex: 1 1 auto;
}

.batch-file-group__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.batch-file-group__title {
  margin: 0;
  color: #0f172a;
  font-size: 1rem;
}

.batch-file-group__meta {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 0.9rem;
}

.batch-case-key-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e8f1ff;
  color: #1d4ed8;
  border: 1px solid #c7dbff;
  box-shadow: none;
}

.batch-file-group--unassigned .batch-case-key-pill {
  background: #fff3dd;
  border-color: #f3d39b;
  color: #b45309;
}

.batch-case-key-pill__label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.78;
}

.batch-case-key-pill__value {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.batch-file-group__stats {
  flex: 0 1 auto;
  color: #475569;
  font-size: 0.86rem;
  white-space: nowrap;
}

.history-row--active {
  background: #eff6ff;
}

.history-row__meta {
  margin-top: 4px;
  font-size: 0.8rem;
}

.empty-state {
  padding: 26px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  color: #475569;
}

.is-hidden {
  display: none !important;
}

.resolve-modal {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(680px, calc(100vw - 32px));
  box-shadow: 0 16px 48px rgb(15 23 42 / 0.25);
}

.resolve-modal::backdrop {
  background: rgb(15 23 42 / 0.45);
}

.resolve-form {
  padding: 22px;
  display: grid;
  gap: 10px;
}

.resolve-form input,
.resolve-form select,
.resolve-form textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  font: inherit;
}

.resolve-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.resolve-modal__actions .btn-primary {
  width: auto;
}

@media (max-width: 960px) {
  .batch-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .batch-header__actions {
    width: 100%;
    justify-content: space-between;
  }

  .batch-layout {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .batch-bulk-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .batch-dropzone__badge {
    position: static;
    margin-bottom: 4px;
  }

  .batch-file-group__stats {
    width: 100%;
    white-space: normal;
  }

  .table-wrap--group {
    max-height: 360px;
  }
}

@media (max-width: 640px) {
  .batch-file-group__title {
    font-size: 1rem;
  }

  .batch-case-key-pill {
    width: 100%;
    justify-content: flex-start;
    border-radius: 12px;
  }
}
