:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --text: #1f2328;
  --muted: #6a737d;
  --border: #dcdcd8;
  --link: #1a5fb4;
  --head: #2d3e50;
  --head-text: #f2f4f6;
  --accent: #e8eef6;
  --red: #c4271a;
  --red-bg: #fdecea;
  --green: #1d7a34;
  --green-bg: #e6f4ea;
  --side-w: 240px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --panel: #1d2126;
    --text: #dfe3e8;
    --muted: #95a0ab;
    --border: #2f353c;
    --link: #79b3ff;
    --head: #0f1215;
    --head-text: #e8ebee;
    --accent: #263240;
    --red: #ff7b6e;
    --red-bg: #3a1f1d;
    --green: #6fd38a;
    --green-bg: #1c3324;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
pre { background: var(--accent); padding: 8px 10px; border-radius: 4px; overflow-x: auto; margin: 6px 0; }
h1 { font-size: 22px; margin: 4px 0 12px; font-weight: 600; }
h2 { font-size: 16px; margin: 0 0 10px; font-weight: 600; }
h3 { font-size: 14px; margin: 0 0 6px; font-weight: 600; }
.muted { color: var(--muted); }

/* header */
.top {
  background: var(--head);
  color: var(--head-text);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  height: 46px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { color: var(--head-text); font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand:hover { text-decoration: none; }
.main-nav { display: flex; gap: 2px; margin-left: auto; }
.main-nav a { color: var(--head-text); opacity: .8; padding: 6px 10px; border-radius: 4px; white-space: nowrap; }
.main-nav a:hover, .main-nav a.on { opacity: 1; background: rgba(255,255,255,.12); text-decoration: none; }
.badge { background: #d93025; color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; font-weight: 600; }
.menu-toggle { display: none; background: none; border: 0; color: var(--head-text); font-size: 20px; cursor: pointer; padding: 4px 6px; }

/* layout */
.wrap { display: flex; flex: 1; align-items: stretch; }
.side {
  width: var(--side-w);
  flex: none;
  border-right: 1px solid var(--border);
  background: var(--panel);
  padding: 12px 10px 24px;
  position: sticky;
  top: 46px;
  height: calc(100vh - 46px);
  overflow-y: auto;
}
main { flex: 1; min-width: 0; padding: 16px 22px 40px; }
.side-resize {
  flex: none; width: 7px; margin-left: -4px; z-index: 2;
  position: sticky; top: 46px; height: calc(100vh - 46px);
  cursor: col-resize; touch-action: none;
}
.side-resize:hover, .side-resize:focus-visible, body.resizing .side-resize {
  background: linear-gradient(to right, transparent 2px, var(--link) 2px, var(--link) 5px, transparent 5px);
  outline: none;
}
body.resizing { cursor: col-resize; user-select: none; }
.foot { border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; padding: 10px 16px; display: flex; gap: 16px; justify-content: flex-end; }

/* hierarchy switcher */
.hierarchy { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.hierarchy label { color: var(--muted); font-size: 12.5px; }
.hierarchy select { flex: 1; min-width: 0; font: inherit; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); color: var(--text); }

/* menu tree */
#filter { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); color: var(--text); font: inherit; margin-bottom: 8px; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 14px; }
.tree li > a, .tree summary { display: block; padding: 2px 6px; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree summary { cursor: pointer; list-style: none; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before { content: "▸"; display: inline-block; width: 12px; color: var(--muted); font-size: 11px; }
.tree details[open] > summary::before { content: "▾"; }
.tree summary a { color: var(--text); font-weight: 500; }
.tree li.leaf > a { padding-left: 18px; color: var(--text); }
.tree li.current > a, .tree li.current > details > summary { background: var(--accent); }
.tree li.current > a, .tree li.current > details > summary a { color: var(--link); font-weight: 600; }
.tree li[hidden] { display: none; }

/* breadcrumbs, meta */
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.crumbs .sep { margin: 0 5px; }
.remark { margin: 0 0 12px; max-width: 900px; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 0 0 14px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }

/* boxes, pills, tables */
.box { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; margin: 0 0 16px; }
.alert-box { border-color: var(--red); }
.error-box { border-color: var(--red); background: var(--red-bg); padding: 8px 12px; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 9px; vertical-align: middle; line-height: 18px; }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.grey { background: var(--accent); color: var(--muted); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot.off { background: var(--red); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
table.list { border-collapse: collapse; width: 100%; font-size: 13px; }
table.list th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--border); padding: 4px 8px; }
table.list td { border-bottom: 1px solid var(--border); padding: 5px 8px; vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
.howto li { margin-bottom: 10px; }
table.list + .box, .box + .box { margin-top: 16px; }

/* graphs */
.graphs { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.graph { position: relative; margin: 0; display: inline-block; max-width: 100%; line-height: 0; }
.graph img { max-width: 100%; height: auto; border-radius: 3px; box-shadow: 0 0 0 1px var(--border); background: var(--panel); }
.graph.zoomable img { cursor: crosshair; user-select: none; -webkit-user-select: none; }
.graph .sel { position: absolute; top: 0; bottom: 0; background: rgba(26, 95, 180, .18); border-left: 1px solid #1a5fb4; border-right: 1px solid #1a5fb4; pointer-events: none; }
.hint { font-size: 12px; margin: -4px 0 8px; }
.cards { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.card h3 .host { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.card h3 .value { float: right; font-family: ui-monospace, Menlo, monospace; font-weight: 600; }
.card .rank { color: var(--muted); }
.card.alerting h3 a { color: var(--red); }
.graph-link:hover { text-decoration: none; }
.front-section { margin-bottom: 26px; }
.front-section > h2 { border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.chart { margin-bottom: 28px; max-width: 720px; }
.chart > h2 { border-bottom: 1px solid var(--border); padding-bottom: 4px; }

/* tabs and navigator */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tabs a { padding: 6px 12px; border: 1px solid transparent; border-bottom: 0; border-radius: 5px 5px 0 0; color: var(--muted); margin-bottom: -1px; }
.tabs a.on { background: var(--panel); border-color: var(--border); color: var(--text); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.zoom-nav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.zoom-nav label { color: var(--muted); font-size: 13px; }
.zoom-nav input { font: inherit; padding: 3px 5px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); color: var(--text); }
.btn { display: inline-block; padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.btn:hover { background: var(--accent); text-decoration: none; }

/* small screens */
@media (max-width: 800px) {
  .menu-toggle { display: block; }
  .side { position: fixed; left: 0; top: 46px; z-index: 9; transform: translateX(-100%); transition: transform .15s ease; box-shadow: 2px 0 10px rgba(0,0,0,.2); width: 80vw; max-width: 300px; }
  body.menu-open .side { transform: none; }
  .side-resize { display: none; }
  main { padding: 12px; }
  .main-nav a { padding: 6px 6px; }
  .brand { font-size: 14px; }
  .card h3 .value { float: none; margin-left: 6px; }
}
@media (max-width: 480px) {
  .brand img { display: none; }
  .main-nav { gap: 0; }
  .main-nav a { font-size: 13px; padding: 6px 5px; }
}
