:root {
  --bg: #f5f6f8; --panel: #ffffff; --panel2: #f9fafb; --line: #e3e6eb; --text: #18202b; --muted: #687385;
  --accent: #2563eb; --accent-soft: #e8efff; --smoke1: rgba(24, 32, 43, .07); --smoke2: rgba(24, 32, 43, .13); --smoke3: rgba(24, 32, 43, .22);
  --grid: #eceef2; --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #11161e; --panel: #171e28; --panel2: #1b2330; --line: #263142; --text: #e6ebf2; --muted: #8b97a8;
  --accent: #5b8cff; --accent-soft: #1d2a44; --smoke1: rgba(230, 235, 242, .06); --smoke2: rgba(230, 235, 242, .11); --smoke3: rgba(230, 235, 242, .2);
  --grid: #222c3a; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161e; --panel: #171e28; --panel2: #1b2330; --line: #263142; --text: #e6ebf2; --muted: #8b97a8;
    --accent: #5b8cff; --accent-soft: #1d2a44; --smoke1: rgba(230, 235, 242, .06); --smoke2: rgba(230, 235, 242, .11); --smoke3: rgba(230, 235, 242, .2);
    --grid: #222c3a; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 24px; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-size: 12.5px; }

.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 2px; font-weight: 700; letter-spacing: .01em; padding: 4px 8px 14px; font-size: 15px; }
.brand .tld { color: var(--muted); font-weight: 500; }
.brand b { margin-left: 6px; color: var(--accent); font-weight: 700; }
.logo { width: 18px; height: 18px; border-radius: 4px; margin-right: 8px; background: var(--accent) url("/static/favicon.svg") center/cover; }
.filter { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--panel2); margin: 0 4px 12px; }
.filter input { border: 0; outline: 0; background: transparent; color: var(--text); padding: 7px 0; flex: 1; min-width: 0; font: inherit; }
kbd { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
nav .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 8px 4px; }
nav a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; color: var(--text); }
nav a:hover { background: var(--panel2); }
nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
nav a .n { margin-left: auto; font-size: 11px; color: var(--muted); }
nav .sub a { padding-left: 26px; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }

main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.crumbs { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a { color: var(--muted); font-weight: 500; }
.crumbs a:hover { color: var(--accent); }
.sources { margin-left: auto; display: flex; gap: 4px; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.sources button { border: 0; background: transparent; color: var(--muted); padding: 4px 10px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; white-space: nowrap; }
.sources button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.live.stale i { background: var(--warn); }
.icon-btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 15px; }
.menu-btn, .side-bg { display: none; }

.view { padding: 22px 24px 40px; flex: 1; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0; }
.lead { margin: 0 0 20px; color: var(--muted); }
.grid { display: grid; gap: 14px; }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
a.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-h .r { margin-left: auto; }
.ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--muted); display: inline-flex; gap: 5px; align-items: center; }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 8px; padding: 4px 10px; cursor: pointer; font: inherit; font-size: 13px; }
.btn.on { border-color: var(--accent); color: var(--accent); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.spark { display: block; width: 160px; height: 30px; }
.toplist td { padding: 6px 8px; }

.chart-card { padding: 14px 16px 12px; margin-bottom: 14px; }
.chart-card .card-h { margin-bottom: 6px; }
canvas.chart { width: 100%; height: 230px; display: block; cursor: crosshair; }
.statrow { display: flex; flex-wrap: wrap; gap: 18px 28px; margin-top: 10px; align-items: flex-start; }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.stat .vals { display: flex; gap: 6px; flex-wrap: wrap; }
.stat .v { border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; background: var(--panel2); min-width: 64px; }
.stat .v small { display: block; font-size: 10px; color: var(--muted); }
.stat .v b { font-family: var(--mono); font-weight: 600; font-size: 12.5px; }
.legend-loss { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 11px; color: var(--muted); margin-top: 8px; }
.legend-loss i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 3px; }
.probe { font-size: 11px; color: var(--muted); margin-top: 4px; }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }

.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 24px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.tip { position: fixed; z-index: 30; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.15); min-width: 150px; }
.tip b { font-family: var(--mono); }
.tip .row { display: flex; justify-content: space-between; gap: 12px; }

@media (max-width: 1100px) { .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .app { display: block; }
  .side { position: fixed; z-index: 25; left: 0; top: 0; bottom: 0; width: min(280px, 84vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 0 24px rgba(0,0,0,.25); padding-top: calc(16px + env(safe-area-inset-top)); }
  .app.nav-open .side { transform: none; }
  .app.nav-open .side-bg { display: block; position: fixed; inset: 0; z-index: 24; background: rgba(10,14,20,.45); }
  .menu-btn { display: inline-grid; align-content: center; gap: 4px; width: 38px; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); cursor: pointer; flex: none; }
  .menu-btn span { display: block; height: 2px; border-radius: 2px; background: var(--text); }
  .top { flex-wrap: wrap; padding: calc(8px + env(safe-area-inset-top)) 12px 10px; gap: 8px 10px; }
  .crumbs { flex: 1; }
  .sources { order: 5; margin: 0; width: 100%; overflow-x: auto; }
  .sources button { flex: 1; }
  .live { display: none; }
  .view { padding: 14px 12px 32px; }
  .cols-3, .cols-2 { grid-template-columns: 1fr; }
  canvas.chart { height: 200px; }
  .hide-m { display: none; }
  .spark { width: 90px; }
  td, th { padding: 7px 6px; }
}

/* ---- Weg zum Ziel (Traceroute) ---- */
.route-card { margin-bottom: 14px; }
.lanes { display: grid; gap: 6px; }
.lane { display: grid; grid-template-columns: 170px 1fr auto; gap: 12px; align-items: center; padding: 10px 10px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; }
.lane:hover { background: var(--panel2); }
.lane.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.lane:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lane-src { display: grid; grid-template-columns: 10px 1fr; column-gap: 8px; align-items: center; }
.lane-src i { width: 10px; height: 10px; border-radius: 50%; grid-row: span 2; }
.lane-src small { color: var(--muted); font-size: 11.5px; grid-column: 2; }
.lane-track { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 0; min-width: 0; }
.seg-pill, .seg-dst { display: inline-flex; flex-direction: column; padding: 5px 10px; border-radius: 8px; line-height: 1.25; min-width: 0; }
.seg-pill { background: color-mix(in srgb, var(--c) 13%, var(--panel)); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-left: 4px solid var(--c); }
.seg-pill b, .seg-dst b { font-size: 12.5px; white-space: nowrap; }
.seg-pill small, .seg-dst small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.seg-dst { border: 1.5px solid var(--text); background: var(--panel); }
.seg-dst small { font-family: var(--mono); color: var(--text); }
.seg-dst.bad { border-color: var(--bad); }
.arrow { width: 22px; height: 2px; background: var(--line); position: relative; flex: none; margin: 0 2px; }
.arrow::after { content: ""; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left: 6px solid var(--muted); border-right: 0; }
.lane-note { flex-basis: 100%; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.lane-chg .chip { white-space: nowrap; }
.chip.ok-chip { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.chip.warn-chip { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }

/* ---- Vergleich ---- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; padding: 4px 10px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
canvas.chart-cmp { width: 100%; height: 220px; display: block; }
.cmp-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 12.5px; }
.cmp-legend .lg { display: inline-flex; align-items: baseline; gap: 6px; }
.cmp-legend .lg.on { font-weight: 600; }
.cmp-legend i, .tip i.sw { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: 3px; margin-right: 5px; }
.cmp-legend b { font-family: var(--mono); font-weight: 600; }
.sec-h { margin: 22px 0 10px; }

/* ---- Hops ---- */
.metro { display: grid; gap: 4px; }
.m-seg { border-left: 3px solid var(--c); margin-left: 34px; padding: 2px 0 6px; }
.m-seg-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 4px 0 4px 14px; }
.m-seg-h b { color: var(--c); }
.m-hop { display: grid; grid-template-columns: 1fr minmax(120px, 34%) 60px; gap: 10px; align-items: center; position: relative; padding: 5px 0 5px 14px; border-top: 1px dashed var(--grid); }
.m-n { position: absolute; left: -36px; width: 24px; text-align: right; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.m-dot { position: absolute; left: -8px; top: 50%; width: 13px; height: 13px; margin-top: -6.5px; border-radius: 50%; background: var(--panel); border: 3px solid var(--c); }
.m-hop.silent .m-dot { border-style: dotted; border-width: 2px; }
.m-hop.silent { color: var(--muted); }
.m-addr { min-width: 0; }
.m-addr .rd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.m-bar { display: flex; align-items: center; gap: 8px; }
.m-bar .bar { flex: 1; height: 8px; border-radius: 4px; background: var(--grid); position: relative; overflow: visible; }
.m-bar .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--c); opacity: .75; }
.m-bar .bar u { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); border-radius: 1px; }
.m-bar b { font-family: var(--mono); font-size: 12px; min-width: 62px; text-align: right; }
.m-loss { font-family: var(--mono); font-size: 12px; text-align: right; color: var(--muted); }
.m-loss.hot { color: var(--bad); font-weight: 600; }
.m-end { margin: 8px 0 0 34px; padding-left: 14px; font-size: 12px; color: var(--muted); }

@media (max-width: 820px) {
  .lane { grid-template-columns: 1fr; gap: 8px; padding: 10px 6px; }
  .lane-chg { justify-self: start; }
  .arrow { width: 12px; }
  canvas.chart-cmp { height: 190px; }
  .m-seg { margin-left: 26px; }
  .m-n { left: -30px; width: 20px; }
  .m-hop { grid-template-columns: 1fr 96px 44px; gap: 6px; }
  .m-bar .bar { display: none; }
  .m-bar b { min-width: 0; }
  .m-end { margin-left: 26px; }
}
