/*!
 * Wikistar v2 — UI global
 *
 * Parches CDN, third-party, shell y componentes artesanales. Consume el
 * contrato de tokens publicado por el archivo activo en themes/. No se edita
 * para crear una personalidad visual nueva: esa responsabilidad es del theme.
 *
 * Nada de pantallas. Un color o layout de un módulo se pinta en esa página
 * con clases Basecoat / Tailwind.
 *
 * Capas:
 *   1. Parches y ajustes menores
 *   2. Third-party — DataTables, Datepicker, TinyMCE
 *   3. Shell — rail del sidebar, logo, estado activo
 *   4. Componentes artesanales V2
 *
 * Ruta: apps/static/assets/v2/css/ui/wikistar-ui_v1.css
 */

/* ==========================================================================
   1. PARCHES Y AJUSTES MENORES — no editar

   Correcciones para que Basecoat 0.3.9 y Tailwind Browser respeten los tokens.
   Incluye utilidades estructurales compartidas. Nada de estilos de una pantalla.
   ========================================================================== */

/* El panel principal consume el fondo semántico del tema. */
body > main {
    background-color: var(--background);
}

/*
 * WCAG 2.2 2.4.11 — Foco no oscurecido: margen superior para cabecera fija (h-16 = 4rem).
 */
:target,
:focus-visible {
    scroll-margin-top: calc(var(--header-height, 4rem) + 1rem);
}

/*
 * WCAG 2.2 2.3.3 / Práctica AA — Respeto universal a la preferencia de reducción de movimiento.
 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Spinner de carga: feedback de estado, no transición decorativa */
    .animate-spin {
        animation-duration: 1s !important;
        animation-iteration-count: infinite !important;
    }
}

/*
 * Breadcrumb de sección (page_header): chart-1 en dark; en light baja L
 * para que el naranja del seed se lea sobre el papel claro.
 */
.app-v2-page-breadcrumb {
    color: var(--chart-1);
}

html:not(.dark) .app-v2-page-breadcrumb {
    color: oklch(from var(--chart-1) calc(l - 0.12) c h);
}

/* Rol tipográfico compartido; la familia concreta pertenece a cada theme. */
.font-heading {
    font-family: var(--font-heading);
}

/*
 * Tailwind Browser vuelve a dejar algunos bordes de Basecoat en currentColor.
 * Estos componentes deben usar el borde semántico del tema.
 */
.card,
.alert,
.alert-destructive,
.badge-outline,
.btn-outline,
.btn-sm-outline,
.btn-lg-outline,
.btn-icon-outline,
.btn-sm-icon-outline,
.btn-lg-icon-outline,
.dialog > *,
.toast .toast-content,
[data-popover] {
    border-color: var(--border);
}

html.dark .btn-outline,
html.dark .btn-sm-outline,
html.dark .btn-lg-outline,
html.dark .btn-icon-outline,
html.dark .btn-sm-icon-outline,
html.dark .btn-lg-icon-outline {
    border-color: var(--input);
}

/*
 * Elevación semántica: las superficies estructurales permanecen planas.
 * Dialog usa el nivel más alto; popovers y avisos flotantes, el intermedio.
 */
.dialog > * {
    box-shadow: var(--shadow-lg);
}

.card {
    color: var(--card-foreground);
}

.toast .toast-content {
    box-shadow: var(--shadow-md);
}

/*
 * #toaster con Popover API (toast.js): entra al top layer y queda sobre
 * <dialog> modal. Reseteamos estilos UA de popover y recreamos el layout
 * de Basecoat: ancho completo en móvil, tarjeta acotada a la derecha en desktop.
 */
.toaster[popover],
.toaster:popover-open {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-width: none;
    height: fit-content;
    margin: 0;
    border: none;
    background: transparent;
    overflow: visible;
    display: flex;
    flex-direction: column-reverse;
    pointer-events: none;
    padding: 1rem;
    z-index: 50;
}

@media (width >= 40rem) {
    .toaster[popover],
    .toaster:popover-open {
        left: auto;
        right: 0;
        max-width: calc(var(--spacing, 0.25rem) * 90);
    }
}

/* Los estados del Toast consumen la semántica del theme activo. */
.toast[data-category="success"] .toast-content {
    border-color: color-mix(in oklab, var(--success) 40%, var(--border));
    background-color: color-mix(in oklab, var(--success) 8%, var(--popover));
}

.toast[data-category="success"] .toast-content > svg {
    color: var(--success);
}

.toast[data-category="warning"] .toast-content {
    border-color: color-mix(in oklab, var(--warning) 40%, var(--border));
    background-color: color-mix(in oklab, var(--warning) 8%, var(--popover));
}

.toast[data-category="warning"] .toast-content > svg {
    color: var(--warning);
}

.toast[data-category="info"] .toast-content {
    border-color: color-mix(in oklab, var(--info) 40%, var(--border));
    background-color: color-mix(in oklab, var(--info) 8%, var(--popover));
}

.toast[data-category="info"] .toast-content > svg {
    color: var(--info);
}

.toast[data-category="error"] .toast-content {
    border-color: color-mix(in oklab, var(--destructive) 40%, var(--border));
    background-color: color-mix(in oklab, var(--destructive) 8%, var(--popover));
}

.toast[data-category="error"] .toast-content > svg {
    color: var(--destructive);
}

[data-popover] {
    color: var(--popover-foreground);
    box-shadow: var(--shadow-md);
}

.table tr {
    border-color: var(--border);
}

/*
 * Backdrop de Dialog equivalente al style pack Vega de Basecoat 1.0.2.
 * El bundle 0.3.9 solo oscurece el fondo; Vega añade blur-xs (4px).
 */
.dialog::backdrop {
    background-color: rgb(0 0 0 / 10%);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    transition-duration: 100ms;
}

/*
 * Cuerpo scrolleable del Dialog: Basecoat solo da padding inline en section.
 * Sin padding-bottom, el último control (textarea, etc.) queda flush / “comido”
 * visualmente por el footer hermano. Aplica a todos los dialogs V2.
 */
.dialog > * > section {
    padding-bottom: calc(var(--spacing) * 5);
    scroll-padding-bottom: calc(var(--spacing) * 5);
}

/*
 * Basecoat solo estiliza hijos directos (> header > h2 / p).
 * Reglas descendientes preservan la tipografía cuando se agrupan en un <div>.
 */
.dialog > * > header h2 {
    font-size: var(--text-lg);
    line-height: 1;
    font-weight: var(--font-weight-semibold);
}

.dialog > * > header p {
    font-size: var(--text-sm);
    line-height: var(--tw-leading, var(--text-sm--line-height));
    color: var(--muted-foreground);
}

/*
 * En 0.3.9, select.select (nativo) sí trae caja; div.select solo estiliza el
 * popover. El disparador se iguala al nativo para que la galería se vea.
 */
div.select > button {
    display: inline-flex;
    height: 2.25rem;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--input);
    background-color: transparent;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    white-space: nowrap;
}

div.select > button > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

div.select > button:focus-visible {
    border-color: var(--ring);
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.field > select {
    width: 100%;
}

/* --------------------------------------------------------------------------
   Utility: skip link (WCAG 2.4.1 Bypass Blocks)
   -------------------------------------------------------------------------- */

.v2-skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 100;
    transform: translateY(-160%);
    transition: transform 120ms ease;
}

.v2-skip-link:focus,
.v2-skip-link:focus-visible {
    transform: translateY(0);
}

.v2-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   Utility: gradient-hero
   -------------------------------------------------------------------------- */

/*
 * Gradiente sutil derivado de primary y muted. Sigue los knobs del theme.
 */
.gradient-hero {
    --hero-accent: var(--primary);
    background:
        linear-gradient(135deg, color-mix(in oklab, var(--hero-accent) 10%, transparent), transparent 46%),
        color-mix(in oklab, var(--muted) 45%, transparent);
}

.gradient-hero-warning {
    --hero-accent: var(--warning);
}

.gradient-hero-destructive {
    --hero-accent: var(--destructive);
}

/* ==========================================================================
   2. THIRD-PARTY — no editar

   Adaptación visual de plugins que cargan su propio CSS después de este theme.
   Prefijo html donde hace falta ganar especificidad sin !important.
   ========================================================================== */

/* --------------------------------------------------------------------------
   DataTables 3
   -------------------------------------------------------------------------- */

/*
 * DataTables 3 — densidad compacta inspirada en las tablas Bootstrap
 * heredadas. La clase oficial .compact aporta padding de 4px; aquí solo se
 * normalizan tipografía, alineación y controles. No se alteran colores.
 *
 * El prefijo html aumenta la especificidad porque el CSS de DataTables se
 * carga después de este theme.
 */
html div.dt-container,
html table.dataTable {
    --dt-header_border: 1px solid var(--border);
    --dt-footer_border: 1px solid var(--border);
    --dt-body_border: 1px solid var(--border);
}

html table.dataTable.compact {
    font-size: 0.76rem;
    line-height: 1.15;
}

html table.dataTable.compact th,
html table.dataTable.compact td {
    vertical-align: middle;
    white-space: nowrap;
}

html table.dataTable.compact thead th,
html table.dataTable.compact thead td {
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.025rem;
    text-transform: uppercase;
}

/*
 * DataTables 3 pone title + icono con space-between. En columnas anchas el
 * caret se va al borde derecho y parece del header vecino (p. ej. ID vs
 * Colaborador). El icono debe quedar pegado al título.
 */
html table.dataTable thead div.dt-column-header {
    justify-content: flex-start;
    gap: 0.35rem;
}

html table.dataTable thead th.dt-orderable-none span.dt-column-order:empty {
    display: none;
}

html table.dataTable thead th.dt-col-metric div.dt-column-header,
html table.dataTable thead th.text-center div.dt-column-header {
    justify-content: center;
}

html table.dataTable thead th.dt-col-actions div.dt-column-header,
html table.dataTable thead th.text-right div.dt-column-header {
    justify-content: flex-end;
}

/*
 * Roles de columna opt-in. Cada pantalla las pone en <th> y en className
 * de DataTables. Evitan que un métrico a la derecha se pegue a Acciones.
 *   dt-col-metric  — conteos / cifras
 *   dt-col-actions — botones de fila
 *   dt-col-person  — identidad (permite wrap: nombre + badge)
 *   dt-col-tight   — fecha / badge / cifra corta (no absorbe el ancho extra)
 */
html table.dataTable th.dt-col-metric,
html table.dataTable td.dt-col-metric {
    width: 7.5rem;
    min-width: 6.5rem;
    padding-inline-end: 1.75rem;
    text-align: center;
}

html table.dataTable th.dt-col-actions,
html table.dataTable td.dt-col-actions {
    padding-inline-start: 1.25rem;
    text-align: right;
    white-space: nowrap;
}

/*
 * Celdas cortas (cifra, fecha, badge). width: 1% + nowrap deja el
 * espacio extra a las columnas de identidad (posición, persona).
 */
html table.dataTable th.dt-col-tight,
html table.dataTable td.dt-col-tight {
    width: 1%;
    white-space: nowrap;
}

html table.dataTable.compact td.dt-col-person {
    white-space: normal;
}

/*
 * Filtro A–Z del panel DataTables. Chips compactos; el estado activo va
 * por aria-checked para no depender solo del color.
 */
.dt-letter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.dt-letter-chip {
    display: inline-flex;
    min-width: 1.75rem;
    height: 1.75rem;
    align-items: center;
    justify-content: center;
    padding: 0 0.45rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--background);
    color: var(--foreground);
    font-size: 0.72rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    cursor: pointer;
}

.dt-letter-chip:hover {
    background: var(--muted);
}

.dt-letter-chip:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.dt-letter-chip[aria-checked="true"] {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--primary-foreground);
}

.dt-letter-chip[data-datatable-letter=""] {
    min-width: 2.75rem;
    font-weight: 600;
}

html div.dt-container:has(table.dataTable.compact) {
    font-size: 0.76rem;
    line-height: 1.15;
}

html div.dt-container:has(table.dataTable.compact) div.dt-layout-row {
    margin-block: 0.5rem;
}

html div.dt-container:has(table.dataTable.compact) .dt-input,
html div.dt-container:has(table.dataTable.compact) .dt-search input {
    min-height: 1.75rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.76rem;
    line-height: 1rem;
}

html div.dt-container:has(table.dataTable.compact) .dt-paging .dt-paging-button {
    min-width: 1.75rem;
    padding: 0.25rem 0.5rem;
}

/* --------------------------------------------------------------------------
   Vanilla JS Datepicker
   -------------------------------------------------------------------------- */

/*
 * Vanilla JS Datepicker 1.3.4 — adaptación visual al theme V2.
 * El CSS del plugin se carga por página después de este theme; por eso se usa
 * el prefijo html para mantener la especificidad sin recurrir a !important.
 * "Hoy" usa accent porque es un realce contextual; primary queda reservado
 * para selección y extremos de rango.
 *
 * Top-layer (Popover API): mismo patrón que #toaster — por encima de <dialog>
 * modal sin montar el popup como `.dialog > *` (Basecoat lo estila como card).
 */
html .datepicker[popover],
html .datepicker:popover-open {
    position: fixed;
    inset: unset;
    margin: 0;
    border: none;
    padding: 0;
    overflow: visible;
    background: transparent;
    z-index: 9999;
}

/* Fallback cuando el popup se reparenta al <dialog> sin Popover API. */
html .dialog > .datepicker,
html .dialog:is([open], :popover-open) > .datepicker {
    position: fixed;
    inset: auto;
    z-index: 60;
    width: max-content;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    gap: 0;
    overflow: visible;
    opacity: 1;
    translate: none;
    scale: none;
    flex-direction: unset;
}

html .datepicker {
    z-index: 9999;
    color: var(--foreground);
    font: inherit;
}

html .datepicker .datepicker-picker {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--popover);
    color: var(--popover-foreground);
    box-shadow: var(--shadow-md);
}

html .datepicker .datepicker-header,
html .datepicker .datepicker-footer {
    background: var(--popover);
}

html .datepicker .datepicker-controls {
    gap: 0.25rem;
    padding: 0.5rem;
}

html .datepicker .datepicker-controls .button,
html .datepicker .datepicker-controls .btn,
html .datepicker .datepicker-controls button {
    min-width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: calc(var(--radius-md) - 2px);
    background: transparent;
    color: var(--popover-foreground);
    font: inherit;
}

html .datepicker .datepicker-controls .button:hover,
html .datepicker .datepicker-controls .btn:hover,
html .datepicker .datepicker-controls button:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

html .datepicker .days-of-week {
    color: var(--muted-foreground);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

html .datepicker .datepicker-cell {
    border-radius: calc(var(--radius-md) - 3px);
    color: var(--popover-foreground);
    transition: background 140ms ease, color 140ms ease, opacity 140ms ease;
}

html .datepicker .datepicker-cell:not(.disabled):hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

html .datepicker .datepicker-cell.focused:not(.selected) {
    background: var(--accent);
    color: var(--accent-foreground);
}

html .datepicker .datepicker-cell.today:not(.selected):not(.range-start):not(.range-end) {
    border: 1px solid var(--border);
    background: var(--accent);
    color: var(--accent-foreground);
}

html .datepicker .datepicker-cell.selected,
html .datepicker .datepicker-cell.selected:hover,
html .datepicker .datepicker-cell.range-start,
html .datepicker .datepicker-cell.range-end {
    background: var(--primary);
    color: var(--primary-foreground);
}

html .datepicker .datepicker-cell.range:not(.range-start):not(.range-end) {
    background: color-mix(in oklab, var(--primary) 16%, transparent);
    color: var(--popover-foreground);
}

html .datepicker .datepicker-cell.disabled,
html .datepicker .datepicker-cell.prev,
html .datepicker .datepicker-cell.next {
    color: var(--muted-foreground);
}

html .datepicker .datepicker-cell.disabled {
    opacity: 0.45;
}

.v2-datepicker-input {
    font-variant-numeric: tabular-nums;
}

.v2-datepicker-range-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.5rem;
}

.v2-datepicker-range-control > span {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .v2-datepicker-range-control {
        grid-template-columns: 1fr;
    }

    .v2-datepicker-range-control > span {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   TinyMCE
   -------------------------------------------------------------------------- */

/*
 * Los diálogos propios de TinyMCE viven en un <dialog> técnico independiente
 * para superar la capa modal nativa sin dejar pasar los clics al formulario.
 */
.v2-richtext-dialog-layer::backdrop {
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

/* TinyMCE opt-in: el skin resuelve el tema; el shell conserva el foco V2. */
.tox.tox-tinymce {
    max-width: 100%;
    overflow: hidden;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: none !important;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.tox.tox-tinymce:focus-within {
    border-color: var(--ring) !important;
    box-shadow: 0 0 0 2px var(--ring) !important;
}

.field:has(.tox-tinymce) > p {
    margin-top: .375rem;
}

/* ==========================================================================
   3. SHELL WIKISTAR — geometría, no paleta

   Sidebar rail, logo, toggle de tema y estado activo de navegación.
   ========================================================================== */

/* Icono del toggle ligado a html.dark, no al modo oscuro del sistema. */
.app-v2-theme-icon-light {
    display: inline-flex;
}

.app-v2-theme-icon-dark {
    display: none;
}

html.dark .app-v2-theme-icon-light {
    display: none;
}

html.dark .app-v2-theme-icon-dark {
    display: inline-flex;
}

/*
 * Basecoat crea el borde lateral del sidebar, pero el segundo Preflight de
 * Tailwind Browser lo deja en currentColor. Reaplicamos el token del tema sin
 * cambiar el color de textos ni iconos.
 */
.sidebar nav {
    border-color: var(--sidebar-border);
    background-color: var(--sidebar);
}

.sidebar nav > header {
    border-color: var(--sidebar-border);
    background-color: var(--sidebar);
}

/*
 * Carousel V2 (Embla) — estructura mínima; el look usa tokens / utilidades.
 */
.app-v2-carousel {
    position: relative;
}

.app-v2-carousel__viewport {
    position: relative;
    overflow: hidden;
}

.app-v2-carousel__container {
    position: relative;
    display: flex;
    touch-action: pan-y pinch-zoom;
}

.app-v2-carousel__slide {
    flex: 0 0 var(--carousel-basis, 50%);
    min-width: 0;
    padding-inline: 0.35rem;
}

@media (min-width: 768px) {
    .app-v2-carousel__slide {
        flex-basis: var(--carousel-basis-md, 33.333%);
    }
}

@media (min-width: 1024px) {
    .app-v2-carousel__slide {
        flex-basis: var(--carousel-basis-lg, 16.666%);
    }
}

.app-v2-carousel__nav {
    display: flex;
    justify-content: flex-end;
    gap: 0.25rem;
    margin-top: 0.75rem;
}

.app-v2-carousel__btn[disabled] {
    opacity: 0.35;
    pointer-events: none;
}

/* Nav lateral: columnas simétricas [prev | track | next] (sin overlay absoluto). */
.app-v2-carousel--nav-side {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 0.35rem;
    padding-inline: 0.25rem;
}

.app-v2-carousel--nav-side .app-v2-carousel__viewport {
    grid-column: 2;
    grid-row: 1;
    padding-inline: 0;
    min-width: 0;
}

.app-v2-carousel--nav-side .app-v2-carousel__nav {
    display: contents;
    margin: 0;
}

.app-v2-carousel--nav-side [data-carousel-prev] {
    grid-column: 1;
    grid-row: 1;
}

.app-v2-carousel--nav-side [data-carousel-next] {
    grid-column: 3;
    grid-row: 1;
}

/* Play/pause no entra en el rail lateral; el autoplay del dashboard va por JS. */
.app-v2-carousel--nav-side [data-carousel-play-toggle] {
    display: none;
}

.app-v2-carousel--nav-side .app-v2-carousel__btn {
    background-color: color-mix(in oklab, var(--card) 80%, transparent);
    border: 1px solid var(--border);
}

.app-v2-carousel--nav-side.app-v2-carousel--centered {
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
}

.app-v2-carousel--nav-side.app-v2-carousel--centered .app-v2-carousel__viewport {
    grid-column: 1;
}

/* Rail de personas compacto (dashboard): celdas exactas N-por-vista, sin padding
 * lateral que desbalancee el primer/último avatar respecto a las flechas. */
.app-v2-carousel--compact .app-v2-carousel__slide {
    padding-inline: 0;
}

.app-v2-carousel--compact .app-v2-carousel__slide > * {
    margin-inline: auto;
}

/* Pocos slides: centrar el grupo en el viewport (Embla no scrollea). */
.app-v2-carousel--centered .app-v2-carousel__container {
    justify-content: center;
}

.app-v2-carousel--centered .app-v2-carousel__nav {
    display: none;
}

.sidebar summary {
    list-style: none !important;
    text-decoration: none !important;
}

.sidebar summary::-webkit-details-marker,
.sidebar summary::marker {
    display: none !important;
    content: "" !important;
}

/*
 * Basecoat pone overflow:hidden en summary; al rotar el chevron -90deg Chromium
 * deja un trazo horizontal. El ellipsis vive en .app-v2-menu-text, no aquí.
 */
.sidebar nav li > details > summary {
    overflow: visible !important;
}

.app-v2-icon-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

#app-v2-icon-recolor-primary feFlood {
    flood-color: var(--sidebar-primary);
}

#app-v2-icon-recolor-accent feFlood {
    flood-color: var(--sidebar-accent-foreground);
}

.app-v2-menu-icon {
    width: 1.1rem;
    height: 1.1rem;
    flex: 0 0 auto;
    object-fit: contain;
}

html.dark .app-v2-menu-icon {
    filter: invert(1) brightness(2);
}

.app-v2-brand-logo-img {
    height: 1.4rem;
    width: auto;
    max-width: 9.5rem;
    object-fit: contain;
    transition: height 0.28s ease, max-width 0.28s ease;
}

html.dark .app-v2-brand-logo-img {
    filter: invert(1);
}

/* El link de marca vive dentro de nav; Basecoat puede marcarle aria-current en /dashboard. */
.sidebar nav > header .app-v2-brand-link,
.sidebar nav > header a[data-sidebar-brand],
.sidebar nav > header a[data-sidebar-brand][aria-current],
.sidebar nav > header a[data-sidebar-brand][data-active] {
    background: transparent !important;
    background-color: transparent !important;
    color: inherit !important;
    font-weight: inherit !important;
    position: static !important;
    box-shadow: none !important;
    outline: none;
}

.sidebar nav > header .app-v2-brand-link::before,
.sidebar nav > header a[data-sidebar-brand]::before,
.sidebar nav > header a[data-sidebar-brand][aria-current="page"]::before {
    content: none !important;
    display: none !important;
}

@media (min-width: 1024px) {
    :root {
        --sidebar-width: 5.25rem;
    }

    .sidebar {
        z-index: 45 !important;
    }

    .sidebar nav {
        width: 5.25rem !important;
        transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s ease !important;
        overflow-x: hidden;
    }

    .sidebar nav:hover {
        width: 16rem !important;
        box-shadow: var(--shadow-lg);
    }

    .app-v2-brand-logo-img {
        height: 1.1rem;
        max-width: 3.8rem;
    }

    .sidebar nav:hover .app-v2-brand-logo-img {
        height: 1.45rem;
        max-width: 9.5rem;
    }

    .sidebar nav > section h3 {
        text-align: center;
        opacity: 0;
        height: 0;
        margin: 0;
        overflow: hidden;
        transition: opacity 0.2s ease, height 0.2s ease;
    }

    .sidebar nav:hover > section h3 {
        text-align: left;
        opacity: 1;
        height: auto;
        margin-block-end: 0.5rem;
    }

    .sidebar nav ul {
        gap: 0.15rem !important;
    }

    .sidebar nav li > details > summary,
    .sidebar nav li > a {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 0.35rem 0.2rem !important;
        height: auto !important;
        min-height: 3.25rem !important;
        gap: 0.15rem !important;
        border-radius: var(--radius-md);
        transition: all 0.2s ease;
    }

    .sidebar nav li .app-v2-menu-icon {
        width: 1.1rem !important;
        height: 1.1rem !important;
        flex-shrink: 0;
    }

    .sidebar nav li .app-v2-menu-text {
        font-size: 0.625rem !important;
        line-height: 1.1 !important;
        font-weight: 500 !important;
        text-align: center !important;
        max-width: 4.75rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: var(--muted-foreground);
    }

    .sidebar nav li > details > summary::after {
        display: none !important;
    }

    .sidebar nav li > details > ul {
        display: none !important;
    }

    .sidebar nav:hover li > details > summary,
    .sidebar nav:hover li > a {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: left !important;
        padding: 0.5rem 0.75rem !important;
        min-height: 2.5rem !important;
        gap: 0.75rem !important;
    }

    .sidebar nav:hover li .app-v2-menu-icon {
        width: 1.1rem !important;
        height: 1.1rem !important;
    }

    .sidebar nav:hover li .app-v2-menu-text {
        font-size: 0.875rem !important;
        font-weight: 400 !important;
        text-align: left !important;
        max-width: none;
        color: inherit;
    }

    .sidebar nav:hover li > details > summary::after {
        display: block !important;
    }

    .sidebar nav:hover li > details[open] > ul {
        display: flex !important;
    }
}

/* --------------------------------------------------------------------------
   Estado activo de navegación
   -------------------------------------------------------------------------- */

/* 1. Menú Padre Desplegable Activo (cuando contiene el submenú de la página actual) */
.sidebar nav summary[data-active="true"],
.sidebar nav summary[data-active="true"] .app-v2-menu-text {
    color: var(--sidebar-primary) !important;
    font-weight: 600 !important;
}

.sidebar nav summary[data-active="true"]::after {
    background-color: var(--sidebar-primary) !important;
}

.sidebar nav summary[data-active="true"] .app-v2-menu-icon {
    color: var(--sidebar-primary) !important;
    stroke: currentColor !important;
}

/*
 * Los filtros url(#app-v2-icon-recolor-*) viven en sidebar.html: en este CSS
 * externo los fragmentos se resolverían contra el archivo, no contra el DOM.
 */

/* 2. Submenú o Menú Simple Activo (Página Actual) — solo ítems de lista, nunca el logo */
.sidebar nav section a[data-active="true"],
.sidebar nav section a[aria-current="page"],
.sidebar nav li > a[data-active="true"],
.sidebar nav li > a[aria-current="page"] {
    background-color: var(--sidebar-accent) !important;
    color: var(--sidebar-accent-foreground) !important;
    font-weight: 600 !important;
    position: relative;
}

.sidebar nav section a[data-active="true"] .app-v2-menu-text,
.sidebar nav section a[aria-current="page"] .app-v2-menu-text,
.sidebar nav li > a[data-active="true"] .app-v2-menu-text,
.sidebar nav li > a[aria-current="page"] .app-v2-menu-text {
    color: var(--sidebar-accent-foreground) !important;
    font-weight: 600 !important;
}

.sidebar nav section a[data-active="true"] .app-v2-menu-icon,
.sidebar nav section a[aria-current="page"] .app-v2-menu-icon,
.sidebar nav li > a[data-active="true"] .app-v2-menu-icon,
.sidebar nav li > a[aria-current="page"] .app-v2-menu-icon {
    color: var(--sidebar-accent-foreground) !important;
    stroke: currentColor !important;
}

/* Indicador lateral de posición activa */
.sidebar nav section a[aria-current="page"]::before,
.sidebar nav li > a[aria-current="page"]::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 70%;
    background-color: var(--sidebar-primary);
    border-radius: 0 2px 2px 0;
}

/* ==========================================================================
   4. COMPONENTES ARTESANALES V2

   Componentes que no existen en Basecoat 0.3.9 y que Wikistar implementa
   localmente con tokens del theme. Esta sección permanece al final y sus
   bloques deben mantenerse contiguos para poder extraerlos a css/ui/components/
   sin mezclar parches CDN ni shell.

   Incluidos actualmente:
   1. Filtros de estado
   2. PeoplePicker      — CSS + assets/v2/js/components/peoplepicker.js
   3. PeopleCard        — CSS + assets/v2/js/components/peoplecard.js
   4. Multiselect       — CSS + assets/v2/js/components/multiselect.js
   5. Timeline          — CSS-only
   6. Accordion         — CSS + assets/v2/js/components/accordion.js
   7. Analítica         — métricas y chart shell
   8. Empty             — CSS-only
   9. Avatar            — CSS-only (API docs Basecoat 1.x)
  10. Attachment Preview — CSS + assets/v2/js/components/attachment-preview.js
  11. Progress          — polyfill Basecoat 1.0.2
  12. Skeleton          — polyfill Basecoat 1.1.0
   ========================================================================== */

/* --------------------------------------------------------------------------
   Filtros de estado
   -------------------------------------------------------------------------- */

/*
 * Filtros de estado para tablas.
 * Son botones de filtro, no tabs: pueden envolver sin generar scroll horizontal
 * y mantienen icono, texto y conteo visibles en anchos pequeños.
 */
.v2-filter-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
    padding: 0.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--muted);
}

.v2-filter-chip {
    display: flex;
    min-width: 0;
    min-height: 2.35rem;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.5rem 0.75rem;
    text-align: center;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.v2-filter-chip:hover {
    background: color-mix(in oklab, var(--foreground) 4%, transparent);
    color: var(--foreground);
}

.v2-filter-chip:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.v2-filter-chip[aria-pressed="true"],
.v2-filter-chip[aria-selected="true"] {
    border-color: var(--border);
    background: var(--background);
    color: var(--foreground);
    box-shadow: var(--shadow-2xs);
}

.v2-filter-chip-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v2-filter-count {
    display: inline-flex;
    min-width: 1.75rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: color-mix(in oklab, var(--foreground) 7%, transparent);
    color: var(--foreground);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    line-height: 1;
    padding: 0.25rem 0.45rem;
}

@media (max-width: 640px) {
    .v2-filter-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .v2-filter-chip {
        justify-content: flex-start;
        padding-inline: 0.65rem;
    }

    .v2-filter-chip-label {
        white-space: normal;
    }
}

@media (max-width: 360px) {
    .v2-filter-group {
        grid-template-columns: 1fr;
    }
}

/* --------------------------------------------------------------------------
   FilterScroller — chips horizontales con flechas prev/next
   -------------------------------------------------------------------------- */

.v2-filter-scroller {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.v2-filter-scroller__track {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding-block: 0.125rem;
}

.v2-filter-scroller__track::-webkit-scrollbar {
    display: none;
}

.v2-filter-scroller .v2-filter-chip {
    flex-shrink: 0;
    min-width: max-content;
}

.v2-filter-scroller__btn[hidden] {
    display: none;
}

/* --------------------------------------------------------------------------
   IconPicker — galería visual del iconpack
   -------------------------------------------------------------------------- */

.icon-picker-control {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.icon-picker-trigger {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) - 2px);
    background: var(--background);
    color: var(--foreground);
    text-align: left;
    cursor: pointer;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.icon-picker-trigger:hover {
    border-color: color-mix(in oklab, var(--foreground) 24%, var(--input));
}

.icon-picker-trigger:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.icon-picker-preview {
    display: inline-flex;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--muted);
}

.icon-picker-preview .app-v2-menu-icon,
.icon-picker-option-thumb .app-v2-menu-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.icon-picker-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
    gap: 0.5rem;
    padding: 0.15rem;
}

.icon-picker-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    padding: 0.65rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--background);
    color: var(--foreground);
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.icon-picker-option:hover {
    background: color-mix(in oklab, var(--foreground) 4%, transparent);
}

.icon-picker-option:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.icon-picker-option.is-selected,
.icon-picker-option[aria-selected="true"] {
    border-color: var(--ring);
    background: color-mix(in oklab, var(--primary) 8%, var(--background));
    box-shadow: var(--shadow-2xs);
}

.icon-picker-option-thumb {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--muted);
}

.icon-picker-option-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    color: var(--muted-foreground);
}

.icon-picker-option.is-selected .icon-picker-option-label,
.icon-picker-option[aria-selected="true"] .icon-picker-option-label {
    color: var(--foreground);
}

/* --------------------------------------------------------------------------
   PeoplePicker
   -------------------------------------------------------------------------- */

/*
 * PeoplePicker artesanal. Combobox de personas (avatar, nombre, correo).
 * No es el Select filtrable de catálogos.
 */
.people-picker-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.people-picker-field {
    position: relative;
    min-width: 0;
    flex: 1 1 auto;
}

.people-picker-field .people-picker-input {
    width: 100%;
}

.people-picker-results {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 20;
    margin-top: 0.25rem;
    max-height: 16rem;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--popover);
    color: var(--popover-foreground);
    box-shadow: var(--shadow-md);
}

.people-picker-empty {
    margin: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.people-picker-option {
    display: flex;
    width: 100%;
    cursor: pointer;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.people-picker-option:hover,
.people-picker-option[aria-selected="true"] {
    background: var(--accent);
    color: var(--accent-foreground);
}

.people-picker-copy {
    min-width: 0;
}

.people-picker-copy strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
}

.people-picker-copy span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/*
 * PeoplePicker variant: select (trigger tipo Select con avatar y popover)
 */
.people-picker[data-variant="select"] .people-picker-control {
    position: relative;
}

.people-picker-select-field {
    position: relative;
}

.people-picker-select-trigger {
    display: inline-flex;
    min-height: 2.25rem;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--input);
    background-color: transparent;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, padding-right 0.15s ease;
}

.people-picker-select-trigger.has-clear {
    padding-right: 3.25rem;
}

.people-picker-select-trigger:hover {
    background-color: color-mix(in srgb, var(--accent) 50%, transparent);
}

.people-picker-select-trigger:focus-visible {
    border-color: var(--ring);
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.people-picker-select-clear {
    position: absolute;
    top: 50%;
    right: 2rem;
    z-index: 2;
    display: inline-flex;
    width: 1.5rem;
    height: 1.5rem;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius-sm, 0.25rem);
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    transform: translateY(-50%);
}

.people-picker-select-clear:hover {
    background-color: color-mix(in srgb, var(--muted) 70%, transparent);
    color: var(--foreground);
}

.people-picker-select-clear:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 1px;
}

.people-picker-select-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.people-picker-select-popover {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    margin-top: 0.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--popover);
    color: var(--popover-foreground);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.people-picker-select-search {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--muted) 30%, transparent);
}

.people-picker-select-search input {
    width: 100%;
    height: 2rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm, 0.25rem);
    border: 1px solid var(--input);
    background: var(--background);
    color: var(--foreground);
    outline: none;
}

.people-picker-select-search input:focus-visible {
    border-color: var(--ring);
    box-shadow: 0 0 0 1px var(--ring);
}

/* Resultados dentro del popover select: flujo normal, no absolute del combobox */
.people-picker[data-variant="select"] .people-picker-results {
    position: static;
    top: auto;
    right: auto;
    left: auto;
    z-index: auto;
    margin-top: 0;
    max-height: 16rem;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

/* --------------------------------------------------------------------------
   PeopleCard
   -------------------------------------------------------------------------- */

/*
 * PeopleCard artesanal. Ficha de persona (avatar, nombre, cargo/depto).
 * Modos:
 *   - .people-card-static: rol presentation (solo mostrar).
 *   - .people-card-selectable: rol radio en radiogroup (elegir uno de pocos).
 *   - .people-card-compact: sin chrome de card (tablas / filas densas).
 */
.people-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: var(--radius-lg, 0.5rem);
    border: 1px solid var(--border);
    background: var(--card);
    padding: 0.75rem;
    text-align: left;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    min-width: 0;
}

.people-card-sm {
    padding: 0.5rem 0.625rem;
    gap: 0.5rem;
}

.people-card-compact {
    width: 100%;
    gap: 0.375rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
    transition: none;
}

.people-card-compact.people-card-sm,
.people-card-compact {
    padding: 0;
}

.people-card-static {
    cursor: default;
}

/* En ficha static (dialogs / detalle): no truncar nombre/meta en una sola línea. */
.people-card-static:not(.people-card-compact) {
    align-items: flex-start;
}

.people-card-static:not(.people-card-compact) .people-card-name,
.people-card-static:not(.people-card-compact) .people-card-meta {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
}

.people-card-compact.people-card-static {
    cursor: default;
}

.people-card-selectable {
    cursor: pointer;
    width: 100%;
}

.people-card-selectable:hover {
    border-color: color-mix(in srgb, var(--primary) 60%, transparent);
}

.people-card-selectable:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--primary);
}

.people-card-selectable[aria-checked="true"],
.people-card-selectable.is-selected {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 5%, var(--card));
    box-shadow: var(--shadow-xs, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

.people-card .avatar {
    width: 2.5rem;
    height: 2.5rem;
}

.people-card-sm .avatar {
    width: 2rem;
    height: 2rem;
}

.people-card-compact .avatar {
    width: 1.5rem;
    height: 1.5rem;
}

.people-card-info {
    min-width: 0;
    flex: 1 1 auto;
}

.people-card-name {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.25rem;
}

.people-card-sm .people-card-name {
    font-size: 0.8125rem;
    line-height: 1.125rem;
}

.people-card-compact .people-card-name {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 1rem;
}

.people-card-meta {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    line-height: 1rem;
}

.people-card-sm .people-card-meta {
    font-size: 0.6875rem;
    line-height: 0.875rem;
}

.people-card-compact .people-card-meta {
    font-size: 0.6875rem;
    line-height: 0.875rem;
}

.people-card-check {
    color: var(--primary);
    flex-shrink: 0;
    transition: opacity 0.15s ease;
}

.people-card-selectable[aria-checked="false"] .people-card-check {
    opacity: 0;
}

.people-card-selectable[aria-checked="true"] .people-card-check {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Multiselect
   -------------------------------------------------------------------------- */

/*
 * Multiselect artesanal. Chips + listbox filtrable (GitHub labels).
 * No es el Select single de Basecoat.
 */
.multiselect-shell {
    position: relative;
}

.multiselect-control {
    display: flex;
    min-height: 2.5rem;
    cursor: text;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    border: 1px solid var(--input);
    border-radius: var(--radius-md);
    background: var(--background);
    padding: 0.375rem 0.5rem;
}

.multiselect-control:focus-within {
    border-color: var(--ring);
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.multiselect-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.multiselect-chip {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 0.2rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius-md) - 2px);
    background: var(--muted);
    padding: 0.125rem 0.25rem 0.125rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.25;
    color: var(--foreground);
}

.multiselect-chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multiselect-chip-remove {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    border: 0;
    border-radius: calc(var(--radius-md) - 4px);
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
}

.multiselect-chip-remove:hover {
    background: color-mix(in oklab, var(--foreground) 10%, transparent);
    color: var(--foreground);
}

.multiselect-search {
    min-width: 7rem;
    flex: 1 1 7rem;
    border: 0;
    background: transparent;
    padding: 0.125rem 0;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--foreground);
    outline: none;
}

.multiselect-search::placeholder {
    color: var(--muted-foreground);
}

.multiselect-chevron {
    flex-shrink: 0;
    margin-left: auto;
    color: var(--muted-foreground);
    opacity: 0.7;
    pointer-events: none;
}

.multiselect-popover {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    left: 0;
    z-index: 40;
    max-height: 16rem;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--popover);
    color: var(--popover-foreground);
    box-shadow: var(--shadow-md);
}

.multiselect-empty {
    margin: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.multiselect-option {
    display: flex;
    width: 100%;
    cursor: pointer;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.875rem;
}

.multiselect-option:hover,
.multiselect-option.is-active {
    background: var(--accent);
    color: var(--accent-foreground);
}

.multiselect-check {
    display: inline-flex;
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    opacity: 0;
}

.multiselect-option[aria-selected="true"] .multiselect-check {
    opacity: 1;
}

.multiselect-option-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multiselect-help {
    margin-top: 0.35rem;
}

/* --------------------------------------------------------------------------
   Timeline
   -------------------------------------------------------------------------- */

/*
 * Timeline artesanal. Raya + punto por ítem. Sin JS.
 * Default: --foreground / --border (claro y oscuro).
 * Acento fijo por ítem: --timeline-accent (hex, rgb, token).
 */
.timeline {
    --timeline-accent: var(--foreground);
    --timeline-dot-size: 0.625rem;
    --timeline-gutter: 1.125rem;
    list-style: none;
    margin: 0;
    padding: 0 0 0 var(--timeline-gutter);
    border-inline-start: 1px solid var(--border);
}

.timeline > li {
    position: relative;
    min-width: 0;
    padding-bottom: 1rem;
}

.timeline > li:last-child {
    padding-bottom: 0;
}

.timeline > li::before {
    content: "";
    position: absolute;
    top: 0.35rem;
    left: calc(-1 * var(--timeline-gutter) - 1px / 2 - var(--timeline-dot-size) / 2);
    width: var(--timeline-dot-size);
    height: var(--timeline-dot-size);
    border-radius: 9999px;
    background: var(--timeline-accent, var(--foreground));
    box-shadow: 0 0 0 4px color-mix(
        in oklab,
        var(--timeline-accent, var(--foreground)) 20%,
        transparent
    );
}

/* --------------------------------------------------------------------------
   Accordion
   -------------------------------------------------------------------------- */

/*
 * Accordion artesanal compatible con el markup de Basecoat 1.x.
 * <details>/<summary> aporta la semántica nativa; accordion.js coordina
 * apertura exclusiva, data-multiple y aria-disabled.
 * Hover: subrayado del título (como Basecoat docs / hover:underline).
 */
.accordion {
    width: 100%;
    min-width: 0;
}

.accordion > details {
    border-bottom: 1px solid var(--border);
}

.accordion > details:last-child {
    border-bottom: 0;
}

/* Anula la transición discreta ::details-content de Basecoat 0.3.9 para que accordion.js anime sin rebote ni pérdida de scrollHeight. */
.accordion details::details-content,
.accordion details[open]::details-content {
    block-size: auto;
    opacity: 1;
    transition: none;
}

.accordion > details > summary {
    display: flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 0.75rem;
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    list-style: none;
    cursor: pointer;
    user-select: none;
    transition: color 150ms ease, background-color 150ms ease;
}

.accordion > details > summary::-webkit-details-marker,
.accordion > details > summary::marker {
    display: none;
    content: "";
}

.accordion > details > summary:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* Árboles con acciones en el summary (menú, estructura, catálogo): sin subrayado. */
.accordion > details > summary:has(button):hover,
.accordion > details[aria-disabled="true"] > summary:hover {
    text-decoration: none;
}

.accordion > details > summary:focus-visible {
    border-radius: var(--radius-sm);
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.accordion > details > summary > :is(svg, .lucide):last-child {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
    color: var(--muted-foreground);
    transition: transform 200ms ease;
}

.accordion > details[open] > summary > :is(svg, .lucide):last-child {
    transform: rotate(180deg);
}

/* Durante el cierre, <details> permanece abierto hasta terminar la altura. */
.accordion > details[data-accordion-state="closing"] > summary > :is(svg, .lucide):last-child {
    transform: rotate(0deg);
}

.accordion > details > :not(summary) {
    padding-bottom: 0.875rem;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    line-height: 1.625;
}

.accordion.border {
    overflow: hidden;
    border-color: var(--border);
}

.accordion.border > details > summary,
.accordion.border > details > :not(summary) {
    padding-inline: 1rem;
}

/*
 * Variante de contenido primario. El accordion por defecto trata el
 * panel como ayuda (muted). Esta clase deja texto y fields al tono V2.
 */
.accordion.accordion-case > details > :not(summary) {
    color: var(--foreground);
    font-size: inherit;
    line-height: inherit;
}

.accordion > details[aria-disabled="true"] > summary {
    color: var(--muted-foreground);
    cursor: not-allowed;
    opacity: 0.5;
}

@media (prefers-reduced-motion: reduce) {
    .accordion > details > summary,
    .accordion > details > summary > :is(svg, .lucide):last-child {
        transition: none;
    }
}

/* --------------------------------------------------------------------------
   Analítica
   -------------------------------------------------------------------------- */
.v2-metric-card {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    color: var(--card-foreground);
}

.v2-metric-card[data-size="compact"] { padding: 0.75rem; }
.v2-metric-card[data-size="normal"] { padding: 1rem; }
.v2-metric-card[data-size="featured"] { padding: 1.25rem; }

.v2-metric-card-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--muted-foreground);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    line-height: 1rem;
    text-transform: uppercase;
}

.v2-metric-card-value {
    margin-top: 0.5rem;
    color: var(--card-foreground);
    font-size: 1.25rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.75rem;
}

.v2-metric-card[data-size="compact"] .v2-metric-card-value { font-size: 1.125rem; }
.v2-metric-card[data-size="featured"] .v2-metric-card-value {
    font-size: clamp(2.25rem, 5vw, 3.75rem);
    line-height: 1;
    letter-spacing: -0.055em;
}

.v2-metric-card-detail {
    margin-top: 0.25rem;
    color: var(--muted-foreground);
    font-size: 0.75rem;
    line-height: 1rem;
}

.v2-chart-shell {
    position: relative;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 18rem;
    min-height: 18rem;
    overflow: hidden;
}

.v2-chart-shell[data-size="compact"] { height: 15rem; min-height: 15rem; }
.v2-chart-shell[data-size="featured"] { height: 22rem; min-height: 22rem; }

.v2-chart-shell canvas {
    display: block;
    width: 100% !important;
    max-width: 100%;
    height: 100% !important;
}

.v2-chart-state {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1rem;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    text-align: center;
}

.v2-chart-state[hidden] { display: none; }

.v2-analytics-filter-panel {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    color: var(--card-foreground);
    padding: 0.75rem;
}

.v2-analytics-scope {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.75rem;
    color: var(--muted-foreground);
    font-size: 0.75rem;
}

@media (max-width: 640px) {
    .v2-chart-shell { height: 15rem; min-height: 15rem; }
    .v2-chart-shell[data-size="compact"] { height: 13rem; min-height: 13rem; }
    .v2-chart-shell[data-size="featured"] { height: 18rem; min-height: 18rem; }
}

/* --------------------------------------------------------------------------
   Empty
   -------------------------------------------------------------------------- */

/*
 * Empty artesanal. 0.3.9 no trae .empty; replica el marcado de la docs
 * actual (header/figure/h3/p/footer) con tokens del theme. Sin JS.
 */
.empty {
    display: flex;
    width: 100%;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    text-align: center;
    text-wrap: balance;
}

/* .empty no está en @layer: gana a utilidades Tailwind (.hidden) si no se anula. */
.empty.hidden,
.empty[hidden] {
    display: none;
}

.empty > header {
    display: flex;
    max-width: 24rem;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.empty figure {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}

.empty figure:has(> svg:only-child) {
    margin-bottom: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    background-color: var(--muted);
    color: var(--muted-foreground);
}

.empty figure svg {
    width: 1.5rem;
    height: 1.5rem;
    pointer-events: none;
    flex-shrink: 0;
}

.empty figure:has(img) {
    overflow: hidden;
}

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

.empty > header > :is(h2, h3, h4) {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 500;
    letter-spacing: -0.025em;
    color: var(--foreground);
}

.empty > header > p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.625;
    color: var(--muted-foreground);
}

.empty > header > p a {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.empty > header > p a:hover {
    color: var(--primary);
}

.empty > :is(section, footer) {
    display: flex;
    width: 100%;
    max-width: 24rem;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* --------------------------------------------------------------------------
   Avatar
   -------------------------------------------------------------------------- */

/*
 * Avatar artesanal. 0.3.9 no trae .avatar; replica la API de la docs actual
 * (root, fallback, badge, group, data-size, data-count) con tokens del theme.
 * Sin JavaScript.
 */
.avatar {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    overflow: visible;
    vertical-align: middle;
    appearance: none;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    color: inherit;
    text-decoration: none;
    user-select: none;
    outline: none;
}

.avatar::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    border: 1px solid var(--border);
    border-radius: inherit;
    mix-blend-mode: darken;
}

html.dark .avatar::after {
    mix-blend-mode: lighten;
}

.avatar:focus-visible {
    box-shadow: 0 0 0 3px var(--ring);
}

.avatar[data-size="sm"] {
    width: 1.5rem;
    height: 1.5rem;
}

.avatar[data-size="lg"] {
    width: 3rem;
    height: 3rem;
}

.avatar[data-size="xl"] {
    width: 6rem;
    height: 6rem;
}

.avatar > img {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: inherit;
}

.avatar > span:not(.avatar-badge) {
    position: relative;
    z-index: 0;
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: inherit;
    background-color: var(--muted);
    color: var(--muted-foreground);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
}

.avatar[data-size="sm"] > span:not(.avatar-badge) {
    font-size: 0.75rem;
}

.avatar[data-size="lg"] > span:not(.avatar-badge) {
    font-size: 1rem;
}

.avatar[data-size="xl"] > span:not(.avatar-badge) {
    font-size: 1.5rem;
}

.avatar > span:not(.avatar-badge) > :is(svg, .lucide) {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.avatar[data-size="sm"] > span:not(.avatar-badge) > :is(svg, .lucide) {
    width: 0.75rem;
    height: 0.75rem;
}

.avatar[data-size="lg"] > span:not(.avatar-badge) > :is(svg, .lucide) {
    width: 1.5rem;
    height: 1.5rem;
}

.avatar[data-size="xl"] > span:not(.avatar-badge) > :is(svg, .lucide) {
    width: 2.5rem;
    height: 2.5rem;
}

.avatar > .avatar-badge {
    position: absolute;
    inset-inline-end: 0;
    bottom: 0;
    z-index: 10;
    display: inline-flex;
    width: 0.625rem;
    height: 0.625rem;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 9999px;
    background-color: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 0 0 2px var(--background);
    user-select: none;
}

.avatar[data-size="sm"] > .avatar-badge {
    width: 0.5rem;
    height: 0.5rem;
}

.avatar[data-size="sm"] > .avatar-badge > :is(svg, .lucide) {
    display: none;
}

.avatar > .avatar-badge > :is(svg, .lucide) {
    width: 0.5rem;
    height: 0.5rem;
    flex-shrink: 0;
}

.avatar[data-size="lg"] > .avatar-badge {
    width: 0.875rem;
    height: 0.875rem;
}

.avatar[data-size="lg"] > .avatar-badge > :is(svg, .lucide) {
    width: 0.625rem;
    height: 0.625rem;
}

.avatar[data-size="xl"] > .avatar-badge {
    width: 1.125rem;
    height: 1.125rem;
}

.avatar[data-size="xl"] > .avatar-badge > :is(svg, .lucide) {
    width: 0.75rem;
    height: 0.75rem;
}

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

.avatar-group > :not(:first-child) {
    margin-inline-start: -0.5rem;
}

.avatar-group > .avatar,
.avatar-group > [data-count] {
    box-shadow: 0 0 0 2px var(--background);
}

.avatar-group > [data-count] {
    position: relative;
    display: flex;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background-color: var(--muted);
    color: var(--muted-foreground);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
}

.avatar-group > [data-count] > :is(svg, .lucide) {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.avatar-group:has(> .avatar[data-size="sm"]) > [data-count] {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.75rem;
}

.avatar-group:has(> .avatar[data-size="sm"]) > [data-count] > :is(svg, .lucide) {
    width: 0.75rem;
    height: 0.75rem;
}

.avatar-group:has(> .avatar[data-size="lg"]) > [data-count] {
    width: 3rem;
    height: 3rem;
    font-size: 1rem;
}

.avatar-group:has(> .avatar[data-size="lg"]) > [data-count] > :is(svg, .lucide) {
    width: 1.5rem;
    height: 1.5rem;
}

.avatar-group:has(> .avatar[data-size="xl"]) > [data-count] {
    width: 6rem;
    height: 6rem;
    font-size: 1.5rem;
}

.avatar-group:has(> .avatar[data-size="xl"]) > [data-count] > :is(svg, .lucide) {
    width: 2.5rem;
    height: 2.5rem;
}

/* --------------------------------------------------------------------------
   Attachment Preview
   -------------------------------------------------------------------------- */

/*
 * Attachment Preview artesanal. Tarjeta de archivo con miniatura, acciones de
 * vista previa y descarga. El JS vive en components/attachment-preview.js.
 */
.attachment-preview {
    position: relative;
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--card);
    color: var(--card-foreground);
}

.attachment-preview[data-variant="compact"] {
    flex-direction: row;
    align-items: center;
}

.attachment-preview-media {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 10rem;
    max-height: 14rem;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    background-color: var(--muted);
}

.attachment-preview-media img {
    width: 100%;
    height: 100%;
    min-height: inherit;
    max-height: inherit;
    object-fit: cover;
    object-position: top center;
}

.attachment-preview-media-placeholder {
    gap: 0.75rem;
    color: var(--muted-foreground);
}

.attachment-preview-media-placeholder > :is(svg, .lucide) {
    width: 2.5rem;
    height: 2.5rem;
}

.attachment-preview-media-placeholder > span {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
}

.attachment-preview-body {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}

.attachment-preview-icon,
.attachment-preview-lock {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    background-color: var(--muted);
    color: var(--muted-foreground);
}

.attachment-preview-icon > :is(svg, .lucide),
.attachment-preview-lock > :is(svg, .lucide) {
    width: 1.25rem;
    height: 1.25rem;
}

.attachment-preview-copy {
    min-width: 0;
    flex: 1;
}

.attachment-preview-copy > h4 {
    margin: 0;
    overflow: hidden;
    color: var(--card-foreground);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-preview-copy > p {
    margin: 0.125rem 0 0;
    overflow: hidden;
    color: var(--muted-foreground);
    font-size: 0.75rem;
    line-height: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-preview-actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.5rem;
}

.attachment-preview[data-variant="preview"] .attachment-preview-actions {
    position: absolute;
    top: 5.5rem;
    left: 50%;
    z-index: 2;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 150ms ease;
}

.attachment-preview[data-variant="preview"] .attachment-preview-media::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-color: color-mix(in oklab, black 36%, transparent);
    opacity: 0;
    transition: opacity 150ms ease;
}

.attachment-preview[data-variant="preview"]:is(:hover, :focus-within) .attachment-preview-actions,
.attachment-preview[data-variant="preview"]:is(:hover, :focus-within) .attachment-preview-media::after {
    opacity: 1;
}

.attachment-preview-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--border);
    border-radius: 9999px;
    background-color: color-mix(in oklab, var(--background) 92%, transparent);
    color: var(--foreground);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.attachment-preview-action:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
    background-color: var(--background);
}

.attachment-preview-action:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.attachment-preview-action > :is(svg, .lucide) {
    width: 1.125rem;
    height: 1.125rem;
}

.attachment-preview-dialog-media {
    display: flex;
    min-height: 18rem;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--muted);
}

.attachment-preview-dialog-media img {
    width: 100%;
    max-height: 72vh;
    object-fit: contain;
}

.attachment-preview-dialog-frame {
    display: block;
    width: 100%;
    min-height: 72vh;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--background);
}

@media (hover: none) {
    .attachment-preview[data-variant="preview"] .attachment-preview-actions,
    .attachment-preview[data-variant="preview"] .attachment-preview-media::after {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .attachment-preview-action,
    .attachment-preview[data-variant="preview"] .attachment-preview-actions,
    .attachment-preview[data-variant="preview"] .attachment-preview-media::after {
        transition: none;
    }
}

/* --------------------------------------------------------------------------
   Progress
   -------------------------------------------------------------------------- */

/*
 * BasecoatUI V1.0.2 Progress Bar Polyfill
 */
.progress {
    height: 0.5rem;
    width: 100%;
    overflow: hidden;
    border-radius: 9999px;
    background: color-mix(in oklab, var(--muted-foreground) 16%, transparent);
}

.progress > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--primary);
    transition: width 500ms cubic-bezier(.2, .8, .2, 1);
}

@media (prefers-reduced-motion: reduce) {
    .progress > span {
        transition: none;
    }
}

/* --------------------------------------------------------------------------
   Skeleton
   -------------------------------------------------------------------------- */

/*
 * BasecoatUI V1.1.0 Skeleton Polyfill
 */
.skeleton {
    background-color: color-mix(in oklab, var(--muted-foreground) 20%, var(--accent));
    animation: ws-skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.skeleton:not([class*="rounded-"]) {
    border-radius: var(--radius-md);
}

@keyframes ws-skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
    }
}

/* --------------------------------------------------------------------------
   Variantes semánticas de estado

   Dentro de esta semántica de estado, Basecoat 0.3.9 solo incluye destructive.
   Estas extensiones conservan su estructura (`badge` + variante) y consumen
   exclusivamente los tokens publicados por el theme activo.
   -------------------------------------------------------------------------- */

.badge-success,
.badge-warning,
.badge-info {
    border-color: transparent;
}

.badge-success {
    background-color: var(--success);
    color: var(--success-foreground);
}

.badge-warning {
    background-color: var(--warning);
    color: var(--warning-foreground);
}

.badge-info {
    background-color: var(--info);
    color: var(--info-foreground);
}

@media (hover: hover) {
    a.badge-success:hover {
        background-color: color-mix(in oklab, var(--success) 90%, transparent);
    }

    a.badge-warning:hover {
        background-color: color-mix(in oklab, var(--warning) 90%, transparent);
    }

    a.badge-info:hover {
        background-color: color-mix(in oklab, var(--info) 90%, transparent);
    }
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-info {
    color: var(--info);
}

/* --------------------------------------------------------------------------
   FullCalendar ↔ Theme V2 (.ws-fc-calendar)
   Theming semántico para FullCalendar 6.1.20 basado en tokens Basecoat V2.
   Soporta modo barras (vacaciones) y modo avatares (flexwork).
   -------------------------------------------------------------------------- */

.ws-fc-calendar,
.vac-fc-calendar {
    --fc-border-color: var(--border);
    --fc-page-bg-color: transparent;
    --fc-neutral-bg-color: var(--muted);
    --fc-neutral-text-color: var(--muted-foreground);
    --fc-list-event-hover-bg-color: var(--accent);
    --fc-today-bg-color: color-mix(in oklab, var(--primary) 12%, transparent);
    --fc-now-indicator-color: var(--primary);
    --fc-button-text-color: var(--foreground);
    --fc-button-bg-color: var(--secondary);
    --fc-button-border-color: var(--border);
    --fc-button-hover-bg-color: var(--accent);
    --fc-button-hover-border-color: var(--border);
    --fc-button-active-bg-color: var(--primary);
    --fc-button-active-border-color: var(--primary);
    --fc-button-active-text-color: var(--primary-foreground);
    --fc-event-text-color: var(--foreground);
    --fc-event-bg-color: var(--secondary);
    --fc-event-border-color: transparent;
    color: var(--foreground);
}

.ws-fc-calendar .fc-toolbar-title,
.vac-fc-calendar .fc-toolbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--foreground);
}

.ws-fc-calendar .fc-button,
.vac-fc-calendar .fc-button {
    border-radius: var(--radius-md, 0.375rem);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: none;
    box-shadow: none !important;
}

.ws-fc-calendar .fc-button-primary,
.vac-fc-calendar .fc-button-primary {
    background-color: var(--secondary) !important;
    border-color: var(--border) !important;
    color: var(--foreground) !important;
}

.ws-fc-calendar .fc-button-primary:hover,
.vac-fc-calendar .fc-button-primary:hover {
    background-color: var(--accent) !important;
    border-color: var(--border) !important;
    color: var(--accent-foreground) !important;
}

.ws-fc-calendar .fc-button-primary:not(:disabled).fc-button-active,
.ws-fc-calendar .fc-button-primary:not(:disabled):active,
.vac-fc-calendar .fc-button-primary:not(:disabled).fc-button-active,
.vac-fc-calendar .fc-button-primary:not(:disabled):active {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--primary-foreground) !important;
}

.ws-fc-calendar .fc-button:focus-visible,
.vac-fc-calendar .fc-button:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.ws-fc-calendar .fc-col-header-cell-cushion,
.ws-fc-calendar .fc-daygrid-day-number,
.ws-fc-calendar .fc-list-day-text,
.ws-fc-calendar .fc-list-day-side-text,
.vac-fc-calendar .fc-col-header-cell-cushion,
.vac-fc-calendar .fc-daygrid-day-number,
.vac-fc-calendar .fc-list-day-text,
.vac-fc-calendar .fc-list-day-side-text {
    color: var(--foreground);
    text-decoration: none;
}

.ws-fc-calendar .fc-daygrid-day.fc-day-other,
.vac-fc-calendar .fc-daygrid-day.fc-day-other {
    background: color-mix(in oklab, var(--muted) 35%, transparent);
}

.ws-fc-calendar .fc-scrollgrid,
.ws-fc-calendar td,
.ws-fc-calendar th,
.vac-fc-calendar .fc-scrollgrid,
.vac-fc-calendar td,
.vac-fc-calendar th {
    border-color: var(--border);
}

.ws-fc-calendar .fc-event,
.vac-fc-calendar .fc-event {
    cursor: pointer;
    border-radius: calc(var(--radius-sm, 0.25rem) - 1px);
    font-size: 0.7rem;
    font-weight: 500;
}

.ws-fc-calendar .fc-event:focus-visible,
.vac-fc-calendar .fc-event:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* Modo Barras (Vacaciones y similares) */
.ws-fc-calendar .fc-event.vac-fc-event--pending-sup,
.ws-fc-calendar .fc-event.vac-fc-event--pending-sup .fc-event-main,
.vac-fc-calendar .fc-event.vac-fc-event--pending-sup,
.vac-fc-calendar .fc-event.vac-fc-event--pending-sup .fc-event-main {
    background-color: var(--warning) !important;
    border-color: color-mix(in oklab, var(--warning) 75%, var(--foreground)) !important;
    color: var(--warning-foreground) !important;
}

.ws-fc-calendar .fc-event.vac-fc-event--pending-rh,
.ws-fc-calendar .fc-event.vac-fc-event--pending-rh .fc-event-main,
.vac-fc-calendar .fc-event.vac-fc-event--pending-rh,
.vac-fc-calendar .fc-event.vac-fc-event--pending-rh .fc-event-main {
    background-color: var(--info) !important;
    border-color: color-mix(in oklab, var(--info) 75%, var(--foreground)) !important;
    color: var(--info-foreground) !important;
}

.ws-fc-calendar .fc-event.vac-fc-event--approved,
.ws-fc-calendar .fc-event.vac-fc-event--approved .fc-event-main,
.vac-fc-calendar .fc-event.vac-fc-event--approved,
.vac-fc-calendar .fc-event.vac-fc-event--approved .fc-event-main {
    background-color: var(--success) !important;
    border-color: color-mix(in oklab, var(--success) 75%, var(--foreground)) !important;
    color: var(--success-foreground) !important;
}

.ws-fc-calendar .fc-event.vac-fc-event--self,
.ws-fc-calendar .fc-event.vac-fc-event--self .fc-event-main,
.vac-fc-calendar .fc-event.vac-fc-event--self,
.vac-fc-calendar .fc-event.vac-fc-event--self .fc-event-main {
    background-color: var(--primary) !important;
    border-color: color-mix(in oklab, var(--primary) 75%, var(--foreground)) !important;
    color: var(--primary-foreground) !important;
}

.ws-fc-calendar .fc-event.vac-fc-event--other,
.ws-fc-calendar .fc-event.vac-fc-event--other .fc-event-main,
.vac-fc-calendar .fc-event.vac-fc-event--other,
.vac-fc-calendar .fc-event.vac-fc-event--other .fc-event-main {
    background-color: var(--secondary) !important;
    border-color: var(--border) !important;
    color: var(--secondary-foreground) !important;
}

/* Modo Avatares (Flexwork y presencia de equipo) */
.ws-fc-calendar .fc-event.ws-fc-event--avatar {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 1px !important;
    margin: 1px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ws-fc-calendar .fc-event.ws-fc-event--avatar .fc-event-main {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.ws-fc-avatar-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 9999px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.ws-fc-avatar-trigger:hover {
    transform: scale(1.15);
    z-index: 10;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.ws-fc-avatar-trigger:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.ws-fc-avatar-trigger .avatar {
    pointer-events: none;
}

.ws-fc-avatar-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 9999px;
    border: 1.5px solid var(--background);
    z-index: 3;
}

.ws-fc-avatar-badge--pre_aprobada {
    background-color: var(--success);
}

.ws-fc-avatar-badge--usada {
    background-color: var(--primary);
}

.ws-fc-avatar-badge--rechazada {
    background-color: var(--destructive);
}

.ws-fc-avatar-badge--cancelada {
    background-color: var(--muted-foreground);
}

.ws-fc-calendar .fc-list-event.ws-fc-event--avatar .fc-list-event-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
    .ws-fc-calendar .fc-event,
    .vac-fc-calendar .fc-event,
    .ws-fc-avatar-trigger {
        transition: none !important;
    }
}

