/* Grafana 11 dark look-alike. */
:root {
  --canvas: #111217;
  --bg1: #181b1f;
  --bg2: #22252b;
  --bg3: #2c3036;
  --border: rgba(204, 204, 220, 0.12);
  --border-strong: rgba(204, 204, 220, 0.2);
  --text: #ccccdc;
  --text-2: rgba(204, 204, 220, 0.65);
  --text-3: rgba(204, 204, 220, 0.45);
  --primary: #3d71d9;
  --primary-text: #6e9fff;
  --green: #73BF69;
  --red: #F2495C;
  --orange: #FF9830;
  --yellow: #FADE2A;
  --demo-h: 32px;
  --top-h: 40px;
  --nav-w: 216px;
  --radius: 4px;
  --mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--canvas);
  color: var(--text);
  font: 14px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono, kbd { font-family: var(--mono); font-size: 12px; }
code { background: var(--bg2); padding: 1px 4px; border-radius: 3px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary-text); outline-offset: 1px; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.skip-link { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--primary); color: #fff; padding: 6px 10px; }
.skip-link:focus { left: 8px; top: 40px; }

/* ---------- demo bar ---------- */
.demo-bar {
  position: fixed; inset: 0 0 auto 0; height: var(--demo-h); z-index: 60;
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: #0b0c0e; border-bottom: 1px solid #262931; font-size: 12.5px; color: #b9bac6;
}
.demo-back { color: #dfe0ea; font-weight: 500; white-space: nowrap; }
.demo-name { color: #e8e9f0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-note { color: #8e8e9a; white-space: nowrap; }
.demo-sep { color: #555; }
.demo-spacer { flex: 1; }
.demo-btn {
  height: 22px; padding: 0 9px; border-radius: 3px; border: 1px solid #3a3d45; background: #1b1d22;
  color: #dfe0ea; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.demo-btn:hover { background: #262931; }
.demo-btn--accent { border-color: #b3541e; color: #ffb27a; }
.demo-btn:disabled { opacity: 0.7; cursor: default; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; top: var(--demo-h); left: 0; right: 0; height: var(--top-h); z-index: 50;
  display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: var(--bg1); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; }
.nav-toggle { display: none; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; }
.breadcrumbs a { color: var(--text-2); }
.breadcrumbs [aria-current] { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.bc-sep { color: var(--text-3); }
.search-btn {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; min-width: 280px;
  background: var(--canvas); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-3); cursor: pointer;
}
.search-btn kbd { margin-left: auto; border: 1px solid var(--border); border-radius: 3px; padding: 0 4px; }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--text-2); padding: 6px; border-radius: var(--radius); display: inline-flex; align-items: center; font-size: 18px; line-height: 1; }
.icon-btn:hover { background: var(--bg2); color: var(--text); }
.bell { position: relative; }
.bell-count { position: absolute; top: 0; right: -2px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 600; display: grid; place-items: center; padding: 0 4px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: #5a3fc0; color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 600; }

/* ---------- layout ---------- */
.layout { display: flex; padding-top: calc(var(--demo-h) + var(--top-h)); min-height: 100vh; }
.sidenav {
  position: fixed; top: calc(var(--demo-h) + var(--top-h)); bottom: 0; left: 0; width: var(--nav-w); z-index: 40;
  background: var(--bg1); border-right: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; overflow-y: auto;
}
.sidenav ul { list-style: none; margin: 0; padding: 0; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: var(--radius); color: var(--text-2); position: relative; }
.nav-link:hover { background: var(--bg2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--bg2); color: var(--text); }
.nav-link.active::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: linear-gradient(#F46800, #FADE2A); }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; border-radius: 8px; font-size: 11px; padding: 0 6px; font-weight: 600; }
.nav-foot { margin-top: auto; padding: 10px; font-size: 11.5px; color: var(--text-3); border-top: 1px solid var(--border); }
.nav-foot-title { text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; margin-bottom: 2px; }
.main { flex: 1; min-width: 0; margin-left: var(--nav-w); outline: none; position: relative; }

/* ---------- buttons, inputs, menus ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; font-size: 13.5px; font-weight: 500; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #4a7ee6; }
.btn-secondary { background: var(--bg2); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--bg3); }
.btn-secondary[aria-pressed=true] { border-color: var(--primary-text); }
.btn.live-on { color: #fff; background: #2b6c38; border-color: #3f9b51; }
.btn svg { flex: none; }
.btn-group { display: inline-flex; }
.btn-split-l { border-top-right-radius: 0; border-bottom-right-radius: 0; padding: 0 9px; }
.btn-split-r { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0; padding: 0 8px; }
.caret { font-size: 10px; color: var(--text-2); margin-left: 2px; }
.input, .var-select, .query-input {
  background: var(--canvas); border: 1px solid var(--border-strong); border-radius: var(--radius); color: var(--text);
  height: 32px; padding: 0 8px; font: inherit; font-size: 13.5px;
}
.var-select { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; min-width: 120px; }
.var-select.small { height: 26px; min-width: 0; font-size: 12.5px; }
.popover { position: absolute; z-index: 80; }
.menu {
  background: var(--bg2); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 4px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); min-width: 200px; max-height: 70vh; overflow: auto;
}
.menu-head { padding: 6px 12px 4px; font-size: 11.5px; color: var(--text-3); }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0;
  padding: 6px 12px; cursor: pointer; color: var(--text); font-size: 13.5px;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--bg3); text-decoration: none; }
.menu-item.active { color: var(--primary-text); }
.menu-item small { margin-left: auto; color: var(--text-3); }
.menu-item kbd { margin-left: auto; color: var(--text-3); border: 1px solid var(--border); border-radius: 3px; padding: 0 4px; }
.menu-item .cb { width: 14px; height: 14px; border: 1px solid var(--border-strong); border-radius: 2px; display: inline-grid; place-items: center; font-size: 10px; }
.menu-item.active .cb { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip {
  border: 1px solid var(--border-strong); background: var(--bg2); color: var(--text-2); border-radius: 12px;
  padding: 2px 10px; font-family: var(--mono); font-size: 11.5px; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--primary-text); }
.chip[aria-pressed=true] { background: var(--primary); color: #fff; border-color: var(--primary); }
.tag { display: inline-block; background: var(--bg3); border-radius: 3px; padding: 0 6px; font-size: 12px; margin-right: 4px; }
.linkish { background: none; border: 0; color: var(--primary-text); cursor: pointer; padding: 0; }
.linkish:hover { text-decoration: underline; }

/* ---------- dashboard ---------- */
.dash { padding: 12px 16px 24px; }
.dash-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar-spacer { flex: 1; }
.dash-picker { display: inline-flex; align-items: baseline; gap: 6px; background: none; border: 0; cursor: pointer; padding: 4px 6px; border-radius: var(--radius); font-size: 18px; min-width: 0; }
.dash-picker:hover { background: var(--bg2); }
.dash-picker-folder { color: var(--text-2); font-size: 14px; }
.dash-picker-title { font-weight: 500; }
.var-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.var { display: inline-flex; }
.var-label { display: inline-flex; align-items: center; padding: 0 10px; height: 32px; background: var(--bg2); border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); color: var(--primary-text); font-size: 13px; font-weight: 500; }
.var .var-select { border-radius: 0 var(--radius) var(--radius) 0; }
.dash-grid { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); grid-auto-rows: 30px; gap: 8px; }
.dash-row { display: flex; align-items: center; border-bottom: 1px solid var(--border); }
.row-toggle { background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; padding: 2px 4px; }
.row-count { color: var(--text-3); font-size: 12.5px; font-weight: 400; }
.chev { display: inline-block; transition: transform .15s; color: var(--text-2); font-size: 12px; }
.chev.collapsed { transform: rotate(-90deg); }

/* ---------- panels ---------- */
.panel {
  background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; position: relative;
}
.panel:focus-within, .panel:hover { border-color: var(--border-strong); }
.panel-header { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; flex: none; }
.panel--notitle .panel-header { position: absolute; right: 0; top: 0; z-index: 2; }
.panel-title { font-size: 14px; font-weight: 500; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-info { width: 14px; height: 14px; border: 1px solid var(--text-3); border-radius: 50%; display: inline-grid; place-items: center; font-size: 9px; font-style: italic; color: var(--text-2); cursor: help; flex: none; }
.panel-status { flex: 1; }
.panel-menu-btn { opacity: 0; background: none; border: 0; cursor: pointer; color: var(--text-2); width: 24px; height: 24px; border-radius: 3px; font-size: 16px; line-height: 1; }
.panel:hover .panel-menu-btn, .panel-menu-btn:focus-visible, .panel-menu-btn[aria-expanded=true] { opacity: 1; }
.panel-menu-btn:hover { background: var(--bg3); color: var(--text); }
.panel-body { flex: 1; min-height: 0; padding: 0 8px 8px; position: relative; }
.no-data { display: grid; place-items: center; height: 100%; color: var(--text-3); font-size: 13px; text-align: center; padding: 8px; }
.no-data.tall { min-height: 120px; }
.no-data.error { color: var(--red); }

/* stat */
.stat-grid { display: grid; gap: 6px; height: 100%; grid-auto-columns: 1fr; grid-auto-rows: 1fr; }
.stat-tile { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; border-radius: 3px; overflow: hidden; min-height: 0; min-width: 0; }
.stat-tile--bg { background: linear-gradient(120deg, color-mix(in srgb, var(--c) 85%, #000), var(--c)); color: #fff; }
.stat-value { font-weight: 500; line-height: 1.1; z-index: 1; white-space: nowrap; letter-spacing: -0.01em; }
.stat-name { font-size: 12.5px; z-index: 1; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 6px; }
.spark { position: absolute; left: 0; right: 0; bottom: 0; height: 42%; width: 100%; }

/* gauge */
.gauge-wrap { height: 100%; display: grid; place-items: center; }
.gauge { width: 100%; height: 100%; max-height: 100%; }
.gauge-text { font-size: 30px; font-weight: 500; font-family: Inter, sans-serif; }

/* timeseries */
.ts { display: flex; flex-direction: column; height: 100%; gap: 4px; }
.ts--right { flex-direction: row; }
.ts-plot { position: relative; flex: 1; min-height: 60px; min-width: 0; }
.ts-legend { flex: none; max-height: 40%; overflow: auto; font-size: 12px; }
.ts--right .ts-legend { max-height: none; max-width: 42%; }
.ts-legend table { border-collapse: collapse; width: 100%; }
.ts-legend th { font-weight: 500; color: var(--primary-text); text-align: left; padding: 1px 6px; font-size: 11.5px; position: sticky; top: 0; background: var(--bg1); }
.ts-legend td { padding: 1px 6px; white-space: nowrap; }
.ts-legend tr.dim { opacity: .45; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.legend-item { background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 0; text-align: left; font-size: 12px; }
.legend-item i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; flex: none; }

/* text */
.text-body h3 { margin: 4px 0; font-size: 22px; font-weight: 500; }
.text-body h4 { margin: 4px 0; font-size: 17px; }
.text-body p { margin: 0; color: var(--text-2); }

/* logs */
.log-list { height: 100%; overflow: auto; font-family: var(--mono); font-size: 12px; }
.log-row { border-bottom: 1px solid rgba(204, 204, 220, 0.04); }
.log-line { display: flex; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-left: 3px solid var(--lc); padding: 1px 6px; cursor: pointer; font: inherit; color: var(--text); }
.log-line:hover { background: var(--bg2); }
.log-time { color: var(--text-2); flex: none; }
.log-msg { white-space: pre; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.log-msg.wrap { white-space: pre-wrap; word-break: break-all; }
.log-row.fresh { animation: fresh 1.5s ease-out; }
@keyframes fresh { from { background: rgba(61, 113, 217, .35); } to { background: transparent; } }
.log-details { padding: 6px 12px 10px 20px; background: var(--bg2); font-family: Inter, sans-serif; }
.ld-table { border-collapse: collapse; font-size: 12.5px; }
.ld-table td { padding: 2px 8px; vertical-align: top; }
.ld-kind { color: var(--text-3); font-size: 11px; }
.ld-key { color: var(--primary-text); font-family: var(--mono); }
.ld-val { font-family: var(--mono); word-break: break-all; }
.ld-actions { margin-left: 8px; }
.ld-actions button { background: none; border: 1px solid var(--border-strong); border-radius: 3px; cursor: pointer; padding: 0 5px; margin-left: 2px; color: var(--text-2); }
.ld-actions button:hover { color: var(--text); }
.ld-derived { margin-top: 6px; font-size: 12.5px; color: var(--text-2); }

/* ---------- view / inspect ---------- */
.view-overlay { position: absolute; inset: 0; min-height: calc(100vh - var(--demo-h) - var(--top-h)); background: var(--canvas); z-index: 30; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.view-overlay .panel { flex: 1; min-height: 420px; max-height: calc(100vh - var(--demo-h) - var(--top-h) - 80px); }
.view-bar { display: flex; align-items: center; gap: 10px; }
.view-hint { color: var(--text-3); font-size: 12.5px; }
.drawer {
  position: fixed; top: calc(var(--demo-h) + var(--top-h)); right: 0; bottom: 0; width: min(760px, 100vw); z-index: 70;
  background: var(--bg1); border-left: 1px solid var(--border-strong); box-shadow: -10px 0 30px rgba(0, 0, 0, .5);
  display: flex; flex-direction: column;
}
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 16px 8px; }
.drawer-title { font-size: 17px; font-weight: 500; }
.drawer-body { padding: 12px 16px 24px; overflow: auto; flex: 1; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; flex: none; }
.tabs button { background: none; border: 0; padding: 8px 12px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--text); border-bottom-color: #F46800; }
.inspect-target { margin-bottom: 14px; }
.inspect-target-head { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; font-size: 12.5px; }
.refid { background: var(--bg3); color: var(--primary-text); border-radius: 3px; padding: 0 6px; font-family: var(--mono); font-size: 12px; font-weight: 500; }
.inspect-h { font-size: 13.5px; margin: 16px 0 4px; font-weight: 500; }
.inspect-data-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.kv { border-collapse: collapse; font-size: 13px; }
.kv th { text-align: left; color: var(--text-2); font-weight: 400; padding: 3px 16px 3px 0; vertical-align: top; }
.kv td { padding: 3px 0; }
.table-scroll { overflow-x: auto; }
.data-table, .list-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.data-table th, .data-table td, .list-table th, .list-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th, .list-table th { color: var(--text-2); font-weight: 500; white-space: nowrap; }
.data-table td.num, .data-table th.num, .list-table .num { text-align: right; }
.data-table td { font-family: var(--mono); font-size: 12px; white-space: nowrap; }

/* code */
pre.code { background: var(--canvas); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin: 0; overflow: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; }
pre.code code { background: none; padding: 0; white-space: pre; }
.pq-fn { color: #6e9fff; }
.pq-metric { color: #ccccdc; font-weight: 500; }
.pq-label { color: #ff9830; }
.pq-str { color: #73bf69; }
.pq-num { color: #b877d9; }
.pq-dur { color: #fade2a; }
.pq-op { color: #8e8e9a; }
.hljs-attr, .hljs-section { color: #6e9fff; }
.hljs-string { color: #73bf69; }
.hljs-number, .hljs-literal { color: #b877d9; }
.hljs-comment { color: #6c6f7a; font-style: italic; }
.hljs-bullet, .hljs-meta, .hljs-punctuation { color: #8e8e9a; }
.hljs-keyword, .hljs-type, .hljs-template-variable, .hljs-variable { color: #ff9830; }

/* ---------- generic pages ---------- */
.page { padding: 16px 24px 40px; max-width: 1400px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 500; margin: 4px 0 4px; }
.page-sub { color: var(--text-2); margin: 0 0 16px; max-width: 900px; }
.section-title { font-size: 17px; font-weight: 500; margin: 24px 0 10px; }
.folder { background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius); }
.folder-head { padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 500; }
.strong-link { font-weight: 500; }

/* ---------- explore ---------- */
.explore-title { font-size: 18px; font-weight: 500; margin: 0 8px 0 4px; }
.query-editor { background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 12px; }
.qe-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 12.5px; }
.qe-hint { margin-left: auto; }
.qe-row { display: flex; gap: 8px; align-items: stretch; }
.query-input { flex: 1; height: auto; min-height: 40px; padding: 8px; font-family: var(--mono); font-size: 13px; resize: vertical; min-width: 0; }
.qe-examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; font-size: 12.5px; }
.query-error { background: rgba(242, 73, 92, .1); border: 1px solid rgba(242, 73, 92, .5); color: #ff99a5; padding: 10px 12px; border-radius: var(--radius); font-family: var(--mono); font-size: 12.5px; }
.explore-results { display: flex; flex-direction: column; gap: 12px; }
.explore-panel { min-height: 360px; }
.explore-panel.volume { min-height: 0; height: 190px; }
.vol-body { height: 150px; }
.logs-panel { min-height: 0; }
.logs-panel .panel-header { height: auto; min-height: 32px; flex-wrap: wrap; }
.log-stats { font-size: 12px; }
.log-options { display: flex; gap: 16px; align-items: center; padding: 4px 10px 8px; font-size: 13px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.opt { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.explore-logs { max-height: 560px; height: auto; }
.label-browser { width: min(560px, 92vw); padding: 8px 12px; }
.lb-label { color: var(--primary-text); font-family: var(--mono); font-size: 12px; margin: 8px 0 4px; }
.lb-values { display: flex; flex-wrap: wrap; gap: 4px; }
.lb-preview { display: block; margin: 10px 0 8px; padding: 6px 8px; }
.lb-actions { display: flex; justify-content: flex-end; }
.metric-browser { width: min(440px, 92vw); padding: 8px; }
.metric-browser .input { width: 100%; margin-bottom: 6px; }
.mb-list { max-height: 50vh; overflow: auto; }
.menu-item.mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------- alerting ---------- */
.alert-summary { margin-top: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.state-badge { display: inline-block; border-radius: 3px; padding: 0 7px; font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap; }
.state-badge--ok { background: rgba(115, 191, 105, .15); color: #73BF69; }
.state-badge--pending { background: rgba(255, 152, 48, .17); color: #FF9830; }
.state-badge--firing { background: rgba(242, 73, 92, .18); color: #ff7383; }
.yaml-box { margin-bottom: 14px; }
.rule-group { background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }
.rule-group-head { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.rule { border-bottom: 1px solid var(--border); }
.rule:last-child { border-bottom: 0; }
.rule--firing { box-shadow: inset 3px 0 0 var(--red); }
.rule--pending { box-shadow: inset 3px 0 0 var(--orange); }
.rule-head { display: grid; grid-template-columns: 16px 76px minmax(0, 1fr) 72px 100px 160px; gap: 10px; align-items: center; width: 100%; background: none; border: 0; padding: 8px 12px; cursor: pointer; text-align: left; }
.rule-head:hover { background: var(--bg2); }
.rule-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-value { font-family: var(--mono); font-size: 12.5px; text-align: right; }
.rule-for { font-size: 12.5px; text-align: right; }
.sev { font-size: 11.5px; border-radius: 3px; padding: 0 6px; justify-self: start; }
.sev--critical { color: #ff7383; border: 1px solid rgba(242, 73, 92, .5); }
.sev--warning { color: #FF9830; border: 1px solid rgba(255, 152, 48, .5); }
.rule-details { padding: 4px 12px 14px 38px; }
.rd-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.rd-label { color: var(--text-3); font-size: 12px; margin: 8px 0 2px; }
.rd-chart { position: relative; height: 200px; min-width: 0; }
.timeline-panel { padding: 12px; }
.tl-bars { margin-bottom: 12px; }
.tl-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 10px; align-items: center; margin-bottom: 4px; }
.tl-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-track { position: relative; height: 18px; background: var(--bg2); border-radius: 2px; overflow: hidden; }
.tl-seg { position: absolute; top: 0; bottom: 0; }
.tl-seg--ok { background: rgba(115, 191, 105, .55); }
.tl-seg--pending { background: rgba(255, 152, 48, .85); }
.tl-seg--firing { background: rgba(242, 73, 92, .9); }
.tl-ticks { position: relative; height: 16px; font-size: 11px; color: var(--text-3); }
.tl-ticks span { position: absolute; transform: translateX(-50%); }
.tl-ticks span:first-child { transform: none; }
.tl-ticks span:last-child { transform: translateX(-100%); }
.events td { font-size: 12.5px; }

/* ---------- architecture ---------- */
.arch-top { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; align-items: start; }
.arch-panel { padding: 8px; }
.arch-diagram { overflow-x: auto; }
.arch-svg { width: 100%; min-width: 640px; height: auto; display: block; }
.arch-svg .net { fill: rgba(61, 113, 217, .05); stroke: rgba(110, 159, 255, .35); stroke-dasharray: 5 4; }
.arch-svg .net-label { fill: #6e9fff; font-size: 11.5px; font-family: var(--mono); }
.arch-svg .node rect { fill: #22252b; stroke: rgba(204, 204, 220, .25); }
.arch-svg .node[data-svc] { cursor: pointer; }
.arch-svg .node[data-svc]:hover rect, .arch-svg .node[data-svc]:focus-visible rect { stroke: #6e9fff; }
.arch-svg .node[data-svc]:focus { outline: none; }
.arch-svg .node.sel rect { stroke: #F46800; stroke-width: 2; }
.arch-svg .node.grafana rect { fill: rgba(244, 104, 0, .12); }
.arch-svg .node.prom rect { fill: rgba(230, 82, 44, .1); }
.arch-svg .node.loki rect, .arch-svg .node.promtail rect { fill: rgba(250, 222, 42, .07); }
.arch-svg .node.ext rect { fill: #181b1f; stroke-dasharray: 3 3; }
.arch-svg .n-title { fill: #e6e6f0; font-size: 14px; font-weight: 600; font-family: Inter, sans-serif; }
.arch-svg .n-title.sm { font-size: 12px; }
.arch-svg .n-sub { fill: #9a9aa8; font-size: 11px; font-family: var(--mono); }
.arch-svg .edge { fill: none; stroke: #8e8e9a; stroke-width: 1.3; }
.arch-svg .edge.pull { stroke: rgba(230, 82, 44, .55); stroke-dasharray: 4 4; animation: dash 1.2s linear infinite; }
.arch-svg .e-label { fill: #a8a8b5; font-size: 10.5px; font-family: var(--mono); }
@keyframes dash { to { stroke-dashoffset: 16; } }
.svc-card { padding: 14px; }
.svc-title { margin: 0; font-size: 18px; font-weight: 500; text-transform: capitalize; }
.svc-card p { color: var(--text-2); font-size: 13px; }
.svc-card .kv td { font-size: 12px; word-break: break-all; }
.code-panel { min-height: 0; }
.code-viewer { max-height: 520px; overflow: auto; position: relative; }
.code-viewer pre.code { border: 0; border-radius: 0; overflow: visible; }
.code-lines { margin: 0; padding-left: 3.4em; }
.code-lines li { white-space: pre; padding-left: 8px; }
.code-lines li::marker { color: #555a66; font-size: 11px; }
.code-lines li.hl { background: rgba(244, 104, 0, .12); box-shadow: inset 2px 0 0 #F46800; }

/* ---------- toasts, modals ---------- */
.toasts { position: fixed; top: calc(var(--demo-h) + var(--top-h) + 10px); right: 12px; z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 24px)); }
.toast { position: relative; background: var(--bg2); border: 1px solid var(--border-strong); border-left: 4px solid var(--primary); border-radius: var(--radius); padding: 10px 30px 10px 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); transition: opacity .4s; }
.toast.out { opacity: 0; }
.toast--error { border-left-color: var(--red); }
.toast--success { border-left-color: var(--green); }
.toast--warning, .toast--pending { border-left-color: var(--orange); }
.toast-title { font-weight: 600; font-size: 13.5px; }
.toast-text { color: var(--text-2); font-size: 12.5px; }
.toast-close { position: absolute; top: 4px; right: 6px; background: none; border: 0; cursor: pointer; color: var(--text-2); font-size: 16px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 95; display: grid; place-items: start center; padding-top: 12vh; }
.search-modal { width: min(560px, calc(100vw - 32px)); background: var(--bg2); border: 1px solid var(--border-strong); border-radius: 6px; padding: 10px; }
.search-modal .input { width: 100%; height: 38px; }
.search-list { list-style: none; margin: 8px 0 0; padding: 0; }
.search-list a { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: var(--radius); color: var(--text); gap: 10px; }
.search-list a:hover, .search-list a:focus { background: var(--bg3); text-decoration: none; }
.search-list small { color: var(--text-3); }
.tour-card { width: min(460px, calc(100vw - 32px)); background: var(--bg2); border: 1px solid var(--border-strong); border-radius: 6px; padding: 18px 20px; }
.tour-card h2 { margin: 4px 0 8px; font-size: 18px; font-weight: 500; }
.tour-card p { color: var(--text-2); margin: 0 0 16px; }
.tour-step { color: #F46800; font-size: 12px; font-weight: 600; }
.tour-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .search-btn { min-width: 0; }
  .arch-top { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .sidenav { transform: translateX(-100%); transition: transform .2s; box-shadow: 10px 0 30px rgba(0, 0, 0, .5); }
  body.nav-open .sidenav { transform: none; }
  .main { margin-left: 0; }
  .rd-grid { grid-template-columns: minmax(0, 1fr); }
  .rule-head { grid-template-columns: 16px 70px minmax(0, 1fr) 90px; }
  .rule-head .sev, .rule-head .rule-for { display: none; }
}
@media (max-width: 768px) {
  .hide-sm { display: none; }
  .dash { padding: 10px; }
  .page { padding: 12px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
  .dash-grid > * { grid-column: 1 / -1 !important; grid-row: auto !important; }
  .dash-grid > .panel { height: max(var(--ph), 150px); }
  .dash-grid > .panel--timeseries { height: max(var(--ph), 300px); }
  .dash-grid > .panel--logs { height: 380px; }
  .dash-grid > .dash-row { height: 32px; }
  .ts--right { flex-direction: column; }
  .ts--right .ts-legend { max-width: none; max-height: 40%; }
  .dash-picker { font-size: 16px; }
  .dash-picker-folder { display: none; }
  .tl-row { grid-template-columns: 110px minmax(0, 1fr); }
  .qe-row { flex-direction: column; }
  .demo-bar { gap: 6px; padding: 0 8px; }
  .demo-name { font-size: 12px; }
  .breadcrumbs > :not(:last-child) { display: none; }
  .view-overlay { padding: 8px; }
}
@media (max-width: 480px) {
  .hide-xs { display: none; }
  .demo-name { max-width: 40vw; }
  .avatar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
