/* ─────────────────────────────────────────────────────────
   AGENTIK MVP — shared stylesheet
   Paleta: --brand (primario), --ink (fondo dark), --muted, --good, --warn, --bad
   ───────────────────────────────────────────────────────── */
:root {
  --brand: #00e5a0;
  --brand-dark: #00b880;
  --ink: #050810;
  --ink-2: #0d1220;
  --ink-3: #141a2c;
  --line: #1f2640;
  --text: #e9edf5;
  --muted: #7b8499;
  --good: #00e5a0;
  --warn: #f5c542;
  --bad: #ff5c6b;
  --radius: 10px;
  --shadow: 0 6px 22px rgba(0,0,0,.35);
  --card: #0f1526;
}

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

body {
  background: var(--ink);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* Layout con sidebar */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink-2);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.sidebar .brand .logo {
  width: 32px; height: 32px;
  background: var(--brand); color: var(--ink);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 20px;
}
.sidebar .brand .name { font-weight: 700; font-size: 16px; }
.sidebar .brand .tag { font-size: 10px; color: var(--muted); letter-spacing: 1.5px; }

.sidebar a.nav {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--text); font-weight: 500;
}
.sidebar a.nav:hover { background: var(--ink-3); text-decoration: none; }
.sidebar a.nav.active { background: var(--ink-3); color: var(--brand); }
.sidebar .user {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* Main */
.main { padding: 24px 32px; overflow-x: auto; }
.main header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.main h1 { font-size: 24px; font-weight: 700; }
.main h2 { font-size: 18px; font-weight: 600; margin: 20px 0 12px; }

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.card .value { font-size: 28px; font-weight: 800; color: var(--brand); }
.card .delta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.card.kpi { cursor: default; }

/* Tables */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { background: var(--ink-3); font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: 1px; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody tr:last-child td { border-bottom: none; }

/* Badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.badge.good  { background: rgba(0,229,160,0.15); color: var(--good); }
.badge.warn  { background: rgba(245,197,66,0.15); color: var(--warn); }
.badge.bad   { background: rgba(255,92,107,0.15); color: var(--bad); }
.badge.muted { background: rgba(123,132,153,0.15); color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 13px;
  border: 1px solid transparent; cursor: pointer; transition: all .12s ease;
}
.btn.primary { background: var(--brand); color: var(--ink); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--ink-3); }
.btn.danger { background: var(--bad); color: #fff; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Forms */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  background: var(--ink-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); }
textarea { resize: vertical; min-height: 80px; }

/* Login */
.login-box {
  max-width: 400px;
  margin: 10vh auto;
  padding: 32px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.login-box h1 { text-align: center; margin-bottom: 24px; color: var(--brand); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.alert.info { background: rgba(0,229,160,0.08); border-left: 3px solid var(--brand); }
.alert.warn { background: rgba(245,197,66,0.1); border-left: 3px solid var(--warn); }
.alert.err  { background: rgba(255,92,107,0.1); border-left: 3px solid var(--bad); }

/* Utility */
.row { display: flex; gap: 12px; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.mono { font-family: 'JetBrains Mono', Menlo, Consolas, monospace; font-size: 12px; }
.hidden { display: none !important; }
.pill { background: var(--ink-3); padding: 3px 9px; border-radius: 999px; font-size: 11px; color: var(--muted); }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; font-size: 13px; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Agents grid */
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.agent-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color .15s ease, transform .15s ease;
  cursor: pointer;
}
.agent-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.agent-card .avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: var(--ink); font-weight: 800; font-size: 18px;
  margin-bottom: 10px;
}
.agent-card h3 { font-size: 16px; margin-bottom: 2px; }
.agent-card .role { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.agent-card .desc { font-size: 12px; color: var(--text); margin-bottom: 10px; line-height: 1.4; }
.agent-card .meta { display: flex; gap: 6px; flex-wrap: wrap; }

/* Responsive */
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 16px; }
}
