/* RapidNet IP Logs — palette borrowed from the fiber colour code (TIA-598): blue, orange, green, brown, slate */
:root {
  --bg: #eef1f1;
  --surface: #ffffff;
  --ink: #17232c;
  --ink-2: #4c5a63;
  --muted: #6f7c84;
  --rule: #d6dddd;
  --rule-2: #e7ecec;
  --blue: #1d5bb8;
  --blue-ink: #144a99;
  --orange: #e2761b;
  --green: #2f8a4c;
  --brown: #8a5a36;
  --slate: #6e7f8a;
  --red: #c23a2b;
  --amber-bg: #fdf3e4;
  --red-bg: #fbeceb;
  --green-bg: #e9f5ed;
  --focus: #1d5bb8;
  --radius: 6px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, "Noto Sans", "Noto Sans Bengali", sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", "Consolas", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12191e;
    --surface: #182228;
    --ink: #e4ebee;
    --ink-2: #b4c0c6;
    --muted: #8796a0;
    --rule: #2b3840;
    --rule-2: #223038;
    --blue: #5b95e6;
    --blue-ink: #8bb6f2;
    --orange: #f0954a;
    --green: #5bbd7a;
    --brown: #b98760;
    --slate: #8fa1ad;
    --red: #ef6c5d;
    --amber-bg: #33291a;
    --red-bg: #3a2220;
    --green-bg: #1b3324;
    --focus: #8bb6f2;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); font-variant-numeric: tabular-nums; }
a { color: var(--blue-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 16px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1rem; margin: 0; font-weight: 600; }
h3 { font-size: .9rem; margin: 18px 0 6px; font-weight: 600; color: var(--ink-2); }
p { margin: 0 0 10px; }
code { font-family: var(--mono); font-size: .85em; background: var(--rule-2); padding: 1px 5px; border-radius: 4px; }
.mono { font-family: var(--mono); font-size: .86em; }
.muted { color: var(--muted); }
.small, .small td { font-size: .85rem; }
.lead { color: var(--ink-2); max-width: 75ch; margin-bottom: 18px; }
.hint { color: var(--muted); font-size: .88rem; margin: 8px 0 0; }
.empty { color: var(--muted); padding: 10px 0; }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 54px; background: var(--surface); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: .98rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand svg { width: 34px; height: 20px; }
.brand b { font-weight: 600; }
.f-blue { fill: var(--blue); } .f-orange { fill: var(--orange); } .f-green { fill: var(--green); }
nav.main { display: flex; align-items: stretch; gap: 2px; height: 100%; overflow-x: auto; scrollbar-width: none; flex: 1; }
nav.main a { display: flex; align-items: center; padding: 0 11px; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; font-size: .93rem; }
nav.main a:hover { color: var(--ink); text-decoration: none; }
nav.main a[aria-current] { color: var(--ink); border-bottom-color: var(--blue); font-weight: 600; }
nav.main .sep { width: 1px; background: var(--rule); margin: 14px 8px; }
.who { display: flex; align-items: center; gap: 12px; font-size: .9rem; white-space: nowrap; }
.who form { margin: 0; }
button.link { background: none; border: 0; padding: 0; color: var(--blue-ink); font: inherit; cursor: pointer; }
button.link:hover { text-decoration: underline; }
button.link.danger, a.danger { color: var(--red); }

main { max-width: 1320px; margin: 0 auto; padding: 24px 20px 40px; }
.foot { max-width: 1320px; margin: 0 auto; padding: 0 20px 28px; color: var(--muted); font-size: .8rem; }
.banner { padding: 9px 20px; font-size: .9rem; }
.banner.warn { background: var(--amber-bg); border-bottom: 1px solid var(--orange); }

/* ---------- trace bar: the main question ---------- */
.trace { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 18px 20px 16px; margin-bottom: 20px; position: relative; overflow: hidden; }
.trace::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--blue) 0 20%, var(--orange) 20% 40%, var(--green) 40% 60%, var(--brown) 60% 80%, var(--slate) 80% 100%); }
.trace h1 { font-size: 1.35rem; margin: 2px 0 12px; color: #fff; }
.trace-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.trace label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: #b9c6cd; }
.trace input { background: #22313a; border: 1px solid #3a4b55; color: #fff; min-width: 0; }
.trace input::placeholder { color: #7f919b; }
.trace input { height: 38px; }
.trace label:first-of-type input { width: 190px; }
.trace .hint { color: #9fb0b9; }
.trace .hint a { color: #a9c9f5; }
@media (prefers-color-scheme: dark) { .trace { background: #0d1418; border: 1px solid var(--rule); } }

/* ---------- headline figures: one line, not cards ---------- */
.figures { display: flex; flex-wrap: wrap; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 0 0 20px; }
.figures div { flex: 1 1 150px; padding: 12px 16px 12px 0; display: flex; flex-direction: column; }
.figures div + div { padding-left: 16px; border-left: 1px solid var(--rule-2); }
.figures b { font-size: 1.55rem; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
.figures span { color: var(--muted); font-size: .85rem; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; min-width: 0; }
.panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel > header .muted { font-size: .85rem; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cols > .panel { margin-bottom: 0; }
.cols { margin-bottom: 18px; }
.cols.three { grid-template-columns: repeat(3, 1fr); }
.cols.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1200px) { .cols.four { grid-template-columns: 1fr 1fr; } }
@media (max-width: 1000px) { .cols.three { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .cols, .cols.three, .cols.four { grid-template-columns: 1fr; } }
.pagehead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.pagehead h1 { margin: 0; }
.spacer { flex: 1; }

/* ---------- charts ---------- */
svg.chart { width: 100%; height: 140px; display: block; }
.ticks { display: flex; justify-content: space-between; font-size: .74rem; color: var(--muted); margin-top: 4px; gap: 4px; overflow: hidden; white-space: nowrap; }
@media (max-width: 560px) { .ticks span:nth-child(even) { display: none; } }
.chart .grid { stroke: var(--rule-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-max { font-size: .78rem; color: var(--muted); text-align: right; margin: -2px 0 0; }
.c-blue { fill: var(--blue); background: var(--blue); }
.c-orange { fill: var(--orange); background: var(--orange); }
.c-green { fill: var(--green); background: var(--green); }
.c-brown { fill: var(--brown); background: var(--brown); }
.c-slate { fill: var(--slate); background: var(--slate); }
.chart rect:hover { opacity: .75; }
.track { fill: var(--rule-2); }
svg.meter { display: block; width: 100%; height: 5px; margin-top: 4px; }
svg.stack { display: block; width: 100%; height: 18px; border-radius: 3px; margin: 4px 0 10px; }
.legend { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .86rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
table.grid th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: .82rem; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.grid td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
table.grid tbody tr:hover td { background: color-mix(in srgb, var(--blue) 5%, transparent); }
.num { text-align: right; white-space: nowrap; }
td.wrap { word-break: break-word; max-width: 60ch; }
td.hot, .hot { color: var(--orange); font-weight: 600; }
table.rank td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--rule-2); }
table.rank td:first-child { width: 100%; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions > * { margin-left: 10px; }
.row-actions form { display: inline; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; background: var(--slate); vertical-align: 1px; }
.dot.ok { background: var(--green); } .dot.bad { background: var(--orange); } .dot.off { background: var(--rule); }
.tag { display: inline-block; font-size: .76rem; padding: 0 7px; border-radius: 10px; background: var(--rule-2); color: var(--ink-2); line-height: 1.6; white-space: nowrap; }
.tag.ok { background: var(--green-bg); color: var(--green); }
.tag.bad { background: var(--red-bg); color: var(--red); }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 4px 0; border-bottom: 1px solid var(--rule-2); }

/* ---------- forms ---------- */
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 5px; padding: 7px 9px; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 22%, transparent); }
textarea { width: 100%; resize: vertical; font-family: var(--mono); font-size: .85rem; }
input[readonly] { background: var(--rule-2); color: var(--muted); }
label { display: flex; flex-direction: column; gap: 4px; font-size: .83rem; color: var(--ink-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: .92rem; color: var(--ink); margin: 6px 0; }
input.inline { width: 70px; padding: 2px 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: .92rem; padding: 7px 14px; border-radius: 5px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--slate); text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--blue-ink); }
.btn.small { padding: 4px 10px; font-size: .84rem; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.filters .grow { flex: 1 1 260px; }
.filters .actions { display: flex; gap: 8px; }
.presets { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .84rem; }
.presets button { font: inherit; font-size: .84rem; background: none; border: 1px solid var(--rule); border-radius: 12px; padding: 1px 10px; color: var(--ink-2); cursor: pointer; }
.presets button:hover { border-color: var(--blue); color: var(--blue-ink); }
.stack-form { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
.stack-form .actions, .settings .actions { display: flex; gap: 8px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form label { flex: 1 1 260px; max-width: 420px; }
.row2 > *, .row4 > * { min-width: 0; }
.row2 input, .row4 input, .row2 select, .row4 select, .settings label > input:not([type=checkbox]):not([type=radio]), .settings label > select { width: 100%; }
label.check > input { flex: none; margin-top: 3px; }
label.check { align-items: flex-start; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 10px; }
@media (max-width: 900px) { .row4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .row2, .row4 { grid-template-columns: 1fr; } }
fieldset { min-width: 0; border: 0; border-top: 1px solid var(--rule-2); padding: 14px 0 6px; margin: 0; }
fieldset:first-of-type { border-top: 0; padding-top: 0; }
legend { font-weight: 600; padding: 0 0 8px; }
.settings .actions { padding-top: 8px; }

.resultbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; font-size: .9rem; color: var(--ink-2); margin: 4px 0 10px; }
.pager { display: flex; gap: 16px; align-items: center; justify-content: flex-end; padding: 12px 0; font-size: .9rem; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 5px; overflow: hidden; background: var(--surface); }
.seg a { padding: 6px 12px; color: var(--ink-2); font-size: .9rem; border-left: 1px solid var(--rule); }
.seg a:first-child { border-left: 0; }
.seg a[aria-current] { background: var(--ink); color: var(--surface); font-weight: 600; text-decoration: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin-bottom: 14px; }
.tabs a { padding: 8px 14px; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--orange); font-weight: 600; }
.answer { border-left: 4px solid var(--orange); background: var(--surface); padding: 12px 16px; margin: 0 0 14px; border-radius: 0 var(--radius) var(--radius) 0; font-size: 1.05rem; }
.answer p { margin: 0 0 6px; }

.flash { padding: 9px 13px; border-radius: 5px; margin: 0 0 10px; border-left: 4px solid var(--green); background: var(--green-bg); font-size: .92rem; }
.flash.warn { border-left-color: var(--orange); background: var(--amber-bg); }
.flash.err { border-left-color: var(--red); background: var(--red-bg); }
.checks { list-style: none; padding: 0; margin: 0 0 12px; }
.checks li { padding: 3px 0 3px 22px; position: relative; font-size: .92rem; }
.checks li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 9px; height: 9px; border-radius: 50%; }
.checks li.ok::before { background: var(--green); }
.checks li.bad::before { background: var(--red); }
.checks li.bad { color: var(--red); }
.version { font-size: 1.5rem; font-weight: 600; margin-bottom: 14px; }

/* ---------- install + setup ---------- */
.install-page { padding: 32px 16px; }
.install { max-width: 860px; margin: 0 auto; }
.install > .brand { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; margin-bottom: 18px; }
.install > .brand svg { width: 34px; height: 20px; }
.install > .brand .muted { margin-left: auto; font-size: .85rem; }
ol.steps { display: flex; flex-wrap: wrap; gap: 6px 22px; list-style: none; counter-reset: s; padding: 0; margin: 0 0 18px; font-size: .9rem; color: var(--muted); }
ol.steps li { counter-increment: s; }
ol.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--rule); margin-right: 7px; font-size: .78rem; }
ol.steps li.now { color: var(--ink); font-weight: 600; }
ol.steps li.now::before { background: var(--blue); border-color: var(--blue); color: #fff; }
ol.steps li.done::before { content: "✓"; background: var(--green); border-color: var(--green); color: #fff; }
ol.setup { padding-left: 22px; margin: 0; }
ol.setup > li { padding: 4px 0 14px; }
ol.setup h3 { margin: 0 0 6px; color: var(--ink); font-size: .98rem; }
ol.setup label { margin: 8px 0; }
.copy { display: flex; gap: 8px; }
.copy input { flex: 1; font-size: .8rem; }
#rsc, #rsc-rm { min-height: 300px; font-size: .8rem; white-space: pre; overflow-x: auto; }
.scripts { margin: 14px 0 0; }
.scripts h3 { display: flex; justify-content: space-between; align-items: center; margin-top: 0; }
.settings label.check { font-size: .9rem; }
.checks li.warn::before { background: var(--orange); }

/* ---------- login ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 26px 26px 22px; display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; }
.login::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--blue) 0 20%, var(--orange) 20% 40%, var(--green) 40% 60%, var(--brown) 60% 80%, var(--slate) 80% 100%); }
.login .brand { font-size: 1.15rem; }
.login p { font-size: .86rem; margin: 0; }
.login .btn { margin-top: 4px; padding: 9px; }

@media (max-width: 760px) {
  .top { height: auto; flex-wrap: wrap; padding: 8px 16px 0; gap: 6px 14px; }
  nav.main { order: 3; flex-basis: 100%; height: 42px; }
  .who { margin-left: auto; }
  main { padding: 16px 16px 32px; }
  .figures div + div { padding-left: 0; border-left: 0; }
  .trace label:first-of-type input { width: 100%; }
  .trace label { flex: 1 1 140px; }
}
@media print {
  .top, .filters, .foot, .banner, .btn { display: none !important; }
  body { background: #fff; }
  .panel { border: 0; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
