/* ipscope — dark, dense, instrument-grade. No framework, no build step. */
:root {
  --bg: #0c0f14;
  --bg-2: #121721;
  --panel: #161d29;
  --panel-2: #1d2634;
  --border: #26303f;
  --text: #d7dee8;
  --muted: #7f8ba0;
  --accent: #4fd1a5;
  --accent-2: #4fa8ff;

  --gateway: #e0b34d;
  --infrastructure: #b06ff0;
  --reserved: #4fa8ff;
  --leased: #4fd1a5;
  --stale: #6d7686;
  --free: #232c3a;

  font-size: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---- top bar ---- */
.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--bg-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: .5px; }
.brand .accent { color: var(--accent); }
nav { display: flex; gap: 4px; }
nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); }
nav a:hover { background: var(--panel); color: var(--text); }
.search { display: flex; flex: 1; min-width: 180px; }
.search input { flex: 1; background: var(--panel); border: 1px solid var(--border); color: var(--text);
  padding: 7px 10px; border-radius: 6px; outline: none; }
.search input:focus { border-color: var(--accent-2); }

.sync { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--panel); cursor: pointer; font-size: 12px; }
.sync .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.sync.stale { border-color: #b0663a; background: #241a12; }
.sync.stale .dot { background: #e08a3a; }
.sync .lbl { color: var(--muted); }
.sync .resync { color: var(--accent-2); }
.sync:hover .resync { text-decoration: underline; }

/* ---- layout ---- */
main { padding: 18px 20px 60px; max-width: 1200px; margin: 0 auto; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 22px 0 8px; color: var(--text); }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.pane { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }

/* ---- network cards ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: block; }
.card:hover { border-color: var(--accent-2); }
.card .name { font-weight: 700; font-size: 16px; }
.card .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.utilbar { height: 8px; border-radius: 4px; background: var(--bg-2); margin-top: 10px; overflow: hidden; }
.utilbar > i { display: block; height: 100%; background: var(--accent); }
.utilbar > i.warn { background: #e0a13a; }
.utilbar > i.crit { background: #e05a4f; }

/* ---- subnet grid ---- */
.grid-head { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-bottom: 12px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

.grid { display: flex; flex-wrap: wrap; gap: 3px; }
.cell { width: 34px; height: 30px; border-radius: 4px; background: var(--free);
  display: flex; align-items: center; justify-content: center;
  font-family: ui-monospace, Menlo, monospace; font-size: 10px; color: var(--muted);
  position: relative; cursor: default; line-height: 1; }
.cell.pool { outline: 1px solid rgba(111, 209, 161, .35); }
.cell a, a.cell { display: flex; align-items: center; justify-content: center; }
.cell a.lock { position: absolute; inset: 0; }
a.cell { cursor: pointer; }
.cell:hover { outline: 2px solid var(--accent-2); z-index: 2; }

.cell.st-gateway { background: var(--gateway); color: #1a1a1a; font-weight: 700; }
.cell.st-infrastructure { background: var(--infrastructure); color: #1a1a1a; font-weight: 700; }
.cell.st-reserved { background: var(--reserved); color: #08131f; font-weight: 700; }
.cell.st-leased { background: var(--leased); color: #08130d; font-weight: 700; }
.cell.st-stale { background: var(--stale); color: #e6ebf2; }
.cell.st-free { background: var(--free); color: var(--muted); }

.pool-band { border-top: 2px dashed rgba(111, 209, 161, .5); margin-top: 4px; }
.band-label { font-size: 11px; color: var(--accent); width: 100%; margin: 6px 0 2px; }

/* ---- host page ---- */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.fact { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.fact .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.fact .v { font-size: 15px; margin-top: 2px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; background: var(--panel-2); border: 1px solid var(--border); }
.tag.orphaned { background: #2a1e12; border-color: #b0663a; color: #e6a15c; }
.tag.online { background: #10231b; border-color: #2f7d5a; color: var(--accent); }
.tag.rand { background: #211a2e; border-color: #6a4f9c; color: #c39bf0; }
.tag.synched { border-color: var(--accent-2); color: var(--accent-2); }

.editable { border-color: var(--accent); }
.editable .k { color: var(--accent); }

form.table { display: grid; gap: 10px; }
label { display: block; font-size: 12px; color: var(--muted); }
input[type=text], textarea, select { width: 100%; margin-top: 4px; background: var(--panel-2);
  border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 8px 10px; }
textarea { min-height: 70px; font-family: inherit; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { background: var(--accent); color: #08130d; border: 0; padding: 9px 16px; border-radius: 7px;
  font-weight: 700; cursor: pointer; font-size: 14px; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent-2); border: 1px solid var(--accent-2); }

/* ---- lists / tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }

/* ---- hygiene ---- */
.finding { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); margin-bottom: 14px; overflow: hidden; }
.finding > summary { cursor: pointer; padding: 12px 16px; list-style: none; display: flex; align-items: center; gap: 10px; }
.finding > summary::-webkit-details-marker { display: none; }
.finding .count { background: var(--panel-2); border: 1px solid var(--border); min-width: 30px; height: 30px;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.finding .ttl { font-weight: 700; }
.finding .d { color: var(--muted); font-size: 12.5px; }
.finding .body { padding: 0 16px 14px; }
.group { margin: 8px 0; }
.group .gh { color: var(--accent); font-weight: 600; font-size: 13px; }

/* ---- picker / search ---- */
.pillbox { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { background: var(--panel-2); border: 1px solid var(--accent-2); color: var(--accent-2);
  padding: 5px 10px; border-radius: 14px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.inline-form select, .inline-form input[type=number] { width: auto; margin-top: 0; }

/* ---- sparkline ---- */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 44px; }
.spark i { width: 6px; background: var(--accent); border-radius: 2px 2px 0 0; display: inline-block; }
.proj { font-size: 13px; margin-top: 8px; }
.proj b { color: var(--accent); }

@media (max-width: 640px) {
  main { padding: 12px 10px 60px; }
  .cell { width: 22px; height: 24px; font-size: 8px; }
  .row2 { grid-template-columns: 1fr; }
}
