/* Sidebar layout */
.sidebar {
    width: 230px;
    height: 100vh;
    background-color: #1a1a2e;
    color: #e0e0e0;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    padding-top: 0;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #0f3460; border-radius: 2px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #1a5276; }

.sidebar-brand {
    padding: 1.25rem 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    background-color: #16213e;
    border-bottom: 1px solid #0f3460;
    text-decoration: none;
    display: block;
}

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

.sidebar .nav-link {
    color: #b0b8cc;
    padding: 0.5rem 1.25rem;
    border-radius: 0;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: background 0.15s;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: #0f3460;
    color: #fff;
}

.sidebar .nav-section {
    padding: 0.5rem 1.25rem 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6c7a8d;
}

.main-content {
    margin-left: 230px;
    padding: 1.5rem;
    min-height: 100vh;
    background-color: #f5f6fa;
}

/* Stat cards */
.stat-card {
    border-radius: 10px;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

/* Job status badges */
.badge-running  { background-color: #0d6efd; }
.badge-idle     { background-color: #6c757d; }
.badge-success  { background-color: #198754; }
.badge-error    { background-color: #dc3545; }

/* Log panel */
.log-panel {
    background-color: #1e1e2e;
    color: #cdd6f4;
    font-family: monospace;
    font-size: 0.8rem;
    border-radius: 6px;
    padding: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
}

/* ── Activate Cards — two-panel layout ── */
.activate-container {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1rem;
    height: calc(100vh - 120px);
}

.activate-search-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.activate-search-panel .card,
.activate-search-panel .card-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.activate-form-panel {
    overflow-y: auto;
}

.search-results-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Search result items — tablet-friendly touch targets */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.5rem;
    border: none;
    border-left: 3px solid transparent;
    background: #fff;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.12s;
    width: 100%;
    min-height: 64px;
}

.search-result-item:hover {
    background-color: #eef2ff;
    border-left-color: #4361ee;
}

.search-result-item.selected {
    background-color: #dbeafe;
    border-left-color: #2563eb;
}

.search-result-img {
    flex-shrink: 0;
    width: 44px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-result-img img {
    width: 44px;
    height: 60px;
    object-fit: contain;
    border-radius: 3px;
}

.img-placeholder {
    width: 44px;
    height: 60px;
    background: #f1f5f9;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: #9ca3af;
}

.search-result-info { flex: 1; min-width: 0; }

.search-result-name {
    font-weight: 600;
    font-size: 0.88rem;
    line-height: 1.2;
    margin-bottom: 2px;
}

.search-result-meta {
    font-size: 0.75rem;
    color: #4b5563;
}

.search-result-rarity {
    font-size: 0.7rem;
    color: #9ca3af;
}

/* Stock stepper — large touch-friendly +/- buttons */
.stock-stepper {
    display: flex;
    align-items: center;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    height: 48px;
}

.stock-btn {
    background: #f8f9fa;
    border: none;
    width: 52px;
    height: 100%;
    font-size: 1.4rem;
    font-weight: 300;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
    user-select: none;
}

.stock-btn:hover { background: #e9ecef; }
.stock-btn:active { background: #dee2e6; }

.stock-value {
    flex: 1;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
}

/* Stock stepper — small version for adjust column */
.stock-stepper-sm {
    display: flex;
    align-items: center;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    height: 32px;
}

.stock-btn-sm {
    background: #f8f9fa;
    border: none;
    width: 28px;
    height: 100%;
    font-size: 1.1rem;
    font-weight: 300;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
    user-select: none;
    padding: 0;
}

.stock-btn-sm:hover { background: #e9ecef; }

.stock-val-sm {
    min-width: 32px;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
}

/* Tablet responsive: stack panels below lg */
@media (max-width: 991px) {
    .activate-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .activate-search-panel {
        height: 360px;
    }
}

/* Legacy thumbnail (other pages) */
.card-thumbnail {
    width: 40px;
    height: 56px;
    object-fit: contain;
}

/* Exchange rate badge (Dashboard header) */
.exchange-rate-badge {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* CLP sub-label below USD values */
.clp-sublabel {
    font-size: 0.72rem;
    color: #16a34a;
    font-weight: 500;
    margin-top: 1px;
}

/* CLP label in stat cards */
.clp-label {
    font-size: 0.8rem;
    color: #16a34a;
    font-weight: 500;
    margin-top: 2px;
}

/* ── Dashboard: Daily sales chart ── */
.daily-chart {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.daily-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.daily-label {
    width: 52px;
    font-size: 0.78rem;
    color: #6b7280;
    text-transform: capitalize;
    flex-shrink: 0;
}
.daily-bar-container {
    flex: 1;
    background: #f1f5f9;
    border-radius: 4px;
    height: 22px;
    overflow: hidden;
}
.daily-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #818cf8);
    border-radius: 4px;
    min-width: 2px;
    transition: width 0.3s ease;
}
.daily-value {
    width: 140px;
    font-size: 0.75rem;
    color: #374151;
    text-align: right;
    flex-shrink: 0;
}

/* ── Dashboard: Top products ranking ── */
.top-product-scroll {
    max-height: 210px;
    overflow-y: auto;
}
.top-product-scroll::-webkit-scrollbar { width: 3px; }
.top-product-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
.top-product-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    border-bottom: 1px solid #f1f5f9;
}
.top-product-row:last-child { border-bottom: none; }
.top-rank {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    background: #6b7280;
}
.top-rank.rank-1 { background: #f59e0b; }
.top-rank.rank-2 { background: #94a3b8; }
.top-rank.rank-3 { background: #b45309; }
.top-product-info {
    flex: 1;
    min-width: 0;
}
.top-product-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.top-product-detail {
    font-size: 0.65rem;
    color: #6b7280;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.top-product-stats {
    text-align: right;
    flex-shrink: 0;
}
.badge-sm { font-size: 0.62rem; padding: 0.2em 0.45em; }
.top-product-revenue {
    font-size: 0.68rem;
    color: #6b7280;
    margin-top: 1px;
}

/* Market price panel */
.market-price-panel {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.market-price-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #166534;
}

.market-price-item {
    background: #fff;
    border: 1px solid #d1fae5;
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
    min-width: 90px;
    text-align: center;
}

.market-price-item.highlighted {
    background: #ecfdf5;
    border-color: #6ee7b7;
    box-shadow: 0 0 0 2px #a7f3d0;
}

.market-price-label {
    font-size: 0.68rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.market-price-usd {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
}

.market-price-clp {
    font-size: 0.72rem;
    color: #16a34a;
    font-weight: 500;
}

/* Margin calculator */
.margin-calculator {
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.margin-calc-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
}

.margin-result {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 0.35rem 0.65rem;
    min-width: 130px;
}

.margin-result-label {
    font-size: 0.68rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.margin-result-usd {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1d4ed8;
}

.margin-result-clp {
    font-size: 0.72rem;
    color: #16a34a;
    font-weight: 500;
}

/* ── Login page ── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
}

.login-logo {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-logo i {
    font-size: 2.5rem;
    color: #1d4ed8;
}

.login-logo h4 {
    margin-top: .5rem;
    color: #1a1a2e;
}

/* ── Top bar ── */
.top-bar {
    min-height: 46px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

/* ── Toast / success notification ── */
.toast-success {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: #16a34a;
    color: #fff;
    padding: .6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    z-index: 9999;
    animation: slideIn .2s ease;
}

.toast-error {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: #dc2626;
    color: #fff;
    padding: .6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    z-index: 9999;
    max-width: 400px;
    animation: slideIn .2s ease;
}

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

/* ── Role badges ── */
.badge.bg-purple { background-color: #7c3aed !important; }

/* ── Bulk action toolbar ── */
.bulk-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    flex-wrap: wrap;
}

.bulk-count {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e40af;
    white-space: nowrap;
}

/* ============================
   POS (Caja) Styles
   ============================ */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    height: 100vh;
    overflow: hidden;
    background: #f0f2f5;
}

.pos-left {
    background: #1a1a2e;
    padding: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-right {
    background: #fff;
    padding: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 2px solid #e5e7eb;
}

.pos-product-list {
    flex: 1;
    overflow-y: auto;
}

.pos-product-item {
    background: #2a2a4a;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    color: #fff;
    transition: background 0.15s;
}

.pos-product-item:hover {
    background: #3a3a5a;
}

.pos-product-item:active {
    background: #4a4a6a;
}

.pos-product-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 4px;
    background: #fff;
}

.pos-product-img-placeholder {
    width: 48px;
    height: 48px;
    background: #3a3a5a;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 1.2rem;
}

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

.pos-cart-item {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.pos-qty-controls {
    display: flex;
    align-items: center;
}

.pos-qty-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.pos-qty-btn:hover {
    background: #e5e7eb;
    border-color: #999;
}

.pos-qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pos-totals {
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 12px;
}

.pos-checkout-btn {
    width: 100%;
    padding: 16px;
    font-size: 1.2rem;
    font-weight: bold;
    background: #16a34a;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.pos-checkout-btn:hover {
    background: #15803d;
}

.pos-checkout-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* POS detail text — visible on dark background */
.pos-product-item .pos-detail-text {
    font-size: 0.78rem;
    color: #a0aec0;
    line-height: 1.4;
}

.pos-product-item .text-warning-light {
    color: #fbbf24;
}

.pos-product-item .text-muted {
    color: #a0aec0 !important;
}

.pos-change-display {
    border: 1px solid rgba(0,0,0,0.08);
}

/* Responsive POS: stack on small screens */
@media (max-width: 768px) {
    .pos-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }
    .pos-left, .pos-right {
        overflow-y: auto;
    }
}

