:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #e2e6ec;
  --text: #26303b;
  --muted: #6b7683;
  --accent: #0b6bcb;
  --accent-dark: #0957a6;
  --green: #1a7f37;
  --red: #cf222e;
  --amber: #9a6700;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: #eef1f5;
  padding: 1px 5px;
  border-radius: 4px;
  word-break: break-all;
}
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* top bar */
.topbar {
  background: #10233b;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, #0b6bcb, #38a3f5);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #fff; letter-spacing: 0.5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; }
.brand-text small { color: #a9c3dd; font-size: 11px; }
.nav { display: flex; gap: 4px; }
.nav a {
  color: #c6d6e8; padding: 7px 13px; border-radius: 6px; font-size: 13.5px;
}
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }

/* layout */
main.container { padding-top: 26px; padding-bottom: 60px; }
.hero { text-align: center; padding: 34px 10px 26px; }
.hero h1 { margin: 0 0 10px; font-size: 27px; }
.hero p { color: var(--muted); max-width: 720px; margin: 0 auto 18px; }
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block; padding: 8px 16px; border-radius: 7px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  font-size: 13.5px; cursor: pointer; transition: background .15s, border-color .15s;
}
.btn:hover { background: #f0f3f7; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger { color: var(--red); border-color: #f0c4c7; }
.btn-danger:hover { background: #fdf0f0; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-xs { padding: 2px 8px; font-size: 12px; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 6px 0 22px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; text-align: center; box-shadow: 0 1px 2px rgba(16,35,59,.04);
}
.card-num { font-size: 24px; font-weight: 700; color: var(--accent); }
.card-label { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* panels */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 22px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(16,35,59,.04);
}
.panel h2 { margin: 0 0 12px; font-size: 18px; }
.panel h3 { margin: 18px 0 6px; font-size: 14.5px; }
.panel p { color: var(--muted); margin: 6px 0; }
.panel .note {
  background: #eef6ff; border: 1px solid #cfe4fa; border-radius: 8px;
  padding: 10px 12px; color: #0a4d8c;
}

.codeblock {
  background: #0f1a28; color: #d7e3f1; border-radius: 10px;
  padding: 14px 16px; overflow-x: auto; font-family: var(--mono);
  font-size: 12.8px; line-height: 1.7;
}
.codeblock code { background: transparent; padding: 0; color: inherit; }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { background: #f7f9fb; font-weight: 600; color: var(--muted); white-space: nowrap; }
.table tr:hover td { background: #fafbfd; }
.table.kv th { width: 130px; background: transparent; }
.table .actions { white-space: nowrap; }
.table-scroll { overflow: auto; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.section-head h2 { margin-bottom: 2px; }
.section-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; border-radius: 99px; padding: 5px 10px; font-size: 12px; white-space: nowrap; }
.badge-ready { color: #116329; background: #dafbe1; }
.dataset-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); gap: 12px; margin-top: 16px; }
.dataset-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); transition: .15s ease; }
.dataset-card:hover { text-decoration: none; border-color: #9bc8ed; box-shadow: 0 8px 22px rgba(11,107,203,.08); transform: translateY(-1px); }
.dataset-card small { display: block; color: var(--muted); margin-top: 2px; }
.dataset-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: linear-gradient(135deg,#e2f2ff,#c4e4fb); color: var(--accent); font-size: 11px; font-weight: 800; }
.dataset-count { color: var(--accent); font-weight: 700; }
.fixture-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.fixture-hero h2 { margin-bottom: 3px; }
.eyebrow { margin: 0 0 3px !important; color: var(--accent) !important; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.fixture-search { display: flex; gap: 8px; margin-bottom: 14px; }
.fixture-search input { flex: 1; min-width: 180px; }
.fixture-search input,.fixture-search select,.editor-grid input,.editor-grid select,.admin-token-row input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--text); }
.fixture-table-wrap { max-height: 66vh; border: 1px solid var(--border); border-radius: 9px; }
.fixture-table { min-width: 1180px; }
.fixture-table thead th { position: sticky; top: 0; z-index: 2; }
.fixture-table .sticky-action { position: sticky; right: 0; background: #fff; box-shadow: -8px 0 14px rgba(16,35,59,.05); }
.fixture-table thead .sticky-action { background: #f7f9fb; z-index: 3; }
.level-pill { display: inline-flex; min-width: 28px; justify-content: center; border-radius: 5px; padding: 1px 5px; background: #eef6ff; color: #0957a6; font: 700 11px var(--mono); }
.tree-indent { display: inline-block; padding-left: calc(min(var(--level), 8) * 12px); }
.editor-dialog { width: min(760px,calc(100vw - 28px)); border: 0; border-radius: 15px; padding: 0; box-shadow: 0 24px 80px rgba(16,35,59,.3); }
.editor-dialog::backdrop { background: rgba(9,30,52,.48); backdrop-filter: blur(3px); }
.editor-dialog form { padding: 20px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.dialog-head h3 { margin: 0; font-size: 19px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 28px; line-height: 1; }
.editor-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; max-height: 52vh; overflow: auto; padding: 2px; }
.editor-grid label,.admin-token-row label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.editor-grid .wide { grid-column: 1/-1; }
.admin-token-row { margin-top: 14px !important; padding-top: 12px; border-top: 1px solid var(--border); }
.dialog-actions { display: flex; gap: 8px; align-items: center; margin-top: 18px; }
.spacer { flex: 1; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; max-width: min(460px,calc(100vw - 40px)); padding: 11px 14px; border-radius: 9px; background: #10233b; color: #fff; box-shadow: 0 12px 34px rgba(0,0,0,.24); }
.toast.error { background: #a40e26; }
.table.bom tr.child td { background: #fbfcfe; color: #4a5766; }
.table.logs td { padding: 8px 10px; }
.nowrap { white-space: nowrap; }
.q { color: var(--muted); font-size: 11.5px; font-family: var(--mono); word-break: break-all; }
.empty { text-align: center; color: var(--muted); padding: 26px !important; }

/* method / status badges */
.m {
  display: inline-block; min-width: 44px; text-align: center; padding: 2px 7px;
  border-radius: 5px; font-size: 11.5px; font-weight: 700; color: #fff;
  font-family: var(--mono);
}
.m-get { background: #1a7f37; }
.m-post { background: #8250df; }
.m-put { background: #9a6700; }
.m-delete { background: #cf222e; }
.m-patch { background: #953800; }
.status { display: inline-block; min-width: 34px; text-align: center; padding: 1px 6px; border-radius: 5px; font-size: 12px; font-weight: 600; font-family: var(--mono); }
.s-2 { background: #dafbe1; color: #116329; }
.s-3 { background: #fff8c5; color: #7d4e00; }
.s-4 { background: #ffebe9; color: #a40e26; }
.s-5 { background: #ffebe9; color: #a40e26; }

/* logs */
.logs-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.logs-controls { display: flex; align-items: center; gap: 12px; }
.chk { color: var(--muted); font-size: 13px; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.filter-bar input, .filter-bar select {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 13px; background: #fff; color: var(--text);
}
.filter-bar input { width: 200px; }
.log-meta { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.log-body td { background: #f7f9fb !important; }
.body-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.body-grid h4 { margin: 4px 0 4px; font-size: 12px; color: var(--muted); }
.body-grid pre {
  background: #0f1a28; color: #d7e3f1; border-radius: 8px; padding: 10px 12px;
  font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all;
  max-height: 260px; overflow: auto; margin: 0 0 10px;
}
.pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 14px; color: var(--muted); font-size: 13px; }

.footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; padding: 18px 0 30px; text-align: center; }

@media (max-width: 720px) {
  .body-grid { grid-template-columns: 1fr; }
  .nav a { padding: 6px 8px; font-size: 12.5px; }
  .filter-bar input { width: 100%; }
  .fixture-hero,.section-head { align-items: stretch; flex-direction: column; }
  .fixture-search { flex-wrap: wrap; }
  .fixture-search input { width: 100%; flex-basis: 100%; }
  .editor-grid { grid-template-columns: 1fr; }
}
