:root {
  --orange: #e8580a;
  --orange-2: #ff7a2d;
  --ink: #1f2328;
  --muted: #68707d;
  --line: #e7e1dc;
  --paper: #fffaf6;
  --surface: #ffffff;
  --green: #197642;
  --red: #b42318;
  --amber: #a15c00;
  --shadow: 0 24px 70px rgba(31, 35, 40, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(232, 88, 10, .16), transparent 34rem),
    linear-gradient(180deg, #fff7f1 0%, #f5f6f8 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 18px 14px 40px;
}

.message-stack {
  display: grid;
  gap: 8px;
  width: min(100%, 720px);
  margin: 0 auto 12px;
}

.message {
  padding: 12px 14px;
  border: 1px solid rgba(25, 118, 66, .22);
  border-radius: 14px;
  color: var(--green);
  background: #effaf3;
  font-weight: 750;
}

.message.error {
  border-color: rgba(180, 35, 24, .24);
  color: var(--red);
  background: #fff0ef;
}

.app-card {
  overflow: hidden;
  width: min(100%, 720px);
  margin: 0 auto;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), #c44805);
}

.topbar.success {
  background: linear-gradient(135deg, var(--green), #0d4f2b);
}

.eyebrow {
  margin: 0 0 5px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .78;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(24px, 5vw, 34px);
  line-height: 1.05;
}

.topbar-note {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, .78);
  font-size: 13px;
  font-weight: 700;
}

h2 {
  font-size: 20px;
}

.ghost-link {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 10px 13px;
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, .13);
}

.top-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.notice {
  margin: 16px 18px 0;
  padding: 12px 14px;
  border: 1px solid #f5c6a4;
  border-radius: 14px;
  color: #7a2d00;
  background: #fff2e9;
}

.error-summary,
.form-feedback {
  display: grid;
  gap: 5px;
  line-height: 1.45;
}

.form-feedback {
  position: sticky;
  top: 10px;
  z-index: 20;
  margin: 16px 18px 0;
  padding: 13px 14px;
  border: 1px solid rgba(180, 35, 24, .28);
  border-radius: 14px;
  color: #7a1b14;
  background: #fff0ef;
  box-shadow: 0 14px 32px rgba(180, 35, 24, .08);
}

.form-feedback[hidden] {
  display: none;
}

.errorlist {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 750;
  list-style: none;
}

.field.is-invalid,
.signature-pad.is-invalid,
label:has(.errorlist:not(:empty)) .field {
  border-color: rgba(180, 35, 24, .75);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, .1);
}

.signature-pad.is-invalid {
  background: #fff7f6;
}

.progress-panel {
  padding: 16px 18px 0;
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #ece5df;
}

.progress-track span {
  display: block;
  width: 25%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--orange-2));
  transition: width .28s ease;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.step-tab {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: color .2s ease, background .2s ease;
}

.step-tab.is-active {
  color: var(--orange);
  background: #fff0e7;
  font-weight: 800;
}

.screen {
  display: none;
  padding: 22px;
  animation: rise .22s ease;
}

.screen.is-active {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.step-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 30px;
  border-radius: 999px;
  color: var(--orange);
  background: #fff0e7;
  font-weight: 800;
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.field,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
  background: #fff;
  outline: 0;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

textarea.field {
  min-height: 94px;
  resize: vertical;
}

.field:focus,
select:focus,
textarea:focus {
  border-color: rgba(232, 88, 10, .75);
  box-shadow: 0 0 0 4px rgba(232, 88, 10, .12);
}

.solution-select {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.choice-card {
  min-height: 94px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  text-align: left;
  color: var(--ink);
  background: linear-gradient(180deg, #fff, #fffaf7);
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.choice-card:hover,
.choice-card.is-selected {
  border-color: rgba(232, 88, 10, .82);
  box-shadow: 0 12px 28px rgba(232, 88, 10, .13);
  transform: translateY(-1px);
}

.choice-card span {
  display: block;
  font-weight: 850;
}

.choice-card small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.hidden-native {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.soft-copy {
  margin: -4px 0 16px;
  color: var(--muted);
  line-height: 1.55;
}

.checklist {
  display: grid;
  gap: 9px;
  margin-bottom: 20px;
}

.check-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.check-item:hover {
  transform: translateY(-1px);
}

.check-item.ok {
  border-color: rgba(25, 118, 66, .38);
  background: #effaf3;
}

.check-item.probleme {
  border-color: rgba(180, 35, 24, .34);
  background: #fff0ef;
}

.check-item strong {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: #f2f2f3;
  font-size: 12px;
}

.check-item.ok strong {
  color: var(--green);
  background: #dff5e8;
}

.check-item.probleme strong {
  color: var(--red);
  background: #ffe0de;
}

.rating-block {
  margin: 12px 0 18px;
}

.rating-row {
  display: flex;
  gap: 9px;
  margin-top: 9px;
}

.rating-row button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}

.rating-row button.is-selected {
  color: #fff;
  background: var(--orange);
  border-color: var(--orange);
  transform: translateY(-1px);
}

.declaration {
  margin-bottom: 18px;
  padding: 15px;
  border: 1px solid #f0d6bc;
  border-radius: 18px;
  color: #71400c;
  background: #fff8ec;
  line-height: 1.55;
}

.signature-grid {
  display: grid;
  gap: 18px;
}

.signature-pad {
  position: relative;
  overflow: hidden;
  height: 160px;
  border: 1px dashed #c9c2bc;
  border-radius: 18px;
  background: #fff;
}

.signature-pad canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.signature-pad span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #a7a19c;
  pointer-events: none;
}

.signature-pad.has-ink span {
  display: none;
}

.mini-button {
  min-height: 38px;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
}

.actionbar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(231, 225, 220, .75);
  background: rgba(255, 255, 255, .84);
  backdrop-filter: blur(18px);
}

.primary-action,
.secondary-action {
  min-height: 50px;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 850;
}

.primary-action {
  flex: 2;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), #c44805);
  box-shadow: 0 12px 24px rgba(232, 88, 10, .22);
}

.secondary-action {
  flex: 1;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
}

.is-hidden {
  display: none;
}

.recap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 22px;
}

.recap-grid div,
.detail-section {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.recap-grid div {
  padding: 14px;
}

.recap-grid span,
.list-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.recap-grid strong {
  display: block;
  margin-top: 5px;
}

.detail-section {
  margin: 0 22px 18px;
  padding: 16px;
}

.detail-section h2 {
  margin-bottom: 12px;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0ece8;
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-row.ok strong {
  color: var(--green);
}

.detail-row.probleme strong {
  color: var(--red);
}

.signature-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.signature-preview img {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  object-fit: contain;
}

.list-stack {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.list-item em {
  color: var(--muted);
  font-style: normal;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  gap: 10px;
  padding: 26px;
  text-align: center;
  color: var(--muted);
}

.empty-state a {
  color: var(--orange);
  font-weight: 850;
}

.auth-card {
  margin-top: 42px;
}

.auth-form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
  background: #fff;
  outline: 0;
}

@media (max-width: 640px) {
  .shell {
    padding: 0;
  }

  .app-card {
    min-height: 100vh;
    border-radius: 0;
  }

  .topbar,
  .screen,
  .recap-grid {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-links {
    justify-content: flex-start;
  }

  .grid,
  .solution-select,
  .recap-grid,
  .signature-preview {
    grid-template-columns: 1fr;
  }

  .steps {
    gap: 4px;
  }

  .step-tab {
    min-height: 34px;
    font-size: 12px;
  }

  .choice-card {
    min-height: 78px;
  }
}
