:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --text: #1d2433;
    --muted: #697386;
    --border: #dce2ee;
    --primary: #1f6feb;
    --primary-dark: #1557bd;
    --success: #16803c;
    --error: #c62828;
    --warning: #a36300;
    --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    min-height: 72px;
    background: #0f172a;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    gap: 20px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.brand small { display: block; color: #b8c0d4; margin-top: 3px; }

.nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav a {
    color: #fff;
    padding: 9px 12px;
    border-radius: 8px;
}
.nav a:hover { background: rgba(255,255,255,0.1); text-decoration: none; }

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto;
}

.footer {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 26px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

h1 { margin: 0 0 6px; font-size: 30px; }
h2 { margin: 0 0 16px; font-size: 20px; }
.muted { color: var(--muted); margin: 0; }
.hint { color: var(--muted); font-size: 13px; }
code {
    background: #eef2ff;
    border: 1px solid #d9e2ff;
    padding: 2px 5px;
    border-radius: 5px;
}

.panel,
.auth-card,
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(440px, 100%);
    margin: 70px auto;
    padding: 28px;
}

.panel { padding: 22px; margin-bottom: 22px; }

.form { display: grid; gap: 18px; }
.form label { display: grid; gap: 7px; font-weight: 700; }
.form input,
.form select,
.form textarea,
.searchbar input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
    color: var(--text);
}
.form textarea { resize: vertical; }
.form input:focus,
.form select:focus,
.form textarea:focus,
.searchbar input:focus {
    outline: 3px solid rgba(31,111,235,0.15);
    border-color: var(--primary);
}

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

.type-block {
    border: 1px dashed var(--border);
    background: #fbfcff;
    border-radius: 14px;
    padding: 18px;
}

.checkline {
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 10px !important;
}
.checkline input { width: auto; }

.btn,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { text-decoration: none; background: #f8fafc; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: #f8fafc; }
.button-row,
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.linklike {
    border: 0;
    background: transparent;
    color: var(--primary);
    padding: 0;
    font: inherit;
    cursor: pointer;
}
.linklike:hover { text-decoration: underline; }

.alert {
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
    background: #fff;
}
.alert-success { border-color: #b7ebc6; background: #ecfff1; color: var(--success); }
.alert-error { border-color: #ffc2c2; background: #fff0f0; color: var(--error); }
.alert-info { border-color: #c8d8ff; background: #f1f6ff; color: #194fa1; }

.searchbar {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}
.searchbar input { flex: 1; }

.table-wrap {
    width: 100%;
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}
th, td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
th { background: #f8fafc; color: #48566f; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
.actions { white-space: nowrap; }
.actions a,
.actions button { margin-right: 10px; }
.empty { text-align: center; color: var(--muted); padding: 34px; }

.badge,
.status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
}
.badge { background: #eef2ff; color: #334eac; }
.status.ok { background: #ecfff1; color: var(--success); }
.status.off { background: #fff3e2; color: var(--warning); }

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.card { padding: 20px; }
.card span { display: block; color: var(--muted); margin-bottom: 8px; }
.card strong { font-size: 32px; }

.stats-grid { align-items: start; }
.mini-table { min-width: 0; box-shadow: none; }
.mini-table td { padding: 10px 0; }
.mini-table td:last-child { text-align: right; font-weight: 700; }

.qr-preview,
.qr-page {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.qr-img {
    width: min(360px, 100%);
    height: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    background: #fff;
}
.qr-meta { flex: 1; min-width: 260px; }

@media (max-width: 820px) {
    .topbar,
    .page-head,
    .qr-preview,
    .qr-page { flex-direction: column; align-items: flex-start; }
    .grid-2,
    .cards { grid-template-columns: 1fr; }
    .searchbar { flex-direction: column; }
    .container { width: min(100% - 20px, 1180px); margin: 18px auto; }
}


/* Actions QR Codes en icones */
.action-list {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 230px;
}

.action-list a,
.action-list button {
    margin-right: 0;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    transition: 0.15s ease;
}

.icon-btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

button.icon-btn {
    font: inherit;
}

.action-stats {
    background: #eef6ff;
    color: #2563eb;
}

.action-qr {
    background: #f3f0ff;
    color: #6d28d9;
}

.action-copy {
    background: #ecfff4;
    color: #15803d;
}

.action-copy.is-copied {
    background: #dcfce7;
    color: #166534;
}

.action-edit {
    background: #fff8e5;
    color: #b45309;
}

.action-disable {
    background: #fff0f0;
    color: #dc2626;
}

.action-enable {
    background: #effff2;
    color: #16a34a;
}

/* Badge role dans la navigation */
.role-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.14);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

/* Tous les boutons d'action en bleu */
.action-stats,
.action-qr,
.action-copy,
.action-edit,
.action-disable,
.action-enable,
.action-copy.is-copied {
    background: #eef6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.action-stats:hover,
.action-qr:hover,
.action-copy:hover,
.action-edit:hover,
.action-disable:hover,
.action-enable:hover {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.icon-btn i {
    color: inherit;
}

/* vCard avec photo */
.photo-field {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f8fafc;
}

.photo-field h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.vcard-photo-current {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 12px 0;
    flex-wrap: wrap;
}

.vcard-photo-preview {
    width: 82px;
    height: 82px;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #fff;
}


/* Correctif affichage formulaire vCard */
#block-vcard,
#block-url,
#block-vcard-photo {
    transition: none;
}

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

@media (max-width: 900px) {
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Correctifs et nouveautés fonctionnalités */
.svg-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.svg-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}
.svg-icon svg path,
.svg-icon svg rect {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.badge-stats { background: #eef6ff; color: #2563eb; }
.badge-simple { background: #f8fafc; color: #475569; }
.current-file {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
    margin-bottom: 12px;
}
.contact-theme {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fbfdff;
}
.form-builder {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    background: #f8fafc;
}
.builder-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}
.builder-head h3 { margin: 0; }
.form-field-row {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    padding: 14px;
    margin-bottom: 12px;
    display: grid;
    gap: 12px;
}
.field-options { display: grid; gap: 7px; }
.field-required { align-self: end; }
.btn-small { padding: 8px 10px; font-size: 13px; justify-self: start; }
.btn-danger { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
.btn-danger:hover { background: #ffe4e6; }
.response-table td { vertical-align: top; }
.response-value-list { margin: 0; padding-left: 18px; }

/* Patch ergonomie : tableau index compact */
.index-table-wrap {
    overflow-x: visible;
}

.index-table {
    min-width: 0;
    table-layout: fixed;
}

.index-table th,
.index-table td {
    padding: 11px 12px;
    overflow-wrap: anywhere;
}

.index-table th:nth-child(1) { width: 22%; }
.index-table th:nth-child(2) { width: 15%; }
.index-table th:nth-child(3) { width: 24%; }
.index-table th:nth-child(4) { width: 14%; }
.index-table th:nth-child(5) { width: 9%; }
.index-table th:nth-child(6) { width: 16%; }

.cell-main strong {
    display: block;
    margin-bottom: 4px;
}

.cell-sub {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.usage-line {
    margin-top: 7px;
}

.index-table .action-list {
    min-width: 0;
    flex-wrap: wrap;
    gap: 7px;
}

.index-table .icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 11px;
}

@media (max-width: 960px) {
    .index-table-wrap {
        overflow-x: auto;
    }
    .index-table {
        min-width: 720px;
    }
}

/* Patch ergonomie : type QR Code en haut du formulaire */
.qr-type-card {
    border: 1px solid #bfdbfe;
    background: linear-gradient(135deg, #eef6ff, #f8fbff);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 10px 22px rgba(31, 111, 235, 0.08);
}

.qr-type-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.qr-type-card h2 {
    margin: 0 0 6px;
    color: #174ea6;
}

.qr-type-label {
    margin: 0;
}

.qr-type-card select {
    border-color: #93c5fd;
    background: #fff;
    font-weight: 700;
}

.qr-type-card select:focus {
    outline-color: rgba(31,111,235,0.22);
}

/* Typographie normale dans les champs de formulaire */
.form input,
.form select,
.form textarea,
.searchbar input,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    font-weight: 400;
    letter-spacing: 0;
}

.form input::placeholder,
.form textarea::placeholder,
.searchbar input::placeholder,
input::placeholder,
textarea::placeholder {
    font-weight: 400;
    color: #9ca3af;
}

/* Personnalisation du questionnaire public */
.form-theme-admin {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    border-radius: 16px;
    padding: 18px;
    display: grid;
    gap: 14px;
}

.form-theme-admin h3,
.form-theme-admin h4 {
    margin: 0 0 4px;
}

.form-logo-admin {
    border-top: 1px solid #dbeafe;
    padding-top: 14px;
    display: grid;
    gap: 12px;
}

.current-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    padding: 12px;
}

.current-logo img {
    width: 120px;
    max-height: 70px;
    object-fit: contain;
    display: block;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px;
}

/* Patch questionnaire : selecteurs couleur propres + apercu mobile */
.form-custom-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 22px;
    align-items: start;
}

.form-custom-controls {
    display: grid;
    gap: 18px;
}

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

.color-control {
    display: grid;
    gap: 8px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
}

.color-control > span {
    font-size: 13px;
    font-weight: 800;
    color: #334155;
}

.color-control-line {
    display: flex;
    align-items: center;
    gap: 9px;
}

.color-swatch {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 13px;
    background: transparent !important;
    cursor: pointer;
    overflow: hidden;
}

.color-swatch::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-swatch::-webkit-color-swatch {
    border: 1px solid #dbe3ef;
    border-radius: 13px;
}

.color-swatch::-moz-color-swatch {
    border: 1px solid #dbe3ef;
    border-radius: 13px;
}

.color-text {
    width: 100%;
    min-width: 0;
    height: 42px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-transform: uppercase;
}

.form-logo-admin .current-logo {
    display: grid;
    gap: 10px;
    margin: 10px 0 14px;
}

.form-logo-admin .current-logo img {
    max-width: 180px;
    max-height: 90px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    padding: 10px;
}

.mobile-preview-wrap {
    position: sticky;
    top: 16px;
    display: grid;
    gap: 10px;
}

.mobile-preview-title {
    font-size: 13px;
    font-weight: 900;
    color: #334155;
    text-align: center;
}

.phone-frame {
    width: 310px;
    max-width: 100%;
    margin: 0 auto;
    padding: 12px;
    border-radius: 36px;
    background: #111827;
    box-shadow: 0 20px 55px rgba(15, 23, 42, .22);
}

.phone-screen {
    min-height: 520px;
    border-radius: 26px;
    padding: 14px;
    overflow: hidden;
    transition: background .15s ease;
}

.preview-form-card {
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
}

.preview-form-header {
    padding: 22px 18px;
    color: #fff;
    text-align: center;
    transition: background .15s ease;
}

.preview-logo-box {
    width: 78px;
    height: 78px;
    margin: 0 auto 12px;
    border-radius: 20px;
    background: rgba(255,255,255,.96);
    border: 3px solid rgba(255,255,255,.62);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-logo-box.is-empty {
    background: rgba(255,255,255,.22);
    color: rgba(255,255,255,.8);
    font-size: 13px;
    font-weight: 900;
}

.preview-logo-box img {
    max-width: 92%;
    max-height: 92%;
    object-fit: contain;
    display: block;
}

.preview-form-header h3 {
    margin: 0;
    font-size: 20px;
    line-height: 1.15;
}

.preview-form-header p {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.35;
    opacity: .92;
}

.preview-form-body {
    padding: 16px;
    display: grid;
    gap: 12px;
}

.preview-field-line span {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 800;
    color: #334155;
}

.preview-field-line div {
    height: 36px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #fff;
}

.preview-choice-line {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid #e5eaf3;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

.preview-choice-line i {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #94a3b8;
    flex: 0 0 14px;
}

#form-preview-button {
    border: 0;
    border-radius: 14px;
    color: #fff;
    min-height: 40px;
    font-size: 14px;
    font-weight: 900;
    transition: background .15s ease;
}

@media (max-width: 1100px) {
    .form-custom-layout {
        grid-template-columns: 1fr;
    }

    .mobile-preview-wrap {
        position: static;
    }
}

@media (max-width: 760px) {
    .color-picker-grid {
        grid-template-columns: 1fr;
    }

    .phone-frame {
        width: 285px;
    }
}

/* Patch interface : menu utilisateur + sections formulaire + RGPD */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.main-nav a {
    color: #fff;
    padding: 9px 12px;
    border-radius: 8px;
    font-weight: 700;
}

.main-nav a:hover {
    background: rgba(255,255,255,0.1);
    text-decoration: none;
}

.user-menu {
    position: relative;
}

.user-menu summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 6px 10px 6px 7px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.16);
    color: #fff;
    cursor: pointer;
    user-select: none;
}

.user-menu summary::-webkit-details-marker {
    display: none;
}

.user-menu summary:hover {
    background: rgba(255,255,255,0.13);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.user-avatar svg {
    width: 18px;
    height: 18px;
}

.user-avatar svg path,
.user-avatar svg circle {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.user-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
}

.user-caret {
    font-size: 12px;
    opacity: .8;
}

.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 220px;
    padding: 10px;
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    z-index: 30;
}

.user-dropdown a {
    display: block;
    padding: 10px 11px;
    border-radius: 10px;
    color: var(--text);
    font-weight: 800;
}

.user-dropdown a:hover {
    background: #f8fafc;
    text-decoration: none;
}

.user-role {
    padding: 8px 11px 10px;
    color: var(--muted);
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}

/* On garde .nav pour compatibilite, mais le nouveau menu utilise .main-nav */
.nav { display: none; }

.form-section {
    border-radius: 18px;
    padding: 20px;
    display: grid;
    gap: 18px;
    border: 1px solid var(--border);
}

.section-titleline h2,
.form-section h2 {
    margin: 0 0 5px;
}

.section-admin-info {
    background: #fff;
    border-color: #e5eaf3;
}

.section-qrcode-choice {
    background: #f8fafc;
    border-color: #dbe3ef;
}

.section-form-builder {
    background: #f3f4f6 !important;
    border-color: #d1d5db !important;
}

.section-form-builder > h2 {
    color: #111827;
}

.admin-purpose-box,
.rgpd-admin-box {
    background: #f8fafc;
    border: 1px solid #e5eaf3;
    border-radius: 16px;
    padding: 16px;
    display: grid;
    gap: 14px;
}

.admin-purpose-box h3,
.rgpd-admin-box h3 {
    margin: 0 0 4px;
}

.qr-type-card {
    background: #f8fafc !important;
    border-color: #dbe3ef !important;
    box-shadow: none !important;
}

.qr-type-card h2,
.section-qrcode-choice h2 {
    color: #111827 !important;
}

.qr-type-label select,
.section-qrcode-choice select {
    border-color: #cbd5e1 !important;
    background: #fff !important;
    font-weight: 500 !important;
}

.form-theme-admin {
    background: #e5e7eb !important;
    border-color: #d1d5db !important;
}

.form-logo-admin {
    border-top-color: #cbd5e1 !important;
}

.color-picker-grid {
    gap: 12px !important;
}

.color-control {
    background: #fff !important;
    border: 1px solid #dbe3ef !important;
    border-radius: 14px !important;
    padding: 12px !important;
}

.color-control-line {
    display: grid !important;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px !important;
}

.color-swatch {
    appearance: none;
    -webkit-appearance: none;
    width: 46px !important;
    height: 42px !important;
    min-width: 46px !important;
    border-radius: 12px !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: inset 0 0 0 3px #fff;
    background: transparent !important;
    overflow: hidden;
}

.color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.color-swatch::-webkit-color-swatch { border: 0; border-radius: 11px; }
.color-swatch::-moz-color-swatch { border: 0; border-radius: 11px; }

.color-text {
    height: 42px !important;
    border-radius: 12px !important;
    font-weight: 400 !important;
}

.builder-head {
    display: grid;
    gap: 4px;
}

.builder-add-bottom {
    display: flex;
    justify-content: flex-start;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #cbd5e1;
}

.rgpd-admin-box {
    margin-top: 4px;
    background: #fff;
}

.rgpd-toggle {
    font-weight: 800 !important;
}

@media (max-width: 820px) {
    .topbar {
        align-items: stretch;
    }

    .topbar-right {
        width: 100%;
        justify-content: space-between;
        gap: 12px;
    }

    .main-nav {
        gap: 6px;
    }

    .main-nav a {
        padding: 8px 9px;
    }

    .user-dropdown {
        right: 0;
    }

    .form-section {
        padding: 16px;
    }
}


/* =========================================================
   Optimisation 20260610 - entete, blocs admin et regles finales
   Ces regles remplacent les anciens blocs de patchs successifs.
   ========================================================= */

/* Logo qrcode-stats dans l'entete administration */
.topbar {
    min-height: 92px;
    background: #061b3f;
}

.brand-logo-link {
    text-decoration: none !important;
    color: #ffffff;
}

.brand-logo {
    display: block;
    width: min(310px, 46vw);
    max-height: 72px;
    object-fit: contain;
    border-radius: 12px;
}

.brand-baseline {
    display: block;
    color: #b8d2e8;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

/* Ancienne pastille texte QR conservee en compatibilite si utilisee ailleurs */
.brand-mark {
    background: #102a55;
}

/* Bloc 1 : Administration interne */
.form .section-admin-info {
    background: rgba(240, 242, 244, 0.76) !important;
    border: 2px solid rgb(170, 200, 210) !important;
    border-radius: 22px !important;
    padding: 26px !important;
    margin-bottom: 34px !important;
    box-shadow: rgba(15, 23, 42, 0.07) 0 12px 28px !important;
}

.form .section-admin-info .section-titleline {
    margin-bottom: 22px !important;
}

/* En bleu uniquement : Administration interne et titre du bloc contenu actif */
.form .section-admin-info > .section-titleline h2,
.form .section-content-block > h2 {
    color: #2563eb !important;
    margin: 0 0 6px !important;
}

.form .section-admin-info .section-titleline .muted {
    color: #475569 !important;
    margin: 0 !important;
}

/* Sous-blocs internes : type QR et utilite */
.form .section-admin-info .admin-qr-type-box,
.form .section-admin-info .admin-purpose-box {
    background: #ffffff !important;
    border: 1px solid #d8e3ea !important;
    border-radius: 18px !important;
    padding: 20px !important;
    margin-top: 22px !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04) !important;
}

.form .section-admin-info .admin-qr-type-box {
    margin-bottom: 22px !important;
}

/* Les titres internes restent neutres, comme demande */
.form .section-admin-info .admin-qr-type-box h3,
.form .section-admin-info .admin-purpose-box h3,
.form .section-content-block h3,
.form .section-content-block h4 {
    color: #111827 !important;
    margin: 0 0 6px !important;
}

.form .section-admin-info .admin-qr-type-box p,
.form .section-admin-info .admin-purpose-box p {
    margin-top: 0 !important;
}

.form .section-admin-info .admin-qr-type-box .qr-type-label {
    display: block !important;
    margin-top: 14px !important;
}

.form .section-admin-info input,
.form .section-admin-info select,
.form .section-admin-info textarea {
    background: #ffffff !important;
    font-weight: 400 !important;
}

/* Email(s) client sous nom/titre */
.form .section-admin-info .client-emails-label {
    margin-top: -4px !important;
}

.form .section-admin-info .client-emails-label .hint {
    font-weight: 400 !important;
}

.client-email-line {
    color: #2563eb;
}

/* Bloc 2 : contenu selon type de QR Code */
.form .section-content-block {
    background: #f3f4f6 !important;
    border: 2px solid rgb(170, 200, 210) !important;
    border-radius: 22px !important;
    padding: 26px !important;
    margin-bottom: 34px !important;
    box-shadow: rgba(15, 23, 42, 0.05) 0 10px 24px !important;
}

.form .section-content-block > .muted,
.form .section-form-builder > .muted {
    margin-bottom: 22px !important;
}

/* Sous-blocs internes dans vCard / PDF / questionnaire */
.form .section-content-block .contact-theme,
.form .section-content-block .photo-field,
.form .section-content-block .form-theme-admin,
.form .section-content-block .form-builder,
.form .section-content-block .rgpd-admin-box,
.form .section-content-block .current-file,
.form .section-content-block .contact-theme-admin,
.section-form-builder .form-logo-admin.form-admin-subblock,
.section-form-builder .form-email-admin-box.form-admin-subblock {
    background: #ffffff !important;
    border: 1px solid #d8e3ea !important;
    border-radius: 18px !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.035) !important;
}

.form .section-content-block .contact-theme,
.form .section-content-block .photo-field,
.form .section-content-block .form-theme-admin,
.form .section-content-block .form-builder,
.form .section-content-block .rgpd-admin-box,
.form .section-content-block .contact-theme-admin,
.section-form-builder .form-logo-admin.form-admin-subblock,
.section-form-builder .form-email-admin-box.form-admin-subblock,
.section-form-builder .form-theme-admin {
    padding: 20px !important;
    margin-top: 22px !important;
}

.section-form-builder .form-builder,
.section-form-builder .rgpd-admin-box,
.section-form-builder .form-email-admin-box,
.section-form-builder .form-theme-admin {
    margin-top: 22px !important;
}

.section-form-builder .form-logo-admin.form-admin-subblock {
    border-top: 1px solid #d8e3ea !important;
}

.section-form-builder .form-logo-admin.form-admin-subblock .current-logo {
    background: #f8fafc !important;
    border: 1px solid #dbe3ef !important;
    border-radius: 14px !important;
    padding: 12px !important;
    margin: 12px 0 !important;
}

.section-form-builder .form-logo-admin.form-admin-subblock h3,
.section-form-builder .form-email-admin-box.form-admin-subblock h3,
.section-form-builder .rgpd-admin-box h3,
.section-form-builder .form-builder h3,
.section-form-builder .form-theme-admin h3 {
    color: #111827 !important;
}

/* Espacements propres, sans paragraphes vides */
.section-form-builder > label,
.section-content-block > label {
    margin-top: 18px !important;
}

.form-theme-admin + .form-builder,
.form-builder + .rgpd-admin-box {
    margin-top: 34px !important;
}

.form-field-row {
    margin-bottom: 18px !important;
}

.builder-add-bottom {
    margin-top: 18px !important;
}

/* L'ancien bloc QR Code separe reste masque s'il existe encore dans une ancienne version */
.form .section-qrcode-choice {
    display: none !important;
}

/* Typographie normale dans les champs */
.form input,
.form select,
.form textarea,
.searchbar input,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    font-weight: 400 !important;
    letter-spacing: 0 !important;
}

.form input::placeholder,
.form textarea::placeholder,
.searchbar input::placeholder,
input::placeholder,
textarea::placeholder {
    font-weight: 400 !important;
    color: #9ca3af !important;
}

/* Date de fin QR-STATS */
.qr-expiry-label {
    margin-top: 18px !important;
    display: grid;
    gap: 7px;
}

.qr-expiry-label input[type="date"] {
    max-width: 260px;
}

.qr-expiry-label .hint {
    display: block;
    max-width: 720px;
    line-height: 1.45;
}

.expiry-line {
    margin-top: 6px !important;
}

.status.super {
    background: #eef6ff;
    color: #2563eb;
}

/* Liste QR Codes : alternance blanche / bleutee */
.index-table tbody tr:nth-child(odd) td {
    background: #ffffff;
}

.index-table tbody tr:nth-child(even) td {
    background: #f5faff;
}

.index-table tbody tr:hover td {
    background: #eef6ff;
}

.index-table tbody tr td.empty {
    background: #ffffff !important;
}

/* Gestion utilisateurs : separation claire */
.users-list .user-separator {
    border: 0;
    border-top: 1px solid #bfd7df;
    margin: 24px 0;
}

.users-list .user-card {
    padding-bottom: 4px;
}

/* Apercu mobile vCard avec photo */
.contact-theme-admin .contact-custom-layout {
    margin-top: 16px;
}

.contact-theme-admin .color-picker-grid {
    margin-top: 4px;
}

.preview-contact-card {
    background: #ffffff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
}

.preview-contact-header {
    padding: 22px 18px;
    color: #ffffff;
    text-align: center;
    transition: background .15s ease;
}

.preview-contact-photo {
    width: 92px;
    height: 92px;
    margin: 0 auto 13px;
    border-radius: 50%;
    background: rgba(255,255,255,.96);
    border: 4px solid rgba(255,255,255,.68);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-contact-photo.is-empty {
    background: rgba(255,255,255,.22);
    color: rgba(255,255,255,.88);
    font-size: 13px;
    font-weight: 900;
}

.preview-contact-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-contact-header h3,
.form .section-content-block .preview-contact-header h3,
.form .section-content-block .preview-form-header h3 {
    margin: 0;
    color: #ffffff !important;
    font-size: 21px;
    line-height: 1.15;
}

.preview-contact-header p {
    margin: 8px 0 0;
    color: rgba(255,255,255,.92);
    font-size: 13px;
    line-height: 1.35;
}

.preview-contact-body {
    padding: 16px;
    display: grid;
    gap: 12px;
}

.preview-contact-body p {
    margin: 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.4;
}

.preview-contact-line {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 9px 11px;
    border-radius: 13px;
    border: 1px solid #e5eaf3;
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
}

.preview-contact-line span {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eaf2ff;
    color: #2563eb;
    font-weight: 900;
    flex: 0 0 22px;
}

.preview-contact-line strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#contact-preview-button {
    border: 0;
    border-radius: 14px;
    color: #ffffff;
    min-height: 42px;
    font-size: 14px;
    font-weight: 900;
    transition: background .15s ease;
}

@media (max-width: 820px) {
    .topbar {
        min-height: auto;
        align-items: stretch;
    }

    .brand-logo {
        width: min(260px, 70vw);
        max-height: 64px;
    }
}

@media (max-width: 700px) {
    .form .section-admin-info,
    .form .section-content-block {
        padding: 18px !important;
        border-radius: 18px !important;
        margin-bottom: 24px !important;
    }

    .form .section-admin-info .admin-qr-type-box,
    .form .section-admin-info .admin-purpose-box,
    .form .section-content-block .contact-theme,
    .form .section-content-block .photo-field,
    .form .section-content-block .form-theme-admin,
    .form .section-content-block .form-builder,
    .form .section-content-block .rgpd-admin-box,
    .form .section-content-block .contact-theme-admin,
    .section-form-builder .form-logo-admin.form-admin-subblock,
    .section-form-builder .form-email-admin-box.form-admin-subblock,
    .section-form-builder .form-theme-admin {
        padding: 16px !important;
        margin-top: 18px !important;
    }
}
