/* Carino Test — complete network & system diagnostics. Matches the Carino
   Systems fleet: near-black surfaces, sharp gold accent, Plex Mono / Red Hat. */
:root {
  --bg:            #050505;
  --bg-card:       #0b0b0b;
  --bg-elev:       #111111;
  --accent:        #eab308;
  --accent-faint:  rgba(234,179,8,0.06);
  --accent-glow:   rgba(234,179,8,0.15);
  --accent-dim:    rgba(234,179,8,0.30);
  --border:        #262626;
  --border-soft:   #1a1a1a;
  --text:          #ffffff;
  --text-sec:      #a3a3a3;
  --text-muted:    #666666;
  --err:           #ef4444;
  --ok:            #eab308;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --disp: 'Red Hat Display', var(--sans);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background:
    radial-gradient(1100px 480px at 50% -10%, rgba(234,179,8,0.07) 0%, transparent 60%),
    linear-gradient(180deg, #0b0b0b 0%, #050505 100%);
  color: var(--text); font-family: var(--sans);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}

/* ---- header ------------------------------------------------------------ */
.hero { max-width: 1120px; margin: 0 auto; padding: 40px 24px 8px; }
.hero-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hero img { width: 34px; height: 34px; border-radius: 6px; }
.hero h1 {
  font-family: var(--disp); font-weight: 900; font-size: clamp(1.5rem, 4vw, 2.1rem);
  margin: 0; letter-spacing: -0.02em;
}
.hero h1 .accent { color: var(--accent); }
.hero .tag { color: var(--text-sec); font-family: var(--mono); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.14em; margin-left: auto; }
.hero p.lede { color: var(--text-sec); max-width: 60ch; margin: 12px 0 0; font-size: 0.92rem; line-height: 1.5; }

/* ---- controls / progress ---------------------------------------------- */
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 20px 0 6px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--text-sec);
  font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em;
  padding: 10px 16px; border-radius: 5px; transition: 0.18s; text-decoration: none;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 14px; height: 14px; }
.btn.primary { border-color: var(--accent-dim); color: var(--accent); background: var(--accent-faint); }
.btn.primary:hover { background: var(--accent-glow); }
.btn:disabled { opacity: 0.5; cursor: default; border-color: var(--border); color: var(--text-muted); }

.progress-wrap { flex: 1 1 200px; min-width: 160px; display: flex; align-items: center; gap: 10px; }
.progress { flex: 1; height: 5px; background: var(--border-soft); border-radius: 3px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent);
  transition: width 0.3s ease; }
.progress-label { font-family: var(--mono); font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; }

/* ---- panel grid -------------------------------------------------------- */
.grid { max-width: 1120px; margin: 8px auto 64px; padding: 0 24px;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  padding: 16px 18px; min-width: 0; }
.panel.wide { grid-column: 1 / -1; }
.panel h2 { font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted); margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; }
.panel h2 .h2-extra { color: var(--text-sec); font-size: 0.66rem; }

/* key/value rows */
.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 5px 0; font-family: var(--mono); font-size: 0.78rem; border-bottom: 1px solid var(--border-soft); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.68rem; flex-shrink: 0; }
.kv .v { color: var(--text); text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv .v.group { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.kv .v.bad { color: var(--err); }
.kv .v.dim { color: var(--text-sec); }

/* stat chips */
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.stat { flex: 1 1 auto; background: var(--bg-elev); border: 1px solid var(--border-soft); border-radius: 5px;
  padding: 8px 10px; min-width: 76px; }
.stat .n { font-family: var(--disp); font-weight: 700; font-size: 1.05rem; color: var(--accent); }
.stat .l { font-family: var(--mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }

/* ---- status dot -------------------------------------------------------- */
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--text-muted); }
.dot.success  { background: var(--accent); box-shadow: 0 0 5px var(--accent); }   /* reachable & responsive */
.dot.slow     { background: #ffffff; box-shadow: 0 0 5px rgba(255,255,255,0.6); } /* reachable but slow */
.dot.fail     { background: var(--err); box-shadow: 0 0 5px var(--err); }
.dot.unknown  { background: var(--text-muted); }                                  /* no connection */
.dot.scanning { background: #a3a3a3; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.legend { display: flex; flex-wrap: wrap; gap: 12px; font-family: var(--mono); font-size: 0.64rem; color: var(--text-muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ---- reachability table (top 50) -------------------------------------- */
.reach-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.reach-toolbar input, .reach-toolbar select {
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); border-radius: 4px;
  font-family: var(--mono); font-size: 0.72rem; padding: 6px 8px; }
.reach-toolbar input { flex: 1 1 160px; min-width: 120px; }
.reach-toolbar input:focus, .reach-toolbar select:focus { outline: none; border-color: var(--accent-dim); }

.table-scroll { overflow-x: auto; }
table.reach { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.74rem; }
table.reach th { text-align: left; color: var(--text-muted); font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.06em; font-size: 0.62rem; padding: 6px 8px; border-bottom: 1px solid var(--border);
  cursor: pointer; white-space: nowrap; user-select: none; position: sticky; top: 0; background: var(--bg-card); }
table.reach th.sort-asc::after  { content: ' ▲'; color: var(--accent); }
table.reach th.sort-desc::after { content: ' ▼'; color: var(--accent); }
table.reach td { padding: 5px 8px; border-bottom: 1px solid var(--border-soft); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
table.reach td.num { color: var(--text-muted); text-align: right; }
table.reach td.ip { color: var(--text-sec); }
table.reach td.lat.slow { color: #ffffff; }
table.reach td.lat.down { color: var(--text-muted); }
table.reach td.bad { color: var(--err); }
table.reach td.region { color: var(--text-muted); font-size: 0.66rem; }
table.reach tr:hover td { background: rgba(255,255,255,0.02); }
.hidden { display: none !important; }

.note { color: var(--text-muted); font-family: var(--mono); font-size: 0.66rem; line-height: 1.5; margin-top: 10px; }

/* ---- responsive -------------------------------------------------------- */
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; gap: 12px; padding: 0 14px; }
  .hero { padding: 28px 14px 8px; }
  .hero .tag { width: 100%; margin-left: 0; }
  .controls .btn { flex: 1 1 auto; justify-content: center; }
  table.reach td { max-width: 130px; }
}
