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

:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-light: #eff6ff;
  --blue-border: #bfdbfe;
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fef2f2;
  --red-border: #fca5a5;
  --yellow-light: #fefce8;
  --yellow-border: #fde68a;
  --yellow-text: #78350f;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-700: #374151;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 0.75rem;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.05);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: #eef2f7;
  color: var(--gray-800);
  min-height: 100vh;
  padding: 2rem 1rem 4rem;
  line-height: 1.6;
}

.container {
  max-width: 680px;
  margin: 0 auto;
}

/* ── Header ── */
header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  background: var(--blue);
  border-radius: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-md);
}

.logo-icon {
  width: 1.75rem;
  height: 1.75rem;
  color: white;
}

header h1 {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

header p {
  color: var(--gray-500);
  font-size: 1rem;
}

/* ── Step indicators ── */
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.75rem;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.step-number {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  transition: background 0.3s, color 0.3s;
}

.step.active .step-number {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 0 0 4px var(--blue-light);
}

.step.done .step-number {
  background: var(--green);
  color: #fff;
}

.step-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-400);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.step.active .step-label { color: var(--blue); }
.step.done  .step-label { color: var(--green); }

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--gray-200);
  margin: 0 0.75rem;
  margin-bottom: 1.1rem;
  max-width: 6rem;
}

/* ── Card ── */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.card.hidden { display: none; }

.card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.card > p {
  color: var(--gray-500);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* ── Form ── */
.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--gray-700);
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 0.5rem;
  font-size: 1rem;
  color: var(--gray-900);
  background: var(--gray-50);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.field-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-top: 0.3rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--blue);
  color: #fff;
  width: 100%;
  padding: 0.875rem;
  margin-top: 0.5rem;
}

.btn-primary:hover:not(:disabled) { background: var(--blue-dark); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-icon { width: 1.1rem; height: 1.1rem; }

.btn-download {
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  color: var(--blue);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-download:hover { background: var(--blue-light); border-color: var(--blue-border); }

/* ── Info box ── */
.info-box {
  background: var(--blue-light);
  border: 1px solid var(--blue-border);
  border-radius: 0.5rem;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: #1e40af;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.info-box code {
  background: rgba(255,255,255,.6);
  padding: 0.1rem 0.3rem;
  border-radius: 0.2rem;
  font-size: 0.85em;
}

/* ── DNS records ── */
.dns-record {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--gray-50);
  margin-bottom: 1rem;
}

.dns-record-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.dns-badge {
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
}

.dns-for {
  font-size: 0.82rem;
  color: var(--gray-500);
}

.dns-field { margin-bottom: 0.85rem; }
.dns-field:last-child { margin-bottom: 0; }

.dns-field-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
  margin-bottom: 0.35rem;
  display: block;
}

.dns-value-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dns-value-row code {
  flex: 1;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--gray-200);
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.82rem;
  color: var(--gray-900);
  word-break: break-all;
  line-height: 1.5;
}

.type-badge {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 0.25rem;
  flex-shrink: 0;
}

.copy-btn {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 0.375rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.copy-btn:hover { background: var(--gray-200); }
.copy-btn.copied { background: var(--green-light); border-color: #86efac; color: var(--green); }

/* ── Timer ── */
.timer-card {
  background: var(--blue-light);
  border: 1.5px solid var(--blue-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.25rem 0;
}

.timer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.timer-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e40af;
}

.timer-value {
  font-size: 1.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--blue-dark);
  font-family: 'SFMono-Regular', Consolas, monospace;
  letter-spacing: -0.02em;
}

.timer-track {
  height: 8px;
  background: var(--blue-border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}

.timer-fill {
  height: 100%;
  width: 100%;
  background: var(--blue);
  border-radius: 4px;
  transition: width 1s linear, background-color 0.5s;
}

.timer-fill.urgent { background: var(--red); }

.timer-note {
  font-size: 0.78rem;
  color: #3b82f6;
  text-align: center;
}

/* ── Bouton secondaire ── */
.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1.5px solid var(--gray-300);
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
}
.btn-secondary:hover:not(:disabled) { background: var(--gray-200); }
.btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ready { background: #15803d !important; }
.btn-ready:hover:not(:disabled) { background: #166534 !important; }

/* ── Action row ── */
.action-row {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── DNS check result ── */
.dns-check-box {
  margin-top: 1rem;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  border: 1.5px solid;
}
.dns-check-ok {
  background: var(--green-light);
  border-color: #86efac;
  color: #14532d;
}
.dns-check-partial {
  background: var(--yellow-light);
  border-color: var(--yellow-border);
  color: var(--yellow-text);
}
.dns-check-header {
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}
.dns-check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-top: 1px solid rgba(0,0,0,.07);
  font-size: 0.85rem;
}
.dns-check-icon {
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.dns-check-label { flex: 1; line-height: 1.4; }
.dns-check-label code { font-size: 0.75rem; opacity: 0.8; }
.dns-check-status { font-weight: 600; font-size: 0.8rem; white-space: nowrap; margin-top: 0.15rem; }
.status-ok { color: var(--green); }
.status-missing { color: var(--red); }

/* ── Loading overlay ── */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  border-radius: var(--radius);
  z-index: 10;
}

.loading-overlay.hidden { display: none; }

.loading-overlay p {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 1rem;
  margin: 0;
}

.loading-sub { font-size: 0.85rem !important; color: var(--gray-400) !important; font-weight: 400 !important; }

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--blue-border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Success ── */
.success-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.success-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  background: var(--green-light);
  border-radius: 50%;
  margin-bottom: 1rem;
}

.success-badge svg {
  width: 1.75rem;
  height: 1.75rem;
  stroke: var(--green);
  stroke-width: 3;
}

.success-header h2 { margin-bottom: 0.25rem; }
.success-header p { color: var(--gray-500); font-size: 0.9rem; }

/* ── Cert files list ── */
#cert-files-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.cert-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 0.65rem;
  background: var(--gray-50);
}

.cert-file-info { min-width: 0; }

.cert-file-name {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.cert-file-desc {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-bottom: 0.25rem;
}

.cert-file-code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.78rem;
  background: var(--blue-light);
  color: var(--blue-dark);
  padding: 0.15rem 0.45rem;
  border-radius: 0.25rem;
}

/* ── Warning box ── */
.warning-box {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--yellow-light);
  border: 1px solid var(--yellow-border);
  border-radius: 0.5rem;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: var(--yellow-text);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.warning-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
  fill: #d97706;
}

/* ── Guide ── */
.guide {
  border-top: 1px solid var(--gray-100);
  padding-top: 1.25rem;
}

.guide h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 0.75rem;
}

.guide ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.guide li {
  font-size: 0.875rem;
  color: var(--gray-500);
  padding-left: 1.1rem;
  position: relative;
}

.guide li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--gray-300);
  font-weight: 700;
}

.guide li code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.8em;
  background: var(--gray-100);
  padding: 0.1rem 0.3rem;
  border-radius: 0.2rem;
}

.guide-note {
  font-size: 0.82rem;
  color: var(--gray-400);
}

/* ── Error box ── */
.error-box {
  background: var(--red-light);
  border: 1px solid var(--red-border);
  border-radius: 0.5rem;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: #991b1b;
  margin-top: 1rem;
  line-height: 1.5;
}

.error-box.hidden { display: none; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .card { padding: 1.25rem; }
  header h1 { font-size: 1.5rem; }
  .timer-value { font-size: 1.35rem; }
  .dns-value-row { flex-direction: column; align-items: stretch; }
  .copy-btn { text-align: center; }
  .cert-file-row { flex-direction: column; align-items: flex-start; }
  .btn-download { width: 100%; }
}
