/* Palette identique à l'app mobile Drapeau */
:root {
    --navy: #1a2f4c;
    --navy-hover: #223f6a;
    --white: #ffffff;
    --gray-100: #f5f6f8;
    --gray-200: #eceef1;
    --gray-500: #8b93a1;
    --gray-700: #4a5261;
    --good: #22a75a;
    --bad: #c8362f;
    --radius: 6px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
    margin: 0;
    padding: 0;
    background: var(--gray-100);
    color: var(--navy);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.4;
    -webkit-text-size-adjust: 100%;
}

.hidden { display: none !important; }

/* ---------- Layout global ---------- */
.app {
    max-width: 560px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--white);
}

.app-header {
    background: var(--navy);
    color: var(--white);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand {
    width: 46px;
    height: 46px;
    border: 2px solid var(--white);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    text-align: center;
    font-size: 20px;
}
.brand span { font-size: 5.5px; letter-spacing: 0.5px; margin-top: 2px; }

.title-block h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.title-block .subtitle {
    font-size: 12px;
    opacity: 0.75;
    margin-top: 2px;
}

.app-body {
    flex: 1;
    padding: 16px;
}

.app-footer {
    padding: 12px 16px;
    text-align: center;
    color: var(--gray-500);
    font-size: 12px;
}

/* ---------- Cards + steps ---------- */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.card h2 {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 2px solid var(--navy);
    padding-bottom: 8px;
}
.card.center { text-align: center; padding: 32px 16px; }

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--gray-200);
    font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--gray-700); }
.info-row .v { color: var(--navy); font-weight: 600; text-align: right; overflow-wrap: anywhere; }

.hint { color: var(--gray-500); font-size: 13px; margin: 4px 0 12px 0; }

.loader { text-align: center; color: var(--gray-500); padding: 40px 0; }

/* ---------- Inputs ---------- */
.label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--navy);
    margin: 12px 0 4px 0;
    letter-spacing: 0.3px;
}
.input {
    display: block;
    width: 100%;
    max-width: 100%;
    background: var(--gray-100);
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    color: var(--navy);
    outline: none;
    min-height: 44px;
    -webkit-appearance: none;
    appearance: none;
    margin-bottom: 12px;
}
.input:focus { background: var(--white); border-color: var(--navy); }
.input-code {
    font-size: 24px;
    letter-spacing: 8px;
    text-align: center;
    font-weight: 700;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    min-height: 44px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    font-family: inherit;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: var(--navy-hover); }
.btn-secondary { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-secondary:hover { background: var(--gray-100); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

/* ---------- Signature pad ---------- */
.canvas-wrap {
    background: var(--white);
    border: 2px dashed var(--navy);
    border-radius: var(--radius);
    height: 260px;
    position: relative;
    overflow: hidden;
    touch-action: none;
}
.pad {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    background: var(--white);
}
.pad-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    font-style: italic;
    pointer-events: none;
}
.pad-hint.hidden { display: none; }

/* ---------- Feedback ---------- */
.error {
    background: rgba(200,54,47,0.1);
    color: var(--bad);
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-top: 8px;
}
.check {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: var(--good);
    color: white;
    font-size: 40px;
    line-height: 72px;
    text-align: center;
    margin: 0 auto 16px;
}
.cross {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: var(--bad);
    color: white;
    font-size: 40px;
    line-height: 72px;
    text-align: center;
    margin: 0 auto 16px;
}
