:root {
    --dc-ink: #f7f8ff;
    --dc-muted: #a7b1cf;
    --dc-line: rgba(133, 151, 194, .24);
    --dc-bg: #061226;
    --dc-panel: rgba(18, 33, 61, .78);
    --dc-panel-2: rgba(13, 26, 50, .92);
    --dc-brand: #7c3aed;
    --dc-brand-2: #2563eb;
    --dc-accent: #19d3da;
    --dc-hot: #a855f7;
    --dc-success: #22e0b8;
    --dc-warning: #f59e0b;
    --dc-danger: #f43f5e;
}

* { letter-spacing: 0; }

body {
    background:
        radial-gradient(circle at 78% 6%, rgba(124, 58, 237, .24), transparent 28rem),
        radial-gradient(circle at 16% 18%, rgba(37, 99, 235, .16), transparent 24rem),
        linear-gradient(135deg, #051021, #071a34 48%, #061226);
    color: var(--dc-ink);
    font-size: 15px;
}

.app-shell {
    min-height: 100vh;
    align-items: flex-start;
}

.app-main {
    min-width: 0;
    min-height: 100vh;
}

.app-content {
    display: block;
    min-height: 0;
}

.sidebar {
    background: linear-gradient(180deg, rgba(4, 13, 31, .98), rgba(7, 19, 42, .95));
    color: #fff;
    border-right: 1px solid rgba(126, 151, 206, .18);
    box-shadow: 16px 0 48px rgba(0, 0, 0, .22);
}

.sidebar a,
.mobile-nav a {
    color: #dbe4ee;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .62rem .75rem;
    border-radius: 8px;
    min-height: 40px;
}

.sidebar a:hover,
.sidebar a.active,
.mobile-nav a.active {
    background: linear-gradient(135deg, #2563eb, #9333ea);
    color: #fff;
    box-shadow: 0 10px 28px rgba(124, 58, 237, .35);
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #a855f7);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    box-shadow: 0 0 24px rgba(168, 85, 247, .38);
}

.topbar {
    background: rgba(5, 16, 35, .78);
    backdrop-filter: blur(12px);
    border-color: var(--dc-line) !important;
}

.content-card,
.metric,
.catalog-card {
    background: var(--dc-panel);
    border: 1px solid var(--dc-line);
    border-radius: 14px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .18);
    backdrop-filter: blur(18px);
}

.metric {
    min-height: 112px;
    position: relative;
    overflow: hidden;
}

.metric::before,
.catalog-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255,255,255,.10), transparent 38%);
}

.metric-value {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700;
}

.chart-box {
    position: relative;
    min-height: 320px;
}

.chart-box-sm {
    min-height: 270px;
}

.btn-dark {
    background: linear-gradient(135deg, #2563eb, #9333ea);
    border-color: rgba(168, 85, 247, .55);
    box-shadow: 0 10px 24px rgba(124, 58, 237, .24);
}

.btn-dark:hover {
    background: linear-gradient(135deg, #1d4ed8, #7e22ce);
    border-color: rgba(168, 85, 247, .75);
}

.btn-outline-dark,
.btn-outline-secondary {
    color: #dbe6ff;
    border-color: rgba(145, 164, 208, .32);
    background: rgba(9, 22, 47, .42);
}

.btn-outline-dark:hover,
.btn-outline-secondary:hover {
    color: #fff;
    background: rgba(124, 58, 237, .32);
    border-color: rgba(168, 85, 247, .7);
}

.form-control,
.form-select {
    color: var(--dc-ink);
    background-color: rgba(5, 16, 35, .62);
    border-color: rgba(145, 164, 208, .28);
}

.form-control:focus,
.form-select:focus {
    color: #fff;
    background-color: rgba(8, 21, 46, .86);
    border-color: rgba(34, 211, 238, .7);
    box-shadow: 0 0 0 .2rem rgba(34, 211, 238, .12);
}

.form-control::placeholder { color: #7f8bad; }
.form-text,
.text-secondary { color: var(--dc-muted) !important; }

a.client-link {
    color: #f3f7ff;
    font-weight: 700;
    text-decoration: none;
}

a.client-link:hover {
    color: #7dd3fc;
    text-decoration: underline;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: #e8edff;
    --bs-table-border-color: rgba(145, 164, 208, .18);
    --bs-table-hover-bg: rgba(124, 58, 237, .12);
    color: #e8edff;
}

.table thead th {
    color: #f8fbff;
    font-weight: 700;
    background: rgba(8, 21, 46, .34);
}

.badge.text-bg-secondary {
    color: #dbe6ff !important;
    background: rgba(145, 164, 208, .28) !important;
}

.badge.text-bg-success {
    color: #052e2b !important;
    background: var(--dc-success) !important;
}

.badge.text-bg-warning {
    color: #281503 !important;
    background: var(--dc-warning) !important;
}

.badge.text-bg-danger {
    background: var(--dc-danger) !important;
}

.table td,
.table th { vertical-align: middle; }

.pagination {
    --bs-pagination-bg: rgba(9, 22, 47, .72);
    --bs-pagination-color: #dbe6ff;
    --bs-pagination-border-color: rgba(145, 164, 208, .3);
    --bs-pagination-hover-bg: rgba(124, 58, 237, .28);
    --bs-pagination-hover-color: #fff;
    --bs-pagination-active-bg: #7c3aed;
    --bs-pagination-active-border-color: #8b5cf6;
    --bs-pagination-disabled-bg: rgba(9, 22, 47, .38);
    --bs-pagination-disabled-color: rgba(219, 230, 255, .42);
    gap: .25rem;
}

.pagination .page-link {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    border-radius: 8px;
    min-width: 2.25rem;
    min-height: 2.25rem;
    overflow: hidden;
}

.pagination svg,
.pagination .page-link svg,
nav[role="navigation"] svg {
    display: inline-block;
    flex: 0 0 auto;
    width: 1rem !important;
    height: 1rem !important;
    max-width: 1rem !important;
    max-height: 1rem !important;
}

.modal-content {
    color: #edf4ff;
    background: #0f203d;
    border: 1px solid rgba(145, 164, 208, .38);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
}

.modal-header,
.modal-footer {
    border-color: rgba(145, 164, 208, .24);
}

.modal-backdrop.show {
    opacity: .48;
}

.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.table-tools {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    padding: .75rem;
    border-bottom: 1px solid var(--dc-line);
}

.table-tools .form-control {
    max-width: 320px;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable::after {
    content: " ↕";
    color: var(--dc-muted);
    font-size: .78rem;
}

th.sortable.sort-asc::after { content: " ↑"; color: #7dd3fc; }
th.sortable.sort-desc::after { content: " ↓"; color: #7dd3fc; }

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1rem;
}

.store-card {
    min-height: 100%;
}

.store-image-link {
    display: block;
}

.store-price {
    color: #7dd3fc;
    font-weight: 800;
    font-size: 1.25rem;
}

.product-hero-img {
    width: 100%;
    max-height: 540px;
    object-fit: contain;
    border-radius: 10px;
    background: rgba(5, 16, 35, .45);
    border: 1px solid var(--dc-line);
}

.catalog-card {
    overflow: hidden;
    position: relative;
}

.catalog-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #edf1f5;
}

.order-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--dc-line);
    display: block;
}

.print-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.thumb-placeholder {
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, rgba(37, 99, 235, .26), rgba(168, 85, 247, .24));
    color: var(--dc-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1020;
    background: rgba(5, 16, 35, .94);
    border-top: 1px solid var(--dc-line);
    box-shadow: 0 -8px 24px rgba(23, 32, 42, .08);
}

.bottom-nav a {
    color: var(--dc-muted);
    text-decoration: none;
    font-size: .78rem;
    padding: .45rem .25rem;
    text-align: center;
    flex: 1;
}

.bottom-nav a.active {
    color: #7dd3fc;
    font-weight: 700;
}

.statement-hero {
    background:
        radial-gradient(circle at 80% 20%, rgba(34, 211, 238, .18), transparent 18rem),
        linear-gradient(135deg, rgba(37, 99, 235, .86), rgba(147, 51, 234, .82));
    color: #fff;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,.18);
    box-shadow: 0 20px 54px rgba(37, 99, 235, .22);
}

.portal-action {
    min-height: 44px;
}

.icon-btn {
    min-width: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sale-lines {
    border: 1px solid var(--dc-line);
    border-radius: 8px;
    padding: .75rem;
    background: rgba(15, 23, 42, .25);
}

.checkout-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
}

.checkout-step {
    border: 1px solid var(--dc-line);
    background: rgba(15, 23, 42, .42);
    border-radius: 8px;
    padding: .75rem;
    color: var(--dc-muted);
    font-weight: 700;
    text-align: center;
}

.checkout-step.active,
.checkout-step.done {
    color: #fff;
    background: linear-gradient(135deg, rgba(37, 99, 235, .85), rgba(147, 51, 234, .72));
}

.checkout-item {
    display: flex;
    gap: .85rem;
    align-items: center;
    border-bottom: 1px solid var(--dc-line);
    padding-bottom: .85rem;
}

.checkout-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.checkout-thumb {
    width: 86px;
    height: 86px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--dc-line);
    flex: 0 0 86px;
}

.checkout-summary {
    position: sticky;
    top: 1rem;
}

.alert-icon {
    align-items: center;
    border-radius: 8px;
    display: inline-flex;
    height: 2.25rem;
    justify-content: center;
    width: 2.25rem;
}

.alert-icon-danger { background: rgba(244, 63, 94, .18); color: #fb7185; }
.alert-icon-warning { background: rgba(245, 158, 11, .18); color: #fbbf24; }
.alert-icon-info { background: rgba(14, 165, 233, .18); color: #38bdf8; }
.alert-icon-primary { background: rgba(99, 102, 241, .18); color: #818cf8; }
.alert-icon-secondary,
.alert-icon-muted { background: rgba(148, 163, 184, .16); color: #cbd5e1; }
.alert-icon-success { background: rgba(16, 185, 129, .18); color: #34d399; }

.ticket-grid {
    display: grid;
    gap: .5rem;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
}

.ticket-chip {
    border: 1px solid var(--dc-line);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    font-weight: 800;
    color: #edf4ff;
    background: rgba(15, 23, 42, .55);
}

.ticket-disponible { border-color: rgba(34, 224, 184, .6); color: #7fffe5; }
.ticket-apartado { border-color: rgba(245, 158, 11, .72); color: #fbbf24; }
.ticket-pagado { border-color: rgba(59, 130, 246, .72); color: #93c5fd; }
.ticket-cancelado { border-color: rgba(244, 63, 94, .7); color: #fb7185; opacity: .65; }

.raffle-wheel {
    align-items: center;
    background:
        radial-gradient(circle at center, rgba(139, 92, 246, .2), transparent 56%),
        rgba(15, 23, 42, .42);
    border: 1px solid var(--dc-line);
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: center;
    min-height: 180px;
    padding: 1rem;
}

.wheel-entry {
    background: linear-gradient(135deg, rgba(37, 99, 235, .28), rgba(147, 51, 234, .28));
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 999px;
    color: #f8fbff;
    font-weight: 700;
    padding: .5rem .75rem;
}

.public-draw-stage {
    align-items: stretch;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(240px, 1fr) minmax(220px, .55fr);
}

.draw-jar {
    min-height: 330px;
    position: relative;
}

.draw-jar-glass {
    background:
        radial-gradient(circle at 25% 20%, rgba(255, 255, 255, .2), transparent 20%),
        linear-gradient(145deg, rgba(37, 99, 235, .18), rgba(124, 58, 237, .12)),
        rgba(9, 22, 47, .72);
    border: 1px solid rgba(145, 164, 208, .35);
    border-radius: 44% 44% 36% 36% / 24% 24% 44% 44%;
    box-shadow: inset 0 0 42px rgba(255, 255, 255, .08), 0 22px 70px rgba(0, 0, 0, .28);
    height: 330px;
    overflow: hidden;
    position: relative;
}

.draw-jar-lip {
    background: linear-gradient(90deg, rgba(96, 165, 250, .4), rgba(168, 85, 247, .5));
    border: 1px solid rgba(219, 230, 255, .22);
    border-radius: 999px;
    height: 34px;
    left: 15%;
    position: absolute;
    right: 15%;
    top: -10px;
}

.draw-ball {
    align-items: center;
    animation: ballFloat 3.2s ease-in-out infinite;
    animation-delay: var(--d);
    background: radial-gradient(circle at 32% 24%, #fff, #c7d2fe 28%, #7c3aed 72%);
    border: 1px solid rgba(255, 255, 255, .65);
    border-radius: 999px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .25);
    color: #081225;
    display: inline-flex;
    font-size: .82rem;
    font-weight: 800;
    height: 52px;
    justify-content: center;
    left: var(--x);
    position: absolute;
    text-transform: uppercase;
    top: var(--y);
    transform: translate(-50%, -50%);
    width: 52px;
}

.public-draw-stage.is-spinning .draw-ball {
    animation: ballShake .32s linear infinite;
}

.public-draw-stage.is-spinning .draw-jar-glass::after {
    animation: chosenBall 1.55s ease-out forwards;
    background: radial-gradient(circle at 32% 24%, #fff, #fef3c7 30%, #f59e0b 75%);
    border: 1px solid rgba(255, 255, 255, .82);
    border-radius: 999px;
    box-shadow: 0 24px 70px rgba(245, 158, 11, .42);
    color: #081225;
    content: "?";
    display: grid;
    font-size: 2rem;
    font-weight: 900;
    height: 88px;
    left: 50%;
    place-items: center;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) scale(.4);
    width: 88px;
    z-index: 5;
}

.draw-empty {
    color: #aab8d4;
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
}

.draw-result {
    background: rgba(9, 22, 47, .72);
    border: 1px solid rgba(145, 164, 208, .32);
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 180px;
    padding: 1.25rem;
}

.draw-result strong {
    color: #fff;
    font-size: clamp(1.7rem, 4vw, 3.4rem);
    line-height: 1.05;
}

.draw-result span {
    color: #aab8d4;
}

.prize-thumb {
    aspect-ratio: 1;
    border: 1px solid rgba(145, 164, 208, .34);
    border-radius: 8px;
    height: 44px;
    object-fit: cover;
    width: 44px;
}

.prize-result-thumb {
    border: 1px solid rgba(145, 164, 208, .34);
    border-radius: 12px;
    height: 120px;
    margin-bottom: .85rem;
    object-fit: cover;
    width: 100%;
}

.compact-wheel-list {
    min-height: auto;
}

@keyframes ballFloat {
    0%, 100% { transform: translate(-50%, -50%) rotate(-4deg); }
    50% { transform: translate(calc(-50% + 8px), calc(-50% - 10px)) rotate(7deg); }
}

@keyframes ballShake {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    25% { transform: translate(calc(-50% + 18px), calc(-50% - 12px)) rotate(22deg); }
    50% { transform: translate(calc(-50% - 12px), calc(-50% + 16px)) rotate(-18deg); }
    75% { transform: translate(calc(-50% + 6px), calc(-50% + 8px)) rotate(14deg); }
    100% { transform: translate(-50%, -50%) rotate(0deg); }
}

@keyframes chosenBall {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(.25); }
    30% { opacity: 1; transform: translate(-50%, -80%) scale(.72); }
    70% { opacity: 1; transform: translate(-50%, -45%) scale(1.08); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 991.98px) {
    .public-draw-stage {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .draw-ball,
    .public-draw-stage.is-spinning .draw-ball,
    .public-draw-stage.is-spinning .draw-jar-glass::after {
        animation: none;
    }
}

.alert-list .list-group-item {
    background: transparent;
    border-color: var(--dc-line);
    color: var(--dc-text);
    padding-left: 0;
    padding-right: 0;
}

.alert-list .list-group-item-action:hover,
.alert-list .list-group-item-action:focus {
    background: rgba(99, 102, 241, .12);
    color: #fff;
}

.timeline {
    display: grid;
    gap: .85rem;
}

.timeline-item {
    display: grid;
    gap: .75rem;
    grid-template-columns: 2.25rem 1fr;
}

.timeline-dot {
    align-items: center;
    border: 1px solid var(--dc-line);
    border-radius: 8px;
    display: inline-flex;
    height: 2.25rem;
    justify-content: center;
    width: 2.25rem;
}

.timeline-body {
    border-bottom: 1px solid var(--dc-line);
    padding-bottom: .85rem;
}

.timeline-item:last-child .timeline-body {
    border-bottom: 0;
    padding-bottom: 0;
}

@media (min-width: 992px) {
    aside.sidebar {
        width: 270px;
        min-height: 100vh;
        max-height: 100vh;
        overflow-y: auto;
        position: sticky;
        top: 0;
        flex: 0 0 270px;
    }

    .offcanvas.sidebar {
        display: none !important;
        min-height: 0;
    }
}

@media (max-width: 991.98px) {
    body { padding-bottom: 62px; }
    .container-fluid { padding-left: .85rem; padding-right: .85rem; }
    .content-card { border-radius: 8px; }
    .table-responsive { border-radius: 8px; }
    .table { min-width: 720px; }
    .metric { min-height: auto; }
    .checkout-steps { grid-template-columns: 1fr; }
    .checkout-item { align-items: flex-start; }
    .checkout-thumb { width: 72px; height: 72px; flex-basis: 72px; }
    .checkout-summary { position: static; }
}

@media print {
    body {
        background: #fff;
        padding: 0;
        font-size: 12px;
    }

    .sidebar,
    .topbar,
    .bottom-nav,
    .print-actions,
    .btn,
    form {
        display: none !important;
    }

    .container-fluid {
        padding: 0 !important;
    }

    .content-card {
        box-shadow: none;
        border: 1px solid #d0d5dd;
        break-inside: avoid;
    }

    .table {
        min-width: 0 !important;
        width: 100% !important;
        table-layout: fixed;
    }

    .table th,
    .table td {
        white-space: normal;
        overflow-wrap: anywhere;
        padding: .35rem;
    }

    .order-thumb,
    .catalog-thumb,
    img {
        max-width: 72px !important;
        max-height: 72px !important;
        width: 72px !important;
        height: 72px !important;
        object-fit: cover !important;
    }
}

.white-space-pre-line {
    white-space: pre-line;
}
