:root {
  --brand: #185FA5;
  --brand-light: #378ADD;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-soft: #475569;
  --text-mute: #94a3b8;
  --success: #1D9E75;
  --warning: #EF9F27;
  --danger: #D85A30;
  --radius: 12px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

html.dark {
  --bg: #0A0A0B;
  --bg-soft: rgba(255,255,255,0.02);
  --card: rgba(255,255,255,0.02);
  --border: rgba(255,255,255,0.08);
  --text: #EDEDED;
  --text-soft: #B0B0B8;
  --text-mute: #888890;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

a { color: var(--brand-light); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 460px; margin: 0 auto; padding: 0 1.5rem; }

/* ====== NAV ====== */
.nav {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 50;
}
.nav-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 1.5rem;
  height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); }
.nav-logo img { height: 30px; width: auto; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { color: var(--text-soft); font-size: 0.9rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--brand-light); font-weight: 500; }

/* ====== BOTONES ====== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.6rem 1.1rem; border-radius: 8px; font-size: 0.9rem; font-weight: 500;
  border: 1px solid transparent; cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-light); text-decoration: none; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text-mute); text-decoration: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

/* ====== CARDS ====== */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.card + .card { margin-top: 1rem; }

/* ====== FORMS ====== */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; margin-bottom: 0.35rem; color: var(--text-soft); }
.form-control {
  width: 100%; padding: 0.6rem 0.8rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg); color: var(--text);
  font-size: 0.9rem; font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--brand-light); }

/* ====== TABLAS ====== */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.table th { font-weight: 500; color: var(--text-soft); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* ====== BADGES ====== */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 500; }
.badge-success { background: rgba(29,158,117,0.15); color: var(--success); }
.badge-warning { background: rgba(239,159,39,0.15); color: var(--warning); }
.badge-danger { background: rgba(216,90,48,0.15); color: var(--danger); }
.badge-mute { background: var(--bg-soft); color: var(--text-mute); }

/* ====== LAYOUT DASHBOARD ====== */
.dash { display: grid; grid-template-columns: 240px 1fr; gap: 2rem; padding: 2rem 0; }
.sidebar { display: flex; flex-direction: column; gap: 0.25rem; }
.sidebar a {
  padding: 0.6rem 0.9rem; border-radius: 8px; color: var(--text-soft); font-size: 0.9rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.sidebar a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.sidebar a.active { background: var(--brand); color: #fff; }
@media (max-width: 768px) {
  .dash { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; }
}

/* ====== STATS ====== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.stat-value { font-size: 1.8rem; font-weight: 600; }
.stat-label { font-size: 0.8rem; color: var(--text-mute); margin-top: 0.25rem; }

/* ====== ALERTS ====== */
.alert { padding: 0.8rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-info { background: rgba(55,138,221,0.12); color: var(--brand-light); }
.alert-success { background: rgba(29,158,117,0.12); color: var(--success); }
.alert-danger { background: rgba(216,90,48,0.12); color: var(--danger); }

/* ====== AUTH PAGES ====== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 0; }
.auth-card { width: 100%; max-width: 420px; }
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo img { height: 40px; }

/* ====== HELPERS ====== */
.text-mute { color: var(--text-mute); }
.text-soft { color: var(--text-soft); }
.text-sm { font-size: 0.85rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; }
h1 { font-size: 1.6rem; font-weight: 600; } h2 { font-size: 1.2rem; font-weight: 600; }
.page-title { margin-bottom: 1.5rem; }

/* ====== THEME TOGGLE ====== */
.theme-toggle { background: none; border: none; cursor: pointer; color: var(--text-soft); padding: 0.4rem; border-radius: 8px; display: flex; }
.theme-toggle:hover { background: var(--bg-soft); }
.theme-toggle .sun { display: none; }
html.dark .theme-toggle .sun { display: block; }
html.dark .theme-toggle .moon { display: none; }
