/* SmokePing Modern - same look as XIPAR Web (tokens, header, controls), plus the side bar and graphs */
:root {
  --bg: #f4f5f7; --panel: #ffffff; --text: #1d2330; --muted: #646d7e; --line: #dde1e8;
  --accent: #1f6feb; --accent-text: #ffffff; --ok: #1a7f37; --warn: #9a6700; --err: #cf222e; --info: #0969da;
  --ok-bg: #dafbe1; --warn-bg: #fff8c5; --err-bg: #ffebe9; --info-bg: #ddf4ff;
  --code: #f6f8fa; --chip: #eef1f5; --set: #fffbe6;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --side: 230px; --top: 49px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218; --panel: #171b23; --text: #e3e7ee; --muted: #9099a8; --line: #2a303b;
    --accent: #4c8dff; --accent-text: #0b0e13; --ok: #3fb950; --warn: #d29922; --err: #f85149; --info: #58a6ff;
    --ok-bg: #12301b; --warn-bg: #3a2e0b; --err-bg: #3d1517; --info-bg: #0d2a4a;
    --code: #11151c; --chip: #222833; --set: #2a2611;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { background: var(--code); border: 1px solid var(--line); border-radius: 6px; padding: 10px; overflow: auto;
  margin: 6px 0; white-space: pre-wrap; word-break: break-all; max-height: 60vh; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
h3 { font-size: 14px; margin: 14px 0 6px; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 16px; }
.right { margin-left: auto; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 6px; }
.grow { flex: 1 1 auto; }
.nowrap { white-space: nowrap; }

/* top bar */
header.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; height: var(--top);
  background: var(--panel); border-bottom: 1px solid var(--line); padding: 0 16px; }
.brand { font-weight: 700; font-size: 16px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand:hover { text-decoration: none; }
.brand span span, .brand > span > span { color: var(--accent); }
.brand-icon { width: 22px; height: 22px; vertical-align: -5px; margin-right: 8px; }
.ver { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text); padding: 2px 8px; border: 1px solid var(--line); border-radius: 12px; white-space: nowrap; }
.ver:hover { text-decoration: none; border-color: var(--accent); }
.ver:empty { display: none; }
.ver.avail { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); font-weight: 600; }
.topright { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.topright a.tb, .topright button.tb { padding: 5px 10px; border-radius: 6px; color: var(--text); border: none; background: none; font: inherit; cursor: pointer; }
.topright a.tb:hover, .topright button.tb:hover { background: var(--chip); text-decoration: none; }
.topright a.tb.on { background: var(--chip); font-weight: 600; }
.topright .alarmchip { background: var(--err); color: #fff; font-weight: 700; border-radius: 12px; padding: 2px 9px; font-size: 12px; }
.topright .alarmchip:hover { text-decoration: none; filter: brightness(1.1); }
.topright .okchip { color: var(--ok); font-size: 12px; padding: 2px 8px; border: 1px solid var(--ok); border-radius: 12px; }
.usermenu { position: relative; }
.usermenu .drop { position: absolute; right: 0; top: 34px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); min-width: 180px; padding: 6px; z-index: 20; display: flex; flex-direction: column; }
.usermenu .drop a, .usermenu .drop button { text-align: left; padding: 6px 10px; border-radius: 6px; color: var(--text); background: none; border: none; font: inherit; cursor: pointer; }
.usermenu .drop a:hover, .usermenu .drop button:hover { background: var(--chip); text-decoration: none; }
.menu-btn { display: none; border: none; background: none; font-size: 20px; color: var(--text); cursor: pointer; padding: 2px 6px; }

/* side bar */
.layout { display: flex; min-height: calc(100vh - var(--top)); }
aside.side { width: var(--side); flex: 0 0 var(--side); background: var(--panel); border-right: 1px solid var(--line);
  position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; padding: 10px 8px 20px; }
aside.side a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; color: var(--text); }
aside.side a:hover { background: var(--chip); text-decoration: none; }
aside.side a.on { background: var(--info-bg); color: var(--info); font-weight: 600; }
aside.side a .n { margin-left: auto; font-size: 11.5px; color: var(--muted); }
aside.side a.on .n { color: var(--info); }
aside.side a .ic { width: 16px; text-align: center; color: var(--muted); }
aside.side a.on .ic { color: var(--info); }
aside.side .sh { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 4px; display: flex; align-items: center; }
aside.side .sh button { margin-left: auto; padding: 0 6px; font-size: 14px; line-height: 18px; }
aside.side .dot { flex: 0 0 auto; }
main { flex: 1 1 auto; min-width: 0; padding: 16px 20px 60px; }
@media (max-width: 860px) {
  .menu-btn { display: inline-block; }
  aside.side { position: fixed; left: 0; top: var(--top); z-index: 15; transform: translateX(-100%); transition: transform .15s; box-shadow: 4px 0 18px rgba(0,0,0,.2); }
  body.side-open aside.side { transform: none; }
  main { padding: 12px 16px 60px; }
  .ver { display: none; }
}

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.pagehead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pagehead h1 { margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 5px 18px; font-size: 13px; align-items: baseline; }
.kv > :nth-child(odd) { color: var(--muted); }

/* buttons, inputs */
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 6px; padding: 5px 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
button:hover, .btn:hover { border-color: var(--accent); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--err); border-color: var(--err); }
button.link { border: none; background: none; color: var(--accent); padding: 0 2px; }
button.icon { padding: 3px 7px; }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=email], input[type=datetime-local], select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { font-family: var(--mono); font-size: 12.5px; width: 100%; }
label.chk { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

/* chips, dots */
.chip { display: inline-block; padding: 1px 7px; border-radius: 10px; background: var(--chip); font-size: 12px; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.err { background: var(--err-bg); color: var(--err); }
.chip.info { background: var(--info-bg); color: var(--info); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); flex: 0 0 auto; }
.dot.up { background: var(--ok); } .dot.down { background: var(--err); } .dot.loss { background: var(--warn); }
.dot.stale, .dot.unknown { background: var(--line); box-shadow: inset 0 0 0 1px var(--muted); }
.dot.down { animation: blink 1.2s step-start infinite; }
@keyframes blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .dot.down { animation: none; } }
.issue { display: flex; gap: 8px; align-items: flex-start; padding: 6px 9px; border-radius: 6px; margin: 4px 0; font-size: 13px; }
.issue.err { background: var(--err-bg); } .issue.warn { background: var(--warn-bg); } .issue.info { background: var(--info-bg); } .issue.ok { background: var(--ok-bg); }

/* tables */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: 12px; color: var(--muted); font-weight: 600; }
table.list tr:hover td { background: var(--code); }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { border-bottom: 2px solid transparent; padding: 7px 12px; color: var(--text); }
.tabs a:hover { text-decoration: none; background: var(--chip); border-radius: 6px 6px 0 0; }
.tabs a.on { border-bottom-color: var(--accent); font-weight: 600; }

/* forms */
.form { display: grid; grid-template-columns: max-content minmax(200px, 380px) 1fr; gap: 8px 12px; align-items: center; }
.form > label { font-weight: 600; font-size: 13px; }
.form .help { color: var(--muted); font-size: 12px; }
.form input[type=text], .form input[type=number], .form input[type=password], .form input[type=url], .form select { width: 100%; }
.form .full { grid-column: 1 / -1; }
.form h3 { grid-column: 1 / -1; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
@media (max-width: 760px) { .form { grid-template-columns: 1fr; } .form .help { margin-top: -4px; } }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.cmd { position: relative; }
.cmd pre { padding-right: 70px; }
.cmd button { position: absolute; right: 6px; top: 6px; font-size: 12px; padding: 2px 8px; }

/* modal, toast, login */
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; overflow: auto; }
.modal .box { background: var(--panel); border-radius: 10px; border: 1px solid var(--line); width: min(860px, 100%); padding: 18px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.modal .box.narrow { width: min(460px, 100%); }
.modal .box h2 { margin-top: 0; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.toast { position: fixed; right: 16px; bottom: 20px; z-index: 40; background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 8px; max-width: 480px; }
.toast.err { background: var(--err); color: #fff; }
.login { max-width: 360px; margin: 10vh auto; }
.login input { width: 100%; margin-bottom: 8px; }
body.nologin aside.side, body.nologin .topright, body.nologin .menu-btn { display: none; }

/* range bar */
.rangebar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: none; border-radius: 0; padding: 4px 10px; font-size: 12.5px; background: var(--panel); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }

/* graph cards */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); }
.cards.wide { grid-template-columns: 1fr; }
@media (max-width: 600px) { .cards { grid-template-columns: 1fr; } }
.gcard { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 8px; min-width: 0; }
.gcard.alarm { border-color: var(--err); box-shadow: inset 4px 0 0 var(--err); }
.gcard.dragging { opacity: .45; }
.gcard.dropbefore { box-shadow: -4px 0 0 var(--accent); }
.ghead { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.ghead h3 { margin: 0; font-size: 14.5px; }
.ghead h3 a { color: var(--text); }
.ghead .host { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ghead .tools { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.ghead .grip { cursor: grab; color: var(--muted); padding: 0 4px; user-select: none; }
.pin { border: none; background: none; font-size: 17px; line-height: 1; color: var(--muted); padding: 0 3px; }
.pin.on { color: #e3a008; }
.pin:hover { color: #e3a008; }

/* the chart */
.pc { position: relative; }
.pc + .pc { margin-top: 6px; }
.pc-head { font-size: 12px; font-weight: 600; color: var(--muted); margin: 2px 0 2px; }
.pc-wrap { position: relative; }
.pc-wrap canvas { display: block; cursor: crosshair; }
.pc-tip { position: absolute; pointer-events: none; padding: 6px 9px; border-radius: 6px; font-size: 12px; line-height: 1.5; white-space: nowrap; z-index: 5;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.pc-tip em, .pc-key em { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.pc-when { color: var(--muted); }
.pc-bad { color: var(--err); }
.pc-reset { position: absolute; top: 12px; left: 14px; font-size: 11px; padding: 1px 9px; border-radius: 10px; }
.pc-busy { position: absolute; top: 12px; right: 76px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pc-legend { font-size: 12px; margin-top: 2px; }
.pc-row { display: flex; gap: 4px 14px; flex-wrap: wrap; align-items: center; padding: 1px 0; }
.pc-row b { min-width: 90px; font-weight: 600; }
.pc-row i { font-style: normal; color: var(--muted); }
.pc-row span { font-variant-numeric: tabular-nums; }
.pc-scale { color: var(--muted); }
.pc-key { display: inline-flex; align-items: center; margin-right: 2px; }
.pc-down { background: rgba(255,0,0,.25); border: 1px solid rgba(255,0,0,.5); }
.pc-probe { color: var(--muted); font-size: 11.5px; }

/* network maps */
.nm-panel { padding: 8px; }
.nm-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 4px 4px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.nm-tools button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.nm-tools .nm-pick { max-width: 320px; }
.nm-wrap { position: relative; }
.nm-svg { display: block; width: 100%; height: min(72vh, 760px); user-select: none; cursor: grab; }
.nm-svg.panning, .nm-svg.panning * { cursor: grabbing !important; }
.nm-zoom { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.nm-zoom button { padding: 2px 9px; font-size: 13px; background: var(--panel); }
.nm-zoom button:first-child, .nm-zoom button:nth-child(2) { min-width: 30px; justify-content: center; font-weight: 700; }
.nm.editing .nm-svg { background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 20px 20px; }
.nm-link .nm-hit { stroke: transparent; stroke-width: 16; cursor: default; }
.nm-link .nm-line { stroke: var(--ok); stroke-width: 3; }
.nm-link.warn .nm-line { stroke: var(--warn); }
.nm-link.bad .nm-line { stroke: var(--err); }
.nm-link.nodata .nm-line { stroke: var(--muted); }
.nm-link.none .nm-line { stroke: var(--muted); stroke-dasharray: 6 5; }
.nm-link.guess .nm-line { stroke-dasharray: 2 6; stroke-linecap: round; }
.nm-link.sel .nm-line { stroke: var(--accent); stroke-width: 5; }
.nm-link:hover .nm-line { stroke-width: 5; }
.nm-ltext { font-size: 12px; font-weight: 600; fill: var(--text); text-anchor: middle; paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.nm-ltext.side { text-anchor: start; }
.nm-link.none .nm-ltext, .nm-link.nodata .nm-ltext { fill: var(--muted); font-weight: 400; }
.nm-node { cursor: pointer; }
.nm.editing .nm-node { cursor: grab; }
.nm-node .nm-shape { fill: var(--panel); stroke: var(--muted); stroke-width: 3; }
.nm-node.up .nm-shape { fill: var(--ok-bg); stroke: var(--ok); }
.nm-node.loss .nm-shape { fill: var(--warn-bg); stroke: var(--warn); }
.nm-node.down .nm-shape { fill: var(--err-bg); stroke: var(--err); }
.nm-node.server .nm-shape { fill: var(--info-bg); stroke: var(--info); }
.nm-node.alarm .nm-shape { stroke-width: 5; }
.nm-node.sel .nm-shape, .nm-node.from .nm-shape { stroke: var(--accent); stroke-width: 5; }
.nm-node .nm-icon { text-anchor: middle; font-size: 15px; font-weight: 700; fill: var(--text); pointer-events: none; }
.nm-node.down .nm-icon { fill: var(--err); }
.nm-node.loss .nm-icon { fill: var(--warn); }
.nm-name { text-anchor: middle; font-size: 12.5px; font-weight: 600; fill: var(--text); paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
.nm-val { text-anchor: middle; font-size: 11.5px; fill: var(--muted); paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
.nm-empty { text-anchor: middle; font-size: 14px; fill: var(--muted); }
.nm-tip { position: absolute; pointer-events: none; padding: 7px 10px; border-radius: 6px; font-size: 12px; line-height: 1.5; max-width: 360px; z-index: 5;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.nm-th { font-weight: 700; margin-bottom: 2px; }
.nm-muted { color: var(--muted); }
.nm-warn { color: var(--warn); }
.nm-auto { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }

/* status table, events */
table.events td.when { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 6px; }
.commits { max-height: 220px; overflow: auto; background: var(--code); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; margin: 6px 0; }
pre.joblog { max-height: 55vh; min-height: 120px; }
.orderlist { list-style: none; margin: 0; padding: 0; }
.orderlist li { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.orderlist li .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mattermost recipient: people search */
.mm-found { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 4px; max-height: 180px; overflow-y: auto; }
.mm-person { text-align: left; font-size: 13px; }
