/* ============================================================
   MK SYSTEM — Componentes UI Reutilizables
   ============================================================ */

/* ── Botones ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.5625rem var(--sp-5);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  line-height: 1;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  white-space: nowrap;
  cursor: pointer;
  border: 1.5px solid transparent;
  letter-spacing: 0.01em;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-sm {
  padding: 0.375rem var(--sp-3);
  font-size: var(--fs-sm);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.75rem var(--sp-8);
  font-size: var(--fs-md);
  border-radius: var(--radius-md);
}

.btn-icon {
  padding: 0.5625rem;
  border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
  padding: var(--sp-2);
}

/* Variantes */
.btn-primary {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}

.btn-primary:hover {
  background: var(--c-primary-dark);
  border-color: var(--c-primary-dark);
  box-shadow: 0 4px 12px rgba(26, 86, 219, .3);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-secondary {
  background: var(--c-white);
  color: var(--t-primary);
  border-color: var(--c-border);
}

.btn-secondary:hover {
  background: var(--c-gray-100);
  border-color: var(--c-border-dark);
}

.btn-outline-primary {
  background: transparent;
  color: var(--c-primary);
  border-color: var(--c-primary);
}

.btn-outline-primary:hover {
  background: var(--c-primary-light);
}

.btn-ghost {
  background: transparent;
  color: var(--t-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--c-gray-100);
  color: var(--t-primary);
}

.btn-success {
  background: var(--c-success);
  color: #fff;
  border-color: var(--c-success);
}

.btn-success:hover {
  background: #087a55;
  box-shadow: 0 4px 12px rgba(14, 159, 110, .3);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--c-danger);
  color: #fff;
  border-color: var(--c-danger);
}

.btn-danger:hover {
  background: #c81e1e;
  box-shadow: 0 4px 12px rgba(224, 36, 36, .3);
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--c-warning);
  color: #fff;
  border-color: var(--c-warning);
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.1875rem 0.5rem;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  border-radius: var(--radius-full);
  line-height: 1;
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-primary {
  background: var(--c-primary-light);
  color: var(--c-primary-dark);
}

.badge-success {
  background: var(--c-success-light);
  color: #065f46;
}

.badge-warning {
  background: var(--c-warning-light);
  color: #92400e;
}

.badge-danger {
  background: var(--c-danger-light);
  color: #9b1c1c;
}

.badge-info {
  background: var(--c-info-light);
  color: #164e63;
}

.badge-gray {
  background: var(--c-gray-200);
  color: var(--c-gray-700);
}

.badge-purple {
  background: var(--c-purple-light);
  color: #5b21b6;
}

.badge-dot::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── Avatares ──────────────────────────────────────────────── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-weight: var(--fw-semi);
  font-size: var(--fs-sm);
  color: #fff;
  background: var(--c-primary);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-xs {
  width: 28px;
  height: 28px;
  font-size: var(--fs-xs);
}

.avatar-sm {
  width: 36px;
  height: 36px;
  font-size: var(--fs-sm);
}

.avatar-md {
  width: 44px;
  height: 44px;
  font-size: var(--fs-base);
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: var(--fs-lg);
}

.avatar-xl {
  width: 72px;
  height: 72px;
  font-size: var(--fs-xl);
}

.avatar-2xl {
  width: 96px;
  height: 96px;
  font-size: var(--fs-2xl);
}

.avatar-blue {
  background: linear-gradient(135deg, #1a56db, #3b7ce8);
}

.avatar-green {
  background: linear-gradient(135deg, #0e9f6e, #31c48d);
}

.avatar-purple {
  background: linear(135deg, #7e3af2, #9f7aea);
}

.avatar-red {
  background: linear-gradient(135deg, #e02424, #f05252);
}

.avatar-orange {
  background: linear-gradient(135deg, #d97706, #f59e0b);
}

.avatar-teal {
  background: linear-gradient(135deg, #0694a2, #06b6d4);
}

.avatar-group {
  display: flex;
  align-items: center;
}

.avatar-group .avatar {
  border: 2px solid var(--c-white);
  margin-left: -8px;
  transition: transform var(--transition-fast);
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

.avatar-group .avatar:hover {
  transform: translateY(-2px);
  z-index: 1;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--c-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-body {
  padding: var(--sp-6);
}

.card-header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.card-header h3,
.card-header h4 {
  font-size: var(--fs-base);
  font-weight: var(--fw-semi);
  color: var(--t-primary);
}

.card-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--c-border);
  background: var(--c-gray-100);
}

/* KPI Card */
.kpi-card {
  background: var(--c-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  transition: all var(--transition-base);
  cursor: default;
  min-width: 0;
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kpi-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.25rem;
}

.kpi-card__icon.blue {
  background: var(--c-primary-light);
  color: var(--c-primary);
}

.kpi-card__icon.green {
  background: var(--c-success-light);
  color: var(--c-success);
}

.kpi-card__icon.orange {
  background: var(--c-warning-light);
  color: var(--c-warning);
}

.kpi-card__icon.red {
  background: var(--c-danger-light);
  color: var(--c-danger);
}

.kpi-card__icon.purple {
  background: var(--c-purple-light);
  color: var(--c-purple);
}

.kpi-card__icon.info {
  background: var(--c-info-light);
  color: var(--c-info);
}

.kpi-card__body {
  flex: 1;
  min-width: 0;
}

.kpi-card__value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: var(--fw-bold);
  color: var(--t-primary);
  line-height: 1.15;
}

.kpi-card__label {
  font-size: var(--fs-sm);
  color: var(--t-secondary);
  margin-top: 4px;
}

.kpi-card__trend {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  margin-top: var(--sp-2);
  display: flex;
  align-items: center;
  gap: 3px;
}

.kpi-card__trend.up {
  color: var(--c-success);
}

.kpi-card__trend.down {
  color: var(--c-danger);
}

.kpi-card__trend.neutral {
  color: var(--t-muted);
}

/* ── Formularios ───────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--t-primary);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.form-label .required {
  color: var(--c-danger);
  font-size: var(--fs-sm);
}

.form-control {
  width: 100%;
  padding: 0.5625rem var(--sp-4);
  font-size: var(--fs-base);
  color: var(--t-primary);
  background: var(--c-white);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  line-height: var(--lh-normal);
}

.form-control:hover:not(:disabled) {
  border-color: var(--c-gray-400);
}

.form-control:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, .12);
}

.form-control:disabled {
  background: var(--c-gray-100);
  color: var(--t-muted);
  cursor: not-allowed;
}

.form-control.is-invalid {
  border-color: var(--c-danger);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(224, 36, 36, .12);
}

.form-control.is-valid {
  border-color: var(--c-success);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
  -webkit-appearance: none;
  appearance: none;
}

.form-hint {
  font-size: var(--fs-xs);
  color: var(--t-muted);
}

.form-error {
  font-size: var(--fs-xs);
  color: var(--c-danger);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.form-row {
  display: grid;
  gap: var(--sp-4);
}

.form-row.cols-2 {
  grid-template-columns: 1fr 1fr;
}

.form-row.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-row.cols-4 {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .form-control {
  flex: 1;
}

.input-group .input-icon-left {
  position: absolute;
  left: var(--sp-3);
  color: var(--t-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.input-group .input-icon-right {
  position: absolute;
  right: var(--sp-3);
  color: var(--t-muted);
  display: flex;
  align-items: center;
  cursor: pointer;
}

.input-group.has-icon-left .form-control {
  padding-left: 2.5rem;
}

.input-group.has-icon-right .form-control {
  padding-right: 2.5rem;
}

/* Checkbox & Radio */
.checkbox-group,
.radio-group {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
}

.form-check {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--c-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.form-check label {
  font-size: var(--fs-sm);
  color: var(--t-secondary);
  cursor: pointer;
}

/* Toggle Switch */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
}

.toggle input {
  display: none;
}

.toggle__track {
  width: 44px;
  height: 24px;
  background: var(--c-gray-300);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition-base);
  flex-shrink: 0;
}

.toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base);
}

.toggle input:checked~.toggle__track {
  background: var(--c-primary);
}

.toggle input:checked~.toggle__track .toggle__thumb {
  transform: translateX(20px);
}

.toggle__label {
  font-size: var(--fs-sm);
  color: var(--t-secondary);
  font-weight: var(--fw-medium);
}

/* ── Tablas ─────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  background: var(--c-white);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}

.table thead tr {
  background: var(--c-gray-100);
  border-bottom: 1px solid var(--c-border);
}

.table th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--t-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

.table th.sortable:hover {
  color: var(--c-primary);
}

.table th .sort-icon {
  margin-left: 4px;
  opacity: 0.5;
}

.table th.sort-asc .sort-icon,
.table th.sort-desc .sort-icon {
  opacity: 1;
  color: var(--c-primary);
}

.table tbody tr {
  border-bottom: 1px solid var(--c-border);
  transition: background var(--transition-fast);
}

.table tbody tr:last-child {
  border-bottom: none;
}

.table tbody tr:hover {
  background: var(--c-gray-100);
}

.table td {
  padding: var(--sp-3) var(--sp-4);
  color: var(--t-primary);
  vertical-align: middle;
}

.table td.text-muted {
  color: var(--t-muted);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.table tbody tr:hover .table-actions {
  opacity: 1;
}

@media (max-width: 768px), (pointer: coarse) {
  .table-actions {
    opacity: 1 !important;
  }
}

/* ── Modales ────────────────────────────────────────────────── */
body.modal-open {
  overflow: hidden !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 25, 40, .45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--sp-4);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.modal-overlay.visible {
  opacity: 1;
}

.modal {
  background: var(--c-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.98);
  transition: transform var(--transition-slow);
  overflow: hidden;
}

.modal-overlay.visible .modal {
  transform: translateY(0) scale(1);
}

.modal-sm {
  max-width: 400px;
}

.modal-md {
  max-width: 580px;
}

.modal-lg {
  max-width: 780px;
}

.modal-xl {
  max-width: 980px;
}

.modal-2xl {
  max-width: 1200px;
}

.modal-header {
  padding: var(--sp-6);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--t-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t-muted);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--c-gray-100);
  color: var(--t-primary);
}

.modal-body {
  padding: var(--sp-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--sp-5) var(--sp-6);
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* ── Drawer (panel lateral) ───────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 25, 40, .3);
  backdrop-filter: blur(2px);
  z-index: var(--z-modal);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.drawer-overlay.visible {
  opacity: 1;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 580px;
  max-width: 95vw;
  background: var(--c-white);
  box-shadow: var(--shadow-2xl);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  z-index: calc(var(--z-modal) + 1);
  overflow: hidden;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: var(--sp-6);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-6);
}

.drawer-footer {
  padding: var(--sp-5) var(--sp-6);
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* ── Toasts ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--c-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border-left: 4px solid;
  min-width: 300px;
  max-width: 420px;
  pointer-events: all;
  transform: translateX(calc(100% + 24px));
  transition: transform var(--transition-slow), opacity var(--transition-slow);
  opacity: 0;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.success {
  border-color: var(--c-success);
}

.toast.error {
  border-color: var(--c-danger);
}

.toast.warning {
  border-color: var(--c-warning);
}

.toast.info {
  border-color: var(--c-info);
}

.toast__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  font-size: 1rem;
}

.toast.success .toast__icon {
  color: var(--c-success);
}

.toast.error .toast__icon {
  color: var(--c-danger);
}

.toast.warning .toast__icon {
  color: var(--c-warning);
}

.toast.info .toast__icon {
  color: var(--c-info);
}

.toast__content {
  flex: 1;
}

.toast__title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: var(--t-primary);
}

.toast__message {
  font-size: var(--fs-xs);
  color: var(--t-secondary);
  margin-top: 2px;
}

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--c-border);
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--t-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.tab-item:hover {
  color: var(--c-primary);
}

.tab-item.active {
  color: var(--c-primary);
  border-bottom-color: var(--c-primary);
  font-weight: var(--fw-semi);
}

/* Tabs pill style */
.tabs-pills {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  background: var(--c-gray-100);
  padding: 4px;
  border-radius: var(--radius-lg);
  width: fit-content;
}

.tabs-pills .tab-item {
  border-radius: var(--radius-md);
  border-bottom: none;
  margin-bottom: 0;
  padding: var(--sp-2) var(--sp-4);
}

.tabs-pills .tab-item.active {
  background: var(--c-white);
  box-shadow: var(--shadow-sm);
  color: var(--t-primary);
  border-bottom-color: transparent;
}

/* ── Alertas inline ─────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  border: 1px solid;
}

.alert-info {
  background: var(--c-info-light);
  border-color: #a5f3fc;
  color: #164e63;
}

.alert-success {
  background: var(--c-success-light);
  border-color: #86efac;
  color: #065f46;
}

.alert-warning {
  background: var(--c-warning-light);
  border-color: #fde68a;
  color: #92400e;
}

.alert-danger {
  background: var(--c-danger-light);
  border-color: #fca5a5;
  color: #9b1c1c;
}

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-16) var(--sp-8);
  text-align: center;
  gap: var(--sp-4);
}

.empty-state__icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-2xl);
  background: var(--c-gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--t-muted);
}

.empty-state h3 {
  font-size: var(--fs-lg);
  color: var(--t-primary);
}

.empty-state p {
  font-size: var(--fs-sm);
  color: var(--t-secondary);
  max-width: 340px;
}

/* ── Skeleton loader ─────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--c-gray-200) 25%, var(--c-gray-100) 50%, var(--c-gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.4s linear infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-wave {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* ── Dropdown ───────────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  padding: var(--sp-2);
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  transition: all var(--transition-base);
  pointer-events: none;
}

.dropdown-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  color: var(--t-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
  white-space: nowrap;
}

.dropdown-item:hover {
  background: var(--c-gray-100);
}

.dropdown-item.danger {
  color: var(--c-danger);
}

.dropdown-item.danger:hover {
  background: var(--c-danger-light);
}

.dropdown-divider {
  height: 1px;
  background: var(--c-border);
  margin: var(--sp-2) 0;
}

/* ── Tooltip ────────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--c-gray-900);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 999;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ── Progress bar ───────────────────────────────────────────── */
.progress {
  width: 100%;
  height: 8px;
  background: var(--c-gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--c-primary);
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

.progress-bar.success {
  background: var(--c-success);
}

.progress-bar.warning {
  background: var(--c-warning);
}

.progress-bar.danger {
  background: var(--c-danger);
}

/* ── Chips / Tags ───────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.25rem 0.625rem;
  background: var(--c-gray-100);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--t-secondary);
  white-space: nowrap;
}

.chip .chip-remove {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  color: var(--t-muted);
  transition: all var(--transition-fast);
}

.chip .chip-remove:hover {
  background: var(--c-gray-300);
  color: var(--t-primary);
}

/* ── Search bar ─────────────────────────────────────────────── */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar .search-icon {
  position: absolute;
  left: var(--sp-3);
  color: var(--t-muted);
  pointer-events: none;
  display: flex;
  font-size: 1rem;
}

.search-bar input {
  width: 100%;
  padding: 0.5rem var(--sp-4) 0.5rem 2.375rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  color: var(--t-primary);
  background: var(--c-white);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-bar input::placeholder {
  color: var(--t-muted);
}

.search-bar input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, .1);
}

/* ── Toolbar / filtros ──────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-white);
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: 1;
  min-width: 0;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* ── Paginación ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.pagination-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--t-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.pagination-btn:hover {
  background: var(--c-gray-100);
  color: var(--t-primary);
}

.pagination-btn.active {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Kanban ─────────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  padding-bottom: var(--sp-4);
  height: 100%;
}

.kanban-column {
  min-width: 280px;
  width: 280px;
  background: var(--c-gray-100);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--c-border);
}

.kanban-column-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--c-white);
}

.kanban-column-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: var(--t-primary);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.kanban-count {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  background: var(--c-gray-200);
  color: var(--t-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.kanban-cards {
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  overflow-y: auto;
  flex: 1;
}

.kanban-card {
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  cursor: pointer;
  transition: all var(--transition-base);
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ── Timeline ───────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: var(--sp-8);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--c-border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--sp-6);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--sp-8) + 10px);
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c-white);
  border: 2px solid var(--c-primary);
  z-index: 1;
}

.timeline-date {
  font-size: var(--fs-xs);
  color: var(--t-muted);
  margin-bottom: var(--sp-2);
  font-weight: var(--fw-medium);
}

.timeline-content {
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
}

/* ── Stat divider ─────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-4);
}

/* ── Acciones con íconos SVG inline (emoji fallback) ───────── */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

/* ── Confirmación peligrosa ─────────────────────────────────── */
.confirm-dialog {
  text-align: center;
  padding: var(--sp-4) 0;
}

.confirm-dialog .confirm-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: var(--c-danger-light);
  color: var(--c-danger);
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--sp-4);
}

.confirm-dialog h3 {
  font-size: var(--fs-lg);
  margin-bottom: var(--sp-2);
}

.confirm-dialog p {
  font-size: var(--fs-sm);
  color: var(--t-secondary);
  margin-bottom: var(--sp-6);
}

/* ── Section header ─────────────────────────────────────────── */
.section-header {
  margin-bottom: var(--sp-6);
}

.section-header h2 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  color: var(--t-primary);
  margin-bottom: var(--sp-1);
}

.section-header p {
  font-size: var(--fs-sm);
  color: var(--t-secondary);
}

.section-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}

.section-actions-left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.section-actions-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* ── Info row en fichas ─────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-5);
}

.info-item {}

.info-item__label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--t-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-1);
}

.info-item__value {
  font-size: var(--fs-base);
  color: var(--t-primary);
  font-weight: var(--fw-medium);
}

/* ── Steppers ───────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--sp-8);
  overflow-x: auto;
  scrollbar-width: none;
}

.step {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

.step::after {
  content: '';
  display: block;
  width: 48px;
  height: 2px;
  background: var(--c-border);
  margin: 0 var(--sp-2);
}

.step:last-child::after {
  display: none;
}

.step__number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c-gray-200);
  color: var(--t-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.step.active .step__number {
  background: var(--c-primary);
  color: #fff;
}

.step.completed .step__number {
  background: var(--c-success);
  color: #fff;
}

.step__label {
  font-size: var(--fs-sm);
  color: var(--t-muted);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}

.step.active .step__label,
.step.completed .step__label {
  color: var(--t-primary);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {

  .form-row.cols-2,
  .form-row.cols-3,
  .form-row.cols-4 {
    grid-template-columns: 1fr;
  }

  .modal-lg,
  .modal-xl,
  .modal-2xl {
    max-width: 100%;
    margin: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
}