/* Auditoría 360 (ADR 0057): el explorador de Acciones, con su riel de facetas, y el panel de Gestión. Las
   filas de la Huella están en command-center.css; las tablas y los KPI compartidos, en usage.css. */

.ax { display: grid; gap: 18px; min-width: 0; }
.ax-management.is-settled .reveal { animation: none; }

/* KPI */
.ax-kpis-error { grid-column: 1 / -1; }

/* Atajos */
.ax-shortcuts { display: grid; gap: 10px; padding: 14px 16px 16px; }
.ax-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.ax-preset {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px 6px 6px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 700;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .25s var(--spring);
}
.ax-preset-icon {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--tone-soft); color: var(--tone-ink); transition: transform .3s var(--spring);
}
.ax-preset-icon .i { width: 15px; height: 15px; }
.ax-preset:hover { border-color: var(--tone); color: var(--tone-ink); transform: translateY(-1px); }
.ax-preset:hover .ax-preset-icon { transform: rotate(-8deg) scale(1.08); }
.ax-preset:active { transform: scale(.96); }
.ax-preset[aria-pressed="true"] { border-color: transparent; background: var(--tone-soft); color: var(--tone-ink); box-shadow: inset 0 0 0 2px var(--tone); }
.ax-preset[aria-pressed="true"] .ax-preset-icon { background: var(--tone); color: var(--on-color); }
.ax-preset:focus-visible { outline: 3px solid var(--tone-ink); outline-offset: 2px; }

/* Riel y listado */
.ax-body { display: grid; grid-template-columns: minmax(250px, 300px) minmax(0, 1fr); gap: 18px; align-items: start; }
.ax-rail { position: sticky; top: calc(var(--topbar) + 16px); display: grid; gap: 12px; min-width: 0; }
.ax-rail-skeleton { display: grid; gap: 12px; }
.ax-search-row { padding: 14px 22px 0; }
.ax-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 22px 0; }
.ax-chips:empty { display: none; }
.ax-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; max-width: 100%; padding: 4px 8px 4px 12px;
  border-radius: 999px; background: var(--violet-100); color: var(--violet-700); font-size: 12.5px; font-weight: 700;
  overflow-wrap: anywhere; transition: background-color .2s var(--ease), transform .25s var(--spring);
}
.ax-chip .i { width: 14px; height: 14px; }
.ax-chip:hover { background: var(--violet-200); }
.ax-chip:active { transform: scale(.96); }

/* Facetas: un <details> por grupo de opciones */
.ax-facet { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-xs); overflow: hidden; }
.ax-facet-head {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; cursor: pointer; list-style: none;
  font-size: 13.5px; font-weight: 750; color: var(--ink); transition: background-color .2s var(--ease);
}
.ax-facet-head::-webkit-details-marker { display: none; }
.ax-facet-head:hover { background: var(--surface-2); }
.ax-facet-head:focus-visible { outline: 3px solid var(--ring-focus); outline-offset: -3px; }
.ax-facet-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--tone-soft); color: var(--tone-ink); }
.ax-facet-icon .i { width: 15px; height: 15px; }
.ax-facet-title { flex: 1; min-width: 0; }
.ax-facet-total { padding: 2px 8px; border-radius: 999px; background: var(--tone-soft); color: var(--tone-ink); font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ax-facet-chevron { display: grid; color: var(--ink-4); transition: transform .25s var(--ease); }
.ax-facet[open] > .ax-facet-head .ax-facet-chevron { transform: rotate(180deg); }
.ax-facet-body { display: grid; gap: 8px; padding: 0 10px 12px; animation: fade .22s var(--ease); }
.ax-facet-empty { padding: 4px 6px; font-size: 12.5px; color: var(--ink-3); }
.ax-options, .ax-who-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ax-option, .ax-who {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  width: 100%; min-height: 44px; padding: 6px 10px; overflow: hidden; border-radius: var(--r-md); text-align: left;
  font-size: 13px; color: var(--ink-2); transition: background-color .2s var(--ease), color .2s var(--ease), transform .25s var(--spring);
}
.ax-option:hover:not(:disabled), .ax-who:hover { background: var(--surface-2); color: var(--ink); }
.ax-option:active:not(:disabled), .ax-who:active { transform: scale(.96); }
.ax-option:focus-visible, .ax-who:focus-visible { outline: 3px solid var(--ring-focus); outline-offset: -2px; }
.ax-option[aria-pressed="true"] { background: var(--tone-soft); color: var(--tone-ink); font-weight: 700; }
.ax-who[aria-pressed="true"] { background: var(--cyan-50); color: var(--cyan-700); }
.ax-who[aria-pressed="true"] strong { color: var(--cyan-700); }
.ax-option:disabled { cursor: not-allowed; opacity: .55; }
.ax-option-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--tone-soft); color: var(--tone-ink); }
.ax-option-icon .i { width: 14px; height: 14px; }
.ax-option-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-option-count { font-size: 12.5px; font-weight: 800; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ax-option-bar {
  position: absolute; inset: auto 10px 3px; height: 3px; border-radius: 3px; background: var(--tone, var(--cyan-500));
  opacity: .55; transform: scaleX(var(--w, 0)); transform-origin: left center; animation: ax-grow .45s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 30ms); pointer-events: none;
}
.ax-who .ax-option-bar { background: var(--cyan-500); }
@keyframes ax-grow { from { transform: scaleX(0); } }
.ax-who-item { display: flex; align-items: center; gap: 2px; }
.ax-who { flex: 1; min-width: 0; }
.ax-who-text { display: grid; min-width: 0; }
.ax-who-text strong { overflow: hidden; font-size: 13px; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.ax-who-text small { overflow: hidden; font-size: 11.5px; color: var(--ink-3); text-overflow: ellipsis; white-space: nowrap; }
.ax-who-link {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: var(--r-md); color: var(--ink-3);
  transition: background-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.ax-who-link .i { width: 16px; height: 16px; }
.ax-who-link:hover { background: var(--blue-50); color: var(--blue-700); transform: translateX(2px); }
.ax-who-list:has(+ .ax-who-more[aria-expanded="true"]) { max-height: 420px; overflow-y: auto; }
.ax-who-more { justify-self: center; }
.ax-who-more[aria-expanded="true"] .i { transform: rotate(180deg); }

/* Gestión: banda con degradado */
.ax-hero {
  position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 28px;
  padding: 24px 28px; overflow: hidden; border-radius: var(--r-xl); background: var(--grad-deep); color: var(--on-color); box-shadow: var(--shadow-deep);
}
.ax-hero::after { position: absolute; inset: 0; content: ""; background: var(--brand-pattern); opacity: .07; pointer-events: none; }
.ax-hero-copy { position: relative; z-index: 1; flex: 1 1 320px; min-width: 0; }
.ax-hero-copy .eyebrow { color: var(--on-color-2); }
.ax-hero h3 { margin-top: 4px; font-size: clamp(20px, 2.2vw, 26px); font-weight: 800; }
.ax-hero p { margin-top: 6px; max-width: 520px; font-size: 13.5px; color: var(--on-color-2); }
.ax-hero-figures { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
.ax-hero-figures > div { min-width: 112px; padding: 12px 16px; border: 1px solid var(--glass-soft-line); border-radius: var(--r-md); background: var(--glass-soft); }
.ax-hero-figures dt { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--on-color-2); }
.ax-hero-figures dd { margin: 2px 0 0; font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ax-hero-figures .is-sensitive dd { color: var(--amber-500); }

/* Gestión: tarjetas de grupo */
.ax-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ax-section-head h3 { font-size: 16px; font-weight: 750; }
.ax-groups { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.ax-groups-skeleton { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.ax-group {
  position: relative; display: grid; gap: 12px; width: 100%; height: 100%; padding: 16px; overflow: hidden; text-align: left;
  transition: transform .25s var(--spring), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.ax-group::before { position: absolute; inset: 0 0 auto; height: 4px; content: ""; background: var(--tone); opacity: .85; }
.ax-group:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--tone-soft); }
.ax-group:active { transform: scale(.97); }
.ax-group:focus-visible { outline: 3px solid var(--tone-ink); outline-offset: 2px; }
.ax-group[aria-pressed="true"] { border-color: var(--tone); box-shadow: 0 0 0 3px var(--tone-soft), var(--shadow-md); }
.ax-group-top { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink); }
.ax-group:hover .icon-tile { transform: rotate(-6deg) scale(1.06); }
.ax-group .icon-tile { transition: transform .3s var(--spring); }
.ax-stack { display: flex; padding-left: 8px; }
.ax-stack > .avatar, .ax-stack-more { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.ax-stack-more {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--tone-soft); color: var(--tone-ink); font-size: 11px; font-weight: 800;
}
.ax-stack-empty { font-size: 12.5px; color: var(--ink-3); }
.ax-group-figures { display: grid; gap: 2px; font-size: 12.5px; color: var(--ink-3); }
.ax-group-figures b { color: var(--ink); font-variant-numeric: tabular-nums; }
.ax-group-figures .is-sensitive b { color: var(--amber-800); }

/* Gestión: ranking */
.ax-rank td.is-sensitive { color: var(--amber-800); font-weight: 800; }
.ax-group-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ax-group-chips .chip { height: 22px; padding: 0 8px; font-size: 11px; }
.ax-last { display: grid; font-size: 12.5px; color: var(--ink-2); }
.ax-last time { font-size: 11.5px; color: var(--ink-3); }
.ax-rank-link { text-align: right; }
.ax-rank-head { flex-wrap: wrap; align-items: center; }
.ax-rank tbody tr:hover .usage-person strong { color: var(--blue-700); }

.ax-management-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.ax-recent-note { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12.5px; font-weight: 650; color: var(--amber-800); }
.ax-alerts { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ax-alert {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 12px; padding: 10px 12px;
  border-radius: var(--r-md); background: var(--amber-50); transition: transform .2s var(--ease);
}
.ax-alert:hover { transform: translateX(3px); }
.ax-alert-text { display: grid; min-width: 0; font-size: 13px; }
.ax-alert-text small { font-size: 12px; color: var(--amber-800); }
.ax-alert .btn { grid-column: 2; justify-self: start; }

@media (max-width: 1280px) {
  .ax-groups { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}
/* El riel pasa arriba del listado y sus facetas quedan como acordeón (cerradas por omisión). */
@media (max-width: 1100px) {
  .ax-body { grid-template-columns: 1fr; }
  .ax-rail { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start; }
  .ax-management-grid { grid-template-columns: 1fr; }
}
/* La tabla del ranking se lee como tarjetas. */
@media (max-width: 720px) {
  .ax-rank thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ax-rank-wrap { overflow: visible; padding: 0 16px 16px; }
  .ax-rank, .ax-rank tbody { display: block; }
  .ax-rank tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin-bottom: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); }
  .ax-rank th, .ax-rank td { display: grid; gap: 2px; padding: 0; border: 0; white-space: normal; text-align: left; }
  .ax-rank th[scope="row"], .ax-rank td[data-label="Grupo"], .ax-rank td[data-label="Última acción"], .ax-rank-link { grid-column: 1 / -1; }
  .ax-rank td::before { content: attr(data-label); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
  .ax-rank .num { text-align: left; font-size: 15px; font-weight: 800; }
  .ax-rank-link::before { display: none; }
  .ax-rank-link .btn { justify-self: start; }
  .ax-hero { padding: 20px; }
  .ax-hero-figures { width: 100%; }
  .ax-hero-figures > div { flex: 1 1 0; min-width: 0; padding: 10px 12px; }
  .ax-hero-figures dd { font-size: 24px; }
}
@media (max-width: 480px) {
  .ax-search-row, .ax-chips { padding-left: 16px; padding-right: 16px; }
  .ax-shortcuts { padding: 12px; }
  .ax-presets { flex-wrap: nowrap; margin: 0 -12px; padding: 0 12px 4px; overflow-x: auto; scrollbar-width: thin; }
  .ax-preset { flex: none; }
  .ax-groups { grid-template-columns: 1fr 1fr; gap: 10px; }
}
/* Objetivos táctiles cómodos en pantallas táctiles. */
@media (pointer: coarse) {
  .ax .btn-sm, .ax-chip { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .ax-option-bar, .ax-facet-body { animation: none; }
  .ax-preset, .ax-option, .ax-who, .ax-chip, .ax-group, .ax-alert { transition: none; }
}
