:root {
  --bg: #0f151d;
  --bg2: #161f2a;
  --bg3: #1e2a3a;
  --line: #273548;
  --fg: #d8e0ea;
  --muted: #7f8ea3;
  --accent: #5ac8fa;
  --good: #4cd964;
  --warn: #ffcc00;
  --bad: #ff453a;
  --sel: #24384f;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body { display: flex; }
a { color: var(--accent); }
button, .btn, select, input {
  font: inherit; color: var(--fg); background: var(--bg3); border: 1px solid var(--line);
  border-radius: 4px; padding: 4px 8px; text-decoration: none; cursor: pointer;
}
button:hover, .btn:hover { border-color: var(--accent); }
button.danger:hover { border-color: var(--bad); color: var(--bad); }
input { cursor: text; }
input:focus, select:focus { outline: none; border-color: var(--accent); }

#sidebar {
  width: 240px; flex: none; background: var(--bg2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0;
}
.brand { font-weight: 700; font-size: 18px; padding: 14px 14px 8px; letter-spacing: .3px; }
.brand span { color: var(--accent); }
#addForm { display: flex; gap: 6px; padding: 0 12px 8px; }
#addForm input { flex: 1; min-width: 0; }
#addForm button { width: 34px; font-weight: 700; }
.error { color: var(--bad); padding: 4px 14px; font-size: 12px; }
.foot { padding: 8px 14px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); }

#main { flex: 1; min-width: 0; padding: 12px 16px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 10px; }
.title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); font-weight: 400; }
.pill { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--bg3); color: var(--muted); font-weight: 500; }
.pill.running { color: var(--good); }
.pill.error { color: var(--bad); }
.pill.paused, .pill.tracing, .pill.resolving { color: var(--warn); }
.controls { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-left: auto; }
.controls label { color: var(--muted); display: flex; gap: 6px; align-items: center; }
.controls label.thr { gap: 4px; }
.controls label.thr input { width: 62px; padding: 3px 4px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }
.sw.good { background: var(--good); } .sw.warn { background: var(--warn); } .sw.bad { background: var(--bad); }
td.hopn { padding-left: 6px; }
td.hopn::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted); vertical-align: -1px; }
td.hopn.good::before { background: var(--good); }
td.hopn.warn::before { background: var(--warn); }
td.hopn.bad::before { background: var(--bad); }

.tablewrap { background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 4px 8px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; position: sticky; top: 0; background: var(--bg2); }
th.num, td.num { text-align: right; }
th.name, td.name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
td.ip { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--bg3); }
tbody tr.selected { background: var(--sel); }
tbody tr.final td { font-weight: 600; }
td.loss.some { color: var(--warn); }
td.loss.bad { color: var(--bad); font-weight: 600; }
td.cur.lost { color: var(--bad); }
.graphcol { width: 34%; min-width: 220px; padding: 2px 8px; }
.graphcol canvas { display: block; width: 100%; height: 18px; }
.hint { color: var(--muted); font-size: 11px; padding: 4px 8px; }

#timelines { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px 4px; }
.panel .phead { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.panel .phead .ptitle { font-weight: 600; }
.panel .phead .pstats { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.panel .phead .close { margin-left: auto; padding: 0 6px; line-height: 1.4; }
.panel canvas { display: block; width: 100%; height: 170px; cursor: crosshair; }

@media (max-width: 800px) {
  body { flex-direction: column; }
  #sidebar { width: auto; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; }
  #main { padding: 8px; }
  .graphcol { min-width: 160px; }
  th.name, td.name { display: none; }
}

/* ---- hopwatch lite additions ---- */
.brand small { font-size: 12px; font-weight: 500; color: var(--muted); }
.presets { padding: 0 12px 8px; }
.presets select { width: 100%; }
#sidebar .box { margin: 0 12px 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
#sidebar .box summary { cursor: pointer; font-weight: 600; }
#sidebar .box p { margin: 6px 0; line-height: 1.4; color: var(--fg); }
#sidebar .row { display: flex; align-items: center; gap: 6px; margin: 6px 0; color: var(--muted); }
#sidebar .row input[type=number] { width: 64px; padding: 2px 4px; }
#sidebar label.box.row { margin: 0 12px 8px; color: var(--fg); }
#sidebar #aboutBox { overflow-y: auto; }
.small { font-size: 11px; }
.banner { margin: 0 12px 8px; padding: 6px 8px; border-radius: 6px; background: rgba(255,69,58,0.16); color: var(--bad); font-weight: 600; }
#sidebar .foot { margin-top: auto; }
td.name.err { color: var(--bad); }
td.act { width: 1%; padding: 0 4px; }
td.act .rm { padding: 0 6px; line-height: 1.4; }
tbody tr.alerting td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
#hops td.ip { font-family: inherit; font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
#sidebar { overflow-y: auto; }
@media (max-width: 600px) {
  #hops th:nth-child(2), #hops td:nth-child(2), #hops th:nth-child(6), #hops td:nth-child(6),
  #hops th:nth-child(7), #hops td:nth-child(7), #hops th:nth-child(9), #hops td:nth-child(9),
  #hops th:nth-child(11), #hops td:nth-child(11) { display: none; }
  #hops td.ip { max-width: 150px; }
}
