:root {
  --paper: #f4efe6;
  --card: #fffdf8;
  --ink: #1b1b18;
  --ink-2: #2f2e28;
  --muted: #4a493f;
  --muted-2: #5b5a52;
  --line: #d9d1c2;
  --field: #cfc6b4;
  --green: #1f4d3a;
  --green-dark: #0e2e22;
  --red: #9a2b1c;
  --serif: "Instrument Serif", Georgia, serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "DM Sans", system-ui, sans-serif; }
a { color: var(--green); }
a:hover { color: var(--green-dark); }
[hidden] { display: none !important; }
@keyframes sp { to { transform: rotate(360deg); } }

header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 24px 40px; border-bottom: 1px solid var(--line); }
.brand { font-family: var(--serif); font-size: 28px; }
.brand span { color: var(--green); }
.tagline { font-size: 14px; color: var(--muted-2); text-align: right; }

main { max-width: 1040px; margin: 0 auto; padding: 56px 24px 96px; display: flex; flex-direction: column; gap: 40px; }
.intro { max-width: 680px; }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 6vw, 68px); line-height: 1; margin: 0 0 16px; }
.intro p { font-size: 18px; line-height: 1.5; color: var(--muted); margin: 0; }

.banner { background: #fbe9e4; border: 1px solid #e7bfb4; color: var(--red); border-radius: 12px; padding: 14px 18px; font-size: 14px; line-height: 1.5; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.form { padding: 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 28px; }
.col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.col-right { gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.label { font-weight: 600; font-size: 14px; }
.hint { font-size: 13px; color: var(--muted-2); line-height: 1.45; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.4; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--green); flex: none; }
.status { font-size: 14px; color: var(--green); }
.error { font-size: 14px; color: var(--red); }

.drop { flex: 1; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; border: 2px dashed var(--green); border-radius: 12px; padding: 28px 16px; cursor: pointer; background: var(--paper); transition: background .15s; }
.drop.over, .drop:hover { background: #ebe4d6; }
.drop.loaded { border-style: solid; }
.drop strong { font-weight: 600; font-size: 16px; color: var(--green); overflow-wrap: anywhere; }
.drop span { font-size: 13px; color: var(--muted-2); }
.drop input { display: none; }

select, input[type="text"], input[type="password"] { border: 1px solid var(--field); border-radius: 10px; font: inherit; background: #fff; color: var(--ink); width: 100%; padding: 12px; }
select:focus, input:focus { outline: 2px solid var(--green); outline-offset: 1px; }

.btn { background: var(--green); color: #fff; border: 0; border-radius: 999px; padding: 16px 28px; font: inherit; font-weight: 600; font-size: 16px; cursor: pointer; }
.btn:hover { background: var(--green-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.spacer { flex: 1; }

.loading { display: flex; align-items: center; gap: 14px; font-size: 16px; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: sp .8s linear infinite; flex: none; }

.result { display: flex; flex-direction: column; gap: 32px; scroll-margin-top: 24px; }
.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 32px; align-items: center; background: var(--green); color: var(--paper); border-radius: 16px; padding: 32px; }
.hero-score { display: flex; align-items: center; gap: 24px; }
.ring { width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ring div { width: 112px; height: 112px; border-radius: 50%; background: var(--green); display: grid; place-items: center; font-family: var(--serif); font-size: 48px; }
.hero-meta { font-size: 14px; opacity: .9; }
.verdict { font-family: var(--serif); font-size: 30px; line-height: 1.1; margin-top: 6px; }
.who { font-size: 14px; opacity: .8; margin-top: 10px; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 4px; }
.bar-head small { opacity: .7; }
.track { height: 6px; background: rgba(244, 239, 230, .2); border-radius: 3px; }
.fill { height: 6px; background: var(--paper); border-radius: 3px; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 24px; }
h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; margin: 0 0 16px; }
.list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.list li { font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.list.critiques { gap: 16px; }
.issue { font-weight: 600; font-size: 15px; color: var(--ink); }
.fix { font-size: 15px; line-height: 1.5; color: var(--ink-2); margin-top: 2px; }
.card.blockers { border-color: #e7bfb4; background: #fdf3ef; }
.card.blockers h2 { color: var(--red); }

.checklist { margin: 16px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px 28px; }
.checklist li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.checklist .mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 600; color: #fff; }
.mark.ok { background: var(--green); }
.mark.warn { background: #a0711c; }
.mark.ko { background: var(--red); }
.mark.na { background: #8c8a80; }
.checklist b { display: block; color: var(--ink); }
details.model { margin-top: 20px; }
details.model summary { cursor: pointer; font-weight: 600; font-size: 15px; color: var(--green); }
details.model ol { margin: 12px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.45; color: var(--ink-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 14px; padding: 6px 12px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); }

details.detail summary { cursor: pointer; font-weight: 600; font-size: 15px; color: var(--green); }
.detail-list { margin: 16px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.detail-list li { font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.detail-list b { color: var(--ink); }

.history-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.history-head h2 { margin: 0; }
.history-head select { width: auto; max-width: 100%; padding: 8px 12px; font-size: 14px; }
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.badge { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-size: 24px; color: #fff; }
.row-name { font-weight: 600; }
.row-meta { font-size: 13px; color: var(--muted-2); margin-top: 2px; line-height: 1.4; }
.row-actions { display: flex; gap: 8px; }
.link { background: none; border: 1px solid var(--field); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; color: var(--green); cursor: pointer; }
.link:hover { background: var(--paper); }
.link.danger { color: var(--red); }
.link.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.link:disabled { opacity: .6; cursor: wait; }
.confirm { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.history-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.result-actions { display: flex; justify-content: flex-end; }
.empty { font-size: 15px; color: var(--muted-2); margin: 8px 0 0; }

.share-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: -12px; }
.share-bar .label { margin-right: 4px; }
.btn-ghost { background: var(--card); color: var(--green); border: 1.5px solid var(--green); border-radius: 999px; padding: 10px 18px; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; }
.btn-ghost:hover { background: var(--green); color: #fff; }
.btn-ghost:disabled { opacity: .6; cursor: wait; }

/* Exports : rendus hors écran puis dessinés en image */
.offscreen { position: fixed; left: -10000px; top: 0; }

.share-card { width: 540px; padding: 36px 36px 30px; background: var(--green); color: var(--paper); font-family: "DM Sans", system-ui, sans-serif; display: flex; flex-direction: column; gap: 22px; }
.share-card .brand span { color: #9cc7b1; }
.sc-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: rgba(244, 239, 230, .8); }
.sc-score { display: flex; align-items: center; gap: 22px; }
.share-card .verdict { font-size: 28px; }
.sc-who { font-size: 14px; color: rgba(244, 239, 230, .85); line-height: 1.4; margin-top: -6px; }
.sc-h { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(244, 239, 230, .75); }
.sc-prio { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.4; }
.sc-foot { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: rgba(244, 239, 230, .75); border-top: 1px solid rgba(244, 239, 230, .2); padding-top: 14px; }

.report { width: 794px; padding: 36px 40px; background: var(--paper); color: var(--ink); font-family: "DM Sans", system-ui, sans-serif; display: flex; flex-direction: column; gap: 22px; }
.report .result { gap: 20px; }
.report .grid2 { grid-template-columns: 1fr; gap: 20px; }
.report-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.report-id { display: grid; grid-template-columns: 150px 1fr; gap: 6px 16px; margin: 0; font-size: 15px; }
.report-id dt { color: var(--muted-2); }
.report-id dd { margin: 0; font-weight: 600; }
.report-foot { font-size: 12px; color: var(--muted-2); margin: 0; line-height: 1.5; }

footer { max-width: 1040px; margin: 0 auto; padding: 0 24px 48px; font-size: 13px; color: var(--muted-2); line-height: 1.5; }

@media (max-width: 640px) {
  header { padding: 20px 16px; }
  .tagline { display: none; }
  main { padding: 40px 16px 72px; }
  .form, .hero { padding: 20px; }
  .hero-score { gap: 16px; }
  .ring { width: 112px; height: 112px; }
  .ring div { width: 88px; height: 88px; font-size: 38px; }
  .verdict { font-size: 24px; }
  .row { grid-template-columns: 48px 1fr; }
  .badge { width: 48px; height: 48px; font-size: 20px; }
  .row-actions { grid-column: 2; }
  footer { padding: 0 16px 40px; }
}
