:root {
  color-scheme: light;
  --bg: #eef3f0;
  --panel: #ffffff;
  --ink: #172221;
  --muted: #62706d;
  --brand: #174c4f;
  --brand-strong: #0f383a;
  --accent: #d57f36;
  --danger: #a83232;
  --line: #d7e0dc;
  --shadow: 0 18px 45px rgba(23, 34, 33, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

button {
  font: inherit;
}

.app-shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.scan-panel,
.result-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.result-panel {
  margin-top: 18px;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.25rem;
}

.privacy-badge {
  flex: 0 0 auto;
  border: 1px solid #a9cac4;
  border-radius: 999px;
  color: var(--brand);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 10px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.button {
  min-height: 44px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: #ffffff;
  color: var(--brand);
  cursor: pointer;
  font-weight: 700;
  padding: 10px 16px;
}

.button:focus-visible,
.icon-button:focus-visible {
  outline: 3px solid rgba(213, 127, 54, 0.35);
  outline-offset: 2px;
}

.button.primary {
  background: var(--brand);
  color: #ffffff;
}

.button:hover {
  border-color: var(--brand-strong);
}

.button.primary:hover {
  background: var(--brand-strong);
}

.status {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
  font-weight: 700;
}

.camera-zone {
  display: grid;
  place-items: center;
  min-height: 280px;
  margin-top: 18px;
  overflow: hidden;
  border: 2px dashed #aac0ba;
  border-radius: 8px;
  background: #f8fbfa;
}

.camera-zone:empty::before {
  content: "La caméra apparaîtra ici";
  color: var(--muted);
}

.camera-zone video {
  width: 100%;
  height: auto;
}

.result-data {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.result-data div {
  display: grid;
  gap: 6px;
}

.result-data div:first-child {
  grid-column: 1 / -1;
}

.result-data dt {
  color: var(--muted);
  font-weight: 700;
}

.result-data dd {
  min-height: 46px;
  margin: 0;
  min-height: 46px;
  border: 1px solid #b8c7c3;
  border-radius: 6px;
  color: var(--ink);
  padding: 10px 12px;
  word-break: break-word;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 18, 17, 0.62);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
  padding: 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.print-sheet {
  display: none;
}

[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 960px);
    padding: 10px 0 24px;
  }

  .scan-panel,
  .result-panel {
    padding: 18px;
  }

  .header-row {
    display: grid;
  }

  h1 {
    font-size: 1.65rem;
  }

  .privacy-badge {
    justify-self: start;
  }

  .actions {
    display: grid;
  }

  .button {
    width: 100%;
  }

  .camera-zone {
    min-height: 240px;
  }

  .result-data {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: 75mm 210mm;
    margin: 0;
  }

  html,
  body {
    background: #ffffff;
  }

  body {
    color: #000000;
    font-size: 12pt;
  }

  .no-print,
  .privacy-badge,
  .kicker,
  .scan-panel,
  .result-panel {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .print-sheet {
    display: block;
    position: relative;
    page-break-after: avoid;
    break-after: avoid;
    color: #000000;
    font-family: Arial, Helvetica, sans-serif;
  }

  .print-sheet.stand300 {
    width: 75mm;
    height: 210mm;
  }

  .print-sheet.stand25 {
    width: 148mm;
    height: 210mm;
  }

  .print-field {
    position: absolute;
    white-space: nowrap;
    color: #000000;
    font-size: 10pt;
    line-height: 1;
  }

  .stand300 .print-avs {
    left: 26mm;
    top: 20mm;
  }

  .stand300 .print-birth-date {
    left: 50mm;
    top: 28mm;
    font-size: 8pt;
  }

  .stand300 .print-last-name {
    left: 26mm;
    top: 28mm;
  }

  .stand300 .print-first-name {
    left: 26mm;
    top: 36mm;
  }

  .stand300 .print-grade {
    left: 26mm;
    top: 44mm;
  }

  .stand25 .print-avs {
    left: 47mm;
    top: 16mm;
  }

  .stand25 .print-birth-date {
    left: 126mm;
    top: 16mm;
  }

  .stand25 .print-last-name {
    left: 47mm;
    top: 24mm;
  }

  .stand25 .print-first-name {
    left: 86mm;
    top: 24mm;
  }

  .stand25 .print-grade {
    left: 86mm;
    top: 32mm;
  }
}
