:root {
  --bg: #f6f8fb;
  --paper: #ffffff;
  --ink: #182338;
  --muted: #62708a;
  --line: #d8deeb;
  --brand: #0ea5a6;
  --brand-2: #0891b2;
  --warn: #f59e0b;
  --danger: #ef4444;
  --good: #16a34a;
  --radius: 14px;
  --shadow: 0 12px 32px rgba(23, 32, 56, 0.11);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  letter-spacing: -0.02em;
}

.muted {
  color: var(--muted);
}

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0f766e;
  background: #ccfbf1;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  padding: 6px 12px;
}

.login-body {
  min-height: 100vh;
  background:
    radial-gradient(1300px 500px at -15% -10%, #cffafe 0, transparent 60%),
    radial-gradient(1000px 600px at 120% 100%, #e0f2fe 0, transparent 60%),
    var(--bg);
}

.login-shell {
  width: min(1120px, 96vw);
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 22px;
  align-items: center;
  padding: 24px;
}

.login-brand {
  padding: 28px;
  animation: fadeSlide 0.7s ease;
}

.login-brand h1 {
  margin-top: 14px;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 0.97;
}

.login-brand p {
  max-width: 530px;
  color: #3f4c63;
  margin-top: 14px;
  line-height: 1.6;
}

.login-points {
  margin-top: 18px;
  padding-left: 18px;
  color: #334155;
  line-height: 1.8;
}

.login-card {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 20px;
  padding: 26px;
  animation: pop 0.6s ease;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  background: #fff;
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid #a5f3fc;
  border-color: var(--brand);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.password-wrap {
  display: flex;
  gap: 8px;
}

.btn-primary,
.btn-ghost {
  border: 0;
  border-radius: 10px;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  padding: 11px 14px;
}

.btn-primary:hover,
.btn-ghost:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.btn-ghost {
  background: #eef2ff;
  color: #334155;
  border: 1px solid #dbe3f8;
  padding: 10px 12px;
}

.btn-ghost.small {
  padding: 6px 9px;
  font-size: 12px;
}

.help-box {
  margin-top: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 10px;
}

.help-box summary {
  cursor: pointer;
  font-weight: 700;
}

.error-text {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.app-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #e2e8f0;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.08);
}

.sidebar-head small {
  display: block;
  color: #94a3b8;
}

.logo-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(130deg, #67e8f9, #14b8a6);
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-item {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.menu-item.active,
.menu-item:hover {
  background: rgba(34, 211, 238, 0.16);
  border-color: rgba(34, 211, 238, 0.35);
  color: #ecfeff;
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  padding-top: 12px;
}

.sidebar-foot p {
  margin: 0 0 8px;
  font-size: 13px;
}

.main-content {
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.topbar h1 {
  font-size: clamp(1.25rem, 2vw, 1.9rem);
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.metric-card h3 {
  font-size: 0.88rem;
  color: #334155;
}

.metric-card p {
  margin: 8px 0 0;
  font-size: 1.65rem;
  font-weight: 800;
  color: #0f172a;
}

.metric-card.small p {
  font-size: 1.35rem;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 8px;
  font-size: 13px;
  text-align: left;
}

th {
  color: #334155;
  background: #f8fafc;
  font-weight: 800;
}

.tag {
  display: inline-block;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 999px;
  font-weight: 700;
}

.tag.bot {
  background: #cffafe;
  color: #115e59;
}

.tag.humano {
  background: #fee2e2;
  color: #b91c1c;
}

.log-box {
  min-height: 360px;
  max-height: 360px;
  overflow: auto;
  margin: 0;
  background: #0b1220;
  color: #dbeafe;
  border-radius: 12px;
  border: 1px solid #1e293b;
  padding: 12px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.section {
  display: none;
}

.section.active {
  display: block;
  animation: fadeSlide 0.4s ease;
}

.separator {
  border-top: 1px solid #e2e8f0;
  margin: 14px 0;
}

.mobile-only {
  display: none;
}

.status-ok {
  color: var(--good);
}

.status-bad {
  color: var(--danger);
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 1150px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    transform: translateX(-102%);
    transition: transform .2s ease;
    z-index: 40;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-only {
    display: inline-block;
  }
}
