/* Dashboard Proyecto Mainumbi 2026 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0a0a0a;
  --sidebar-bg:  #111;
  --surface:     #181818;
  --surface2:    #202020;
  --border:      #252525;
  --border2:     #2e2e2e;
  --yellow:      #f5c518;
  --yellow-dim:  rgba(245,197,24,0.14);
  --yellow-glow: rgba(245,197,24,0.06);
  --blue:        #3b82f6;
  --blue-dim:    rgba(59,130,246,0.14);
  --green:       #22c55e;
  --green-dim:   rgba(34,197,94,0.12);
  --purple:      #a855f7;
  --red:         #ef4444;
  --red-dim:     rgba(239,68,68,0.14);
  --orange:      #f97316;
  --text:        #f0f4f8;
  --text-muted:  #6b7280;
  --text-dim:    #9ca3af;
  --sidebar-w:   228px;
  --radius:      10px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }

/* ── LAYOUT ── */
.layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--border);
}

.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-name { font-weight: 800; font-size: 15px; color: var(--yellow); letter-spacing: 0.08em; }
.brand-sub { font-size: 11px; color: var(--text-muted); }

.nav-list { list-style: none; padding: 10px 8px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 1px;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(245,197,24,0.2); }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sync-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(34,197,94,0.6);
  flex-shrink: 0;
}
.sync-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.sync-date { font-size: 12px; color: var(--text-dim); font-weight: 500; }
@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 6px rgba(34,197,94,0.6); }
  50%      { box-shadow: 0 0 16px rgba(34,197,94,1); transform: scale(1.4); }
}
.sync-dot-pulse { animation: pulse-dot 0.6s ease 3; }

/* ── MAIN ── */
.main { margin-left: var(--sidebar-w); flex: 1; padding: 24px; min-height: 100vh; position: relative; }

/* ── TOPBAR ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 10px;
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; }
.page-title { font-size: 22px; font-weight: 700; }
.page-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-weight: 500;
}
/* ── TOPBAR ACTIONS ── */
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* Botón Actualizar */
.btn-refresh {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  color: #111;
  background: var(--yellow);
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(245,197,24,0.25);
  white-space: nowrap;
}
.btn-refresh:hover  { background: #f0ba05; box-shadow: 0 3px 14px rgba(245,197,24,0.4); }
.btn-refresh:active { opacity: 0.85; }
.btn-refresh:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn-refresh-loading { opacity: 0.8; }

/* Icono giratorio */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.spin { animation: spin 0.8s linear infinite; }

/* Overlay de carga */
.refresh-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10,10,10,0.82);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 200;
  backdrop-filter: blur(3px);
  border-radius: var(--radius);
}
.refresh-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(245,197,24,0.2);
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.refresh-msg { font-size: 15px; font-weight: 600; color: var(--text); }
.refresh-sub { font-size: 12px; color: var(--text-muted); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 11px 18px;
  font-size: 13px;
  color: var(--text);
  max-width: 480px;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast-visible { opacity: 1 !important; transform: translateY(0) !important; }
.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red); }
.toast-info    { border-left: 3px solid var(--blue); }

.sheets-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  background: var(--surface);
  transition: color 0.15s, border-color 0.15s;
}
.sheets-link:hover { color: var(--green); border-color: rgba(34,197,94,0.3); }

/* ── SECTIONS ── */
.section { display: none; }
.section.active { display: block; }

/* ── KPI GRID ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--kpi-color, var(--yellow));
  opacity: 0.7;
}
.kpi-card:hover { border-color: var(--border2); }
.kpi-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.kpi-value { font-size: 25px; font-weight: 700; line-height: 1.1; color: var(--kpi-color, var(--yellow)); }
.kpi-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

.kpi-yellow { --kpi-color: var(--yellow); }
.kpi-blue   { --kpi-color: var(--blue); }
.kpi-green  { --kpi-color: var(--green); }
.kpi-purple { --kpi-color: var(--purple); }
.kpi-red    { --kpi-color: var(--red); }
.kpi-orange { --kpi-color: var(--orange); }

/* ── CHARTS ── */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.chart-card.full { margin-bottom: 12px; }
.chart-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.chart-wrap {
  position: relative;
  height: 220px;
}

/* ── TABLES ── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 24px;
}
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.table-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface2);
  border-radius: 20px;
  padding: 2px 9px;
}
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  background: var(--surface2);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10.5px;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid #1a1a1a; transition: background 0.1s; }
tbody tr:hover { background: var(--surface2); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 9px 12px; color: var(--text-dim); vertical-align: top; }

.td-y  { color: var(--yellow); font-weight: 600; }
.td-b  { color: var(--blue); }
.td-g  { color: var(--green); }
.td-m  { color: #3a3a3a; }
.td-r  { color: var(--red); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.tag-exp  { background: rgba(239,68,68,0.15);  color: #ef4444; }
.tag-eqp  { background: rgba(249,115,22,0.15); color: #f97316; }
.tag-seg  { background: rgba(59,130,246,0.15);  color: #3b82f6; }
.tag-sin  { background: rgba(107,114,128,0.1);  color: #6b7280; }
.tag-mat  { background: rgba(168,85,247,0.15);  color: #a855f7; }
.tag-der  { background: rgba(245,158,11,0.15);  color: #f59e0b; }
.tag-ok   { background: rgba(34,197,94,0.12);   color: #22c55e; }

/* ── PILL ACTIVITIES ── */
.pill {
  display: inline-block;
  margin: 1px 3px 1px 0;
  background: var(--surface2);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--text-dim);
}
.pill .sec { color: #3a4a5a; margin-left: 3px; }

/* ── ERROR ── */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 300px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #252525; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #333; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 14px; }
  .topbar-left { flex-direction: column; align-items: flex-start; gap: 4px; }
}
