:root {
  --bg: #f6f7f9; --card: #fff; --ink: #1d2433; --muted: #6b7385; --line: #e3e6ec;
  --accent: #1f6feb; --good: #1a7f4b; --bad: #c4372d; --warn: #b26b00;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: var(--bg); color: var(--ink); }
body.offline main, body.offline .options { opacity: .45; pointer-events: none; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: #111827; color: #fff; flex-wrap: wrap; }
.brand { display: flex; flex-direction: column; }
.node-name { font-size: 20px; font-weight: 700; }
.node-role { font-size: 12px; color: #aab3c5; }
.peers { display: flex; gap: 8px; flex: 1; }
.peer { font-size: 12px; padding: 3px 10px; border-radius: 99px; border: 1px solid #3a4459; }
.peer.up { color: #7ee2a8; } .peer.down { color: #ff9b91; }
.power { display: flex; gap: 10px; align-items: center; }
.badge { font-weight: 700; font-size: 12px; padding: 4px 10px; border-radius: 4px; }
.badge.up { background: var(--good); } .badge.down { background: var(--bad); }

.tabs { display: flex; gap: 4px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 12px 14px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.options { display: flex; gap: 18px; align-items: end; padding: 12px 24px; flex-wrap: wrap; background: #eef2f8; border-bottom: 1px solid var(--line); }
.options label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
.hint { font-size: 12px; color: var(--muted); }

main { padding: 20px 24px 60px; }
.grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; min-width: 0; }
#tab-repl .grid { grid-template-columns: 1fr; }
h2 { font-size: 16px; margin: 0 0 12px; } h3 { font-size: 13px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); font-weight: 400; }
.mono { font-family: var(--mono); } .small { font-size: 12px; } .num { text-align: right; }

input, select { font: inherit; padding: 6px 8px; border: 1px solid #c9ced8; border-radius: 5px; background: #fff; min-width: 0; }
.btn { font: inherit; padding: 6px 12px; border-radius: 5px; border: 1px solid #c9ced8; background: #fff; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.topbar .btn { background: #263045; color: #fff; border-color: #3a4459; }
.btn:disabled { opacity: .5; cursor: default; }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0 4px; font: inherit; }
.link.danger { color: var(--bad); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input { width: 120px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
tr.pending td { background: #fff7e8; }
.actions { text-align: right; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 10px; }

.row-form { display: grid; gap: 8px; }
.row-form label { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.form-actions { display: flex; gap: 8px; margin-top: 4px; }
.result { background: #0f172a; color: #d7e0f0; padding: 12px; border-radius: 6px; font: 12px/1.5 var(--mono); max-height: 360px; overflow: auto; white-space: pre-wrap; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }

.pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.pill.done { background: #e2f5ea; color: var(--good); } .pill.pending { background: #fff0d6; color: var(--warn); }

.events { list-style: none; margin: 0; padding: 0; }
.events li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.ev-failure b, .ev-replication-failed b { color: var(--bad); }
.ev-recovery b, .ev-retry b { color: var(--good); }
.ev-conflict b { color: var(--warn); }

.toast { position: fixed; bottom: 20px; right: 20px; background: #111827; color: #fff; padding: 10px 16px; border-radius: 6px; max-width: 480px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.bad { background: var(--bad); }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }
