/* MailRym — interface de l'outil d'audit. S'appuie sur style.css (mêmes variables). */

:root {
  --ok: #10B981;
  --ok-ink: #047857;
  --warn: #F59E0B;
  --warn-ink: #92400E;
  --bad: #EF4444;
  --bad-ink: #B91C1C;
  --na: #94A3B8;
  --na-ink: #475569;
}

/* ---------- Zone de saisie ---------- */
.audit-grid { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 960px) { .audit-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 4.5rem; } }
.audit-grid .checks li strong { font-weight: 600; }
.audit-grid .checks li span { color: var(--ink-2); }

.audit-form { display: grid; gap: 1.25rem; }
.audit-form .field input { font-size: 1.1rem; padding: .95rem 1rem; }
.dkim { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.dkim summary { cursor: pointer; padding: .8rem 1rem; font-weight: 600; font-size: .98rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.dkim summary::-webkit-details-marker { display: none; }
.dkim summary::after { content: "+"; font-size: 1.4rem; line-height: 1; font-weight: 400; color: var(--blue-strong); }
.dkim[open] summary::after { content: "–"; }
.dkim-body { padding: 0 1rem 1rem; display: grid; gap: .6rem; }
.dkim-body .hint { margin: 0; font-size: .9rem; color: var(--ink-2); line-height: 1.5; }
.dkim code, .raw code { font-family: var(--mono); font-size: .85em; background: #EEF2F7; padding: .1em .35em; border-radius: 4px; }
.audit-note { margin: 0; font-size: .88rem; color: var(--ink-2); line-height: 1.55; }
.audit-quota { margin: 0; font-size: .92rem; font-weight: 600; color: var(--ink); }

.alert { padding: 1rem 1.1rem; border-radius: var(--radius); border: 1px solid; font-size: .98rem; line-height: 1.5; }
.alert[hidden] { display: none; }
.alert strong { display: block; margin-bottom: .15rem; }
.alert-error { background: #FEF2F2; border-color: #FECACA; color: #7F1D1D; }
.alert-limit { background: #FFFBEB; border-color: #FDE68A; color: #78350F; }
.alert .btn { margin-top: .75rem; }

/* ---------- Attente ---------- */
.loading { display: flex; gap: 1rem; align-items: center; padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.loading[hidden] { display: none; }
.loading p { margin: 0; color: var(--ink-2); }
.loading strong { display: block; color: var(--ink); }
.spin { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--blue-strong); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn .spin { width: 18px; height: 18px; border-width: 2px; border-color: rgba(255,255,255,.35); border-top-color: #fff; }
.btn .spin[hidden] { display: none; }

/* ---------- Résultats ---------- */
.results { padding-top: 1rem; scroll-margin-top: 90px; }
.results[hidden] { display: none; }
.results-grid { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 960px) {
  .results-grid { grid-template-columns: minmax(0, 4.2fr) minmax(0, 7fr); gap: 4rem; }
  .score-col { position: sticky; top: 96px; }
}

.score-panel { background: var(--navy-deep); color: var(--on-dark); border-radius: var(--radius-lg); box-shadow: 0 24px 48px -24px rgba(17,28,62,.55); overflow: hidden; }
.score-top { padding: 1.5rem 1.5rem 1.25rem; display: flex; align-items: center; gap: 1.25rem; }
.ring { position: relative; flex: none; width: 112px; height: 112px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: rgba(255,255,255,.12); stroke-width: 9; }
.ring .arc { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.2,.7,.2,1); }
.ring .num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .num b { font-size: 2.15rem; line-height: 1; letter-spacing: -.04em; color: #fff; }
.ring .num small { font-size: .78rem; color: var(--on-dark-2); margin-top: .15rem; }
.score-head { min-width: 0; }
.score-domain { font-family: var(--mono); font-size: .82rem; color: var(--on-dark-2); overflow-wrap: anywhere; margin-bottom: .35rem; }
.score-state { font-size: 1.35rem; font-weight: 700; color: #fff; line-height: 1.2; letter-spacing: -.015em; }
.tone-ok .arc { stroke: var(--ok); }
.tone-warn .arc { stroke: var(--warn); }
.tone-bad .arc { stroke: var(--bad); }

.score-rows { list-style: none; border-top: 1px solid rgba(255,255,255,.1); }
.score-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,.07); }
.score-row b { color: #fff; font-size: .95rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--mono); font-size: .76rem; font-weight: 600; white-space: nowrap; }
.chip svg { width: 14px; height: 14px; flex: none; }
.chip.ok { color: #6EE7B7; }
.chip.warn { color: #FCD34D; }
.chip.bad { color: #FCA5A5; }
.chip.na { color: #B6C2D6; }
.compliance { padding: 1.1rem 1.5rem 1.35rem; display: flex; gap: .8rem; align-items: flex-start; font-size: .9rem; line-height: 1.45; color: var(--on-dark-2); }
.compliance strong { display: block; color: #fff; font-size: .98rem; margin-bottom: .1rem; }
.compliance .badge { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.compliance .badge svg { width: 15px; height: 15px; }
.compliance.ok .badge { background: var(--ok); }
.compliance.bad .badge { background: var(--bad); }

.summary { font-size: clamp(1.1rem, 1.7vw, 1.3rem); line-height: 1.6; color: var(--ink); margin: 0 0 2.5rem; max-width: 62ch; }
.block-title { font-size: 1.4rem; letter-spacing: -.02em; margin: 0 0 1rem; }
.results-main > section { margin-bottom: 2.75rem; }

/* Actions prioritaires */
.actions { list-style: none; border-top: 1px solid var(--line); }
.action { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; padding-block: 1.15rem; border-bottom: 1px solid var(--line); }
.prio { align-self: start; font-size: .82rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; line-height: 1.4; white-space: nowrap; }
.prio.haute { background: #FEE2E2; color: #991B1B; }
.prio.moyenne { background: #FEF3C7; color: #92400E; }
.prio.basse { background: #E0ECFF; color: #1E40AF; }
.action h4 { font-size: 1.05rem; margin: 0 0 .25rem; line-height: 1.35; }
.action p { margin: 0; color: var(--ink-2); font-size: .98rem; max-width: 62ch; }

/* Détail par protocole */
.proto { border-top: 1px solid var(--line); }
.proto details { border-bottom: 1px solid var(--line); }
.proto summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 0; font-weight: 600; }
.proto summary::-webkit-details-marker { display: none; }
.proto summary .name { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.proto summary .name::before { content: "+"; font-size: 1.4rem; line-height: 1; font-weight: 400; color: var(--blue-strong); width: 1rem; }
.proto details[open] summary .name::before { content: "–"; }
.pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; font-weight: 600; padding: .22rem .65rem; border-radius: 999px; white-space: nowrap; }
.pill svg { width: 12px; height: 12px; }
.pill.ok { background: #D1FAE5; color: var(--ok-ink); }
.pill.warn { background: #FEF3C7; color: var(--warn-ink); }
.pill.bad { background: #FEE2E2; color: var(--bad-ink); }
.pill.na { background: #E2E8F0; color: var(--na-ink); }
.proto-body { padding: 0 0 1.25rem 1.7rem; display: grid; gap: .8rem; }
.proto-body p { margin: 0; color: var(--ink-2); font-size: .98rem; max-width: 64ch; }
.raw-value { font-family: var(--mono); font-size: .8rem; line-height: 1.55; background: var(--navy-deep); color: #D7E0F0; padding: .8rem 1rem; border-radius: var(--radius); overflow-wrap: anywhere; white-space: pre-wrap; }
.reco { border-left: 3px solid var(--blue); padding: .1rem 0 .1rem .9rem; color: var(--ink); font-size: .98rem; max-width: 64ch; }
.reco strong { display: block; font-size: .9rem; color: var(--blue-strong); }
.meta-line { font-size: .88rem; color: var(--ink-2); }
.meta-line b { color: var(--ink); font-weight: 600; }

.raw { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.raw summary { cursor: pointer; padding: .9rem 1rem; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
.raw summary::-webkit-details-marker { display: none; }
.raw summary::after { content: "+"; font-size: 1.4rem; line-height: 1; font-weight: 400; color: var(--blue-strong); }
.raw[open] summary::after { content: "–"; }
.raw pre { margin: 0; padding: 0 1rem 1rem; font-family: var(--mono); font-size: .78rem; line-height: 1.55; overflow-x: auto; color: var(--ink-2); }

.limits { font-size: .92rem; color: var(--ink-2); max-width: 66ch; padding: 1rem 1.15rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.limits strong { color: var(--ink); }

.result-cta { background: var(--navy); color: var(--on-dark); border-radius: var(--radius-lg); padding: 1.75rem; display: grid; gap: 1.1rem; }
.result-cta h3 { color: #fff; font-size: 1.35rem; }
.result-cta p { margin: 0; color: var(--on-dark-2); max-width: 54ch; }
.result-cta .btn-row { margin-top: .25rem; }

@media (max-width: 519px) {
  .score-top { flex-direction: column; align-items: flex-start; }
  .proto-body { padding-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ring .arc { transition: none !important; }
}
.audit-note-top { margin-top: 1.5rem; }
.results-gap { height: clamp(2.5rem, 6vw, 4.5rem); }
