/* ============================================================
   Kermesse POS — Design System v3
   Mobile-first, themed, accessible.
   Convención: mobile base + min-width media queries.
   ============================================================ */

/* ---------- 1. RESET ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

img, svg, video, canvas {
    display: block;
    max-width: 100%;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

input, select, textarea {
    font: inherit;
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

[hidden] {
    display: none !important;
}

/* ---------- 2. DESIGN TOKENS (no temáticos) ---------- */
:root {
    /* Spacing scale (4px base) */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Typography */
    --font-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-display: 'Fredoka', 'Fredoka One', var(--font-base);
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --weight-regular: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;
    --leading-tight: 1.2;
    --leading-normal: 1.5;
    --leading-relaxed: 1.65;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-2xl: 28px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06), 0 1px 1px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.05);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
    --shadow-xl: 0 24px 64px rgba(0,0,0,0.16), 0 8px 16px rgba(0,0,0,0.08);

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur-fast: 150ms;
    --dur-base: 250ms;
    --dur-slow: 400ms;

    /* z-index scale */
    --z-base: 1;
    --z-sticky: 10;
    --z-dropdown: 100;
    --z-overlay: 200;
    --z-modal: 1000;
    --z-toast: 2000;

    /* Layout */
    --max-content: 1280px;
    --header-h: 200px;
    --nav-h: 56px;

    /* Status colors (no temáticos) */
    --color-success: #2f9e44;
    --color-warning: #e8590c;
    --color-danger: #d6336c;
    --color-info: #1971c2;
    --color-border: #e9ecef;
    --color-border-strong: #ced4da;
    --color-text-muted: #495057;
    --color-text-soft: #868e96;
}

/* Tokens temáticos por defecto (ThemeApplier los sobrescribe) */
:root {
    --color-primary: #1ABC9C;
    --color-primary-dark: #16a085;
    --color-primary-light: #6cdbc1;
    --color-primary-soft: rgba(26, 188, 156, 0.12);
    --color-secondary: #FF6B6B;
    --color-secondary-dark: #cc5555;
    --color-secondary-soft: rgba(255, 107, 107, 0.12);
    --color-accent: #E9C46A;
    --color-accent-dark: #be9b4a;
    --color-accent-soft: rgba(233, 196, 106, 0.18);
    --color-bg: #f5f7fa;
    --color-surface: #ffffff;
    --color-text: #1a202c;

    --banner-image: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    --banner-overlay: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.45) 100%);
    --pattern-image: none;
}

/* Desktop layout tokens */
@media (min-width: 769px) {
    :root {
        --header-h: 240px;
        --nav-h: 64px;
    }
}

/* ---------- 3. BASE ---------- */
html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-base);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: var(--pattern-image);
    background-size: 240px 240px;
    background-repeat: repeat;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    line-height: var(--leading-tight);
}

/* ---------- 4. LAYOUT: APP SHELL ---------- */
.app-container {
    position: relative;
    z-index: var(--z-base);
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- 5. HEADER (banner + content overlay) ----------
   No usamos isolation: isolate aquí porque el dropdown del event switcher
   (descendiente del header) necesita poder pintar por encima del nav y del
   contenido, no quedarse encerrado en el stacking context del header. */
.app-header {
    position: relative;
    min-height: var(--header-h);
    color: white;
    overflow: visible;
    z-index: var(--z-dropdown);
}

.app-header-banner {
    position: absolute;
    inset: 0;
    background-image: var(--banner-image);
    background-size: cover;
    background-position: center;
    z-index: 0;
    transition: background-image var(--dur-slow) var(--ease-out);
}

.app-header-overlay {
    position: absolute;
    inset: 0;
    background: var(--banner-overlay);
    z-index: 1;
    pointer-events: none;
}

.app-header-content {
    position: relative;
    z-index: 2;
    max-width: var(--max-content);
    margin: 0 auto;
    padding: var(--space-4);
    min-height: var(--header-h);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-3);
}

@media (min-width: 769px) {
    .app-header-content {
        padding: var(--space-6);
    }
}

/* Event Switcher (botón con título dentro del header) */
.event-switcher {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: white;
    padding: var(--space-2) var(--space-3);
    margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-3));
    border-radius: var(--radius-lg);
    transition: background var(--dur-fast);
    text-align: left;
    min-width: 0;
    flex: 1;
    -webkit-tap-highlight-color: transparent;
}

.event-switcher:hover,
.event-switcher:focus-visible,
.event-switcher.open {
    background: rgba(255, 255, 255, 0.14);
    outline: none;
}

.event-switcher .logo {
    font-size: 2.5rem;
    line-height: 1;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.35));
    flex-shrink: 0;
}

.event-switcher .title-section {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.event-switcher .app-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    text-shadow: 0 2px 12px rgba(0,0,0,0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-switcher .event-subtitle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}

.event-switcher .subtitle-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.switcher-chevron {
    font-size: 0.65rem;
    opacity: 0.85;
    transition: transform var(--dur-fast);
}

.event-switcher.open .switcher-chevron {
    transform: rotate(180deg);
}

/* Read-only: para users no-super. El switcher se ve como display sólo
   (sin chevron, sin hover effect, sin pointer cursor). El super admin
   sigue teniendo el dropdown activo. */
.event-switcher.switcher-readonly {
    cursor: default;
    pointer-events: none;
}

.event-switcher.switcher-readonly .switcher-chevron {
    display: none;
}

.event-switcher.switcher-readonly:hover,
.event-switcher.switcher-readonly:focus-visible {
    background: transparent;
}

@media (min-width: 769px) {
    .event-switcher .logo {
        font-size: 3rem;
    }

    .event-switcher .app-title {
        font-size: var(--text-3xl);
    }

    .event-switcher .event-subtitle {
        font-size: var(--text-base);
    }
}

/* Header actions (user info, login) */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

#userInfo .user-info {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.user-info-username {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: white;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    background: rgba(0, 0, 0, 0.28);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    backdrop-filter: blur(6px);
}

@media (max-width: 600px) {
    .user-info-username {
        display: none;
    }

    .header-actions .btn-label {
        display: none;
    }

    .header-actions .btn-sm {
        padding: var(--space-2);
        min-width: 38px;
        min-height: 38px;
    }
}

/* ---------- 6. EVENT DROPDOWN ---------- */
.event-dropdown {
    position: absolute;
    top: 100%;
    left: var(--space-3);
    right: var(--space-3);
    margin-top: var(--space-2);
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--color-border);
    z-index: calc(var(--z-dropdown) + 1);
    overflow: hidden;
    animation: dropdownIn var(--dur-base) var(--ease-out);
    color: var(--color-text);
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.event-dropdown-header {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-text-soft);
    border-bottom: 1px solid var(--color-border);
}

.event-dropdown-list {
    max-height: 50vh;
    overflow-y: auto;
}

.event-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    text-align: left;
    transition: background var(--dur-fast);
    border-bottom: 1px solid var(--color-border);
}

.event-item:last-child {
    border-bottom: none;
}

.event-item:hover,
.event-item:focus-visible {
    background: var(--color-primary-soft);
    outline: none;
}

.event-item.active {
    background: var(--color-primary-soft);
}

.event-item-emoji {
    font-size: 1.75rem;
    line-height: 1;
    flex-shrink: 0;
    width: 2.5rem;
    text-align: center;
}

.event-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.event-item-name {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-item-theme {
    font-size: var(--text-xs);
    color: var(--color-text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-item-check {
    color: var(--color-primary);
    font-size: 1rem;
    flex-shrink: 0;
}

.event-manage {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-4);
    background: var(--color-primary-soft);
    border-top: 1px solid var(--color-border);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-primary-dark);
    transition: background var(--dur-fast);
}

.event-manage:hover {
    background: var(--color-primary);
    color: white;
}

.event-empty {
    padding: var(--space-6);
    text-align: center;
    color: var(--color-text-soft);
    font-size: var(--text-sm);
}

@media (min-width: 769px) {
    .event-dropdown {
        left: var(--space-6);
        right: auto;
        min-width: 360px;
        max-width: 440px;
    }
}

/* ---------- 7. NAV TABS ---------- */
.tab-navigation {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.tab-navigation::-webkit-scrollbar { display: none; }

.tab-btn {
    flex: 1 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-2);
    color: var(--color-text-soft);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    position: relative;
    min-width: 64px;
    transition: color var(--dur-fast);
    white-space: nowrap;
}

.tab-btn i {
    font-size: 1.1rem;
}

.tab-btn span {
    display: none;
}

.tab-btn:hover {
    color: var(--color-text);
}

.tab-btn.active {
    color: var(--color-primary-dark);
    font-weight: var(--weight-semibold);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 25%;
    right: 25%;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--color-primary);
}

.tab-indicator { display: none; }

@media (min-width: 600px) {
    .tab-btn span {
        display: inline;
    }
}

@media (min-width: 769px) {
    .tab-navigation {
        padding: 0 var(--space-6);
        gap: var(--space-1);
        max-width: var(--max-content);
        margin: 0 auto;
        width: 100%;
    }

    .tab-btn {
        flex: 0 0 auto;
        padding: var(--space-4) var(--space-5);
    }
}

/* ---------- 8. MAIN / TAB PANELS ---------- */
.tab-content {
    position: relative;
    z-index: var(--z-base);
}

.tab-panel {
    display: none;
    max-width: var(--max-content);
    margin: 0 auto;
    padding: var(--space-4);
    animation: fadeUp var(--dur-base) var(--ease-out);
}

.tab-panel.active {
    display: block;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (min-width: 769px) {
    .tab-panel {
        padding: var(--space-6);
    }
}

.section-header {
    margin-bottom: var(--space-5);
}

.section-header h2 {
    font-size: var(--text-2xl);
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
}

.section-header p {
    color: var(--color-text-soft);
    font-size: var(--text-sm);
}

/* ---------- 9. BUTTONS ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    line-height: 1.2;
    transition: all var(--dur-fast) var(--ease-out);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    border: 1px solid transparent;
    min-height: 44px;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border-strong);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-bg);
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}

.btn-warning {
    background: var(--color-warning);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    filter: brightness(0.92);
}

.btn-info {
    background: var(--color-info);
    color: white;
}

.btn-info:hover:not(:disabled) {
    filter: brightness(0.92);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
    border: none;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--color-bg);
    color: var(--color-text);
}

.btn-danger-ghost {
    background: transparent;
    color: var(--color-text-muted);
    border: none;
}

.btn-danger-ghost:hover:not(:disabled) {
    background: rgba(214, 51, 108, 0.1);
    color: var(--color-danger);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    min-height: 36px;
}

.btn-large {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-base);
    min-height: 52px;
    width: 100%;
}

.btn-icon {
    padding: 0;
    width: 40px;
    min-height: 40px;
}

.btn-icon.btn-sm {
    width: 32px;
    min-height: 32px;
}

.btn-add {
    background: var(--color-primary);
    color: white;
}

/* Pulse en confirmar */
.pulse-btn {
    position: relative;
    overflow: hidden;
}

.pulse-btn:not(:disabled)::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.4), transparent 70%);
    opacity: 0;
    transition: opacity var(--dur-base);
}

.pulse-btn:hover:not(:disabled)::before {
    opacity: 1;
}

/* ---------- 10. ORDER SECTION (pedidos) ---------- */
.order-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

@media (min-width: 1024px) {
    .order-section {
        display: grid;
        grid-template-columns: 1fr 380px;
        gap: var(--space-6);
        align-items: start;
    }
}

/* Products section */
.products-section {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.products-header h3 {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
}

.products-count {
    font-size: var(--text-xs);
    color: var(--color-text-soft);
    background: var(--color-bg);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
}

.products-grid {
    padding: var(--space-3);
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
}

@media (min-width: 600px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: var(--space-4);
        gap: var(--space-4);
    }
}

/* Product card estilo "ticket" */
.product-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition: all var(--dur-base) var(--ease-out);
}

.product-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12%;
    bottom: 12%;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--color-primary);
    opacity: 0;
    transition: opacity var(--dur-fast);
}

.product-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.product-card:hover::before {
    opacity: 1;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    line-height: var(--leading-tight);
    margin-bottom: 2px;
}

.product-price {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    color: var(--color-primary-dark);
}

.product-controls,
.quantity-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.qty-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: var(--color-surface);
    border: 1.5px solid var(--color-border-strong);
    color: var(--color-text);
    font-size: var(--text-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--dur-fast);
}

.qty-btn:hover:not(:disabled) {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.qty-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.qty-btn[data-action="add"] {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.qty-btn[data-action="add"]:hover:not(:disabled) {
    background: var(--color-primary-dark);
    transform: scale(1.06);
}

.quantity {
    min-width: 28px;
    text-align: center;
    font-size: var(--text-base);
    font-weight: var(--weight-bold);
    font-variant-numeric: tabular-nums;
}

/* ---------- 11. CART / ORDER SUMMARY ---------- */
.order-summary {
    /* mobile: flow normal */
}

@media (min-width: 1024px) {
    .order-summary {
        position: sticky;
        top: calc(var(--header-h) + var(--nav-h) + var(--space-6));
        z-index: var(--z-sticky);
    }
}

.cart {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (min-width: 1024px) {
    .cart {
        box-shadow: var(--shadow-lg);
    }
}

.cart-header {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    padding: var(--space-3) var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h3 {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.cart-count {
    font-size: var(--text-xs);
    background: rgba(255,255,255,0.25);
    padding: 2px var(--space-3);
    border-radius: var(--radius-full);
    backdrop-filter: blur(6px);
}

.cart-items {
    max-height: 240px;
    overflow-y: auto;
    padding: var(--space-2) var(--space-3);
}

@media (min-width: 1024px) {
    .cart-items {
        max-height: 400px;
    }
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) 0;
    border-bottom: 1px dashed var(--color-border);
    gap: var(--space-3);
}

.cart-item:last-child {
    border-bottom: none;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-weight: var(--weight-semibold);
    font-size: var(--text-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-details {
    color: var(--color-text-soft);
    font-size: var(--text-xs);
}

.item-total {
    font-weight: var(--weight-bold);
    font-family: var(--font-display);
    color: var(--color-primary-dark);
}

.empty-cart {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    color: var(--color-text-soft);
}

.empty-cart i {
    font-size: 2rem;
    margin-bottom: var(--space-3);
    color: var(--color-border-strong);
    display: block;
}

.empty-cart p {
    font-size: var(--text-sm);
}

.cart-footer {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

.payment-method-section {
    margin-bottom: var(--space-3);
}

.payment-method-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-muted);
    margin-bottom: var(--space-2);
}

.payment-method-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
}

.payment-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-3) var(--space-2);
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--color-text-muted);
    transition: all var(--dur-fast);
}

.payment-btn i {
    font-size: var(--text-lg);
}

.payment-btn:hover {
    border-color: var(--color-primary-light);
    color: var(--color-primary-dark);
}

.payment-btn.selected {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: var(--space-3) 0;
    padding: var(--space-3) 0;
    border-top: 2px solid var(--color-border);
}

.cart-total span:first-child {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
}

.total-amount {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--color-primary-dark);
}

/* ---------- 12. PRODUCTOS TAB ---------- */
.products-admin {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.admin-title h3 {
    font-size: var(--text-lg);
}

.products-stats {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-1);
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-soft);
}

.products-table-container {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.products-table {
    display: flex;
    flex-direction: column;
}

/* Filas de la tabla (renderizadas por ProductView) */
.products-table > div,
.product-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    transition: background var(--dur-fast);
}

.products-table > div:last-child,
.product-row:last-child {
    border-bottom: none;
}

.products-table > div:hover {
    background: var(--color-primary-soft);
}

/* ---------- 13. SUMMARY (resumen) ---------- */
.summary-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.summary-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
}

@media (min-width: 600px) {
    .summary-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-4);
    }
}

.summary-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: var(--space-3);
    align-items: center;
    border: 1px solid var(--color-border);
    transition: all var(--dur-base);
}

.summary-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
    font-size: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.orders-card .card-icon {
    background: var(--color-secondary-soft);
    color: var(--color-secondary-dark);
}

.product-card .card-icon {
    background: var(--color-accent-soft);
    color: var(--color-accent-dark);
}

.card-content {
    flex: 1;
    min-width: 0;
}

.card-content h3 {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-soft);
    margin-bottom: var(--space-1);
    font-family: var(--font-base);
    font-weight: var(--weight-semibold);
}

.summary-value {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--color-text);
}

.summary-value.top-product {
    font-size: var(--text-base);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-trend {
    font-size: var(--text-xs);
    color: var(--color-text-soft);
    margin-top: var(--space-1);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

/* Chart section */
.chart-section {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
    gap: var(--space-2);
}

.chart-header h3 {
    font-size: var(--text-lg);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.chart-info {
    font-size: var(--text-xs);
    color: var(--color-text-soft);
}

.chart-container {
    position: relative;
    height: 260px;
    width: 100%;
}

/* User stats */
.user-stats-section {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.user-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
    gap: var(--space-2);
}

.user-stats-header h3 {
    font-size: var(--text-lg);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.stats-info {
    font-size: var(--text-xs);
    color: var(--color-text-soft);
}

.user-stats-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
}

@media (min-width: 600px) {
    .user-stats-container {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

/* ---------- 14. FILTERS (analytics + sales) ---------- */
.analytics-filters,
.sales-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

@media (min-width: 769px) {
    .analytics-filters,
    .sales-filters {
        grid-template-columns: repeat(4, 1fr);
        align-items: end;
    }
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.filter-group label {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.filter-input,
.filter-select {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    background: var(--color-surface);
    min-height: 40px;
}

.filter-input:focus,
.filter-select:focus {
    outline: 2px solid var(--color-primary-soft);
    border-color: var(--color-primary);
}

.filter-actions {
    display: flex;
    gap: var(--space-2);
    grid-column: 1 / -1;
}

@media (min-width: 769px) {
    .filter-actions {
        grid-column: auto;
    }
}

/* ---------- 15. VENTAS (recent orders) ---------- */
.orders-list {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    margin-bottom: var(--space-4);
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.list-header h3 {
    font-size: var(--text-lg);
}

.refresh-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--color-bg);
    color: var(--color-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--dur-fast);
}

.refresh-btn:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
}

.orders-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.export-section {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.export-controls {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    width: 100%;
}

.export-controls .btn {
    flex: 1 0 200px;
}

/* ---------- 16. EVENTOS Y TEMAS TAB ---------- */
.admin-block {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    margin-bottom: var(--space-4);
    overflow: hidden;
}

.admin-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    gap: var(--space-3);
    flex-wrap: wrap;
}

.admin-block-header h3 {
    font-size: var(--text-lg);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.admin-empty {
    padding: var(--space-8);
    text-align: center;
    color: var(--color-text-soft);
    font-size: var(--text-sm);
}

/* Lista de eventos */
.events-list {
    display: flex;
    flex-direction: column;
}

.event-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    transition: background var(--dur-fast);
    flex-wrap: wrap;
}

.event-card:last-child {
    border-bottom: none;
}

.event-card:hover {
    background: var(--color-bg);
}

.event-card.active {
    background: var(--color-primary-soft);
    border-left: 4px solid var(--color-primary);
    padding-left: calc(var(--space-5) - 4px);
}

.event-card-emoji {
    font-size: 2.25rem;
    line-height: 1;
    flex-shrink: 0;
    width: 3rem;
    text-align: center;
}

.event-card-info {
    flex: 1;
    min-width: 180px;
}

.event-card-name {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
}

.event-card-meta {
    font-size: var(--text-xs);
    color: var(--color-text-soft);
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-wrap: wrap;
    margin-top: 2px;
}

.event-card-slug {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    background: var(--color-bg);
    padding: 1px var(--space-1);
    border-radius: var(--radius-sm);
}

.event-card-dot {
    opacity: 0.5;
}

.event-card-actions {
    display: flex;
    gap: var(--space-1);
    align-items: center;
    flex-shrink: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 4px var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-active {
    background: rgba(47, 158, 68, 0.18);
    color: var(--color-success);
}

.badge-super {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
    border: 1px solid rgba(255,255,255,0.25);
}

/* Lista de temas (grid) */
.themes-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
    padding: var(--space-4);
}

@media (min-width: 600px) {
    .themes-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .themes-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

.theme-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    transition: all var(--dur-base);
}

.theme-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    border-color: var(--color-primary-light);
}

.theme-card-preview {
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.theme-card-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.18) 100%);
}

.theme-card-emoji {
    font-size: 3rem;
    line-height: 1;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.35));
    position: relative;
    z-index: 1;
}

.theme-card-info {
    padding: var(--space-3) var(--space-4);
    flex: 1;
}

.theme-card-name {
    font-size: var(--text-base);
    font-weight: var(--weight-bold);
}

.theme-card-app-title {
    font-size: var(--text-xs);
    color: var(--color-text-soft);
    margin-top: 2px;
}

.theme-card-swatches {
    display: flex;
    gap: 6px;
    margin-top: var(--space-3);
}

.mini-swatch {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-surface);
    box-shadow: 0 0 0 1px var(--color-border);
}

.theme-card-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
    min-height: 44px;
}

.theme-template-badge {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    background: rgba(0, 0, 0, 0.55);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    backdrop-filter: blur(4px);
    z-index: 2;
}

.theme-card.is-template .theme-card-preview {
    position: relative;
}

.theme-locked-hint {
    width: 100%;
    text-align: center;
    font-size: var(--text-xs);
    color: var(--color-text-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: var(--weight-semibold);
}

/* ---------- 17. MODALS ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.modal.show {
    display: flex;
    animation: modalIn var(--dur-base) var(--ease-out);
}

@keyframes modalIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    max-width: 480px;
    width: 100%;
    max-height: calc(100vh - var(--space-8));
    overflow-y: auto;
    animation: modalSlide var(--dur-slow) var(--ease-spring);
}

@keyframes modalSlide {
    from { transform: translateY(20px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    font-size: var(--text-lg);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    color: var(--color-text-soft);
    transition: all var(--dur-fast);
}

.modal-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.form-body {
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

.theme-modal-content {
    max-width: 640px;
}

/* ---------- 18. FORMS ---------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-group label {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: var(--space-3) var(--space-4);
    border: 1.5px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    background: var(--color-surface);
    transition: border-color var(--dur-fast);
    min-height: 44px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: 3px solid var(--color-primary-soft);
    outline-offset: 0;
    border-color: var(--color-primary);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group textarea#themeSeedProducts {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}

.input-hint {
    font-size: var(--text-xs);
    color: var(--color-text-soft);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

@media (min-width: 600px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

.form-checkbox-group {
    flex-direction: row;
    align-items: center;
}

.form-checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--color-text);
}

.form-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--color-primary);
}

/* Color pickers + preview */
.color-pickers {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
}

@media (min-width: 600px) {
    .color-pickers {
        grid-template-columns: repeat(3, 1fr);
    }
}

.color-picker-group {
    flex-direction: row;
    align-items: center;
    gap: var(--space-2);
}

.color-picker-group label {
    font-size: var(--text-sm);
    flex: 1;
    margin: 0;
}

.color-picker-group input[type="color"] {
    width: 48px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--color-surface);
    min-height: 0;
}

.theme-preview {
    background: linear-gradient(135deg, var(--color-bg), var(--color-surface));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.theme-preview-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.theme-preview-emoji {
    font-size: 2.5rem;
    line-height: 1;
}

.theme-preview-text {
    display: flex;
    flex-direction: column;
}

.theme-preview-text strong {
    font-size: var(--text-base);
    font-family: var(--font-display);
}

.theme-preview-text small {
    font-size: var(--text-xs);
    color: var(--color-text-soft);
}

.theme-preview-swatches {
    display: flex;
    gap: var(--space-1);
}

.swatch {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-surface);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ---------- 19. TOASTS ---------- */
.toast-container {
    position: fixed;
    bottom: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-2);
    pointer-events: none;
    max-width: 92vw;
    width: 400px;
}

@media (min-width: 769px) {
    .toast-container {
        left: auto;
        right: var(--space-6);
        bottom: var(--space-6);
        transform: none;
    }
}

.toast {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-3) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    pointer-events: auto;
    animation: toastIn var(--dur-base) var(--ease-spring);
    border-left: 4px solid var(--color-primary);
}

.toast.success { border-left-color: var(--color-success); }
.toast.error { border-left-color: var(--color-danger); }
.toast.warning { border-left-color: var(--color-warning); }
.toast.info { border-left-color: var(--color-info); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 20. LOADING OVERLAY ---------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-toast);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
    color: var(--color-text);
}

.loading-spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-4);
    border: 4px solid var(--color-primary-soft);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
}

.loading-content p {
    color: var(--color-text-soft);
    font-size: var(--text-sm);
}

/* ---------- 21. LOGIN MODAL (legacy in SummaryView) ---------- */
.login-modal {
    /* SummaryView uses .modal patterns */
}

.user-info button {
    border-radius: var(--radius-full);
}

/* ---------- Tabla genérica (productos admin) ---------- */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table thead th {
    text-align: left;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-soft);
    font-weight: var(--weight-semibold);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.table tbody td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--color-primary-soft);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table .text-right { text-align: right; }

.products-data-table .col-name {
    font-weight: var(--weight-semibold);
}

.products-data-table .col-price {
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    color: var(--color-primary-dark);
    white-space: nowrap;
}

.products-data-table .col-id {
    color: var(--color-text-soft);
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: var(--text-xs);
}

.products-data-table .col-date {
    color: var(--color-text-soft);
    font-size: var(--text-xs);
    white-space: nowrap;
}

.products-data-table .col-actions {
    white-space: nowrap;
}

/* Mobile: ocultar columnas secundarias + targets táctiles más amigables */
@media (max-width: 600px) {
    .hide-mobile {
        display: none !important;
    }

    .table thead th,
    .table tbody td {
        padding: var(--space-3) var(--space-2);
    }

    /* Botones de acción más grandes en mobile (touch-friendly: ≥44px) */
    .products-data-table .btn-icon,
    .products-data-table .btn-icon.btn-sm {
        width: 44px;
        min-height: 44px;
        font-size: 1rem;
    }

    .products-data-table .col-actions {
        display: flex;
        gap: var(--space-1);
        justify-content: flex-end;
    }
}

/* ---------- 22. AUTH GATE ---------- */
.auth-gate {
    position: relative;
    z-index: var(--z-base);
    padding: var(--space-6) var(--space-4);
    min-height: 60vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.auth-gate-card {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-6);
    border: 1px solid var(--color-border);
    animation: modalSlide var(--dur-slow) var(--ease-spring);
}

@media (min-width: 600px) {
    .auth-gate-card {
        padding: var(--space-8);
    }
}

.auth-gate-header {
    text-align: center;
    margin-bottom: var(--space-5);
}

.auth-gate-header i {
    font-size: 2.5rem;
    color: var(--color-primary);
    margin-bottom: var(--space-3);
    display: inline-block;
}

.auth-gate-logo {
    width: 160px;
    height: auto;
    margin: 0 auto var(--space-4);
    display: block;
    object-fit: contain;
}

.auth-gate-header h2 {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    margin-bottom: var(--space-2);
}

.auth-gate-header p {
    color: var(--color-text-soft);
    font-size: var(--text-sm);
}

.auth-gate form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.form-error {
    background: rgba(214, 51, 108, 0.1);
    color: var(--color-danger);
    border: 1px solid rgba(214, 51, 108, 0.25);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    text-align: center;
    font-weight: var(--weight-semibold);
}

.auth-gate-footer {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
    font-size: var(--text-xs);
    color: var(--color-text-soft);
    text-align: center;
}

.auth-event-hint {
    margin-top: var(--space-1);
    opacity: 0.75;
}

/* Auth state visibility (driven by data-auth en <body>).
   Cuando no hay sesión, el header completo se oculta para que el login sea
   neutro: el usuario no ve el tema del evento ni puede cambiarlo desde ahí. */
body[data-auth="logged-out"] .app-header,
body[data-auth="logged-out"] .tab-navigation,
body[data-auth="logged-out"] .tab-content {
    display: none;
}

body[data-auth="logged-in"] .auth-gate {
    display: none;
}

/* Cuando logged-out, el body se ve como pantalla neutra de login (sin pattern del tema) */
body[data-auth="logged-out"]::before {
    background-image: none;
}

/* Pestaña Eventos sólo visible para super admins */
body:not([data-role="super"]) .tab-btn[data-tab="eventos"] {
    display: none;
}

body[data-auth="logged-out"] {
    background: linear-gradient(135deg, #f4f6fb 0%, #e2e8f0 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- 23. UTILITIES ---------- */
.text-muted { color: var(--color-text-soft); }
.text-center { text-align: center; }

/* Collapsible "advanced" section dentro de un form (HTML <details>) */
.form-collapse {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.form-collapse > summary {
    list-style: none;
    cursor: pointer;
    padding: var(--space-3) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-text-muted);
    transition: background var(--dur-fast);
    user-select: none;
}

.form-collapse > summary::-webkit-details-marker { display: none; }
.form-collapse > summary::marker { content: ''; }

.form-collapse > summary::after {
    content: '\f078'; /* fa-chevron-down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: auto;
    font-size: 0.65rem;
    transition: transform var(--dur-fast);
    color: var(--color-text-soft);
}

.form-collapse[open] > summary::after {
    transform: rotate(180deg);
}

.form-collapse > summary:hover {
    background: var(--color-primary-soft);
    color: var(--color-text);
}

.form-collapse-hint {
    color: var(--color-text-soft);
    font-weight: var(--weight-regular);
    font-size: var(--text-xs);
}

.form-collapse > .form-group {
    padding: 0 var(--space-4) var(--space-4);
    margin-top: 0;
}

textarea#themeSeedProducts {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: var(--text-xs);
}

/* Login-required message en pestaña Resumen */
.login-required-message {
    padding: var(--space-8) var(--space-4);
    text-align: center;
    color: var(--color-text-soft);
}

.login-required-message .login-icon i {
    font-size: 3rem;
    color: var(--color-border-strong);
    margin-bottom: var(--space-3);
}

.login-required-message h3 {
    font-size: var(--text-xl);
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.login-required-message p {
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
}

/* User stats grid (renderUserStats) */
.user-stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
}

@media (min-width: 600px) {
    .user-stats-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

.user-stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.user-stat-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--weight-bold);
    font-size: var(--text-base);
}

.user-stat-header .user-info {
    display: flex;
    flex-direction: column;
}

.user-stat-header h4 {
    font-size: var(--text-base);
    font-weight: var(--weight-bold);
}

.user-role {
    font-size: var(--text-xs);
    color: var(--color-text-soft);
}

.user-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
}

.metric-item {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    text-align: center;
}

.metric-value {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: var(--color-text);
}

.metric-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-soft);
    margin-top: 2px;
}

.user-performance {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.performance-bar {
    height: 6px;
    background: var(--color-bg);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.performance-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--radius-full);
    transition: width 600ms var(--ease-out);
}

.performance-text {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--color-text-soft);
}

.no-user-stats,
.no-orders {
    padding: var(--space-8) var(--space-4);
    text-align: center;
    color: var(--color-text-soft);
}

.no-user-stats i,
.no-orders i {
    font-size: 2.5rem;
    color: var(--color-border-strong);
    margin-bottom: var(--space-3);
}

.no-user-stats h4,
.no-orders h3 {
    color: var(--color-text);
    margin-bottom: var(--space-1);
}

/* Order item en lista de ventas */
.order-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    transition: background var(--dur-fast);
}

.order-item:hover {
    background: var(--color-primary-soft);
}

.order-info {
    flex: 1;
    min-width: 0;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-1);
}

.order-id {
    font-weight: var(--weight-bold);
    color: var(--color-text);
}

.order-user {
    font-size: var(--text-xs);
    color: var(--color-text-soft);
}

.order-products {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-payment-method,
.order-time {
    font-size: var(--text-xs);
    color: var(--color-text-soft);
    display: inline-block;
    margin-right: var(--space-3);
    margin-top: 2px;
}

.order-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-2);
    flex-shrink: 0;
}

.order-total {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: var(--color-primary-dark);
}

.btn-delete-order {
    background: transparent;
    border: none;
    color: var(--color-text-soft);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    transition: all var(--dur-fast);
}

.btn-delete-order:hover {
    background: rgba(214, 51, 108, 0.12);
    color: var(--color-danger);
}

/* Pedido eliminado — visible como audit trail, no se cuenta en stats */
.order-item.deleted {
    background: rgba(214, 51, 108, 0.06);
    border-color: rgba(214, 51, 108, 0.28);
}

.order-item.deleted:hover {
    background: rgba(214, 51, 108, 0.10);
}

.order-item.deleted .order-id,
.order-item.deleted .order-products,
.order-item.deleted .order-total {
    text-decoration: line-through;
    color: var(--color-text-soft);
}

.order-item.deleted .order-id {
    color: var(--color-text-soft);
}

.order-item.deleted .order-total {
    color: var(--color-danger);
}

.deleted-badge {
    display: inline-block;
    margin-left: var(--space-2);
    padding: 2px var(--space-2);
    background: var(--color-danger);
    color: white;
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    text-decoration: none;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

.order-item.deleted .order-deleted-info {
    margin-top: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-danger);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-style: italic;
}
