/* =====================================================================
   Componentes reutilizables
   ===================================================================== */

/* ---------- Botones ---------- */
.btn {
  --btn-bg: var(--color-surface);
  --btn-fg: var(--color-text);
  --btn-border: var(--color-border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-4);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-md);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; background: var(--color-surface-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: 0.5; pointer-events: none; }

.btn-primary {
  --btn-bg: var(--color-accent);
  --btn-fg: var(--color-on-accent);
  --btn-border: var(--color-accent);
  box-shadow: inset 0 -2px 0 rgba(18, 18, 17, 0.12);
}
.btn-primary:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); box-shadow: inset 0 -2px 0 rgba(18, 18, 17, 0.12), 0 6px 16px -6px rgba(150, 190, 0, 0.6); }

.btn-dark {
  --btn-bg: var(--color-text);
  --btn-fg: var(--color-bg);
  --btn-border: var(--color-text);
}
.btn-dark:hover { background: var(--color-text); opacity: 0.88; }

.btn-ghost { --btn-bg: transparent; --btn-border: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-surface-2); color: var(--color-text); }

.btn-danger { --btn-bg: var(--color-danger); --btn-fg: #fff; --btn-border: var(--color-danger); }
.btn-danger:hover { background: var(--color-danger-text); border-color: var(--color-danger-text); }
.btn-danger-ghost { --btn-bg: transparent; --btn-border: transparent; color: var(--color-danger-text); }
.btn-danger-ghost:hover { background: var(--color-danger-soft); }

.btn-sm { min-height: 32px; padding: 0 var(--space-3); font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-lg { min-height: 52px; padding: 0 var(--space-5); font-size: 1rem; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}
.card-header h2, .card-header h3 { font-size: 1rem; font-weight: 650; }
.card-header .muted { font-size: var(--text-sm); }
.card-body { padding: var(--space-5); }
.card-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.card-flush .card-body { padding: 0; }
.card-muted { background: var(--color-surface-2); box-shadow: none; }

/* ---------- Insignias y chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-3);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}
.badge-plain::before { display: none; }
.badge-success { background: var(--color-success-soft); color: var(--color-success-text); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning-text); }
.badge-danger { background: var(--color-danger-soft); color: var(--color-danger-text); }
.badge-info { background: var(--color-info-soft); color: var(--color-info-text); }
.badge-accent { background: var(--color-accent-soft); color: var(--color-accent-text); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

/* ---------- Formularios ---------- */
.form { display: flex; flex-direction: column; gap: var(--space-5); }
.form-grid { display: grid; gap: var(--space-4) var(--space-5); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}
.field .optional { font-weight: 400; color: var(--color-text-subtle); }
.field-hint { font-size: var(--text-xs); color: var(--color-text-subtle); }
.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--color-danger-text);
  font-weight: 500;
}

.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9375rem;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--color-text-subtle); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--color-text-subtle); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--color-text);
  box-shadow: 0 0 0 4px var(--color-accent-soft), 0 0 0 1px var(--color-text);
}
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 4px var(--color-danger-soft);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2385858F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}
.input-sm, .select-sm { min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: var(--text-sm); }

.input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input-group:focus-within { border-color: var(--color-text); box-shadow: 0 0 0 4px var(--color-accent-soft); }
.input-group .input { border: 0; box-shadow: none; border-radius: 0; min-width: 0; }
.input-group .addon {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}
.input-group .addon:first-child { border-right: 1px solid var(--color-border); }
.input-group .addon:last-child { border-left: 1px solid var(--color-border); }
.input-group.has-error { border-color: var(--color-danger); }

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  cursor: pointer;
}
.check input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--color-accent);
}

.password-field { position: relative; }
.password-field .input { padding-right: 48px; }
.password-field .toggle-visibility {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-subtle);
}
.password-field .toggle-visibility:hover { color: var(--color-text); background: var(--color-surface-2); }

.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 2px; }
.strength span { height: 4px; border-radius: 2px; background: var(--color-surface-3); transition: background var(--dur-base); }
.strength[data-score="1"] span:nth-child(-n+1) { background: var(--color-danger); }
.strength[data-score="2"] span:nth-child(-n+2) { background: var(--color-warning); }
.strength[data-score="3"] span:nth-child(-n+3) { background: var(--color-success); }
.strength[data-score="4"] span { background: var(--color-success); }

.fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.fieldset > legend { padding: 0; margin-bottom: var(--space-1); font-weight: 650; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* Selector visual de opciones (verticales, modalidades) */
.option-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.option-card { position: relative; display: block; cursor: pointer; }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card .option-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  height: 100%;
  padding: var(--space-4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
}
.option-card:hover .option-body { border-color: var(--color-text-subtle); transform: translateY(-1px); }
.option-card input:focus-visible + .option-body { outline: 2px solid var(--color-focus); outline-offset: 2px; }
  .option-card input:checked + .option-body {
  border-color: var(--color-text);
  box-shadow: 0 0 0 1px var(--color-text), 0 0 0 5px var(--color-accent-soft);
}
.option-card .option-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
}
.option-card input:checked + .option-body .option-icon { background: var(--color-accent); color: var(--color-on-accent); }
.option-card .option-title { font-weight: 650; font-size: 0.9375rem; }
.option-card .option-text { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.45; }

/* ---------- Avisos ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-info-soft);
  color: var(--color-info-text);
  font-size: var(--text-sm);
}
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--color-success-soft); color: var(--color-success-text); }
.alert-warning { background: var(--color-warning-soft); color: var(--color-warning-text); }
.alert-danger { background: var(--color-danger-soft); color: var(--color-danger-text); }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; }
.alert-body { flex: 1; min-width: 0; }

/* Toasts (mensajes flash) */
.toasts {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-text);
  color: var(--color-bg);
  box-shadow: var(--shadow-3);
  font-size: var(--text-sm);
  animation: toast-in var(--dur-slow) var(--ease-out);
}
.toast .icon { margin-top: 1px; }
.toast-success .icon { color: #5FD08F; }
.toast-error .icon { color: #FF7A7A; }
.toast-close {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.6;
  padding: 0 0 0 var(--space-2);
}
.toast-close:hover { opacity: 1; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: all var(--dur-base) var(--ease-out); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .toasts { left: var(--space-4); right: var(--space-4); bottom: var(--space-4); max-width: none; }
}

/* ---------- Estados vacíos ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-7) var(--space-5);
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}
.empty-icon .icon { width: 26px; height: 26px; }
.empty h3 { font-size: 1.0625rem; }
.empty p { max-width: 42ch; color: var(--color-text-muted); font-size: var(--text-sm); }
.empty-sm { padding: var(--space-6) var(--space-4); }

/* ---------- Indicadores (KPI) ---------- */
.kpi { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.kpi-label { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-text-muted); font-weight: 500; }
.kpi-value {
  font-size: 2.125rem;
  font-weight: 750;
  font-variation-settings: "wdth" 82;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kpi-meta { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--color-text-subtle); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta-up { color: var(--color-success-text); }
.delta-down { color: var(--color-danger-text); }
.sparkline { height: 32px; margin-top: var(--space-1); color: var(--color-accent); }
.sparkline svg { width: 100%; height: 100%; overflow: visible; }

/* ---------- Progreso ---------- */
.progress {
  position: relative;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-3);
  overflow: hidden;
}
.progress > span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--color-text);
  transition: width var(--dur-slow) var(--ease-out);
}
.progress-success > span { background: var(--color-success); }
.progress-warning > span { background: var(--color-warning); }
.progress-held { background: repeating-linear-gradient(45deg, var(--color-surface-3), var(--color-surface-3) 4px, transparent 4px, transparent 8px); }

.ring { --p: 0; --size: 56px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--color-text) calc(var(--p) * 1%), var(--color-surface-3) 0); }
.ring::before { content: ""; grid-area: 1 / 1; width: calc(var(--size) - 10px); height: calc(var(--size) - 10px); border-radius: 50%; background: var(--color-surface); }
.ring span { grid-area: 1 / 1; position: relative; font-size: var(--text-sm); font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- Tablas ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { font-size: var(--text-sm); }
.table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
  white-space: nowrap;
}
.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-fast); }
.table tbody tr:hover { background: var(--color-surface-2); }
.table .cell-main { font-weight: 600; color: var(--color-text); }
.table .cell-sub { font-size: var(--text-xs); color: var(--color-text-subtle); }
.table .actions { text-align: right; white-space: nowrap; }
.table thead th:first-child { border-top-left-radius: var(--radius-lg); }
.table thead th:last-child { border-top-right-radius: var(--radius-lg); }

@media (max-width: 720px) {
  .table-stack thead { display: none; }
  .table-stack tr { display: block; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); }
  .table-stack td { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-1) 0; border: 0; }
  .table-stack td[data-label]::before { content: attr(data-label); color: var(--color-text-subtle); font-size: var(--text-xs); }
  .table-stack .actions { justify-content: flex-end; padding-top: var(--space-2); }
}

/* ---------- Pestañas ---------- */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}
.tab:hover { color: var(--color-text); text-decoration: none; }
.tab.is-active { color: var(--color-text); font-weight: 600; }
.tab.is-active::after {
  content: "";
  position: absolute;
  left: var(--space-2);
  right: var(--space-2);
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-text);
}
.tab .count { font-size: var(--text-xs); color: var(--color-text-subtle); font-variant-numeric: tabular-nums; }

/* Control segmentado */
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}
.segmented a, .segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
}
.segmented .is-active { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-1); }

/* ---------- Menús desplegables (details/summary, sin JS obligatorio) ---------- */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-3);
  animation: pop-in var(--dur-base) var(--ease-out);
}
.dropdown-menu.align-left { left: 0; right: auto; }
.dropdown-menu.drop-up { top: auto; bottom: calc(100% + 6px); }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font-size: var(--text-sm);
  text-align: left;
  text-decoration: none;
}
.dropdown-item:hover { background: var(--color-surface-2); text-decoration: none; }
.dropdown-item .icon { color: var(--color-text-subtle); }
.dropdown-item.is-danger { color: var(--color-danger-text); }
.dropdown-item.is-danger .icon { color: currentColor; }
.dropdown-sep { height: 1px; margin: var(--space-2) 0; background: var(--color-border); }
.dropdown-label { padding: 6px 10px; font-size: var(--text-xs); color: var(--color-text-subtle); font-weight: 600; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- Diálogos (<dialog> nativo) ---------- */
.dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-3);
}
.dialog-lg { width: min(720px, calc(100vw - 32px)); }
.dialog::backdrop { background: var(--color-overlay); backdrop-filter: blur(2px); }
.dialog[open] { animation: pop-in var(--dur-slow) var(--ease-out); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: var(--space-5) var(--space-5) 0; }
.dialog-header h2 { font-size: 1.125rem; }
.dialog-body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.dialog-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-3); padding: 0 var(--space-5) var(--space-5); }
@media (max-width: 640px) {
  .dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 92vh; }
}

/* ---------- Avatares ---------- */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-surface-3);
  color: var(--color-text);
  font-size: var(--text-xs);
  font-weight: 650;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-square { border-radius: var(--radius-md); }
.avatar-lg { width: 44px; height: 44px; font-size: var(--text-sm); }

/* ---------- Cabecera de página ---------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.page-header h1 { font-size: 1.75rem; }
.page-header .page-sub { margin-top: var(--space-1); color: var(--color-text-muted); font-size: var(--text-sm); }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.breadcrumb { display: flex; align-items: center; gap: 6px; margin-bottom: var(--space-2); font-size: var(--text-sm); color: var(--color-text-subtle); }
.breadcrumb a { color: inherit; }
.breadcrumb a:hover { color: var(--color-text); }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.section-title h2 { font-size: 1.125rem; }

/* ---------- Listas ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}
.list-item:last-child { border-bottom: 0; }
.list-link { color: inherit; text-decoration: none; transition: background var(--dur-fast); }
.list-link:hover { background: var(--color-surface-2); text-decoration: none; }

.dl { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: var(--space-3) var(--space-4); margin: 0; font-size: var(--text-sm); }
.dl dt { color: var(--color-text-subtle); }
.dl dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Paginación ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) 0; font-size: var(--text-sm); color: var(--color-text-muted); }
.pagination-links { display: flex; gap: var(--space-2); }

/* ---------- Esqueleto de carga ---------- */
.skeleton { background: linear-gradient(90deg, var(--color-surface-2), var(--color-surface-3), var(--color-surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Pasos (asistente) ---------- */
.stepper { display: flex; gap: var(--space-2); counter-reset: step; list-style: none; margin: 0; padding: 0; }
.stepper li { flex: 1; min-width: 0; }
.stepper a, .stepper button {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  padding: 0 0 var(--space-2);
  border: 0;
  background: transparent;
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: left;
  text-decoration: none;
}
.stepper a::before, .stepper button::before {
  content: "";
  height: 3px;
  border-radius: 2px;
  background: var(--color-surface-3);
  transition: background var(--dur-base);
}
.stepper .is-done, .stepper .is-current { color: var(--color-text); }
.stepper .is-done::before { background: var(--color-text); }
.stepper .is-current::before { background: var(--color-accent); }
.stepper .step-num { color: var(--color-text-subtle); font-weight: 500; }
.table th.text-right { text-align: right; }
/* Los textos solo para lectores de pantalla no deben escapar del contenedor con scroll. */
.table-wrap { position: relative; }
