:root {
  --bg: #f4f6f9;
  --panel: #fff;
  --text: #1f2933;
  --muted: #6b7785;
  --line: #e3e8ee;
  --primary: #1f6feb;
  --primary-d: #1859c4;
  --ok: #1a8f4c;
  --ok-bg: #e5f6ec;
  --bad: #d1352b;
  --bad-bg: #fdeceb;
  --warn: #b7791f;
  --warn-bg: #fdf4e3;
  --info-bg: #e8f0fe;
  --side: #1d2733;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 13px; }
.boot { padding: 80px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }

/* layout */
.layout { display: flex; min-height: 100vh; }
.side { width: 210px; background: var(--side); color: #c9d3de; flex-shrink: 0; display: flex; flex-direction: column; }
.side .brand { padding: 20px 18px; font-size: 16px; font-weight: 600; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.side .brand small { display: block; font-size: 12px; font-weight: 400; color: #8a97a6; }
.side nav { padding: 10px 0; flex: 1; }
.side nav a { display: block; padding: 10px 20px; color: #c9d3de; border-left: 3px solid transparent; }
.side nav a:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.side nav a.active { background: rgba(31,111,235,.18); color: #fff; border-left-color: var(--primary); }
.side .foot { padding: 14px 18px; font-size: 12px; color: #8a97a6; border-top: 1px solid rgba(255,255,255,.08); }
.side .foot a { color: #c9d3de; }
.main { flex: 1; min-width: 0; padding: 24px 28px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; font-weight: 600; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.panel > h2 { font-size: 15px; margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.panel > .body { padding: 16px 18px; }
.panel > .body.flush { padding: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 22px; font-weight: 600; margin-top: 2px; }
.stat .v.bad { color: var(--bad); }
.stat .v.ok { color: var(--ok); }

/* site card */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.card:hover { border-color: #b9c6d6; box-shadow: 0 2px 10px rgba(20,40,70,.07); }
.card.alert { border-color: #f0b4af; }
.card .title { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card .title b { font-size: 15px; }
.card .fqdn { color: var(--muted); font-size: 13px; }
.card .tags { margin: 10px 0 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.slot-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px dashed var(--line); font-size: 13px; }
.slot-row .slot { width: 22px; height: 22px; border-radius: 50%; background: #eef2f7; color: #44546a; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex-shrink: 0; }
.slot-row .srv { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-row .srv small { color: var(--muted); }
.slot-row > small.votes { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; line-height: 20px; white-space: nowrap; background: #eef2f7; color: #44546a; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: var(--primary); }
.badge.live { background: var(--primary); color: #fff; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; background: #a0abb8; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; color: var(--muted); font-size: 13px; background: #fafbfc; }
tr:last-child td { border-bottom: none; }
td.nowrap, th.nowrap { white-space: nowrap; }
.empty { padding: 36px; text-align: center; color: var(--muted); }
.votes { font-size: 12px; color: var(--muted); }
.votes span { margin-right: 10px; white-space: nowrap; }

/* buttons */
button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 6px 14px; border-radius: 6px; cursor: pointer; line-height: 1.5; white-space: nowrap; }
button:hover { border-color: #b9c6d6; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-d); }
button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); }
button.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
button.sm { padding: 3px 10px; font-size: 13px; }
button.link { border: none; background: none; color: var(--primary); padding: 0 6px; }
button:disabled { opacity: .55; cursor: not-allowed; }

/* forms */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; color: #44546a; margin-bottom: 4px; font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; font: inherit; padding: 7px 10px; border: 1px solid #cfd8e3; border-radius: 6px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,111,235,.12); }
input:disabled { background: #f3f5f8; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14px; }
.radios { display: flex; flex-direction: column; gap: 8px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; cursor: pointer; }
.radio-card:hover { border-color: #b9c6d6; }
.radio-card input { margin-top: 4px; }
.radio-card small { display: block; color: var(--muted); }
.weights { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.weights input { width: 90px; }
.section-title { grid-column: 1 / -1; font-weight: 600; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-top: 6px; }

/* notes */
.note { padding: 10px 14px; border-radius: 6px; background: var(--info-bg); color: #24426e; font-size: 13px; margin-bottom: 14px; }
.note.warn { background: var(--warn-bg); color: #7a5212; }
.note.bad { background: var(--bad-bg); color: #8e2019; }
.note.ok { background: var(--ok-bg); color: #145c33; }
.note b { font-weight: 600; }
.note ul { margin: 6px 0 0; padding-left: 20px; }
.banner { background: var(--warn-bg); color: #7a5212; padding: 10px 16px; border-radius: 6px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
pre.cmd { background: #1d2733; color: #d7e1ec; padding: 12px 14px; border-radius: 6px; overflow-x: auto; font-size: 13px; margin: 8px 0; white-space: pre-wrap; word-break: break-all; }

/* events */
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; gap: 10px; padding: 9px 18px; border-bottom: 1px solid var(--line); font-size: 13px; align-items: flex-start; }
.events li:last-child { border-bottom: none; }
.events .t { color: var(--muted); white-space: nowrap; flex-shrink: 0; width: 140px; }
.events .m { flex: 1; word-break: break-all; }
.events .lv { flex-shrink: 0; width: 44px; }

/* 环境对比 */
.panel > .body.flush { overflow-x: auto; }
td.ops { min-width: 240px; }
td.ops .link { padding: 0 4px; }
.modal.lg { max-width: 1000px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
table.traffic input[type=number] { width: 90px; }
table.traffic select { width: auto; }
.findings, .bad-list, .warn-list { margin: 4px 0 10px; padding-left: 4px; list-style: none; font-size: 13px; }
.findings li { padding: 3px 0; }
.findings .lv-error, .bad-list li, li.lv-error { color: var(--bad); }
.findings .lv-warn, .warn-list li { color: var(--warn); }
.findings .lv-ok, li.lv-ok { color: var(--ok); }
.findings .lv-info { color: var(--muted); }
.bad-list li::before { content: '✘ '; }
.warn-list li::before { content: '⚠ '; }
.verify-item { padding: 10px 0; border-top: 1px dashed var(--line); }
.verify-item:first-child { border-top: none; }
pre.oplog { max-height: 360px; overflow-y: auto; }
td .slot { width: 22px; height: 22px; border-radius: 50%; background: #eef2f7; color: #44546a; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cmp h4, .body h4 { margin: 0 0 8px; font-size: 14px; }
textarea { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 13px; resize: vertical; }
@media (max-width: 800px) { .cmp { grid-template-columns: 1fr; } }

/* kv */
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; font-size: 13px; }
.kv .k { color: var(--muted); }

/* modal */
.modal-mask { position: fixed; inset: 0; background: rgba(15,25,40,.45); display: flex; align-items: flex-start; justify-content: center; z-index: 100; overflow-y: auto; padding: 50px 16px; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 680px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal.sm { max-width: 460px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 16px; display: flex; justify-content: space-between; }
.modal-body { padding: 18px 20px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.modal-err { color: var(--bad); font-size: 13px; margin-right: auto; align-self: center; }

/* toast */
#toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1d2733; color: #fff; padding: 9px 18px; border-radius: 6px; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.2); max-width: 80vw; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login { background: #fff; width: 360px; border-radius: 10px; padding: 32px 30px; border: 1px solid var(--line); box-shadow: 0 6px 30px rgba(20,40,70,.08); }
.login h1 { font-size: 20px; margin: 0 0 4px; }
.login p { color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.login .field { margin-bottom: 14px; }
.login button { width: 100%; padding: 9px; margin-top: 6px; }
.login .err { color: var(--bad); font-size: 13px; min-height: 20px; }

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .side { width: 100%; }
  .side nav { display: flex; flex-wrap: wrap; padding: 0; }
  .side nav a { padding: 8px 12px; border-left: none; }
  .side .foot { display: none; }
  .main { padding: 16px; }
  .form { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
}

table.creds { width: 100%; margin: 4px 0; }
table.creds td, table.creds th { padding: 4px 6px; }
table.creds input { width: 100%; box-sizing: border-box; }
