/* ============================================================
   ProviAmerica Admin — Design tokens
   Paleta: navy profundo + hilo teal como acento de identidad
   Tipografia: Barlow Condensed (labels/headers), Inter (cuerpo),
   JetBrains Mono (codigo, logs, datos)
   ============================================================ */
:root {
  --bg: #0a0e16;
  --surface: #121826;
  --surface-2: #1a2233;
  --surface-3: #212b3e;
  --border: #263252;
  --border-soft: #1c2538;

  --text: #f3f6fb;
  --text-dim: #97a3ba;
  --text-faint: #5f6c86;

  --accent: #ff002c;        /* rojo ProviAmerica — texto, focus, badges */
  --accent-strong: #ad0724;  /* rojo oscuro — fondos de boton */
  --accent-soft: rgba(255, 0, 44, .12);
  --accent-gradient: linear-gradient(135deg, #ff002c 0%, #ad0724 100%);

  --danger: #ef4b4b;
  --danger-strong: #a82424;
  --danger-soft: rgba(239, 75, 75, .12);

  --warn: #e3a53f;
  --warn-soft: rgba(227, 165, 63, .12);

  --success: #34d399;
  --success-soft: rgba(52, 211, 153, .12);

  --radius: 10px;
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: .01em; }

/* Signature element: "puntada" — linea de division tipo costura */
.stitch {
  height: 1px;
  background-image: repeating-linear-gradient(90deg, var(--border) 0 7px, transparent 7px 12px);
  margin: 12px 0 20px;
}

::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- Login ---------------- */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 900px 500px at 15% 10%, rgba(255,0,44,.08), transparent 60%),
    var(--bg);
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}
.mark { margin-bottom: 20px; text-align: center; }
.login-logo { height: 42px; width: auto; margin-bottom: 14px; }
.mark-line {
  display: block;
  width: 36px;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: 2px;
  margin: 0 auto 10px;
}
.eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
}
.login-card h1 { font-size: 26px; margin-top: 4px; margin-bottom: 6px; }
.lead { color: var(--text-dim); font-size: 13px; margin: 0 0 24px; line-height: 1.5; }

.field-label {
  display: block;
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--text-faint);
  margin-bottom: 6px;
  margin-top: 14px;
}
.login-card input { width: 100%; }
.login-card button { width: 100%; margin-top: 24px; }
.error { color: var(--danger); min-height: 18px; font-size: 13px; margin-top: 10px; margin-bottom: 0; }

/* ---------------- App shell ---------------- */
#app-screen { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
}
.brand { padding: 0 24px 20px; border-bottom: 1px solid var(--border-soft); margin-bottom: 12px; }
.brand-logo { height: 28px; width: auto; margin-bottom: 10px; display: block; }
.brand h1 { font-size: 24px; margin-top: 2px; }
.brand h1 span { color: var(--accent); }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; flex: 1; }
.tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  color: var(--text-dim);
  padding: 11px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
}
.tab-btn:hover { background: var(--surface-2); color: var(--text); }
.tab-btn.active {
  background: var(--surface-2);
  color: var(--text);
  border-left-color: var(--accent);
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-faint); }
.tab-btn.active .nav-icon, .tab-btn:hover .nav-icon { color: var(--accent); }

.sidebar-footer { padding: 12px 12px 0; border-top: 1px solid var(--border-soft); margin-top: 12px; }
.dev-credit { text-align: center; font-size: 11px; color: var(--text-faint); margin: 12px 0 0; letter-spacing: .02em; }

/* ---------------- Content ---------------- */
.content-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}
header h2 { font-size: 22px; }

.pm2-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-dim);
}
.pm2-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); display: inline-block; }
.pm2-pill b { color: var(--text); font-weight: 600; }

main { padding: 28px 32px 60px; max-width: 1180px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 22px;
}
.panel h3 { font-size: 18px; }
.panel h4 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 26px;
  margin-bottom: 10px;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 4px; }
.field { display: flex; flex-direction: column; }

input, select, textarea {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: var(--font-body);
}
input::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

button {
  padding: 9px 16px;
  border-radius: 7px;
  border: none;
  background: var(--accent-gradient);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 13.5px;
  font-family: var(--font-body);
  transition: filter .12s ease;
}
button:hover { filter: brightness(1.12); }
button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
button.ghost:hover { background: var(--surface-2); }
button.small { padding: 6px 11px; font-size: 12px; }
button.full { width: 100%; }
button.danger { background: var(--danger-strong); color: #fff0f0; }

.checkbox-label { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 13px; }
.checkbox-label input { width: auto; }

.callout {
  margin-top: 18px;
  background: var(--accent-soft);
  border: 1px solid rgba(255,0,44,.3);
  border-radius: 8px;
  padding: 14px 16px;
}
.callout p { margin: 0 0 8px; font-size: 13px; color: var(--text-dim); }

table { width: 100%; border-collapse: collapse; margin-top: 4px; }
thead th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-faint);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
  color: var(--text);
}
tbody tr:hover td { background: var(--surface-2); }
#users-table td:nth-child(1),
#recent-table td:nth-child(2),
#changelog-table td:nth-child(3) { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); }

pre {
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
  line-height: 1.6;
}

.warn { color: var(--warn); font-size: 13px; background: var(--warn-soft); border: 1px solid rgba(227,165,63,.3); padding: 10px 14px; border-radius: 8px; margin-top: 0; }
.status-line { color: var(--text-dim); font-size: 13px; font-family: var(--font-mono); }

#code-editor {
  width: 100%;
  height: 440px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre;
  resize: vertical;
  margin-top: 14px;
}

.stats-grid { display: flex; gap: 14px; margin: 4px 0 6px; }
.stat-card {
  flex: 1;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
}
.stat-card span { display: block; font-family: var(--font-display); font-size: 30px; font-weight: 600; color: var(--accent); }
.stat-card label { color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.bar-row .label { width: 210px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 12px; }
.bar-row .track { flex: 1; background: var(--surface-3); border-radius: 6px; height: 8px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--accent); border-radius: 6px; }
.bar-row .count { width: 32px; text-align: right; color: var(--text-dim); font-family: var(--font-mono); font-size: 12px; }

.badge { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.badge.active { background: var(--success-soft); color: var(--success); border: 1px solid rgba(52,211,153,.3); }
.badge.inactive { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(239,75,75,.3); }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  #app-screen { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 12px 16px; overflow-x: auto; }
  .brand { border: none; padding: 0 16px 0 0; margin: 0; }
  .nav { flex-direction: row; padding: 0; }
  .sidebar-footer { border: none; padding: 0 0 0 12px; margin: 0; }
  main { padding: 20px 16px 40px; }
  header { padding: 16px; }
  .stats-grid { flex-direction: column; }
  .bar-row .label { width: 120px; }
}
