/* =====================================================================
   FixLab — capa de identidad sobre Bootstrap 5.3
   =====================================================================
   Dirección: taller de precisión. Superficies de grafito, una única línea
   de acento cian que marca lo activo, y ámbar reservado exclusivamente
   para lo que exige atención (stock bajo, demoras, saldo impago).

   El color no decora: informa. Si algo está en ámbar o rojo, hay que
   hacer algo al respecto.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Tokens
   --------------------------------------------------------------------- */
:root {
    --fx-font-display: 'Bricolage Grotesque', 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
    --fx-font-body:    'Instrument Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
    --fx-font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    --fx-sidebar-w:    248px;
    --fx-topbar-h:     62px;
    --fx-radius:       12px;
    --fx-radius-sm:    8px;
    --fx-radius-lg:    18px;

    --fx-transition:   180ms cubic-bezier(.4, 0, .2, 1);

    /* Acentos, idénticos en ambos temas salvo ajuste de contraste */
    --fx-cyan:   #06b6d4;
    --fx-amber:  #d97706;
    --fx-green:  #059669;
    --fx-red:    #dc2626;
    --fx-blue:   #2563eb;
    --fx-violet: #7c3aed;
    --fx-rose:   #e11d48;
    --fx-lime:   #65a30d;
    --fx-slate:  #475569;
}

/* Tema oscuro — el predeterminado del sistema */
[data-bs-theme='dark'] {
    --fx-bg:          #0b0e14;
    --fx-surface:     #111621;
    --fx-surface-2:   #161d2b;
    --fx-surface-3:   #1d2634;
    --fx-border:      #232d3f;
    --fx-border-soft: #1a2231;
    --fx-text:        #e3e9f4;
    --fx-text-soft:   #a3b0c4;
    --fx-muted:       #6f7d94;

    --fx-cyan:   #22d3ee;
    --fx-amber:  #fbbf24;
    --fx-green:  #34d399;
    --fx-red:    #f87171;
    --fx-blue:   #60a5fa;
    --fx-violet: #a78bfa;
    --fx-rose:   #fb7185;
    --fx-lime:   #a3e635;
    --fx-slate:  #94a3b8;

    --fx-shadow:      0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .7);
    --fx-shadow-lg:   0 24px 60px -20px rgba(0, 0, 0, .85);
    --fx-glow:        0 0 0 1px rgba(34, 211, 238, .28), 0 0 24px -6px rgba(34, 211, 238, .35);
    --fx-tint:        rgba(255, 255, 255, .03);
}

/* Tema claro */
[data-bs-theme='light'] {
    --fx-bg:          #f2f5fa;
    --fx-surface:     #ffffff;
    --fx-surface-2:   #f7f9fc;
    --fx-surface-3:   #eef2f8;
    --fx-border:      #dfe5ee;
    --fx-border-soft: #eaeff6;
    --fx-text:        #0f172a;
    --fx-text-soft:   #45536b;
    --fx-muted:       #74829a;

    --fx-shadow:      0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px -14px rgba(15, 23, 42, .18);
    --fx-shadow-lg:   0 24px 60px -24px rgba(15, 23, 42, .28);
    --fx-glow:        0 0 0 1px rgba(6, 182, 212, .3), 0 0 20px -8px rgba(6, 182, 212, .4);
    --fx-tint:        rgba(15, 23, 42, .02);
}

/* Puente con las variables de Bootstrap para que sus componentes hereden
   el tema sin tener que sobrescribir cada uno por separado. */
[data-bs-theme] {
    --bs-body-bg:          var(--fx-bg);
    --bs-body-color:       var(--fx-text);
    --bs-border-color:     var(--fx-border);
    --bs-secondary-color:  var(--fx-muted);
    --bs-emphasis-color:   var(--fx-text);
    --bs-link-color:       var(--fx-cyan);
    --bs-link-hover-color: var(--fx-cyan);
    --bs-primary:          var(--fx-cyan);
    --bs-body-font-family: var(--fx-font-body);
}

/* ---------------------------------------------------------------------
   2. Base
   --------------------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--fx-border) transparent; }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--fx-border);
    border: 3px solid transparent;
    border-radius: 99px;
    background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--fx-muted); background-clip: content-box; }

body {
    font-family: var(--fx-font-body);
    background: var(--fx-bg);
    color: var(--fx-text);
    font-size: .9375rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02', 'cv03', 'cv04';
}

h1, h2, h3, h4, h5, h6, .fx-display {
    font-family: var(--fx-font-display);
    font-weight: 600;
    letter-spacing: -.022em;
    color: var(--fx-text);
}

a { text-decoration: none; transition: color var(--fx-transition); }

/* Cifras: siempre monoespaciadas y de ancho fijo. Una columna de importes
   solo se puede comparar de un vistazo si los dígitos están alineados. */
.fx-num, .fx-money, td.fx-num, .table .fx-num {
    font-family: var(--fx-font-mono);
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum';
    letter-spacing: -.02em;
}

.fx-mono { font-family: var(--fx-font-mono); letter-spacing: -.02em; }

.fx-muted     { color: var(--fx-muted) !important; }
.fx-soft      { color: var(--fx-text-soft) !important; }
.fx-label     { font-size: .6875rem; font-weight: 600; letter-spacing: .07em;
                text-transform: uppercase; color: var(--fx-muted); }

:focus-visible {
    outline: 2px solid var(--fx-cyan);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------------------------------------------------------------------
   3. Estructura: sidebar + topbar + contenido
   --------------------------------------------------------------------- */
.fx-shell { min-height: 100vh; }

.fx-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--fx-sidebar-w);
    background: var(--fx-surface);
    border-right: 1px solid var(--fx-border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    overflow: hidden;
}

/* Trama técnica muy tenue: da textura sin competir con el contenido. */
.fx-sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--fx-tint) 1px, transparent 1px),
        linear-gradient(90deg, var(--fx-tint) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    opacity: .8;
}

.fx-brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    height: var(--fx-topbar-h);
    padding: 0 1.1rem;
    border-bottom: 1px solid var(--fx-border-soft);
    position: relative;
    flex-shrink: 0;
}

.fx-brand__mark {
    width: 34px; height: 34px;
    flex-shrink: 0;
    border-radius: 10px;
    display: grid; place-items: center;
    background: linear-gradient(145deg, var(--fx-cyan), color-mix(in srgb, var(--fx-cyan) 55%, var(--fx-violet)));
    color: #04121a;
    font-family: var(--fx-font-display);
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -.05em;
    box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--fx-cyan) 60%, transparent);
}

.fx-brand__name {
    font-family: var(--fx-font-display);
    font-weight: 700;
    font-size: 1.06rem;
    letter-spacing: -.03em;
    color: var(--fx-text);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fx-brand__tag {
    font-size: .625rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--fx-muted);
    font-weight: 600;
}

.fx-nav {
    flex: 1;
    overflow-y: auto;
    padding: .85rem .6rem 1.5rem;
    position: relative;
}

.fx-nav__section {
    font-size: .625rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--fx-muted);
    padding: 1rem .65rem .35rem;
    opacity: .75;
}

.fx-nav__link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .52rem .65rem;
    margin-bottom: 1px;
    border-radius: var(--fx-radius-sm);
    color: var(--fx-text-soft);
    font-size: .875rem;
    font-weight: 500;
    position: relative;
    transition: background var(--fx-transition), color var(--fx-transition);
}

.fx-nav__link i { font-size: 1.05rem; width: 1.2rem; text-align: center; opacity: .75; }

.fx-nav__link:hover { background: var(--fx-surface-2); color: var(--fx-text); }
.fx-nav__link:hover i { opacity: 1; }

.fx-nav__link.active {
    background: color-mix(in srgb, var(--fx-cyan) 12%, transparent);
    color: var(--fx-cyan);
    font-weight: 600;
}
.fx-nav__link.active i { opacity: 1; }

/* Marca vertical de la sección activa. */
.fx-nav__link.active::before {
    content: '';
    position: absolute;
    left: -.6rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    border-radius: 0 3px 3px 0;
    background: var(--fx-cyan);
    box-shadow: 0 0 10px -1px var(--fx-cyan);
}

.fx-nav__badge {
    margin-left: auto;
    font-family: var(--fx-font-mono);
    font-size: .6875rem;
    font-weight: 600;
    padding: .08rem .38rem;
    border-radius: 5px;
    background: var(--fx-surface-3);
    color: var(--fx-text-soft);
}

.fx-nav__badge--alert {
    background: color-mix(in srgb, var(--fx-amber) 18%, transparent);
    color: var(--fx-amber);
}

/* --- Topbar --- */
.fx-topbar {
    position: fixed;
    top: 0; right: 0;
    left: var(--fx-sidebar-w);
    height: var(--fx-topbar-h);
    background: color-mix(in srgb, var(--fx-bg) 82%, transparent);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    border-bottom: 1px solid var(--fx-border);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1.1rem;
    z-index: 1030;
}

.fx-search {
    position: relative;
    flex: 1;
    max-width: 460px;
}

.fx-search i {
    position: absolute;
    left: .8rem; top: 50%;
    transform: translateY(-50%);
    color: var(--fx-muted);
    font-size: .95rem;
    pointer-events: none;
}

.fx-search input {
    width: 100%;
    height: 38px;
    padding: 0 2.4rem 0 2.3rem;
    border-radius: 99px;
    border: 1px solid var(--fx-border);
    background: var(--fx-surface);
    color: var(--fx-text);
    font-size: .875rem;
    transition: border-color var(--fx-transition), box-shadow var(--fx-transition);
}

.fx-search input::placeholder { color: var(--fx-muted); }

.fx-search input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--fx-cyan) 55%, transparent);
    box-shadow: var(--fx-glow);
}

.fx-search kbd {
    position: absolute;
    right: .5rem; top: 50%;
    transform: translateY(-50%);
    font-family: var(--fx-font-mono);
    font-size: .6875rem;
    padding: .12rem .35rem;
    border-radius: 5px;
    border: 1px solid var(--fx-border);
    background: var(--fx-surface-2);
    color: var(--fx-muted);
}

.fx-iconbtn {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 10px;
    border: 1px solid var(--fx-border);
    background: var(--fx-surface);
    color: var(--fx-text-soft);
    font-size: 1.05rem;
    transition: all var(--fx-transition);
    flex-shrink: 0;
}

.fx-iconbtn:hover {
    color: var(--fx-cyan);
    border-color: color-mix(in srgb, var(--fx-cyan) 45%, transparent);
    background: var(--fx-surface-2);
}

.fx-avatar {
    width: 34px; height: 34px;
    border-radius: 10px;
    display: grid; place-items: center;
    font-family: var(--fx-font-display);
    font-size: .8125rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: #06131b;
    flex-shrink: 0;
}

.fx-avatar--cyan   { background: linear-gradient(145deg, #22d3ee, #0891b2); }
.fx-avatar--amber  { background: linear-gradient(145deg, #fbbf24, #d97706); }
.fx-avatar--violet { background: linear-gradient(145deg, #a78bfa, #7c3aed); color: #fff; }
.fx-avatar--lime   { background: linear-gradient(145deg, #a3e635, #65a30d); }
.fx-avatar--rose   { background: linear-gradient(145deg, #fb7185, #e11d48); color: #fff; }
.fx-avatar--slate  { background: linear-gradient(145deg, #94a3b8, #475569); color: #fff; }

.fx-userbtn {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .25rem .55rem .25rem .25rem;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--fx-text);
    transition: all var(--fx-transition);
}

.fx-userbtn:hover { background: var(--fx-surface); border-color: var(--fx-border); }
.fx-userbtn__name { font-size: .8125rem; font-weight: 600; line-height: 1.15; }
.fx-userbtn__role { font-size: .6875rem; color: var(--fx-muted); line-height: 1.15; }

/* --- Contenido --- */
.fx-main {
    margin-left: var(--fx-sidebar-w);
    padding: calc(var(--fx-topbar-h) + 1.5rem) 1.5rem 3.5rem;
    min-height: 100vh;
}

.fx-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.35rem;
}

.fx-page-title {
    font-family: var(--fx-font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.035em;
    margin: 0;
    line-height: 1.2;
}

.fx-page-sub { color: var(--fx-muted); font-size: .875rem; margin: .15rem 0 0; }

/* ---------------------------------------------------------------------
   4. Superficies
   --------------------------------------------------------------------- */
.fx-card {
    background: var(--fx-surface);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius);
    box-shadow: var(--fx-shadow);
    overflow: hidden;
}

.fx-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--fx-border-soft);
}

.fx-card__title {
    font-family: var(--fx-font-display);
    font-size: .9375rem;
    font-weight: 650;
    letter-spacing: -.02em;
    margin: 0;
}

.fx-card__body { padding: 1.1rem; }
.fx-card__body--flush { padding: 0; }

/* --- Cards de indicador --- */
.fx-stat {
    background: var(--fx-surface);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius);
    padding: .95rem 1rem 1rem;
    position: relative;
    overflow: hidden;
    transition: border-color var(--fx-transition), transform var(--fx-transition);
}

/* Filo superior de color: identifica la métrica sin necesidad de leerla. */
.fx-stat::after {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: linear-gradient(90deg, var(--fx-stat-color, var(--fx-cyan)), transparent 85%);
    opacity: .9;
}

.fx-stat:hover { border-color: color-mix(in srgb, var(--fx-stat-color, var(--fx-cyan)) 40%, var(--fx-border)); }

.fx-stat__label {
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--fx-muted);
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-bottom: .4rem;
}

.fx-stat__value {
    font-family: var(--fx-font-display);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -.04em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.fx-stat__meta { font-size: .75rem; color: var(--fx-muted); margin-top: .3rem; }

.fx-stat--cyan   { --fx-stat-color: var(--fx-cyan); }
.fx-stat--green  { --fx-stat-color: var(--fx-green); }
.fx-stat--amber  { --fx-stat-color: var(--fx-amber); }
.fx-stat--red    { --fx-stat-color: var(--fx-red); }
.fx-stat--violet { --fx-stat-color: var(--fx-violet); }
.fx-stat--blue   { --fx-stat-color: var(--fx-blue); }

.fx-delta { font-size: .75rem; font-weight: 600; font-family: var(--fx-font-mono); }
.fx-delta--up   { color: var(--fx-green); }
.fx-delta--down { color: var(--fx-red); }

/* ---------------------------------------------------------------------
   5. Tablas
   --------------------------------------------------------------------- */
.fx-table-wrap { overflow-x: auto; }

.fx-table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .875rem;
}

.fx-table thead th {
    background: var(--fx-surface-2);
    border-bottom: 1px solid var(--fx-border);
    color: var(--fx-muted);
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: .6rem .85rem;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

.fx-table tbody td {
    padding: .7rem .85rem;
    border-bottom: 1px solid var(--fx-border-soft);
    vertical-align: middle;
    color: var(--fx-text-soft);
}

.fx-table tbody tr:last-child td { border-bottom: none; }
.fx-table tbody tr { transition: background var(--fx-transition); }
.fx-table tbody tr:hover { background: var(--fx-surface-2); }
.fx-table tbody tr:hover td { color: var(--fx-text); }

.fx-table td strong, .fx-table td .fx-strong { color: var(--fx-text); font-weight: 600; }
.fx-table .text-end { text-align: right; }

.fx-table__actions { white-space: nowrap; text-align: right; }

.fx-table a.fx-link { color: var(--fx-cyan); font-weight: 600; }
.fx-table a.fx-link:hover { text-decoration: underline; }

/* Fila que exige atención: una barra fina a la izquierda, sin teñir todo. */
.fx-row--alert  { box-shadow: inset 3px 0 0 var(--fx-amber); }
.fx-row--danger { box-shadow: inset 3px 0 0 var(--fx-red); }

/* ---------------------------------------------------------------------
   6. Badges y estados
   --------------------------------------------------------------------- */
.fx-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .6875rem;
    font-weight: 650;
    letter-spacing: .01em;
    padding: .22rem .55rem;
    border-radius: 99px;
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1.4;
}

.fx-badge--cyan   { background: color-mix(in srgb, var(--fx-cyan) 14%, transparent);   color: var(--fx-cyan);   border-color: color-mix(in srgb, var(--fx-cyan) 28%, transparent); }
.fx-badge--green  { background: color-mix(in srgb, var(--fx-green) 14%, transparent);  color: var(--fx-green);  border-color: color-mix(in srgb, var(--fx-green) 28%, transparent); }
.fx-badge--amber  { background: color-mix(in srgb, var(--fx-amber) 15%, transparent);  color: var(--fx-amber);  border-color: color-mix(in srgb, var(--fx-amber) 30%, transparent); }
.fx-badge--red    { background: color-mix(in srgb, var(--fx-red) 14%, transparent);    color: var(--fx-red);    border-color: color-mix(in srgb, var(--fx-red) 28%, transparent); }
.fx-badge--blue   { background: color-mix(in srgb, var(--fx-blue) 14%, transparent);   color: var(--fx-blue);   border-color: color-mix(in srgb, var(--fx-blue) 28%, transparent); }
.fx-badge--violet { background: color-mix(in srgb, var(--fx-violet) 14%, transparent); color: var(--fx-violet); border-color: color-mix(in srgb, var(--fx-violet) 28%, transparent); }
.fx-badge--rose   { background: color-mix(in srgb, var(--fx-rose) 14%, transparent);   color: var(--fx-rose);   border-color: color-mix(in srgb, var(--fx-rose) 28%, transparent); }
.fx-badge--lime   { background: color-mix(in srgb, var(--fx-lime) 15%, transparent);   color: var(--fx-lime);   border-color: color-mix(in srgb, var(--fx-lime) 30%, transparent); }
.fx-badge--slate,
.fx-badge--secondary { background: var(--fx-surface-3); color: var(--fx-text-soft); border-color: var(--fx-border); }
.fx-badge--light  { background: transparent; color: var(--fx-muted); border-color: var(--fx-border); }

/* Alias para reutilizar nombres de Bootstrap desde el helper badge(). */
.fx-badge--success { background: color-mix(in srgb, var(--fx-green) 14%, transparent); color: var(--fx-green); border-color: color-mix(in srgb, var(--fx-green) 28%, transparent); }
.fx-badge--danger  { background: color-mix(in srgb, var(--fx-red) 14%, transparent);   color: var(--fx-red);   border-color: color-mix(in srgb, var(--fx-red) 28%, transparent); }
.fx-badge--warning { background: color-mix(in srgb, var(--fx-amber) 15%, transparent); color: var(--fx-amber); border-color: color-mix(in srgb, var(--fx-amber) 30%, transparent); }
.fx-badge--info    { background: color-mix(in srgb, var(--fx-blue) 14%, transparent);  color: var(--fx-blue);  border-color: color-mix(in srgb, var(--fx-blue) 28%, transparent); }
.fx-badge--primary { background: color-mix(in srgb, var(--fx-cyan) 14%, transparent);  color: var(--fx-cyan);  border-color: color-mix(in srgb, var(--fx-cyan) 28%, transparent); }

.fx-badge__dot { width: 5px; height: 5px; border-radius: 99px; background: currentColor; flex-shrink: 0; }

/* ---------------------------------------------------------------------
   7. Botones
   --------------------------------------------------------------------- */
.btn {
    font-family: var(--fx-font-body);
    font-weight: 600;
    font-size: .875rem;
    border-radius: var(--fx-radius-sm);
    padding: .48rem .95rem;
    transition: all var(--fx-transition);
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border-width: 1px;
}

.btn i { font-size: 1rem; }

.btn-primary {
    background: var(--fx-cyan);
    border-color: var(--fx-cyan);
    color: #04121a;
}

.btn-primary:hover, .btn-primary:focus {
    background: color-mix(in srgb, var(--fx-cyan) 85%, #000);
    border-color: color-mix(in srgb, var(--fx-cyan) 85%, #000);
    color: #04121a;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -8px var(--fx-cyan);
}

.btn-outline-secondary {
    border-color: var(--fx-border);
    color: var(--fx-text-soft);
    background: var(--fx-surface);
}

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

.btn-danger  { background: var(--fx-red);   border-color: var(--fx-red);   color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--fx-red) 85%, #000); border-color: color-mix(in srgb, var(--fx-red) 85%, #000); color: #fff; }

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--fx-muted);
    padding: .35rem .5rem;
}

.btn-ghost:hover { background: var(--fx-surface-2); color: var(--fx-text); }
.btn-ghost--danger:hover { background: color-mix(in srgb, var(--fx-red) 12%, transparent); color: var(--fx-red); }

.btn-sm { font-size: .8125rem; padding: .32rem .7rem; border-radius: 7px; }
.btn-lg { font-size: .9375rem; padding: .65rem 1.4rem; }

/* ---------------------------------------------------------------------
   8. Formularios
   --------------------------------------------------------------------- */
.form-label {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--fx-text-soft);
    margin-bottom: .3rem;
}

.form-label .fx-req { color: var(--fx-red); margin-left: .1rem; }

.form-control, .form-select {
    background: var(--fx-surface);
    border: 1px solid var(--fx-border);
    color: var(--fx-text);
    border-radius: var(--fx-radius-sm);
    padding: .5rem .75rem;
    font-size: .875rem;
    transition: border-color var(--fx-transition), box-shadow var(--fx-transition);
}

.form-control:focus, .form-select:focus {
    background: var(--fx-surface);
    border-color: color-mix(in srgb, var(--fx-cyan) 55%, transparent);
    box-shadow: var(--fx-glow);
    color: var(--fx-text);
}

.form-control::placeholder { color: var(--fx-muted); }
.form-control:disabled, .form-control[readonly] { background: var(--fx-surface-3); color: var(--fx-muted); }

.form-control.is-invalid, .form-select.is-invalid {
    border-color: var(--fx-red);
    background-image: none;
    padding-right: .75rem;
}

.invalid-feedback { font-size: .78125rem; color: var(--fx-red); }
.form-text { font-size: .78125rem; color: var(--fx-muted); }

/* Campo de importe: el símbolo de moneda va adosado y el número monoespaciado. */
.fx-money-input { position: relative; }
.fx-money-input .form-control { font-family: var(--fx-font-mono); text-align: right; padding-left: 2.6rem; }
.fx-money-input__sym {
    position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
    font-family: var(--fx-font-mono); font-size: .8125rem; color: var(--fx-muted); pointer-events: none;
}

.form-check-input { background-color: var(--fx-surface-3); border-color: var(--fx-border); }
.form-check-input:checked { background-color: var(--fx-cyan); border-color: var(--fx-cyan); }
.form-check-label { font-size: .875rem; color: var(--fx-text-soft); }

.fx-fieldset { border: 1px solid var(--fx-border-soft); border-radius: var(--fx-radius); padding: 1.1rem; margin-bottom: 1.1rem; }
.fx-fieldset__legend {
    font-family: var(--fx-font-display); font-size: .8125rem; font-weight: 650;
    letter-spacing: .02em; color: var(--fx-cyan); text-transform: uppercase;
    padding: 0 .4rem; margin-left: -.4rem; width: auto;
}

/* ---------------------------------------------------------------------
   9. Estados vacíos
   --------------------------------------------------------------------- */
.fx-empty { padding: 3.25rem 1.5rem; text-align: center; }

.fx-empty__icon {
    width: 56px; height: 56px;
    margin: 0 auto .9rem;
    display: grid; place-items: center;
    border-radius: 16px;
    background: var(--fx-surface-2);
    border: 1px solid var(--fx-border);
    color: var(--fx-muted);
    font-size: 1.5rem;
}

.fx-empty__title { font-family: var(--fx-font-display); font-size: 1rem; font-weight: 650; margin-bottom: .25rem; }
.fx-empty__text  { color: var(--fx-muted); font-size: .875rem; max-width: 26rem; margin: 0 auto 1.1rem; }

/* ---------------------------------------------------------------------
   10. Avisos
   --------------------------------------------------------------------- */
.fx-toasts {
    position: fixed;
    top: calc(var(--fx-topbar-h) + .75rem);
    right: 1.1rem;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    max-width: min(24rem, calc(100vw - 2rem));
}

.fx-toast {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .75rem .9rem;
    border-radius: var(--fx-radius);
    background: var(--fx-surface);
    border: 1px solid var(--fx-border);
    box-shadow: var(--fx-shadow-lg);
    font-size: .875rem;
    color: var(--fx-text);
    animation: fx-toast-in 320ms cubic-bezier(.2, .9, .3, 1.2) both;
}

.fx-toast i { font-size: 1.05rem; flex-shrink: 0; margin-top: .05rem; }
.fx-toast--success { border-left: 3px solid var(--fx-green); }
.fx-toast--success i { color: var(--fx-green); }
.fx-toast--danger  { border-left: 3px solid var(--fx-red); }
.fx-toast--danger i { color: var(--fx-red); }
.fx-toast--warning { border-left: 3px solid var(--fx-amber); }
.fx-toast--warning i { color: var(--fx-amber); }
.fx-toast--info    { border-left: 3px solid var(--fx-blue); }
.fx-toast--info i { color: var(--fx-blue); }

.fx-toast__close { margin-left: auto; background: none; border: none; color: var(--fx-muted); padding: 0 .1rem; font-size: 1rem; line-height: 1; }
.fx-toast__close:hover { color: var(--fx-text); }

.fx-toast.is-leaving { animation: fx-toast-out 220ms ease-in forwards; }

@keyframes fx-toast-in {
    from { opacity: 0; transform: translateX(1.5rem) scale(.96); }
    to   { opacity: 1; transform: none; }
}

@keyframes fx-toast-out {
    to { opacity: 0; transform: translateX(1.5rem) scale(.96); }
}

.fx-alert {
    display: flex;
    gap: .7rem;
    padding: .8rem 1rem;
    border-radius: var(--fx-radius);
    border: 1px solid var(--fx-border);
    background: var(--fx-surface-2);
    font-size: .875rem;
    align-items: flex-start;
}

.fx-alert i { font-size: 1.1rem; flex-shrink: 0; margin-top: .05rem; }
.fx-alert--warning { border-color: color-mix(in srgb, var(--fx-amber) 35%, transparent); background: color-mix(in srgb, var(--fx-amber) 8%, var(--fx-surface)); }
.fx-alert--warning i { color: var(--fx-amber); }
.fx-alert--danger  { border-color: color-mix(in srgb, var(--fx-red) 35%, transparent); background: color-mix(in srgb, var(--fx-red) 8%, var(--fx-surface)); }
.fx-alert--danger i { color: var(--fx-red); }
.fx-alert--info    { border-color: color-mix(in srgb, var(--fx-blue) 32%, transparent); background: color-mix(in srgb, var(--fx-blue) 7%, var(--fx-surface)); }
.fx-alert--info i { color: var(--fx-blue); }

/* ---------------------------------------------------------------------
   11. Menús y modales de Bootstrap
   --------------------------------------------------------------------- */
.dropdown-menu {
    background: var(--fx-surface);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius);
    box-shadow: var(--fx-shadow-lg);
    padding: .35rem;
    font-size: .875rem;
    min-width: 12rem;
}

.dropdown-item {
    border-radius: var(--fx-radius-sm);
    padding: .45rem .6rem;
    color: var(--fx-text-soft);
    display: flex;
    align-items: center;
    gap: .55rem;
}

.dropdown-item:hover, .dropdown-item:focus { background: var(--fx-surface-2); color: var(--fx-text); }
.dropdown-item i { font-size: 1rem; opacity: .8; width: 1.1rem; }
.dropdown-item--danger { color: var(--fx-red); }
.dropdown-item--danger:hover { background: color-mix(in srgb, var(--fx-red) 12%, transparent); color: var(--fx-red); }
.dropdown-divider { border-color: var(--fx-border-soft); margin: .3rem 0; }
.dropdown-header { font-size: .6875rem; text-transform: uppercase; letter-spacing: .07em; color: var(--fx-muted); font-weight: 700; }

.modal-content {
    background: var(--fx-surface);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-lg);
    box-shadow: var(--fx-shadow-lg);
}

.modal-header { border-bottom: 1px solid var(--fx-border-soft); padding: 1rem 1.25rem; }
.modal-title  { font-family: var(--fx-font-display); font-size: 1.0625rem; font-weight: 650; letter-spacing: -.02em; }
.modal-body   { padding: 1.25rem; }
.modal-footer { border-top: 1px solid var(--fx-border-soft); padding: .85rem 1.25rem; gap: .5rem; }
.btn-close    { filter: var(--fx-close-filter, none); opacity: .6; }
[data-bs-theme='dark'] .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }

/* ---------------------------------------------------------------------
   12. Paginación
   --------------------------------------------------------------------- */
.fx-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: .8rem 1.1rem;
    border-top: 1px solid var(--fx-border-soft);
    font-size: .8125rem;
    color: var(--fx-muted);
}

.fx-pagination__pages { display: flex; gap: .2rem; }

.fx-pagination__page {
    min-width: 32px; height: 32px;
    display: grid; place-items: center;
    padding: 0 .5rem;
    border-radius: 7px;
    border: 1px solid transparent;
    color: var(--fx-text-soft);
    font-family: var(--fx-font-mono);
    font-size: .8125rem;
    transition: all var(--fx-transition);
}

.fx-pagination__page:hover { background: var(--fx-surface-2); color: var(--fx-text); }

.fx-pagination__page.active {
    background: color-mix(in srgb, var(--fx-cyan) 15%, transparent);
    border-color: color-mix(in srgb, var(--fx-cyan) 35%, transparent);
    color: var(--fx-cyan);
    font-weight: 700;
}

.fx-pagination__page.disabled { color: var(--fx-muted); opacity: .4; pointer-events: none; }

/* ---------------------------------------------------------------------
   13. Filtros
   --------------------------------------------------------------------- */
.fx-filters {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
    padding: .8rem 1.1rem;
    border-bottom: 1px solid var(--fx-border-soft);
    background: var(--fx-surface-2);
}

.fx-filters .form-control, .fx-filters .form-select {
    height: 34px; padding-top: .25rem; padding-bottom: .25rem; font-size: .8125rem;
    background: var(--fx-surface);
}

.fx-filters__spacer { flex: 1; }

.fx-chip {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .2rem .55rem .2rem .65rem;
    border-radius: 99px;
    background: color-mix(in srgb, var(--fx-cyan) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--fx-cyan) 28%, transparent);
    color: var(--fx-cyan);
    font-size: .75rem; font-weight: 600;
}

.fx-chip a { color: inherit; opacity: .7; display: grid; place-items: center; }
.fx-chip a:hover { opacity: 1; }

/* ---------------------------------------------------------------------
   14. Login
   --------------------------------------------------------------------- */
.fx-auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1.25rem;
    position: relative;
    overflow: hidden;
    background: var(--fx-bg);
}

/* Atmósfera: dos halos difusos y una trama fina. Da profundidad sin
   recurrir al degradado plano de siempre. */
.fx-auth::before {
    content: '';
    position: absolute;
    width: 60vmax; height: 60vmax;
    top: -22vmax; right: -18vmax;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--fx-cyan) 18%, transparent) 0%, transparent 62%);
    filter: blur(24px);
    animation: fx-drift 22s ease-in-out infinite alternate;
}

.fx-auth::after {
    content: '';
    position: absolute;
    width: 46vmax; height: 46vmax;
    bottom: -20vmax; left: -14vmax;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--fx-violet) 15%, transparent) 0%, transparent 62%);
    filter: blur(24px);
    animation: fx-drift 28s ease-in-out infinite alternate-reverse;
}

@keyframes fx-drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(-4vmax, 3vmax) scale(1.12); }
}

.fx-auth__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--fx-tint) 1px, transparent 1px),
        linear-gradient(90deg, var(--fx-tint) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 45%, #000 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 45%, #000 20%, transparent 75%);
}

.fx-auth__card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 25rem;
    background: color-mix(in srgb, var(--fx-surface) 88%, transparent);
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    border: 1px solid var(--fx-border);
    border-radius: 20px;
    padding: 2rem 1.85rem 1.85rem;
    box-shadow: var(--fx-shadow-lg);
}

.fx-auth__brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.6rem; }

.fx-auth__title {
    font-family: var(--fx-font-display);
    font-size: 1.4rem; font-weight: 700;
    letter-spacing: -.04em; margin: 0 0 .2rem;
}

.fx-auth__sub { color: var(--fx-muted); font-size: .875rem; margin: 0 0 1.5rem; }

.fx-auth__foot {
    margin-top: 1.5rem; padding-top: 1.1rem;
    border-top: 1px solid var(--fx-border-soft);
    font-size: .75rem; color: var(--fx-muted); text-align: center;
}

/* Aparición escalonada de los elementos del formulario. */
.fx-reveal { animation: fx-reveal 520ms cubic-bezier(.2, .8, .3, 1) both; }
.fx-reveal:nth-child(1) { animation-delay: 40ms; }
.fx-reveal:nth-child(2) { animation-delay: 100ms; }
.fx-reveal:nth-child(3) { animation-delay: 160ms; }
.fx-reveal:nth-child(4) { animation-delay: 220ms; }
.fx-reveal:nth-child(5) { animation-delay: 280ms; }
.fx-reveal:nth-child(6) { animation-delay: 340ms; }

@keyframes fx-reveal {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

.fx-pass-toggle {
    position: absolute; right: .55rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--fx-muted);
    padding: .25rem; font-size: 1.05rem; line-height: 1;
}
.fx-pass-toggle:hover { color: var(--fx-cyan); }

/* ---------------------------------------------------------------------
   15. Responsive
   --------------------------------------------------------------------- */
.fx-sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(2px);
    z-index: 1035;
    opacity: 0; pointer-events: none;
    transition: opacity var(--fx-transition);
}

body.fx-sidebar-open .fx-sidebar-backdrop { opacity: 1; pointer-events: auto; }

@media (max-width: 1199.98px) {
    :root { --fx-sidebar-w: 232px; }
}

@media (max-width: 991.98px) {
    .fx-sidebar {
        transform: translateX(-100%);
        transition: transform var(--fx-transition);
        box-shadow: var(--fx-shadow-lg);
    }

    body.fx-sidebar-open .fx-sidebar { transform: none; }

    .fx-topbar { left: 0; }
    .fx-main   { margin-left: 0; padding-left: 1rem; padding-right: 1rem; }
}

@media (max-width: 767.98px) {
    .fx-main { padding-top: calc(var(--fx-topbar-h) + 1rem); padding-bottom: 2.5rem; }
    .fx-page-title { font-size: 1.25rem; }
    .fx-stat__value { font-size: 1.35rem; }
    .fx-search { max-width: none; }
    .fx-search kbd { display: none; }
    .fx-userbtn__meta { display: none; }
    .fx-card__body { padding: .9rem; }
    .fx-toasts { left: 1rem; right: 1rem; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ---------------------------------------------------------------------
   16. Impresión
   --------------------------------------------------------------------- */
@media print {
    .fx-sidebar, .fx-topbar, .fx-toasts, .fx-no-print, .btn { display: none !important; }
    .fx-main { margin: 0; padding: 0; }
    .fx-card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
    body { background: #fff; color: #000; font-size: 11pt; }
}
