:root {
  --ink: #1f2a33;
  --muted: #6b7785;
  --line: #e6ebf0;
  --bg: #f4f6f8;
  --card: #fff;
  --brand: #1a5276;
  --mint: #0f9d58;
  --amber: #d4a017;
  --red: #c0392b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
.skip { position: absolute; left: -9999px; }
.masthead, footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
footer { border-bottom: 0; border-top: 1px solid var(--line); margin-top: 40px; color: var(--muted); font-size: 13px; }
.wordmark { color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: 0.02em; }
.wordmark span { color: var(--brand); }
.wordmark small { margin-left: 8px; color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: 0.12em; }
.back { color: var(--brand); text-decoration: none; font-size: 14px; }
main { max-width: 960px; margin: 0 auto; padding: 28px 20px 10px; }
.eyebrow { margin: 0 0 8px; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brand); font-weight: 700; }
h1 { margin: 0 0 8px; font-size: 2rem; }
.lead, .meta { color: var(--muted); margin: 0; }
.gate { max-width: 420px; margin: 48px auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 28px; }
.gate-form { display: grid; gap: 10px; margin-top: 20px; }
.gate-form label { font-size: 13px; color: var(--muted); }
.gate-form input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.button {
  appearance: none; border: 0; border-radius: 8px; background: var(--brand); color: #fff;
  padding: 10px 16px; font-weight: 600; cursor: pointer; font-size: 14px;
}
.button[disabled] { opacity: 0.55; cursor: wait; }
.button-ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.error { color: var(--red); margin: 0; font-size: 14px; }
.flash { color: #0f6b5c; margin: 0; font-size: 14px; font-weight: 600; }
.toolbar { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar-actions { display: flex; gap: 8px; align-items: flex-start; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.summary article {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; display: flex; align-items: center; gap: 10px;
}
.summary strong { font-size: 1.4rem; }
.summary span:last-child { color: var(--muted); font-size: 13px; }
.dot {
  width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: 0 0 12px;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}
.dot.mint { background: var(--mint); }
.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.quadrant {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 18px 8px; margin-bottom: 18px;
}
.quadrant-head h2 { margin: 0 0 4px; font-size: 1.15rem; }
.quadrant-head p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.host-list { list-style: none; margin: 0; padding: 0; }
.host-list li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 4px; border-top: 1px solid var(--line);
}
.host-main { display: grid; gap: 2px; min-width: 0; }
.host-main strong { font-size: 14px; word-break: break-all; }
.host-meta, .host-issuer { color: var(--muted); font-size: 12px; }
.host-error { color: var(--red); font-size: 12px; }
.host-link { color: var(--brand); text-decoration: none; }
.host-link:hover { text-decoration: underline; }
.empty, .empty-quad { color: var(--muted); list-style: none; padding: 8px 4px; }
.scan-modal {
  display: none; position: fixed; inset: 0; z-index: 40;
  background: rgba(15, 23, 32, 0.45); align-items: center; justify-content: center; padding: 16px;
}
.scan-modal.is-open { display: flex; }
.scan-modal-card {
  width: min(560px, 100%); max-height: min(80vh, 720px); overflow: hidden;
  background: var(--card); border-radius: 14px; border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0,0,0,0.18); display: flex; flex-direction: column;
}
.scan-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 8px; }
.scan-modal-head h2 { margin: 0; font-size: 1.15rem; }
.scan-modal-close {
  border: 0; background: transparent; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted);
}
.scan-modal-current { margin: 0 18px 10px; color: var(--muted); font-size: 13px; }
.scan-modal-current strong { color: var(--ink); }
.scan-progress {
  margin: 0 18px; height: 8px; background: #eef2f6; border-radius: 999px; overflow: hidden;
}
.scan-progress-bar { height: 100%; width: 0; background: var(--brand); transition: width 0.25s ease; }
.scan-modal-count { margin: 8px 18px 0; font-size: 12px; color: var(--muted); }
.scan-live-list {
  list-style: none; margin: 10px 0 0; padding: 0 10px 10px; overflow: auto; flex: 1;
}
.scan-live-list li {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px 8px;
  border-top: 1px solid var(--line);
}
.scan-modal-foot { margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
@media (max-width: 720px) {
  .summary { grid-template-columns: 1fr; }
  .masthead, footer { padding: 14px 16px; }
}

.print-only { display: none; }

@media print {
  @page {
    size: A4;
    margin: 12mm 14mm;
  }

  .print-only { display: block; }
  .no-print,
  .skip,
  .scan-modal,
  .toolbar-actions,
  nav,
  .back { display: none !important; }

  html, body {
    background: #fff !important;
    color: #1f2a33 !important;
    min-height: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .masthead, footer {
    background: #fff !important;
    border-color: #d9dee5 !important;
    padding: 8px 0;
  }

  footer { margin-top: 18px; font-size: 11px; }
  main { max-width: none; margin: 0; padding: 8px 0 0; }

  .toolbar { margin-bottom: 12px; }
  .toolbar .eyebrow { margin-bottom: 4px; }
  .toolbar h1 { font-size: 1.55rem; margin-bottom: 4px; }
  .meta { font-size: 12px; }

  .print-stamp {
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 1px solid #d9dee5;
    border-radius: 8px;
    background: #f8fafb;
    font-size: 12px;
    color: #6b7785;
  }

  .summary { gap: 8px; margin-bottom: 14px; break-inside: avoid; }
  .summary article {
    background: #fff !important;
    border-color: #d9dee5 !important;
    border-radius: 8px;
    padding: 10px 12px;
  }

  .quadrant {
    background: #fff !important;
    border-color: #d9dee5 !important;
    border-radius: 10px;
    padding: 12px 12px 4px;
    margin-bottom: 12px;
    break-inside: avoid;
  }

  .quadrant-head h2 { font-size: 1.05rem; }
  .quadrant-head p { margin-bottom: 8px; font-size: 11px; }

  .host-list li {
    padding: 8px 2px;
    break-inside: avoid;
  }

  .host-main strong { font-size: 12.5px; }
  .host-meta, .host-issuer, .host-error { font-size: 11px; }

  .dot {
    box-shadow: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .error, .flash { display: none !important; }
}
