: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;
}


/* 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;
    }
}


/* Types QR-STATS / SIMPLE */
.qr-mode-help {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid #bfdbfe;
    background: #eef6ff;
    color: #1d4ed8;
    border-radius: 14px;
    padding: 12px 14px;
}

.qr-mode-help strong {
    font-size: 14px;
}

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

.badge-simple {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #cbd5e1;
}

select optgroup {
    font-weight: 800;
}


/* Correctif icones SVG locales */
.svg-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    pointer-events: none;
}

.svg-icon svg {
    width: 18px;
    height: 18px;
    display: block;
    overflow: visible;
}

.svg-icon svg path,
.svg-icon svg rect,
.svg-icon svg circle,
.svg-icon svg line,
.svg-icon svg polyline,
.svg-icon svg polygon {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}
