/**
 * GreenTablePos - Estilos y Tema Profesional de Billar
 * Inspirado en paño verde esmeralda, grafito mate y detalles en oro pulido.
 */

:root {
    --bg-main: #09120d;
    --bg-card: #0f1c14;
    --bg-card-hover: #14261c;
    --bg-surface: #172a1f;
    --bg-surface-light: #20392b;
    --border-color: #234231;
    --border-highlight: #34d399;
    
    --felt-green: #059669;
    --felt-green-glow: rgba(16, 185, 129, 0.25);
    --felt-green-dark: #064e3b;
    --emerald-accent: #10b981;
    
    --gold-accent: #f59e0b;
    --gold-hover: #d97706;
    --gold-glow: rgba(245, 158, 11, 0.25);
    
    --graphite: #121714;
    --graphite-light: #1f2722;
    --graphite-border: #2e3a33;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-gold: #fbbf24;
    --text-emerald: #34d399;
    
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.2);
    --warning: #f59e0b;
    --success: #10b981;
    --info: #38bdf8;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.6);
    --shadow-active: 0 0 25px rgba(245, 158, 11, 0.2);
    --shadow-green: 0 0 25px rgba(16, 185, 129, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--emerald-accent);
}

/* Header & Top Bar */
.navbar {
    background: linear-gradient(180deg, #101f16 0%, #0d1912 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: radial-gradient(circle at 30% 30%, #34d399, #065f46);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    border: 2px solid #059669;
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand-title span {
    color: var(--text-gold);
}

.branch-badge {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-emerald);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* User & Role Switcher Pills */
.role-switcher {
    display: flex;
    align-items: center;
    background: var(--graphite);
    border: 1px solid var(--graphite-border);
    padding: 4px;
    border-radius: var(--radius-full);
}

.role-pill {
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.role-pill.active {
    background: var(--felt-green);
    color: #fff;
    box-shadow: 0 0 10px var(--felt-green-glow);
}

.role-pill.active.admin {
    background: #6366f1;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.role-pill.active.owner {
    background: var(--gold-accent);
    color: #000;
    box-shadow: 0 0 10px var(--gold-glow);
}

/* Main Container & Tabs */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
    width: 100%;
    flex: 1;
}

.tab-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tab-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: var(--bg-card-hover);
    color: #fff;
}

.tab-btn.active {
    background: var(--bg-surface-light);
    border-color: var(--border-highlight);
    color: #fff;
    box-shadow: 0 0 12px var(--felt-green-glow);
}

/* Grid of Billiard Tables */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.table-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--text-muted);
}

.table-card.available::before {
    background: var(--success);
}

.table-card.occupied {
    border-color: var(--gold-accent);
    box-shadow: var(--shadow-active);
}

.table-card.occupied::before {
    background: linear-gradient(90deg, var(--gold-accent), #fef08a, var(--gold-accent));
    background-size: 200% 100%;
    animation: goldGlow 3s linear infinite;
}

@keyframes goldGlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.table-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-ball-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #cbd5e1 50%, #64748b 100%);
    color: #0f172a;
    font-weight: 800;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.5);
    border: 2px solid #fff;
}

.table-card.occupied .table-ball-number {
    background: radial-gradient(circle at 35% 35%, #fef08a 0%, #f59e0b 60%, #78350f 100%);
    color: #000;
    border-color: #fbbf24;
}

.table-name-group h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
}

.table-type {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-status-pill {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-available {
    background: rgba(16, 185, 129, 0.15);
    color: var(--text-emerald);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-occupied {
    background: rgba(245, 158, 11, 0.18);
    color: var(--text-gold);
    border: 1px solid rgba(245, 158, 11, 0.5);
    animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Timer Display Section */
.timer-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timer-box {
    display: flex;
    flex-direction: column;
}

.timer-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.timer-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-gold);
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.timer-cost-box {
    text-align: right;
}

.timer-cost-amount {
    font-size: 1.45rem;
    font-weight: 800;
    color: #fff;
}

.timer-rate-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Customer & Bar consumables mini list */
.table-meta-bar {
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
}

.table-meta-bar .customer-tag {
    font-weight: 600;
    color: #e2e8f0;
}

.table-meta-bar .bar-badge {
    color: var(--text-emerald);
    font-weight: 700;
}

/* Table Card Buttons */
.table-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: auto;
}

.btn {
    appearance: none;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--felt-green);
    color: #fff;
    box-shadow: 0 2px 10px var(--felt-green-glow);
}

.btn-primary:hover {
    background: var(--emerald-accent);
}

.btn-gold {
    background: var(--gold-accent);
    color: #000;
    box-shadow: 0 2px 10px var(--gold-glow);
}

.btn-gold:hover {
    background: var(--gold-hover);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-surface-light);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-full {
    grid-column: span 2;
}

.btn-icon-only {
    padding: 8px 10px;
    min-width: 36px;
}

/* POS Bar Module Layout */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 16px;
}

@media (max-width: 900px) {
    .pos-layout {
        grid-template-columns: 1fr;
    }
}

.pos-categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.cat-pill {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cat-pill.active {
    background: var(--felt-green);
    color: #fff;
    border-color: var(--border-highlight);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 14px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.product-card:hover {
    border-color: var(--emerald-accent);
    background: var(--bg-card-hover);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 15px var(--felt-green-glow);
}

.product-card:active {
    transform: scale(0.97);
}

.product-img-wrapper {
    width: 100%;
    height: 120px;
    background: #09130d;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover .product-thumb {
    transform: scale(1.08);
}

.product-placeholder-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.product-stock-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(10, 22, 16, 0.88);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-color);
    color: var(--text-emerald);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.product-stock-tag.low {
    background: rgba(220, 38, 38, 0.9);
    color: #fff;
    border-color: #ef4444;
}

.product-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
}

.product-category-tag {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.product-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: #fff;
    line-height: 1.3;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: auto;
    padding-top: 4px;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-gold);
}

.product-action-hint {
    font-size: 0.72rem;
    color: var(--emerald-accent);
    font-weight: 700;
}

/* Pantalla de Login Dedicada */
.login-view-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 30%, #0d291b 0%, #06110a 75%, #020704 100%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 35px var(--felt-green-glow);
    width: 100%;
    max-width: 440px;
    padding: 34px 28px;
    animation: loginFadeIn 0.3s ease;
}

@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand-header {
    text-align: center;
    margin-bottom: 26px;
}

.login-ball-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #34d399 0%, #059669 50%, #022c22 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 0 30px var(--felt-green-glow);
    border: 3px solid #10b981;
    margin-bottom: 12px;
}

.login-title {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: #fff;
}

.login-title span {
    color: var(--text-gold);
}

.login-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* POS Cart / Ticket Drawer */
.pos-cart-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    position: sticky;
    top: 75px;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.cart-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
}

.cart-items-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 12px;
}

.cart-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: #fff;
}

.cart-item-price-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cart-item-qty-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-btn {
    width: 26px;
    height: 26px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: #fff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 800;
}

.cart-total-box {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 12px;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.cart-grand-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
    padding-top: 6px;
    border-top: 1px solid var(--border-color);
}

.target-destination-selector {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 10px;
    border-radius: var(--radius-md);
    width: 100%;
    margin-bottom: 12px;
    font-weight: 600;
    outline: none;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    transform: translateY(20px);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 16px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--emerald-accent);
}

/* Audit Table & Badges */
.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.audit-table th {
    text-align: left;
    padding: 10px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.audit-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.badge-action {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}

.badge-action.warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-action.danger  { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.badge-action.success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-action.info    { background: rgba(56, 189, 248, 0.2); color: var(--info); }

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-surface);
    color: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastSlideIn 0.25s ease forwards;
    font-weight: 600;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   SUB-NAVEGACIÓN DEL PANEL DE DUEÑO Y FILTROS DE AUDITORÍA
   ========================================================================== */
.owner-subnav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    overflow-x: auto;
}

.owner-subnav-btn {
    appearance: none;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.owner-subnav-btn:hover {
    color: #fff;
    border-color: var(--emerald-accent);
}

.owner-subnav-btn.active {
    background: var(--felt-green);
    color: #fff;
    border-color: var(--emerald-accent);
    box-shadow: 0 2px 10px var(--felt-green-glow);
}

/* Selector de Moneda (Lempiras, Dólares, Euros) */
.currency-pill {
    display: inline-flex;
    cursor: pointer;
    position: relative;
}

.currency-pill input[type="radio"] {
    display: none;
}

.currency-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-main);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    user-select: none;
}

.currency-pill input[type="radio"]:checked + .currency-label {
    border-color: var(--gold-accent);
    background: rgba(217, 119, 6, 0.15);
    color: var(--text-gold);
    box-shadow: 0 0 12px var(--gold-glow);
}

/* Filtros de Relevancia de Bitácora de Auditoría */
.audit-filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.audit-filter-pill {
    appearance: none;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.audit-filter-pill:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.audit-filter-pill.active {
    background: rgba(217, 119, 6, 0.2);
    color: var(--text-gold);
    border-color: var(--gold-accent);
    box-shadow: 0 0 8px rgba(217, 119, 6, 0.3);
}

/* Miniaturas de Fotos de Productos en Tablas */
.thumbnail-prod {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    display: block;
}

.rate-input {
    width: 120px;
    padding: 8px 12px;
    font-weight: 800;
    color: var(--text-gold);
    font-size: 0.95rem;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: right;
    outline: none;
    transition: border-color 0.2s;
}

.rate-input:focus {
    border-color: var(--gold-accent);
}

/* ========================================================
   ESTILOS OPERACIONES DE CAJA, BILLETAJE Y SAAS
   ======================================================== */

/* Grid y Tarjetas de Billetaje */
.billetaje-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.billetaje-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s ease;
}

.billetaje-item:focus-within {
    border-color: var(--gold-accent);
    box-shadow: 0 0 10px rgba(217, 119, 6, 0.2);
}

.billetaje-denom-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.billetaje-denom-label {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-gold);
}

.billetaje-subtotal {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-emerald);
}

.billetaje-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.billetaje-qty-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 1rem;
    font-weight: 800;
    text-align: right;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #fff;
    outline: none;
    transition: border-color 0.15s;
}

.billetaje-qty-input:focus {
    border-color: var(--gold-accent);
}

/* Tarjetas de Permisos para Cajeros (Dueño) */
.permission-toggle-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.permission-toggle-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.02);
}

.permission-toggle-card input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--emerald-primary);
    cursor: pointer;
    margin-top: 2px;
}

.perm-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
}

.perm-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

/* Badges de Estado de Suscripción SaaS */
.sub-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.sub-badge-active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--text-emerald);
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.sub-badge-expiring {
    background: rgba(217, 119, 6, 0.2);
    color: var(--text-gold);
    border: 1px solid rgba(217, 119, 6, 0.45);
}

.sub-badge-expired {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Badges de Cuadre / Descuadre en Auditoría */
.reconcile-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 800;
}

.reconcile-balanced {
    background: rgba(16, 185, 129, 0.2);
    color: var(--text-emerald);
    border: 1px solid var(--emerald-primary);
}

.reconcile-shortage {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.5);
}

.reconcile-surplus {
    background: rgba(217, 119, 6, 0.2);
    color: var(--text-gold);
    border: 1px solid rgba(217, 119, 6, 0.5);
}

/* ========================================================
   BOLA 8 GIRATORIA 3D - ANIMACIÓN DE CARGA EXCLUSIVA
   ======================================================== */
.billiard-spinning-ball-container {
    perspective: 800px;
    width: 110px;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.billiard-spinning-ball {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%, #4b5563 0%, #1f2937 40%, #030712 90%);
    box-shadow: 0 0 35px rgba(16, 185, 129, 0.45), inset -10px -10px 25px rgba(0, 0, 0, 0.9), 0 12px 28px rgba(0, 0, 0, 0.7);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ballSpin3D 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.ball-shine {
    position: absolute;
    top: 10%;
    left: 18%;
    width: 26px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 70%);
    transform: rotate(-35deg);
    pointer-events: none;
}

.ball-center-circle {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35), 0 0 8px rgba(0, 0, 0, 0.4);
    animation: circleCounterSpin 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.ball-number {
    font-size: 1.8rem;
    font-weight: 900;
    font-family: 'Arial Black', Impact, sans-serif;
    color: #0b0f14;
    line-height: 1;
    transform: translateY(-1px);
}

@keyframes ballSpin3D {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.08);
        box-shadow: 0 0 45px rgba(16, 185, 129, 0.75), inset -10px -10px 25px rgba(0, 0, 0, 0.9), 0 18px 36px rgba(0, 0, 0, 0.8);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes circleCounterSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(-360deg);
    }
}

/* Plan Cards Styling */
.sub-plan-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sub-plan-card:hover {
    border-color: rgba(16, 185, 129, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.sub-plan-card.active {
    border-color: var(--emerald-primary);
    background: rgba(16, 185, 129, 0.08);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
}

.sub-plan-card.popular {
    border-color: rgba(245, 158, 11, 0.6);
}

.sub-plan-badge-popular {
    position: absolute;
    top: -12px;
    right: 14px;
    background: linear-gradient(90deg, #f59e0b, #d97706);
    color: #0b0f14;
    font-weight: 800;
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

/* ========================================================
   ASISTENTE DE CONFIGURACIÓN PASO A PASO (ONBOARDING)
   ======================================================== */
.wizard-step-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.wizard-step-pill .step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.75rem;
}

.wizard-step-pill.active {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--emerald-primary);
    color: var(--text-emerald);
}

.wizard-step-pill.active .step-num {
    background: var(--emerald-primary);
    color: #0b0f14;
    font-weight: 900;
}

.wizard-step-pill.completed {
    border-color: rgba(16, 185, 129, 0.5);
    color: #a7f3d0;
}

.wizard-step-line {
    flex: 1;
    min-width: 14px;
    height: 2px;
    background: var(--border-color);
}

.wizard-choice-card {
    background: var(--bg-surface);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wizard-choice-card:hover {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.05);
}

.wizard-choice-card.active {
    border-color: var(--emerald-primary);
    background: rgba(16, 185, 129, 0.1);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

/* ==========================================================================
   DISEÑO ERGONÓMICO MÓVIL Y TABLET (TOUCH-FIRST & RESPONSIVE PWA)
   ========================================================================== */

/* Clases de utilidad móvil / escritorio */
.mobile-only {
    display: none !important;
}

@media (max-width: 900px) {
    .mobile-only {
        display: block !important;
    }
    .desktop-only {
        display: none !important;
    }
}

/* Barra de Navegación Inferior Móvil (Fijada abajo con soporte notch / safe area) */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(11, 22, 16, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.7);
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    padding: 6px 0;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

.mobile-nav-item:active {
    transform: scale(0.92);
}

.mobile-nav-icon {
    font-size: 1.35rem;
    line-height: 1;
}

.mobile-nav-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.mobile-nav-item.active {
    color: var(--text-emerald);
}

.mobile-nav-item.active .mobile-nav-label {
    color: #fff;
}

.mobile-nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--text-emerald);
    border-radius: 0 0 3px 3px;
    box-shadow: 0 0 8px var(--felt-green-glow);
}

.mobile-cart-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    background: var(--gold-accent);
    color: #0b0f14;
    font-size: 0.68rem;
    font-weight: 900;
    padding: 1px 6px;
    border-radius: 10px;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
    line-height: 1.2;
}

/* Hoja Inferior "Más" (Drawer Bottom Sheet) */
.mobile-more-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1090;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.mobile-more-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-more-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    border-radius: 20px 20px 0 0;
    padding: 12px 18px calc(24px + env(safe-area-inset-bottom, 0px)) 18px;
    z-index: 1100;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.75);
    max-height: 85vh;
    overflow-y: auto;
}

.mobile-more-sheet.active {
    transform: translateY(0);
}

.sheet-drag-handle {
    width: 44px;
    height: 5px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    margin: 0 auto 12px auto;
}

.mobile-more-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.mobile-more-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-more-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    color: #fff;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

.mobile-more-btn:active {
    background: var(--bg-surface-light);
    transform: scale(0.98);
}

.mobile-more-btn .more-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.mobile-more-btn .more-info {
    flex: 1;
}

.mobile-more-btn .more-info strong {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
}

.mobile-more-btn .more-info small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.mobile-more-btn .more-arrow {
    font-size: 1.3rem;
    color: var(--text-muted);
}

.mobile-more-btn.danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Barra Flotante de Carrito Móvil */
.mobile-pos-cart-bar {
    display: none;
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    background: linear-gradient(90deg, #059669 0%, #047857 100%);
    border: 2px solid #34d399;
    border-radius: 50px;
    padding: 10px 18px;
    z-index: 990;
    box-shadow: 0 8px 30px rgba(5, 150, 105, 0.5);
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    animation: cartBounceIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    touch-action: manipulation;
}

.mobile-pos-cart-bar:active {
    transform: scale(0.98);
}

@keyframes cartBounceIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   REGLAS MEDIA QUERY RESPONSIVAS PARA TABLETS Y TELÉFONOS (<= 900px)
   ========================================================================== */
@media (max-width: 900px) {
    /* Espaciado del contenedor para que la barra inferior no tape nada */
    .app-container {
        padding: 12px;
        padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Ocultar barra superior horizontal de pestañas y activar la barra inferior */
    .tab-nav {
        display: none !important;
    }

    .mobile-bottom-nav {
        display: flex !important;
    }

    /* Navbar superior simplificado */
    .navbar {
        padding: 8px 12px;
    }

    .brand-title {
        font-size: 1.05rem;
    }

    .brand-title small {
        display: none;
    }

    #btn-install-app {
        display: none !important;
    }

    #header-branch-select {
        max-width: 130px;
        font-size: 0.72rem;
        padding: 4px 6px;
    }

    #current-user-name {
        max-width: 90px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.8rem;
    }

    #current-user-role-badge {
        font-size: 0.6rem;
    }

    /* Módulo 1: Mesas de Billar */
    .tables-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 12px;
    }

    .table-card {
        padding: 14px;
        border-radius: 14px;
    }

    .timer-container {
        padding: 12px;
        margin: 10px 0;
    }

    .timer-value {
        font-size: 1.6rem !important;
    }

    .timer-cost-amount {
        font-size: 1.4rem !important;
    }

    .table-actions-grid {
        gap: 8px;
    }

    .table-actions-grid .btn {
        min-height: 46px;
        font-size: 0.95rem;
    }

    /* Módulo 2: POS / Barra de Productos */
    .pos-layout {
        grid-template-columns: 1fr !important;
        gap: 0;
    }

    .pos-categories {
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }

    .cat-pill {
        padding: 8px 16px;
        font-size: 0.85rem;
        scroll-snap-align: start;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    .product-card {
        border-radius: 12px;
        transition: transform 0.1s ease;
    }

    .product-card:active {
        transform: scale(0.96);
    }

    .product-img-wrapper {
        height: 120px !important;
    }

    .product-info {
        padding: 10px !important;
    }

    .product-title {
        font-size: 0.85rem !important;
        line-height: 1.25 !important;
        min-height: 2.5em;
    }

    .product-price {
        font-size: 1.05rem !important;
    }

    /* Drawer de Carrito POS para Móviles */
    .pos-cart-panel {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        height: auto !important;
        max-height: 86vh !important;
        border-radius: 20px 20px 0 0 !important;
        z-index: 1050 !important;
        transform: translateY(105%) !important;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 0 -12px 45px rgba(0, 0, 0, 0.85) !important;
        border: 1px solid var(--border-color) !important;
        padding: 14px 16px calc(24px + env(safe-area-inset-bottom, 0px)) 16px !important;
        background: var(--bg-card) !important;
    }

    .pos-cart-panel.mobile-active {
        transform: translateY(0) !important;
    }

    .cart-items-list {
        max-height: 38vh;
    }

    .cart-qty-btn {
        width: 38px !important;
        height: 38px !important;
        font-size: 1.1rem !important;
    }

    /* Módulo 3: Operaciones de Caja */
    .shift-header-summary, .stats-grid, .owner-stats-grid, #superadmin-summary-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .stat-card {
        padding: 12px !important;
    }

    .stat-value {
        font-size: 1.35rem !important;
    }

    /* Módulo 4: Entrada de Stock y Tablas de Auditoría */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-sm);
        margin-bottom: 14px;
    }

    /* Modales como Bottom Sheets en Móviles */
    .modal-overlay {
        align-items: flex-end !important;
        padding: 0 !important;
    }

    .modal-content {
        border-radius: 20px 20px 0 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        border-bottom: none !important;
        border-left: none !important;
        border-right: none !important;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
        transform: translateY(100%) !important;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    .modal-overlay.active .modal-content {
        transform: translateY(0) !important;
    }

    /* Formularios táctiles con campos más amplios */
    .form-control, select.form-control, input.form-control {
        font-size: 16px !important; /* Previene el zoom automático molesto en iPhone Safari */
        padding: 12px 14px !important;
        min-height: 48px;
    }

    .btn {
        min-height: 46px;
        font-size: 0.95rem;
    }

    /* Wizard Onboarding en móvil */
    .wizard-steps-bar {
        overflow-x: auto;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
    }

    .wizard-choice-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
}

/* ==========================================================================
   AJUSTES ULTRA-COMPACTOS PARA TELÉFONOS PEQUEÑOS (<= 480px)
   ========================================================================== */
@media (max-width: 480px) {
    .tables-grid {
        grid-template-columns: 1fr !important;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .product-img-wrapper {
        height: 105px !important;
    }

    .login-card {
        padding: 20px 16px !important;
        width: 95% !important;
    }

    .stats-grid, .owner-stats-grid, #superadmin-summary-cards {
        grid-template-columns: 1fr 1fr !important;
    }
}




