:root {
  --cp-azul: #179bd7;
  --cp-azul-oscuro: #293a4a;
  --cp-fondo: #f2f4f7;
  --cp-borde: #dfe3e8;
  --topbar-h: 56px;
  --sidebar-w: 72px;
}

body {
  background: var(--cp-fondo);
  font-size: 14px;
}

/* Barra superior */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  background: var(--cp-azul-oscuro);
  z-index: 1030;
}
.brand { font-size: 1.4rem; letter-spacing: -.5px; }
.brand span { color: #ff6c2c; }

.search-top { position: relative; width: 260px; }
.search-top i {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: #9aa7b4;
}
.search-top input {
  padding-left: 30px;
  background: rgba(255,255,255,.1);
  border: 0;
  color: #fff;
}
.search-top input::placeholder { color: #b8c3cd; }

/* Barra lateral */
.sidebar {
  position: fixed;
  top: var(--topbar-h); bottom: 0; left: 0;
  width: var(--sidebar-w);
  background: #1f2d3a;
  padding-top: 8px;
  z-index: 1020;
  transition: transform .2s;
}
.sidebar a {
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 4px;
  color: #aab6c2;
  text-decoration: none;
  font-size: 11px;
}
.sidebar a i { font-size: 1.4rem; margin-bottom: 2px; }
.sidebar a:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidebar a.active { color: #fff; background: var(--cp-azul); }

/* Contenido */
.content {
  margin-top: var(--topbar-h);
  margin-left: var(--sidebar-w);
  padding: 24px;
}

.search-main { position: relative; }
.search-main i {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: #8a96a3; font-size: 1.1rem;
}
.search-main input { padding-left: 44px; border-color: var(--cp-borde); }

/* Grupos de herramientas */
.tool-group {
  background: #fff;
  border: 1px solid var(--cp-borde);
  border-radius: 6px;
  margin-bottom: 16px;
  overflow: hidden;
}
.group-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  font-size: 1.05rem; font-weight: 600;
  color: #2c3e50;
  border-bottom: 1px solid var(--cp-borde);
  cursor: pointer;
  user-select: none;
}
.group-header .group-icon { color: var(--cp-azul); font-size: 1.2rem; }
.group-header .chevron { transition: transform .2s; color: #8a96a3; }
.group-header.collapsed .chevron { transform: rotate(180deg); }
.group-header.collapsed { border-bottom-color: transparent; }

.group-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 4px;
  padding: 12px;
}
.tool {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 4px;
  color: #1a5f8a;
  text-decoration: none;
}
.tool i { font-size: 1.9rem; line-height: 1; }
.tool:hover { background: #eef6fc; color: var(--cp-azul); }

.text-orange { color: #f28c28; }
.text-indigo { color: #6f42c1; }

/* Tarjetas laterales */
.side-card { border-color: var(--cp-borde); }
.side-card .card-header {
  background: #fff;
  font-weight: 600;
  color: #2c3e50;
}
.stat { margin-bottom: 14px; }
.recurso-actualizado { font-size: 11px; margin-top: -6px; }
.stat .progress { height: 6px; margin-top: 4px; }

/* Inicio de sesión */
.pantalla-login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(160deg, #293a4a 0%, #1f2d3a 45%, var(--cp-fondo) 45.1%);
}
.login-caja { width: 100%; max-width: 400px; }
.login-marca { font-size: 2.2rem; color: #fff; }

/* Páginas de herramienta */
.page-icon { font-size: 2.6rem; color: var(--cp-azul); }
.mini-stat {
  display: flex; align-items: center; gap: 14px;
  background: #fff;
  border: 1px solid var(--cp-borde);
  border-radius: 6px;
  padding: 14px 16px;
}
.mini-stat i { font-size: 1.8rem; }
.mini-stat .num { font-size: 1.3rem; font-weight: 600; line-height: 1.1; }
.mini-stat .lbl { color: #6c7a89; font-size: 12px; }

.panel-card { border-color: var(--cp-borde); }
.panel-card .card-header, .panel-card .card-footer { background: #fff; }
.panel-card .progress { height: 6px; margin-top: 3px; }

.search-inline { position: relative; min-width: 220px; }
.search-inline i {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: #8a96a3;
}
.search-inline input { padding-left: 30px; }

.section-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: #6c7a89;
  border-bottom: 1px solid var(--cp-borde);
  padding-bottom: 6px; margin: 8px 0 12px;
}

/* Selector de tipo (crear dominio) */
.tipo-opcion { display: flex; flex-direction: column; gap: 2px; padding: 12px; height: 100%; }
.tipo-opcion i { font-size: 1.4rem; }
.tipo-opcion small { opacity: .75; font-size: 12px; }

/* Editor de zonas DNS */
.dns-tipo { min-width: 52px; font-family: Consolas, monospace; }
.dns-nombre { min-width: 180px; }
.dns-valor { min-width: 220px; max-width: 460px; font-family: Consolas, monospace; }

/* Acceso SSH */
.estado-punto {
  width: 14px; height: 14px; border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(25, 135, 84, .15);
  flex-shrink: 0;
}
.estado-punto.bg-secondary { box-shadow: 0 0 0 4px rgba(108, 117, 125, .15); }
.cmd {
  display: flex; align-items: center; gap: 8px;
  background: #1e2630;
  border-radius: 6px;
  padding: 6px 6px 6px 12px;
}
.cmd code { color: #9fe6a0; flex: 1; word-break: break-all; }

/* Bloqueo de IP */
.formatos td { padding: 2px 4px; }
.formatos td:first-child { color: #6c7a89; white-space: nowrap; }
.formatos code { cursor: pointer; }
.formatos code:hover { text-decoration: underline; }

/* Let's Encrypt SSL */
.pasos li { padding: 4px 0; display: flex; align-items: center; }

/* Tareas cron */
.cron-ayuda {
  background: #1e2630;
  color: #9fe6a0;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.35;
}
.cron-cmd { max-width: 520px; }

/* Administrar usuarios */
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600;
  flex-shrink: 0;
}
.srv-chip {
  display: inline-flex; align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--cp-borde);
  border-radius: 20px;
  font-size: 12px;
  color: #b5bec8;
  background: #f7f9fb;
  text-decoration: line-through;
}
.srv-chip.on { text-decoration: none; background: #fff; border-color: currentColor; }
.servicio {
  border: 1px solid var(--cp-borde);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
}
.servicio.activo { border-color: #9ccfeb; background: #f6fbfe; }
.servicio .srv-opciones { display: none; margin-top: 10px; padding-left: 44px; }
.servicio.activo .srv-opciones { display: block; }

/* Estadísticas y gráficos */
:root {
  --serie-1: #2a78d6;        /* serie única: azul */
  --serie-1-suave: #cde2fb;
  --g-rejilla: #e1e0d9;
  --g-base: #c3c2b7;
  --g-texto: #898781;
  --estado-bien: #006300;
  --estado-aviso: #fab219;
  --estado-critico: #d03b3b;
}
.stat-tile {
  background: #fff;
  border: 1px solid var(--cp-borde);
  border-radius: 6px;
  padding: 14px 16px;
  height: 100%;
}
.stat-tile .lbl { color: #6c7a89; font-size: 12px; }
.stat-tile .valor { font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
.stat-tile .delta { font-size: 12px; }
.delta-bien { color: var(--estado-bien); }
.delta-mal { color: var(--estado-critico); }

.grafico { position: relative; min-height: 220px; }
.grafico svg { display: block; overflow: visible; }
.g-rejilla { stroke: var(--g-rejilla); stroke-width: 1; }
.g-base { stroke: var(--g-base); stroke-width: 1; }
.g-eje { fill: var(--g-texto); font-size: 11px; font-variant-numeric: tabular-nums; }
.g-barra { fill: var(--serie-1); }
.g-barra.activa { fill: #1c5cab; }
.g-linea { fill: none; stroke: var(--serie-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.g-area { fill: var(--serie-1); opacity: .1; }
.g-punto { fill: var(--serie-1); stroke: #fff; stroke-width: 2; }
.g-guia { stroke: var(--g-base); stroke-width: 1; }
.grafico-tip {
  display: none;
  position: absolute;
  pointer-events: none;
  background: #fff;
  border: 1px solid rgba(11, 11, 11, .1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 5;
}
.tabla-num { font-variant-numeric: tabular-nums; }

/* Medidor: el relleno lleva el estado; la pista es un paso claro del mismo tono */
.medidor { height: 6px; border-radius: 3px; background: var(--serie-1-suave); overflow: hidden; }
.medidor > div { height: 100%; border-radius: 3px; background: var(--serie-1); }
.medidor.aviso { background: #fde7b5; }
.medidor.aviso > div { background: var(--estado-aviso); }
.medidor.critico { background: #f6cfcf; }
.medidor.critico > div { background: var(--estado-critico); }
.estado-aviso { color: #8a5a00; font-size: 12px; }
.estado-critico { color: var(--estado-critico); font-size: 12px; }

.barra-h { height: 8px; background: #f0efec; border-radius: 4px; overflow: hidden; }
.barra-h > div { height: 100%; background: var(--serie-1); border-radius: 0 4px 4px 0; }

/* Panel (resumen) */
.list-group-flush > .aviso-critico { border-left: 3px solid var(--estado-critico); }
.aviso-critico > .bi { color: var(--estado-critico); }
.list-group-flush > .aviso-aviso { border-left: 3px solid var(--estado-aviso); }
.aviso-aviso > .bi { color: #c98500; }
.list-group-flush > .aviso-info { border-left: 3px solid var(--serie-1); }
.aviso-info > .bi { color: var(--serie-1); }
.accesos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.acceso {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px;
  border: 1px solid var(--cp-borde);
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
  color: #2c3e50;
  text-decoration: none;
}
.acceso i { font-size: 1.7rem; }
.acceso:hover { background: #eef6fc; border-color: #9ccfeb; color: var(--cp-azul); }
.actividad li { display: flex; gap: 10px; padding-bottom: 12px; }
.actividad li:last-child { padding-bottom: 0; }
.actividad li > .bi { font-size: 1.1rem; margin-top: 1px; }

/* Preferencias */
.pref-menu .list-group-item.active { background: #eef6fc; color: #0f5d8a; border-color: var(--cp-borde); font-weight: 600; }
.requisitos li { color: #6c7a89; }
.requisitos li.ok { color: var(--estado-bien); }
.pasos-2fa { padding-left: 1.2rem; }
.pasos-2fa > li { margin-bottom: 1.25rem; padding-left: .25rem; }
.pasos-2fa > li::marker { font-weight: 600; color: var(--cp-azul); }
.qr { border: 1px solid var(--cp-borde); border-radius: 6px; padding: 6px; background: #fff; line-height: 0; }
.codigos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
  max-width: 560px;
}
.codigos code {
  background: #f7f9fb;
  border: 1px solid var(--cp-borde);
  border-radius: 4px;
  padding: 4px 8px;
  color: #2c3e50;
  text-align: center;
  font-size: 13px;
}

/* Administrador de archivos */
.fm { overflow: hidden; }
.fm-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--cp-borde);
  background: #fafbfc;
}
.fm-btn {
  display: flex; flex-direction: column; align-items: center;
  min-width: 64px;
  padding: 4px 6px;
  border: 0; border-radius: 4px;
  background: transparent;
  color: #2c3e50;
  font-size: 11px;
}
.fm-btn i { font-size: 1.25rem; }
.fm-btn:hover:not(:disabled) { background: #e7f2fa; color: var(--cp-azul); }
.fm-btn:disabled { opacity: .35; }
.fm-btn.text-danger:hover:not(:disabled) { background: #fdecec; color: #dc3545; }

.fm-body { display: flex; min-height: calc(100vh - 230px); }
.fm-tree {
  width: 260px; flex-shrink: 0;
  border-right: 1px solid var(--cp-borde);
  padding: 10px;
  overflow: auto;
  background: #fff;
}
.tree-item {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  color: #2c3e50;
  text-decoration: none;
  white-space: nowrap;
}
.tree-item .caret { font-size: 10px; color: #8a96a3; width: 12px; }
.tree-item:hover { background: #eef6fc; }
.tree-item.active { background: #d8ecf8; color: #0f5d8a; font-weight: 600; }

.fm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fm-nav {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--cp-borde);
}
.fm-path { background: #f7f9fb; border-bottom: 1px solid var(--cp-borde); }
.fm-path a { text-decoration: none; }
.fm-table-wrap { flex: 1; }
.fm-table th { white-space: nowrap; }
.fm-table tbody tr { cursor: default; user-select: none; }
@media (max-width: 1199.98px) {
  .fm-nav .btn span { display: none; }
  .fm-tree { width: 220px; }
}
.fm-table tbody tr.table-active > * { --bs-table-bg-state: #d8ecf8; }
.fm-status { border-top: 1px solid var(--cp-borde); background: #fafbfc; }

.fm-context {
  position: fixed;
  display: none;
  z-index: 1060;
  min-width: 200px;
}
.fm-context.show { display: block; }

.fm-drop {
  display: block;
  border: 2px dashed #b9c6d2;
  border-radius: 8px;
  padding: 36px;
  text-align: center;
  cursor: pointer;
  background: #f7f9fb;
}
.fm-drop i { font-size: 2.8rem; color: var(--cp-azul); }
.fm-drop.over, .fm-drop:hover { border-color: var(--cp-azul); background: #eef6fc; }

.fm-editor {
  display: flex;
  height: 65vh;
  min-height: 100%;
  background: #1e2630;
  font: 13px/1.5 Consolas, "Courier New", monospace;
}
.fm-lineas {
  margin: 0; padding: 12px 10px;
  color: #5c6b7a;
  text-align: right;
  overflow: hidden;
  user-select: none;
  background: #18202a;
  font: inherit;
}
.fm-editor textarea {
  flex: 1;
  border: 0; outline: 0; resize: none;
  padding: 12px;
  background: transparent;
  color: #d6dee6;
  font: inherit;
  white-space: pre;
  tab-size: 2;
}

@media (max-width: 767.98px) {
  .fm-tree { display: none; }
  .fm-search { width: 100%; margin-top: 4px; }
  .fm-search .search-inline { flex: 1; min-width: 0; }
}

/* Responsive */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; padding: 16px; }
}
