:root {
  --navy: #2b3a5a;
  --red: #e3202b;
  --bg: #f3f4f8;
  --surface: #ffffff;
  --text: #1c2433;
  --muted: #5b6577;
  --border: #d9dde6;
  --black: #000000;
  --good: #00b050;
  --good-text: #8ed973;
  --warn: #ffc000;
  --alert: #d9623d;
  --alert-text: #f57851;
  --bad: #a03514;
  --bad-text: #d9623d;
  --radius: 12px;
  --focus: 0 0 0 3px rgba(43, 58, 90, 0.35);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  line-height: 1.5;
}

.container {
  width: min(1180px, 100% - 32px);
  margin-inline: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  background: var(--navy);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  z-index: 10;
}
.skip-link:focus {
  top: 8px;
}

[hidden] {
  display: none !important;
}

/* En-tête ------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 4px solid var(--navy);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-block: 14px;
}
.logo {
  height: auto;
  max-width: 100%;
}
.site-header h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  color: var(--navy);
}
.tagline {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Cartes & formulaire ------------------------------------------------- */
main {
  min-width: 0;
  padding-block: 24px 40px;
  display: grid;
  gap: 24px;
}
.card {
  scroll-margin-top: 96px;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(20, 30, 50, 0.06);
}
.card h2 {
  margin: 0 0 16px;
  font-size: 1.2rem;
  color: var(--navy);
}
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}
.field-row {
  align-items: start;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
label,
.label-row {
  font-weight: 600;
  font-size: 0.92rem;
}
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
input[type='text'],
input[type='search'],
textarea {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
textarea {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.9rem;
  resize: vertical;
}
input:focus-visible,
textarea:focus-visible,
button:focus-visible,
.file-button:focus-within,
.table-scroll:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-color: var(--navy);
}
#file:focus-visible + * {
  outline: none;
}
.help {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}
.form-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fdecea;
  color: #8a1c13;
  border: 1px solid #f3b9b3;
}
.notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff6dd;
  color: #6b4b00;
  border: 1px solid #f0d78a;
  font-size: 0.9rem;
}

.btn,
.file-button {
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--navy);
  cursor: pointer;
}
.file-button {
  display: inline-block;
}
.dropzone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: #fafbfd;
}
.dropzone.is-over {
  border-color: var(--navy);
  background: #eef0f6;
}
.dropzone-text {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 400;
}
.file-button:has(+ input:focus-visible) {
  box-shadow: var(--focus);
}
.btn:hover,
.file-button:hover {
  background: #eef0f6;
}
.btn-primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.btn-primary:hover {
  background: #1f2b45;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.actions {
  display: flex;
  gap: 12px;
}
.progress-wrap {
  margin-top: 16px;
}
progress {
  width: 100%;
  height: 10px;
  accent-color: var(--navy);
}

/* Partie 1 : synthèse ----------------------------------------------- */
.report-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.report-heading {
  grid-column: 2;
  text-align: center;
}
.report-head .logo {
  grid-column: 1;
  grid-row: 1;
}
.report-heading h2 {
  margin: 0;
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  color: var(--text);
}
.report-date {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.summary {
  display: grid;
  gap: 0;
  max-width: 760px;
  margin-inline: auto;
}
.summary-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  text-align: center;
}
.summary-table thead tr {
  background: var(--black);
}
.summary-table th {
  padding: 5px 4px;
  font-size: 0.85rem;
  color: #fff;
  overflow-wrap: anywhere;
}
.summary-table td {
  padding: 5px 4px;
  font-variant-numeric: tabular-nums;
}
.summary-table tbody td:first-child {
  font-weight: 700;
}
.count-link {
  font: inherit;
  background: none;
  border: 0;
  padding: 2px 8px;
  cursor: pointer;
  color: var(--navy);
  font-weight: 600;
  text-decoration: underline dotted;
  border-radius: 4px;
}
.count-link:hover {
  background: #eef0f6;
}

.tone-good {
  color: var(--good-text) !important;
}
.tone-warn {
  color: var(--warn) !important;
}
.tone-alert {
  color: var(--alert-text) !important;
}
.tone-bad {
  color: var(--bad-text) !important;
}

.charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 28px;
}
.chart-card {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  align-content: start;
  justify-items: center;
}
.chart-card figcaption {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.9rem;
}
.doughnut {
  width: min(230px, 100%);
  height: auto;
}
.doughnut-total {
  font-size: 30px;
  font-weight: 700;
  fill: var(--text);
}
.doughnut-caption {
  font-size: 11px;
  fill: var(--muted);
}
.legend-groups {
  display: grid;
  gap: 8px;
  width: 100%;
}
.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  font-size: 0.88rem;
}
.legend li {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 8px;
}
.legend .legend-title {
  display: block;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 4px;
}
.legend-count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.swatch-good {
  background: var(--good);
}
.swatch-warn {
  background: var(--warn);
}
.swatch-alert {
  background: var(--alert);
}
.swatch-bad {
  background: var(--bad);
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

/* Partie 2 : détail ---------------------------------------------------- */
.detail-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.detail-tools input[type='search'] {
  max-width: 340px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--navy);
  color: #fff;
  border-radius: 999px;
  padding: 3px 6px 3px 12px;
  font-size: 0.85rem;
}
.chip button {
  background: rgba(255, 255, 255, 0.2);
  border: 0;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.table-scroll {
  max-width: 100%;
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.detail-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 0.82rem;
}
.detail-table th {
  position: sticky;
  top: 0;
  background: var(--black);
  color: #fff;
  text-align: left;
  padding: 8px 10px;
  white-space: nowrap;
  z-index: 1;
}
.detail-table td {
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  vertical-align: top;
}
.detail-table tbody tr:nth-child(even) {
  background: #f7f8fb;
}
.cell-domain {
  font-weight: 600;
  white-space: nowrap;
}
.cell-dns {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.78rem;
  min-width: 140px;
  max-width: 380px;
  overflow-wrap: anywhere;
}
.cell-notes {
  color: var(--bad);
  min-width: 160px;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 600;
  background: #eceef3;
  color: var(--text);
}
.badge-good {
  background: #d8f3e2;
  color: #00632b;
}
.badge-warn {
  background: #fff1c2;
  color: #6b4b00;
}
.badge-alert {
  background: #fde0d6;
  color: #8a3213;
}
.badge-bad {
  background: #f5d2c8;
  color: #7a210a;
}

.site-footer {
  padding-block: 8px 32px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

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

@media (max-width: 720px) {
  .field-row {
    grid-template-columns: 1fr;
  }
  .report-head {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .report-heading {
    grid-column: 1;
  }
  .report-head .logo {
    grid-column: 1;
  }
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .card {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

@media print {
  body {
    background: #fff;
  }
  .no-print,
  .site-header,
  .site-footer,
  .skip-link {
    display: none !important;
  }
  .card {
    box-shadow: none;
    border: 0;
    padding: 0;
    break-inside: avoid;
  }
  .table-scroll {
    max-height: none;
    overflow: visible;
  }
  .detail-table {
    font-size: 0.65rem;
  }
  .summary-table thead tr,
  .detail-table th {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #detail {
    break-before: page;
  }
}

.selector-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 0;
  padding: 0;
}
.selector-list li {
  padding: 2px 9px;
  border-radius: 999px;
  background: #eceef3;
  color: var(--navy);
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.78rem;
}
/* Bulles d'aide ------------------------------------------------------- */
.tip-host {
  position: relative;
}
.info {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-left: 6px;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font: italic 700 0.7rem/1 Georgia, 'Times New Roman', serif;
  vertical-align: middle;
  cursor: help;
  opacity: 0.75;
}
.info:hover,
.info:focus-visible {
  opacity: 1;
}
.tooltip {
  position: absolute;
  z-index: 15;
  top: calc(100% + 8px);
  left: 50%;
  width: min(320px, calc(100vw - 48px));
  transform: translateX(-50%);
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  box-shadow: 0 6px 18px rgba(20, 30, 50, 0.3);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  width: 10px;
  height: 10px;
  background: var(--navy);
  transform: translateX(-50%) rotate(45deg);
}
.tooltip .tip-reco {
  display: block;
  margin-top: 8px;
  font-weight: 700;
}
.tip-host:hover > .tooltip,
.tip-host:focus-within > .tooltip {
  visibility: visible;
  opacity: 1;
}
.summary-table th.tip-host .tooltip {
  left: 0;
  transform: none;
}
.summary-table th.tip-host .tooltip::before {
  left: 24px;
}

@media print {
  .info,
  .tooltip {
    display: none !important;
  }
}