/* ==========================================================================
   WYLCO / THE SOUND STORE - DASHBOARD COMERCIAL
   Design System: Impotodo / RacePoint Glassmorphism & High-Contrast Commercial
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg-main: #F8FAFC;
  --bg-card: #FFFFFF;
  --border-color: #E2E8F0;
  --border-hover: #CBD5E1;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --accent-emerald: #10B981;
  --accent-blue: #2563EB;
  --accent-purple: #7C3AED;
  --accent-amber: #F59E0B;
  --accent-rose: #EF4444;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
}

/* ===== CARDS & GLASSMORPHISM (IMPOTODO STYLE) ===== */
.glass-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.hero-card {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  color: #FFFFFF;
}

/* ===== BADGES COMERCIALES ===== */
.badge-green { background-color: #DEF7EC; color: #03543F; border: 1px solid #BCF0DA; }
.badge-red { background-color: #FDE8E8; color: #9B1C1C; border: 1px solid #FBD5D5; }
.badge-blue { background-color: #E1EFFE; color: #1E429F; border: 1px solid #C3DDFD; }
.badge-purple { background-color: #F3E8FF; color: #6B21A8; border: 1px solid #E9D5FF; }
.badge-amber { background-color: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ===== SELECTOR DE PERIODO Y SELECTOR DE METAS (IMPOTODO) ===== */
.period-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.period-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
}

.period-btn:hover {
  background: #F8FAFC;
  color: #0F172A;
  border-color: #CBD5E1;
  transform: translateY(-1px);
}

.period-btn.active {
  background: #0F172A;
  border-color: #0F172A;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}

.period-btn:focus-visible {
  outline: 3px solid rgba(15, 23, 42, 0.14);
  outline-offset: 2px;
}

/* ===== TARJETAS DE TIENDA (TODAY STORE CARD) ===== */
.today-store-card {
  position: relative;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 20px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
}

.today-store-card:hover {
  border-color: #94A3B8;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.today-store-card.active {
  border-color: #10B981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.10), 0 8px 18px rgba(15, 23, 42, 0.08);
}

/* Botón y acordeón de detalle */
.store-card-btn-detail {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid #E2E8F0;
  background: #F8FAFC;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.store-card-btn-detail:hover {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #0F172A;
}

.store-card-btn-detail .chevron {
  transition: transform 0.2s ease;
  font-size: 10px;
}

.store-card-btn-detail.open .chevron {
  transform: rotate(180deg);
}

.store-detail-drawer {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #E2E8F0;
  animation: drawerOpen 0.2s ease-out forwards;
}

.store-detail-drawer.open {
  display: block;
}

@keyframes drawerOpen {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Micro Chips de Canales */
.channel-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  background: #F1F5F9;
  color: #334155;
  border: 1px solid #E2E8F0;
}

.channel-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.channel-chip .dot.piso { background-color: #2563EB; }
.channel-chip .dot.pol { background-color: #0D9488; }
.channel-chip .dot.nc { background-color: #EF4444; }

/* Semáforo de Actividad por Asesor */
.activity-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.activity-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 9px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .035em;
  border: 1px solid transparent;
}

.activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  flex: 0 0 auto;
}
.activity-green { background: #ECFDF5; color: #047857; border-color: #A7F3D0; }
.activity-green .activity-dot { background: #10B981; box-shadow: 0 0 0 3px rgba(16,185,129,.10); }
.activity-yellow { background: #FFFBEB; color: #B45309; border-color: #FDE68A; }
.activity-yellow .activity-dot { background: #F59E0B; box-shadow: 0 0 0 3px rgba(245,158,11,.10); }
.activity-red { background: #FFF1F2; color: #BE123C; border-color: #FECDD3; }
.activity-red .activity-dot { background: #F43F5E; box-shadow: 0 0 0 3px rgba(244,63,94,.10); }

/* Theme Toggle Button */
.theme-toggle {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  color: #64748B;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  background: #F8FAFC;
  color: #0F172A;
  border-color: #CBD5E1;
}

.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .theme-icon-sun { display: none; }

/* Botones genéricos de UI */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: #2563EB;
  color: #FFFFFF;
}
.btn-primary:hover {
  background: #1D4ED8;
}

.btn-outline {
  background: #FFFFFF;
  border-color: #E2E8F0;
  color: #334155;
}
.btn-outline:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
  color: #0F172A;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 8px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.btn-icon:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
}

/* Nav Tabs */
.app-nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748B;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.nav-tab-btn:hover {
  background: #F1F5F9;
  color: #0F172A;
}

.nav-tab-btn.active {
  background: #0F172A;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

/* Tab Content Visibility */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* Formularios y Inputs */
.form-input, .form-select {
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  background: #FFFFFF;
  color: #0F172A;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-select:focus {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Tablas de Datos */
.table-card {
  border-radius: 16px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.data-table th {
  background-color: #F8FAFC;
  color: #64748B;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  border-bottom: 1px solid #E2E8F0;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #F1F5F9;
  color: #1E293B;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: #F8FAFC;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Sub-Tablas para el Drawer de Tienda */
.store-sub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.store-sub-table th {
  background: #F8FAFC;
  color: #64748B;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  padding: 6px 10px;
  border-bottom: 1px solid #E2E8F0;
}

.store-sub-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #F1F5F9;
  color: #334155;
}

.store-sub-table tbody tr:last-child td {
  border-bottom: none;
}

/* Modales */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

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

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
  color: #0F172A;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: #94A3B8;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: #0F172A; }

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid #E2E8F0;
  background: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Spinner */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(0, 0, 0, 0.08);
  border-top-color: #2563EB;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  color: #64748B;
  font-size: 13px;
  font-weight: 600;
}

/* ==========================================================================
   ADMINISTRACIÓN Y SUB-VISTAS
   ========================================================================== */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: flex-start;
}

.admin-sidebar {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.admin-nav-item {
  background: transparent;
  border: none;
  border-radius: 10px;
  color: #64748B;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-nav-item:hover {
  background: #F1F5F9;
  color: #0F172A;
}

.admin-nav-item.active {
  background: #2563EB;
  color: #FFFFFF;
}

.admin-view {
  display: none;
}
.admin-view.active {
  display: block;
}

.audit-json-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 6px 8px;
  font-family: monospace;
  font-size: 11px;
  color: #475569;
  max-width: 260px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ==========================================================================
   RAX AI CHAT VIEWPORT
   ========================================================================== */
.chat-container {
  display: flex;
  flex-direction: column;
  background-color: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  min-height: 560px;
  overflow: hidden;
}

.messages-viewport {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-bubble {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}

.message-bubble.user {
  align-self: flex-end;
  background-color: #2563EB;
  color: #FFFFFF;
}

.message-bubble.assistant {
  align-self: flex-start;
  background-color: #F1F5F9;
  border: 1px solid #E2E8F0;
  color: #0F172A;
}

.input-section {
  padding: 14px 20px;
  background-color: #F8FAFC;
  border-top: 1px solid #E2E8F0;
}

.input-container {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 12px;
  padding: 6px 12px;
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 14px;
  color: #0F172A;
  resize: none;
}

.send-btn {
  background: #2563EB;
  border: none;
  border-radius: 8px;
  color: #FFFFFF;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   MODO OSCURO (HTML.DARK) - FIDELIDAD IMPOTODO
   ========================================================================== */
html.dark {
  color-scheme: dark;
  background: #07111F;
}

html.dark body {
  background: #0B1220 !important;
  color: #E5E7EB !important;
}

html.dark .glass-card {
  background: #111827 !important;
  border-color: #263244 !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24) !important;
}

html.dark .hero-card {
  background: linear-gradient(135deg, #0A1322 0%, #111C2E 100%) !important;
  border: 1px solid #263244;
}

html.dark .today-store-card {
  background: #111827 !important;
  border-color: #263244 !important;
}

html.dark .today-store-card:hover {
  background: #162033 !important;
  border-color: #3A475B !important;
}

html.dark .today-store-card.active {
  background: #162033 !important;
  border-color: #10B981 !important;
}

html.dark .store-detail-drawer {
  border-color: #263244 !important;
}

html.dark .store-card-btn-detail {
  background: #1E293B !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}

html.dark .store-card-btn-detail:hover {
  background: #334155 !important;
  color: #FFFFFF !important;
}

html.dark .period-switcher {
  background: #0F172A !important;
  border-color: #263244 !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.20) !important;
}

html.dark .period-btn {
  background: #111827 !important;
  color: #AEBBD0 !important;
  border-color: #263244 !important;
}

html.dark .period-btn:hover {
  background: #182234 !important;
  color: #F8FAFC !important;
  border-color: #3A475B !important;
}

html.dark .period-btn.active {
  background: #1B2638 !important;
  color: #FFFFFF !important;
  border-color: #64748B !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.30) !important;
}

html.dark .channel-chip {
  background: #1E293B !important;
  border-color: #334155 !important;
  color: #CBD5E1 !important;
}

html.dark .theme-toggle {
  background: #111827 !important;
  color: #94A3B8 !important;
  border-color: #263244 !important;
  box-shadow: 0 3px 12px rgba(0,0,0,.22);
}

html.dark .theme-toggle:hover {
  background: #182234 !important;
  color: #F8FAFC !important;
  border-color: #3A475B !important;
}

html.dark .theme-toggle .theme-icon-moon { display: none; }
html.dark .theme-toggle .theme-icon-sun { display: block; }

html.dark .form-input,
html.dark .form-select {
  background: #111827 !important;
  color: #E5E7EB !important;
  border-color: #3A475B !important;
}

html.dark .table-card {
  background: #111827 !important;
  border-color: #263244 !important;
}

html.dark .data-table th,
html.dark .store-sub-table th {
  background: #182234 !important;
  color: #94A3B8 !important;
  border-color: #263244 !important;
}

html.dark .data-table td,
html.dark .store-sub-table td {
  border-color: #263244 !important;
  color: #E2E8F0 !important;
}

html.dark .data-table tbody tr:hover {
  background: #162033 !important;
}

html.dark .modal-card {
  background: #111827 !important;
  border-color: #263244 !important;
}

html.dark .modal-header,
html.dark .modal-footer {
  background: #0F172A !important;
  border-color: #263244 !important;
}

html.dark .modal-title {
  color: #FFFFFF !important;
}

html.dark .admin-sidebar {
  background: #111827 !important;
  border-color: #263244 !important;
}

html.dark .admin-nav-item {
  color: #94A3B8 !important;
}

html.dark .admin-nav-item:hover {
  background: #182234 !important;
  color: #FFFFFF !important;
}

html.dark .audit-json-box {
  background: #0B0F17 !important;
  border-color: #263244 !important;
  color: #94A3B8 !important;
}

html.dark .chat-container {
  background: #111827 !important;
  border-color: #263244 !important;
}

html.dark .message-bubble.assistant {
  background: #1E293B !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}

html.dark .input-section {
  background: #0F172A !important;
  border-color: #263244 !important;
}

html.dark .input-container {
  background: #111827 !important;
  border-color: #3A475B !important;
}

html.dark .chat-input {
  color: #FFFFFF !important;
}

html.dark .btn-outline {
  background: #111827 !important;
  border-color: #263244 !important;
  color: #CBD5E1 !important;
}
html.dark .btn-outline:hover {
  background: #182234 !important;
  color: #FFFFFF !important;
  border-color: #3A475B !important;
}

html.dark .btn-icon {
  background: #111827 !important;
  border-color: #263244 !important;
  color: #CBD5E1 !important;
}

/* ==========================================================================
   RESPONSIVIDAD Y AJUSTES MÓVILES (390PX Y MENORES)
   ========================================================================== */
@media (max-width: 1024px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    flex-direction: row;
    overflow-x: auto;
  }
  .admin-nav-item {
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  body {
    padding: 12px !important;
  }
  .period-switcher {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }
  .period-btn {
    flex: 0 0 auto;
    padding: 5px 10px;
    font-size: 11px;
  }
  .theme-toggle {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table {
    min-width: 640px;
  }
}


/* ===== BADGES GENÉRICOS (tablas de vendedores / ranking) ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 9999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge-info { background-color: #E1EFFE; color: #1E429F; border: 1px solid #C3DDFD; }
.badge-teal { background-color: #D5F5F6; color: #036672; border: 1px solid #AFECEF; }
.badge-neutral { background-color: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; }
.badge-warning { background-color: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.badge-success { background-color: #DEF7EC; color: #03543F; border: 1px solid #BCF0DA; }
.badge-danger { background-color: #FDE8E8; color: #9B1C1C; border: 1px solid #FBD5D5; }

/* ===== TABLA RANKING DE TIENDAS ===== */
.rank-table th.sortable { cursor: pointer; user-select: none; }
.rank-table th.sortable:hover { color: #2563EB; }
.rank-table th.sorted { color: #2563EB; }
.rank-table td.num, .rank-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-table tbody tr { cursor: pointer; }
.rank-table tfoot td { font-weight: 800; border-top: 2px solid #CBD5E1; background: #F8FAFC; padding: 10px 14px; }
.rank-pos { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 9999px; font-size: 11px; font-weight: 800; background: #F1F5F9; color: #334155; }
.rank-pos.top { background: #DBEAFE; color: #1E40AF; }
.rank-move-up { color: #059669; font-size: 10px; font-weight: 800; }
.rank-move-down { color: #DC2626; font-size: 10px; font-weight: 800; }
.rank-bar { width: 90px; height: 6px; border-radius: 9999px; background: #E2E8F0; overflow: hidden; display: inline-block; vertical-align: middle; position: relative; }
.rank-bar > span { display: block; height: 100%; border-radius: 9999px; }
.rank-bar > i { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #0F172A; opacity: .55; }
.tier-chip { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 5px; font-size: 10px; font-weight: 800; background: #F1F5F9; color: #94A3B8; margin-right: 2px; }
.tier-chip.on { background: #10B981; color: #FFFFFF; }
.last-inv { font-size: 11px; font-weight: 700; white-space: nowrap; }
.last-inv.fresh { color: #059669; }
.last-inv.warn { color: #D97706; }
.last-inv.stale { color: #DC2626; }
.last-inv.none { color: #94A3B8; }
html.dark .rank-table tfoot td { background: #0F172A; border-top-color: #334155; }
html.dark .rank-pos, html.dark .tier-chip { background: #1E293B; color: #CBD5E1; }
html.dark .tier-chip.on { background: #10B981; color: #FFFFFF; }
html.dark .rank-bar { background: #334155; }
html.dark .rank-bar > i { background: #F8FAFC; }
html.dark .badge-neutral { background-color: #1E293B; color: #CBD5E1; border-color: #334155; }


/* ===== PRIMERA PLANA: VENTAS DE HOY ===== */
.today-total-card { background: linear-gradient(160deg, #0F172A 0%, #1E293B 100%); color: #FFFFFF; box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18); }
.today-pill { background: rgba(16, 185, 129, 0.18); color: #6EE7B7; border: 1px solid rgba(16, 185, 129, 0.35); border-radius: 9999px; padding: 2px 9px; font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.today-strip { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
.today-strip::-webkit-scrollbar { height: 6px; }
.today-strip::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 9999px; }
.today-mini { flex: 0 0 230px; scroll-snap-align: start; border: 1px solid #E2E8F0; border-radius: 14px; padding: 12px; background: #F8FAFC; display: flex; flex-direction: column; gap: 6px; cursor: pointer; user-select: none; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.today-mini:hover { border-color: #94A3B8; box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.08); transform: translateY(-1px); }
.today-mini.zero { opacity: .55; }
.today-mini .tm-name { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #64748B; text-align: center; display: flex; align-items: center; justify-content: center; gap: 4px; }
.today-mini .tm-chevron { display: inline-block; transition: transform 0.2s ease; font-size: 10px; color: #94A3B8; }
.today-mini:hover .tm-chevron { color: #2563EB; }
.today-mini.collapsed .tm-chevron { transform: rotate(-90deg); }
.today-mini .tm-amt { font-size: 18px; font-weight: 900; color: #0F172A; text-align: center; font-variant-numeric: tabular-nums; }
.today-mini .tm-tkts { align-self: center; font-size: 10px; font-weight: 700; color: #047857; background: #D1FAE5; border-radius: 9999px; padding: 1px 8px; }
.today-mini .tm-detail { display: flex; flex-direction: column; gap: 6px; }
.today-mini.collapsed .tm-detail { display: none !important; }
.today-mini .tm-who { font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #94A3B8; border-top: 1px solid #E2E8F0; padding-top: 6px; }
.today-mini .tm-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11px; }
.today-mini .tm-row .tm-acc { display: flex; flex-direction: column; min-width: 0; }
.today-mini .tm-row .tm-acc b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #1E293B; }
.today-mini .tm-row .tm-val { font-weight: 800; color: #0F172A; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.tm-ch { display: inline-flex; align-items: center; gap: 2px; font-size: 9px; font-weight: 800; border-radius: 6px; padding: 0 5px; width: fit-content; }
.tm-ch.piso { background: #DBEAFE; color: #1E40AF; }
.tm-ch.pol { background: #CCFBF1; color: #0F766E; }
.tm-ch.otro { background: #FEF3C7; color: #92400E; }
.tm-goal { font-size: 10px; color: #64748B; }
.tm-goal .bar { height: 4px; border-radius: 9999px; background: #E2E8F0; overflow: hidden; margin-top: 2px; }
.tm-goal .bar > span { display: block; height: 100%; border-radius: 9999px; }
html.dark .today-mini { background: #0F172A; border-color: #334155; }
html.dark .today-mini:hover { border-color: #64748B; box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.35); }
html.dark .today-mini:hover .tm-chevron { color: #60A5FA; }
html.dark .today-mini .tm-amt, html.dark .today-mini .tm-row .tm-val, html.dark .today-mini .tm-row .tm-acc b { color: #F1F5F9; }
html.dark .today-mini .tm-who { border-top-color: #334155; }
html.dark .tm-goal .bar { background: #334155; }


/* Ventas de hoy: cuadrícula sin scroll (12 tiendas en 2 filas en pantalla ancha) */
.today-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .today-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .today-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .today-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.today-grid .today-mini { flex: none; padding: 10px; gap: 5px; min-width: 0; }
.today-grid .today-mini .tm-amt { font-size: 16px; }
.today-grid .today-mini .tm-row { font-size: 10.5px; }
.today-grid .today-mini .tm-row .tm-val { font-size: 10.5px; }


/* Ventas de hoy: total a la izquierda (estira a la altura de las 2 filas) + tiendas a la derecha */
.today-layout { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: stretch; }
@media (min-width: 1024px) { .today-layout { grid-template-columns: 250px minmax(0, 1fr); } }
@media (min-width: 1024px) { .today-layout .today-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .today-layout .today-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.today-layout .today-mini .tm-amt { font-size: 15px; }
.today-layout .today-mini .tm-name { font-size: 10px; }
.today-layout .today-mini .tm-goal { font-size: 9.5px; }

@media (min-width: 1024px) { .today-layout { grid-template-columns: 270px minmax(0, 1fr); } }

/* ===== Ventas por hora / Ventas de la semana ===== */
.chart-box { position: relative; width: 100%; overflow: hidden; }
.chart-box svg { display: block; font-family: inherit; }
.week-cards { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .week-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 520px) { .week-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.week-card { border: 1px solid #E2E8F0; border-radius: 12px; padding: 10px 8px; text-align: center; background: #fff; }
.week-card .wc-day { font-size: 10px; font-weight: 800; letter-spacing: .04em; color: #475569; }
.week-card .wc-date { font-size: 10px; color: #94A3B8; margin-bottom: 4px; }
.week-card .wc-amt { font-size: 15px; font-weight: 800; color: #059669; white-space: nowrap; }
.week-card .wc-cnt { font-size: 10px; color: #94A3B8; margin-top: 2px; }
.week-card.today { border-color: #F6AD45; background: #FFFBEB; box-shadow: 0 0 0 1px #F6AD45 inset; }
.week-card.today .wc-day { color: #C2410C; }
.week-card.today .wc-amt { color: #C2410C; }
.week-card.future { opacity: .45; background: #F8FAFC; }
.week-card.future .wc-amt { color: #94A3B8; }
.dark .week-card { background: rgba(15, 23, 42, .6); border-color: #334155; }
.dark .week-card.today { background: rgba(246, 173, 69, .12); }
.dark .week-card .wc-day { color: #CBD5E1; }
