/**
 * @file inventory.css
 * @project Chicky Gallery
 * Inventario 2.0
 *
 * Misma estructura y clases que la versión 1.0.
 * Los cambios de diseño están marcados con "CAMBIO".
 */

/* =============================================
   VARIABLES
============================================= */

.inventory-page {
    --inv-bg: #f7f7fa;
    --inv-card: #ffffff;
    --inv-text: #25222c;
    --inv-muted: #77717f;
    --inv-border: #e8e4ec;
    --inv-soft: #f6f3f8;
    --inv-input: #ffffff;
    --inv-accent: #af00a1;
    --inv-accent-hover: #920087;
    --inv-accent-soft: rgba(175, 0, 161, 0.09);
    --inv-shadow: 0 10px 35px rgba(30, 20, 40, 0.045);
    --inv-danger: #c33c54;
    --inv-success: #267e60;

    /* CAMBIO: colores de apoyo para las tarjetas y avisos */
    --inv-warning: #b46a12;
    --inv-warning-soft: rgba(214, 140, 30, 0.14);
    --inv-danger-soft: rgba(205, 65, 95, 0.12);
    --inv-success-soft: rgba(38, 126, 96, 0.12);

    --inv-tone-a: #af00a1;
    --inv-tone-a-soft: rgba(175, 0, 161, 0.1);
    --inv-tone-b: #1f8f78;
    --inv-tone-b-soft: rgba(31, 143, 120, 0.12);
    --inv-tone-c: #c2761a;
    --inv-tone-c-soft: rgba(214, 140, 30, 0.14);
    --inv-tone-d: #4f6fd1;
    --inv-tone-d-soft: rgba(79, 111, 209, 0.12);

    --inv-hero:
        linear-gradient(
            135deg,
            rgba(175, 0, 161, 0.1) 0%,
            rgba(175, 0, 161, 0.025) 45%,
            rgba(31, 143, 120, 0.07) 100%
        );

    width: min(1460px, calc(100% - 36px));
    min-height: 80vh;
    margin: 0 auto;
    padding: 38px 0 90px;
    color: var(--inv-text);
    font-family: -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, Arial, sans-serif;
}

html.dark-mode .inventory-page,
body.dark-mode .inventory-page,
html[data-theme="dark"] .inventory-page {
    --inv-bg: #151219;
    --inv-card: #211d27;
    --inv-text: #f4eff6;
    --inv-muted: #b4a9bd;
    --inv-border: #423749;
    --inv-soft: #2c2433;
    --inv-input: #292330;
    --inv-accent: #dc9ae6;
    --inv-accent-hover: #edb5f2;
    --inv-accent-soft: rgba(220, 154, 230, 0.13);
    --inv-shadow: 0 12px 35px rgba(0, 0, 0, 0.19);
    --inv-danger: #ff879a;
    --inv-success: #77dbaf;

    /* CAMBIO */
    --inv-warning: #f0c36d;
    --inv-warning-soft: rgba(240, 195, 109, 0.14);
    --inv-danger-soft: rgba(255, 135, 154, 0.15);
    --inv-success-soft: rgba(119, 219, 175, 0.14);

    --inv-tone-a: #dc9ae6;
    --inv-tone-a-soft: rgba(220, 154, 230, 0.14);
    --inv-tone-b: #6fdcc0;
    --inv-tone-b-soft: rgba(111, 220, 192, 0.13);
    --inv-tone-c: #f0c36d;
    --inv-tone-c-soft: rgba(240, 195, 109, 0.14);
    --inv-tone-d: #9db4ff;
    --inv-tone-d-soft: rgba(157, 180, 255, 0.14);

    --inv-hero:
        linear-gradient(
            135deg,
            rgba(220, 154, 230, 0.13) 0%,
            rgba(220, 154, 230, 0.03) 45%,
            rgba(111, 220, 192, 0.08) 100%
        );
}

.inventory-page *,
.inventory-page *::before,
.inventory-page *::after {
    box-sizing: border-box;
}

/* =============================================
   HEADER
   CAMBIO: ahora es una tarjeta con degradado
   y un sticker de Salem decorativo
============================================= */

.inv-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 28px;
    padding: clamp(22px, 3vw, 34px);
    border: 1px solid var(--inv-border);
    border-radius: 26px;
    background: var(--inv-hero), var(--inv-card);
    box-shadow: var(--inv-shadow);
    overflow: hidden;
}

.inv-header::before {
    content: "";
    position: absolute;
    top: -70px;
    right: -50px;
    width: 230px;
    height: 230px;
    border-radius: 50%;
    background: var(--inv-accent-soft);
    pointer-events: none;
}

.inv-header > * {
    position: relative;
    z-index: 1;
}

.inv-header-art {
    position: absolute !important;
    z-index: 0 !important;
    right: clamp(14px, 3vw, 34px);
    bottom: -4px;
    width: clamp(92px, 12vw, 150px);
    height: auto;
    object-fit: contain;
    image-rendering: pixelated;
    pointer-events: none;
    user-select: none;
}

@media (min-width: 900px) {
    .inv-header {
        padding-right: clamp(150px, 17vw, 215px);
    }
}

.inv-eyebrow {
    color: var(--inv-accent);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.inv-heading h1 {
    margin: 9px 0 8px;
    color: var(--inv-text);
    font-size: clamp(2.2rem, 4vw, 3.35rem);
    font-weight: 760;
    line-height: 1.12;
    letter-spacing: -0.055em;
}

.inv-heading p,
.inv-panel-heading p {
    margin: 0;
    color: var(--inv-muted);
    font-size: 0.94rem;
    line-height: 1.6;
}

.inv-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* =============================================
   BOTONES
============================================= */

.inv-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 11px 17px;
    border: 1px solid transparent;
    border-radius: 12px;
    font: inherit;
    font-size: 0.87rem;
    font-weight: 730;
    line-height: 1.3;
    text-decoration: none;
    cursor: pointer;
    transition:
        background 0.17s ease,
        transform 0.17s ease,
        border-color 0.17s ease,
        box-shadow 0.17s ease;
}

.inv-button:hover {
    transform: translateY(-1px);
}

.inv-button-primary {
    background: #af00a1;
    color: white;
    box-shadow: 0 6px 18px rgba(175, 0, 161, 0.22);
}

.inv-button-primary:hover {
    background: #920087;
    color: white;
    box-shadow: 0 8px 22px rgba(175, 0, 161, 0.3);
}

.inv-button-secondary {
    background: var(--inv-card);
    border-color: var(--inv-border);
    color: var(--inv-text);
}

.inv-button-secondary:hover {
    background: var(--inv-soft);
}

.inv-button:disabled,
.inv-icon-button:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
}

/* =============================================
   TARJETAS DE RESUMEN
   CAMBIO: icono en un recuadro de color,
   barra superior y un tono distinto por tarjeta
============================================= */

.inv-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.inv-stat {
    --tone: var(--inv-tone-a);
    --tone-soft: var(--inv-tone-a-soft);

    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 23px;
    border: 1px solid var(--inv-border);
    border-radius: 20px;
    background: var(--inv-card);
    box-shadow: var(--inv-shadow);
    overflow: hidden;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.inv-stat::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--tone);
    opacity: 0.85;
}

.inv-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 38px rgba(30, 20, 40, 0.09);
}

.inv-stat--items,
.inv-stat--estimate {
    --tone: var(--inv-tone-a);
    --tone-soft: var(--inv-tone-a-soft);
}

.inv-stat--units,
.inv-stat--total {
    --tone: var(--inv-tone-b);
    --tone-soft: var(--inv-tone-b-soft);
}

.inv-stat--value,
.inv-stat--real {
    --tone: var(--inv-tone-c);
    --tone-soft: var(--inv-tone-c-soft);
}

.inv-stat--sales {
    --tone: var(--inv-tone-d);
    --tone-soft: var(--inv-tone-d-soft);
}

.inv-stat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.inv-stat-top span,
.inv-stat > span {
    font-size: 0.82rem;
    font-weight: 650;
    color: var(--inv-muted);
}

.inv-stat-top i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: var(--tone-soft);
    color: var(--tone);
    font-size: 1.3rem;
}

.inv-stat > strong {
    color: var(--inv-text);
    font-size: clamp(1.55rem, 2vw, 2rem);
    font-weight: 750;
    letter-spacing: -0.045em;
    overflow-wrap: anywhere;
}

.inv-stat > small {
    color: var(--inv-muted);
    font-size: 0.74rem;
    line-height: 1.5;
}

/* =============================================
   PESTAÑAS
   CAMBIO: la activa lleva fondo de acento
   y una barra inferior
============================================= */

.inv-tabs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    width: fit-content;
    max-width: 100%;
    margin-bottom: 20px;
    padding: 5px;
    border-radius: 16px;
    background: var(--inv-soft);
}

.inv-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 17px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--inv-muted);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition:
        background 0.18s ease,
        color 0.18s ease;
}

.inv-tab:hover {
    color: var(--inv-text);
}

.inv-tab.is-active {
    background: var(--inv-card);
    color: var(--inv-accent);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.065);
}

.inv-tab.is-active::after {
    content: "";
    position: absolute;
    left: 24%;
    right: 24%;
    bottom: 4px;
    height: 3px;
    border-radius: 999px;
    background: var(--inv-accent);
}

/* =============================================
   PANELES
============================================= */

.inv-panel {
    border: 1px solid var(--inv-border);
    border-radius: 20px;
    background: var(--inv-card);
    box-shadow: var(--inv-shadow);
    overflow: hidden;
}

/* CAMBIO: entrada suave al cambiar de pestaña */

.inv-panel:not([hidden]) {
    animation: inv-fade-up 0.26s ease both;
}

.inv-panel[hidden],
.inv-toast[hidden] {
    display: none !important;
}

.inv-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 25px;
}

.inv-panel-heading h2 {
    margin: 0 0 6px;
    color: var(--inv-text);
    font-size: 1.22rem;
    font-weight: 750;
}

.inv-subtle-count {
    padding: 7px 11px;
    border-radius: 999px;
    background: var(--inv-accent-soft);
    color: var(--inv-accent);
    font-size: 0.79rem;
    font-weight: 750;
}

/* =============================================
   BUSCADOR Y FILTROS
============================================= */

.inv-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 15px 25px;
    border-top: 1px solid var(--inv-border);
    border-bottom: 1px solid var(--inv-border);
}

.inv-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 260px;
    min-width: 180px;
}

.inv-search i {
    position: absolute;
    left: 14px;
    color: var(--inv-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

.inv-search input {
    width: 100%;
    padding-left: 41px !important;
}

.inventory-page input,
.inventory-page select,
.inventory-page textarea {
    min-width: 0;
    max-width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--inv-border);
    border-radius: 11px;
    background: var(--inv-input);
    color: var(--inv-text);
    font: inherit;
    font-size: 0.88rem;
    line-height: 1.5;
    color-scheme: light;
}

html.dark-mode .inventory-page input,
html.dark-mode .inventory-page select,
html.dark-mode .inventory-page textarea,
html[data-theme="dark"] .inventory-page input,
html[data-theme="dark"] .inventory-page select,
html[data-theme="dark"] .inventory-page textarea {
    color-scheme: dark;
}

.inventory-page input::placeholder,
.inventory-page textarea::placeholder {
    color: var(--inv-muted);
    opacity: 0.85;
}

.inventory-page input:focus,
.inventory-page select:focus,
.inventory-page textarea:focus {
    border-color: var(--inv-accent);
    outline: 2px solid var(--inv-accent-soft);
    outline-offset: 1px;
}

#inv-category-filter {
    min-width: 180px;
}

.inv-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--inv-muted);
    font-size: 0.83rem;
    cursor: pointer;
}

.inv-check input {
    width: 16px;
    height: 16px;
    accent-color: #af00a1;
}

/* =============================================
   TABLAS
============================================= */

.inv-table-scroll {
    width: 100%;
    overflow-x: auto;
}

.inv-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
    color: var(--inv-text);
    font-size: 0.85rem;
}

.inv-table th {
    padding: 15px 18px;
    background: var(--inv-soft);
    color: var(--inv-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.035em;
    text-align: left;
}

.inv-table td {
    padding: 16px 18px;
    border-top: 1px solid var(--inv-border);
    vertical-align: middle;
}

.inv-table tbody tr {
    transition: background 0.15s ease;
}

.inv-table tbody tr:hover {
    background: var(--inv-accent-soft);
}

.inv-table td:first-child strong {
    display: block;
    color: var(--inv-text);
    font-weight: 750;
}

.inv-table td:first-child small {
    display: block;
    margin-top: 5px;
    max-width: 250px;
    overflow: hidden;
    color: var(--inv-muted);
    text-overflow: ellipsis;
    font-size: 0.76rem;
}

/* =============================================
   ESTADOS VACÍOS
   CAMBIO: sticker de Salem sobre el mensaje
============================================= */

.inv-empty {
    padding: 45px 20px !important;
    text-align: center;
    color: var(--inv-muted);
    white-space: normal;
}

.inv-empty p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.inv-empty-sticker {
    display: block;
    width: 96px;
    height: 96px;
    margin: 0 auto 10px;
    object-fit: contain;
    image-rendering: pixelated;
    opacity: 0.95;
}

.inv-number {
    font-variant-numeric: tabular-nums;
}

.inv-quantity {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: 6px 10px;
    border-radius: 9px;
    background: var(--inv-soft);
    color: var(--inv-text);
    font-weight: 750;
}

.inv-quantity.is-low {
    background: var(--inv-warning-soft);
    color: var(--inv-warning);
}

.inv-quantity.is-empty {
    background: var(--inv-danger-soft);
    color: var(--inv-danger);
}

/* CAMBIO: etiquetas de estado junto a la cantidad */

.inv-stock-cell {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.inv-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.35;
    white-space: nowrap;
}

.inv-badge.is-empty {
    background: var(--inv-danger-soft);
    color: var(--inv-danger);
}

.inv-badge.is-low {
    background: var(--inv-warning-soft);
    color: var(--inv-warning);
}

.inv-badge.is-archived {
    background: var(--inv-soft);
    color: var(--inv-muted);
}

.inv-badge.is-ok {
    background: var(--inv-success-soft);
    color: var(--inv-success);
}

.inv-row-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.inv-row-actions button,
.inv-category-actions button {
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--inv-accent);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 750;
    cursor: pointer;
}

.inv-row-actions button:hover,
.inv-category-actions button:hover {
    background: var(--inv-accent-soft);
}

.inv-row-actions button.is-danger,
.inv-category-actions button.is-danger {
    color: var(--inv-danger);
}

.inv-row-actions button.is-danger:hover,
.inv-category-actions button.is-danger:hover {
    background: var(--inv-danger-soft);
}

.inv-row-archived {
    opacity: 0.58;
}

.inv-positive {
    color: var(--inv-success);
    font-weight: 750;
}

.inv-negative {
    color: var(--inv-danger);
    font-weight: 750;
}

/* =============================================
   CATEGORÍAS
============================================= */

.inv-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
    gap: 14px;
    padding: 24px;
    border-top: 1px solid var(--inv-border);
}

.inv-category-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--inv-border);
    border-radius: 16px;
    background: var(--inv-soft);
    transition:
        transform 0.18s ease,
        border-color 0.18s ease;
}

.inv-category-card:hover {
    transform: translateY(-2px);
    border-color: var(--inv-accent);
}

.inv-category-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--inv-accent-soft);
    color: var(--inv-accent);
    font-size: 1.25rem;
}

/* CAMBIO: cada categoría con un tono distinto */

.inv-category-card:nth-child(4n + 2) .inv-category-icon {
    background: var(--inv-tone-b-soft);
    color: var(--inv-tone-b);
}

.inv-category-card:nth-child(4n + 3) .inv-category-icon {
    background: var(--inv-tone-c-soft);
    color: var(--inv-tone-c);
}

.inv-category-card:nth-child(4n) .inv-category-icon {
    background: var(--inv-tone-d-soft);
    color: var(--inv-tone-d);
}

.inv-category-card strong {
    color: var(--inv-text);
    font-size: 0.96rem;
    overflow-wrap: anywhere;
}

.inv-category-card small {
    color: var(--inv-muted);
}

.inv-category-actions {
    display: flex;
    gap: 5px;
    margin-top: auto;
}

.inv-category-grid > .inv-empty {
    grid-column: 1 / -1;
}

/* =============================================
   DIÁLOGOS
============================================= */

.inv-dialog {
    position: fixed;
    width: min(580px, calc(100% - 24px));
    max-height: min(90vh, 900px);
    margin: auto;
    padding: 0;
    overflow-y: auto;
    border: 1px solid var(--inv-border);
    border-top: 4px solid #af00a1;
    border-radius: 22px;
    background: var(--inv-card);
    color: var(--inv-text);
    box-shadow: 0 25px 85px rgba(0, 0, 0, 0.24);
}

.inv-dialog[open] {
    animation: inv-pop 0.22s ease both;
}

.inv-dialog-small {
    width: min(490px, calc(100% - 24px));
}

.inv-dialog::backdrop {
    background: rgba(15, 10, 20, 0.52);
    backdrop-filter: blur(4px);
}

.inv-form {
    display: flex;
    flex-direction: column;
    gap: 17px;
    padding: 27px;
}

.inv-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 6px;
}

.inv-dialog-header h2 {
    margin: 8px 0 5px;
    color: var(--inv-text);
    font-size: 1.55rem;
    letter-spacing: -0.035em;
}

.inv-dialog-header p {
    margin: 0;
    color: var(--inv-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.inv-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 35px;
    height: 35px;
    border: 0;
    border-radius: 10px;
    background: var(--inv-soft);
    color: var(--inv-text);
    font-size: 1.3rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.inv-icon-button:hover {
    background: var(--inv-accent-soft);
    color: var(--inv-accent);
}

.inv-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.inv-field label {
    color: var(--inv-text);
    font-size: 0.83rem;
    font-weight: 750;
}

.inv-field input,
.inv-field select,
.inv-field textarea {
    width: 100%;
}

.inv-field small {
    color: var(--inv-muted);
    font-size: 0.75rem;
    line-height: 1.5;
}

.inv-form-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
}

.inv-dialog-footer {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
    padding-top: 18px;
    border-top: 1px solid var(--inv-border);
}

.inv-current-stock,
.inv-sale-total {
    padding: 15px;
    border-radius: 12px;
    background: var(--inv-soft);
    color: var(--inv-muted);
    font-size: 0.86rem;
}

.inv-current-stock {
    margin: 0;
}

.inv-current-stock strong {
    color: var(--inv-text);
}

.inv-sale-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--inv-accent-soft);
}

.inv-sale-total strong {
    color: var(--inv-text);
    font-size: 1.3rem;
    font-variant-numeric: tabular-nums;
}

/* =============================================
   NOTIFICACIONES
============================================= */

.inv-toast {
    position: fixed;
    z-index: 10010;
    right: 24px;
    bottom: 24px;
    width: min(370px, calc(100vw - 40px));
    padding: 15px 19px;
    border: 1px solid var(--inv-border);
    border-left: 4px solid var(--inv-accent);
    border-radius: 13px;
    background: var(--inv-card);
    color: var(--inv-text);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.16);
    font-size: 0.87rem;
    line-height: 1.5;
}

.inv-toast:not([hidden]) {
    animation: inv-fade-up 0.22s ease both;
}

.inv-toast.is-error {
    border-left-color: var(--inv-danger);
}

/* =============================================
   ANÁLISIS Y GRÁFICA
   CAMBIO: estas clases estaban en la vista pero no
   tenían estilos; ahora la gráfica se ve completa
============================================= */

#inv-profit-content {
    padding: 0 25px 25px;
}

#inv-profit-content[hidden] {
    display: none !important;
}

.inv-profit-section {
    margin-top: 24px;
}

.inv-analysis-filters {
    margin: 4px 0 18px;
}

.inv-projection-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.inv-chart-card {
    margin: 22px 0;
    padding: 20px;
    border: 1px solid var(--inv-border);
    border-radius: 18px;
    background: var(--inv-soft);
}

.inv-chart-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.inv-chart-heading h3 {
    margin: 0 0 4px;
    color: var(--inv-text);
    font-size: 1.05rem;
    font-weight: 750;
}

.inv-chart-heading p {
    margin: 0;
    color: var(--inv-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.inv-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-bottom: 12px;
    color: var(--inv-muted);
    font-size: 0.78rem;
    font-weight: 650;
}

.inv-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.inv-chart-key {
    display: inline-block;
    width: 14px;
    height: 5px;
    border-radius: 999px;
}

.inv-chart-key.revenue {
    background: #718096;
}

.inv-chart-key.gross {
    background: #af00a1;
}

.inv-chart-key.adjusted {
    background: #1f9d7a;
}

.inv-chart-scroll {
    overflow-x: auto;
    border-radius: 12px;
    background: var(--inv-card);
}

#inv-profit-chart {
    display: block;
    width: 100%;
    min-width: 560px;
    height: auto;
    color: var(--inv-muted);
}

.inv-analysis-subtitle {
    margin: 26px 0 12px;
    color: var(--inv-text);
    font-size: 1.05rem;
    font-weight: 750;
}

.inv-analysis-disclaimer {
    margin: 12px 0 0;
    color: var(--inv-muted);
    font-size: 0.82rem;
    line-height: 1.6;
}

#inv-sale-discount-summary {
    display: block;
    width: 100%;
    color: var(--inv-muted);
    font-size: 0.8rem;
}

/* =============================================
   ACCESIBILIDAD
============================================= */

.inventory-page
:is(button, a, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--inv-accent);
    outline-offset: 2px;
}

/* =============================================
   ANIMACIONES
============================================= */

@keyframes inv-fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes inv-pop {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* =============================================
   RESPONSIVE
============================================= */

@media (max-width: 1100px) {
    .inv-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 899px) {
    .inv-header-art {
        opacity: 0.35;
    }
}

@media (max-width: 720px) {
    .inv-projection-cards {
        grid-template-columns: 1fr;
    }

    #inv-profit-content {
        padding: 0 17px 20px;
    }

    .inv-chart-card {
        padding: 14px;
    }

    /* -----------------------------------------
       CAMBIO: las tablas pasan a tarjetas.
       Cada celda usa su atributo data-label
       (lo agrega inventory.js).
    ----------------------------------------- */

    .inv-table-scroll {
        overflow-x: visible;
    }

    .inv-table,
    .inv-table tbody {
        display: block;
        white-space: normal;
    }

    .inv-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    .inv-table tbody tr {
        display: block;
        margin: 0 14px 12px;
        padding: 6px 14px;
        border: 1px solid var(--inv-border);
        border-radius: 15px;
        background: var(--inv-card);
    }

    .inv-table tbody tr:first-child {
        margin-top: 14px;
    }

    .inv-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        padding: 10px 0;
        border-top: 1px solid var(--inv-border);
        text-align: right;
    }

    .inv-table td:first-child {
        display: block;
        padding: 12px 0 10px;
        border-top: 0;
        text-align: left;
    }

    .inv-table td[data-label]:not(:first-child)::before {
        content: attr(data-label);
        flex: 0 0 auto;
        color: var(--inv-muted);
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0.03em;
        text-align: left;
        text-transform: uppercase;
    }

    .inv-table td:first-child small {
        max-width: none;
    }

    .inv-table td.inv-empty {
        display: block;
        text-align: center;
    }

    .inv-table tbody tr:has(td.inv-empty) {
        padding: 0;
        border: 0;
        background: transparent;
    }

    .inv-row-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

@media (max-width: 650px) {
    .inventory-page {
        width: calc(100% - 22px);
        padding: 20px 0 55px;
    }

    .inv-header {
        align-items: stretch;
        border-radius: 20px;
    }

    .inv-header-art {
        display: none;
    }

    .inv-header-actions {
        width: 100%;
    }

    .inv-header-actions .inv-button {
        flex: 1;
    }

    .inv-stats {
        gap: 10px;
    }

    .inv-stat {
        padding: 16px;
        border-radius: 15px;
    }

    .inv-stat-top i {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .inv-stat > strong {
        font-size: 1.45rem;
    }

    .inv-tabs {
        width: 100%;
        justify-content: space-between;
    }

    .inv-tab {
        flex: 1;
        justify-content: center;
        padding: 10px 7px;
        gap: 5px;
        font-size: 0.74rem;
    }

    .inv-tab.is-active::after {
        display: none;
    }

    .inv-panel {
        border-radius: 15px;
    }

    .inv-panel-heading,
    .inv-toolbar {
        padding: 17px;
    }

    .inv-toolbar {
        align-items: stretch;
    }

    .inv-search,
    #inv-category-filter {
        flex: 1 1 100%;
        width: 100%;
    }

    .inv-form {
        padding: 20px;
    }
}

@media (max-width: 400px) {
    .inv-form-columns {
        grid-template-columns: 1fr;
    }

    .inv-tabs .ti {
        display: none;
    }
}

/* =============================================
   MOVIMIENTO REDUCIDO
============================================= */

@media (prefers-reduced-motion: reduce) {
    .inv-button,
    .inv-tab,
    .inv-stat,
    .inv-category-card,
    .inv-table tbody tr {
        transition: none;
    }

    .inv-panel:not([hidden]),
    .inv-dialog[open],
    .inv-toast:not([hidden]) {
        animation: none;
    }

    .inv-button:hover,
    .inv-stat:hover,
    .inv-category-card:hover {
        transform: none;
    }
}