/* ==========================================================================
   Whois Investigator

   1.  Brand colours (edit these first)
   2.  Design tokens
   3.  Base elements and typography
   4.  Buttons, forms and controls
   5.  Header, navigation and footer
   6.  Page furniture: headings, sections, panels
   7.  Status tags and signals
   8.  Tables
   9.  Search forms and the extension picker
   10. Result tables (bulk / list / lookalikes)
   11. Reports: banners, data lists, DNS, certificate, raw response
   12. Watchlist, history and admin
   13. Account pages
   14. Responsive
   15. Print
   ========================================================================== */


/* 1. BRAND COLOURS ---------------------------------------------------------
   Everything that carries the brand reads from this one block. Change the
   three hex values below and the whole site re-colours: navigation bar,
   primary buttons, links, focus rings, chart bars and footer.
   -------------------------------------------------------------------------- */

:root {
  --brand: #1f5741;         /* Main brand colour: nav bar, primary buttons, links */
  --brand-dark: #14382a;    /* Pressed / hover state of the above */
  --brand-tint: #e9f1ed;    /* Pale wash used behind selected items */
}


/* 2. DESIGN TOKENS --------------------------------------------------------- */

:root {
  /* Neutrals */
  --ink: #16191b;           /* Headings */
  --body: #2c3235;          /* Body copy */
  --muted: #5f6a6d;         /* Secondary copy, labels */
  --faint: #8d9694;         /* Placeholder-level copy */
  --line: #dde2df;          /* Borders */
  --line-strong: #c6cec9;   /* Borders that need to read as a divider */
  --surface: #ffffff;       /* Cards and panels */
  --surface-alt: #f3f6f4;   /* Inset areas, table headers */
  --page: #f7f8f6;          /* Page background */

  /* Meaning */
  --ok: #1c7a4e;            /* Available, valid, healthy */
  --ok-bg: #e6f2ea;
  --warn: #8f5d0c;          /* Needs attention */
  --warn-bg: #fbf0d8;
  --bad: #a3342a;           /* Expired, invalid, failed */
  --bad-bg: #fae3e0;
  --info: #35525f;          /* Registered / factual, no judgement */
  --info-bg: #e7eef1;

  /* Shape */
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(22, 25, 27, .05), 0 6px 18px rgba(22, 25, 27, .05);
  --shadow-lift: 0 2px 4px rgba(22, 25, 27, .07), 0 12px 28px rgba(22, 25, 27, .09);

  /* Type */
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif,
          "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;
}


/* 3. BASE ELEMENTS AND TYPOGRAPHY ------------------------------------------ */

html {
  font-size: 16px;
  min-height: 100%;
  overflow-y: scroll;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  color: var(--body);
  background: var(--page);
  font-family: var(--sans);
  font-size: .95rem;
  line-height: 1.55;
}

main {
  flex: 1 0 auto;
}

h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover,
a:focus-visible {
  color: var(--brand-dark);
}

/* One consistent, visible focus ring everywhere. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 3px;
}

code, pre, .mono {
  font-family: var(--mono);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.5rem 0;
  opacity: 1;
}

.muted {
  color: var(--muted);
}

.faint {
  color: var(--faint);
}

/* Domains, IPs and record values are identifiers - monospace so that
   l/1 and O/0 can be told apart. Matters most on the lookalike checker. */
.ident {
  font-family: var(--mono);
  font-size: .95em;
  overflow-wrap: anywhere;
}

.container {
  max-width: 1180px;
}

.narrow {
  max-width: 900px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  padding: .7rem 1.1rem;
  color: #fff;
  background: var(--brand-dark);
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
  color: #fff;
}


/* 4. BUTTONS, FORMS AND CONTROLS ------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border-radius: var(--radius-sm);
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.3;
  padding: .5rem .95rem;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.btn-primary,
.btn-primary:visited {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary:disabled {
  color: #fff;
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  box-shadow: none;
}

.btn-outline-secondary,
.btn-outline-secondary:visited {
  color: var(--body);
  background: var(--surface);
  border-color: var(--line-strong);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active {
  color: var(--brand-dark);
  background: var(--surface-alt);
  border-color: var(--brand);
}

.btn-sm {
  padding: .3rem .6rem;
  font-size: .82rem;
}

.btn:disabled {
  opacity: .75;
}

/* A text-weight button: used for "all / none", "remove", "copy". */
.ext-toggle {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--brand);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.ext-toggle:hover,
.ext-toggle:focus {
  color: var(--brand-dark);
  text-decoration: underline;
}

.form-control,
.form-select {
  color: var(--body);
  border-color: var(--line-strong);
  border-radius: var(--radius-sm);
}

.form-control::placeholder {
  color: var(--faint);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 87, 65, .14);
}

/* Small clipboard button that sits beside a value. */
.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  padding: 0;
  color: var(--faint);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: .78rem;
  cursor: pointer;
}

.copy-btn:hover,
.copy-btn:focus {
  color: var(--brand);
  background: var(--surface-alt);
  border-color: var(--line);
}

.copy-btn.is-copied {
  color: var(--ok);
  border-color: var(--ok);
}


/* 5. HEADER, NAVIGATION AND FOOTER ----------------------------------------- */

.app-header {
  background: var(--brand);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
}

.app-nav {
  padding: 0;
}

.app-nav > .container {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .35rem 0;
  color: #fff;
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: -.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover,
.brand:focus {
  color: #fff;
}

.brand .bi {
  font-size: 1.25rem;
  opacity: .85;
}

.brand__mark {
  font-weight: 600;
}

.brand__mark span {
  font-weight: 400;
  opacity: .78;
}

.navbar-toggler {
  padding: .3rem .55rem;
  border-color: rgba(255, 255, 255, .35);
}

.navbar-toggler:focus {
  box-shadow: none;
}

.app-nav .navbar-nav {
  align-items: center;
  gap: .1rem;
}

.app-nav .nav-link {
  position: relative;
  color: rgba(255, 255, 255, .85);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  padding: .4rem .8rem;
  white-space: nowrap;
}

.app-nav .nav-link:hover,
.app-nav .nav-link:focus {
  color: #fff;
  background: rgba(255, 255, 255, .12);
}

.app-nav .nav-link.active {
  color: #fff;
  background: rgba(0, 0, 0, .18);
  font-weight: 600;
}

/* Account links sit to the right, behind a hairline divider. */
.nav-account {
  align-items: center;
  gap: .1rem;
  margin-left: auto;
}

.nav-account .nav-link {
  font-size: .85rem;
}

.nav-account__divider {
  width: 1px;
  height: 1.4rem;
  margin: 0 .5rem;
  background: rgba(255, 255, 255, .22);
}

.nav-link-button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.nav-logout {
  display: inline-flex;
  margin: 0;
}

.nav-account__user {
  max-width: 15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-footer {
  margin-top: 3rem;
  padding: 1.6rem 0;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: .85rem;
}

.site-footer .container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 1.5rem;
}

.site-footer__brand {
  color: var(--ink);
  font-weight: 600;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.1rem;
}

.site-footer__note {
  flex-basis: 100%;
  color: var(--faint);
  font-size: .8rem;
}


/* 6. PAGE FURNITURE -------------------------------------------------------- */

/* Breadcrumb + title band at the top of every page. */
.page-heading {
  padding: 1.15rem 0 1.05rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.page-heading .container {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .75rem 1.25rem;
}

.page-heading h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -.015em;
}

.page-heading p {
  margin: .3rem 0 0;
  color: var(--muted);
  font-size: .9rem;
  max-width: 62ch;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin: 0 0 .3rem;
  color: var(--faint);
  font-size: .8rem;
}

.crumbs a {
  color: var(--muted);
  text-decoration: none;
}

.crumbs a:hover,
.crumbs a:focus {
  color: var(--brand);
  text-decoration: underline;
}

.crumbs__sep {
  opacity: .6;
}

/* Report identity: the domain or IP under investigation, stated once, large. */
.report-head__id {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem .7rem;
  margin: 0;
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}

.report-head__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}

.report-head__actions form {
  display: inline-flex;
  margin: 0;
}

.eyebrow {
  margin: 0 0 .5rem;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.section {
  padding: 1.75rem 0 2.25rem;
}

.section--muted {
  background: var(--surface-alt);
  border-top: 1px solid var(--line);
}

.panel,
.whois-panel,
.admin-panel,
.whois-search-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.whois-panel,
.admin-panel {
  padding: 1.15rem 1.25rem;
}

.whois-search-panel {
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.whois-panel h2,
.whois-search-panel h2,
.admin-panel h2 {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 .8rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
}

.whois-search-panel h2 {
  font-size: 1.12rem;
  margin-bottom: .4rem;
}

.whois-panel h2 .bi,
.whois-search-panel h2 .bi,
.admin-panel h2 .bi {
  color: var(--brand);
  font-size: 1.05em;
}

.whois-panel h3 {
  margin: 1.1rem 0 .5rem;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.whois-panel-sub,
.panel-sub {
  margin: -.4rem 0 .9rem;
  color: var(--muted);
  font-size: .85rem;
  max-width: 74ch;
}

.whois-panel--block {
  margin-bottom: 1.15rem;
}

.whois-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start; /* Panels size to their content instead of stretching to the tallest. */
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.empty-state {
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}

.form-actions,
.admin-actions,
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
}

.admin-toolbar {
  justify-content: space-between;
  margin-bottom: 1rem;
}

.admin-toolbar p {
  margin: 0;
}

.form-actions {
  margin-top: 1rem;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
}


/* 7. STATUS TAGS AND SIGNALS ----------------------------------------------- */

.stock {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .15rem .5rem;
  color: var(--info);
  background: var(--info-bg);
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}

.stock--in {
  color: var(--ok);
  background: var(--ok-bg);
}

.stock--out {
  color: var(--bad);
  background: var(--bad-bg);
}

.stock--error {
  color: var(--warn);
  background: var(--warn-bg);
}

.stock--lg {
  padding: .3rem .7rem;
  font-size: .82rem;
}

.whois-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.whois-pill {
  display: inline-flex;
  align-items: center;
  padding: .15rem .5rem;
  color: var(--body);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: .74rem;
  font-weight: 600;
}

.whois-pill--help {
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.whois-pill--dns {
  min-width: 3.4rem;
  justify-content: center;
  color: var(--brand);
  background: var(--brand-tint);
  border-color: #c9ded4;
}

/* At-a-glance signal tiles at the top of a report. */
.investigation-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .7rem;
  margin: 0 0 1.15rem;
}

.investigation-signal {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  min-width: 0;
  padding: .75rem .85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--faint);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.investigation-signal > .bi {
  margin-top: .1rem;
  color: var(--faint);
  font-size: 1.05rem;
  line-height: 1;
}

.investigation-signal div {
  display: grid;
  min-width: 0;
  gap: .1rem;
}

.investigation-signal strong {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.investigation-signal span {
  color: var(--ink);
  font-size: .85rem;
  font-weight: 500;
  line-height: 1.35;
}

.investigation-signal--good {
  border-left-color: var(--ok);
}

.investigation-signal--good > .bi {
  color: var(--ok);
}

.investigation-signal--warning {
  border-left-color: var(--warn);
}

.investigation-signal--warning > .bi {
  color: var(--warn);
}

.investigation-signal--danger {
  border-left-color: var(--bad);
}

.investigation-signal--danger > .bi {
  color: var(--bad);
}


/* 8. TABLES ---------------------------------------------------------------- */

.admin-table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.admin-table {
  margin: 0;
  min-width: 720px;
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
  --bs-table-bg: transparent;
}

.admin-table > thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: .6rem .8rem;
  color: var(--muted);
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line-strong);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-table > tbody td {
  padding: .55rem .8rem;
  border-top: 1px solid var(--line);
  border-bottom: 0;
  vertical-align: middle;
}

.admin-table > tbody tr:first-child td {
  border-top: 0;
}

.admin-table > tbody tr:hover td {
  background: var(--surface-alt);
}

.admin-table__actions {
  display: flex;
  gap: .5rem;
  white-space: nowrap;
}

.whois-table td {
  vertical-align: middle;
}

.whois-panel .admin-table-wrap {
  box-shadow: none;
  border-radius: var(--radius-sm);
}

.whois-dns-table {
  min-width: 520px;
}

.whois-dns-value {
  font-family: var(--mono);
  font-size: .84rem;
  overflow-wrap: anywhere;
}

/* Type and TTL are narrow, fixed facts - only the value column should ever wrap. */
.whois-dns-table th:first-child,
.whois-dns-table td:first-child {
  width: 1%;
  white-space: nowrap;
}

.whois-dns-table th:last-child,
.whois-dns-table td:last-child {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}


/* 9. SEARCH FORMS AND THE EXTENSION PICKER --------------------------------- */

.whois-search-panel > p {
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: .92rem;
  max-width: 74ch;
}

.whois-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .55rem;
}

.whois-search-form .form-control {
  min-height: 3rem;
  font-family: var(--mono);
  font-size: 1.02rem;
}

.whois-search-form .btn {
  padding-inline: 1.25rem;
}

.whois-search-form--compact {
  margin-bottom: 1.25rem;
}

.whois-search-form--compact .form-control {
  min-height: 2.5rem;
  font-size: .92rem;
}

.whois-search-hint {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  margin: .6rem 0 0;
  color: var(--muted);
  font-size: .84rem;
  min-height: 1.4rem;
}

.whois-search-hint code,
.whois-search-hint .ident {
  color: var(--brand-dark);
  background: var(--brand-tint);
  border-radius: 3px;
  padding: .05rem .3rem;
  font-size: .82rem;
}

/* The routing hint swaps as you type: keyword vs full domain vs IP. */
.route-hint[hidden] {
  display: none;
}

.ext-picker {
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}

/* Dimmed while the box holds a full domain or IP, where the extensions play no part. */
.ext-picker.is-inactive {
  opacity: .5;
  transition: opacity .15s ease;
}

.ext-picker__head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .8rem;
}

.ext-picker__head h3 {
  margin: 0;
  color: var(--ink);
  font-size: .92rem;
  font-weight: 600;
}

.ext-picker__count {
  color: var(--muted);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}

.ext-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
}

.ext-group {
  min-width: 0;
  margin: 0;
  padding: .7rem .8rem .8rem;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.ext-group legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  float: left;
  width: 100%;
  margin: 0 0 .5rem;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.ext-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  clear: both;
}

.ext-checkbox {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin: 0;
  padding: .22rem .5rem;
  color: var(--body);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.ext-checkbox:hover {
  border-color: var(--brand);
}

.ext-checkbox input {
  width: .85rem;
  height: .85rem;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.ext-checkbox:has(input:checked) {
  color: var(--brand-dark);
  background: var(--brand-tint);
  border-color: var(--brand);
  font-weight: 600;
}

.whois-list-form .whois-list-input {
  font-family: var(--mono);
  font-size: .88rem;
  margin-bottom: .75rem;
}

.whois-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: .85rem;
  margin-top: 1.25rem;
}

.category-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .3rem;
  padding: .95rem 1.05rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.category-tile span {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.3;
}

.category-tile span .bi {
  color: var(--brand);
}

.category-tile small {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
}

.whois-single-panel {
  margin-top: 1.15rem;
}


/* 10. RESULT TABLES (bulk / list / lookalikes) ----------------------------- */

.bulk-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .75rem;
  margin: 1.5rem 0 .85rem;
}

.bulk-summary h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.bulk-summary__counts {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

/* Filter chips: purely client-side show/hide over the result rows. */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .6rem;
  margin-bottom: .75rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  color: var(--body);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--brand);
}

.chip__count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.chip[aria-pressed="true"] {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.chip[aria-pressed="true"] .chip__count {
  color: rgba(255, 255, 255, .8);
}

.result-table {
  min-width: 640px;
}

.result-table td:first-child {
  font-family: var(--mono);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.result-table__state {
  width: 1%;
  white-space: nowrap;
}

.result-table tr[hidden] {
  display: none;
}

/* A thin colour key down the left edge of each row. */
.result-table tbody tr {
  border-left: 3px solid transparent;
}

.result-table tbody tr.is-available {
  border-left-color: var(--ok);
}

.result-table tbody tr.is-registered {
  border-left-color: var(--info);
}

.result-table tbody tr.is-error {
  border-left-color: var(--warn);
}

.result-table__detail {
  color: var(--muted);
  font-size: .84rem;
}

.result-empty {
  display: none;
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
}

.result-empty.is-shown {
  display: block;
}


/* 11. REPORTS -------------------------------------------------------------- */

.whois-banner {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  margin-bottom: 1.15rem;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.whois-banner .bi {
  font-size: 1.35rem;
  line-height: 1.25;
}

.whois-banner strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
}

.whois-banner p {
  margin: .2rem 0 0;
  color: var(--muted);
  font-size: .89rem;
}

.whois-banner--available {
  border-left-color: var(--ok);
}

.whois-banner--available .bi {
  color: var(--ok);
}

.whois-banner--registered {
  border-left-color: var(--info);
}

.whois-banner--registered .bi {
  color: var(--info);
}

.whois-banner--error {
  border-left-color: var(--bad);
}

.whois-banner--error .bi {
  color: var(--bad);
}

.whois-banner--warning {
  border-left-color: var(--warn);
}

.whois-banner--warning .bi {
  color: var(--warn);
}

.whois-banner--slim {
  margin-bottom: .85rem;
  padding: .65rem .9rem;
}

.whois-banner--slim .bi {
  font-size: 1.05rem;
}

.whois-banner--slim p {
  margin: 0;
}

.whois-dl {
  display: grid;
  gap: .4rem;
  margin: 0;
}

.whois-dl > div {
  display: grid;
  grid-template-columns: minmax(112px, max-content) minmax(0, 1fr);
  gap: .3rem .85rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--line);
  font-size: .89rem;
}

.whois-dl > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.whois-dl dt {
  color: var(--muted);
  font-weight: 500;
}

.whois-dl dd {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.whois-dl--compact > div {
  grid-template-columns: minmax(78px, max-content) minmax(0, 1fr);
  font-size: .84rem;
}

.whois-ns-list {
  display: grid;
  gap: .3rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: .86rem;
}

.whois-ns-list li {
  display: flex;
  align-items: center;
  gap: .35rem;
  overflow-wrap: anywhere;
}

.whois-ns-list .bi {
  color: var(--brand);
  flex: none;
}

.whois-record-snippet {
  display: block;
  width: 100%;
  margin-top: .3rem;
  padding: .4rem .6rem;
  color: var(--body);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  line-height: 1.5;
  word-break: break-all;
  white-space: pre-wrap;
}

.whois-note {
  display: flex;
  align-items: flex-start;
  gap: .4rem;
  margin-bottom: 1.15rem;
  padding: .7rem .9rem;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: .86rem;
}

.whois-note .bi {
  margin-top: .15rem;
  color: var(--faint);
}

.whois-raw {
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.whois-raw summary {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .8rem 1.05rem;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  list-style-position: inside;
}

.whois-raw[open] summary {
  border-bottom: 1px solid var(--line);
}

.whois-raw summary .whois-copy {
  margin-left: auto;
}

.whois-raw pre {
  max-height: 460px;
  overflow: auto;
  margin: 0;
  padding: 1rem 1.05rem;
  background: #14181a;
  color: #dfe5e2;
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: .76rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}

.whois-meta {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .8rem;
}

.whois-meta a {
  margin-left: .5rem;
}

.whois-ssl-host {
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 400;
}

.whois-sans {
  gap: .3rem;
}

/* Redirect trace: where the domain actually sends a browser. */
.trace-list {
  display: grid;
  gap: .5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trace-hop {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: .2rem .7rem;
  padding: .5rem .7rem;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.trace-hop__code {
  min-width: 2.6rem;
  padding: .1rem .4rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .76rem;
  font-weight: 700;
  text-align: center;
  color: var(--info);
  background: var(--info-bg);
}

.trace-hop__code--ok {
  color: var(--ok);
  background: var(--ok-bg);
}

.trace-hop__code--bad {
  color: var(--bad);
  background: var(--bad-bg);
}

.trace-hop__url {
  font-family: var(--mono);
  font-size: .82rem;
  overflow-wrap: anywhere;
}

.trace-hop__note {
  grid-column: 2;
  color: var(--muted);
  font-size: .78rem;
}

.trace-arrow {
  color: var(--faint);
  font-size: .8rem;
  text-align: center;
  line-height: 1;
}

/* Lookalike / typosquat report. */
.lookalike-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1rem;
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: .84rem;
}

.lookalike-kind {
  display: inline-flex;
  align-items: center;
  padding: .1rem .45rem;
  color: var(--muted);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}

/* The differing characters are underlined so the swap is obvious at a glance. */
.diff-char {
  color: var(--bad);
  background: var(--bad-bg);
  border-radius: 2px;
  padding: 0 .05rem;
  font-weight: 700;
}


/* 12. WATCHLIST, HISTORY AND ADMIN ----------------------------------------- */

.whois-watch-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .7rem;
  margin: 0 0 1.15rem;
}

.whois-watch-bar form {
  display: inline-flex;
  margin: 0;
}

.watch-remove {
  display: inline-flex;
  margin: 0;
}

.whois-recent {
  margin-top: 1.15rem;
}

.whois-recent .admin-table-wrap {
  margin-bottom: .75rem;
  box-shadow: none;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: .85rem;
  margin-bottom: 1.15rem;
}

.admin-stats div {
  padding: .9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.admin-stats span {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.admin-stats strong {
  display: block;
  margin-top: .2rem;
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.admin-analytics {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.admin-analytics h2 {
  font-size: .95rem;
}

.day-chart {
  display: flex;
  align-items: stretch;
  gap: .35rem;
  height: 175px;
}

.day-chart__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: .25rem;
  min-width: 0;
}

.day-chart__bar {
  width: 100%;
  max-width: 32px;
  background: var(--brand);
  border-radius: 3px 3px 0 0;
  transition: background-color .15s ease;
}

.day-chart__col:hover .day-chart__bar {
  background: var(--brand-dark);
}

.day-chart__count,
.day-chart__label {
  color: var(--muted);
  font-size: .68rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.top-domains {
  margin: 0;
  padding-left: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  font-size: .88rem;
}

.top-domains li {
  display: flex;
  align-items: baseline;
  gap: .5rem;
}

.top-domains li a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: .84rem;
}

.top-domains__count {
  margin-left: auto;
  color: var(--muted);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}

.whois-admin-filter {
  margin-bottom: 1.15rem;
}

.whois-admin-filter__fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
  /* Take the toolbar's width rather than being sized by content. Without this the percentage in
     the rule below resolves against a container that is itself sized from its content, and the
     last control wraps onto its own line with the row half empty. */
  flex: 1 1 auto;
}

.whois-admin-filter__fields .form-control {
  width: min(100%, 250px);
}

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
  font-size: .88rem;
  white-space: nowrap;
}

/* Switches between the two admin reports. */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: 1.15rem;
  border-bottom: 1px solid var(--line);
}

.admin-tabs__link {
  padding: .5rem .9rem;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
}

.admin-tabs__link:hover {
  color: var(--brand-dark);
  text-decoration: none;
}

.admin-tabs__link.active {
  border-bottom-color: var(--brand);
  color: var(--brand-dark);
}

/* A full-width analytics panel, for lists that sit below the two-column pair. */
.admin-panel--wide {
  margin-bottom: 1.15rem;
}

/* Referrers are plain text rather than links, so they need the same truncation the
   linked lists get from .top-domains li a. */
.top-domains--split li > .ident {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* 13. ACCOUNT PAGES -------------------------------------------------------- */

.account-panel {
  max-width: 460px;
  margin: 0 auto;
  padding: 1.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
}

.account-panel h2 {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 0 0 .35rem;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 600;
}

.account-panel h2 .bi {
  color: var(--brand);
}

.account-panel > p.muted {
  margin-bottom: 1.25rem;
  font-size: .9rem;
}

.account-panel__field {
  display: grid;
  gap: .3rem;
  margin-bottom: .95rem;
}

.account-panel__field label {
  color: var(--ink);
  font-size: .86rem;
  font-weight: 600;
}

.account-panel__field .form-control {
  min-height: 2.6rem;
}

.account-panel__field small {
  color: var(--muted);
  font-size: .78rem;
}

.account-panel__remember {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 .25rem;
  font-size: .88rem;
  cursor: pointer;
}

.account-panel__remember input {
  margin: 0;
  accent-color: var(--brand);
}

.account-panel__submit {
  width: 100%;
  min-height: 2.7rem;
}

.account-panel__errors:not(:empty) {
  margin-bottom: 1rem;
}

.account-panel__errors ul {
  margin: 0;
  padding-left: 1.1rem;
}

.account-form {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.account-panel__alt {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .88rem;
}

/* The register form's bot honeypot. Moved off-screen rather than set to display:none or
   visibility:hidden, both of which the better bots know to skip: the whole point is that a
   script filling in every field it finds in the DOM fills this one too. The field is also
   aria-hidden and out of the tab order in the markup, so nobody is ever asked to complete it.
   Deleting this rule makes a real input appear on the page - remove the check first. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}


/* 14. RESPONSIVE ----------------------------------------------------------- */

@media (max-width: 991.98px) {
  .app-nav > .container {
    flex-wrap: wrap;
    padding-top: .4rem;
    padding-bottom: .4rem;
  }

  .app-nav .navbar-collapse {
    flex-basis: 100%;
  }

  .app-nav .navbar-nav {
    align-items: stretch;
    padding: .4rem 0;
  }

  .nav-account {
    margin-left: 0;
    padding-top: .4rem;
    border-top: 1px solid rgba(255, 255, 255, .18);
  }

  .nav-account__divider {
    display: none;
  }
}

@media (max-width: 900px) {
  .whois-grid,
  .admin-analytics {
    grid-template-columns: 1fr;
  }

  .investigation-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .ext-grid {
    grid-template-columns: 1fr;
  }

  .whois-search-panel {
    padding: 1.15rem;
  }

  .whois-search-form {
    grid-template-columns: 1fr;
  }

  .whois-dl > div {
    grid-template-columns: 1fr;
    gap: .05rem;
  }

  .page-heading .container {
    align-items: flex-start;
  }

  .report-head__id {
    font-size: 1.2rem;
  }

  .investigation-summary {
    grid-template-columns: 1fr;
  }

  /* Stacked, but stretched: with align-items:flex-start a column flex container sizes
     each child to its max-content, and the long footer sentence then drags the whole
     document wider than the screen - which also pushes the nav toggle off the edge. */
  .site-footer .container,
  .pagination-bar,
  .admin-toolbar,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .site-footer__note {
    flex-basis: auto;
  }

  /* Buttons keep their own width rather than spanning the screen. */
  .pagination-bar .btn,
  .form-actions .btn,
  .admin-toolbar .btn,
  .admin-toolbar form {
    align-self: flex-start;
  }
}


/* 15. PRINT ---------------------------------------------------------------
   Reports get printed and saved as PDFs, so give them a clean paper layout:
   no chrome, no interactive controls, nothing clipped or scrolled away.
   ------------------------------------------------------------------------- */

@media print {
  .app-header,
  .site-footer,
  .whois-search-form,
  .whois-watch-bar,
  .report-head__actions,
  .filter-bar,
  .copy-btn,
  .whois-copy,
  .pagination-bar,
  .skip-link {
    display: none !important;
  }

  body {
    color: #000;
    background: #fff;
    font-size: 11pt;
  }

  .section {
    padding: 0;
  }

  .page-heading {
    padding: 0 0 .5rem;
    border-bottom: 1px solid #999;
  }

  .container,
  .narrow {
    max-width: none;
    width: 100%;
  }

  .whois-panel,
  .whois-banner,
  .admin-table-wrap,
  .investigation-signal,
  .whois-raw {
    box-shadow: none;
    border-color: #bbb;
    break-inside: avoid;
  }

  .whois-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Print the raw response on paper, not as white-on-black. */
  .whois-raw pre {
    max-height: none;
    color: #000;
    background: #fff;
    border-top: 1px solid #bbb;
  }

  .whois-raw[open] summary {
    border: 0;
  }

  details {
    break-inside: avoid;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  .admin-table {
    min-width: 0;
  }

  .admin-table > thead th {
    position: static;
    background: #eee;
  }
}
