/* ============================================
   SundayTec 4.0 — Sistema de Diseño Compartido
   ============================================
   Paleta: Dorado (primario) + Cyan (secundario)
   Fuente: IBM Plex Sans + IBM Plex Mono
   ============================================ */

/* ── Google Fonts ─────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ── Variables Globales ───────────────────── */
:root {
  /* Backgrounds */
  --bg: #ede9e2;
  --surface: #fbfaf7;
  --surface2: #e2ddd2;
  --surface3: #e2ddd2;
  --border: #e2ddd2;
  --border-hover: #e2ddd2;

  /* Texto */
  --text: #2a2622;
  --text2: #6e675e;
  --text3: #9a9389;

  /* Acento primario: Dorado */
  --gold: #9a7b4f;
  --gold-dim: rgba(240, 180, 41, 0.15);
  --gold-hover: #9a7b4f;
  --gold-text: #9a7b4f;

  /* Acento secundario: Cyan */
  --cyan: #9a7b4f;
  --cyan-dim: rgba(154,123,79, 0.12);
  --cyan-hover: #b79a6e;
  --cyan-text: #9a7b4f;

  /* Semánticos */
  --green: #5e8b6f;
  --green-dim: rgba(52, 211, 153, 0.12);
  --red: #b5524a;
  --red-dim: rgba(248, 113, 113, 0.12);
  --amber: #9a7b4f;
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.12);
  --pink: #f472b6;

  /* Tipografía */
  --font: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Consolas', monospace;

  /* Bordes y sombras */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 2px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);

  /* Transiciones */
  --transition: 0.2s ease;
}

/* ── Reset Base ───────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Links ────────────────────────────────── */
a { color: var(--cyan-text); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--cyan-hover); }

/* ============================================
   NAVBAR GLOBAL
   ============================================ */
.st-navbar {
  background: linear-gradient(135deg, #fbfaf7, #fbfaf7);
  border-bottom: 1px solid var(--border);
  padding: 0 34px;
  display: flex;
  align-items: center;
  height: 68px;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(12px);
}

.st-navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-right: 32px;
  flex-shrink: 0;
}

.st-navbar-logo svg {
  width: 39px;
  height: 39px;
}

.st-navbar-logo span {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold), var(--gold-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.st-navbar-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
}

.st-navbar-links::-webkit-scrollbar { height: 0; }

.st-nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 17px;
  font-weight: 500;
  color: var(--text2);
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.st-nav-link:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}

.st-nav-link.active {
  background: var(--gold-dim);
  color: var(--gold-text);
  border-color: rgba(240, 180, 41, 0.25);
}

.st-nav-link .nav-icon {
  font-size: 20px;
}

.st-navbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.st-navbar-user .user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 1px solid rgba(240, 180, 41, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--gold-text);
}

/* Mobile navbar */
@media (max-width: 768px) {
  .st-navbar { padding: 0 17px; height: 60px; }
  .st-navbar-logo span { display: none; }
  .st-nav-link { padding: 8px 14px; font-size: 15px; }
  .st-nav-link .nav-label { display: none; }
}

/* ============================================
   COMPONENTES COMPARTIDOS
   ============================================ */

/* ── Cards ────────────────────────────────── */
.st-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}

.st-card:hover {
  border-color: var(--border-hover);
}

.st-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.st-card-header h3 {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}

.st-card-body {
  padding: 16px 20px;
}

/* ── Badges ───────────────────────────────── */
.st-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.st-badge-gold { background: var(--gold-dim); color: var(--gold-text); }
.st-badge-cyan { background: var(--cyan-dim); color: var(--cyan-text); }
.st-badge-green { background: var(--green-dim); color: var(--green); }
.st-badge-red { background: var(--red-dim); color: var(--red); }
.st-badge-purple { background: var(--purple-dim); color: var(--purple); }

/* ── Tablas ───────────────────────────────── */
.st-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.st-table thead th {
  background: var(--surface2);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.st-table tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.st-table tbody tr:hover td {
  background: var(--surface2);
}

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

/* Alineación numérica */
.st-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.st-table .pos { color: var(--green); }
.st-table .neg { color: var(--red); }

/* ── Botones ──────────────────────────────── */
.st-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.st-btn-gold {
  background: var(--gold);
  color: #ede9e2;
  border-color: var(--gold);
}
.st-btn-gold:hover { background: var(--gold-hover); }

.st-btn-outline {
  background: transparent;
  color: var(--text2);
  border-color: var(--border);
}
.st-btn-outline:hover { border-color: var(--gold); color: var(--gold-text); }

.st-btn-cyan {
  background: var(--cyan);
  color: #ede9e2;
  border-color: var(--cyan);
}
.st-btn-cyan:hover { background: var(--cyan-hover); }

.st-btn-sm { padding: 5px 10px; font-size: 11px; }

/* ── Inputs ───────────────────────────────── */
.st-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

.st-input:focus { border-color: var(--gold); }
.st-input::placeholder { color: var(--text3); }

.st-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

.st-select:focus { border-color: var(--gold); }

/* ── Tabs ─────────────────────────────────── */
.st-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  overflow-x: auto;
}

.st-tab {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  border: none;
  background: none;
  font-family: var(--font);
}

.st-tab:hover { color: var(--text); background: var(--surface2); }
.st-tab.active { background: var(--gold-dim); color: var(--gold-text); font-weight: 600; }

/* ── KPI Cards ────────────────────────────── */
.st-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.st-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: border-color var(--transition);
}

.st-kpi:hover { border-color: var(--border-hover); }

.st-kpi-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text2);
  margin-bottom: 6px;
}

.st-kpi-value {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.st-kpi-sub {
  font-size: 11px;
  color: var(--text2);
  margin-top: 4px;
}

/* ── Layout helpers ───────────────────────── */
.st-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 24px;
}

.st-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.st-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.st-flex { display: flex; }
.st-flex-center { display: flex; align-items: center; }
.st-gap-sm { gap: 8px; }
.st-gap { gap: 16px; }
.st-gap-lg { gap: 24px; }

@media (max-width: 768px) {
  .st-grid-2, .st-grid-3 { grid-template-columns: 1fr; }
  .st-container { padding: 16px; }
  .st-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Sidebar Layout ───────────────────────── */
.st-layout-sidebar {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: calc(100vh - 52px);
}

.st-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  overflow-y: auto;
}

.st-sidebar-section {
  padding: 0 16px;
  margin-bottom: 16px;
}

.st-sidebar-title {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  padding: 0 4px;
  margin-bottom: 8px;
}

.st-sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.st-sidebar-item:hover { background: var(--surface2); color: var(--text); }
.st-sidebar-item.active { background: var(--gold-dim); color: var(--gold-text); }

.st-main {
  padding: 20px 24px;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .st-layout-sidebar { grid-template-columns: 1fr; }
  .st-sidebar { display: none; }
  .st-main { padding: 16px; }
}

/* ── Tooltips ─────────────────────────────── */
.st-tooltip {
  position: relative;
}

.st-tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface3);
  color: var(--text);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  box-shadow: var(--shadow);
}

.st-tooltip:hover::after { opacity: 1; }

/* ── Loading ──────────────────────────────── */
.st-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: st-spin 0.6s linear infinite;
}

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

/* ── Page title ───────────────────────────── */
.st-page-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.st-page-subtitle {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 20px;
}

/* ── Charts area ──────────────────────────── */
.st-chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

/* ── Utility ──────────────────────────────── */
.text-gold { color: var(--gold-text); }
.text-cyan { color: var(--cyan-text); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text2); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.mt-sm { margin-top: 8px; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb { margin-bottom: 16px; }
.hidden { display: none !important; }
