/* =====================================================================
   PAY COLLECTOR — Back-offices (marchand / admin), authentification, accueil
   ===================================================================== */
:root {
    --bg: #f3f5f9;
    --surface: #ffffff;
    --text: #1d2433;
    --muted: #5b6475;
    --border: #e1e6ee;
    --primary: #0f3d91;
    --primary-2: #1a56c4;
    --accent: #1a73e8;
    --ok: #16a34a;   --ok-bg: #e6f6ec;
    --wait: #9a6700; --wait-bg: #fff4d6;
    --ko: #c62828;   --ko-bg: #fdecec;
    --info-bg: #e8f1ff;
    --side: #0b1f47;
    --side-text: #c9d5ee;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 8px rgba(16, 24, 40, .05);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg); color: var(--text); line-height: 1.5; font-size: 15px;
}
a { color: var(--primary-2); }
code, pre { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; }
.muted { color: var(--muted); }
.d-block { display: block; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 24px; }
.w-sm { max-width: 110px; }
.pos { color: var(--ok); }
.neg { color: var(--ko); }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------------- Boutons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 40px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
    background: #fff; color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: #f6f8fb; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-2); }
.btn--danger { background: var(--ko); border-color: var(--ko); color: #fff; }
.btn--danger:hover { background: #a91f1f; }
.btn--ghost { background: transparent; }
.btn--sm { min-height: 34px; padding: 5px 12px; font-size: .88rem; }
.btn--block { width: 100%; min-height: 46px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------------- Badges / alertes ---------------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .74rem; font-weight: 700; vertical-align: middle; background: #eef1f5; color: var(--muted); white-space: nowrap; }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--wait { background: var(--wait-bg); color: var(--wait); }
.badge--ko { background: var(--ko-bg); color: var(--ko); }
.badge--test { background: #111827; color: #fbbf24; }
.alert { padding: 12px 14px; border-radius: 8px; margin: 0 0 16px; }
.alert--ok { background: var(--ok-bg); color: #0f5f2e; }
.alert--ko { background: var(--ko-bg); color: #8a1c1c; }
.alert--info { background: var(--info-bg); color: #0b3b8c; }
.chip { display: inline-block; padding: 6px 12px; border-radius: 99px; font-size: .85rem; font-weight: 600; text-decoration: none; margin: 0 6px 8px 0; }
.chip--wait { background: var(--wait-bg); color: var(--wait); }
.chip--ko { background: var(--ko-bg); color: var(--ko); }

/* ---------------- Mise en page back-office ---------------- */
.bo { display: flex; min-height: 100vh; }
.side { width: 240px; flex: none; background: var(--side); color: var(--side-text); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.bo--admin .side { background: #1a1333; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.08rem; padding: 4px 8px 18px; }
.brand--dark { color: var(--text); }
.brand-tag { font-size: .62rem; background: #fbbf24; color: #1a1333; padding: 2px 6px; border-radius: 4px; }
.nav { list-style: none; margin: 0; padding: 0; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--side-text); text-decoration: none; font-weight: 500; min-height: 44px; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a[aria-current] { background: rgba(255, 255, 255, .14); color: #fff; }
.page { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.top-title { font-size: 1.15rem; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-user { display: flex; align-items: center; gap: 12px; }
.top-user form { margin: 0; }
.top-name { font-weight: 600; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.nav-toggle, .burger { display: none; }

@media (max-width: 900px) {
    .side { position: fixed; left: -260px; z-index: 20; transition: left .2s; box-shadow: 4px 0 24px rgba(0,0,0,.2); }
    .nav-toggle:checked ~ .side { left: 0; }
    .burger { display: inline-flex; flex-direction: column; gap: 4px; padding: 10px; cursor: pointer; min-width: 44px; min-height: 44px; justify-content: center; }
    .burger span { width: 20px; height: 2px; background: var(--text); display: block; }
    .top { padding: 8px 12px; }
    .top-name, .top-user .badge { display: none; }
    .content { padding: 14px; }
}

/* ---------------- Cartes / grilles ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card--highlight { border-color: #fbbf24; background: #fffbeb; }
.card-title { font-size: 1.02rem; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.card-head p { margin: 0; max-width: 720px; }
.grid-2 { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 1100px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-2--wide-left { grid-template-columns: 1.6fr 1fr; }
}
.grid-2 > * { min-width: 0; }
.big-number { font-size: 2rem; font-weight: 800; margin: 0 0 12px; }

/* ---------------- KPIs ---------------- */
.toolbar { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.seg a { padding: 6px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .88rem; }
.seg a[aria-current] { background: var(--primary); color: #fff; }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.kpi-label { display: block; color: var(--muted); font-size: .82rem; }
.kpi-value { display: block; font-size: 1.45rem; margin-top: 4px; }
.kpi-sub { display: block; color: var(--muted); font-size: .8rem; }
.chart { position: relative; }
.chart canvas { width: 100%; display: block; }
.chart-tip { position: absolute; pointer-events: none; background: #111827; color: #fff; font-size: .78rem; padding: 4px 8px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -120%); }
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; }
.bars meter { width: 100%; height: 10px; }
.bars-value { font-weight: 600; font-size: .88rem; white-space: nowrap; }
.steps { padding-left: 20px; margin: 0; }
.steps li { margin-bottom: 6px; }

/* ---------------- Tableaux ---------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; padding: 10px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:hover { background: #fafbfd; }
.table--compact td, .table--compact th { padding: 7px 8px; }
.table .num { text-align: right; }
.table .empty { text-align: center; color: var(--muted); padding: 24px; }
.table tr.is-muted td { opacity: .55; }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; padding-top: 14px; }

/* ---------------- Définitions / timeline ---------------- */
.dl { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 8px 16px; margin: 0 0 12px; }
.dl dt { color: var(--muted); font-size: .88rem; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .dl { grid-template-columns: 1fr; gap: 2px; } .dl dd { margin-bottom: 8px; } }
.timeline { list-style: none; padding: 0; margin: 0 0 12px; }
.timeline li { padding: 8px 0; border-bottom: 1px dashed var(--border); overflow-wrap: anywhere; }
.code { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 8px; overflow-x: auto; font-size: .82rem; line-height: 1.55; white-space: pre; }
.copy-field { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.copy-field code { background: #f1f4f9; padding: 6px 10px; border-radius: 6px; word-break: break-all; }

/* ---------------- Formulaires ---------------- */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: .88rem; }
.form label small { font-weight: 400; color: var(--muted); }
.form--grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
.form--inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.form--tight { gap: 6px; }
.form--tight input, .form--tight select { min-height: 34px; padding: 4px 8px; }
.form-actions, .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-actions { grid-column: 1 / -1; }
input, select, textarea {
    font: inherit; font-weight: 400; color: var(--text); background: #fff;
    border: 1px solid #cfd6e1; border-radius: 8px; padding: 9px 11px; min-height: 42px; width: 100%;
}
.form--inline input, .form--inline select { width: auto; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid rgba(26,115,232,.25); }
.check { display: flex !important; grid-template-columns: none; flex-direction: row; align-items: center; gap: 8px; font-weight: 500 !important; }
.check input { width: 20px; min-height: 20px; height: 20px; flex: none; }
.logo-preview { max-height: 60px; border: 1px solid var(--border); border-radius: 6px; padding: 4px; background: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters label { display: grid; gap: 2px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.filters input, .filters select { min-height: 38px; padding: 6px 8px; width: auto; min-width: 120px; }
.filters-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.method-picks { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.method-pick { display: flex !important; flex-direction: row; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-weight: 500 !important; cursor: pointer; }
.method-pick input { width: 20px; min-height: 20px; flex: none; }
.method-pick img { object-fit: contain; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-current] { color: var(--primary); border-bottom-color: var(--primary); }
.toc { font-size: .9rem; }
.doc h2 { font-size: 1.12rem; margin-top: 0; }
.doc h3 { font-size: .98rem; margin: 18px 0 8px; }

/* ---------------- Authentification ---------------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(135deg, #0b1f47, #1a56c4); }
.auth-box { width: 100%; max-width: 440px; background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.auth-box .brand { padding: 0 0 16px; }
.auth-title { font-size: 1.3rem; margin: 0 0 16px; }
.auth-links { text-align: center; font-size: .9rem; margin-bottom: 0; }

/* ---------------- Assistant d'installation ---------------- */
.wiz { width: 100%; max-width: 860px; background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.wiz .brand { padding: 0 0 18px; }
.wiz-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 22px; counter-reset: none; }
.wiz-step a, .wiz-step > span { text-decoration: none; }
.wiz-step a { display: flex; align-items: center; gap: 6px; color: inherit; }
.wiz-step { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 99px; background: #eef1f5; color: var(--muted); font-size: .82rem; font-weight: 600; }
.wiz-step--current { background: var(--primary); color: #fff; }
.wiz-step--done { background: var(--ok-bg); color: #0f5f2e; }
.wiz-num { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, .6); font-size: .75rem; }
.wiz-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 18px; }
.wiz-fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px 14px; margin: 0; }
.wiz-fieldset legend { font-weight: 700; padding: 0 6px; }
.wiz .form--grid { display: grid; gap: 14px; }
@media (max-width: 560px) { .wiz { padding: 18px; } .wiz-label { display: none; } .wiz-step--current .wiz-label { display: inline; } }

/* ---------------- Accueil public ---------------- */
.pub { background: #fff; }
.pub-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; max-width: 1180px; margin: 0 auto; }
.pub-nav { display: flex; gap: 14px; align-items: center; }
.pub-hero { text-align: center; max-width: 900px; margin: 0 auto; padding: 56px 20px 32px; }
.pub-hero h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); margin: 0 0 14px; }
.pub-hero p { color: var(--muted); font-size: 1.08rem; }
.pub-hero--small { padding: 80px 20px; }
.pub-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.pub-methods { list-style: none; padding: 0; margin: 32px 0 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.pub-methods img { border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: #fff; object-fit: contain; }
.pub-features { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); max-width: 1100px; margin: 0 auto; padding: 24px 20px 56px; }
.pub-features article { background: var(--bg); border-radius: 12px; padding: 20px; }
.pub-features h2 { font-size: 1.1rem; margin-top: 0; }
.pub-foot { text-align: center; color: var(--muted); padding: 24px; border-top: 1px solid var(--border); font-size: .88rem; }
