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

:root {
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-muted: #666;
  --border: #e0e3e8;
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --up: #34a853;
  --down: #ea4335;
  --partial: #f9ab00;
  --gray: #dadce0;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Navbar */
.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--primary);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--primary); background: var(--primary); color: white; }
.nav-user { font-size: 13px; color: var(--text-muted); padding: 4px 8px; background: var(--bg); border-radius: 6px; }

/* Container */
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* Dashboard header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.dashboard-header h1 { font-size: 24px; font-weight: 700; }
.text-muted { color: var(--text-muted); font-size: 14px; }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat-up .stat-value { color: var(--up); }
.stat-down .stat-value { color: var(--down); }
.stat-paused .stat-value { color: var(--partial); }
.text-green { color: var(--up); }
.text-yellow { color: var(--partial); }
.text-red { color: var(--down); }

/* Time nav */
.time-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: var(--shadow);
  display: inline-flex;
}
.time-nav a {
  text-decoration: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
}
.time-nav a:hover { color: var(--text); }
.time-nav a.active { background: var(--primary); color: white; }

/* Bar legend */
.bar-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.bar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.legend-dot {
  width: 10px;
  height: 14px;
  border-radius: 2px;
  display: inline-block;
}

/* Monitor list */
.monitor-list { display: flex; flex-direction: column; gap: 8px; }
.monitor-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  border-left: 4px solid var(--gray);
  transition: border-color 0.2s;
}
.monitor-card.status-up { border-left-color: var(--up); }
.monitor-card.status-down { border-left-color: var(--down); }
.monitor-card.status-unknown { border-left-color: var(--gray); }

.monitor-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.monitor-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-up { background: var(--up); }
.dot-down { background: var(--down); }
.dot-unknown { background: var(--gray); }

.monitor-info { min-width: 0; }
.monitor-name {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
}
.monitor-name:hover { color: var(--primary); }
.monitor-url {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}
.monitor-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.monitor-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.uptime-pct {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.pct-good { color: var(--up); }
.pct-warn { color: var(--partial); }
.pct-bad { color: var(--down); }

.monitor-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Uptime bars — estilo ||||||| */
.uptime-bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
}
.uptime-bars .bar {
  width: 6px;
  height: 28px;
  border-radius: 2px 2px 0 0;
  transition: opacity 0.15s;
  min-width: 3px;
}
.uptime-bars.large .bar { width: 10px; height: 36px; }
.uptime-bars .bar:hover { opacity: 0.7; transform: scaleY(1.1); }
/* response-time colors */
.bar-fast { background: #0d9488; }       /* 0-150ms  — verde teal */
.bar-good { background: #22c55e; }       /* 150-400ms — verde */
.bar-slow { background: #f59e0b; }       /* 400-800ms — ámbar */
.bar-vslow { background: #f97316; }      /* 800ms+ — naranja */
.bar-down { background: #ef4444; }       /* caído/error */
.bar-no-data { background: #d1d5db; }    /* sin datos */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--down); border-color: #f5c6cb; }
.btn-danger:hover { background: #fce8e6; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* Forms */
.form-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light, rgba(26,115,232,0.15));
}
.form-group small { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.inline-form { display: inline; }
.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 400 !important;
}
.checkbox-label input { width: auto; }

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 16px 20px; }

/* Tables */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 8px; border-bottom: 2px solid var(--border); font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
td { padding: 10px 8px; border-bottom: 1px solid var(--border); }
.error-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--down); }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.badge-up { background: #e6f7e6; color: #137333; }
.badge-down { background: #fce8e6; color: #c5221f; }
.badge-paused { background: #fef7e0; color: #b06000; }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-error { background: #fce8e6; color: #c5221f; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 16px; font-size: 16px; }

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
}
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
  background: var(--card);
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}
.login-header { text-align: center; margin-bottom: 32px; }
.logo-icon { color: var(--primary); margin-bottom: 12px; }
.login-header h1 { font-size: 24px; }
.login-header p { color: var(--text-muted); font-size: 14px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form .form-group label { font-size: 13px; }

/* Incidents */
.incident-list { display: flex; flex-direction: column; gap: 8px; }
.incident-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg);
}
.incident-item.resolved { opacity: 0.6; }
.incident-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}
.dot-major { background: var(--down); }
.dot-minor { background: var(--partial); }
.dot-resolved { background: var(--up); }
.incident-content { flex: 1; }
.incident-title { font-weight: 600; font-size: 14px; }
.incident-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.incident-desc { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal.show { display: flex; }
.modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
}
.modal-content {
  position: relative;
  background: var(--card);
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 0;
}
.modal-header h3 { font-size: 18px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 0 20px 20px;
}

/* Status Pages grid */
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.page-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: box-shadow 0.15s;
}
.page-card:hover { box-shadow: var(--shadow); }
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.page-logo { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.page-logo-placeholder {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-info h3 { font-size: 15px; }
.page-body { font-size: 13px; color: var(--text-muted); }
.page-slug { margin-top: 8px; }
.page-slug a { color: var(--primary); text-decoration: none; font-size: 12px; }
.page-slug a:hover { text-decoration: underline; }
.page-actions { display: flex; gap: 4px; margin-top: 12px; }

/* Monitor select grid */
.monitor-select-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.monitor-select-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.monitor-select-item:hover { border-color: var(--primary); }
.monitor-select-item input { width: auto; }
.monitor-select-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Header actions */
.header-actions { display: flex; gap: 8px; }

@media (max-width: 768px) {
  .container { padding: 16px; }
  .monitor-card { flex-direction: column; align-items: stretch; gap: 12px; }
  .monitor-right { flex-direction: row; align-items: center; justify-content: space-between; }
  .monitor-actions { justify-content: flex-end; }
  .form-row { grid-template-columns: 1fr; }
  .uptime-bars .bar { width: 6px; height: 14px; }
}
