@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg: #f0f4f9;
  --card: #ffffff;
  --line: #d6e1ef;
  --ink: #0d1926;
  --muted: #5a6d86;
  --primary: #1e5eff;
  --primary-2: #0f3ea8;
  --ok: #16884f;
  --ok-bg: #e8f7ef;
  --ok-border: #9fd8bc;
  --warn: #c07a07;
  --warn-bg: #fff8eb;
  --warn-border: #f3d29c;
  --error: #be3c36;
  --error-bg: #fff0ee;
  --error-border: #f0b2a7;
  --shadow-sm: 0 1px 3px rgba(13,25,38,0.07), 0 1px 2px rgba(13,25,38,0.04);
  --shadow-md: 0 4px 16px rgba(13,25,38,0.09), 0 2px 6px rgba(13,25,38,0.05);
  --shadow-lg: 0 8px 32px rgba(13,25,38,0.12), 0 4px 12px rgba(13,25,38,0.07);
  --radius: 14px;
  --spring: 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

body {
  font-family: 'Outfit', 'Segoe UI', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 85% 0%, rgba(30,94,255,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 10% 90%, rgba(22,136,79,0.06) 0%, transparent 45%),
    var(--bg);
  min-height: 100vh;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
  display: grid;
  gap: 16px;
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #081b38 0%, #0f2f65 55%, #1e5eff 100%);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: 0 8px 32px rgba(30,94,255,0.20), var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,0.07) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30px; left: 30%;
  width: 300px; height: 100px;
  background: radial-gradient(ellipse, rgba(30,94,255,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-head {
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.hero-logo {
  width: 120px;
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.25));
}

.hero-copy { min-width: 0; }

.hero h1 {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  margin: 0;
}

.hero p {
  margin: 4px 0 0;
  font-size: 14px;
  color: rgba(255,255,255,0.72);
  font-weight: 400;
}

.hero-meta {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.meta {
  font-size: 12px;
  color: rgba(255,255,255,0.60);
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 250ms ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Buttons ───────────────────────────────────────────────── */
button {
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--spring), box-shadow 200ms ease, filter 150ms ease;
  will-change: transform;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30,94,255,0.30);
  filter: brightness(1.06);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
  transition-duration: 80ms;
}

button.secondary {
  background: #eef2fa;
  border-color: #cdd8ec;
  color: #2a4a7f;
}

button.secondary:hover:not(:disabled) {
  box-shadow: 0 4px 14px rgba(30,63,168,0.14);
  background: #e8eef8;
}

/* Amber — acciones de mantenimiento (SSL repair, nginx repair) */
button.warning {
  background: linear-gradient(135deg, #e69d0a, #c07a07);
  color: #fff;
}

button.warning:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(192,122,7,0.35);
  filter: brightness(1.08);
}

/* Rojo — acciones críticas / destructivas (restart) */
button.danger {
  background: linear-gradient(135deg, #d14040, #a82e2e);
  color: #fff;
}

button.danger:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(209,64,64,0.38);
  filter: brightness(1.08);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  filter: none !important;
}

.ui-select {
  height: 34px;
  border: 1px solid #cdd8ec;
  border-radius: 8px;
  background: #f8faff;
  color: #1b3f74;
  padding: 0 10px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.ui-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,94,255,0.12);
}

/* ── Status ────────────────────────────────────────────────── */
.status {
  margin-top: 10px;
  min-height: 18px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* ── Health Score ──────────────────────────────────────────── */
.health-grid {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.health-score-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.health-semaphore {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #9db2d8;
  background: #d8e1ef;
  flex-shrink: 0;
  transition: background 400ms ease, border-color 400ms ease, box-shadow 400ms ease;
}

.health-semaphore.ok {
  border-color: #3dbf7e;
  background: #2aa869;
  box-shadow: 0 0 0 4px rgba(42,168,105,0.18);
}

.health-semaphore.warn {
  border-color: #f0b53e;
  background: #e8a020;
  box-shadow: 0 0 0 4px rgba(232,160,32,0.20);
}

.health-semaphore.crit {
  border-color: #e05050;
  background: #cb4b3f;
  box-shadow: 0 0 0 4px rgba(203,75,63,0.20);
}

.health-semaphore.pending {
  border-color: #9db2d8;
  background: #d8e1ef;
}

.health-score-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.health-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

/* ── Health Pills ──────────────────────────────────────────── */
.health-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid #cfdaf0;
  background: #eef3fc;
  color: #1d3f71;
}

.health-pill.ok      { background: #d7f6e7; border-color: var(--ok-border); color: #0d5c35; }
.health-pill.warn    { background: var(--warn-bg); border-color: var(--warn-border); color: #7d5000; }
.health-pill.crit    { background: var(--error-bg); border-color: var(--error-border); color: #7d2a1d; }
.health-pill.pending { background: #eef3fc; border-color: #cfdaf0; color: #1d3f71; }

/* ── Metric Cards ──────────────────────────────────────────── */
.metrics-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 12px;
}

.metric-card {
  border: 1px solid var(--line);
  border-top: 3px solid #9db2d8;
  border-radius: 10px;
  padding: 12px 14px;
  background: #f8fbff;
  transition: transform var(--spring), box-shadow 250ms ease;
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.metric-card h3 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.metric-card strong {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 6px;
  line-height: 1.1;
}

.metric-card p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.metric-card.ok   { border-top-color: #2aa869; border-color: var(--ok-border); background: #f0fbf5; }
.metric-card.warn { border-top-color: #e8a020; border-color: var(--warn-border); background: #fffbf0; }
.metric-card.crit { border-top-color: #cb4b3f; border-color: var(--error-border); background: #fff5f4; }

/* ── Alerts ────────────────────────────────────────────────── */
.alerts-list {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.ssl-summary {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.alert-item {
  border-radius: 8px;
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  padding: 8px 12px;
  font-size: 13px;
  color: #5c3c00;
  transition: transform 150ms ease;
}

.alert-item:hover { transform: translateX(3px); }
.alert-item.warn  { border-color: var(--warn-border); background: var(--warn-bg); color: #5c3c00; }
.alert-item.crit  { border-color: var(--error-border); background: var(--error-bg); color: #7d2a1d; }
.alert-item.ok    { border-color: var(--ok-border); background: var(--ok-bg); color: #0d5c35; }

/* ── Table ─────────────────────────────────────────────────── */
.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  background: #f6f9ff;
}

tbody tr { transition: background 150ms ease; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f0f5ff; }

/* ── Status Chips ──────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid #cfdaf0;
  background: #eef3fc;
  color: #1d3f71;
}

.chip.running {
  background: #d7f6e7;
  border-color: var(--ok-border);
  color: #0d5c35;
}

.chip.running::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2aa869;
  flex-shrink: 0;
  animation: pulse-dot 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.55); opacity: 0.45; }
}

.chip.stopped {
  background: #ffe3dd;
  border-color: #f2b1a4;
  color: #7d2a1d;
}

.chip.unknown {
  background: #f0f3f8;
  border-color: #cfd8e6;
  color: #4a5c70;
}

/* ── Jobs ──────────────────────────────────────────────────── */
.jobs {
  margin-top: 10px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.jobs-empty {
  padding: 18px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.job {
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  transition: background 150ms ease;
}

.job:last-child { border-bottom: none; }
.job:hover { background: #f6f9ff; }

.job-label {
  font-weight: 600;
  color: var(--ink);
  font-size: 12.5px;
}

.job-time {
  font-family: 'DM Mono', Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.job-duration {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.7;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid #cfdaf0;
  background: #eef3fc;
  color: #1d3f71;
}

.badge.ok      { background: #d7f6e7; border-color: var(--ok-border); color: #0d5c35; }
.badge.error   { background: #ffe3dd; border-color: #f2b1a4; color: #7d2a1d; }
.badge.pending { background: var(--warn-bg); border-color: var(--warn-border); color: #7d5000; }

/* ── Terminal ──────────────────────────────────────────────── */
pre {
  margin-top: 12px;
  min-height: 160px;
  max-height: 300px;
  overflow-x: auto;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'DM Mono', Consolas, 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.65;
  background: #0b1626;
  color: #c8deff;
  border: 1px solid #1e3456;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.35);
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,25,38,0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: modal-bg-in 180ms ease forwards;
}

@keyframes modal-bg-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(13,25,38,0.28), 0 4px 16px rgba(13,25,38,0.12);
  padding: 28px 28px 22px;
  min-width: 320px;
  max-width: 440px;
  width: calc(100% - 40px);
  animation: modal-box-in 220ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modal-box-in {
  from { transform: translateY(18px) scale(0.95); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.modal-title   { font-size: 15px; font-weight: 700; color: var(--ink); margin: 0 0 10px; }
.modal-message { font-size: 14px; color: #3d4e66; margin: 0 0 22px; line-height: 1.55; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

.modal-btn {
  height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--spring), box-shadow 200ms ease, filter 150ms ease;
}

.modal-btn:hover { transform: translateY(-2px); }

.modal-btn-cancel {
  background: #eaf0fc;
  border-color: #cdd8ec;
  color: #1b3f74;
}
.modal-btn-cancel:hover { box-shadow: 0 4px 12px rgba(30,63,168,0.15); }

.modal-btn-confirm {
  background: linear-gradient(130deg, var(--primary), var(--primary-2));
  color: #fff;
}
.modal-btn-confirm:hover { box-shadow: 0 6px 18px rgba(30,94,255,0.35); filter: brightness(1.08); }

/* ── Login Modal ──────────────────────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,15,28,0.70);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: modal-bg-in 250ms ease forwards;
}

.login-box {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(13,25,38,0.35), 0 4px 16px rgba(13,25,38,0.15);
  padding: 36px 32px 28px;
  width: calc(100% - 40px);
  max-width: 370px;
  text-align: center;
  animation: modal-box-in 280ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.login-logo {
  width: 90px;
  margin-bottom: 14px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.12));
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.login-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 22px;
}

.login-box form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-box input {
  height: 40px;
  border: 1px solid #cdd8ec;
  border-radius: 9px;
  background: #f8faff;
  color: var(--ink);
  padding: 0 14px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.login-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,94,255,0.12);
}

.login-box input::placeholder {
  color: #9aadca;
}

.login-box button[type="submit"] {
  height: 42px;
  margin-top: 6px;
  border: none;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--spring), box-shadow 200ms ease, filter 150ms ease;
}

.login-box button[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30,94,255,0.30);
  filter: brightness(1.06);
}

.login-box button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: none;
}

.login-error {
  min-height: 18px;
  font-size: 12px;
  color: var(--error);
  font-weight: 600;
  margin-top: 2px;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 700px) {
  .hero-head { flex-direction: column; align-items: flex-start; }
  .hero-logo { width: 100px; }
  .head-row  { flex-direction: column; align-items: flex-start; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
}
