:root {
    --brand: #f5b544;
    --brand-dark: #d2921a;
    --brand-ink: #14145c;
    --navy: #14145c;
    --navy-soft: #20207a;
    --navy-line: #2d2d85;
    --surface: #f4f6f9;
    --sidebar-width: 256px;

    --bs-primary: #14145c;
    --bs-primary-rgb: 20, 20, 92;
    --bs-link-color: #0b5ed7;
    --bs-link-color-rgb: 11, 94, 215;
    --bs-body-color: #1c2430;
    --bs-border-radius: .5rem;
    --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background: var(--surface);
}

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-color: var(--brand-ink);
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-hover-color: var(--brand-ink);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-active-color: var(--brand-ink);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-disabled-color: var(--brand-ink);
    --bs-btn-focus-shadow-rgb: 245, 181, 68;
    font-weight: 600;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--brand-dark);
    box-shadow: 0 0 0 .2rem rgba(245, 181, 68, .25);
}

.form-check-input:checked {
    background-color: var(--navy);
    border-color: var(--navy);
}

.card {
    border-color: #e3e8ef;
}

.table > thead > tr > th {
    background: #f8fafc;
    color: #5b6675;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* --- Marca --- */
.brand-mark {
    align-items: center;
    color: #fff;
    display: inline-flex;
    font-weight: 700;
    gap: .6rem;
    min-width: 0;
    text-decoration: none;
}

.brand-mark:hover {
    color: #fff;
}

.brand-bolt {
    align-items: center;
    background: #fff;
    border-radius: .5rem;
    color: var(--brand-ink);
    display: inline-flex;
    flex-shrink: 0;
    height: 2.5rem;
    justify-content: center;
    width: 2.5rem;
}

.brand-mark-lg {
    color: var(--navy);
    font-size: 1.25rem;
}

.brand-mark-lg:hover {
    color: var(--navy);
}

/* --- Estados vacíos --- */
.empty-state {
    color: #6b7686;
    padding: 2.5rem 1rem;
    text-align: center;
}

.empty-state > .bi {
    color: #b3bcc8;
    display: block;
    font-size: 2rem;
    margin-bottom: .5rem;
}

/* --- Ingreso y errores --- */
.auth-body {
    background: linear-gradient(160deg, #eef1f6 0%, #e3e8f0 100%);
    min-height: 100vh;
}

.auth-wrap {
    align-items: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.auth-card {
    max-width: 400px;
    width: 100%;
}

.error-card {
    margin-top: 8vh;
    max-width: 520px;
}

.error-code {
    color: var(--brand-dark);
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: .75rem;
}

/* --- Panel de administración --- */
.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    --bs-offcanvas-bg: var(--navy);
    --bs-offcanvas-width: var(--sidebar-width);
    background: var(--navy);
    color: #d3d6ee;
}

.admin-sidebar .sidebar-head {
    align-items: center;
    border-bottom: 1px solid var(--navy-line);
    display: flex;
    gap: .5rem;
    justify-content: space-between;
    padding: 1rem;
}

.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: .5rem .75rem;
}

.sidebar-section {
    color: #9a9fd0;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    padding: 1rem .75rem .35rem;
    text-transform: uppercase;
}

.sidebar-link {
    align-items: center;
    border-radius: .5rem;
    color: #d3d6ee;
    display: flex;
    gap: .7rem;
    margin-bottom: 2px;
    padding: .6rem .75rem;
    text-decoration: none;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
    background: var(--navy-soft);
    color: #fff;
}

.sidebar-link.active {
    background: var(--brand);
    color: var(--brand-ink);
    font-weight: 600;
}

.sidebar-foot {
    border-top: 1px solid var(--navy-line);
    padding: .75rem;
}

@media (min-width: 992px) {
    .admin-sidebar {
        background: var(--navy) !important;
        display: flex;
        flex: 0 0 var(--sidebar-width);
        flex-direction: column;
        height: 100vh;
        position: sticky;
        top: 0;
    }
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        display: flex;
        flex-direction: column;
    }
}

.admin-main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    align-items: center;
    background: #fff;
    border-bottom: 1px solid #e3e8ef;
    display: flex;
    gap: .75rem;
    padding: .75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.admin-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    min-width: 0;
}

.user-name {
    max-width: 180px;
}

.admin-content {
    padding: 1rem;
}

@media (min-width: 768px) {
    .admin-topbar {
        padding: .85rem 1.5rem;
    }

    .admin-content {
        padding: 1.5rem;
    }
}

.page-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.form-narrow {
    max-width: 720px;
}

.stat-label {
    color: #5b6675;
    font-size: .85rem;
}

.stat-value {
    font-size: 1.5rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    line-height: 1.2;
    margin: .35rem 0 .15rem;
    overflow-wrap: anywhere;
}

.stat-note {
    color: #6b7686;
    font-size: .8rem;
}

.permission-group {
    border: 1px solid #e3e8ef;
    border-radius: .5rem;
    padding: .75rem 1rem 1rem;
}

.permission-group legend {
    float: none;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .04em;
    margin-bottom: .25rem;
    padding: 0 .35rem;
    text-transform: uppercase;
    width: auto;
}

/* --- Tienda pública --- */
.store-body {
    background: #fff;
}

.store-header {
    background: var(--navy);
}

.store-header .navbar {
    padding-bottom: .85rem;
    padding-top: .85rem;
}

.store-hero {
    background: linear-gradient(135deg, var(--navy) 0%, #26268a 100%);
    color: #fff;
    padding: 3.5rem 0;
}

.hero-kicker {
    background: rgba(245, 181, 68, .15);
    border: 1px solid rgba(245, 181, 68, .4);
    border-radius: 2rem;
    color: var(--brand);
    display: inline-block;
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding: .25rem .8rem;
}

.hero-title {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1rem;
    text-wrap: balance;
}

.hero-text {
    color: #d3d6ee;
    font-size: 1.1rem;
    max-width: 38rem;
}

.hero-logo {
    align-items: center;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 10px rgba(255, 255, 255, .12);
    display: inline-flex;
    height: 300px;
    justify-content: center;
    width: 300px;
}

.auth-logo img {
    display: block;
    height: auto;
}

.footer-link {
    color: inherit;
}

.footer-link:hover {
    color: #fff;
}

.category-card .card-body {
    align-items: center;
    display: flex;
    font-weight: 600;
    gap: .6rem;
}

.category-card .bi {
    color: var(--brand-dark);
}

.feature-item {
    align-items: center;
    background: var(--surface);
    border-radius: .75rem;
    display: flex;
    gap: 1rem;
    height: 100%;
    padding: 1.1rem 1.25rem;
}

.feature-item > .bi {
    color: var(--brand-dark);
    font-size: 1.75rem;
}

.feature-item strong,
.feature-item span {
    display: block;
}

.feature-item span {
    color: #5b6675;
    font-size: .9rem;
}

.store-footer {
    background: var(--navy);
    color: #d3d6ee;
    padding: 2.5rem 0 1.25rem;
}

.store-footer li {
    margin-bottom: .35rem;
}

.footer-title {
    color: #fff;
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .06em;
    margin-bottom: .75rem;
    text-transform: uppercase;
}

.footer-bottom {
    border-top: 1px solid var(--navy-line);
    color: #9a9fd0;
    display: flex;
    flex-wrap: wrap;
    font-size: .8rem;
    gap: .5rem;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1rem;
}

/* --- Catálogo (panel) --- */
.tree-child {
    padding-left: 1.5rem;
    position: relative;
}

.tree-child::before {
    color: #9aa4b2;
    content: "└";
    left: .35rem;
    position: absolute;
}

.tree-child-note {
    padding-left: 1.5rem;
}

.min-w-0 {
    min-width: 0;
}

.product-thumb {
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: .4rem;
    flex-shrink: 0;
    height: 48px;
    object-fit: contain;
    width: 48px;
}

.product-thumb-empty {
    align-items: center;
    color: #b3bcc8;
    display: inline-flex;
    justify-content: center;
}

.form-actions {
    background: var(--surface);
    border-top: 1px solid #e3e8ef;
    bottom: 0;
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
    margin: 0 -1rem;
    padding: .75rem 1rem;
    position: sticky;
    z-index: 5;
}

@media (min-width: 768px) {
    .form-actions {
        margin: 0 -1.5rem;
        padding: .75rem 1.5rem;
    }
}

.image-tile {
    border: 1px solid #e3e8ef;
    border-radius: .5rem;
    padding: .5rem;
    position: relative;
}

.image-tile.is-primary {
    border-color: var(--brand-dark);
    box-shadow: 0 0 0 1px var(--brand-dark);
}

.image-tile img {
    aspect-ratio: 1;
    background: #fff;
    border-radius: .35rem;
    display: block;
    margin-bottom: .5rem;
    object-fit: contain;
    width: 100%;
}

.image-tile-badge {
    left: .9rem;
    position: absolute;
    top: .9rem;
}

.variants-table {
    min-width: 760px;
}

.variants-table td:nth-child(4),
.variants-table td:nth-child(5) {
    width: 6.5rem;
}

.table .btn {
    white-space: nowrap;
}

/* --- Marcas en la portada --- */
.brands-band {
    background: var(--surface);
    overflow: hidden;
    padding: 3.5rem 0;
}

.section-kicker {
    color: var(--brand-dark);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.brands-title {
    color: var(--navy);
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 800;
    margin: .25rem 0 2rem;
    text-wrap: balance;
}

.brand-marquee {
    display: flex;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    overflow: hidden;
}

.brand-track {
    animation: brand-scroll 45s linear infinite;
    display: flex;
    flex-shrink: 0;
    gap: 1rem;
    margin: 0;
    padding: .5rem 1rem .5rem 0;
}

.brand-marquee:hover .brand-track {
    animation-play-state: paused;
}

@keyframes brand-scroll {
    to {
        transform: translateX(-100%);
    }
}

.brand-logo {
    align-items: center;
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: .75rem;
    display: flex;
    flex-shrink: 0;
    height: 5.5rem;
    justify-content: center;
    padding: 1rem 1.5rem;
    width: 11.5rem;
}

.brand-logo img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.brands-more {
    background: linear-gradient(90deg, var(--navy) 0%, #3a3ab8 45%, var(--brand-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: clamp(2.25rem, 7vw, 4.25rem);
    font-style: italic;
    font-weight: 900;
    letter-spacing: -.02em;
    line-height: 1.1;
    margin: 2rem 0 .5rem;
}

.brands-more-note {
    color: #5b6675;
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    .brand-marquee {
        -webkit-mask-image: none;
        mask-image: none;
        overflow-x: auto;
    }

    .brand-track {
        animation: none;
    }

    .brand-track[aria-hidden="true"] {
        display: none;
    }
}

/* --- Productos en la tienda --- */
.product-card {
    color: inherit;
    overflow: hidden;
    text-decoration: none;
    transition: box-shadow .15s ease, transform .15s ease;
}

.product-card:hover,
.product-card:focus-visible {
    box-shadow: 0 .5rem 1.25rem rgba(20, 20, 92, .12);
    color: inherit;
    transform: translateY(-2px);
}

.product-card-photo {
    align-items: center;
    aspect-ratio: 1;
    background: #fff;
    border-bottom: 1px solid #eef1f5;
    color: #c5ccd6;
    display: flex;
    font-size: 2.5rem;
    justify-content: center;
    position: relative;
}

.product-card-photo img {
    height: 100%;
    object-fit: contain;
    padding: .5rem;
    width: 100%;
}

.product-card-badge {
    left: .6rem;
    position: absolute;
    top: .6rem;
}

.product-brand {
    color: var(--brand-dark);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.product-card-name {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: .35rem;
}

.product-card-price {
    color: var(--navy);
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.product-price-old {
    color: #7a8494;
    text-decoration: line-through;
}

.product-photo {
    align-items: center;
    aspect-ratio: 1;
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: .75rem;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.product-photo img {
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.product-photo-empty {
    color: #c5ccd6;
    font-size: 4rem;
}

.product-gallery {
    display: grid;
    gap: .5rem;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    margin: .75rem 0 0;
}

.product-gallery img {
    aspect-ratio: 1;
    border: 1px solid #e3e8ef;
    border-radius: .5rem;
    object-fit: contain;
    width: 100%;
}

.product-title {
    color: var(--navy);
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 800;
    margin: .25rem 0 .5rem;
    text-wrap: balance;
}

.product-price-block {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: .75rem;
}

.product-price {
    color: var(--navy);
    font-size: 2rem;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.product-contact {
    align-items: center;
    background: var(--surface);
    border-radius: .75rem;
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
}

.product-contact > .bi {
    color: var(--brand-dark);
    font-size: 1.5rem;
}

.product-contact strong,
.product-contact span {
    display: block;
}

.product-description {
    overflow-wrap: anywhere;
}

/* --- Panel: publicar producto --- */
.publish-panel {
    align-items: center;
    background: #fff8e6;
    border: 1px solid #f0d28a;
    border-radius: .6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
}

.publish-panel.is-published {
    background: #eef8f1;
    border-color: #b9dfc5;
}

.publish-checklist {
    margin-top: .35rem;
}

.publish-checklist .is-ok .bi {
    color: #198754;
}

.publish-checklist .is-missing {
    color: #b02a37;
    font-weight: 600;
}

.publish-checklist .is-warning .bi {
    color: #b7791f;
}

.product-edit {
    position: absolute;
    right: 1.1rem;
    top: .6rem;
    z-index: 2;
}

/* --- Tienda: buscador, carrito y cuenta en el encabezado --- */
.store-search {
    display: flex;
    flex: 1 1 auto;
    gap: .4rem;
    max-width: 30rem;
}

.cart-link {
    align-items: center;
    border-radius: .5rem;
    color: #fff;
    display: inline-flex;
    font-size: 1.35rem;
    height: 2.5rem;
    justify-content: center;
    position: relative;
    text-decoration: none;
    width: 2.75rem;
}

.cart-link:hover,
.cart-link:focus-visible {
    background: var(--navy-soft);
    color: var(--brand);
}

.cart-count {
    background: var(--brand);
    border-radius: 999px;
    color: var(--brand-ink);
    font-size: .7rem;
    font-weight: 800;
    line-height: 1;
    min-width: 1.2rem;
    padding: .2rem .3rem;
    position: absolute;
    right: 0;
    text-align: center;
    top: .1rem;
}

.hero-search {
    display: flex;
    gap: .5rem;
    max-width: 32rem;
}

/* --- Catálogo: filtros --- */
.filter-block {
    margin-bottom: 1.25rem;
}

.filter-title {
    color: #5b6675;
    display: block;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .04em;
    margin-bottom: .5rem;
    text-transform: uppercase;
}

.filter-list a {
    border-radius: .375rem;
    color: inherit;
    display: block;
    padding: .3rem .5rem;
    text-decoration: none;
}

.filter-list a:hover {
    background: var(--surface);
}

.filter-list a.active {
    background: var(--navy);
    color: #fff;
    font-weight: 600;
}

.filter-sublist {
    border-left: 2px solid #e3e8ef;
    margin: .25rem 0 .25rem .75rem;
    padding-left: .5rem;
}

/* --- Ficha: compra y compartir --- */
.buy-box {
    background: var(--surface);
    border-radius: .75rem;
    margin-top: 1rem;
    padding: 1rem;
}

.quantity-input {
    text-align: center;
    width: 5.5rem;
}

.share-box {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: 1rem;
}

/* --- Carrito y checkout --- */
.cart-line {
    align-items: center;
    display: grid;
    gap: .75rem;
    grid-template-columns: 4rem minmax(0, 1fr) auto auto auto;
    padding-bottom: .85rem;
    padding-top: .85rem;
}

.cart-line-photo {
    align-items: center;
    aspect-ratio: 1;
    background: #fff;
    border: 1px solid #eef1f5;
    border-radius: .5rem;
    color: #c5ccd6;
    display: flex;
    font-size: 1.5rem;
    justify-content: center;
    overflow: hidden;
}

.cart-line-photo img {
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.cart-line-quantity {
    align-items: center;
    display: flex;
    gap: .35rem;
}

.cart-line-total {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    min-width: 6.5rem;
    text-align: right;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .cart-line {
        grid-template-columns: 3.5rem minmax(0, 1fr) auto;
    }

    .cart-line-quantity {
        grid-column: 2;
    }

    .cart-line-total {
        min-width: 0;
    }
}

.summary-card {
    position: sticky;
    top: 1rem;
}

.summary-list {
    display: grid;
    gap: .35rem .75rem;
    grid-template-columns: 1fr auto;
}

.summary-list dt {
    font-weight: 400;
}

.summary-list dd {
    font-variant-numeric: tabular-nums;
    margin: 0;
    text-align: right;
}

.summary-list .summary-total {
    border-top: 1px solid #e3e8ef;
    font-size: 1.2rem;
    font-weight: 800;
    margin-top: .35rem;
    padding-top: .6rem;
}

.summary-items li {
    display: flex;
    font-size: .9rem;
    gap: .75rem;
    justify-content: space-between;
    margin-bottom: .35rem;
}

.checkout-steps {
    color: #7a8494;
    display: flex;
    flex-wrap: wrap;
    font-size: .9rem;
    gap: .5rem 1.25rem;
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    counter-reset: step;
}

.checkout-steps li {
    counter-increment: step;
}

.checkout-steps li::before {
    content: counter(step) ". ";
}

.checkout-steps .current {
    color: var(--navy);
    font-weight: 700;
}

.checkout-steps a {
    color: inherit;
}

/* --- Seguimiento del pedido --- */
.order-progress {
    display: grid;
    gap: .5rem;
    grid-template-columns: repeat(5, 1fr);
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
}

.order-progress li {
    border-top: 4px solid #e3e8ef;
    color: #7a8494;
    font-size: .8rem;
    padding-top: .4rem;
}

.order-progress .done {
    border-color: var(--brand);
    color: var(--bs-body-color);
}

.order-progress .current {
    border-color: var(--navy);
    color: var(--navy);
    font-weight: 700;
}

/* --- Hoja de impresión del pedido --- */
.print-sheet {
    margin: 0 auto;
    max-width: 800px;
}

@media print {
    .auth-body {
        background: #fff;
    }

    .print-sheet {
        border: 0;
        max-width: none;
    }
}
