:root {
  --bg: #0f1419;
  --panel: #171d26;
  --panel-2: #1e2530;
  --border: #2a3340;
  --text: #d7dee8;
  --muted: #7c8a9c;
  --accent: #4c8dff;
  --ok: #2ecc71;
  --down: #ff5252;
  --warn: #ffb74d;
  --gray: #5b6878;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; }
.muted { color: var(--muted); font-weight: 400; font-size: 0.85em; }
.center { text-align: center; }

.conn { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }
section { margin-bottom: 32px; }
section h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 12px; }

.section-head { display: flex; align-items: center; justify-content: space-between; }
.actions { display: flex; gap: 8px; }
.hint { color: var(--muted); font-size: 12px; margin: 0 0 12px; }

/* --------------- Servidores --------------- */
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.server-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.server-card .name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.server-card .meta { color: var(--muted); font-size: 12px; margin-top: 6px; word-break: break-all; }
.server-card.offline { border-color: rgba(255,82,82,.4); }

/* --------------- Tablas --------------- */
.grid { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.grid th, .grid td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.grid th { background: var(--panel-2); color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.grid tr:last-child td { border-bottom: none; }
.grid td.url, .grid td.code { font-family: ui-monospace, "Cascadia Code", monospace; font-size: 12px; }
.grid a { color: var(--accent); text-decoration: none; }
.grid a:hover { text-decoration: underline; }

/* --------------- Semáforo --------------- */
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex: none; }
.dot-ok { background: var(--ok); box-shadow: 0 0 8px rgba(46,204,113,.6); }
.dot-down { background: var(--down); box-shadow: 0 0 8px rgba(255,82,82,.6); }
.dot-gray { background: var(--gray); }
.dot-warn { background: var(--warn); }

.badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); }
.badge.on { color: var(--ok); border-color: rgba(46,204,113,.4); }
.badge.off { color: var(--muted); }
.badge.multi { color: var(--warn); border-color: rgba(255,183,77,.4); margin-left: 6px; }

/* --------------- Botones --------------- */
.btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 2px 6px; font-size: 13px; }
.btn-danger { color: var(--down); }

/* --------------- Estado de replicación --------------- */
.repl-status { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.repl-status:empty { display: none; }
.repl-pill { font-size: 12px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--border); }
.repl-pill.ok { color: var(--ok); border-color: rgba(46,204,113,.4); }
.repl-pill.err { color: var(--down); border-color: rgba(255,82,82,.4); }

/* --------------- Modal --------------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal.hidden { display: none; }
.modal-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 24px; width: 420px; max-width: 92vw; }
.modal-card h3 { margin: 0 0 16px; }
.modal-card label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.modal-card input[type=text], .modal-card input[type=url], .modal-card input:not([type]), .modal-card select {
  width: 100%; margin-top: 4px; padding: 8px 10px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px;
}
.modal-card label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.modal-card label.check input { width: auto; margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
