:root {
  --bg: #f6f7f9; --panel: #fff; --text: #16181d; --muted: #6b7280; --line: #e3e6ea;
  --accent: #ff5a1f; --accent-ink: #fff; --ok: #0a7d4a; --ok-bg: #e3f6ec; --bad: #b42318; --bad-bg: #fde8e6;
  --warn: #9a6700; --sel: #fff4ee;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216; --panel: #181b21; --text: #eceef2; --muted: #98a1b0; --line: #2a2f38;
    --ok: #4ade80; --ok-bg: #12301f; --bad: #ff8a80; --bad-bg: #3a1b18; --warn: #f5c451; --sel: #2a1d16;
  }
}
* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, "Segoe UI", sans-serif; }
.grow { flex: 1; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
nav { display: flex; gap: 4px; }
nav button { border: 0; background: none; padding: 8px 12px; border-radius: 8px; color: var(--muted); cursor: pointer; font: inherit; }
nav button.on { background: var(--sel); color: var(--accent); font-weight: 600; }

button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 8px 12px; border-radius: 8px; cursor: pointer; }
button:hover, .btn:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: progress; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger { color: var(--bad); }

main { max-width: 1280px; margin: 0 auto; padding: 20px 20px 120px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 12px; }

.tools { display: flex; gap: 10px; margin-bottom: 12px; }
.search, select, input:not([type=checkbox]) { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); }
.search { flex: 1; }

.empty { text-align: center; padding: 80px 20px; border: 2px dashed var(--line); border-radius: 16px; color: var(--muted); }
.empty h2 { color: var(--text); margin: 0 0 6px; }

.tablewrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: var(--bg); position: sticky; top: 0; }
tr.sel td { background: var(--sel); }
.r { text-align: right; white-space: nowrap; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; white-space: nowrap; }
small { color: var(--muted); }
.clip { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.warn { color: var(--warn); cursor: help; margin-left: 6px; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted);
  font: 12px ui-monospace, Consolas, monospace; text-decoration: none; border: 1px solid var(--line); }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; cursor: help; }

.actionbar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(1240px, calc(100% - 24px));
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgb(0 0 0 / .18); z-index: 6; }

.toast { position: fixed; top: 64px; right: 20px; z-index: 20; padding: 10px 14px; border-radius: 10px; background: var(--text);
  color: var(--bg); max-width: 420px; box-shadow: 0 6px 20px rgb(0 0 0 / .25); }
.toast.bad { background: var(--bad); color: #fff; }

.modal { position: fixed; inset: 0; background: rgb(0 0 0 / .45); display: grid; place-items: center; z-index: 30; padding: 16px; }
.card { background: var(--panel); border-radius: 14px; width: min(860px, 100%); max-height: 88vh; display: flex; flex-direction: column; }
.card h3 { margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modalbody { padding: 12px 20px; overflow: auto; }
.modalfoot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.modalbody table td, .modalbody table th { padding: 5px 8px; font-size: 13px; }
.res-ok { color: var(--ok); } .res-bad { color: var(--bad); }
pre { background: var(--bg); padding: 10px; border-radius: 8px; overflow: auto; font-size: 12px; }

.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 14px 16px; display: grid; gap: 10px; align-content: start; }
legend { font-weight: 700; padding: 0 6px; }
fieldset label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
fieldset label input, fieldset label select { color: var(--text); font-size: 14px; }
fieldset label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--text); }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.savebar { grid-column: 1 / -1; }

button.mini { padding: 1px 8px; font-size: 12px; border-radius: 999px; color: var(--bad); }
.stack { display: grid; gap: 4px; margin: 10px 0; font-size: 13px; color: var(--muted); }
.stack input { width: 100%; color: var(--text); font-size: 14px; }
.card .check { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
