:root {
  color-scheme: light;
  --ink: #2b2b2b;
  --muted: #666666;
  --paper: #969596;
  --card: #f7f7f7;
  --line: #c8c8c8;
  --pine: #2b2b2b;
  --pine-dark: #1f1f1f;
  --pine-pale: #f7f7f7;
  --amber: #d4b559;
  --amber-pale: #d4b559;
  --danger: #b84c3d;
  --danger-pale: #fae8e4;
  --shadow: 0 18px 55px rgba(24, 24, 24, .14);
  font-family: Cambria, Georgia, "Times New Roman", serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: #5c5c5c; }
button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

#app { width: min(100%, 520px); min-height: 100dvh; margin: 0 auto; background: var(--card); position: relative; box-shadow: var(--shadow); }
.topbar { min-height: 82px; padding: max(13px, env(safe-area-inset-top)) 18px 12px; display: grid; grid-template-columns: 42px 1fr 42px; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .94); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(14px); }
.topbar h1 { margin: 2px 0 0; text-align: center; font-size: 17px; font-weight: 500; }
.eyebrow { margin: 0; text-align: center; color: var(--muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.icon-button { width: 42px; height: 42px; border: 0; border-radius: 50%; color: var(--ink); background: transparent; font-size: 22px; cursor: pointer; }
.icon-button:hover { background: var(--pine-pale); }
.progress-track { height: 4px; background: var(--line); position: sticky; top: 82px; z-index: 11; }
#global-progress { width: 8%; height: 100%; background: var(--amber); transition: width .25s ease; }

#screen { min-height: calc(100dvh - 168px); padding: 24px 20px 112px; outline: none; }
.screen-section { animation: enter .22s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
h2 { margin: 8px 0 10px; font-family: inherit; font-size: clamp(28px, 8vw, 36px); line-height: 1.05; font-weight: 500; }
h3 { margin: 0; font-size: 17px; font-weight: 500; }
p { line-height: 1.5; }
.lead { margin: 0; color: var(--muted); font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }

.hero-visual { height: 230px; border-radius: 24px; margin-bottom: 18px; overflow: hidden; position: relative; background: linear-gradient(155deg, #eeeeee 0 43%, #bdbdbd 43% 59%, #555555 59%); }
.demo-chip { position: absolute; z-index: 3; top: 14px; left: 14px; padding: 7px 10px; border-radius: 999px; color: #444444; background: rgba(255,255,255,.9); font-size: 12px; font-weight: 500; }
.mountains::before, .mountains::after { content: ""; position: absolute; width: 230px; height: 230px; bottom: 30px; transform: rotate(45deg); border-radius: 16px; background: #f5f5f5; }
.mountains::before { left: -75px; }
.mountains::after { right: -105px; bottom: 2px; background: #c8c8c8; }
.chalet-shape { width: 190px; height: 80px; position: absolute; left: 50%; bottom: 25px; transform: translateX(-50%); background: #606060; box-shadow: inset 0 -15px rgba(0,0,0,.12); }
.chalet-shape::before { content: ""; width: 135px; height: 135px; position: absolute; top: -68px; left: 28px; transform: rotate(45deg); border-radius: 4px; background: #292929; }
.chalet-shape span { position: absolute; inset: 24px 8px auto; z-index: 2; text-align: center; color: white; font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }

.pill { display: inline-flex; align-items: center; width: fit-content; padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.pill-success, .pill-warning { color: #2b2b2b; background: #d4b559; }
.pill-danger { color: #7b3027; background: var(--danger-pale); }

.info-card { margin-top: 16px; padding: 16px; border: 1px solid #9f9e9f; border-radius: 18px; color: #2b2b2b; background: #b3b2b3; }
.reservation-preview { display: flex; gap: 13px; align-items: center; }
.reservation-preview p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.card-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; color: #303030; background: #eeeeee; font-size: 21px; }
.detail-list { margin: 18px 0 0; border: 1px solid var(--line); border-radius: 18px; padding: 4px 16px; }
.detail-row { min-height: 52px; display: flex; justify-content: space-between; align-items: center; gap: 15px; border-bottom: 1px solid var(--line); font-size: 14px; }
.detail-row:last-child { border: 0; }
.detail-row span { color: var(--muted); }
.detail-row strong { text-align: right; font-weight: 500; }

label.field-label { display: block; margin: 18px 0 7px; color: var(--muted); font-size: 13px; }
input[type="text"], input[type="email"], textarea { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; color: var(--ink); background: white; outline: none; }
input:focus, textarea:focus { border-color: var(--pine); box-shadow: 0 0 0 3px rgba(85,85,85,.18); }
textarea { min-height: 88px; resize: vertical; }
.code-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin: 18px 0 8px; }
.code-grid input { width: 100%; height: 49px; border: 1px solid var(--line); border-radius: 11px; padding: 0; text-align: center; color: var(--ink); background: white; font-size: 18px; }
.inline-message { margin-top: 12px; padding: 11px 12px; border-radius: 12px; font-size: 13px; }
.inline-message.success { color: var(--pine); background: var(--pine-pale); }
.inline-message.error { color: #7b3027; background: var(--danger-pale); }

.is-mission-page #screen { padding-top: 54px; padding-bottom: 176px; }
.is-mission-page #help-button { visibility: hidden; }
.is-mission-page .screen-section > h2, .is-mission-page .screen-section > .lead { text-align: center; }
.is-mission-page .screen-section > h2 { font-size: clamp(31px, 8vw, 44px); }
.is-mission-page .screen-section > .lead { margin: 14px auto 0; max-width: 470px; color: var(--ink); }
.mission-list { display: grid; gap: 24px; margin-top: 68px; }
.mission-card { min-height: 163px; display: grid; grid-template-columns: 102px 1fr auto; gap: 22px; align-items: center; padding: 24px 28px; border: 2px solid #454545; border-radius: 27px; color: #2b2b2b; background: #ffffff; box-shadow: none; }
.mission-card--ecrin, .mission-card--refuge, .mission-card--attestation { border-color: #454545; color: #2b2b2b; background: #ffffff; }
.mission-icon { width: 88px; height: 88px; display: grid; place-items: center; position: relative; border: 2px solid #3c3c3c; border-radius: 50%; color: #2b2b2b; }
.mission-icon svg { width: 42px; height: 42px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mission-number { width: 38px; height: 38px; position: absolute; top: -10px; left: -10px; z-index: 1; display: grid; place-items: center; border-radius: 50%; color: #ffffff; background: #2b2b2b; font-size: 18px; font-weight: 500; }
.mission-card h3 { margin: 0; font-size: clamp(26px, 7vw, 36px); font-weight: 500; }
.mission-card p { margin: 8px 0 0; color: #2b2b2b; font-size: 16px; }
.mission-state { color: #2b2b2b; font-size: 42px; line-height: 1; }
.mission-card.completed .mission-number { color: #ffffff; background: #2b2b2b; }
.mission-list + .info-card { margin-top: 64px; padding: 0; border: 0; border-radius: 0; text-align: center; background: transparent; box-shadow: none; }
.mission-list + .info-card strong { display: block; margin: 0; font-size: clamp(28px, 8vw, 38px); font-weight: 500; }
.mission-list + .info-card p { display: none; }
.guide-client-list { margin-top: 22px; display: grid; gap: 14px; }
.guide-client-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #ffffff; box-shadow: var(--shadow); }
.guide-client-card img { width: 100%; max-height: 245px; display: block; object-fit: cover; }
.guide-client-card > div { padding: 16px; }
.guide-client-card h3 { font-size: 20px; }
.guide-client-card p { margin: 7px 0 0; white-space: pre-line; }
.guide-client-location { color: var(--amber); font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }

.inspection-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.zone-visual { height: 210px; margin: 14px 0; border-radius: 22px; display: flex; align-items: flex-end; padding: 15px; color: white; position: relative; overflow: hidden; background: linear-gradient(135deg, #dddddd, #919191 48%, #4b4b4b); }
.zone-visual::before { content: ""; position: absolute; width: 160px; height: 160px; right: -30px; top: -40px; border: 22px solid rgba(255,255,255,.3); border-radius: 50%; }
.zone-visual.refuge { background: linear-gradient(135deg, #cfcfcf, #777777 48%, #292929); }
.zone-visual span { position: relative; z-index: 1; padding: 8px 10px; border-radius: 11px; background: rgba(24, 24, 24, .76); font-size: 12px; }
.zone-visual.has-photo { height: auto; min-height: 0; padding: 0; display: block; background: #c8c8c8; line-height: 0; }
.zone-visual.has-photo::before { display: none; }
.zone-visual.has-photo img { width: 100%; height: auto; display: block; }
.zone-visual.has-photo > span { position: absolute; left: 13px; bottom: 13px; line-height: 1.2; }
.client-hotspot { width: 34px; height: 34px; position: absolute; z-index: 2; transform: translate(-50%, -50%); border: 3px solid white; border-radius: 50%; color: white; background: var(--amber); box-shadow: 0 5px 15px rgba(0,0,0,.28); cursor: pointer; font-size: 12px; font-weight: 600; }
.client-hotspot.active { outline: 4px solid rgba(255,255,255,.55); }
.photo-carousel { margin: -5px 0 11px; display: grid; grid-template-columns: 42px 1fr 42px; gap: 8px; align-items: center; }
.photo-carousel button { height: 38px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: white; cursor: pointer; }
.photo-carousel small { text-align: center; color: var(--muted); }
.photo-guidance { margin-bottom: 13px; padding: 10px 12px; border-left: 3px solid var(--amber); border-radius: 0 11px 11px 0; color: #444444; background: var(--amber-pale); font-size: 12px; line-height: 1.45; }
.zone-navigation { display: grid; grid-template-columns: 44px 1fr 44px; gap: 10px; align-items: center; margin-bottom: 15px; }
.zone-navigation button { height: 42px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: white; cursor: pointer; }
.zone-navigation div { text-align: center; }
.zone-navigation strong { display: block; font-weight: 500; }
.zone-navigation small { color: var(--muted); }
.control-list { display: grid; gap: 10px; }
.control-card { border: 1px solid #9f9e9f; border-radius: 17px; padding: 14px; color: #2b2b2b; background: #b3b2b3; }
.control-card .field-label, .control-card .muted { color: var(--muted); }
.control-title { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.control-title strong { font-size: 14px; font-weight: 500; }
.status-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 11px; }
.status-button { min-height: 42px; border: 1px solid var(--line); border-radius: 11px; padding: 6px 4px; color: var(--ink); background: white; cursor: pointer; font-size: 11px; }
.status-button.selected[data-status="ok"] { border-color: var(--pine); color: var(--pine); background: var(--pine-pale); }
.status-button.selected[data-status="issue"] { border-color: var(--danger); color: #7b3027; background: var(--danger-pale); }
.status-button.selected[data-status="unknown"] { border-color: var(--amber); color: #444444; background: var(--amber-pale); }
.justification { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.photo-input { width: 100%; font-size: 12px; color: var(--muted); }
.photo-input::file-selector-button { margin-right: 8px; border: 1px solid var(--danger); border-radius: 10px; padding: 8px 10px; color: var(--danger); background: white; }
.quick-action { width: 100%; min-height: 44px; margin: 12px 0; border: 1px dashed var(--pine); border-radius: 13px; color: var(--pine); background: var(--pine-pale); cursor: pointer; }
.all-ok-action { border: 0; color: var(--ink); background: var(--amber); box-shadow: 0 5px 14px rgba(117, 91, 22, .18); font-weight: 600; }
.all-ok-action:hover { background: #c7a743; }
.all-ok-action:active { transform: translateY(1px); }
.error-summary { margin: 12px 0; padding: 12px; border-radius: 13px; color: #7b3027; background: var(--danger-pale); font-size: 13px; }

.summary-block { margin-top: 18px; }
.summary-block h3 { margin-bottom: 9px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.issue-card { margin-top: 10px; padding: 13px; border-left: 4px solid var(--danger); border-radius: 0 13px 13px 0; background: var(--danger-pale); font-size: 13px; }
.check-row { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; margin: 18px 0; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--pine); }
.check-row label { font-size: 13px; line-height: 1.45; }
.signature-wrap { margin-top: 16px; }
#signature-pad { width: 100%; height: 145px; border: 1px dashed var(--pine); border-radius: 16px; display: block; background: #fafafa; touch-action: none; }
.signature-actions { display: flex; justify-content: flex-end; margin-top: 7px; }
.text-button { border: 0; padding: 6px; color: var(--pine); background: transparent; cursor: pointer; font-size: 13px; }

.success-mark { width: 96px; height: 96px; margin: 28px auto 20px; border-radius: 50%; display: grid; place-items: center; color: var(--pine); background: var(--pine-pale); font-size: 44px; }
.locked-note { margin-top: 16px; padding: 13px; border-radius: 13px; color: var(--muted); background: #f5f5f5; font-size: 13px; }

.footer-actions { min-height: 86px; padding: 13px 18px max(16px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: minmax(100px, .8fr) 1.7fr; gap: 10px; position: fixed; bottom: 0; left: 50%; z-index: 12; width: min(100%, 520px); transform: translateX(-50%); border-top: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.button { min-height: 50px; border-radius: 14px; padding: 11px 15px; font-weight: 500; cursor: pointer; }
.button-primary { border: 1px solid var(--pine); color: var(--amber); background: var(--pine); }
.button-primary:hover { background: var(--pine-dark); }
.button-secondary { border: 1px solid var(--line); color: var(--ink); background: white; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.footer-actions.mission-footer { gap: 10px; padding: 14px 30px max(18px, env(safe-area-inset-bottom)); grid-template-rows: auto auto; }
.footer-actions.mission-footer .button-primary { order: 1; min-height: 62px; border: 0; border-radius: 999px; color: white; background: linear-gradient(120deg, #2b2b2b, #5a3100); font-size: 18px; }
.footer-actions.mission-footer .button-secondary { order: 2; min-height: 39px; border: 0; color: #4a2a0a; background: transparent; font-size: 18px; }

dialog { width: min(calc(100% - 32px), 430px); border: 1px solid var(--line); border-radius: 22px; padding: 22px; color: var(--ink); background: var(--card); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(24, 24, 24, .58); backdrop-filter: blur(4px); }
dialog h2 { font-size: 27px; }
dialog li { margin: 9px 0; line-height: 1.4; }
.dialog-close { float: right; width: 38px; height: 38px; border: 0; border-radius: 50%; color: var(--ink); background: var(--paper); cursor: pointer; font-size: 22px; }

@media (min-width: 521px) {
  body { padding: 24px 0; }
  #app { min-height: calc(100dvh - 48px); border: 1px solid var(--line); border-radius: 30px; overflow: hidden; }
  .topbar { top: 0; }
  .progress-track { top: 82px; }
  .footer-actions { bottom: 24px; border-radius: 0 0 30px 30px; }
}

/* Charte unifiée — Les Clées d’Anthouard */
:root { --paper: #ffffff; --card: #ffffff; --line: #3c3c3c; --pine-pale: #f7f7f7; --amber-pale: #f7f0d7; --shadow: 0 10px 24px rgba(24,24,24,.08); }
html, body { background: #ffffff; }
#app { background: #ffffff; box-shadow: none; }
.topbar, .footer-actions { border-color: #d7d7d7; background: rgba(255,255,255,.97); }
.icon-button:hover { background: #f7f0d7; }
.hero-visual { border: 2px solid #3c3c3c; background: #ffffff; box-shadow: none; }
.demo-chip, .pill-success, .pill-warning { border: 1px solid #3c3c3c; color: #2b2b2b; background: #d4b559; }
.info-card, .detail-list, .control-card, .locked-note { border-color: #3c3c3c; color: #2b2b2b; background: #ffffff; box-shadow: none; }
.card-icon { border: 1px solid #3c3c3c; border-radius: 50%; background: #ffffff; }
input[type="text"], input[type="email"], textarea, .code-grid input, .photo-carousel button, .zone-navigation button, .status-button { border-color: #3c3c3c; background: #ffffff; }
.photo-guidance { border: 1px solid #3c3c3c; border-left: 5px solid #d4b559; border-radius: 14px; color: #2b2b2b; background: #ffffff; }
.control-card { border-width: 1.5px; }
.status-button.selected[data-status="ok"], .status-button.selected[data-status="unknown"] { border-color: #3c3c3c; color: #2b2b2b; background: #f7f0d7; }
.quick-action { border: 1.5px solid #3c3c3c; color: #2b2b2b; background: #ffffff; }
.all-ok-action { border: 0; background: #d4b559; }
.summary-row { border-color: #3c3c3c; }
#signature-pad { border: 1.5px solid #3c3c3c; background: #ffffff; }
.button { border-radius: 999px; }
.button-primary { border: 0; color: #ffffff; background: linear-gradient(120deg, #2b2b2b, #5a3100); }
.button-secondary { border: 1.5px solid #3c3c3c; }
dialog { border: 1.5px solid #3c3c3c; background: #ffffff; box-shadow: var(--shadow); }

/* Anthouard Collection — application de la charte de marque */
:root {
  --ink: #221f1c;
  --muted: #62615c;
  --paper: #f5f3e8;
  --card: #ffffff;
  --line: #d9d5c5;
  --pine: #221f1c;
  --pine-dark: #000000;
  --pine-pale: #e2dec8;
  --amber: #a28b1f;
  --amber-pale: #e2dec8;
  --danger: #9c3c31;
  --danger-pale: #f6e6e0;
  --shadow: 0 14px 35px rgba(34, 31, 28, .10);
}

html, body { background: var(--paper); }
#app { background: var(--paper); }
.topbar, .footer-actions { border-color: var(--line); background: rgba(245, 243, 232, .96); }
.eyebrow { color: var(--amber); font-weight: 600; letter-spacing: .09em; }
.progress-track { background: #e2dec8; }
#global-progress { background: var(--amber); }
.icon-button:hover { background: #e2dec8; }
.lead, .muted { color: var(--muted); }
h2, h3 { color: var(--ink); }

.hero-visual { border: 0; border-radius: 18px; background: #e2dec8; }
.demo-chip { color: var(--ink); background: rgba(245, 243, 232, .92); }
.mountains::before { background: #f5f3e8; }
.mountains::after { background: #d6d0b8; }
.chalet-shape { background: #6d6252; }
.chalet-shape::before { background: var(--ink); }
.pill-success, .pill-warning, .demo-chip { border-color: transparent; }
.pill-success, .pill-warning { color: #ffffff; background: var(--amber); }
.info-card, .detail-list, .control-card, .locked-note { border-color: var(--line); background: #ffffff; }
.card-icon { border-color: var(--amber); color: var(--amber); background: #f5f3e8; }
input[type="text"], input[type="email"], textarea, .code-grid input,
.photo-carousel button, .zone-navigation button, .status-button { border-color: var(--line); border-radius: 10px; }
input:focus, textarea:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(162, 139, 31, .16); }
.photo-guidance { border: 0; border-left: 4px solid var(--amber); border-radius: 0; color: var(--ink); background: #e2dec8; }
.control-card { border-radius: 14px; }
.status-button.selected[data-status="ok"], .status-button.selected[data-status="unknown"] { border-color: var(--amber); color: var(--ink); background: #e2dec8; }
.quick-action { border-color: var(--amber); color: var(--ink); background: #ffffff; }
.all-ok-action, .all-ok-action:hover { color: #ffffff; background: var(--amber); box-shadow: none; }
.button { border-radius: 6px; font-weight: 600; }
.button-primary, .footer-actions.mission-footer .button-primary { color: #ffffff; background: var(--ink); }
.button-primary:hover, .footer-actions.mission-footer .button-primary:hover { background: #3d3c3a; }
.button-secondary { border-color: var(--ink); background: transparent; }
.footer-actions.mission-footer .button-secondary { color: var(--ink); }

.is-mission-page #screen { padding-top: 38px; }
.is-mission-page .screen-section > .lead { color: var(--muted); }
.mission-list { gap: 14px; margin-top: 42px; }
.mission-card, .mission-card--ecrin, .mission-card--refuge, .mission-card--attestation {
  min-height: 132px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #ffffff;
  box-shadow: var(--shadow);
}
.mission-card--ecrin { border-left: 5px solid var(--amber); }
.mission-icon { width: 76px; height: 76px; border-color: var(--amber); color: var(--ink); background: #f5f3e8; }
.mission-number { color: #ffffff; background: var(--ink); }
.mission-card h3 { font-size: clamp(24px, 7vw, 32px); }
.mission-card p, .mission-state { color: var(--muted); }
.mission-list + .info-card { margin-top: 40px; }

.zone-visual { border-radius: 14px; background: #d6d0b8; }
.zone-visual.refuge { background: #c8c1ae; }
.zone-visual span { background: rgba(34,31,28,.86); }
.client-hotspot { color: #ffffff; background: var(--amber); }
.client-hotspot.active { outline-color: rgba(162,139,31,.34); }
dialog { border-color: var(--line); border-radius: 14px; background: #f5f3e8; }
.dialog-close { color: #ffffff; background: var(--ink); }
