:root {
  --primary: #0f1f3d;     /* azul oscuro */
  --brand: #e5a06c;       /* color del logo */
  --text-primary: #0f172a;
  --text-muted: #3f4c63;
  --border-soft: #d0d7e7;
  --main-header-height: 6.5rem;
}

body {
  padding-top: 0;
  transition: padding-top 0.25s ease;
  color: var(--text-primary);
  background-color: #f8fafc;
}

body.has-main-header {
  padding-top: var(--main-header-height, 6.5rem);
}

[data-main-header] {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

[data-main-header].is-scrolled {
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 15px 38px rgba(15, 23, 42, 0.12);
}

.dark [data-main-header] {
  background: rgba(15, 23, 42, 0.9);
}

.dark [data-main-header].is-scrolled {
  background: rgba(15, 23, 42, 0.78);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.55rem;
  background: #fff;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.03s, color 0.2s;
}

.btn:hover { background: #f3f4f6; box-shadow: 0 6px 16px rgba(17, 24, 39, 0.08); }
.btn:active { transform: translateY(1px); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  background: transparent;
  color: #1f2937;
  font-weight: 600;
  font-size: 0.8rem;
  transition: background-color 0.2s, color 0.2s, transform 0.03s;
}

.btn-ghost:hover {
  background: rgba(15, 31, 61, 0.14);
  color: var(--primary);
}

.btn-ghost:active {
  transform: translateY(1px);
}

.dark .btn-ghost {
  color: #cbd5f5;
}

.dark .btn-ghost:hover {
  background: rgba(229, 160, 108, 0.18);
  color: #ffe0c7;
}

.theme-toggle {
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  padding: 0.3rem;
  border-radius: 9999px;
  position: relative;
  border: 1px solid rgba(15, 31, 61, 0.12);
  background: rgba(255, 255, 255, 0.85);
}

.theme-toggle-icon {
  width: 1.25rem;
  height: 1.25rem;
  transition: color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  background: rgba(15, 31, 61, 0.1);
}

.theme-toggle::after {
  content: attr(data-theme-label);
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 0.35rem);
  font-size: 0.65rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.theme-toggle:hover::after {
  opacity: 1;
}

.theme-toggle[data-theme-state="auto"] .theme-toggle-icon {
  color: #0f1f3d;
}

.theme-toggle[data-theme-state="light"] .theme-toggle-icon {
  color: #f59e0b;
}

.theme-toggle[data-theme-state="dark"] .theme-toggle-icon {
  color: #94a3b8;
}

.dark .theme-toggle[data-theme-state="auto"] .theme-toggle-icon {
  color: #e5a06c;
}

.dark .theme-toggle {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.45);
}

.dark .theme-toggle:hover {
  background: rgba(229, 160, 108, 0.22);
}

.dark .theme-toggle[data-theme-state="light"] .theme-toggle-icon {
  color: #fde68a;
}

.dark .theme-toggle[data-theme-state="dark"] .theme-toggle-icon {
  color: #cbd5f5;
}

.btn-tall {
  padding: 0.52rem 0.9rem;
}

.btn-md {
  padding: 0.64rem 0.42rem;
  font-size: 0.8rem;
}

.btn-xl {
  padding: 0.8rem 1.2rem;
  font-size: 0.95rem;
}

.btn-lg {
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
}

.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border-radius: 0.55rem;
  color: #fff;
}

.btn-secondary {
  background: linear-gradient(135deg, #0b1f44, #1e3a8a);
  border: 1px solid #0b1f44;
}

.btn-secondary:hover {
  filter: brightness(1.05);
  box-shadow: 0 8px 20px rgba(11, 31, 68, 0.35);
}

.btn-danger {
  background: linear-gradient(135deg, #b91c1c, #7f1d1d);
  border: 1px solid #7f1d1d;
}

.btn-danger:hover { filter: brightness(1.05); box-shadow: 0 8px 18px rgba(185, 28, 28, 0.35); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #0f1f3d;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.btn-icon:hover { background: #f3f4f6; box-shadow: 0 4px 12px rgba(15, 31, 61, 0.12); }

.card {
  background: #fff;
  border-radius: 1rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.06), 0 1px 2px rgba(2, 6, 23, 0.04);
  padding: 1rem;
}

.resultado-bloque {
  margin-top: 1.5rem;
  padding: 1rem 1.2rem;
  border-radius: 0.95rem;
  border-left: 6px solid transparent;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.resultado-clientes { border-left-color: #0284c7; background: rgba(14, 165, 233, 0.08); }
.resultado-casos { border-left-color: #4f46e5; background: rgba(99, 102, 241, 0.08); }
.resultado-tareas { border-left-color: #059669; background: rgba(34, 197, 94, 0.08); }
.resultado-tickets { border-left-color: #d97706; background: rgba(245, 158, 11, 0.1); }

.resultado-bloque__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.resultado-etiqueta {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.resultado-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: #0f1f3d;
  border-bottom: 1px solid transparent;
}

.resultado-link:hover {
  color: #1d4ed8;
  border-color: rgba(29, 78, 216, 0.45);
}

.resultado-lista {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.resultado-item {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05);
}

.resultado-item__main {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.resultado-item__titulo {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.resultado-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.resultado-label {
  display: inline-block;
  margin-right: 0.35rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
  color: #0f172a;
}

.resultado-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  background: rgba(15, 31, 61, 0.12);
  color: #0f1f3d;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.resultado-item__acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .resultado-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .resultado-item__main {
    max-width: 70%;
  }
}

.searchable-select {
  position: relative;
  display: block;
}

.searchable-select__input {
  width: 100%;
  padding-right: 2.2rem;
}

.searchable-select__clear {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.searchable-select__clear.hidden {
  display: none;
}

.searchable-select__clear:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

.searchable-select__list {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  max-height: 16rem;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 0.75rem;
  box-shadow: 0 20px 32px rgba(15, 23, 42, 0.18);
  z-index: 70;
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}

.searchable-select__list.hidden {
  display: none;
}

.searchable-select__option {
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.searchable-select__option:hover,
.searchable-select__option.is-active {
  background: rgba(15, 31, 61, 0.12);
}

.searchable-select__empty {
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.searchable-select__original {
  display: none !important;
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 0.75rem;
  box-shadow: 0 20px 30px rgba(15, 23, 42, 0.15);
  z-index: 80;
  overflow: hidden;
}

.search-suggestions.hidden {
  display: none;
}

.search-suggestions__list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  max-height: 18rem;
  overflow-y: auto;
}

.search-suggestions__item {
  display: block;
}

.search-suggestions__link {
  display: block;
  padding: 0.55rem 0.85rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: background-color 0.15s ease;
}

.search-suggestions__link:hover,
.search-suggestions__link:focus-visible,
.search-suggestions__link.is-active {
  background: rgba(15, 31, 61, 0.12);
  outline: none;
}

.search-suggestions__label {
  font-weight: 600;
  font-size: 0.9rem;
  display: block;
}

.search-suggestions__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.search-suggestions__empty {
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrapper::-webkit-scrollbar {
  height: 6px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.35);
  border-radius: 9999px;
}

.table-wrapper .table {
  min-width: 640px;
}

.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; color: var(--text-primary); }
.table th { text-align: left; border-bottom: 1px solid #cbd5f5; padding: 0.6rem 0.4rem; color: #1e293b; font-weight: 700; letter-spacing: 0.01em; }
.table td { border-bottom: 1px solid #e2e8f0; padding: 0.55rem 0.4rem; vertical-align: top; color: var(--text-primary); }
.actions-cell {
  vertical-align: middle;
  min-width: 10.5rem;
}
.actions-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  align-items: stretch;
}
.btn-action {
  width: 100%;
  justify-content: center;
}

.priority-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #e2e8f0;
  color: #1f2937;
}
.priority-alta { background: rgba(220, 38, 38, 0.15); color: #b91c1c; }
.priority-media { background: rgba(234, 179, 8, 0.18); color: #b45309; }
.priority-baja { background: rgba(16, 185, 129, 0.15); color: #047857; }

.kanban-wrapper {
  width: 100%;
  overflow-x: auto;
}
.kanban-inner {
  display: flex;
  gap: 1.2rem;
  min-width: 840px;
}

.kanban-column {
  flex: 1 1 0;
  background: #f8fafc;
  border-radius: 1rem;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(15, 31, 61, 0.05);
  max-height: 80vh;
  overflow-y: auto;
}

.kanban-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.kanban-card {
  background: #fff;
  border-radius: 0.85rem;
  border: 1px solid #e2e8f0;
  padding: 0.85rem;
  box-shadow: 0 2px 6px rgba(15, 31, 61, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

input,
select,
textarea {
  border: 1px solid #e5e7eb;
  border-radius: 0.6rem;
  padding: 0.55rem 0.7rem;
  width: 100%;
  outline: none;
  transition: box-shadow 0.2s, border-color 0.2s;
}

textarea.input {
  min-height: 9rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.35); }

label { display: block; margin-bottom: 0.25rem; font-size: 0.85rem; color: var(--text-muted); font-weight: 600; letter-spacing: 0.01em; }

.tag { display: inline-block; font-size: 0.7rem; border: 1px solid #e5e7eb; color: #065f46; background: #ecfdf5; padding: 0.1rem 0.45rem; border-radius: 0.5rem; }

.table tr:hover td { background: #fafafa; }
.table tr:nth-child(even) td { background: #fcfcfd; }

.card h2,
.card h3 { margin-bottom: 0.35rem; font-weight: 700; letter-spacing: -0.01em; }

.card .sub { color: var(--text-muted); font-size: 0.85rem; }

#cal { min-height: 680px; }

header img[alt="logo Justicia Para Todos"] {
  max-height: 5.76rem;
  width: auto;
}

.btn-active,
.btn.active,
.btn[aria-current="page"] {
  background-color: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
}

@media (max-width: 1024px) {
  .card { padding: 0.85rem; }
}

@media (max-width: 1024px) {
  header img[alt="logo Justicia Para Todos"] { max-height: 4.48rem; }
}

@media (max-width: 768px) {
  header img[alt="logo Justicia Para Todos"] { max-height: 3.84rem; }

  .btn,
  .btn-secondary,
  .btn-danger {
    width: 100%;
    justify-content: center;
  }

  .card { padding: 0.75rem; }

  .table { font-size: 0.9rem; }
}

@media (max-width: 640px) {
  header img[alt="logo Justicia Para Todos"] { max-height: 3.2rem; }
}



header nav .btn {
  padding: 0.5rem 0.85rem;
  font-size: 0.95rem;
}

a:focus-visible,
.btn:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.btn-ghost:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

.text-gray-500,
.text-slate-500,
.text-slate-400,
.text-gray-400 {
  color: var(--text-muted) !important;
}

@media (max-width: 768px) {
  header nav .btn {
    width: 100%;
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
  }
}

.tracking-dot-current {
  animation: tracking-dot-pulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.6);
  transform-origin: center;
}

@keyframes tracking-dot-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
    transform: scale(1);
  }
  40% {
    box-shadow: 0 0 0 40px rgba(249, 115, 22, 0);
    transform: scale(1.32);
  }
  65% {
    box-shadow: 0 0 0 44px rgba(249, 115, 22, 0);
    transform: scale(0.92);
  }
}

.tracking-step {
  position: relative;
}

.tracking-step-inner {
  position: relative;
  z-index: 1;
}

.step-icon {
  width: 1.3rem;
  height: 1.3rem;
  display: block;
  transform-origin: center;
  transition: color 0.3s ease, opacity 0.3s ease;
}

.step-icon path,
.step-icon line,
.step-icon polyline,
.step-icon polygon,
.step-icon rect,
.step-icon circle,
.step-icon ellipse {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: step-icon-draw 0.9s ease forwards;
}


.tracking-step-done .step-icon {
  color: #f8fafc;
  filter: drop-shadow(0 0 4px rgba(37, 99, 235, 0.35));
}

.tracking-step-current .step-icon {
  color: #fff;
  animation: step-icon-breathe 2.4s ease-in-out infinite 0.9s;
}

.tracking-step-pending .step-icon {
  color: #94a3b8;
  opacity: 0.8;
}

@keyframes step-icon-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes step-icon-breathe {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(249, 115, 22, 0));
  }
  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.35));
  }
}

@media (prefers-reduced-motion: reduce) {
  .step-icon path,
  .step-icon line,
  .step-icon polyline,
  .step-icon polygon,
  .step-icon rect,
  .step-icon circle,
  .step-icon ellipse {
    animation: none;
    stroke-dashoffset: 0;
  }

  .tracking-step-current .step-icon {
    animation: none;
  }
}

.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;
}

.timeline-wrapper {
  position: relative;
  --step-width: 6.6rem;
  --connector-thickness: 0.22rem;
  --connector-gap: 0.6rem;
  --connector-top: 1.05rem;
}

.tracking-connector {
  display: none;
}

@media (min-width: 768px) {
  .tracking-connector {
    display: block;
    position: absolute;
    top: var(--connector-top);
    left: calc(-1 * ((var(--step-width) + var(--connector-gap)) / 2));
    width: calc(var(--step-width) + var(--connector-gap));
    height: var(--connector-thickness);
    background: #e2e8f0;
    border-radius: 9999px;
    transform: translateY(-50%);
    z-index: 0;
  }

  .tracking-connector-none {
    display: none;
  }

  .tracking-connector-done {
    background: rgba(37, 99, 235, 0.92);
    animation: tracking-line-pulse 1.3s ease-in-out infinite;
  }

  .tracking-connector-pending {
    background: #e2e8f0;
  }
}

@keyframes tracking-line-pulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 26px rgba(59, 130, 246, 0.7);
    opacity: 0.95;
  }
}
