/* ============================================================
   Bilingu Management Dashboard — estética app.bilingu.com
   Tokens extraídos del panel real (Plus Jakarta Sans, #6e1ae6).
   ============================================================ */
:root {
  --primary: #6e1ae6;
  --primary-600: #5b13c4;
  --primary-tint: rgba(110, 26, 230, 0.06);
  --primary-tint-strong: rgba(110, 26, 230, 0.12);
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e9edf3;
  --border-strong: #dfe4ec;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --success-bg: #dcfce7;
  --success-fg: #15803d;
  --amber-bg: #fef3c7;
  --amber-fg: #b45309;
  --blue: #3b82f6;
  --violet: #8b5cf6;
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 264px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.08);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px;
}
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #7c3aed, #6e1ae6 60%, #a855f7);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 4px 12px rgba(110, 26, 230, 0.35);
}
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.brand-name b { color: var(--primary); }

.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.nav-group { margin-bottom: 4px; }
.nav-group-title {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px 6px; font-size: 12px; font-weight: 700;
  color: var(--text-2); text-transform: none; letter-spacing: 0;
}
.nav-group-title .count {
  margin-left: auto; background: #f1f5f9; color: var(--muted);
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 2px 0; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; font-size: 14px;
  border: none; background: none; width: 100%; text-align: left;
  transition: background .12s, color .12s;
}
.nav-item .ico { width: 18px; height: 18px; opacity: .8; }
.nav-item:hover { background: #f6f7f9; }
.nav-item.active {
  background: var(--primary-tint);
  color: var(--primary);
  font-weight: 600;
}
.nav-item.active .ico { opacity: 1; }
.nav-item .tag {
  margin-left: auto; font-size: 10px; font-weight: 700; color: var(--muted-2);
  background: #f1f5f9; border-radius: 999px; padding: 1px 7px;
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 12px 16px; display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #6e1ae6);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.sidebar-foot .who { line-height: 1.2; overflow: hidden; }
.sidebar-foot .who b { font-size: 13px; display: block; }
.sidebar-foot .who span { font-size: 12px; color: var(--muted); }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(248, 250, 252, 0.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px;
}
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.crumbs .sep { color: var(--muted-2); }
.crumbs .cur { color: var(--text); font-weight: 600; }
.search {
  margin-left: 8px; flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; color: var(--muted);
}
.search input { border: none; outline: none; background: none; flex: 1; font-size: 14px; color: var(--text); }
.topbar-spacer { flex: 1; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); display: grid; place-items: center; color: var(--muted);
}

.content { padding: 28px; max-width: 1360px; width: 100%; }
.page-head { margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }

/* ---------- Cards / KPIs ---------- */
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(4, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .grid.kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .grid.kpis, .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card.pad { padding: 20px 22px; }
.kpi { padding: 20px 22px; }
.kpi .label { color: var(--muted); font-size: 14px; font-weight: 600; }
.kpi .value { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin-top: 6px; }
.kpi .sub { margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.trend { display: inline-flex; align-items: center; gap: 4px;
  background: var(--success-bg); color: var(--success-fg);
  font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.kpi .bar { margin-top: 14px; height: 8px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
.kpi .bar > span { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--violet)); }

.card-title { font-size: 17px; font-weight: 700; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.legend-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.legend-row:last-child { border-bottom: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-row .n { margin-left: auto; font-weight: 700; }
.legend-row .pct { color: var(--muted); width: 44px; text-align: right; }

/* ---------- Table ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.field {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; color: var(--muted);
}
.field input, .field select { border: none; outline: none; background: none; font-size: 14px; color: var(--text); font-family: inherit; }
.field.grow { flex: 1; min-width: 240px; }
.field.grow input { flex: 1; }
.count-pill { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 600; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary); color: #fff; border: none;
  border-radius: 10px; padding: 9px 16px; font-weight: 600; font-size: 14px;
}
.btn:hover { background: var(--primary-600); }
.btn.ghost { background: var(--card); color: var(--text-2); border: 1px solid var(--border); }
.btn.ghost:hover { background: #f6f7f9; }

.table-wrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data thead th {
  position: sticky; top: 0; background: #fbfcfe; z-index: 1;
  text-align: left; padding: 13px 16px; font-size: 12px; font-weight: 700;
  color: var(--muted); white-space: nowrap; border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
}
table.data thead th:hover { color: var(--primary); }
table.data tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #fafbfe; }
td.name { font-weight: 600; color: var(--text); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td .muted { color: var(--muted-2); }
.badge { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 10px;
  background: var(--primary-tint-strong); color: var(--primary); white-space: nowrap; }
.badge.green { background: var(--success-bg); color: var(--success-fg); }
.linkish { color: var(--primary); font-weight: 600; }
.linkish:hover { text-decoration: underline; }
.empty-cell { color: #cbd5e1; }

.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; color: var(--muted); font-size: 13px; }
.pager .pages { display: flex; gap: 6px; }
.pager button { border: 1px solid var(--border); background: var(--card); border-radius: 8px; padding: 6px 11px; color: var(--text-2); }
.pager button:hover:not(:disabled) { background: #f6f7f9; }
.pager button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager button:disabled { opacity: .5; cursor: default; }

/* ---------- Placeholder sections ---------- */
.placeholder { display: grid; place-items: center; min-height: 320px; text-align: center; color: var(--muted); }
.placeholder .big { font-size: 42px; margin-bottom: 10px; }
.placeholder h3 { margin: 0 0 6px; color: var(--text); font-size: 20px; }

.mt { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.flag { font-size: 15px; }
