:root {
  --green: #2d6a35;
  --green-light: #eaf2ea;
  --green-dark: #1f4d26;
  --amber: #b8862f;
  --red: #a83c34;
  --ink: #1c211d;
  --paper: #faf9f6;
  --paper-2: #f1efe9;
  --line: #ddd8cd;
  --font-display: "Fraunces", serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px;
  background: var(--green);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.brand-sub { font-size: 12px; color: #6b6a63; }

/* ---------- Gate ---------- */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.05);
}
.gate-lead { margin: 20px 0 14px; color: #55534c; font-size: 14px; }
#gate-form { display: flex; flex-direction: column; gap: 10px; }

input[type="password"], input[type="url"] {
  font-family: var(--font-body);
  font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}
input[type="password"]:focus, input[type="url"]:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

button {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  padding: 12px 18px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}
button:hover { background: var(--green-dark); }
button:disabled { opacity: 0.6; cursor: default; }

.error-msg { color: var(--red); font-size: 13px; margin-top: 10px; }

/* ---------- Topbar / shell ---------- */
.topbar {
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.shell { max-width: 1080px; margin: 0 auto; padding: 40px 24px 80px; }

.intro h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 34px;
  margin: 0 0 8px;
}
.intro p { color: #55534c; margin: 0 0 24px; font-size: 15px; }

.url-form { display: flex; gap: 10px; }
.url-form input { flex: 1; }

.loading {
  display: flex; align-items: center; gap: 12px;
  margin-top: 20px; color: #55534c; font-size: 14px;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Report ---------- */
.report { margin-top: 48px; }

.scores-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  grid-template-rows: auto auto auto auto;
  gap: 10px 28px;
  align-items: center;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 16px;
}
.score-gauge--main { grid-row: 1 / span 4; position: relative; width: 130px; height: 130px; }
.score-gauge--main svg { width: 130px; height: 130px; transform: rotate(-90deg); }
.score-gauge--main circle { fill: none; stroke-width: 10; }
.score-gauge--main .track { stroke: var(--paper-2); }
.score-gauge--main .fill { stroke: var(--green); stroke-linecap: round; stroke-dasharray: 327; stroke-dashoffset: 327; transition: stroke-dashoffset 0.8s ease; }
.score-value {
  position: absolute; top: 0; left: 0; width: 130px; height: 110px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 32px; font-weight: 600;
}
.score-label { position: absolute; bottom: 0; left: 0; width: 130px; text-align: center; font-size: 11px; color: #6b6a63; }

.score-mini { display: flex; flex-direction: column; gap: 6px; }
.score-mini-bar { height: 8px; background: var(--paper-2); border-radius: 4px; overflow: hidden; }
.score-mini-fill { height: 100%; width: 0%; background: var(--green); transition: width 0.8s ease; }
.score-mini-label { font-size: 12.5px; color: #55534c; }

.report-meta {
  display: flex; justify-content: space-between;
  font-size: 12.5px; color: #6b6a63; margin-bottom: 12px; padding: 0 4px;
}

.export-row { display: flex; gap: 10px; margin-bottom: 24px; padding: 0 4px; flex-wrap: wrap; }
.btn-secondary {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  padding: 9px 14px;
  background: #fff;
  color: var(--green-dark);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--green-light); border-color: var(--green); }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 16px;
}
.panel h2 {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600;
  margin: 0 0 16px;
}
.panel h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em;
  color: #6b6a63; margin: 20px 0 10px;
}

.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .panel-grid { grid-template-columns: 1fr; } .scores-row { grid-template-columns: 1fr; } .score-gauge--main { grid-row: auto; margin: 0 auto; } }

/* ---------- Recommendations ---------- */
.reco-list { display: flex; flex-direction: column; gap: 10px; }
.reco-item {
  display: grid; grid-template-columns: 90px 1fr; gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  font-size: 14px;
}
.reco-item.haute { border-left-color: var(--red); }
.reco-item.moyenne { border-left-color: var(--amber); }
.reco-item.basse { border-left-color: var(--green); }
.reco-priority { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; align-self: start; padding-top: 2px; }
.reco-item.haute .reco-priority { color: var(--red); }
.reco-item.moyenne .reco-priority { color: var(--amber); }
.reco-item.basse .reco-priority { color: var(--green-dark); }
.reco-pilier { font-size: 11px; color: #6b6a63; font-family: var(--font-mono); margin-bottom: 4px; display: inline-block; }
.reco-probleme { font-weight: 600; margin-bottom: 2px; }
.reco-action { color: #55534c; }

/* ---------- Tables / lists ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-bottom: 14px; }
.data-table th, .data-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.data-table th { color: #6b6a63; font-weight: 600; font-size: 12px; text-transform: uppercase; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 3px 8px; border-radius: 20px; }
.tag.ok { background: var(--green-light); color: var(--green-dark); }
.tag.bad { background: #f6e6e4; color: var(--red); }

.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.check-list li { display: flex; align-items: center; gap: 8px; }
.check-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.check-dot.ok { background: var(--green); }
.check-dot.bad { background: var(--red); }

.meta-dl { margin: 0; font-size: 13.5px; }
.meta-dl dt { color: #6b6a63; font-size: 12px; text-transform: uppercase; margin-top: 12px; }
.meta-dl dt:first-child { margin-top: 0; }
.meta-dl dd { margin: 3px 0 0; font-family: var(--font-mono); font-size: 13px; word-break: break-word; }

.heading-tree { font-family: var(--font-mono); font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.heading-row { color: #55534c; }

#rendering-block img { width: 100%; border-radius: 8px; border: 1px solid var(--line); margin-top: 10px; }
