:root {
  --bg: #f4f6f9; --card: #fff; --ink: #1a2233; --muted: #6b7280; --line: #e5e8ef;
  --brand: #1f5eff; --brand-ink: #fff; --ok: #16a34a; --warn: #d97706; --hot: #e11d48; --soft: #eef2ff;
  --radius: 10px; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 6px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }

.topbar { background: #0f172a; color: #cbd5e1; padding: 0 20px; display: flex; align-items: center; gap: 18px; height: 52px; }
.topbar .brand { color: #fff; font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.topbar .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.25); }
.topbar nav { display: flex; gap: 2px; flex: 1; }
.topbar nav a { color: #cbd5e1; padding: 6px 10px; border-radius: 6px; }
.topbar nav a.active, .topbar nav a:hover { background: #1e293b; color: #fff; text-decoration: none; }
.topbar select { background: #1e293b; color: #fff; border: 1px solid #334155; border-radius: 6px; padding: 5px 8px; }
.topbar form { margin: 0; }
.topbar button.link { background: none; border: 0; color: #94a3b8; cursor: pointer; font: inherit; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 20px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.flash { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 900px) { .grid.two, .grid.three { grid-template-columns: 1fr; } }
.kpi .card { padding: 14px 16px; margin: 0; }
.kpi .v { font-size: 26px; font-weight: 700; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: 12px; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #fafbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.company { display: flex; align-items: center; gap: 10px; }
.company img, .logo { width: 28px; height: 28px; border-radius: 6px; background: #f1f5f9; object-fit: contain; flex: none; }
.logo.ph { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #475569; font-size: 12px; }
.company .n { font-weight: 600; }
.company .d { color: var(--muted); font-size: 12px; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #e5e7eb; color: #374151; white-space: nowrap; }
.badge.company { background: #dbeafe; color: #1e40af; }
.badge.isp { background: #f3f4f6; color: #6b7280; }
.badge.hosting { background: #fef3c7; color: #92400e; }
.badge.edu { background: #ede9fe; color: #5b21b6; }
.badge.gov { background: #dcfce7; color: #166534; }
.badge.hot { background: #ffe4e6; color: #be123c; }
.badge.new { background: #dcfce7; color: #166534; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.fail { background: #fee2e2; color: #991b1b; }
.routes { color: var(--muted); font-size: 12px; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg a, .seg span { padding: 6px 10px; color: var(--muted); border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; }
.seg a.active { background: var(--brand); color: #fff; text-decoration: none; }
input[type=text], input[type=url], input[type=password], input[type=email], select, textarea {
  font: inherit; padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: var(--ink); width: 100%;
}
textarea { min-height: 90px; font-family: var(--mono); font-size: 12px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; font-weight: 600; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; color: var(--ink); margin: 4px 14px 4px 0; }
.btn { display: inline-block; font: inherit; padding: 7px 12px; border-radius: 8px; border: 1px solid #cbd5e1; background: #fff; color: var(--ink); cursor: pointer; }
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: #b91c1c; border-color: #fecaca; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
form.inline { display: inline; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
pre.code { background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 8px; overflow: auto; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; }

.chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 10px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; min-width: 4px; }
.chart .bar .t { background: #cbd5e1; border-radius: 3px 3px 0 0; }
.chart .bar .i { background: var(--brand); border-radius: 3px 3px 0 0; }
.chart .bar:hover .tip { display: block; }
.chart .tip { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; font-size: 11px; padding: 4px 7px; border-radius: 5px; white-space: nowrap; z-index: 2; }
.legend { font-size: 12px; color: var(--muted); display: flex; gap: 14px; margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; }
.timeline li.hot::before { background: var(--hot); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 4px 12px; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; }
.login { max-width: 360px; margin: 80px auto; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
