/* H&V Factoring · Componentes reutilizables */

/* ── Iconos ───────────────────────────────────────────── */
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 14px; height: 14px; }
.ico-lg { width: 22px; height: 22px; }

/* ── Botones ──────────────────────────────────────────── */
.btn {
  --_bg: var(--c-panel); --_fg: var(--c-text); --_bd: var(--c-line);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--_bd); border-radius: var(--r-md);
  background: var(--_bg); color: var(--_fg);
  font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background var(--dur-1) ease, border-color var(--dur-1) ease, box-shadow var(--dur-1) ease, transform var(--dur-1) ease;
}
.btn:hover { border-color: var(--c-line-strong); box-shadow: var(--sh-1); }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { --_bg: var(--c-btn-bg); --_fg: var(--c-btn-fg); --_bd: var(--c-btn-bg); }
.btn-primary:hover { --_bg: var(--c-btn-hover); --_bd: var(--c-btn-hover); }
.btn-ghost { --_bg: transparent; --_bd: transparent; }
.btn-ghost:hover { --_bg: var(--c-hover); box-shadow: none; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn .count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-grid; place-items: center; font-size: 10.5px;
  background: var(--c-accent-strong); color: #fff;
}
.icon-btn { position: relative; }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-neg); box-shadow: 0 0 0 2px var(--c-bg);
}

kbd {
  display: inline-flex; align-items: center; height: 20px; padding: 0 6px;
  border: 1px solid var(--c-line); border-bottom-width: 2px; border-radius: 5px;
  background: var(--c-panel-2); color: var(--c-text-3);
  font-family: var(--ff-body); font-size: 11px; font-weight: 600;
}

.link { color: var(--c-accent-strong); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link .ico { width: 14px; height: 14px; transition: transform var(--dur-2) var(--ease-out); }
.link:hover .ico { transform: translateX(2px); }
button.link { border: 0; background: none; padding: 0; font-size: inherit; }

/* ── Segmented control ────────────────────────────────── */
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  border-radius: var(--r-md); background: var(--c-sunken); border: 1px solid var(--c-line-soft);
}
.seg button {
  height: 28px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent;
  font-size: 12.5px; font-weight: 600; color: var(--c-text-3); white-space: nowrap;
  transition: background var(--dur-2) var(--ease-out), color var(--dur-1) ease, box-shadow var(--dur-2) ease;
}
.seg button:hover { color: var(--c-text); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--c-panel); color: var(--c-text); box-shadow: var(--sh-1); }
.seg.seg-sm button { height: 24px; padding: 0 9px; font-size: 11.5px; }

/* ── Tarjetas ─────────────────────────────────────────── */
.card {
  position: relative;
  background: var(--c-panel);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  min-width: 0;
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 20px 0;
}
.card-head h3 { font-size: 15px; font-weight: 700; letter-spacing: -0.005em; }
.card-head .sub { font-size: 12.5px; color: var(--c-text-3); margin-top: 2px; }
.card-head .tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.card-body { padding: 14px 20px 18px; }
.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; border-top: 1px solid var(--c-line-soft); font-size: 12px; color: var(--c-text-3);
}

/* ── Badges de estado ─────────────────────────────────── */
.badge {
  --_c: var(--c-neutral); --_bg: var(--c-neutral-soft);
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  background: var(--_bg); color: var(--_c);
  font-size: 11.5px; font-weight: 700; white-space: nowrap; line-height: 1;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.no-dot::before { display: none; }
.badge.pos { --_c: var(--c-pos); --_bg: var(--c-pos-soft); }
.badge.neg { --_c: var(--c-neg); --_bg: var(--c-neg-soft); }
.badge.warn { --_c: var(--c-warn); --_bg: var(--c-warn-soft); }
.badge.info { --_c: var(--c-info); --_bg: var(--c-info-soft); }
.badge.outline { background: transparent; border: 1px solid var(--c-line); color: var(--c-text-2); }

.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px;
  border-radius: 5px; background: var(--c-sunken); color: var(--c-text-2);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}

.rating {
  display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 6px;
  border-radius: 6px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.02em;
  background: var(--c-sunken); color: var(--c-text);
}
.rating.r-A\+, .rating.r-A { background: var(--c-pos-soft); color: var(--c-pos); }
.rating.r-B\+ { background: var(--c-info-soft); color: var(--c-info); }
.rating.r-B { background: var(--c-warn-soft); color: var(--c-warn); }
.rating.r-C { background: var(--c-neg-soft); color: var(--c-neg); }

/* Delta (variación) */
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.delta .ico { width: 12px; height: 12px; stroke-width: 2.4; }
.delta.good { color: var(--c-pos); }
.delta.bad { color: var(--c-neg); }
.delta.flat { color: var(--c-text-3); }

/* ── Formularios ──────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .field-label { font-size: 11.5px; font-weight: 600; color: var(--c-text-2); }
.input, .select {
  height: 36px; width: 100%; padding: 0 11px;
  border: 1px solid var(--c-line); border-radius: var(--r-md);
  background: var(--c-panel); color: var(--c-text); font-size: 13px;
  transition: border-color var(--dur-1) ease, box-shadow var(--dur-1) ease;
}
.select {
  appearance: none; -webkit-appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B777C' stroke-width='2.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 10px center;
  text-overflow: ellipsis; cursor: pointer;
}
.input:hover, .select:hover { border-color: var(--c-line-strong); }
.input:focus, .select:focus { border-color: var(--c-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-focus) 18%, transparent); outline: none; }
.select.is-set { border-color: color-mix(in srgb, var(--c-accent-strong) 55%, var(--c-line)); background-color: var(--c-accent-soft); font-weight: 600; }
.input-sm, .select-sm { height: 30px; font-size: 12.5px; border-radius: var(--r-sm); }
.field.is-invalid .input, .field.is-invalid .select { border-color: var(--c-neg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-neg) 14%, transparent); }
.field .hint { font-size: 11.5px; color: var(--c-text-3); }
.field.is-invalid .hint { color: var(--c-neg); }
.field.is-valid .input { border-color: color-mix(in srgb, var(--c-pos) 60%, var(--c-line)); }

.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--c-text-3); pointer-events: none; }
.input-icon .input { padding-left: 32px; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--c-accent-strong); }

/* ── Tabs ─────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--c-line); overflow-x: auto; overflow-y: hidden; }
.tabs button {
  position: relative; height: 40px; padding: 0 14px; border: 0; background: none;
  font-size: 13px; font-weight: 600; color: var(--c-text-3); white-space: nowrap;
}
.tabs button:hover { color: var(--c-text); }
.tabs button[aria-selected="true"] { color: var(--c-text); }
.tabs button[aria-selected="true"]::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--c-text);
}

/* ── Tablas ───────────────────────────────────────────── */
.table-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--c-line-soft); }
.table-toolbar .input-icon { width: 280px; max-width: 100%; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; font-size: 13px; }
.table th {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 14px; text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-text-3);
  background: var(--c-panel-2); border-bottom: 1px solid var(--c-line);
}
.table th.num, .table td.num { text-align: right; }
.table th button {
  display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
}
.table th button:hover { color: var(--c-text); }
.table th .sort-ico { width: 11px; height: 11px; opacity: 0.35; }
.table th[aria-sort="ascending"] .sort-ico, .table th[aria-sort="descending"] .sort-ico { opacity: 1; color: var(--c-text); }
.table th[aria-sort="descending"] .sort-ico { transform: rotate(180deg); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--c-line-soft); white-space: nowrap; vertical-align: middle; }
.table td.wrap { white-space: normal; }
.table tbody tr { transition: background var(--dur-1) ease; }
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr:hover { background: var(--c-hover); }
.table tbody tr:focus-visible { outline: 2px solid var(--c-focus); outline-offset: -2px; }
.table .cell-main { font-weight: 600; color: var(--c-text); }
.table .cell-sub { font-size: 11.5px; color: var(--c-text-3); }
.table-dense td { padding: 7px 12px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; font-size: 12.5px; color: var(--c-text-3); }
.pager { display: flex; align-items: center; gap: 4px; }
.pager button { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--c-line); border-radius: var(--r-sm); background: var(--c-panel); font-size: 12.5px; font-weight: 600; }
.pager button[aria-current="page"] { background: var(--c-btn-bg); color: var(--c-btn-fg); border-color: var(--c-btn-bg); }
.pager button:disabled { opacity: 0.4; cursor: default; }

.meter { position: relative; height: 6px; border-radius: 3px; background: var(--c-sunken); overflow: hidden; min-width: 60px; }
.meter > i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--c-accent-strong); transform-origin: left; animation: grow-x var(--dur-4) var(--ease-out) both; }
.meter.warn > i { background: var(--c-warn); }
.meter.neg > i { background: var(--c-neg); }
.meter-row { display: flex; align-items: center; gap: 8px; }
.meter-row .meter { flex: 1; }

/* ── Indicadores KPI ──────────────────────────────────── */
.kpi {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  padding: 16px 18px 14px;
  background: var(--c-panel); border: 1px solid var(--c-line); border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), border-color var(--dur-2) ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--c-line-strong); }
.kpi-top { display: flex; align-items: center; gap: 6px; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--c-text-2); }
.kpi-info { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: none; color: var(--c-text-faint); padding: 0; }
.kpi-info:hover, .kpi-info:focus-visible { color: var(--c-text); background: var(--c-hover); }
.kpi-info .ico { width: 14px; height: 14px; }
.kpi-top .tag { margin-left: auto; }
.kpi-value {
  margin-top: 10px;
  font-size: 27px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--c-text-3); margin-left: 3px; letter-spacing: 0; }
.kpi-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--c-text-3); min-height: 18px; flex-wrap: wrap; }
.kpi-spark { height: 40px; margin: 10px -4px 0; }
.kpi-spark svg { width: 100%; height: 100%; overflow: visible; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--c-line); font-size: 12px; }
.kpi-foot .muted { font-size: 11.5px; }
.kpi .link { font-size: 12px; }

/* ── Tooltip ──────────────────────────────────────────── */
.tooltip {
  position: fixed; z-index: var(--z-tip); max-width: 300px;
  padding: 9px 11px; border-radius: 8px;
  background: var(--chart-tooltip-bg); color: var(--chart-tooltip-fg);
  font-size: 12px; line-height: 1.45; box-shadow: var(--sh-3);
  pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity var(--dur-1) ease, transform var(--dur-2) var(--ease-out);
}
.tooltip.is-on { opacity: 1; transform: none; }
.tooltip b { font-weight: 700; }
.tooltip .tip-def { display: block; margin-top: 4px; opacity: 0.72; font-size: 11.5px; }

/* ── Menús desplegables ───────────────────────────────── */
.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  min-width: 260px; max-height: 70vh; overflow: auto;
  padding: 6px; border-radius: var(--r-lg);
  background: var(--c-panel); border: 1px solid var(--c-line); box-shadow: var(--sh-3);
  animation: pop-in var(--dur-2) var(--ease-out);
}
.menu-label { padding: 8px 10px 4px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; font-size: 13px;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--c-hover); }
.menu-item[aria-checked="true"] { font-weight: 700; }
.menu-item[aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--c-accent-strong); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--c-line-soft); }
.menu-note { padding: 8px 10px; font-size: 11.5px; color: var(--c-text-3); line-height: 1.4; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--c-brand-2), var(--c-brand));
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  box-shadow: 0 0 0 2px var(--c-panel), 0 0 0 3px var(--c-line);
}
.profile-btn { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px 0 4px; border: 0; border-radius: var(--r-md); background: none; text-align: left; }
.profile-btn:hover { background: var(--c-hover); }
.profile-btn .who { line-height: 1.15; }
.profile-btn .who b { display: block; font-size: 12.5px; }
.profile-btn .who span { display: block; font-size: 11px; color: var(--c-text-3); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1520px) { .profile-btn .who span { max-width: 118px; } }

/* ── Drawer y modal ───────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: var(--z-drawer);
  background: rgba(8, 14, 16, 0.42);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  animation: fade-in var(--dur-2) ease both;
}
.scrim.is-closing { animation: fade-out var(--dur-2) ease both; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: calc(var(--z-drawer) + 1);
  width: min(760px, 100vw);
  display: flex; flex-direction: column;
  background: var(--c-bg); border-left: 1px solid var(--c-line); box-shadow: var(--sh-3);
  animation: slide-in-right var(--dur-3) var(--ease-out) both;
}
.drawer.is-closing { animation: slide-out-right var(--dur-2) var(--ease-in-out) both; }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 22px; background: var(--c-panel); border-bottom: 1px solid var(--c-line); }
.drawer-head h2 { font-family: var(--ff-display); font-weight: 600; font-size: 26px; line-height: 1.1; }
.drawer-head .sub { color: var(--c-text-3); font-size: 13px; margin-top: 4px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 28px; }
.drawer-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 22px; background: var(--c-panel); border-top: 1px solid var(--c-line); }

.modal {
  position: fixed; left: 50%; top: 50%; z-index: calc(var(--z-modal) + 1);
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: var(--c-panel); border: 1px solid var(--c-line); border-radius: var(--r-xl); box-shadow: var(--sh-3);
  transform: translate(-50%, -50%);
  animation: modal-in var(--dur-3) var(--ease-out) both;
}
.modal.is-closing { animation: modal-out var(--dur-2) ease both; }
.modal.modal-lg { width: min(960px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 22px 12px; }
.modal-head h2 { font-size: 17px; font-weight: 700; }
.modal-head .sub { font-size: 12.5px; color: var(--c-text-3); margin-top: 2px; }
.modal-body { padding: 4px 22px 18px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 22px 18px; }
.scrim.scrim-modal { z-index: var(--z-modal); }

/* ── Toasts ───────────────────────────────────────────── */
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  width: 360px; max-width: calc(100vw - 40px);
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--c-panel); border: 1px solid var(--c-line); box-shadow: var(--sh-3);
  font-size: 13px;
  animation: toast-in var(--dur-3) var(--ease-out) both;
}
.toast.is-closing { animation: toast-out var(--dur-2) ease both; }
.toast .ico { margin-top: 1px; }
.toast b { display: block; }
.toast p { color: var(--c-text-2); font-size: 12.5px; margin-top: 2px; }
.toast.pos .ico { color: var(--c-pos); } .toast.warn .ico { color: var(--c-warn); } .toast.info .ico { color: var(--c-info); } .toast.neg .ico { color: var(--c-neg); }
.toast .x { margin-left: auto; border: 0; background: none; color: var(--c-text-3); padding: 2px; border-radius: 4px; }

/* ── Alertas inline ───────────────────────────────────── */
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--c-info-soft); color: var(--c-text); font-size: 13px;
  border: 1px solid color-mix(in srgb, var(--c-info) 18%, transparent);
}
.callout .ico { color: var(--c-info); margin-top: 1px; }
.callout.warn { background: var(--c-warn-soft); border-color: color-mix(in srgb, var(--c-warn) 22%, transparent); }
.callout.warn .ico { color: var(--c-warn); }
.callout.neg { background: var(--c-neg-soft); border-color: color-mix(in srgb, var(--c-neg) 22%, transparent); }
.callout.neg .ico { color: var(--c-neg); }
.callout.pos { background: var(--c-pos-soft); border-color: color-mix(in srgb, var(--c-pos) 22%, transparent); }
.callout.pos .ico { color: var(--c-pos); }
.callout b { font-weight: 700; }

/* ── Timeline ─────────────────────────────────────────── */
.timeline { list-style: none; position: relative; }
.timeline li { position: relative; display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; padding: 8px 0; }
.timeline li::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: -8px; width: 1px; background: var(--c-line); }
.timeline li:last-child::before { display: none; }
.timeline .tl-ico {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c-sunken); color: var(--c-text-2);
  box-shadow: 0 0 0 3px var(--c-panel);
}
.timeline .tl-ico .ico { width: 14px; height: 14px; }
.timeline .tl-ico.pos { background: var(--c-pos-soft); color: var(--c-pos); }
.timeline .tl-ico.neg { background: var(--c-neg-soft); color: var(--c-neg); }
.timeline .tl-ico.warn { background: var(--c-warn-soft); color: var(--c-warn); }
.timeline .tl-ico.info { background: var(--c-info-soft); color: var(--c-info); }
.timeline .tl-title { font-size: 13px; font-weight: 600; line-height: 1.35; }
.timeline .tl-sub { font-size: 12px; color: var(--c-text-3); margin-top: 1px; line-height: 1.4; }
.timeline .tl-time { font-size: 11.5px; color: var(--c-text-3); white-space: nowrap; text-align: right; }
.timeline .tl-amt { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timeline li.is-new { animation: feed-in var(--dur-4) var(--ease-out) both; }

/* ── Stepper operacional ──────────────────────────────── */
.stepper { display: flex; list-style: none; overflow-x: auto; padding: 4px 0 6px; }
.stepper li { flex: 1; min-width: 86px; position: relative; text-align: center; font-size: 11px; color: var(--c-text-3); padding-top: 26px; line-height: 1.25; }
.stepper li::before {
  content: ""; position: absolute; top: 6px; left: 50%; width: 12px; height: 12px; margin-left: -6px; z-index: 1;
  border-radius: 50%; background: var(--c-panel); border: 2px solid var(--c-line-strong);
}
.stepper li::after { content: ""; position: absolute; top: 11px; left: -50%; right: 50%; height: 2px; background: var(--c-line); }
.stepper li:first-child::after { display: none; }
.stepper li.done { color: var(--c-text-2); }
.stepper li.done::before { background: var(--c-accent-strong); border-color: var(--c-accent-strong); }
.stepper li.done::after, .stepper li.current::after { background: var(--c-accent-strong); }
.stepper li.current { color: var(--c-text); font-weight: 700; }
.stepper li.current::before { background: var(--c-panel); border-color: var(--c-accent-strong); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-accent-strong) 20%, transparent); }
.stepper li.alt::before { border-color: var(--c-neg); background: var(--c-neg); }
.stepper li.alt { color: var(--c-neg); font-weight: 700; }

/* ── Listas de definición ─────────────────────────────── */
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 18px; }
.dl > div { min-width: 0; }
.dl dt { font-size: 11.5px; color: var(--c-text-3); font-weight: 600; }
.dl dd { font-size: 13.5px; font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }

.breakdown { width: 100%; font-size: 13px; }
.breakdown td { padding: 7px 0; border-bottom: 1px dashed var(--c-line); }
.breakdown td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; padding-left: 12px; }
.breakdown tr.minus td:last-child { color: var(--c-text-2); }
.breakdown tr.total td { border-bottom: 0; border-top: 2px solid var(--c-text); padding-top: 10px; font-weight: 800; font-size: 14px; }
.breakdown .note { font-size: 11.5px; color: var(--c-text-3); }

/* ── Skeleton, vacío y error ──────────────────────────── */
.skel {
  position: relative; overflow: hidden; border-radius: 8px;
  background: var(--c-sunken);
}
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--c-panel) 70%, transparent), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s ease-in-out infinite;
}
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 40px 20px; color: var(--c-text-3);
}
.empty .empty-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--c-sunken); color: var(--c-text-2); margin-bottom: 6px; }
.empty .empty-ico .ico { width: 24px; height: 24px; }
.empty h4 { color: var(--c-text); font-size: 15px; }
.empty p { font-size: 13px; max-width: 380px; }

/* ── Paleta de comandos ───────────────────────────────── */
.palette {
  position: fixed; left: 50%; top: 12vh; z-index: calc(var(--z-palette) + 1);
  width: min(640px, calc(100vw - 32px));
  transform: translateX(-50%);
  background: var(--c-panel); border: 1px solid var(--c-line); border-radius: var(--r-xl); box-shadow: var(--sh-3);
  overflow: hidden;
  animation: palette-in var(--dur-3) var(--ease-out) both;
}
.palette .scrim { z-index: var(--z-palette); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--c-line); }
.palette-input .ico { color: var(--c-text-3); }
.palette-input input { flex: 1; height: 54px; border: 0; background: none; font-size: 15px; outline: none; }
.palette-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-group { padding: 10px 10px 4px; }
.palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: none; text-align: left; font-size: 13px; }
.palette-item .ico { color: var(--c-text-3); }
.palette-item .pi-sub { font-size: 11.5px; color: var(--c-text-3); }
.palette-item .pi-right { margin-left: auto; font-size: 11.5px; color: var(--c-text-3); white-space: nowrap; }
.palette-item[aria-selected="true"] { background: var(--c-accent-soft); }
.palette-foot { display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--c-line); font-size: 11.5px; color: var(--c-text-3); }

/* ── Progreso circular ────────────────────────────────── */
.ring { position: relative; display: inline-grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-track { stroke: var(--c-sunken); }
.ring .ring-val { stroke: var(--c-accent-strong); transition: stroke-dashoffset 1.1s var(--ease-out); }
.ring.warn .ring-val { stroke: var(--c-warn); }
.ring.neg .ring-val { stroke: var(--c-neg); }
.ring .ring-label { position: absolute; text-align: center; line-height: 1.1; }
.ring .ring-label b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.ring .ring-label span { font-size: 10.5px; color: var(--c-text-3); }

/* Foco programático en contenedores de capas (no interactivos) */
.drawer-body:focus, .modal-body:focus, .drawer:focus, .modal:focus { outline: none; }
