/* ============================================================
   PacketScope Web — a-packets.com inspired design system
   by 0xCANCELO
   ============================================================ */

:root {
  --nav: #3b4149;
  --nav-link: #c3cad3;
  --accent: #2196f3;
  --accent-d: #1976d2;
  --accent-bg: #e3f2fd;
  --orange: #ff7043;
  --green: #43a047;
  --red: #e53935;
  --amber: #fb8c00;
  --purple: #8e24aa;
  --teal: #00897b;
  --indigo: #3949ab;
  --text: #3c4650;
  --muted: #8a94a0;
  --line: #e6eaf0;
  --line-soft: #f0f3f7;
  --bg: #ffffff;
  --chip-bg: #eef3f8;
  --mono: "SFMono-Regular", ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: Roboto, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent-d); text-decoration: none; }
a:hover { text-decoration: none; }
.page { flex: 1; }
.container { max-width: 1160px; margin: 0 auto; padding: 0 26px; }
.container .tool-grid { margin-bottom: 10px; }

/* ---------------- top dark navbar ---------------- */
.topnav {
  height: 48px; background: var(--nav);
  display: flex; align-items: center; padding: 0 22px; gap: 28px;
  position: sticky; top: 0; z-index: 50;
}
.topnav-brand { display: flex; align-items: center; gap: 9px; }
.brand-name { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-tag { color: #9aa3ad; font-size: 11px; margin-left: 4px; }
.logo-badge {
  width: 26px; height: 26px; border-radius: 6px; background: var(--orange);
  color: #fff; font-weight: 800; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
}
.logo-badge.small { width: 20px; height: 20px; font-size: 12px; border-radius: 5px; }
.topnav-links { display: flex; gap: 24px; margin-left: 12px; }
.topnav-links a { color: var(--nav-link); font-size: 13px; }
.topnav-links a:hover { color: #fff; }
.topnav-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; height: 28px; padding: 0 14px;
  border-radius: 15px; font-size: 12px; font-weight: 600;
}
.pill-blue { background: var(--accent); color: #fff; }

/* ---------------- sub header (breadcrumb bar) ---------------- */
.subbar {
  height: 52px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 18px; gap: 16px;
  position: sticky; top: 48px; z-index: 40;
}
.subbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 14px; }
.subbar-brand .chev { color: var(--muted); display: inline-flex; }
.subbar-brand .chev .ic { width: 14px; height: 14px; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; }
.crumb-icon {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.crumb-icon .ic { width: 14px; height: 14px; }
.crumb-name { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.crumb-name:hover { color: var(--accent-d); }
.chev-d { color: #b8c1cb; display: inline-flex; }
.chev-d .ic { width: 13px; height: 13px; }
.crumb-pill {
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 600;
  padding: 4px 12px; border-radius: 14px; white-space: nowrap;
}
.subbar-actions { margin-left: auto; display: flex; gap: 8px; flex: none; }

/* ---------------- layout: sidebar + main ---------------- */
.layout { display: flex; align-items: stretch; min-height: calc(100vh - 100px); }
.sidebar {
  width: 224px; flex: none; border-right: 1px solid var(--line);
  padding: 10px 0 20px; background: #fff;
}
.snav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; color: #5b6672; font-size: 13px;
  border-left: 3px solid transparent;
}
.snav a:hover { background: #f5f8fb; }
.snav a.active {
  background: var(--accent-bg); color: var(--accent-d); font-weight: 600;
  border-left-color: var(--accent);
}
.snav .ic { width: 16px; height: 16px; opacity: .8; flex: none; }
.snav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snav .count { margin-left: auto; color: #9aa4b0; font-size: 12px; }
.snav-sep { height: 1px; background: var(--line-soft); margin: 10px 16px; }
.sidebar-foot {
  margin-top: 26px; padding: 0 16px; color: #b3bcc5; font-size: 11px; line-height: 1.7;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; margin-left: auto; flex: none; }
.status-dot.run { background: var(--amber); animation: pulse 1.1s infinite; }
.status-dot.pend { background: #cbd3db; }
.status-dot.err { background: var(--red); }
.status-dot.skip { background: #d9dde2; }
.snav a .status-dot + .count { margin-left: 6px; }
@keyframes pulse { 50% { opacity: .35; } }

.main { flex: 1; padding: 26px 32px 40px; max-width: 1240px; min-width: 0; }

/* ---------------- cards ---------------- */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05); margin-bottom: 22px; overflow: hidden;
}
.card-h {
  padding: 13px 20px; border-bottom: 1px solid var(--line-soft);
  font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 9px;
}
.card-h.center { justify-content: center; }
.card-b { padding: 20px; }
.card-b.no-pad-b { padding-bottom: 0; }
.center-card { max-width: 520px; margin-left: auto; margin-right: auto; }

/* ---------------- stats ---------------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 21px; font-weight: 700; margin-top: 5px; word-break: break-all; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.stat-good { color: var(--green); }
.stat-bad { color: var(--red); }
.stat-warn { color: var(--amber); }
.stat-muted { color: var(--muted); }
.flag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---------------- icons ---------------- */
.ic { width: 17px; height: 17px; flex: none; }
.ic-blue { color: var(--accent); }
.ic-green { color: var(--green); }
.ic-orange { color: var(--orange); }
.ic-purple { color: var(--purple); }
.ic-teal { color: var(--teal); }
.ic-red { color: var(--red); }
.ic-amber { color: var(--amber); }
.ic-indigo { color: var(--indigo); }

/* ---------------- badges & chips ---------------- */
.badge {
  display: inline-block; padding: 2.5px 8px; border-radius: 3px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
}
.badge.green { background: var(--green); color: #fff; }
.badge.blue { background: var(--accent); color: #fff; }
.badge.red { background: var(--red); color: #fff; }
.badge.amber { background: var(--amber); color: #fff; }
.badge.gray { background: #90a0ae; color: #fff; }
.badge.purple { background: var(--purple); color: #fff; }
.badge.orange { background: var(--orange); color: #fff; }
.badge.dns-a { background: #43a047; } .badge.dns-aaaa { background: #1e88e5; }
.badge.dns-mx { background: #8e24aa; } .badge.dns-ns { background: #fb8c00; }
.badge.dns-txt { background: #00897b; } .badge.dns-soa { background: #3949ab; }
.badge.dns-cname { background: #d81b60; } .badge.dns-ptr, .badge.dns-reverse { background: #6d4c41; }

.count-chip {
  margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--chip-bg); padding: 3px 10px; border-radius: 12px;
}
.ipchip {
  display: inline-block; background: var(--chip-bg); border: 1px solid #dfe7ee;
  border-radius: 4px; padding: 3px 8px; font-family: var(--mono); font-size: 12px; color: var(--text);
}
.portchip {
  display: inline-block; background: #37474f; color: #fff; border-radius: 4px;
  padding: 3px 8px; font-family: var(--mono); font-size: 12px; font-weight: 700;
}
.chip-block { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.mono { font-family: var(--mono); font-size: 12.5px; }
.mono-sm { font-size: 11px; }
.muted { color: var(--muted); }
.bold { font-weight: 700; }
.wrap { word-break: break-all; }
.ta-r { text-align: right; }
.ta-c { text-align: center; }
.inline { display: inline; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: none; border-radius: 5px; padding: 9px 16px;
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  background: transparent; color: var(--text);
}
.btn .ic { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-d); }
.btn-outline { border: 1px solid #ccd4dc; color: #5b6672; background: #fff; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-d); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { color: var(--red); background: #fdf1f0; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: default; }

/* ---------------- forms ---------------- */
.scan-form { display: flex; gap: 10px; flex-wrap: wrap; }
.scan-form input[type="text"], .scan-form input[type="number"], .scan-form input[type="search"] {
  flex: 1; min-width: 220px; height: 40px; border: 1px solid #ccd4dc; border-radius: 5px;
  padding: 0 14px; font-size: 14px; font-family: inherit; color: var(--text); outline: none;
}
.scan-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(33, 150, 243, .15); }
.scan-hint { color: var(--muted); font-size: 12.5px; margin-top: 10px; }
.file-label { position: relative; flex: 1; min-width: 240px; }
.file-label input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn {
  display: flex; align-items: center; gap: 8px; height: 40px; justify-content: center;
  border: 1.5px dashed #b9c4cf; border-radius: 5px; color: #5b6672; font-size: 13px;
}
.file-btn:hover { border-color: var(--accent); color: var(--accent-d); }

/* ---------------- tables ---------------- */
.table-search {
  width: 260px; height: 34px; border: 1px solid #ccd4dc; border-radius: 5px;
  padding: 0 12px; margin-bottom: 12px; font-size: 13px; outline: none; font-family: inherit;
}
.table-search:focus { border-color: var(--accent); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; padding: 9px 12px; border-bottom: 2px solid var(--line);
}
.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data-table tbody tr:hover { background: #f8fafc; }
.kv-table { width: 100%; border-collapse: collapse; }
.kv-table td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); }
.kv-table tr:last-child td { border-bottom: none; }
.kv-table td:first-child { color: var(--muted); width: 220px; font-weight: 500; }
.kv-table td:last-child { font-weight: 500; }
.row-link { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.row-link:hover { color: var(--accent-d); }
.row-link .ic { width: 15px; height: 15px; color: var(--muted); }

/* ---------------- charts ---------------- */
.donut-row { display: flex; justify-content: center; }
.donut-wrap { display: flex; align-items: center; gap: 34px; flex-wrap: wrap; justify-content: center; }
.donut-holder svg { display: block; }
.legend { display: flex; flex-direction: column; gap: 8px; min-width: 150px; }
.lg-item { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.lg-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.lg-val { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 70px; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12.5px; }
.bar-label { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--line-soft); height: 12px; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--accent); }
.bar-val { font-family: var(--mono); color: var(--muted); text-align: right; }

/* ---------------- method chips (a-packets style) ---------------- */
.chip-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 14px 18px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
  background: #fff;
}
.mchip { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.mchip-name { font-size: 12px; font-weight: 600; color: #5b6672; letter-spacing: .02em; }
.mchip-n { color: var(--muted); font-weight: 500; }
.mchip input { display: none; }
.switch {
  width: 30px; height: 16px; border-radius: 9px; background: #cfd6dd; position: relative;
  transition: background .15s; flex: none;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: #fff; transition: left .15s;
}
.mchip input:checked + .switch { background: var(--accent); }
.mchip input:checked + .switch::after { left: 16px; }
.mchip input:disabled + .switch { opacity: .5; }
.chip-search {
  height: 30px; border: 1px solid #ccd4dc; border-radius: 4px; padding: 0 10px;
  font-size: 12.5px; width: 170px; outline: none; font-family: inherit;
}
.chip-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------------- request rows (expandable) ---------------- */
.req-list { max-height: 640px; overflow-y: auto; }
.req-block { border-bottom: 1px solid var(--line-soft); }
.req-block.hidden { display: none; }
.req-row {
  display: flex; align-items: center; gap: 9px; padding: 10px 16px; cursor: pointer;
}
.req-row:hover { background: #fafbfc; }
.req-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--green); }
.req-row .chev { margin-left: auto; color: #b8c1cb; transition: transform .15s; display: inline-flex; }
.req-row .chev .ic { width: 15px; height: 15px; }
.req-block.open .chev { transform: rotate(180deg); }
.code-panel {
  display: none; background: #262b31; margin: 0 12px 12px; border-radius: 6px;
  padding: 14px 16px; overflow-x: auto;
}
.req-block.open .code-panel { display: block; }
.code-panel-inner { font-family: var(--mono); font-size: 12.5px; line-height: 1.75; color: #cfd8dc; white-space: pre; }
.c-m { color: #ff8a65; font-weight: 700; }
.c-p { color: #9ccc65; }
.c-h { color: #64b5f6; }
.c-v { color: #b0bec5; }
.arrow { color: #b8c1cb; display: inline-flex; }
.arrow .ic { width: 14px; height: 14px; }
.arrow-cell { width: 30px; color: #b8c1cb; }
.arrow-cell .ic { width: 14px; height: 14px; }

/* ---------------- word cloud ---------------- */
.wordcloud {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
  gap: 6px 18px; padding: 34px 20px; min-height: 180px;
}
.wordcloud span { line-height: 1; cursor: default; transition: opacity .15s; }
.wordcloud span:hover { opacity: .6; }

/* ---------------- progress / scan status ---------------- */
.progress { height: 8px; background: var(--line-soft); border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #64b5f6); border-radius: 5px; transition: width .5s; }
.progress-meta { font-size: 12.5px; color: var(--muted); margin: 10px 0 18px; }
.tool-status { display: flex; flex-direction: column; gap: 4px; }
.tool-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft); font-size: 13.5px;
}
.tool-ic-sm { color: var(--muted); display: inline-flex; }
.tool-name { font-weight: 600; }
.tool-state { margin-left: auto; color: var(--muted); font-size: 12.5px; display: inline-flex; align-items: center; gap: 8px; }
.tool-state[data-state="done"] { color: var(--green); font-weight: 600; }
.tool-state[data-state="error"] { color: var(--red); font-weight: 600; }
.spin {
  width: 13px; height: 13px; border-radius: 50%; flex: none;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- pager ---------------- */
.pager { display: flex; align-items: center; gap: 14px; justify-content: flex-end; padding-top: 14px; }
.pager-info { font-size: 12.5px; color: var(--muted); }

/* ---------------- home hero ---------------- */
.hero { text-align: center; padding: 46px 20px 30px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; color: var(--accent-d);
  background: var(--accent-bg); font-size: 11.5px; font-weight: 700; letter-spacing: .06em;
  padding: 6px 14px; border-radius: 14px; margin-bottom: 18px;
}
.hero-badge .ic { width: 14px; height: 14px; }
.hero h1 { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.hero h1 .accent { color: var(--accent); }
.hero-sub { color: var(--muted); max-width: 760px; margin: 14px auto 0; font-size: 15px; line-height: 1.65; }
.scan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 1000px; margin: 10px auto 30px; padding: 0 20px; }

.section-title { font-size: 17px; font-weight: 700; margin: 30px 0 14px; display: flex; align-items: center; gap: 8px; }
.section-title .ic { width: 18px; height: 18px; }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tool-card {
  border: 1px solid var(--line); border-radius: 8px; padding: 16px;
  display: flex; flex-direction: column; gap: 7px; align-items: flex-start;
  color: var(--text); font-size: 13px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05); transition: border-color .15s, transform .15s;
  background: #fff;
}
.tool-card b { font-size: 14px; }
.tool-card > span:last-child { color: var(--muted); line-height: 1.5; }
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-ic {
  width: 34px; height: 34px; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center; background: var(--line-soft);
}
.tool-ic .ic { width: 18px; height: 18px; }
.ic-blue.tool-ic { background: var(--accent-bg); }
.ic-green.tool-ic { background: #e8f5e9; }
.ic-purple.tool-ic { background: #f3e5f5; }
.ic-amber.tool-ic { background: #fff3e0; }
.ic-teal.tool-ic { background: #e0f2f1; }
.ic-red.tool-ic { background: #ffebee; }
.ic-indigo.tool-ic { background: #e8eaf6; }
.ic-orange.tool-ic { background: #fff3e0; }

/* ---------------- empty / misc ---------------- */
.empty {
  text-align: center; color: var(--muted); padding: 34px 20px; font-size: 13.5px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.empty.big { font-size: 16px; padding: 50px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.two-col .card { margin-bottom: 22px; }
@media (max-width: 1000px) {
  .two-col, .scan-grid { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .subbar-left { display: none; }
}

/* ---------------- footer ---------------- */
.footer {
  border-top: 1px solid var(--line); padding: 16px 28px; color: var(--muted);
  font-size: 12.5px; display: flex; align-items: center; gap: 10px; background: #fff;
}
.footer strong { color: var(--text); }
.footer .logo-badge { vertical-align: middle; margin-right: 6px; }
.footer-right { margin-left: auto; }
.footer .author { color: var(--accent-d); font-weight: 700; }

/* statuses on home table */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.status .ic { width: 14px; height: 14px; }
.status.done { color: var(--green); }
.status.running { color: var(--amber); }

/* ---------------- pictures grid ---------------- */
.thumb-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px;
}
.thumb-card {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: #fff; display: flex; flex-direction: column;
  transition: box-shadow .15s ease, transform .15s ease;
}
.thumb-card:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, .10); transform: translateY(-2px); }
.thumb-img {
  display: flex; align-items: center; justify-content: center;
  height: 120px; background: #f6f8fa; border-bottom: 1px solid var(--line);
}
.thumb-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.thumb-img svg { width: 40px; height: 40px; }
.thumb-meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.thumb-name { font-size: 12.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb-meta .muted { font-size: 11.5px; }

/* ---------------- credentials ---------------- */
.cred-val { font-weight: 700; color: #b71c1c; }
.badge.red { background: #ffebee; color: #c62828; }
.cred-blur { filter: blur(4px); transition: filter .12s ease; cursor: pointer; }
.cred-blur:hover, .cred-blur.reveal { filter: none; }

/* ---------------- ethernet ipchips inline wrap ---------------- */
td.mono .ipchip { display: inline-block; margin: 1px 2px 1px 0; }
