/* Estilo shadcn/ui (new-york, neutro zinc) sin React: mismos tokens y medidas
   que https://ui.shadcn.com. Primary = azul BaldeCash #4654CD. */
:root {
  --background: #ffffff; --foreground: #09090b;
  --card: #ffffff; --muted: #f4f4f5; --muted-foreground: #71717a;
  --accent: #f4f4f5; --border: #e4e4e7; --input: #e4e4e7;
  --primary: #4654cd; --primary-hover: #3a47b8; --primary-foreground: #ffffff;
  --primary-soft: #ececfb; --primary-border: #d5d8f5; --ring: #4654cd;
  --destructive: #dc2626; --radius: .5rem;
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
  /* alias usados por el JS/HTML existente */
  --azul: var(--primary); --azul-hover: var(--primary-hover); --azul-suave: var(--primary-soft); --azul-borde: var(--primary-border);
  --texto: var(--foreground); --tenue: var(--muted-foreground); --borde: var(--border); --zona: #fafafa;
  color-scheme: light;
  font: 14px/1.5 "Geist", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--foreground); }
body.con-modal { overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
h1 { font-size: 1.5rem; line-height: 1.2; margin: 0; font-weight: 600; letter-spacing: -.025em; }
h2 { font-weight: 600; letter-spacing: -.015em; }
h3 { font-size: .95rem; font-weight: 600; margin: 1.6rem 0 .4rem; }
code { font: .8em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--muted); border-radius: .3rem; padding: .1rem .3rem; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---- ScrollArea: barras finas, thumb redondeado, sin track ---- */
* { scrollbar-width: thin; scrollbar-color: #d4d4d8 transparent; }
*:hover { scrollbar-color: #a1a1aa transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: #a1a1aa; }
::-webkit-scrollbar-corner { background: transparent; }
.visor * { scrollbar-color: rgb(255 255 255 / .25) transparent; }
.visor ::-webkit-scrollbar-thumb { background-color: rgb(255 255 255 / .25); }
.pestanas::-webkit-scrollbar { height: 6px; }
.pestanas::-webkit-scrollbar-thumb { border-width: 1px; }

/* ---- cabecera del sitio ---- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .9rem; height: 3.5rem; padding: 0 1.5rem;
  background: rgb(255 255 255 / .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.marca { display: inline-flex; align-items: center; gap: .55rem; font-weight: 600; color: var(--foreground); letter-spacing: -.01em; }
.marca:hover { color: var(--foreground); }
.marca-logo { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: .4rem; background: var(--primary); color: #fff; font-size: .8rem; font-weight: 700; }
.aviso { display: inline-flex; align-items: center; font-size: .75rem; font-weight: 600; color: var(--muted-foreground); border: 1px solid var(--border); border-radius: .375rem; padding: .05rem .5rem; }
.espacio { flex: 1; }
.flex1 { flex: 1; min-width: 0; }
.usuario { color: var(--muted-foreground); font-size: .85rem; }
.btn-link { display: inline-flex; align-items: center; height: 2rem; padding: 0 .75rem; border-radius: var(--radius); border: 1px solid var(--input); background: #fff;
  color: var(--foreground); box-shadow: var(--shadow-xs); font: inherit; font-size: .8rem; font-weight: 500; cursor: pointer; }
.btn-link:hover { background: var(--accent); }

/* ---- Button (default / outline / ghost / icon) ---- */
.btn, .btn-sec, .btn-icono, .adj-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; white-space: nowrap;
  border-radius: var(--radius); font: inherit; font-size: .875rem; font-weight: 500; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s; }
.btn { height: 2.25rem; padding: 0 1rem; background: var(--primary); color: var(--primary-foreground); border: 0; box-shadow: var(--shadow); }
.btn:hover { background: var(--primary-hover); color: var(--primary-foreground); }
.btn-sec { height: 2rem; padding: 0 .75rem; font-size: .8rem; background: #fff; color: var(--foreground); border: 1px solid var(--input); box-shadow: var(--shadow-xs); }
.btn-sec:hover { background: var(--accent); color: var(--foreground); }
.btn-icono { width: 2rem; height: 2rem; padding: 0; border: 0; background: transparent; color: var(--muted-foreground); font-size: .95rem; }
.btn-icono:hover { background: var(--accent); color: var(--foreground); }

/* ---- layout ---- */
.app { padding: 1.5rem 1.5rem 3rem; max-width: 1600px; margin: 0 auto; }
.tenue { color: var(--muted-foreground); }
/* Breadcrumb */
.migas { font-size: .85rem; color: var(--muted-foreground); margin-bottom: .75rem; display: flex; align-items: center; flex-wrap: wrap; gap: .1rem; }
.migas a { color: var(--muted-foreground); }
.migas a:hover { color: var(--foreground); }
.migas > :last-child { color: var(--foreground); }
.migas .sep { margin: 0 .4rem; color: #a1a1aa; }
.barra { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .9rem; }
.cabecera { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.cabecera p { margin: .3rem 0 0; }

/* ---- Input / Select / Checkbox ---- */
input.buscador, select { height: 2.25rem; font: inherit; font-size: .875rem; color: inherit; background: transparent; border: 1px solid var(--input);
  border-radius: var(--radius); padding: 0 .75rem; box-shadow: var(--shadow-xs); transition: box-shadow .15s, border-color .15s; }
select { padding-right: 2rem; appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m7 15 5 5 5-5M7 9l5-5 5 5'/%3E%3C/svg%3E") no-repeat right .55rem center; cursor: pointer; }
input.buscador::placeholder { color: var(--muted-foreground); }
input.buscador:focus, select:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgb(70 84 205 / .18); }
input.buscador { width: min(420px, 100%); }
input[type="checkbox"] { accent-color: var(--primary); width: 1rem; height: 1rem; vertical-align: -.15rem; }

/* ---- portada de bases (Card + stats) ---- */
.portada { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  padding: 1.5rem; margin-bottom: 1.25rem; border-radius: .75rem; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); }
.portada h1 { font-size: 1.6rem; }
.portada p { margin: .35rem 0 0; max-width: 560px; }
.portada .portada-etiqueta { margin: 0 0 .3rem; font-size: .75rem; font-weight: 600; color: var(--primary); }
.resumen { display: flex; gap: .6rem; flex-wrap: wrap; }
.resumen div { background: var(--card); border: 1px solid var(--border); border-radius: .75rem; padding: .65rem 1rem; min-width: 108px; }
.resumen strong { display: block; font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.resumen span { font-size: .75rem; color: var(--muted-foreground); }

/* ---- herramientas (fijas al hacer scroll) ---- */
.herramientas { position: sticky; top: 3.5rem; z-index: 4; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .6rem 0; margin-bottom: .4rem; background: rgb(255 255 255 / .92); backdrop-filter: blur(6px); }
.herramientas input.buscador { width: min(320px, 100%); }
/* Tabs (TabsList + TabsTrigger) */
.segmentos { display: inline-flex; align-items: center; gap: 0; height: 2.25rem; padding: .2rem; background: var(--muted); border-radius: var(--radius); }
.segmento { display: inline-flex; align-items: center; gap: .4rem; height: 100%; border: 0; background: transparent; font: inherit; font-size: .875rem; font-weight: 500;
  color: var(--muted-foreground); padding: 0 .75rem; border-radius: calc(var(--radius) - 2px); cursor: pointer; transition: color .15s, background-color .15s; }
.segmento:hover { color: var(--foreground); }
.segmento.activo { background: #fff; color: var(--foreground); box-shadow: var(--shadow); }
.segmento-cifra, .pestana-cifra { font-size: .7rem; font-weight: 600; background: rgb(0 0 0 / .06); color: var(--muted-foreground); border-radius: .3rem; padding: 0 .35rem; }
.segmento.activo .segmento-cifra, .pestana.activa .pestana-cifra { background: var(--primary-soft); color: var(--primary); }

/* ---- secciones por workspace ---- */
.seccion { margin-top: 1.5rem; }
.seccion-cabecera { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-bottom: .75rem; }
.seccion-cabecera h2 { margin: 0; font-size: 1.05rem; }
.icono-ws { color: var(--primary); font-size: 1rem; align-self: center; }

/* ---- tarjetas de bases (Card) ---- */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: .75rem; }
.tarjetas > a { color: inherit; border-radius: .75rem; }
.tarjeta { display: flex; align-items: center; gap: .85rem; background: var(--card); border: 1px solid var(--border); border-radius: .75rem;
  padding: .9rem 1rem; height: 100%; box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s, background-color .15s; }
.tarjetas > a:hover .tarjeta { background: #fafafa; box-shadow: var(--shadow); border-color: #d4d4d8; }
.tarjetas > a:focus-visible { outline-offset: 2px; }
.tarjeta.vacia { opacity: .5; }
.tarjeta-fila { display: flex; align-items: center; gap: .85rem; }
.tarjeta-titulo { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tarjeta-titulo mark { background: #fef08a; color: inherit; border-radius: 3px; padding: 0 1px; }
.metricas { display: flex; gap: .4rem; font-size: .8rem; color: var(--muted-foreground); margin-top: .1rem; }
.metricas strong { color: var(--foreground); font-weight: 600; }
.metricas .punto { color: #d4d4d8; }
.flecha { color: var(--muted-foreground); opacity: 0; transform: translateX(-4px); transition: opacity .15s, transform .15s; }
.tarjetas > a:hover .flecha, .tarjetas > a:focus-visible .flecha { opacity: 1; transform: none; }
.icono-base { flex: none; width: 2.5rem; height: 2.5rem; border-radius: var(--radius); display: grid; place-items: center; font-weight: 600; font-size: .85rem; color: #fff; }
.barra .icono-base { width: 2rem; height: 2rem; font-size: .75rem; }
.tono-0 { background: #4654cd; } .tono-1 { background: #0d9488; } .tono-2 { background: #7c3aed; }
.tono-3 { background: #ea580c; } .tono-4 { background: #2563eb; } .tono-5 { background: #db2777; }

/* ---- pestañas de tablas (TabsList con scroll) ---- */
.pestanas { display: flex; gap: 0; width: max-content; max-width: 100%; overflow-x: auto; padding: .2rem; margin-bottom: .9rem;
  background: var(--muted); border-radius: var(--radius); scrollbar-width: thin; }
.pestanas > a { flex: none; border-radius: calc(var(--radius) - 2px); }
.pestana { display: inline-flex; align-items: center; gap: .45rem; height: 1.85rem; padding: 0 .75rem; border-radius: calc(var(--radius) - 2px);
  color: var(--muted-foreground); font-weight: 500; font-size: .875rem; white-space: nowrap; transition: color .15s; }
.pestanas > a:hover .pestana { color: var(--foreground); }
.pestana.activa { background: #fff; color: var(--foreground); box-shadow: var(--shadow); }
.tabla-sola { font-size: 1rem; margin: 0 0 .8rem; }

/* ---- grilla (Table) ---- */
table { border-collapse: collapse; }
.grilla { overflow: auto; max-height: calc(100vh - 270px); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.grilla table { min-width: 100%; font-size: .875rem; }
.grilla th, .grilla td { padding: 0 .75rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.grilla th { height: 2.5rem; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
/* Alto de fila fijo (como Airtable): el contenido se recorta, el detalle completo va en el modal. */
.grilla { --lineas: 1; }
.grilla.alto-medio { --lineas: 2; }
.grilla.alto-alto { --lineas: 4; }
.grilla td { height: calc(var(--lineas) * 1.5rem + .9rem); }
.celda { max-width: 280px; min-width: 60px; max-height: calc(var(--lineas) * 1.5rem); overflow: hidden; line-height: 1.5rem; }
.alto-compacto .celda { white-space: nowrap; text-overflow: ellipsis; }
.alto-compacto .celda .chips { flex-wrap: nowrap; }
.grilla:not(.alto-compacto) .celda { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--lineas); white-space: normal; overflow-wrap: anywhere; }
.grilla:not(.alto-compacto) .celda .chips { display: flex; }
.grilla .fija .celda { max-width: 300px; }
.grilla td.t-number .celda, .grilla td.t-currency .celda, .grilla td.t-percent .celda,
.grilla td.t-count .celda, .grilla td.t-autoNumber .celda, .grilla td.t-rating .celda { text-align: right; min-width: 50px; }
.grilla th { position: sticky; top: 0; background: #fafafa; font-weight: 500; color: var(--muted-foreground); z-index: 2; }
.grilla .fija { position: sticky; left: 0; background: var(--card); z-index: 1; font-weight: 500; box-shadow: inset -1px 0 0 var(--border); }
.grilla th.fija { z-index: 3; background: #fafafa; }
.grilla tbody tr { cursor: pointer; transition: background-color .1s; }
.grilla tbody tr:hover td { background: #f4f4f5; }
.grilla tbody tr:last-child td { border-bottom: 0; }
.grilla tbody tr.fila-esq { cursor: default; }
.vacio-grilla { text-align: center !important; padding: 2.5rem !important; color: var(--muted-foreground); cursor: default; }
.sentinela { padding: .9rem; text-align: center; color: var(--muted-foreground); min-height: 2.5rem; }
.una-linea { display: inline; }
.multilinea { white-space: pre-wrap; }
th.num, td.num, .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Popover (selector de columnas) ---- */
.selector { position: relative; }
.selector summary { display: inline-flex; align-items: center; gap: .4rem; height: 2.25rem; padding: 0 .75rem; cursor: pointer; list-style: none;
  border: 1px solid var(--input); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-xs); font-size: .875rem; font-weight: 500; }
.selector summary:hover { background: var(--accent); }
.selector summary::-webkit-details-marker { display: none; }
.selector-lista { position: absolute; z-index: 6; margin-top: .35rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: .3rem; max-height: 360px; overflow: auto; min-width: 240px; box-shadow: var(--shadow-lg); }
.selector-lista label { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border-radius: calc(var(--radius) - 2px); white-space: nowrap; font-size: .875rem; cursor: pointer; }
.selector-lista label:hover { background: var(--accent); }

/* ---- Skeleton / Spinner ---- */
.esq { display: block; height: .8rem; border-radius: .375rem; background: var(--muted); animation: pulso 2s cubic-bezier(.4, 0, .6, 1) infinite; }
.esq-titulo { height: 1.5rem; width: 240px; margin-bottom: .6rem; }
.esq-sub { width: 360px; max-width: 80%; }
.esq-linea { width: 85%; margin: .25rem 0; }
.esq-corta { width: 45%; margin: .25rem 0; }
.esq-icono { width: 2.5rem; height: 2.5rem; border-radius: var(--radius); flex: none; }
@keyframes pulso { 50% { opacity: .5; } }
.cargando-mas { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted-foreground); font-size: .85rem; }
.spinner { width: 1rem; height: 1rem; border: 2px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; animation: giro .7s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .esq, .spinner { animation: none; } }

/* ---- estados (Alert / Card) ---- */
.estado { padding: 3rem 1rem; text-align: center; color: var(--muted-foreground); }
.estado.error { color: var(--foreground); }
.estado-icono { width: 2.75rem; height: 2.75rem; margin: 0 auto .8rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; background: var(--primary-soft); color: var(--primary); }
.estado.error .estado-icono { background: #fef2f2; color: var(--destructive); }
.estado .acciones { display: flex; gap: .75rem; justify-content: center; align-items: center; margin-top: .9rem; }
.estado.acceso { max-width: 420px; margin: 4rem auto; padding: 2.25rem 1.75rem; border: 1px solid var(--border); border-radius: .75rem; box-shadow: var(--shadow); background: var(--card); }
.estado.acceso h1 { margin-bottom: .6rem; color: var(--foreground); font-size: 1.35rem; }

/* ---- Dialog (ficha) ---- */
.modal { width: min(920px, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); padding: 0; border: 1px solid var(--border); background: var(--background);
  border-radius: .75rem; box-shadow: var(--shadow-lg); color: var(--foreground); overflow: auto; }
.modal:focus, .modal:focus-visible { outline: none; }
.modal::backdrop { background: rgb(0 0 0 / .5); }
.modal[open] { animation: entrar .18s ease-out; }
@keyframes entrar { from { opacity: 0; transform: scale(.97); } }
.modal-barra { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: .5rem; padding: .65rem .75rem .65rem 1.5rem; background: rgb(255 255 255 / .95); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); }
.modal-barra .migas { margin: 0; }
.ficha-cuerpo { padding: 1.25rem 1.5rem 1.5rem; }
.ficha-titulo { font-size: 1.35rem; font-weight: 600; letter-spacing: -.02em; margin: 0 0 .3rem; line-height: 1.25; }
.ver-vacios { display: inline-flex; align-items: center; gap: .4rem; margin: .5rem 0 .2rem; font-size: .85rem; font-weight: 500; color: var(--muted-foreground); cursor: pointer; }
.campos { margin: .6rem 0 0; }
.campo { display: grid; grid-template-columns: minmax(140px, 230px) 1fr; gap: 1rem; padding: .65rem 0; border-top: 1px solid var(--border); }
.campo dt { color: var(--muted-foreground); font-weight: 500; font-size: .85rem; }
.campo dd { margin: 0; overflow-wrap: anywhere; }
.vacio { color: #a1a1aa; }
.nota { margin-top: 1.5rem; font-size: .8rem; }
code.json { font-size: .75rem; }
.check { color: #16a34a; font-weight: 700; }

/* ---- Badge (chips) ---- */
.chips { display: inline-flex; flex-wrap: wrap; gap: .25rem; vertical-align: middle; }
.celda .chip { line-height: 1.2rem; }
.chip { display: inline-flex; align-items: center; border-radius: .375rem; padding: .05rem .5rem; font-size: .75rem; font-weight: 600; background: var(--muted); color: var(--foreground); white-space: nowrap; border: 1px solid transparent; }
.chip.link { background: var(--primary-soft); color: var(--primary); }
a.chip.link:hover { background: #dfe2fb; color: var(--primary-hover); }
.chip.roto { text-decoration: line-through; opacity: .7; }
.chip.mas { background: #fff; border-color: var(--border); color: var(--muted-foreground); }
.c-blue { background: #dbeafe; } .c-cyan { background: #cffafe; } .c-teal { background: #ccfbf1; }
.c-green { background: #dcfce7; } .c-yellow { background: #fef9c3; } .c-orange { background: #ffedd5; }
.c-red { background: #fee2e2; } .c-pink { background: #fce7f3; } .c-purple { background: #f3e8ff; } .c-gray { background: #f4f4f5; }
.fuerte.c-blue { background: #2563eb; color: #fff; } .fuerte.c-cyan { background: #0891b2; color: #fff; }
.fuerte.c-teal { background: #0d9488; color: #fff; } .fuerte.c-green { background: #16a34a; color: #fff; }
.fuerte.c-yellow { background: #eab308; } .fuerte.c-orange { background: #ea580c; color: #fff; }
.fuerte.c-red { background: #dc2626; color: #fff; } .fuerte.c-pink { background: #db2777; color: #fff; }
.fuerte.c-purple { background: #7c3aed; color: #fff; } .fuerte.c-gray { background: #52525b; color: #fff; }

/* ---- adjuntos: Badge en la grilla ---- */
.chip.adj-chip { background: #fff; border-color: var(--border); padding: 0 .45rem 0 .35rem; }
.adj-chip .adj-clip { font-size: .7rem; margin-right: .2rem; }
.adj-chip .tenue { font-weight: 500; font-size: .7rem; margin-left: .15rem; }

/* ---- adjuntos: galería en la ficha (Card compacta) ---- */
.campo-adjuntos { grid-template-columns: 1fr; gap: .5rem; }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.adj { margin: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow-xs); transition: box-shadow .15s, border-color .15s; }
.adj:hover { border-color: #d4d4d8; box-shadow: var(--shadow); }
.adj-vista { display: flex; align-items: center; justify-content: center; position: relative; height: 80px; padding: 0; border: 0; border-bottom: 1px solid var(--border); background: #fafafa; cursor: pointer; overflow: hidden; }
.adj-vista img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.adj:hover .adj-vista img { transform: scale(1.04); }
.adj-vista:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.adj-icono-envoltura { position: relative; display: inline-flex; }
.adj-icono { display: inline-flex; align-items: flex-end; justify-content: center; width: 34px; height: 42px; border-radius: 4px 11px 4px 4px; padding-bottom: .3rem; font-size: .58rem; font-weight: 800; letter-spacing: .03em; color: #fff; background: #71717a; box-shadow: var(--shadow-xs); }
.adj-icono.c-rojo { background: #dc2626; } .adj-icono.c-verde { background: #16a34a; } .adj-icono.c-azul { background: #2563eb; }
.adj-icono.c-naranja { background: #ea580c; } .adj-icono.c-morado { background: #7c3aed; } .adj-icono.c-gris { background: #71717a; }
.adj-play { position: absolute; right: -8px; bottom: -5px; width: 18px; height: 18px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .6rem; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.adj figcaption { display: flex; flex-direction: column; gap: 0; padding: .4rem .55rem .5rem; min-width: 0; }
.adj-nombre { font-weight: 500; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adj-meta { color: var(--muted-foreground); font-size: .7rem; }
.adj-acciones { display: flex; gap: .3rem; margin-top: .35rem; }
.adj-btn { flex: 1; height: 1.6rem; padding: 0 .4rem; font-size: .72rem; border: 1px solid var(--input); background: #fff; color: var(--foreground); box-shadow: var(--shadow-xs); }
.adj-btn:hover { background: var(--accent); color: var(--foreground); }
.adj.no-disp { opacity: .7; }
.adj.no-disp .adj-vista { cursor: default; filter: grayscale(1); }
.adj.no-disp:hover { box-shadow: var(--shadow-xs); border-color: var(--border); }
.adj-estado { margin-top: .3rem; font-size: .7rem; font-weight: 600; color: #a16207; background: #fefce8; border: 1px solid #fef08a; border-radius: .375rem; padding: 0 .4rem; align-self: flex-start; }

/* ---- visor (imágenes y videos) ---- */
.visor { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgb(9 9 11 / .92); color: #fff; display: none; }
.visor[open] { display: flex; flex-direction: column; animation: entrar .16s ease-out; }
.visor:focus, .visor:focus-visible { outline: none; }
.visor::backdrop { background: transparent; }
.visor-barra { display: flex; align-items: center; gap: .5rem; padding: .7rem 1rem; }
.visor-nombre { font-weight: 500; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visor-contador { color: #a1a1aa; font-size: .85rem; white-space: nowrap; }
.visor-btn { display: inline-flex; align-items: center; height: 2rem; padding: 0 .75rem; border-radius: var(--radius); border: 1px solid rgb(255 255 255 / .15); background: rgb(255 255 255 / .06); color: #fff; font: inherit; font-size: .8rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.visor-btn:hover { background: rgb(255 255 255 / .14); color: #fff; }
.visor-escena { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 0 4rem 1rem; }
.visor-escena img, .visor-escena video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius); box-shadow: 0 10px 40px rgb(0 0 0 / .5); background: #fff; }
.visor-escena .spinner { position: absolute; width: 2rem; height: 2rem; border-color: rgb(255 255 255 / .2); border-top-color: #fff; }
.visor-error { color: #fca5a5; }
.visor-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 1px solid rgb(255 255 255 / .15); background: rgb(255 255 255 / .08); color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.visor-nav:hover { background: rgb(255 255 255 / .18); }
.visor-nav.ant { left: 1rem; } .visor-nav.sig { right: 1rem; }
.visor-tira { display: flex; gap: .4rem; justify-content: center; padding: 0 1rem 1rem; overflow-x: auto; }
.visor-tira button { flex: none; width: 56px; height: 44px; padding: 0; border-radius: .375rem; border: 2px solid transparent; background: rgb(255 255 255 / .1); color: #fff; cursor: pointer; overflow: hidden; opacity: .55; }
.visor-tira button.activa, .visor-tira button:hover { opacity: 1; border-color: #fff; }
.visor-tira img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 700px) {
  .app { padding: 1rem; }
  .top { padding: 0 1rem; }
  .campo { grid-template-columns: 1fr; gap: .2rem; }
  .aviso, .usuario { display: none; }
  .grilla { max-height: none; }
  .resumen div { min-width: 0; flex: 1; }
  .portada { padding: 1.1rem; }
  .modal { width: 100vw; max-height: 100vh; border-radius: 0; border: 0; }
  .modal-barra .migas { display: none; }
  .visor-escena { padding: 0 .5rem 1rem; }
}

/* ==== Más azul BaldeCash (sobre la base shadcn) ==== */
.top { background: var(--primary); border-bottom-color: var(--primary-hover); backdrop-filter: none; }
.marca, .marca:hover { color: #fff; }
.marca-logo { background: #fff; color: var(--primary); }
.aviso { color: #e3e6ff; border-color: rgb(255 255 255 / .35); }
.usuario { color: #e3e6ff; }
.btn-link { background: rgb(255 255 255 / .12); border-color: rgb(255 255 255 / .3); color: #fff; box-shadow: none; }
.btn-link:hover { background: rgb(255 255 255 / .22); }

.btn-sec, .adj-btn, .selector summary { color: var(--primary); border-color: var(--primary-border); }
.btn-sec:hover, .adj-btn:hover, .selector summary:hover { background: var(--primary-soft); color: var(--primary-hover); }
input.buscador, select { border-color: var(--primary-border); }

.segmentos, .pestanas { background: var(--primary-soft); }
.segmento, .pestana { color: #5b66c9; }
.segmento:hover, .pestanas > a:hover .pestana { color: var(--primary-hover); }
.segmento.activo, .pestana.activa { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.segmento-cifra, .pestana-cifra { background: rgb(70 84 205 / .12); color: var(--primary); }
.segmento.activo .segmento-cifra, .pestana.activa .pestana-cifra { background: rgb(255 255 255 / .22); color: #fff; }

.portada { background: linear-gradient(135deg, var(--primary-soft) 0%, #fff 75%); border-color: var(--primary-border); }
.resumen div { border-color: var(--primary-border); }
.resumen strong { color: var(--primary); }
.seccion-cabecera { border-bottom: 2px solid var(--primary-soft); padding-bottom: .5rem; }
.tarjetas > a:hover .tarjeta { border-color: var(--primary); background: #fafaff; }
.flecha { color: var(--primary); }

.grilla { border-color: var(--primary-border); }
.grilla th, .grilla th.fija { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.grilla tbody tr:hover td { background: #f5f6fe; }
.migas > :last-child { color: var(--primary); font-weight: 500; }

.modal-barra { border-bottom: 2px solid var(--primary); }
.campo dt { color: #5b66c9; }
.adj:hover { border-color: var(--primary-border); }
.adj-vista { background: #f7f8fe; }
.estado.acceso { border-top: 4px solid var(--primary); }

* { scrollbar-color: #c5c9f0 transparent; }
*:hover { scrollbar-color: #8f98e3 transparent; }
::-webkit-scrollbar-thumb { background-color: #c5c9f0; }
::-webkit-scrollbar-thumb:hover { background-color: #8f98e3; }
.visor * { scrollbar-color: rgb(255 255 255 / .25) transparent; }
.visor ::-webkit-scrollbar-thumb { background-color: rgb(255 255 255 / .25); }

/* ==== Modernización: íconos lucide, Tabs animadas, hover de tarjetas ==== */
.ico { width: 1rem; height: 1rem; flex: none; display: inline-block; vertical-align: -.15em; }
.btn .ico, .btn-sec .ico, .btn-link .ico, .visor-btn .ico, .adj-btn .ico, .selector summary .ico { width: .95rem; height: .95rem; }
.adj-btn .ico { width: .8rem; height: .8rem; }
.btn-icono .ico { width: 1.1rem; height: 1.1rem; }
.migas .sep { display: inline-flex; margin: 0 .25rem; color: #a1a1aa; }
.migas .sep .ico { width: .85rem; height: .85rem; }
.icono-ws { display: inline-flex; width: 1.75rem; height: 1.75rem; border-radius: .45rem; background: var(--primary-soft); align-items: center; justify-content: center; }
.icono-ws .ico { width: 1rem; height: 1rem; }
.estado-icono .ico { width: 1.3rem; height: 1.3rem; }
.check .ico { width: 1.05rem; height: 1.05rem; stroke-width: 2.5; }
.adj-chip .adj-clip { width: .75rem; height: .75rem; margin-right: .2rem; color: var(--primary); }
.adj-play .ico { width: .55rem; height: .55rem; fill: currentColor; stroke: none; }
.visor-nav .ico { width: 1.4rem; height: 1.4rem; }
.visor-nav { display: flex; align-items: center; justify-content: center; }
.visor-tira .ico { width: 1rem; height: 1rem; fill: currentColor; }
.btn-sec.hecho { color: #16a34a; border-color: #bbf7d0; background: #f0fdf4; }
.btn-link { gap: .35rem; }

/* Buscador (Input con ícono y atajo) */
.caja-busqueda { position: relative; display: inline-flex; align-items: center; width: min(360px, 100%); }
.caja-busqueda .lupa { position: absolute; left: .7rem; color: var(--primary); pointer-events: none; width: .95rem; height: .95rem; }
.caja-busqueda input.buscador { width: 100%; padding-left: 2.1rem; padding-right: 2.2rem; }
.caja-busqueda .atajo { position: absolute; right: .55rem; pointer-events: none; font: 600 .7rem ui-monospace, monospace; color: var(--muted-foreground);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: .3rem; padding: 0 .35rem; background: #fff; transition: opacity .15s; }
.caja-busqueda input:focus ~ .atajo, .caja-busqueda input:not(:placeholder-shown) ~ .atajo { opacity: 0; }
input.buscador::-webkit-search-cancel-button { cursor: pointer; }

/* Tabs con indicador deslizante */
.con-indicador { position: relative; isolation: isolate; }
.indicador { position: absolute; left: 0; top: 0; z-index: -1; border-radius: calc(var(--radius) - 2px); background: var(--primary);
  box-shadow: 0 2px 8px -2px rgb(70 84 205 / .55); transition: transform .32s cubic-bezier(.3, .9, .3, 1), width .32s cubic-bezier(.3, .9, .3, 1), height .32s; will-change: transform; }
.indicador.sin-animar { transition: none; }
.indicador.oculto { opacity: 0; }
.con-indicador .segmento.activo, .con-indicador .pestana.activa { background: transparent; box-shadow: none; }
.segmento, .pestana { position: relative; transition: color .25s; }
.pestanas > a { position: relative; }
.pestana .ico-tabla { width: .85rem; height: .85rem; opacity: .7; }
.pestana.activa .ico-tabla { opacity: 1; }

/* Tarjetas de bases: elevación, barra azul y brillo que sigue al mouse */
.tarjeta { position: relative; overflow: hidden; isolation: isolate;
  transition: transform .22s cubic-bezier(.3, .9, .3, 1), box-shadow .22s, border-color .22s, background-color .22s; }
.tarjeta::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--primary); transform: scaleY(0); transform-origin: bottom; transition: transform .25s cubic-bezier(.3, .9, .3, 1); }
.tarjeta::after { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .25s;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgb(70 84 205 / .10), transparent 65%); }
.tarjetas > a:hover .tarjeta, .tarjetas > a:focus-visible .tarjeta { transform: translateY(-3px); border-color: var(--primary-border); background: #fff;
  box-shadow: 0 12px 28px -12px rgb(70 84 205 / .45), 0 2px 6px -2px rgb(0 0 0 / .06); }
.tarjetas > a:hover .tarjeta::before, .tarjetas > a:focus-visible .tarjeta::before { transform: scaleY(1); }
.tarjetas > a:hover .tarjeta::after { opacity: 1; }
.tarjetas > a:active .tarjeta { transform: translateY(-1px) scale(.995); }
.icono-base { transition: transform .25s cubic-bezier(.3, .9, .3, 1); }
.tarjetas > a:hover .icono-base { transform: scale(1.07) rotate(-4deg); }
.tarjetas > a:hover .tarjeta-titulo { color: var(--primary); }
.flecha { display: inline-flex; width: 1.75rem; height: 1.75rem; border-radius: 50%; align-items: center; justify-content: center; background: var(--primary-soft); }
.tarjetas > a:hover .flecha { background: var(--primary); color: #fff; }
.tarjeta.principal { border-color: var(--primary-border); background: linear-gradient(135deg, #f7f8ff, #fff 60%); }
.insignia { display: inline-flex; align-items: center; margin-left: .45rem; padding: 0 .4rem; border-radius: .3rem; font-size: .65rem; font-weight: 600;
  background: var(--primary); color: #fff; vertical-align: .1rem; }
.tarjeta-titulo { transition: color .2s; }

/* Estados vacíos */
.vacio-icono { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; margin: 0 auto .6rem; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }

@media (prefers-reduced-motion: reduce) {
  .indicador, .tarjeta, .tarjeta::before, .icono-base { transition: none; }
  .tarjetas > a:hover .tarjeta, .tarjetas > a:hover .icono-base { transform: none; }
}
@media (max-width: 700px) { .caja-busqueda { width: 100%; } .caja-busqueda .atajo { display: none; } }

/* ==== Hover de tablas: filas de la grilla y pestañas ==== */
.grilla tbody tr td { transition: background-color .12s; }
.grilla tbody tr:not(.fila-esq):hover td { background: #f3f4fe; }
.grilla tbody tr:not(.fila-esq):hover td.fija { background: #eceefd; box-shadow: inset 3px 0 0 var(--primary), inset -1px 0 0 var(--primary-border); }
.grilla tbody tr:not(.fila-esq):hover td.fija a { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgb(70 84 205 / .4); }
.grilla tbody tr:not(.fila-esq):active td { background: #e8eafc; }
.grilla tbody tr:not(.fila-esq):hover td + td { box-shadow: inset 0 1px 0 var(--primary-border), inset 0 -1px 0 var(--primary-border); }
.grilla tbody tr:has(.vacio-grilla):hover td { background: transparent; box-shadow: none; }
.grilla th { transition: background-color .12s, color .12s; }
.grilla th:hover { background: #e3e6fb; color: var(--primary-hover); }
.grilla tbody tr:nth-child(even):not(:hover) td { background: #fcfcff; }
.grilla tbody tr:nth-child(even):not(:hover) td.fija { background: #fcfcff; }

.pestanas > a .pestana { transition: color .2s, background-color .2s; }
.pestanas > a:hover .pestana:not(.activa) { background: rgb(70 84 205 / .09); color: var(--primary-hover); }
.pestanas > a:hover .pestana:not(.activa) .ico-tabla { opacity: 1; }
.segmento:not(.activo):hover { background: rgb(70 84 205 / .09); color: var(--primary-hover); }
/* La activa (sobre el indicador azul) siempre en blanco, también con hover. */
.segmento.activo, .segmento.activo:hover, .pestana.activa, .pestanas > a:hover .pestana.activa { color: #fff; }
.segmento.activo:hover .segmento-cifra, .pestanas > a:hover .pestana.activa .pestana-cifra { color: #fff; }
.tarjetas > a:hover .flecha .ico { color: #fff; }

/* ==== Select de shadcn (trigger + popover) ==== */
.sel { position: relative; display: inline-flex; }
.sel-nativo { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sel-boton { display: inline-flex; align-items: center; justify-content: space-between; gap: .6rem; height: 2.25rem; min-width: 10rem; padding: 0 .65rem 0 .75rem;
  font: inherit; font-size: .875rem; color: var(--foreground); background: #fff; border: 1px solid var(--primary-border); border-radius: var(--radius);
  box-shadow: var(--shadow-xs); cursor: pointer; white-space: nowrap; transition: border-color .15s, box-shadow .15s, background-color .15s; }
.sel-boton:hover { border-color: #b9bff0; background: #fcfcff; }
.sel-boton:focus-visible, .sel.abierto .sel-boton { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgb(70 84 205 / .18); }
.sel-flechas { width: .9rem; height: .9rem; color: var(--muted-foreground); }
.sel-lista { position: absolute; top: calc(100% + .35rem); left: 0; z-index: 30; min-width: 100%; padding: .25rem; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top; pointer-events: none; transition: opacity .12s, transform .12s; }
.sel.abierto .sel-lista { opacity: 1; transform: none; pointer-events: auto; }
.herramientas .sel-lista { left: auto; right: 0; }
.sel-opcion { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem .4rem .45rem; border-radius: calc(var(--radius) - 2px);
  font-size: .875rem; white-space: nowrap; cursor: pointer; user-select: none; }
.sel-opcion.foco { background: var(--primary-soft); color: var(--primary-hover); }
.sel-check { width: .9rem; height: .9rem; color: var(--primary); visibility: hidden; }
.sel-opcion[aria-selected="true"] { font-weight: 500; }
.sel-opcion[aria-selected="true"] .sel-check { visibility: visible; }

/* ==== Checkbox de shadcn ==== */
input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 1rem; height: 1rem; margin: 0; flex: none; display: inline-grid; place-content: center;
  border: 1px solid var(--primary); border-radius: .25rem; background: #fff; box-shadow: var(--shadow-xs); cursor: pointer; vertical-align: -.15rem;
  transition: background-color .12s, box-shadow .12s; }
input[type="checkbox"]::after { content: ""; width: .7rem; height: .7rem; transform: scale(0); transition: transform .12s;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat; }
input[type="checkbox"]:checked { background: var(--primary); }
input[type="checkbox"]:checked::after { transform: scale(1); }
input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(70 84 205 / .25); }

/* Input: mismo borde y foco que el Select */
input.buscador:hover { border-color: #b9bff0; }
@media (max-width: 700px) { .sel, .sel-boton { width: 100%; } }

/* ==== Barra de filtros pareja (Input + Select + Popover) ==== */
input.buscador::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
input.buscador { border-color: var(--primary-border); }
.caja-busqueda .limpiar { position: absolute; right: .35rem; display: none; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem;
  padding: 0; border: 0; border-radius: .3rem; background: transparent; color: var(--muted-foreground); cursor: pointer; }
.caja-busqueda .limpiar:hover { background: var(--primary-soft); color: var(--primary); }
.caja-busqueda .limpiar .ico { width: .85rem; height: .85rem; }
.caja-busqueda.con-texto .limpiar { display: inline-flex; }
.caja-busqueda.con-texto .atajo { display: none; }
.caja-busqueda .lupa { color: var(--muted-foreground); transition: color .15s; }
.caja-busqueda:focus-within .lupa { color: var(--primary); }
.selector summary { color: var(--foreground); border-color: var(--primary-border); gap: .5rem; }
.selector summary .ico { color: var(--muted-foreground); }
.selector summary:hover { background: #fcfcff; border-color: #b9bff0; color: var(--foreground); }
.selector[open] summary { border-color: var(--ring); box-shadow: 0 0 0 3px rgb(70 84 205 / .18); }
.selector-lista { padding: .25rem; }
.selector-lista label:hover { background: var(--primary-soft); color: var(--primary-hover); }
.barra .sel-boton, .herramientas .sel-boton { min-width: 0; }

[hidden] { display: none !important; }

/* ==== Menú de la cabecera ==== */
.menu { display: inline-flex; gap: .15rem; margin-left: .6rem; padding: .2rem; border-radius: var(--radius); background: rgb(255 255 255 / .12); }
.menu a { padding: .3rem .75rem; border-radius: calc(var(--radius) - 2px); color: #e3e6ff; font-size: .85rem; font-weight: 500; transition: background-color .15s, color .15s; }
.menu a:hover { color: #fff; background: rgb(255 255 255 / .14); }
.menu a.activo { background: #fff; color: var(--primary); box-shadow: var(--shadow); }

/* ==== Auditoría ==== */
.portada-audit { align-items: flex-start; }
.portada-audit > div:first-child { flex: 1 1 420px; }
.aviso-audit { display: flex; gap: .5rem; align-items: flex-start; margin-top: .6rem !important; max-width: 640px !important; padding: .6rem .75rem;
  border: 1px solid #fde68a; background: #fffbeb; border-radius: var(--radius); color: #713f12; font-size: .85rem; }
.aviso-audit .ico { color: #b45309; margin-top: .15rem; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: .6rem; flex: 0 1 380px; }
.kpi { display: flex; flex-direction: column; gap: .2rem; text-align: left; padding: .7rem .9rem; border: 1px solid var(--primary-border); border-radius: .75rem;
  background: #fff; font: inherit; color: inherit; }
button.kpi { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
button.kpi:hover { border-color: var(--primary); box-shadow: 0 8px 20px -10px rgb(70 84 205 / .5); transform: translateY(-1px); }
.kpi-titulo { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--muted-foreground); }
.kpi strong { font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; color: var(--primary); font-variant-numeric: tabular-nums; }
.kpi.sensible .kpi-titulo .ico { color: #b45309; }

.herramientas-audit { gap: .5rem; }
.herramientas-audit .caja-busqueda { width: min(240px, 100%); }
.grupo-fechas { display: inline-flex; align-items: center; gap: .4rem; }
.grupo-fechas > .ico { color: var(--primary); }
input.fecha { height: 2.25rem; padding: 0 .55rem; font: inherit; font-size: .85rem; color: var(--foreground); background: #fff; border: 1px solid var(--primary-border);
  border-radius: var(--radius); box-shadow: var(--shadow-xs); }
input.fecha:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgb(70 84 205 / .18); }
.sel-lista { max-height: 320px; overflow-y: auto; }

.chips-cat { display: flex; flex-wrap: wrap; gap: .35rem; margin: .3rem 0 .6rem; }
.chip-cat { display: inline-flex; align-items: center; gap: .35rem; height: 1.9rem; padding: 0 .65rem; border-radius: 99px; border: 1px dashed var(--primary-border);
  background: #fff; color: var(--muted-foreground); font: inherit; font-size: .8rem; font-weight: 500; cursor: pointer; transition: all .15s; }
.chip-cat .ico { width: .85rem; height: .85rem; }
.chip-cat:hover { border-color: var(--primary); color: var(--primary); }
.chip-cat.activo { border-style: solid; border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.chip-cat-n { font-size: .7rem; font-weight: 600; padding: 0 .35rem; border-radius: 99px; background: rgb(70 84 205 / .1); }
.chip-cat.suave { border-style: solid; border-color: transparent; }
.chip-cat.suave:hover { background: var(--muted); color: var(--foreground); }
.aviso-sensible { color: #b45309; }
.contexto-filtros { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.contexto-filtros:empty { display: none; }
.filtro-activo { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .3rem .2rem .6rem; border-radius: var(--radius); background: var(--primary); color: #fff; font-size: .8rem; }
.filtro-activo code { background: rgb(255 255 255 / .2); color: #fff; }
.filtro-activo button { display: inline-flex; border: 0; background: rgb(255 255 255 / .18); color: #fff; border-radius: .3rem; padding: .15rem; cursor: pointer; }
.filtro-activo button:hover { background: rgb(255 255 255 / .32); }

.audit-medio { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: .75rem; margin-bottom: 1rem; }
.grafico, .tarjeta-top { position: relative; border: 1px solid var(--border); border-radius: .75rem; padding: .9rem 1rem; background: #fff; box-shadow: var(--shadow-xs); }
.grafico-cab { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
.grafico h3, .tarjeta-top h3 { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-size: .9rem; }
.grafico h3 .ico, .tarjeta-top h3 .ico { color: var(--primary); }
.grafico-lienzo { width: 100%; min-height: 170px; }
.g-barra { fill: var(--primary); }
.g-grid { stroke: #eceef5; stroke-width: 1; }
.g-eje { fill: var(--muted-foreground); font-size: 10px; }
.g-hit { fill: transparent; cursor: crosshair; }
.g-hit.activo { fill: rgb(70 84 205 / .08); }
.grafico-tip { position: absolute; top: 2.4rem; left: 0; pointer-events: none; opacity: 0; transition: opacity .1s; white-space: nowrap;
  background: var(--foreground); color: #fff; font-size: .75rem; padding: .3rem .55rem; border-radius: .375rem; box-shadow: var(--shadow-lg); }
.grafico-tip.visible { opacity: 1; }
.tops { display: grid; gap: .75rem; }
.tarjeta-top ol { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .15rem; }
.tarjeta-top li button { display: grid; grid-template-columns: minmax(0, 1fr) 70px auto; align-items: center; gap: .5rem; width: 100%; padding: .25rem .35rem;
  border: 0; border-radius: .375rem; background: transparent; font: inherit; font-size: .8rem; text-align: left; cursor: pointer; color: inherit; }
.tarjeta-top li button:hover { background: var(--primary-soft); color: var(--primary-hover); }
.top-nombre { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-barra { height: 6px; border-radius: 99px; background: var(--primary-soft); overflow: hidden; }
.top-relleno { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.top-n { font-variant-numeric: tabular-nums; color: var(--muted-foreground); font-size: .75rem; }
.titulo-seccion { margin: 0; font-size: 1.05rem; }

.grilla-audit { max-height: none; overflow: visible; }
.grilla-audit table { width: 100%; }
.grilla-audit td { height: auto; padding: .55rem .75rem; vertical-align: top; }
.grilla-audit tbody tr { cursor: pointer; }
.grilla-audit tbody tr.sensible td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.a-fecha { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted-foreground); font-size: .8rem; }
.a-objeto { max-width: 420px; }
.a-resumen { color: var(--muted-foreground); font-size: .78rem; margin-top: .1rem; }
.a-ip { font: .75rem ui-monospace, monospace; color: var(--muted-foreground); white-space: nowrap; }
.a-base { max-width: 200px; }
.link-usuario { display: inline-flex; align-items: center; gap: .45rem; border: 0; background: none; padding: 0; font: inherit; color: var(--foreground); cursor: pointer; text-align: left; }
.link-usuario:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.avatar { display: inline-grid; place-items: center; flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: .72rem; font-weight: 700; }

.cat { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .5rem; border-radius: .375rem; font-size: .75rem; font-weight: 600;
  background: var(--muted); color: var(--foreground); white-space: nowrap; }
.cat .ico { width: .8rem; height: .8rem; }
.cat-acceso { background: #eef2ff; color: #3730a3; }
.cat.sensible { background: #fffbeb; color: #92400e; box-shadow: inset 0 0 0 1px #fde68a; }
.cat-ia { background: #faf5ff; color: #6b21a8; }

.panel-lateral { margin: 0 0 0 auto; width: min(560px, 100vw); height: 100vh; max-height: none; padding: 0; border: 0; border-left: 1px solid var(--border);
  background: #fff; box-shadow: var(--shadow-lg); overflow: auto; color: var(--foreground); }
.panel-lateral[open] { animation: deslizar .2s ease-out; }
.panel-lateral::backdrop { background: rgb(0 0 0 / .35); }
@keyframes deslizar { from { transform: translateX(30px); opacity: 0; } }
.panel-resumen { font-size: 1rem; font-weight: 500; margin: 0 0 1rem; }
.panel-datos { display: grid; grid-template-columns: 120px 1fr; gap: .35rem .8rem; font-size: .85rem; margin: 0 0 1rem; }
.panel-datos dt { color: var(--muted-foreground); }
.panel-datos dd { margin: 0; overflow-wrap: anywhere; }
.json-bloque { margin: .4rem 0 1rem; padding: .75rem; max-height: 360px; overflow: auto; border-radius: var(--radius); background: #0f172a; color: #e2e8f0;
  font: .75rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Actividad en la ficha */
.seccion-actividad { margin-top: 1.4rem; }
.seccion-actividad .barra { margin-bottom: .2rem; }
.seccion-actividad h3 { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.seccion-actividad h3 .ico { color: var(--primary); }
.seccion-actividad .barra a { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; font-weight: 500; }
.nota-actividad { margin: 0 0 .6rem; font-size: .8rem; }
.linea-tiempo { list-style: none; margin: 0; padding: 0; }
.linea-tiempo li { display: grid; grid-template-columns: 1.8rem 1fr; gap: .6rem; padding: .45rem 0; position: relative; }
.linea-tiempo li:not(:last-child)::before { content: ""; position: absolute; left: .85rem; top: 2rem; bottom: -.3rem; width: 1px; background: var(--primary-border); }
.lt-punto { display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.lt-punto .ico { width: .85rem; height: .85rem; }
.lt-resumen { font-size: .85rem; }
.lt-fecha { font-size: .75rem; }

@media (max-width: 900px) { .audit-medio { grid-template-columns: 1fr; } .kpis { flex-basis: 100%; } .menu { display: none; } }
