/* DNS Tools shared design system (B+C). Loaded FIRST on every page family: public, account, support, reports, commerce, error, admin.
   One set of tokens, one page container, one header/nav/footer, one set of controls. Family stylesheets (app.css, site.css, account.css,
   support.css, commerce.css, report-email.css, admin*.css) add page-specific pieces only and must not redefine these fundamentals.
   Breakpoints (media queries cannot read custom properties): 1024 / 768 / 620 / 390. */

/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #0b0d10; --panel: #11151a; --panel2: #171c22; --text: #f1f3f5; --muted: #929ba5; --line: #293039;
  --ok: #8fd4a7; --warn: #e4ba70; --risk: #ee8a86; --btn: #f2f4f5; --bt: #0b0d10;
  color-scheme: dark;

  /* spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  /* radii */
  --r-control: 9px; --r-card: 19px; --r-inner: 12px; --r-pill: 999px;
  /* elevation */
  --shadow-card: none; --shadow-pop: 0 18px 50px rgba(0, 0, 0, .35);
  /* z-index */
  --z-skip: 10; --z-sticky: 100; --z-overlay: 2000; --z-toast: 3000;
  /* layout */
  --container: 1340px; --gutter: 32px; --w-narrow: 520px; --w-form: 760px; --header-h: 76px;
  /* type */
  --font-sans: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 11px; --fs-sm: 13px; --fs-md: 15px; --fs-lg: 18px;
  --fs-h3: 17px; --fs-h2: 24px; --fs-h1: clamp(32px, 3.4vw, 46px); --fs-display: clamp(38px, 4.4vw, 62px);
}
html[data-theme=light] {
  --bg: #f5f7f9; --panel: #fff; --panel2: #f8fafb; --text: #1c2228; --muted: #5a646e; --line: #dce2e7;
  --ok: #27794a; --warn: #98691f; --risk: #b3261e; --btn: #20262c; --bt: #fff;
  --shadow-pop: 0 18px 44px rgba(28, 34, 40, .18);
  color-scheme: light;
}
@media (max-width: 768px) { :root { --gutter: 24px; } }
@media (max-width: 620px) { :root { --gutter: 16px; --header-h: 64px; } }

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: var(--s3); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: var(--fs-md); line-height: 1.5; transition: background-color .2s, color .2s; }
[hidden] { display: none !important; }
a { color: var(--text); text-underline-offset: 3px; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--ok); outline-offset: 3px; }
main:focus, #results:focus, #scan:focus { outline: none; }
.sr-only, .sr { position: absolute; left: 0; top: 0; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -9999px; top: var(--s2); z-index: var(--z-skip); background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-control); padding: 10px 14px; text-decoration: none; }
.skip-link:focus { left: var(--s4); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- the one page container
   header, primary nav, sub-nav, main and footer all live inside .app, so they share identical left/right edges on every page. */
.app { display: flex; flex-direction: column; width: 100%; min-height: 100vh; max-width: var(--container); margin-inline: auto; padding: 0 var(--gutter) var(--s6); }
main { display: block; flex: 1 0 auto; min-width: 0; padding-top: var(--s5); }

/* ---------------------------------------------------------------- header, navigation, footer */
.site-header { min-height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: var(--s4); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: -.02em; font-size: 18px; color: var(--text); text-decoration: none; }
.brand span { color: var(--muted); font-weight: 500; }
.primary-nav { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.primary-nav a, .subnav a { color: var(--muted); text-decoration: none; border: 1px solid transparent; border-radius: var(--r-control); padding: 8px 12px; font-size: 13px; line-height: 1.3; }
.primary-nav a:hover, .subnav a:hover { color: var(--text); }
.primary-nav a[aria-current=page], .subnav a[aria-current=page] { background: var(--panel); border-color: var(--line); color: var(--text); }
.subnav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.subnav-links { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); }
.subnav-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-left: auto; font-size: 12px; color: var(--muted); }
.subnav-tools form { margin: 0; }
.subnav-tools .ghost { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.subnav-user { overflow-wrap: anywhere; }

.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--s4) var(--s6); border-top: 1px solid var(--line); margin-top: var(--s7); padding: var(--s5) 0 0; font-size: 13px; color: var(--muted); }
.footer-main { display: grid; gap: var(--s3); min-width: 0; }
.site-footer p { margin: 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.footer-tag { color: var(--text); }
.footer-id { display: grid; gap: var(--s1); text-align: right; }
.issue-link { color: var(--muted); font-size: 13px; text-decoration: underline; }
.issue-link:hover { color: var(--text); }
@media (max-width: 768px) { .footer-id { text-align: left; } }

/* ---------------------------------------------------------------- typography scale */
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
main h1 { font-size: var(--fs-h1); line-height: 1.05; letter-spacing: -.045em; margin: var(--s2) 0 var(--s3); overflow-wrap: anywhere; }
main h2 { font-size: var(--fs-h2); letter-spacing: -.025em; }
main h3 { font-size: var(--fs-h3); letter-spacing: -.01em; }
.tag, .eyebrow { font: var(--fs-xs) var(--font-mono); letter-spacing: .13em; color: var(--muted); text-transform: uppercase; }
.lead { font-size: var(--fs-lg); line-height: 1.6; color: var(--muted); max-width: 36rem; margin: 0; }
.muted { color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; }
.hint, .fine2, .field-help { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 6px 0 0; }
.mono { font-family: var(--font-mono); }
code { font-family: var(--font-mono); }
.pagehead { padding: var(--s4) 0 var(--s5); }
.pagehead .lead { font-size: 17px; max-width: 36rem; }

/* ---------------------------------------------------------------- buttons: .primary / .ghost / .danger (+ .dt-btn aliases, .theme, .re-btn, .btn) */
button, input, select, textarea { font: inherit; color: inherit; }
.primary, .ghost, .danger, .theme, .re-btn, .dt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; padding: 10px 18px;
  border: 1px solid transparent; border-radius: var(--r-control); font: 600 15px/1.2 var(--font-sans); text-align: center; text-decoration: none; cursor: pointer;
  -webkit-appearance: none; appearance: none; }
.primary, .re-btn, .dt-btn.primary { background: var(--btn); color: var(--bt); border-color: var(--btn); border-radius: 8px; font-weight: 700; }
.ghost, .theme, .dt-btn.ghost { background: var(--panel); color: var(--text); border-color: var(--line); font-weight: 500; }
.theme { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.danger { background: transparent; color: var(--risk); border-color: var(--risk); }
.ghost:hover, .theme:hover { border-color: var(--muted); }
.primary:hover, .re-btn:hover { opacity: .92; }
.primary:disabled, .ghost:disabled, .danger:disabled, .dt-btn:disabled, .re-btn:disabled, [aria-disabled=true].primary { opacity: .55; cursor: not-allowed; }
.is-loading, [aria-busy=true].primary, [aria-busy=true].ghost { opacity: .7; cursor: progress; }
.primary:focus-visible, .ghost:focus-visible, .theme:focus-visible { outline-offset: 2px; }
.linkbtn { text-decoration: none; }
.tool-fields > .field { margin: 0; }
.btn-row, .actions, .tool-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

/* ---------------------------------------------------------------- form controls: label above, full-width control */
label { font-size: 13px; }
.field { display: grid; gap: 6px; min-width: 0; margin: 0 0 var(--s4); border: 0; padding: 0; }
.field label, .field legend, .stack > label { display: block; font-size: 13px; font-weight: 700; color: var(--text); margin: 0; padding: 0; }
.field .req, .field .opt { font-weight: 400; color: var(--muted); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], input[type=tel], input[type=number], input:not([type]), select, textarea {
  display: block; width: 100%; min-width: 0; min-height: 44px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-control);
  padding: 11px 13px; font: 16px/1.4 var(--font-sans); -webkit-appearance: none; appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
textarea { min-height: 150px; resize: none; }
input[type=file] { width: 100%; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-control); padding: 9px; font-size: 13px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--ok); outline-offset: 2px; }
[aria-invalid=true] { border-color: var(--risk) !important; }
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
.field-error { color: var(--risk); font-size: 12px; line-height: 1.5; margin: 0; }
.field-error:empty { display: none; }
.check, .field-bool { display: flex; gap: 10px; align-items: flex-start; }
.check label, .field-bool label { font-weight: 400; font-size: 13px; line-height: 1.55; }
.hp-wrap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* stacked form: every control, including the submit button, is the full width of the form (input width == button width) */
.stack { display: grid; gap: var(--s3); margin-top: var(--s4); }
.stack > .primary, .stack > .ghost, .stack > .danger, form.stack .primary:only-of-type { width: 100%; }
.stack.inline { grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: var(--s3); }
.stack.inline > label, .stack.inline > .hint { grid-column: 1 / -1; }
.stack.inline > .primary { width: auto; }
@media (max-width: 620px) { .stack.inline { grid-template-columns: 1fr; } .stack.inline > .primary { width: 100%; } }

/* inline "search bar" (hero domain form, tool input): input and button share one rounded field */
.search, .dt-search { display: flex; align-items: center; gap: var(--s2); background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-inner); padding: 7px; margin: var(--s4) 0 var(--s2); }
.search:focus-within, .dt-search:focus-within { outline: 2px solid var(--ok); outline-offset: 2px; }
.search input, .dt-search input { flex: 1; width: auto; min-width: 0; min-height: 44px; border: 0; outline: 0; background: none; padding: 10px 12px; font: 16px var(--font-mono); }
.search .primary, .dt-search .primary { flex: none; }
@media (max-width: 620px) {
  .search, .dt-search { display: grid; gap: var(--s2); }
  .search .primary, .dt-search .primary { width: 100%; }
}

/* ---------------------------------------------------------------- cards, notices, badges, empty states */
.panel, .card, .box, .dt-card, .side-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-card); min-width: 0; }
.panel, .card, .box, .dt-card { padding: var(--s5); }
.card { margin: var(--s4) 0; }
.card h2, .panel h2 { font-size: 20px; letter-spacing: -.02em; margin: 0 0 var(--s2); }
.dt-card--narrow, .card.narrow, .checkout { width: min(100%, var(--w-narrow)); margin-inline: auto; }
.card.narrow { margin-block: var(--s6); }
.checkout { margin-block: var(--s6); }
.card.narrow h1, .checkout h1 { font-size: clamp(28px, 3vw, 36px); }
.box { max-width: none; }
@media (max-width: 620px) { .panel, .card, .box, .dt-card { padding: var(--s4); } }

.error { color: var(--risk); font-size: 13px; margin: var(--s2) 0; }
.flash, .dt-notice, .notice-ok, .form-summary { border: 1px solid var(--line); border-radius: var(--r-inner); padding: 11px 14px; margin: var(--s3) 0; font-size: 14px; background: var(--panel2); }
.flash.ok, .dt-notice--ok, .notice-ok { border-color: var(--ok); } .flash.warn, .dt-notice--warn { border-color: var(--warn); } .flash.bad, .dt-notice--risk, .form-summary { border-color: var(--risk); }
.flash.bad { color: var(--risk); }
.badge { display: inline-block; border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-pill); padding: 3px 10px; font: 11px var(--font-mono); letter-spacing: .04em; color: var(--text); white-space: nowrap; }
.badge.ok, .badge.tone-good { color: var(--ok); border-color: var(--ok); }
.badge.warn, .badge.tone-warn { color: var(--warn); border-color: var(--warn); }
.badge.risk, .badge.tone-risk { color: var(--risk); border-color: var(--risk); }
.badge.tone-unknown, .badge.tone-info { color: var(--muted); }
.empty, .dt-empty { padding: var(--s5); color: var(--muted); font-size: 13px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r-inner); }
.row { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; justify-content: space-between; }

/* ---------------------------------------------------------------- tables: always inside their own horizontal scroll container */
.tablewrap, .table-wrap, .tablebox, .dt-table-wrap { position: relative; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tablewrap table, .dt-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.tablewrap th, .tablewrap td, .dt-table th, .dt-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: break-word; }
.tablewrap thead th, .dt-table thead th { font: 11px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tablewrap tbody th { font-weight: 600; }
.tablewrap tr:last-child > *, .dt-table tr:last-child > * { border-bottom: 0; }

/* ---------------------------------------------------------------- narrow screens: compact navigation */
@media (max-width: 620px) {
  .subnav { gap: var(--s2); }
  .subnav-links { gap: 2px; }
  .subnav a { padding: 7px 9px; font-size: 12.5px; }
  .subnav-tools { width: 100%; justify-content: space-between; margin-left: 0; }
}

/* ---------------------------------------------------------------- refinements found in visual review */
.card .lead, .panel .lead, .dt-card .lead, .checkout .lead { margin-bottom: var(--s4); }
input[type=file]::file-selector-button { margin-right: var(--s3); padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--panel); color: var(--text); font: 500 13px var(--font-sans); cursor: pointer; }
.radio { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-weight: 400; }
@media (max-width: 620px) {
  .tablewrap table, .dt-table { min-width: 480px; }
  .tablewrap thead th { white-space: nowrap; }
}

/* ---------------------------------------------------------------- touch targets (>= 40px) and compact navigation */
.primary-nav a, .subnav a { display: inline-flex; align-items: center; min-height: 40px; }
.site-footer nav a { display: inline-flex; align-items: center; min-height: 40px; }
.site-footer nav { gap: 0 var(--s5); }
details > summary { min-height: 40px; padding-block: 10px; display: list-item; }
.brand { display: inline-block; line-height: 40px; }

/* ---------------------------------------------------------------- themed checkboxes and radios (no browser-default control styling) */
input[type=checkbox], input[type=radio] { -webkit-appearance: none; appearance: none; display: inline-grid; place-content: center; width: 20px; height: 20px; margin: 0; padding: 0; flex: none;
  background: var(--panel2); border: 1.5px solid var(--muted); border-radius: 6px; cursor: pointer; accent-color: var(--ok); }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]::after { content: ""; width: 5px; height: 10px; margin-top: -2px; border: solid var(--bt); border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); transition: transform .12s; }
input[type=radio]::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bt); transform: scale(0); transition: transform .12s; }
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--btn); border-color: var(--btn); }
input[type=checkbox]:checked::after { transform: rotate(45deg) scale(1); }
input[type=radio]:checked::after { transform: scale(1); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 2px solid var(--ok); outline-offset: 2px; }
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: .55; cursor: not-allowed; }
.check label, .field-bool label { display: block; min-height: 40px; padding-block: 9px; }
.check > input, .field-bool > input { margin-top: 10px; }
.check label a, .field-bool label a { display: inline-block; padding: 12px 0; margin: -12px 0; }
input[type=checkbox]:indeterminate { background: var(--btn); border-color: var(--btn); }
input[type=checkbox]:indeterminate::after { width: 10px; height: 2px; margin: 0; border: 0; background: var(--bt); transform: none; }
.fade-end { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
.fade-start { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); }
.fade-start.fade-end { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }

/* ---------------------------------------------------------------- menu disclosure below 940px (dt-nav.js); the collapsed nav keeps its box so edges stay identical */
.header-tools { display: flex; align-items: center; gap: var(--s2); }
.nav-toggle { display: none; align-items: center; justify-content: center; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--panel); color: var(--text); font: 500 14px var(--font-sans); cursor: pointer; }
@media (max-width: 940px) {
  .nav-toggle { display: inline-flex; }
  .primary-nav { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0; max-height: 0; overflow: hidden; visibility: hidden; border-bottom-width: 0; }
  .primary-nav.is-open { max-height: none; visibility: visible; padding: var(--s2) 0; border-bottom-width: 1px; }
  .primary-nav a { min-height: 44px; padding: 10px 12px; font-size: 15px; }
}
/* tool / form refinements from the independent visual review */
.primary:disabled, .dt-btn.primary:disabled { background: var(--panel2); color: var(--muted); border-color: var(--line); opacity: 1; cursor: not-allowed; }
[aria-invalid=true]:focus-visible { outline-color: var(--risk); }
input[type=checkbox], input[type=radio] { min-width: 20px; min-height: 20px; aspect-ratio: 1; box-sizing: border-box; }
@media (max-width: 620px) {
  .search, .dt-search { border: 0; background: none; padding: 0; }
  .search input, .dt-search input { border: 1px solid var(--line); background: var(--panel2); border-radius: var(--r-control); padding: 11px 13px; }
}
.metric strong { font-family: var(--font-sans); line-height: 1.1; }

@media (max-width: 1200px) { .footer-id { text-align: left; } }

/* modal-adjacent: invalid fields show one clear state (red border and red ring) */

.scroll-hint { margin: 0 0 var(--s1); text-align: right; font: 11px var(--font-mono); letter-spacing: .04em; color: var(--muted); }
.tablewrap.fade-end, .table-wrap.fade-end { box-shadow: inset -14px 0 12px -12px var(--muted); }

/* Touch targets: inline utility links (Report an issue etc.) get a 44px hit area on small screens without changing their look. */
@media (max-width: 820px) {
  a.issue-link, .issue-link { display: inline-flex; align-items: center; min-height: 44px; padding-block: 8px; }
}
