/* Portail DMARC - feuille de style (aucune ressource externe) */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --text: #1c2330; --muted: #5d6778; --line: #e3e7ee;
  --brand: #1f4e8c; --brand-ink: #ffffff; --brand-soft: #e8f0fb;
  --ok: #1b7f4c; --ok-soft: #e5f5ec; --warning: #a85b00; --warning-soft: #fff3e0;
  --critical: #c0262d; --critical-soft: #fdeaea; --info: #1d5fae; --info-soft: #e7f0fb;
  --neutral: #5d6778; --neutral-soft: #eef0f4;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 .25rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: var(--mono); font-size: .88em; }
small, .muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

/* ---- Mise en page ---- */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: #142742; color: #d7e1f0; padding: 1.25rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { color: #fff; font-weight: 700; font-size: 1.05rem; display: flex; gap: .6rem; align-items: center; margin-bottom: 1.5rem; }
.sidebar .brand .logo { width: 34px; height: 34px; border-radius: 8px; background: #2f6fc0; display: grid; place-items: center; font-size: .85rem; }
.sidebar .brand small { display: block; color: #9fb3cf; font-weight: 400; font-size: .78rem; }
.sidebar nav a { display: flex; align-items: center; justify-content: space-between; color: #d7e1f0; padding: .5rem .65rem; border-radius: 7px; margin-bottom: 2px; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.sidebar nav a.active { background: #2f6fc0; color: #fff; }
.sidebar .section { text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; color: #8aa0bf; margin: 1.25rem .65rem .4rem; }
.sidebar .count { background: var(--critical); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; font-weight: 700; }
.sidebar .domains a { font-size: .9rem; padding: .3rem .65rem; }
.sidebar .user { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .85rem; color: #9fb3cf; }
.sidebar .user button { margin-top: .5rem; }
.main { padding: 1.75rem 2rem 3rem; max-width: 1280px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head .sub { color: var(--muted); }

/* ---- Cartes ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.15rem 1.25rem; margin-bottom: 1.15rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: .82rem; }
.kpi .value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.kpi .hint { color: var(--muted); font-size: .8rem; }

/* ---- Domaines (tableau de bord) ---- */
.client-group { margin-bottom: 1.5rem; }
.client-group h2 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.domain-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.domain-card { display: block; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--neutral); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); color: var(--text); }
.domain-card:hover { text-decoration: none; border-color: #c5cfdd; transform: translateY(-1px); }
.domain-card.s-ok { border-left-color: var(--ok); }
.domain-card.s-warning { border-left-color: var(--warning); }
.domain-card.s-critical { border-left-color: var(--critical); }
.domain-card.s-info { border-left-color: var(--info); }
.domain-card .top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.domain-card .name { font-weight: 700; font-size: 1.05rem; word-break: break-all; }
.domain-card .stats { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem .75rem; margin-top: .75rem; font-size: .88rem; }
.domain-card .stats span { color: var(--muted); display: block; font-size: .76rem; }
.domain-card .issue { margin-top: .6rem; font-size: .84rem; color: var(--critical); }

/* ---- Badges et états ---- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.critical, .badge.danger { background: var(--critical-soft); color: var(--critical); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral, .badge.unknown { background: var(--neutral-soft); color: var(--neutral); }
.status-dot { width: .7rem; height: .7rem; border-radius: 50%; display: inline-block; background: var(--neutral); }
.status-dot.ok { background: var(--ok); } .status-dot.warning { background: var(--warning); }
.status-dot.critical { background: var(--critical); } .status-dot.info { background: var(--info); }

.callout { border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: 1rem; border: 1px solid transparent; }
.callout.ok { background: var(--ok-soft); border-color: #bfe3cf; }
.callout.warning { background: var(--warning-soft); border-color: #f5d2a3; }
.callout.critical { background: var(--critical-soft); border-color: #f3c0c2; }
.callout.info { background: var(--info-soft); border-color: #c5d9f3; }
.callout.unknown { background: var(--neutral-soft); border-color: var(--line); }
.callout .title { font-weight: 700; margin-bottom: .25rem; }

.headline { font-size: 1.08rem; }
.facts { margin: .5rem 0 0; padding-left: 1.2rem; }
.facts li { margin-bottom: .3rem; }

.reco { display: flex; gap: .75rem; padding: .8rem 0; border-top: 1px solid var(--line); }
.reco:first-of-type { border-top: 0; padding-top: 0; }
.reco .icon { flex: 0 0 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.reco.critical .icon { background: var(--critical-soft); color: var(--critical); }
.reco.warning .icon { background: var(--warning-soft); color: var(--warning); }
.reco.info .icon { background: var(--info-soft); color: var(--info); }
.reco .t { font-weight: 650; }

/* ---- Score ---- */
.score { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; border: 7px solid var(--neutral-soft); flex: 0 0 auto; }
.score.ok { border-color: var(--ok); color: var(--ok); }
.score.warning { border-color: var(--warning); color: var(--warning); }
.score.critical { border-color: var(--critical); color: var(--critical); }
.score small { display: block; font-size: .65rem; color: var(--muted); font-weight: 500; text-align: center; margin-top: -.4rem; }

/* ---- Onglets ---- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a { padding: .6rem .9rem; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.period { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.period a { padding: .35rem .75rem; color: var(--muted); font-size: .86rem; border-right: 1px solid var(--line); }
.period a:last-child { border-right: 0; }
.period a.active { background: var(--brand); color: #fff; }
.period a:hover { text-decoration: none; }

/* ---- Tableaux ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .6rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; background: #fafbfc; }
tr:hover td { background: #fafcff; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--neutral-soft); border-radius: 999px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--ok); }
.bar.warning > span { background: var(--warning); } .bar.critical > span { background: var(--critical); }
.split-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--neutral-soft); }
.split-bar span { display: block; height: 100%; }
.split-bar .ok { background: var(--ok); } .split-bar .fix, .split-bar .check { background: var(--warning); }
.split-bar .suspect { background: var(--critical); } .split-bar .forward { background: #9aa6b8; }

/* ---- Filtres ---- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.chip { padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: .86rem; }
.chip.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.chip:hover { text-decoration: none; border-color: #b8c4d6; }

/* ---- DNS ---- */
.record { font-family: var(--mono); font-size: .85rem; background: #f3f5f8; border: 1px solid var(--line); border-radius: 7px; padding: .55rem .7rem; word-break: break-all; display: block; margin: .35rem 0; }
.check-row { display: grid; grid-template-columns: 170px 1fr; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.check-row:first-child { border-top: 0; }
.check-row .k { font-weight: 650; }
.copy { font-size: .78rem; margin-left: .5rem; }

/* ---- Assistant ---- */
.stepper { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .75rem 0 1rem; }
.stepper .step { border: 1px solid var(--line); border-radius: 9px; padding: .65rem .75rem; background: #fafbfc; font-size: .86rem; }
.stepper .step .n { font-weight: 700; }
.stepper .step.done { background: var(--ok-soft); border-color: #bfe3cf; }
.stepper .step.current { background: var(--info-soft); border-color: var(--info); box-shadow: 0 0 0 1px var(--info) inset; }

/* ---- Formulaires ---- */
form .field { margin-bottom: 1rem; }
label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .92rem; }
.field .help { color: var(--muted); font-size: .82rem; margin-top: .25rem; }
.field .errorlist, .errorlist { color: var(--critical); list-style: none; padding: 0; margin: .3rem 0 0; font-size: .86rem; }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  width: 100%; max-width: 520px; padding: .55rem .7rem; border: 1px solid #c9d2df; border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #9cc2f5; outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: 1.05rem; height: 1.05rem; margin: 0 .45rem 0 0; vertical-align: -2px; }
.field ul.choices, .field div > div > label, .field ul { list-style: none; padding: 0; margin: 0; }
.field ul li label, .field div > div > label { font-weight: 400; }
.inline-check label { display: inline; font-weight: 500; }
.btn, button { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; background: var(--brand); color: #fff; }
.btn:hover, button:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary, button.secondary { background: #fff; color: var(--text); border-color: #c9d2df; }
.btn.danger, button.danger { background: var(--critical); }
.btn.small, button.small { padding: .3rem .65rem; font-size: .84rem; }
.btn.link, button.link { background: none; color: inherit; padding: 0; border: 0; font-weight: 500; text-decoration: underline; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .4rem; }

/* ---- Messages ---- */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .7rem 1rem; border-radius: 8px; margin-bottom: .5rem; background: var(--info-soft); border: 1px solid #c5d9f3; }
.messages li.success { background: var(--ok-soft); border-color: #bfe3cf; }
.messages li.error { background: var(--critical-soft); border-color: #f3c0c2; }
.messages li.warning { background: var(--warning-soft); border-color: #f5d2a3; }

/* ---- Pages de connexion ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(160deg, #142742 0%, #1f4e8c 100%); }
.auth .card { width: 100%; max-width: 440px; padding: 2rem; }
.auth .brand { text-align: center; margin-bottom: 1.5rem; }
.auth .brand .logo { width: 52px; height: 52px; border-radius: 12px; background: #2f6fc0; color: #fff; display: grid; place-items: center; margin: 0 auto .6rem; font-weight: 800; }
.auth input { max-width: none; }
.auth button { width: 100%; justify-content: center; padding: .7rem; }
.qr { width: 220px; height: 220px; margin: .5rem auto 1rem; background: #fff; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.qr svg { width: 100%; height: 100%; }
.secret { font-family: var(--mono); background: #f3f5f8; border-radius: 6px; padding: .4rem .6rem; text-align: center; letter-spacing: .08em; word-break: break-all; }
.once { font-family: var(--mono); font-size: 1.3rem; background: #fffbe6; border: 2px dashed #e0b400; border-radius: 8px; padding: .8rem; text-align: center; letter-spacing: .05em; user-select: all; }

.chart-box { position: relative; height: 260px; }
.legend-inline { display: flex; gap: 1rem; font-size: .84rem; color: var(--muted); margin-top: .5rem; flex-wrap: wrap; }
.legend-inline i { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: .5rem; }
.glossary dt { font-weight: 700; margin-top: 1rem; }
.glossary dd { margin: .25rem 0 0 0; }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar .domains { display: none; }
  .main { padding: 1.25rem 1rem 2rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .check-row { grid-template-columns: 1fr; gap: .3rem; }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4, .stepper { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .tabs, .period, .actions, form { display: none !important; }
  .layout { display: block; } .main { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---- Utilitaires (pas d'attribut style= : CSP stricte) ---- */
.mt-1 { margin-top: 1rem; } .mt-s { margin-top: .6rem; } .mb-0 { margin-bottom: 0; }
.note { font-size: .86rem; }
.narrow { max-width: 680px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.flex { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.flex.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
meter { width: 100%; min-width: 90px; height: 10px; }
svg.splitbar { width: 100%; height: 12px; display: block; border-radius: 999px; }
svg.splitbar .ok { fill: var(--ok); } svg.splitbar .fix, svg.splitbar .check { fill: var(--warning); }
svg.splitbar .suspect { fill: var(--critical); } svg.splitbar .forward { fill: #9aa6b8; } svg.splitbar .bg { fill: var(--neutral-soft); }
.legend-inline i.lg-ok { background: var(--ok); } .legend-inline i.lg-fix { background: var(--warning); }
.legend-inline i.lg-suspect { background: var(--critical); } .legend-inline i.lg-forward { background: #9aa6b8; }
.kpi .value.small { font-size: 1.1rem; padding-top: .3rem; }
.domain-card .issue.muted { color: var(--muted); }
