/**
 * V4 Design System - Components
 * Reusable UI components (buttons, cards, inputs, badges)
 */

/* ===== BUTTONS ===== */

/* Icon Buttons */
.icon-button-compact {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--surface-store);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-button-compact:active {
    transform: scale(0.92);
}

/* Primary Button */
.btn-primary {
    height: 56px;
    padding: 0 28px;
    border-radius: 14px;
    border: none;
    background: var(--color-action-purple);
    color: var(--text-inverse);
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-primary:active {
    transform: scale(0.96);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Secondary Button */
.btn-secondary {
    height: 56px;
    padding: 0 28px;
    border-radius: 14px;
    border: 2px solid var(--border);
    background: var(--surface-elevated);
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--surface-2);
    border-color: var(--text-secondary);
}

.btn-secondary:active {
    transform: scale(0.96);
}

/* Danger Button */
.btn-danger {
    height: 56px;
    padding: 0 28px;
    border-radius: 14px;
    border: none;
    background: var(--color-remove-red);
    color: var(--text-inverse);
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: var(--color-remove-red-dark);
    transform: translateY(-2px);
}

.btn-danger:active {
    transform: scale(0.96);
}

/* Ghost Button */
.btn-ghost {
    height: 56px;
    padding: 0 28px;
    border-radius: 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    background: var(--surface-store);
}

.btn-ghost:active {
    transform: scale(0.96);
}

/* Back Button (text variant) */
.back-button {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: 2px solid var(--text-secondary);
    background: var(--surface-elevated);
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.back-button:hover {
    background: var(--surface-store);
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.back-button:active {
    transform: scale(0.96);
}

/* Back Button (icon-only square variant, used in page headers) */
/* DEPRECATED: migrado a .page-back-btn en redesign.css — no usar */
.btn-back {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    background: var(--surface-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s;
    flex-shrink: 0;
    cursor: pointer;
}

.btn-back:hover {
    border-color: var(--color-price-blue);
    color: var(--color-price-blue);
    background: var(--surface-elevated);
}

/* ===== CARDS ===== */

/* Base Card */
.card {
    background: var(--surface-elevated);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

/* Large Card */
.card-lg {
    background: var(--surface-elevated);
    border-radius: var(--radius-2xl);
    padding: 32px;
    box-shadow: var(--shadow-md);
}

/* ===== INPUTS ===== */

/* Text Input */
.input {
    width: 100%;
    height: 50px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    padding: 0 16px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    background: var(--surface-elevated);
    transition: all 0.2s ease;
}

.input:focus {
    outline: none;
    border-color: var(--color-price-blue);
    box-shadow: 0 0 0 3px var(--color-price-blue-light);
}

.input::placeholder {
    color: var(--text-tertiary);
}

/* Large Input */
.input-lg {
    width: 100%;
    height: 56px;
    border-radius: 14px;
    border: 2px solid var(--border);
    padding: 0 20px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    background: var(--surface-elevated);
    transition: all 0.2s ease;
}

.input-lg:focus {
    outline: none;
    border-color: var(--color-price-blue);
    box-shadow: 0 0 0 3px var(--color-price-blue-light);
}

/* Select Input */
.select {
    width: 100%;
    height: 50px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    padding: 0 16px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    background: var(--surface-elevated);
    cursor: pointer;
    transition: all 0.2s ease;
}

.select:focus {
    outline: none;
    border-color: var(--color-price-blue);
    box-shadow: 0 0 0 3px var(--color-price-blue-light);
}

/* ===== BADGES ===== */

.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
}

.badge-primary {
    background: var(--color-price-blue-light);
    color: var(--color-price-blue-dark);
}

.badge-success {
    background: var(--color-add-green-light);
    color: var(--color-add-green-dark);
}

.badge-warning {
    background: var(--color-warning-yellow-light);
    color: var(--warn);
}

.badge-danger {
    background: var(--color-remove-red-light);
    color: var(--color-remove-red-dark);
}

.badge-neutral {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-secondary);
}

/* Product Badge (circular counter) */
.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--color-add-green);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* ===== CHIPS/TAGS ===== */

.chip,
.filter-chip {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: var(--surface-elevated);
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    text-decoration: none;
}

.chip.active,
.filter-chip.active {
    background: var(--color-action-purple);
    color: var(--text-inverse);
    border-color: var(--color-action-purple);
}

.chip:hover:not(.active),
.filter-chip:hover:not(.active) {
    border-color: var(--color-action-purple);
    background: var(--color-action-purple-light);
}

/* ===== DIVIDERS ===== */

.divider {
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 24px 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 2px;
    background: var(--border);
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

/* ===== FORM GROUPS ===== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    height: 50px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    padding: 0 16px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    background: var(--surface-elevated);
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-price-blue);
    box-shadow: 0 0 0 3px var(--color-price-blue-light);
}

.form-select {
    width: 100%;
    height: 50px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    padding: 0 16px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    background: var(--surface-elevated);
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-select:focus {
    outline: none;
    border-color: var(--color-price-blue);
    box-shadow: 0 0 0 3px var(--color-price-blue-light);
}

/* ===== TOAST NOTIFICATIONS ===== */

.toast-container {
    position: fixed;
    bottom: calc(80px + 16px); /* above footer nav */
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.toast {
    padding: 14px 24px;
    border-radius: 14px;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 240px;
    max-width: 360px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    white-space: nowrap;
}

.toast-success {
    background: var(--ok);
    color: white;
}

.toast-error {
    background: var(--bad);
    color: white;
}

/* ============================================================
   KX-* DESIGN SYSTEM — namespace kx-
   Nuevo sistema de componentes reutilizables para modo admin.
   No choca con redesign.css porque usa el prefijo kx-.
   ============================================================ */

/* ===== KX TOOLBAR ===== */
.kx-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
}
.kx-toolbar__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--fg-1);
    margin: 0;
}
.kx-toolbar__actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ===== KX FILTERS ===== */
.kx-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.kx-filters__search {
    position: relative;
    flex: 1;
    min-width: 200px;
}
.kx-filters__search input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--surface-1);
}
.kx-filters__chips {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

/* ===== KX CHIP ===== */
.kx-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.15s;
    background: var(--surface-1);
    color: var(--fg-2);
    text-decoration: none;
}
.kx-chip:hover {
    border-color: var(--color-action-purple);
    color: var(--color-action-purple);
}
.kx-chip--active {
    background: var(--color-action-purple);
    color: white !important;
    border-color: var(--color-action-purple) !important;
}
.kx-chip--warning { background: color-mix(in srgb, var(--warn) var(--tint-bg-amt), var(--surface-1)); color: color-mix(in srgb, var(--warn) var(--tint-ink-amt), var(--tint-ink)); border-color: var(--warn); }
.kx-chip--danger  { background: color-mix(in srgb, var(--bad)  var(--tint-bg-amt), var(--surface-1)); color: color-mix(in srgb, var(--bad)  var(--tint-ink-amt), var(--tint-ink)); border-color: var(--bad); }
.kx-chip--success { background: color-mix(in srgb, var(--ok)   var(--tint-bg-amt), var(--surface-1)); color: color-mix(in srgb, var(--ok)   var(--tint-ink-amt), var(--tint-ink)); border-color: var(--ok); }
.kx-chip__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0,0,0,0.08);
    color: inherit;
    line-height: 1;
    margin-left: 2px;
}
.kx-chip--active .kx-chip__count {
    background: rgba(255,255,255,0.25);
}

/* ===== KX KPI CARD ===== */
.kx-kpi-card {
    background: var(--surface-1, white);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
}
.kx-kpi-card__label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--fg-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
}
.kx-kpi-card__value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--fg-1);
    line-height: 1.1;
    font-family: 'JetBrains Mono', monospace;
}
.kx-kpi-card__delta {
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    font-weight: 500;
}
.kx-kpi-card__delta--up   { color: var(--ok); }
.kx-kpi-card__delta--down { color: var(--bad); }
.kx-kpi-card--purple { border-top: 3px solid var(--color-action-purple); }
.kx-kpi-card--green  { border-top: 3px solid var(--color-add-green); }
.kx-kpi-card--blue   { border-top: 3px solid var(--color-price-blue); }
.kx-kpi-card--amber  { border-top: 3px solid var(--warn); }
.kx-kpi-card--red    { border-top: 3px solid var(--bad); }
.kx-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
}

/* ===== KX TABLE ===== */
.kx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.kx-table thead {
    background: var(--surface-2);
    border-bottom: 2px solid var(--border);
}
.kx-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--fg-2);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.kx-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.kx-table tbody tr:hover { background: var(--surface-2); }
.kx-table tbody tr:last-child td { border-bottom: none; }
.kx-table__actions {
    display: flex;
    gap: 0.375rem;
    justify-content: flex-end;
}

/* ===== KX PAGINATION ===== */
.kx-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--fg-2);
}
.kx-pagination__pages { display: flex; gap: 0.25rem; }
.kx-pagination__page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    text-decoration: none;
    color: var(--fg-1);
    font-size: 0.875rem;
}
.kx-pagination__page--active {
    background: var(--color-action-purple);
    color: white;
    border-color: var(--color-action-purple);
}

/* ============================================================
   KX TABLE VIEW — vista de tabla/lista densa estándar del sitio
   Origen: /inventory/v4/, la vista de referencia del equipo — su chrome
   (toolbar sticky, buscador, chips, view toggle, grid de filas denso con
   hover-grow, paginador sticky) fue extraído aquí y /inventory/v4/ corre
   sobre estas mismas clases (inventory.css solo aporta columnas de
   producto). Reutilizable por cualquier tabla/lista futura, o para migrar
   las existentes que hoy usan .kx-table + .kx-pagination cuando necesiten
   más densidad: selector de tamaño de página, filas que crecen al hover,
   paginador sticky. El título y los botones de acción de cabecera NO viven
   aquí: usar .kx-page-header + .kx-action-btn (ya estándar, no tocado).

   Ejemplo compuesto (columnas propias de la vista via --kx-tv-cols en el
   contenedor .kx-tv-list; ver KX HOVER REVEAL más arriba para las acciones
   ocultas-hasta-hover de cada fila):
     <div class="kx-tv-toolbar">
       <div class="kx-search"> ... </div>
       <div class="kx-tv-toolbar__row">
         <div class="filter-chips">...<button class="kx-chip">...</button></div>
         <div class="kx-view-toggle">...</div>
       </div>
     </div>
     <div class="kx-tv-list" style="--kx-tv-cols: 1fr 100px 100px 200px;">
       <div class="kx-tv-list__header"> ...títulos de columna... </div>
       <div class="kx-tv-row kx-hover-reveal"> ...celdas + .kx-hover-reveal__target... </div>
     </div>
     <div class="kx-tv-paginator"> ... </div>
   ============================================================ */

/* ----- Toolbar sticky (buscador + chips + view toggle) ----- */
/* Fix: .main-content tiene overflow-y:auto, lo que crea un scroll container
   que rompe position:sticky en el toolbar. :has() acota el fix a páginas
   que efectivamente tienen un .kx-tv-toolbar. */
.main-content:has(.kx-tv-toolbar) {
    overflow-y: visible;
}
.kx-tv-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface-store);
    padding: 10px 0 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}
.kx-tv-toolbar__row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    min-height: 36px;
}

/* ----- KX SEARCH — variante con icono a la izquierda + botón limpiar -----
 * Alternativa a la clase pelada .search-input (ver más arriba) cuando la
 * vista necesita botón de limpiar. Ambas conviven: .search-input pelado para
 * el caso simple sin limpiar (history.html, pos/products_grid.html,
 * quick_entry/review.html), .kx-search cuando se necesita el botón.
 * Usage:
 *   <div class="kx-search">
 *     <i data-lucide="search" class="kx-search__icon"></i>
 *     <input type="text" class="kx-search__input" placeholder="...">
 *     <button class="kx-search__clear" x-show="query" @click="query = ''"><i data-lucide="x"></i></button>
 *   </div>
 */
.kx-search {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.kx-search__icon {
    position: absolute;
    left: 14px;
    color: var(--text-tertiary);
    pointer-events: none;
    width: 18px;
    height: 18px;
    z-index: 1;
}
.kx-search__input {
    width: 100%;
    height: 44px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    padding: 0 44px;
    font-size: 15px;
    font-weight: 500;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    background: var(--surface-elevated);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}
.kx-search__input:focus {
    outline: none;
    border-color: var(--color-action-purple);
    box-shadow: 0 0 0 3px var(--color-action-purple-light);
}
.kx-search__input::placeholder {
    color: var(--text-tertiary);
}
.kx-search__clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--surface-3);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.kx-search__clear:hover { background: #cbd5e1; }

/* ----- KX VIEW TOGGLE — switch list/grid ----- */
.kx-view-toggle {
    display: inline-flex;
    flex-shrink: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
    height: 36px;
    align-items: center;
    box-sizing: border-box;
}
.kx-view-toggle__btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.kx-view-toggle__btn:hover { color: var(--text-secondary); }
.kx-view-toggle__btn--active {
    background: var(--surface-elevated);
    color: var(--fg-1);
    box-shadow: var(--shadow-sm);
}

/* ----- KX TV LIST/ROW — grid denso con fila que crece al hover -----
 * Contenedor .kx-tv-list, cabecera .kx-tv-list__header, filas .kx-tv-row.
 * Columnas propias de cada vista via variable heredada `--kx-tv-cols`
 * (setearla una vez en el contenedor .kx-tv-list, la heredan header y filas):
 *   .kx-tv-list { --kx-tv-cols: minmax(200px,1fr) 100px 70px 100px 380px; }
 * Barra de acento izquierda opcional (severidad/estado por fila) via
 * `--kx-tv-accent` (color) + `--kx-tv-accent-opacity` (0-1), seteadas por
 * clases modificadoras propias de cada vista (ej. .stock-warning en
 * inventario). Combinar con .kx-hover-reveal en la fila +
 * .kx-hover-reveal__target en las acciones para revelar botones ocultos
 * con hover/foco (ver sección KX HOVER REVEAL).
 */
.kx-tv-list {
    margin-top: 8px;
    background: var(--surface-elevated);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.kx-tv-list__header {
    display: grid;
    grid-template-columns: var(--kx-tv-cols, 1fr);
    gap: 16px;
    padding: 12px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-bottom: 2px solid var(--border);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
}
.kx-tv-row {
    display: grid;
    grid-template-columns: var(--kx-tv-cols, 1fr);
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    transition: padding 0.18s ease, box-shadow 0.18s ease, background 0.15s ease;
    position: relative;
}
.kx-tv-row:last-child { border-bottom: none; }
/* Crece solo la fila con hover — reflowea vecinas, no usa transform, para
   no generar glitches de layout. */
.kx-tv-row:hover {
    background: var(--surface-2);
    padding: 24px 18px;
    box-shadow: var(--shadow-md);
    z-index: 1;
}
.kx-tv-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--kx-tv-accent, transparent);
    opacity: var(--kx-tv-accent-opacity, 0);
    transition: opacity 0.15s ease;
}

/* ----- KX TV ENTITY — celda de identidad (ícono + título + subtítulo) -----
 * Primera columna típica de una .kx-tv-row: quién/qué es esta fila.
 * Ícono y título crecen junto con el hover-grow de la fila (mismo look en
 * cualquier vista: producto, alerta, empleado, venta...).
 * Usage:
 *   <div class="kx-tv-entity">
 *     <div class="kx-tv-icon kx-tv-icon--warn"><i data-lucide="..."></i></div>
 *     <div class="kx-tv-entity__body">
 *       <div class="kx-tv-title">Nombre</div>
 *       <div class="kx-tv-subtitle">Detalle secundario</div>
 *     </div>
 *   </div>
 */
.kx-tv-entity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.kx-tv-entity__body { min-width: 0; flex: 1; }

.kx-tv-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: width 0.18s ease, height 0.18s ease, background 0.18s ease;
}
.kx-tv-icon svg, .kx-tv-icon i { width: 18px; height: 18px; transition: width 0.18s ease, height 0.18s ease; }
.kx-tv-row:hover .kx-tv-icon { width: 52px; height: 52px; background: var(--surface-elevated); }
.kx-tv-row:hover .kx-tv-icon svg, .kx-tv-row:hover .kx-tv-icon i { width: 26px; height: 26px; }

.kx-tv-icon--ok   { background: color-mix(in srgb, var(--ok) var(--tint-bg-amt), var(--surface-1));   color: color-mix(in srgb, var(--ok) var(--tint-ink-amt), var(--tint-ink));   border-color: transparent; }
.kx-tv-icon--warn { background: color-mix(in srgb, var(--warn) var(--tint-bg-amt), var(--surface-1)); color: color-mix(in srgb, var(--warn) var(--tint-ink-amt), var(--tint-ink)); border-color: transparent; }
.kx-tv-icon--bad  { background: color-mix(in srgb, var(--bad) var(--tint-bg-amt), var(--surface-1));  color: color-mix(in srgb, var(--bad) var(--tint-ink-amt), var(--tint-ink));  border-color: transparent; }
.kx-tv-icon--info { background: color-mix(in srgb, var(--accent) var(--tint-bg-amt), var(--surface-1)); color: color-mix(in srgb, var(--accent) var(--tint-ink-amt), var(--tint-ink)); border-color: transparent; }

.kx-tv-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    transition: font-size 0.18s ease;
}
.kx-tv-row:hover .kx-tv-title { font-size: 16px; }
.kx-tv-subtitle {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ----- KX TV ACTIONS / ACTION BTN — botones por fila -----
 * Un solo lenguaje de botón de acción para cualquier .kx-tv-row, reemplaza
 * soluciones ad-hoc por vista (kx-button suelto, eq-icon-btn, etc). Combinar
 * con .kx-hover-reveal en la fila + .kx-hover-reveal__target en el wrapper
 * de acciones para revelarlos solo con hover/foco.
 * Tonos: --primary (verde, constructiva) / --neutral (gris, default) /
 *        --warn (ámbar) / --danger (rojo, destructiva).
 * Modificador --icon: cuadrado 54x54 sin label, para filas con 2+ acciones.
 * Usage:
 *   <div class="kx-tv-actions">
 *     <button class="kx-tv-action-btn kx-tv-action-btn--neutral kx-tv-action-btn--icon" title="Ver">
 *       <i data-lucide="eye"></i>
 *     </button>
 *   </div>
 */
.kx-tv-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }

.kx-tv-action-btn {
    height: 54px;
    padding: 6px 20px;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 19px !important; /* scale.css: `button{font-size:...!important}` global */
    font-weight: 800;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
}
.kx-tv-action-btn svg, .kx-tv-action-btn i { width: 24px; height: 24px; flex-shrink: 0; }
.kx-tv-action-btn--icon { width: 54px; height: 54px; padding: 0; flex-shrink: 0; }
.kx-tv-action-btn:hover { transform: scale(1.03); }
.kx-tv-action-btn:active { transform: scale(0.97); }

.kx-tv-action-btn--neutral { background: var(--surface-2); border-color: var(--border); color: var(--text-secondary); }
.kx-tv-action-btn--neutral:hover { background: var(--surface-3); color: var(--text-primary); }

.kx-tv-action-btn--primary { background: var(--ok); color: var(--text-inverse); }
.kx-tv-action-btn--primary:hover { background: color-mix(in srgb, var(--ok) 82%, black); }

.kx-tv-action-btn--warn { background: color-mix(in srgb, var(--warn) var(--tint-bg-amt), var(--surface-1)); border-color: var(--warn); color: color-mix(in srgb, var(--warn) var(--tint-ink-amt), var(--tint-ink)); }
.kx-tv-action-btn--warn:hover { background: var(--warn); color: var(--text-inverse); }

.kx-tv-action-btn--danger { background: color-mix(in srgb, var(--bad) var(--tint-bg-amt), var(--surface-1)); border-color: var(--bad); color: color-mix(in srgb, var(--bad) var(--tint-ink-amt), var(--tint-ink)); }
.kx-tv-action-btn--danger:hover { background: var(--bad); color: var(--text-inverse); }

/* ----- KX TV PAGINATOR — barra sticky inferior con selector de tamaño -----
 * Más rico que .kx-pagination (footer simple no-sticky, sin selector de
 * tamaño): usar este para listas densas paginadas client-side; usar
 * .kx-pagination para paginación simple dentro de una .kx-section.
 * Usage:
 *   <div class="kx-tv-paginator">
 *     <div class="kx-tv-paginator__sizes">
 *       <span class="kx-tv-paginator__label">Mostrar</span>
 *       <button class="kx-tv-paginator__size-btn kx-tv-paginator__size-btn--active">10</button>
 *     </div>
 *     <div class="kx-tv-paginator__nav">
 *       <button class="kx-tv-paginator__nav-btn">«</button>
 *       <button class="kx-tv-paginator__page-btn kx-tv-paginator__page-btn--active">1</button>
 *       <button class="kx-tv-paginator__nav-btn">»</button>
 *     </div>
 *   </div>
 */
.kx-tv-paginator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    margin-top: 8px;
    position: sticky;
    bottom: var(--footer-h, 64px);
    z-index: 9;
    background: var(--surface-store);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.kx-tv-paginator__sizes { display: flex; align-items: center; gap: 6px; }
.kx-tv-paginator__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 2px;
}
.kx-tv-paginator__size-btn {
    height: 32px;
    min-width: 42px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1.5px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    cursor: pointer;
    transition: all 0.15s ease;
}
.kx-tv-paginator__size-btn:hover {
    border-color: var(--color-action-purple);
    color: var(--fg-1);
    background: var(--color-action-purple-light);
}
.kx-tv-paginator__size-btn--active {
    background: var(--color-action-purple);
    border-color: var(--color-action-purple);
    color: #fff;
}
.kx-tv-paginator__nav { display: flex; align-items: center; gap: 8px; }
.kx-tv-paginator__nav-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1.5px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}
.kx-tv-paginator__nav-btn:hover:not(:disabled) {
    border-color: var(--color-action-purple);
    color: var(--fg-1);
    background: var(--color-action-purple-light);
}
.kx-tv-paginator__nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.kx-tv-paginator__page-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border-radius: 7px;
    border: 1.5px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    cursor: pointer;
    transition: all 0.15s ease;
}
.kx-tv-paginator__page-btn:hover {
    background: var(--color-action-purple-light);
    color: var(--fg-1);
    border-color: var(--color-action-purple);
}
.kx-tv-paginator__page-btn--active {
    background: var(--color-action-purple);
    border-color: var(--color-action-purple);
    color: #fff;
}

/* ===== KX EMPTY STATE ===== */
.kx-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--fg-2);
}
.kx-empty-state__icon {
    display: flex;
    margin-bottom: 1rem;
    opacity: 0.4;
}
.kx-empty-state__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--fg-1);
    margin-bottom: 0.5rem;
}
.kx-empty-state__body {
    font-size: 0.875rem;
    max-width: 320px;
    margin-bottom: 1.5rem;
}

/* ===== KX BUTTON ===== */
.kx-button {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
    font-family: var(--font-body, 'Inter', sans-serif);
}
.kx-button--primary {
    background: var(--color-action-purple);
    color: white;
}
.kx-button--primary:hover { background: #094BAC; }
.kx-button--secondary {
    background: var(--surface-1);
    color: var(--fg-1);
    border: 1.5px solid var(--border);
}
.kx-button--secondary:hover {
    border-color: var(--color-action-purple);
    color: var(--color-action-purple);
}
.kx-button--ghost {
    background: transparent;
    color: var(--fg-2);
}
.kx-button--ghost:hover {
    background: var(--surface-2);
    color: var(--fg-1);
}
.kx-button--danger {
  background: color-mix(in srgb, var(--bad) var(--tint-bg-amt), var(--surface-1)) !important;
  color:      color-mix(in srgb, var(--bad) var(--tint-ink-amt), var(--tint-ink)) !important;
  border: 1.5px solid var(--bad) !important;
}
.kx-button--danger:hover { background: color-mix(in srgb, var(--bad) 30%, var(--surface-1)); }
.kx-button--sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.kx-button--icon { padding: 0.5rem; border-radius: 8px; }

/* ===== KX SECTION ===== */
.kx-section {
    background: var(--surface-1, white);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.kx-section__header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.kx-section__body { padding: 1.5rem; }

/* ===== KX BADGE ===== */
.kx-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.kx-badge--success { background: color-mix(in srgb, var(--ok)     var(--tint-bg-amt), var(--surface-1)); color: color-mix(in srgb, var(--ok)     var(--tint-ink-amt), var(--tint-ink)); border: 1.5px solid var(--ok); }
.kx-badge--warning { background: color-mix(in srgb, var(--warn)   var(--tint-bg-amt), var(--surface-1)); color: color-mix(in srgb, var(--warn)   var(--tint-ink-amt), var(--tint-ink)); border: 1.5px solid var(--warn); }
.kx-badge--danger  { background: color-mix(in srgb, var(--bad)    var(--tint-bg-amt), var(--surface-1)); color: color-mix(in srgb, var(--bad)    var(--tint-ink-amt), var(--tint-ink)); border: 1.5px solid var(--bad); }
.kx-badge--neutral { background: var(--surface-2); color: var(--fg-2); border: 1.5px solid var(--border); }
.kx-badge--purple  { background: color-mix(in srgb, var(--accent) var(--tint-bg-amt), var(--surface-1)); color: color-mix(in srgb, var(--accent) var(--tint-ink-amt), var(--tint-ink)); border: 1.5px solid var(--accent); }

/* ===== SEARCH INPUT (uso con clase pelada, sin .search-wrapper) =====
   Puertadas por: templates/v4/sales/history.html, templates/v4/pos/components/products_grid.html,
   templates/v4/inventory/quick_entry/review.html. Ver plan de unificación 4.3. */
.search-input {
    width: 100%;
    height: 52px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    padding: 0 48px 0 18px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    background: var(--surface-1);
    transition: all 0.2s ease;
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, white);
}
.search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--fg-2);
}

/* ===== KX PAGE — contenedor de ancho estándar ===== */
.kx-page {
    padding: 20px 24px 32px;
    max-width: 1200px;
    margin: 0 auto;
}
.kx-page--wide   { max-width: 1400px; }
.kx-page--narrow { max-width: 640px;  }

/* ===== KX PAGE HEADER ===== */
.kx-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 4px 0;
}
.kx-page-header__back {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--surface-1);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--fg-1);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.kx-page-header__back:hover {
    background: var(--surface-2);
    border-color: var(--surface-3);
}
.kx-page-header__text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}
.kx-page-header__title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--fg-1);
    margin: 0;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kx-page-header__subtitle {
    font-size: 14px;
    color: var(--fg-2);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kx-page-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ===== KX PAGE — RESPONSIVE ===== */
@media (max-width: 768px) {
    .kx-page {
        padding: 12px 16px 24px;
    }
    .kx-page-header {
        margin-bottom: 16px;
        flex-wrap: wrap;
        gap: 10px;
    }
    .kx-page-header__title {
        font-size: 19px;
    }
    .kx-page-header__actions {
        flex-wrap: wrap;
        width: 100%;
    }

    /* Cuando el slot de acciones son solo íconos compactos (Alertas+Más, Proveedores+Historial),
       no hay motivo para forzar el wrap a una segunda línea a ancho completo — se quedan junto al título. */
    .kx-page-header:has(.kx-inv-header-actions-row),
    .kx-page-header:has(.asi-header-actions-row) {
        flex-wrap: nowrap;
    }
    .kx-page-header__actions:has(.kx-inv-header-actions-row),
    .kx-page-header__actions:has(.asi-header-actions-row) {
        flex-wrap: nowrap;
        width: auto;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .kx-page {
        padding: 8px 12px 20px;
    }
    .kx-page-header {
        margin-bottom: 14px;
    }
    .kx-page-header__title {
        font-size: 17px;
    }
}

/* ===== KX ACTION BUTTON — touch-first header CTA (shared component) ===== */
/*
 * Usage:
 *   <button class="kx-action-btn kx-action-btn--primary">
 *       <i data-lucide="plus"></i><span>Label</span>
 *   </button>
 * Modifiers: --primary (terracota fill) | --secondary (neutral) | --accent (terracota tint)
 * Count badge: <span class="kx-action-btn__count">N</span> inside the button
 */
.kx-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 20px;
    border-radius: 13px;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: transform 0.13s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.13s ease,
                background 0.12s ease;
}

.kx-action-btn i,
.kx-action-btn svg {
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0;
    stroke-width: 2 !important;
}

.kx-action-btn:active {
    transform: scale(0.95) !important;
    transition-duration: 0.07s !important;
}

/* Secondary — neutral utility */
.kx-action-btn--secondary {
    background: var(--surface-2);
    color: var(--fg-1);
    border: 1.5px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.kx-action-btn--secondary:hover {
    background: var(--surface-3);
    border-color: var(--fg-3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: var(--fg-1);
}

/* Accent — terracota tint (e.g. alert button when count > 0) */
.kx-action-btn--accent {
    background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
    color: var(--accent);
    border: 1.5px solid color-mix(in srgb, var(--accent) 28%, var(--border));
    box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 12%, transparent);
    font-weight: 800;
}
.kx-action-btn--accent:hover {
    background: color-mix(in srgb, var(--accent) 16%, var(--surface-2));
    transform: translateY(-1px);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 20%, transparent);
    text-decoration: none;
    color: var(--accent);
}

/* Primary — terracota solid CTA */
.kx-action-btn--primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 32%, transparent);
}
.kx-action-btn--primary:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent);
    text-decoration: none;
    color: #fff;
}

/* Inline count badge */
.kx-action-btn__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    margin-left: 2px;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    border-radius: 10px;
}
.kx-action-btn--secondary .kx-action-btn__count,
.kx-action-btn--accent .kx-action-btn__count {
    background: var(--accent);
    color: #fff;
}

/* Mobile responsive (scoped to header actions slot) */
@media (max-width: 768px) {
    .kx-page-header__actions .kx-action-btn {
        flex: 1 1 calc(50% - 4px);
        height: 52px;
        border-radius: 14px;
    }
}
@media (max-width: 480px) {
    .kx-page-header__actions .kx-action-btn {
        flex: 1 1 100%;
        justify-content: flex-start;
        height: 52px;
        padding: 0 20px;
    }
}

/* Icon-only variant — compact square button, no text label */
.kx-action-btn--icon-only {
    position: relative;
    width: 48px;
    padding: 0;
    gap: 0;
}
/* El badge de conteo pasa de "pastilla inline" a insignia superpuesta en la esquina —
   mismo tratamiento que .footer-badge (barra inferior) para consistencia visual. */
.kx-action-btn--icon-only .kx-action-btn__count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    margin-left: 0;
    padding: 0 4px;
    line-height: 18px;
    border-radius: 9px;
    border: 2px solid var(--surface-1);
    font-size: 10px;
}

/* ===== KX TOOLTIP — small hover label bubble (pointer devices only) ===== */
/*
 * Usage: add class + data-tooltip to any element with position context.
 *   <a class="kx-action-btn kx-action-btn--icon-only kx-tooltip" data-tooltip="Alertas">…</a>
 * Touch devices skip the hover reveal entirely (no sticky tooltip on tap).
 */
.kx-tooltip {
    position: relative;
}
.kx-tooltip::after,
.kx-tooltip::before {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.kx-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 9px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--fg-1);
    color: #fff;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    z-index: 600;
}
.kx-tooltip::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--fg-1);
    z-index: 600;
}
@media (hover: hover) and (pointer: fine) {
    .kx-tooltip:hover::after,
    .kx-tooltip:hover::before {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ===== KX HOVER REVEAL — acciones ocultas hasta hover/foco en la fila o tarjeta =====
 * Origen: patron "acciones ocultas hasta hover" nacido en .row-actions/.card-actions-compact
 * de /inventory/v4/ (inventory.css) y replicado en .fiado-actions-cell de /sales/fiados/.
 * Se extrae aqui como componente unico para no duplicar la logica opacity/transform en cada
 * vista nueva con tabla o grid de tarjetas.
 *
 * Usage:
 *   1. Clase `kx-hover-reveal` en el contenedor que dispara el hover (fila <tr>, <div> de fila,
 *      tarjeta de producto, etc).
 *   2. Clase `kx-hover-reveal__target` en el bloque de acciones dentro de ese contenedor.
 *      Agregar `kx-hover-reveal__target--rise` si el contenedor es una tarjeta (grid) en vez
 *      de una fila de tabla/lista — cambia la direccion de entrada de horizontal a vertical.
 *
 * Revela con mouse (:hover) y con teclado (:focus-within) — nunca solo en click, para que
 * Tab no dañe foco invisible (WCAG 2.4.7). En touch (sin hover) queda siempre visible via
 * `@media (hover:none)`. `prefers-reduced-motion` ya lo cubre a11y.css globalmente (pisa
 * transition-duration en `*`).
 *
 * Ejemplo (fila de tabla):
 *   <tr class="kx-hover-reveal">
 *     <td>...</td>
 *     <td><div class="kx-hover-reveal__target"> ...botones... </div></td>
 *   </tr>
 *
 * Ejemplo (tarjeta de grid):
 *   <div class="product-card kx-hover-reveal">
 *     ...
 *     <div class="kx-hover-reveal__target kx-hover-reveal__target--rise"> ...botones... </div>
 *   </div>
 *
 * El layout interno (display, gap, justify-content, tamaños de boton) sigue siendo
 * responsabilidad de la vista — este componente solo resuelve el show/hide.
 */
.kx-hover-reveal__target {
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.kx-hover-reveal:hover .kx-hover-reveal__target,
.kx-hover-reveal:focus-within .kx-hover-reveal__target {
    opacity: 1;
    transform: translateX(0);
}
.kx-hover-reveal__target--rise {
    transform: translateY(4px);
}
.kx-hover-reveal:hover .kx-hover-reveal__target--rise,
.kx-hover-reveal:focus-within .kx-hover-reveal__target--rise {
    transform: translateY(0);
}
@media (hover: none) {
    .kx-hover-reveal__target {
        opacity: 1;
        transform: none;
    }
}

/* ===== KX SCROLL STRIP — subtle prev/next arrows for horizontal-scroll rows ===== */
/*
 * Usage:
 *   <div class="kx-scroll-wrap" x-data="scrollStrip()" x-init="init($refs.track)">
 *       <button class="kx-scroll-arrow kx-scroll-arrow--left" x-show="canLeft" x-cloak @click="scrollBy(-1)" aria-label="Ver anteriores"><i data-lucide="chevron-left"></i></button>
 *       <div class="my-strip" x-ref="track" @scroll.passive="onScroll">...</div>
 *       <button class="kx-scroll-arrow kx-scroll-arrow--right" x-show="canRight" x-cloak @click="scrollBy(1)" aria-label="Ver más"><i data-lucide="chevron-right"></i></button>
 *   </div>
 * Requires src/static/js/v4/scroll-strip.js (registers the `scrollStrip` Alpine component).
 */
.kx-scroll-wrap {
    position: relative;
}
.kx-scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 27px;
    height: 27px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-1);
    border: 1px solid var(--border);
    color: var(--fg-2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
    cursor: pointer;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
}
.kx-scroll-arrow i,
.kx-scroll-arrow svg {
    width: 14px !important;
    height: 14px !important;
    stroke-width: 2.5 !important;
}
.kx-scroll-arrow--left {
    left: -2px;
}
.kx-scroll-arrow--right {
    right: -2px;
}

/* ===== KX BATCHBAR — barra flotante de selección múltiple =====
 * Pill oscura centrada que aparece solo cuando hay elementos
 * seleccionados. Reemplaza barras fijas de ancho completo por un
 * componente flotante con la misma animación de entrada/salida en
 * todas partes: slide-up + fade (220ms). Nace en Alertas (batchbar
 * de reposición) y es el patrón por defecto para cualquier flujo de
 * selección múltiple nuevo (pickers, tablas con acciones batch, etc).
 *
 * Usage:
 *   <div class="kx-batchbar" x-show="selected.length > 0" x-cloak
 *        x-transition:enter-start="kx-batchbar-start" x-transition:enter-end="kx-batchbar-end"
 *        x-transition:leave-start="kx-batchbar-end" x-transition:leave-end="kx-batchbar-start">
 *     <div class="kx-batchbar__inner">
 *       <div class="kx-batchbar__count" x-text="selected.length"></div>
 *       <div class="kx-batchbar__label">
 *         <strong x-text="...">…</strong>
 *         <span>texto de apoyo opcional</span>
 *       </div>
 *       <button type="button" class="kx-batchbar__clear" @click="...">Limpiar</button>
 *       <a/button class="kx-batchbar__cta">Acción principal</a/button>
 *     </div>
 *   </div>
 * Mismo patrón Alpine de clases con nombre que .kx-sheet-start/.kx-sheet-end
 * (shell.css) — el elemento con x-show lleva la transition CSS, las clases
 * start/end solo aportan el estado inicial/final de opacity + transform.
 */
.kx-batchbar {
    position: fixed; left: 0; right: 0; bottom: calc(var(--footer-h, 76px) + 12px); z-index: 150;
    display: flex; justify-content: center; padding: 0 16px; pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(.2, .8, .2, 1);
}
.kx-batchbar__inner {
    pointer-events: auto;
    background: var(--fg-1); color: var(--surface-1);
    border-radius: var(--r-lg, 18px);
    box-shadow: 0 18px 44px -14px rgba(0, 0, 0, .45);
    display: flex; align-items: center; gap: 14px;
    padding: 10px 12px 10px 18px;
    max-width: 640px; width: 100%;
}
.kx-batchbar__count {
    font-family: var(--font-mono); font-weight: 700; font-size: 18px;
    background: color-mix(in srgb, currentColor 14%, transparent); min-width: 38px; height: 38px; padding: 0 6px;
    border-radius: var(--r-sm, 10px); display: grid; place-items: center; flex-shrink: 0;
}
.kx-batchbar__label { flex: 1; font-size: 13px; font-weight: 600; line-height: 1.3; min-width: 0; overflow: hidden; }
.kx-batchbar__label strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kx-batchbar__label span { display: block; color: color-mix(in srgb, currentColor 58%, transparent); font-size: 11.5px; font-weight: 500; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kx-batchbar__clear {
    border: none; background: none; font-size: 12.5px; font-weight: 600; cursor: pointer;
    color: color-mix(in srgb, currentColor 65%, transparent); padding: 8px 10px; border-radius: var(--r-sm, 10px);
    transition: background .12s, color .12s; white-space: nowrap;
}
.kx-batchbar__clear:hover { background: color-mix(in srgb, currentColor 10%, transparent); color: currentColor; }
.kx-batchbar__cta {
    background: var(--accent); color: #fff; border: none; cursor: pointer;
    padding: 12px 18px; border-radius: var(--r-md, 14px); font-weight: 700; font-size: 14px;
    display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
    text-decoration: none; transition: background .15s;
}
.kx-batchbar__cta:disabled { opacity: .5; cursor: not-allowed; }
.kx-batchbar__cta:hover:not(:disabled) { background: var(--accent-dark); }
.kx-batchbar__cta i,
.kx-batchbar__cta svg { width: 16px !important; height: 16px !important; }

/* Tokens de transición Alpine — mismo lenguaje que kx-sheet-start/kx-sheet-end */
.kx-batchbar-start { opacity: 0; transform: translateY(16px) scale(.97); }
.kx-batchbar-end   { opacity: 1; transform: translateY(0) scale(1); }

@media (prefers-reduced-motion: reduce) {
    .kx-batchbar { transition: none !important; }
}
@media (max-width: 480px) {
    .kx-batchbar__inner { gap: 10px; padding: 8px 8px 8px 14px; }
    .kx-batchbar__label span { display: none; }
    .kx-batchbar__cta { padding: 10px 14px; font-size: 13px; }
}
