/* VentesPro — thème bleu clair & blanc */
:root {
    --blue-900: #0b3b5c;
    --blue-700: #1769a0;
    --blue-600: #2a86c4;
    --blue-500: #4da8da;
    --blue-300: #9fd3f0;
    --blue-100: #dff1fb;
    --blue-50:  #f1f9fe;
    --white: #ffffff;
    --ink: #17324a;
    --ink-soft: #5a7489;
    --line: #dbe9f3;
    --ok: #1f9d6b;
    --ok-bg: #e3f6ee;
    --warn: #c98a12;
    --warn-bg: #fdf3dc;
    --danger: #d24b4b;
    --danger-bg: #fde8e8;
    --star: #f5b301;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(23, 105, 160, .06), 0 6px 20px rgba(23, 105, 160, .07);
    --shadow-lg: 0 12px 40px rgba(23, 105, 160, .16);
    --sidebar: 250px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--blue-50);
}
a { color: var(--blue-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--blue-900); }
h2 { font-size: 1.05rem; font-weight: 650; }
.h2 { font-size: 1.4rem; margin-bottom: .5rem; }
p { margin: 0 0 .75rem; }
img { max-width: 100%; }
code.details { display: block; font-size: .75rem; color: var(--ink-soft); background: var(--blue-50); padding: .3rem .5rem; border-radius: 6px; white-space: pre-wrap; word-break: break-word; max-width: 420px; }
[hidden] { display: none !important; }

.icon { width: 18px; height: 18px; flex-shrink: 0; }
.icon-xs { width: 14px; height: 14px; vertical-align: -2px; }
.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.text-ok { color: var(--ok) !important; }
.text-danger { color: var(--danger) !important; }
.center { text-align: center; }

/* ---------- Layout applicatif ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
    background: var(--white); border-right: 1px solid var(--line);
    display: flex; flex-direction: column; z-index: 40;
    transition: transform .25s ease;
    overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: .65rem; padding: 1.25rem 1.25rem 1rem; color: var(--blue-900); font-weight: 750; font-size: 1.15rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, var(--blue-500), var(--blue-700)); color: var(--white);
}
.brand-mark-lg { width: 56px; height: 56px; border-radius: 16px; margin-bottom: .75rem; }
.brand-mark-lg .icon { width: 28px; height: 28px; }
.nav { display: flex; flex-direction: column; padding: .25rem .75rem 1.5rem; gap: 2px; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); padding: 1rem .75rem .35rem; font-weight: 600; }
.nav-link {
    display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: var(--radius-sm);
    color: var(--ink); font-weight: 500; font-size: .93rem; background: none; border: 0; width: 100%; text-align: left;
    cursor: pointer; font-family: inherit;
}
.nav-link .icon { color: var(--blue-500); }
.nav-link:hover { background: var(--blue-50); text-decoration: none; }
.nav-link.is-active { background: var(--blue-100); color: var(--blue-900); font-weight: 650; }
.nav-link.is-active .icon { color: var(--blue-700); }
.nav-form { margin: 0; }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem;
    padding: .85rem 1.75rem; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.page-title { font-size: 1.25rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: .75rem; }
.user-chip { display: flex; align-items: center; gap: .6rem; color: var(--ink); padding: .25rem .5rem .25rem .25rem; border-radius: 999px; }
.user-chip:hover { background: var(--blue-50); text-decoration: none; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--blue-100); color: var(--blue-700); font-weight: 700; font-size: .85rem; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta small { color: var(--ink-soft); font-size: .75rem; }
.icon-btn {
    display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--white); color: var(--blue-700); cursor: pointer; position: relative; font-size: 1.2rem; line-height: 1;
}
.icon-btn:hover { background: var(--blue-50); text-decoration: none; }
.burger { display: none; }
.bell-badge {
    position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--danger); color: var(--white); font-size: .7rem; font-weight: 700; display: grid; place-items: center;
}
.bell.is-ringing .icon { animation: ring 1s ease 3; transform-origin: 50% 0; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 40% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } }

.content { padding: 1.5rem 1.75rem 3rem; display: flex; flex-direction: column; gap: 1.25rem; max-width: 1400px; width: 100%; }
.sidebar-backdrop { display: none; }

/* ---------- Grilles ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 2fr 1.4fr; gap: 1rem; }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.grid-aside { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.25rem; align-items: start; }
.grid-aside-left { grid-template-columns: 360px minmax(0, 1fr); }
.form .grid-2 { gap: 0 1rem; }
.stack { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.center-narrow { max-width: 440px; margin: 1rem auto; width: 100%; }

/* ---------- Cartes ---------- */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.35rem; border: 1px solid rgba(219, 233, 243, .6); min-width: 0; }
.card-flat { box-shadow: none; }
.card-narrow { max-width: 680px; width: 100%; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.card-gradient { background: linear-gradient(120deg, var(--blue-500), var(--blue-700)); color: var(--white); border: 0; }
.card-gradient h2 { color: var(--white); font-size: 1.35rem; }
.card-gradient p { margin: .25rem 0 0; opacity: .9; }
.welcome { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1.5rem 1.75rem; }

.page-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.page-actions p { margin: 0; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis-inline { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 1rem 0 .5rem; }
.kpi { background: var(--white); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .2rem; border: 1px solid rgba(219, 233, 243, .6); position: relative; min-width: 0; }
.kpis-inline .kpi { box-shadow: none; background: var(--blue-50); border-color: var(--line); }
.kpi-primary { background: linear-gradient(135deg, var(--blue-500), var(--blue-700)); color: var(--white); border: 0; }
.kpis-inline .kpi-primary { background: linear-gradient(135deg, var(--blue-500), var(--blue-700)); }
.kpi-label { font-size: .8rem; color: var(--ink-soft); font-weight: 550; }
.kpi-value { font-size: 1.55rem; font-weight: 750; color: var(--blue-900); letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi-sub { font-size: .8rem; color: var(--ink-soft); }
.kpi-primary .kpi-label, .kpi-primary .kpi-sub { color: rgba(255, 255, 255, .85); }
.kpi-primary .kpi-value { color: var(--white); }
.kpi-icon { position: absolute; top: 1rem; right: 1rem; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--blue-100); color: var(--blue-700); }
.kpi-primary .kpi-icon { background: rgba(255, 255, 255, .2); color: var(--white); }
.kpi-icon-warn { background: var(--warn-bg); color: var(--warn); }
.kpi-icon-danger { background: var(--danger-bg); color: var(--danger); }
.kpi-icon-ok { background: var(--ok-bg); color: var(--ok); }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .62rem 1.1rem; border-radius: var(--radius-sm); border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; line-height: 1.2;
    transition: background .15s, box-shadow .15s, transform .05s; white-space: nowrap; text-decoration: none !important;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .nav-link:focus-visible { outline: 3px solid var(--blue-300); outline-offset: 1px; }
.btn-primary { background: var(--blue-600); color: var(--white); box-shadow: 0 2px 8px rgba(42, 134, 196, .3); }
.btn-primary:hover { background: var(--blue-700); }
.btn-ghost { background: var(--white); color: var(--blue-700); border-color: var(--line); }
.btn-ghost:hover { background: var(--blue-50); border-color: var(--blue-300); }
.btn-success { background: var(--ok); color: var(--white); }
.btn-success:hover { filter: brightness(.95); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { filter: brightness(.95); }
.btn-danger-ghost { background: var(--white); color: var(--danger); border-color: #f3caca; }
.btn-danger-ghost:hover { background: var(--danger-bg); }
.btn-white { background: var(--white); color: var(--blue-700); }
.btn-white-ghost { background: rgba(255, 255, 255, .15); color: var(--white); border-color: rgba(255, 255, 255, .45); }
.btn-white-ghost:hover { background: rgba(255, 255, 255, .25); }
.btn-sm { padding: .42rem .75rem; font-size: .83rem; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { padding: .9rem 1.25rem; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; }
.btn-row-fill > * { flex: 1; }
.link { font-weight: 600; }

/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: .95rem; margin: 0; }
.field { display: flex; flex-direction: column; gap: .35rem; margin: 0; min-width: 0; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--blue-900); }
.field-inline { flex-direction: row; align-items: center; gap: .5rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=month],
input[type=datetime-local], input[type=search], input[type=number], select, textarea {
    width: 100%; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
    font: inherit; font-size: 16px; color: var(--ink); background: var(--white); transition: border-color .15s, box-shadow .15s;
    min-height: 44px;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(77, 168, 218, .18); outline: none; }
input[readonly] { background: var(--blue-50); }
.field-error { color: var(--danger); font-size: .8rem; margin: 0; font-weight: 500; }
.hint { font-size: .8rem; color: var(--ink-soft); margin: 0; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 2.2rem; }
.input-suffix span { position: absolute; right: .85rem; top: 50%; transform: translateY(-50%); color: var(--ink-soft); font-weight: 600; }
.form-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .5rem; flex-wrap: wrap; }
.form-actions-stack { flex-direction: column; }
.check { display: flex; gap: .65rem; align-items: flex-start; font-size: .92rem; cursor: pointer; padding: .8rem; border-radius: var(--radius-sm); background: var(--blue-50); border: 1px solid var(--line); }
.check input { width: 20px; height: 20px; margin: .1rem 0 0; accent-color: var(--blue-600); flex-shrink: 0; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .85rem 1.1rem; }
.toolbar-group { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.toolbar input[type=date] { min-height: 38px; padding: .4rem .6rem; font-size: .9rem; width: auto; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { padding: .38rem .8rem; border-radius: 999px; background: var(--white); border: 1px solid var(--line); color: var(--ink); font-size: .83rem; font-weight: 550; }
.chip:hover { border-color: var(--blue-300); text-decoration: none; }
.chip.is-active { background: var(--blue-600); color: var(--white); border-color: var(--blue-600); }

.filters summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: .5rem; color: var(--blue-700); list-style: none; }
.filters summary::-webkit-details-marker { display: none; }
.filters-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .85rem; margin-top: 1rem; align-items: end; }
.filters-actions { display: flex; gap: .5rem; justify-content: flex-end; grid-column: -2 / -1; }

.month-nav { display: flex; align-items: center; gap: .5rem; }
.month-nav .icon-btn { width: 34px; height: 34px; }
.month-form { margin: 0; }
.month-form input { width: auto; min-height: 34px; padding: .3rem .5rem; font-size: .88rem; }
.month-label { display: none; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; margin: 0 -1.35rem; padding: 0 1.35rem; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); font-weight: 650; padding: .6rem .75rem; border-bottom: 1px solid var(--line); background: var(--blue-50); white-space: nowrap; }
.table th:first-child { border-top-left-radius: 8px; }
.table th:last-child { border-top-right-radius: 8px; }
.table td { padding: .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #fafdff; }
.table tfoot th { background: none; border-bottom: 0; font-size: .85rem; color: var(--blue-900); }
.table-compact td { padding: .5rem .75rem; }
.table .num { text-align: right; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; margin: 0; }
.table .actions .btn { margin-left: .25rem; }
.row-muted td { opacity: .55; }
.empty { color: var(--ink-soft); text-align: center; padding: 1.5rem .5rem; display: flex; justify-content: center; align-items: center; gap: .5rem; margin: 0; }
td.empty { display: table-cell; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 650; background: #edf1f4; color: var(--ink-soft); white-space: nowrap; }
.badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-approved { background: var(--ok-bg); color: var(--ok); }
.badge-declined { background: var(--danger-bg); color: var(--danger); }
.badge-admin { background: var(--blue-900); color: var(--white); }
.badge-agent { background: var(--blue-100); color: var(--blue-700); }

/* ---------- Alertes & toasts ---------- */
.alert { display: flex; align-items: center; gap: .65rem; padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: .92rem; font-weight: 500; border: 1px solid transparent; }
.alert span { flex: 1; }
.alert-success { background: var(--ok-bg); color: #13704b; border-color: #bfe8d6; }
.alert-error { background: var(--danger-bg); color: #a53434; border-color: #f4c4c4; }
.alert-info { background: var(--blue-100); color: var(--blue-900); border-color: var(--blue-300); }
.alert-close { background: none; border: 0; font-size: 1.3rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; padding: 0 .25rem; }
.alert-close:hover { opacity: 1; }
.toasts { position: fixed; right: 1.25rem; bottom: 1.25rem; display: flex; flex-direction: column; gap: .6rem; z-index: 100; max-width: min(380px, calc(100vw - 2.5rem)); }
.toast { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1rem 1.1rem; border-left: 4px solid var(--blue-500); animation: slidein .3s ease; display: flex; gap: .75rem; align-items: flex-start; }
.toast .icon { color: var(--blue-600); margin-top: 2px; }
.toast strong { display: block; color: var(--blue-900); }
.toast p { margin: .15rem 0 0; font-size: .87rem; color: var(--ink-soft); }
.toast-close { margin-left: auto; background: none; border: 0; cursor: pointer; font-size: 1.2rem; color: var(--ink-soft); line-height: 1; }
@keyframes slidein { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Listes ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .75rem .25rem; border-bottom: 1px solid var(--line); color: var(--ink); }
.list li:last-child .list-item, .list li.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--blue-50); text-decoration: none; border-radius: 8px; }
.list-item > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.list-right { display: flex; align-items: center; gap: .6rem; }
.amount { font-weight: 700; color: var(--blue-900); white-space: nowrap; }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .7rem; }
.bars li { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: .75rem; font-size: .88rem; }
.bars-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars-track { height: 8px; background: var(--blue-50); border-radius: 4px; overflow: hidden; }
.bars-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue-300), var(--blue-600)); border-radius: 4px; transition: width .6s ease; }
.bars-value { font-weight: 650; white-space: nowrap; }

/* ---------- Graphes ---------- */
.chart { position: relative; height: 280px; }
.chart-sm { height: 200px; margin-bottom: 1rem; }
.chart canvas { width: 100%; height: 100%; display: block; }
.chart-tip { position: absolute; pointer-events: none; background: var(--blue-900); color: var(--white); padding: .45rem .65rem; border-radius: 8px; font-size: .78rem; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: var(--shadow-lg); z-index: 2; }
.legend { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: .82rem; color: var(--ink-soft); margin-top: .75rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-primary { background: var(--blue-600); }
.dot-danger { background: var(--danger); }

/* ---------- Étoiles ---------- */
.stars { display: flex; flex-wrap: wrap; gap: 4px; padding: .9rem 1rem; background: linear-gradient(135deg, #fffaf0, #fff); border: 1px solid #f8e7b9; border-radius: var(--radius-sm); align-items: center; min-height: 58px; }
.star .icon { width: 28px; height: 28px; }
.star-full { color: var(--star); }
.star-full .icon { fill: var(--star); }
.star-pending { color: var(--star); opacity: .75; }
.star-full { animation: pop .35s ease backwards; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.stars-extra { font-weight: 750; color: var(--warn); margin-left: .35rem; }
.star-mini { display: inline-flex; }
.star-mini .icon { width: 16px; height: 16px; }

/* ---------- PIN ---------- */
.pin-card { text-align: center; padding: 2rem 1.75rem; }
.pin-card h2 { font-size: 1.2rem; margin-bottom: .35rem; }
.pin-form { max-width: 300px; margin: 1.25rem auto .75rem; text-align: left; }
.pin-input { text-align: center; font-size: 1.6rem !important; letter-spacing: .5em; font-weight: 700; }
.big-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--blue-100); color: var(--blue-700); margin-bottom: 1rem; }
.big-icon .icon { width: 30px; height: 30px; }
.big-icon-muted { background: #eef2f5; color: var(--ink-soft); }
.lock-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin: 1rem 0 0; padding-top: 1rem; border-top: 1px dashed var(--line); }

/* ---------- Liens de vente ---------- */
.pack-picker { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.pack-picker legend { font-size: .85rem; font-weight: 600; color: var(--blue-900); margin-bottom: .4rem; padding: 0; }
.pack-option { display: block; cursor: pointer; }
.pack-option input { position: absolute; opacity: 0; pointer-events: none; }
.pack-option-body { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .8rem 1rem; border: 2px solid var(--line); border-radius: var(--radius-sm); transition: border-color .15s, background .15s; }
.pack-option input:checked + .pack-option-body { border-color: var(--blue-500); background: var(--blue-50); }
.pack-option input:focus-visible + .pack-option-body { outline: 3px solid var(--blue-300); }
.pack-option-price { font-weight: 750; color: var(--blue-700); white-space: nowrap; }
.links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .85rem; }
.link-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; display: flex; flex-direction: column; gap: .7rem; background: var(--white); }
.link-card.is-fresh { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(77, 168, 218, .2); }
.link-card.is-expired { opacity: .5; }
.link-card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.link-url input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem !important; min-height: 38px; color: var(--ink-soft); }
.countdown { display: inline-flex; align-items: center; gap: .3rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--blue-700); background: var(--blue-100); padding: .2rem .6rem; border-radius: 999px; font-size: .85rem; }
.countdown.is-low { color: var(--danger); background: var(--danger-bg); }

/* ---------- Détails vente ---------- */
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; margin: 0; }
.details-grid dt { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); font-weight: 600; margin-bottom: .15rem; }
.details-grid dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.span-2 { grid-column: span 2; }
.signature-view { background: var(--blue-50); border: 1px dashed var(--blue-300); border-radius: var(--radius-sm); padding: 1rem; text-align: center; }
.signature-view img { max-height: 180px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--blue-100); display: flex; flex-direction: column; gap: .9rem; }
.timeline li { position: relative; display: flex; flex-direction: column; gap: .15rem; }
.timeline li::before { content: ""; position: absolute; left: calc(-1rem - 6px); top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue-500); border: 2px solid var(--white); }

/* ---------- Agenda ---------- */
.agenda { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .7rem; }
.agenda li { display: flex; gap: .85rem; align-items: center; }
.agenda-date { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 50px; height: 52px; border-radius: 10px; background: var(--blue-100); color: var(--blue-700); flex-shrink: 0; line-height: 1.1; }
.agenda-date strong { font-size: 1.15rem; }
.agenda-date small { font-size: .7rem; text-transform: uppercase; }
.agenda-body { display: flex; flex-direction: column; min-width: 0; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { text-align: center; font-size: .72rem; font-weight: 650; color: var(--ink-soft); padding: .3rem 0; text-transform: uppercase; }
.cal-cell { aspect-ratio: 1 / .8; border-radius: 8px; background: var(--blue-50); color: var(--ink); padding: .35rem .45rem; display: flex; flex-direction: column; justify-content: space-between; font-size: .85rem; min-width: 0; }
.cal-cell:hover { text-decoration: none; background: var(--blue-100); }
.cal-empty { background: transparent; }
.cal-cell.is-today { outline: 2px solid var(--blue-500); background: var(--white); font-weight: 700; }
.cal-cell.has-items { background: var(--blue-100); }
.cal-count { align-self: flex-end; background: var(--blue-600); color: var(--white); border-radius: 999px; font-size: .7rem; font-weight: 700; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; }
.day-title { font-size: .85rem; color: var(--blue-700); margin: 1.1rem 0 .5rem; text-transform: capitalize; }
.day-title:first-of-type { margin-top: 0; }
.appt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.appt { display: flex; gap: .9rem; align-items: flex-start; padding: .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.appt.is-past { opacity: .55; }
.appt-time { font-weight: 750; color: var(--blue-700); background: var(--blue-100); padding: .3rem .55rem; border-radius: 8px; font-variant-numeric: tabular-nums; }
.appt-body { flex: 1; min-width: 0; }
.appt-meta { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .83rem; color: var(--ink-soft); margin-top: .2rem; }
.appt-meta span { display: inline-flex; align-items: center; gap: .3rem; }
.appt-note { font-size: .85rem; margin: .45rem 0 0; color: var(--ink-soft); }
.appt-actions { display: flex; gap: .3rem; }
.appt-actions form { margin: 0; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; }
.pagination-info { font-size: .88rem; color: var(--ink-soft); }

/* ---------- Pages publiques ---------- */
.public { background: linear-gradient(160deg, var(--blue-100) 0%, var(--blue-50) 45%, var(--white) 100%); min-height: 100vh; }
.public-wrap { max-width: 640px; margin: 0 auto; padding: 2.5rem 1rem 2rem; display: flex; flex-direction: column; gap: 1rem; min-height: 100vh; justify-content: center; }
.public-card { padding: 2rem; border-radius: 20px; box-shadow: var(--shadow-lg); }
.public-foot { text-align: center; font-size: .78rem; color: var(--ink-soft); margin: .5rem 0 0; }
.login-card { max-width: 420px; width: 100%; margin: 0 auto; }
.login-head { text-align: center; margin-bottom: 1.5rem; }
.login-head .brand-mark { margin: 0 auto .75rem; display: grid; }
.order-head { text-align: center; padding-bottom: 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.order-kicker { text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; color: var(--blue-600); font-weight: 700; margin-bottom: .35rem; }
.order-pack { font-size: 1.45rem; }
.order-amount { font-size: 2.2rem; font-weight: 800; color: var(--blue-700); margin: .35rem 0 0; letter-spacing: -.02em; }
.thanks .big-icon { width: 84px; height: 84px; background: var(--ok-bg); color: var(--ok); animation: pop .4s ease; }
.thanks .big-icon .icon { width: 42px; height: 42px; }

.signature-pad { position: relative; border: 2px dashed var(--blue-300); border-radius: var(--radius-sm); background: var(--blue-50); height: 190px; touch-action: none; overflow: hidden; }
.signature-pad canvas { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.signature-pad.is-signed { border-style: solid; border-color: var(--blue-500); background: var(--white); }
.signature-hint { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--blue-300); font-weight: 600; pointer-events: none; font-size: .95rem; }
.signature-pad.is-signed .signature-hint { display: none; }
.signature-clear { position: absolute; top: .5rem; right: .5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
    .grid-main, .grid-aside, .grid-aside-left { grid-template-columns: minmax(0, 1fr); }
    .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.is-open { transform: none; }
    .sidebar-backdrop.is-open { display: block; position: fixed; inset: 0; background: rgba(11, 59, 92, .35); z-index: 35; }
    .main { margin-left: 0; }
    .burger { display: inline-grid; }
    .user-meta { display: none; }
    .topbar { padding: .7rem 1rem; }
    .content { padding: 1rem 1rem 2.5rem; }
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .table-wrap { margin: 0 -1rem; padding: 0 1rem; }
    .card { padding: 1.1rem 1rem; }
}
@media (max-width: 600px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-3 > :nth-child(2) { grid-column: 2; }
    .grid-3 > :nth-child(3) { grid-column: 1 / -1; }
    .kpis, .kpis-4, .kpis-inline { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .kpi-value { font-size: 1.25rem; }
    .kpi-icon { display: none; }
    .details-grid { grid-template-columns: minmax(0, 1fr); }
    .span-2 { grid-column: auto; }
    .public-card { padding: 1.5rem 1.15rem; }
    .public-wrap { padding: 1rem .75rem; justify-content: flex-start; }
    .order-amount { font-size: 1.9rem; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .filters-actions { grid-column: 1 / -1; }
    .bars li { grid-template-columns: 80px 1fr auto; }
    .page-title { font-size: 1.05rem; }
    .welcome { padding: 1.25rem; }
    .star .icon { width: 24px; height: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
    .sidebar, .topbar, .page-actions, .btn, form { display: none !important; }
    .main { margin: 0; }
}

/* ---------- Assistant d'installation ---------- */
.install-card { max-width: 620px; width: 100%; margin: 0 auto; }
.install-step { font-size: 1rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.checklist { list-style: none; margin: 0 0 1.25rem; padding: .85rem 1rem; background: var(--blue-50); border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: .4rem; font-size: .88rem; }
.checklist li { display: flex; gap: .5rem; align-items: flex-start; }
.checklist .icon { margin-top: 3px; }
.checklist .is-ok .icon { color: var(--ok); }
.checklist .is-ko { color: var(--danger); }
.checklist small { color: var(--ink-soft); }
input[type=url] { width: 100%; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; font-size: 16px; color: var(--ink); background: var(--white); min-height: 44px; }

/* ---------- Remboursements, paie, agents ---------- */
.badge-refunded { background: #efe7fb; color: #6b3fb5; }
.btn-warn { background: #fff; color: #6b3fb5; border-color: #dccbf5; }
.btn-warn:hover { background: #f6f0fe; }
.badge-freelance { background: #fff1e0; color: #b3610b; }
.badge-salaried { background: var(--blue-100); color: var(--blue-700); }
.badge-paid { background: var(--ok-bg); color: var(--ok); }
.badge-draft { background: var(--warn-bg); color: var(--warn); }
.tabs { display: flex; gap: .35rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab { padding: .65rem 1rem; font-weight: 600; color: var(--ink-soft); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--blue-700); text-decoration: none; }
.tab.is-active { color: var(--blue-700); border-bottom-color: var(--blue-600); }
.progress { height: 8px; background: var(--blue-50); border-radius: 4px; overflow: hidden; min-width: 90px; }
.progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue-300), var(--blue-600)); border-radius: 4px; transition: width .6s ease; }
.progress.is-done > span { background: linear-gradient(90deg, #7fd8b3, var(--ok)); }
.pay-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; margin: 0; }
.pay-form input { width: 110px; min-height: 34px; padding: .35rem .5rem; font-size: .85rem; }
.pay-form input.pay-note { width: 150px; }
.drift { display: inline-flex; gap: .3rem; align-items: center; font-size: .78rem; color: var(--warn); background: var(--warn-bg); padding: .15rem .5rem; border-radius: 999px; margin-top: .25rem; }
.note-chips { display: flex; gap: .3rem; flex-wrap: wrap; }
.note-type-absent { background: var(--danger-bg); color: var(--danger); }
.note-type-late { background: var(--warn-bg); color: var(--warn); }
.note-type-warning { background: #ffe9dc; color: #b8531a; }
.note-type-praise { background: var(--ok-bg); color: var(--ok); }
.note-type-performance { background: var(--blue-100); color: var(--blue-700); }
.note-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.note-item { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.note-item .note-body { flex: 1; min-width: 0; }
.note-item p { margin: .25rem 0 0; font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.earn-card { display: flex; flex-direction: column; gap: .5rem; padding: 1rem; border-radius: var(--radius-sm); background: linear-gradient(135deg, #f3fbf7, #fff); border: 1px solid #cdeedd; margin-top: 1rem; }
.earn-card strong.big { font-size: 1.4rem; color: var(--ok); }
.settings-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: .75rem; align-items: end; }
@media (max-width: 900px) { .settings-form { grid-template-columns: minmax(0, 1fr); } .kpis-inline { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpis-inline.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 600px) { .kpis-inline.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
