   DARK MODE
================================================== */

body.dark {
    background: #0a0a0a !important;
    color: #d4d4d4;
    /* Texto secundario: #666 sobre #0a0a0a daba ~2.3:1, ilegible.
       Estos valores mantienen >= 7:1 sobre el fondo oscuro. */
    --text: #e5e5e5;
    --text-muted: #a8a8a8;
    --text-faint: #8f8f8f;
    --border: #2f2f2f;
}

body.dark .app-header {
    background: #161616;
    box-shadow: 0 2px 8px rgba(0,0,0,.5);
}

body.dark .search-box {
    background: #1e1e1e;
    border-color: #2a2a2a;
}

body.dark .search-box:focus-within {
    background: #1e1e1e;
    border-color: #444;
}

body.dark .search-box input { color: #e0e0e0; }
body.dark .search-box i { color: #a8a8a8; }

body.dark .page-size-select {
    background: #1e1e1e;
    color: #d4d4d4;
    border-color: #2a2a2a;
}

body.dark .page-size-select:focus { border-color: #444; }

body.dark .filters-bar {
    background: #161616;
    box-shadow: 0 2px 8px rgba(0,0,0,.5);
}

body.dark .filter-tag {
    background: #1e1e1e;
    border-color: #2a2a2a;
    color: #888;
}

body.dark .filter-tag:hover {
    background: #252525;
    border-color: #444;
    color: #ccc;
}

body.dark .filter-tag.active {
    background: #e0e0e0;
    border-color: #e0e0e0;
    color: #0a0a0a;
}

body.dark .view-toggle { background: #1e1e1e; }
body.dark .view-btn { color: #a8a8a8; }
body.dark .view-btn:hover { background: #2a2a2a; color: #ddd; }
body.dark .view-btn.active { background: #e0e0e0; color: #0a0a0a; }

body.dark .btn-icon { background: #1e1e1e; color: #888; }
body.dark .btn-icon:hover { background: #e0e0e0; color: #0a0a0a; }

body.dark .results-count { color: #777; }

body.dark .product-card {
    background: #161616;
    border-color: #222;
}

body.dark .product-card:hover {
    border-color: #333;
    box-shadow: 0 8px 30px rgba(0,0,0,.6);
}

body.dark .card-img-wrapper {
    background: #111;
    border-color: #222;
}

body.dark .product-name { color: #e0e0e0; }
body.dark .price { color: #4ade80; }
body.dark .promo { color: #f87171; }
body.dark .rating, body.dark .stock { color: #777; }

body.dark .badge.bg-primary-subtle { background: rgba(255,255,255,.08) !important; color: #ccc !important; }
body.dark .badge.bg-secondary-subtle { background: rgba(255,255,255,.05) !important; color: #999 !important; }

body.dark .table-responsive {
    background: #161616 !important;
    border-color: #222 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.5);
}

body.dark .table { background: #161616 !important; color: #d4d4d4 !important; }
body.dark .table thead { background: #111 !important; }

body.dark .table th {
    color: #888 !important;
    border-color: #222 !important;
    background: #111 !important;
}

body.dark .table th.sortable:hover { background: #1e1e1e !important; }

body.dark .table th.sort-asc,
body.dark .table th.sort-desc {
    background: rgba(255,255,255,.05) !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

body.dark .table td {
    color: #ccc !important;
    border-color: #1e1e1e !important;
    background: #161616 !important;
}

body.dark .table-row-clickable:hover { background: #1e1e1e !important; }

body.dark .table-image {
    background: #111 !important;
    border-color: #222 !important;
}

body.dark .table-name { color: #e0e0e0 !important; }

body.dark .empty-state {
    background: #161616;
    border-color: #222;
    box-shadow: 0 2px 8px rgba(0,0,0,.5);
}

body.dark .empty-state i { color: #2a2a2a; }
body.dark .empty-state p { color: #888; }
body.dark .empty-state small { color: #555; }

body.dark .modal-content {
    background: #161616;
    box-shadow: 0 20px 60px rgba(0,0,0,.8);
}

body.dark .modal-header {
    background: #111;
    border-color: #222;
}

body.dark .modal-title { color: #e0e0e0; }
body.dark .btn-close { filter: invert(1); }

body.dark .detail-image {
    background: #111;
    border-color: #222;
}

body.dark .detail-name { color: #e0e0e0; }
body.dark .detail-value { color: #e0e0e0; }

body.dark .spec-row {
    background: #1a1a1a;
    border-color: #333;
}

body.dark .detail-extra {
    background: #1a1a1a;
    padding: 16px;
    border-radius: 10px;
}

body.dark .spec-label { color: #777; }
body.dark .spec-value { color: #d4d4d4; }
body.dark .detail-json pre { background: #050505; }

body.dark .meta-item { color: #888; }

body.dark ::-webkit-scrollbar-thumb { background: #2a2a2a; }
body.dark ::-webkit-scrollbar-track { background: #111; }

body.dark .form-control,
body.dark .form-select {
    background: #1e1e1e;
    color: #d4d4d4;
    border-color: #2a2a2a;
}

body.dark .form-control:focus,
body.dark .form-select:focus {
    background: #1e1e1e;
    color: #d4d4d4;
    border-color: #444;
}

body.dark hr { border-color: #222; }

body.dark .text-muted,
body.dark .form-text { color: var(--text-muted) !important; }
body.dark .text-success { color: #4ade80 !important; }
body.dark .text-danger { color: #f87171 !important; }
body.dark .text-warning { color: #fbbf24 !important; }
body.dark .text-primary { color: #e0e0e0 !important; }
body.dark .bg-white { background-color: #161616 !important; }
body.dark .bg-body-tertiary { background-color: #0a0a0a !important; }

body.dark .modal-backdrop.show { background: rgba(0,0,0,.8); }
body.dark .modal-backdrop { background: rgba(0,0,0,.7); }

body.dark .store-elflorido {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
}

body.dark .store-calimax {
    background: linear-gradient(135deg, #ea580c, #c2410c);
    color: white;
}

body.dark .store-bodega {
    background: linear-gradient(135deg, #ca8a04, #a16207);
    color: white;
}

body.dark .grammage-badge {
    background: #1e1e1e;
    color: #aaa;
    border-color: #2a2a2a;
}

body.dark .unit-price {
    color: #22d3ee;
}

body.dark .table-unitprice {
    color: #22d3ee;
}

body.dark .table-grammage {
    color: #777;
}

body.dark .card-meta { color: #aaa; }

/* ===========================
   BRAND
=========================== */

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -.3px;
    line-height: 1.2;
}

.brand-tagline {
    font-size: .7rem;
    color: #94a3b8;
    font-weight: 500;
}

body.dark .brand-name { color: #e0e0e0; }
body.dark .brand-tagline { color: #9a9a9a; }

/* ===========================
   SETTINGS DROPDOWN
=========================== */

.settings-dropdown {
    min-width: 240px;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
}

.settings-section { margin-bottom: 8px; }

.settings-section-title {
    font-size: .72rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 8px;
}

.settings-source-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background .15s;
}
.settings-radio:hover { background: #f1f5f9; }
.settings-radio input:checked + span { color: #3b82f6; }
.settings-radio input { accent-color: #3b82f6; }

body.dark .settings-dropdown {
    background: #161616;
    border-color: #2a2a2a;
    box-shadow: 0 8px 32px rgba(0,0,0,.6);
}

body.dark .settings-section-title { color: #9a9a9a; }

body.dark .settings-radio { color: #aaa; }
body.dark .settings-radio:hover { background: #1e1e1e; }
body.dark .settings-radio input:checked + span { color: #e0e0e0; }
body.dark .settings-radio input { accent-color: #e0e0e0; }

/* ===========================
   SUMMARY BAR - Action Chips
=========================== */

.summary-bar {
    background: white;
    border-radius: var(--radius);
    padding: 12px 20px;
    box-shadow: var(--shadow);
    transition: background .3s;
}

.summary-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.summary-stats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.summary-stat {
    font-size: .78rem;
    font-weight: 600;
    color: #475569;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.summary-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot-elflorido { background: #3b82f6; }
.dot-calimax { background: #f97316; }

.summary-store-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.summary-store-badge.active {
    box-shadow: 0 0 0 2px white, 0 0 0 4px currentColor;
}

body.dark .summary-store-badge.store-elflorido {
    background: transparent;
    color: #60a5fa;
    border-color: #60a5fa;
}
body.dark .summary-store-badge.store-elflorido.active {
    color: white;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-color: transparent;
}

body.dark .summary-store-badge.store-calimax {
    background: transparent;
    color: #fb923c;
    border-color: #fb923c;
}
body.dark .summary-store-badge.store-calimax.active {
    color: white;
    background: linear-gradient(135deg, #f97316, #ea580c);
    border-color: transparent;
}

body.dark .summary-store-badge.store-bodega {
    background: transparent;
    color: #facc15;
    border-color: #facc15;
}
body.dark .summary-store-badge.store-bodega.active {
    color: white;
    background: linear-gradient(135deg, #eab308, #ca8a04);
    border-color: transparent;
}
body.dark .summary-store-badge.store-soriana { color: #fca5a5; border-color: #dc2626; background: transparent; }
body.dark .summary-store-badge.store-soriana.active { color: white; background: #dc2626; border-color: transparent; }
body.dark .summary-store-badge.store-walmart { color: #7dd3fc; border-color: #0ea5e9; background: transparent; }
body.dark .summary-store-badge.store-walmart.active { color: white; background: #0ea5e9; border-color: transparent; }

.summary-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.summary-chip {
    border: 1.5px solid #e2e8f0;
    background: white;
    color: #64748b;
    font-size: .75rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all .15s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    user-select: none;
}

.summary-chip:hover { border-color: #3b82f6; color: #3b82f6; background: #eff6ff; }

.summary-chip.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 2px 6px rgba(59,130,246,.25);
}

.summary-chip-more {
    border: none;
    background: #f1f5f9;
    padding: 5px 8px;
}
.summary-chip-more:hover { background: #e2e8f0; color: #475569; }

.summary-expanded {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.summary-expanded-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.summary-smart {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .78rem;
    background: #fefce8;
    padding: 6px 14px;
    border-radius: 10px;
    border: 1px solid #fde68a;
}

.summary-smart-label {
    font-weight: 700;
    color: #92400e;
    text-transform: uppercase;
    font-size: .65rem;
    letter-spacing: .5px;
}

.summary-smart-name {
    font-weight: 600;
    color: #1e293b;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-smart-price {
    font-weight: 800;
    color: #16a34a;
}

.smart-picks-list {
    width: 100%;
}

.smart-picks-header {
    font-size: .78rem;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.smart-pick-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
    font-size: .78rem;
}

.smart-pick-item:hover {
    background: #f1f5f9;
}

.smart-pick-rank {
    font-weight: 800;
    color: #94a3b8;
    min-width: 24px;
    font-size: .72rem;
}

.smart-pick-name {
    flex: 1;
    font-weight: 600;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===========================
   NOTIFICACIONES (DARK)
   =========================== */
body.dark .notif-alert-ok   { background: #0a1a0a; border-color: #166534; color: #4ade80; }
body.dark .notif-alert-warn { background: #1a1508; border-color: #78501a; color: #fbbf24; }
body.dark .notif-alert-err  { background: #1a0a0a; border-color: #7f1d1d; color: #f87171; }
body.dark .notif-alert code { background: rgba(255,255,255,.1); }
body.dark .notif-hour { background: #1a1a1a; border-color: #333; color: #aaa; }
body.dark .notif-hour.active { background: #3b82f6; border-color: #3b82f6; color: #fff; }
body.dark .notif-preview { color: #888; }
body.dark .notif-item { background: #1a1a1a; border-color: #2a2a2a; }
body.dark .notif-item-name { color: #e5e7eb; }
body.dark .notif-price { color: #f5f5f5; }
body.dark .notif-chip { background: #2a2a2a; color: #bbb; }
body.dark .notif-chip.muted { background: #3f1414; color: #f87171; }
body.dark .notif-hist { background: #1a1a1a; }
body.dark .notif-hist-title { color: #bbb; }
body.dark .notif-rule-editor { background: #141414; border-left-color: #2a2a2a; }
body.dark .notif-store.store-elflorido { background: #14243f; color: #93c5fd; }
body.dark .notif-store.store-calimax  { background: #3a1f0a; color: #fdba74; }
body.dark .notif-store.store-bodega    { background: #3b2f0a; color: #fde047; }
body.dark .notif-store.store-soriana   { background: #450f0f; color: #fca5a5; }
body.dark .notif-store.store-walmart   { background: #0c2a3d; color: #7dd3fc; }
body.dark .notif-promo { background: #3a1f0a; color: #fdba74; }
body.dark .notif-unit { color: #c4b5fd; }


/* ===========================
   PAGINA DE SETTINGS (DARK)
   =========================== */

body.dark .settings-card-hint { color: #9ca3af; }
body.dark .store-toggle {
    background: #121212;
    border-color: #2a2a2a;
}
body.dark .store-toggle:hover { background: #171717; border-color: #3a3a3a; }
body.dark .store-toggle.on {
    background: #10233d;
    border-color: #3b82f6;
    box-shadow: 0 1px 6px rgba(59, 130, 246, .18);
}
body.dark .store-toggle-name { color: #e5e7eb; }
body.dark .store-toggle-desc { color: #9ca3af; }
body.dark .store-toggle-check i {
    background: #1a1a1a;
    border-color: #3f3f46;
}
body.dark .store-toggle-check input:checked + i {
    background: #3b82f6;
    border-color: #3b82f6;
}
body.dark .store-toggle-state.state-live { background: #052e16; color: #86efac; }
body.dark .store-toggle-state.state-pending { background: #3b2f0a; color: #fde047; }
