:root {
    --bg: #eef3fb;
    --bg-soft: #f7f9fd;
    --card: #ffffff;
    --card-soft: #f8fafc;
    --text: #172033;
    --muted: #667085;
    --muted-2: #98a2b3;
    --border: #d9e2ef;
    --primary: #1d4ed8;
    --primary-2: #2563eb;
    --primary-soft: #dbeafe;
    --danger: #b42318;
    --danger-soft: #fee4e2;
    --ok: #067647;
    --ok-soft: #dcfae6;
    --warn: #b54708;
    --warn-soft: #fef0c7;
    --shadow: 0 14px 35px rgba(15, 23, 42, .08);
    --radius: 20px;
    --sidebar: #0b1220;
    --sidebar-2: #101b30;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .12), transparent 34rem),
        linear-gradient(145deg, #eef3fb 0%, #f8fafc 48%, #eef6ff 100%);
    color: var(--text);
    font-size: 15px;
}

a { color: inherit; }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 286px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px 18px;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(16, 27, 48, .98), rgba(11, 18, 32, .98)),
        radial-gradient(circle at top, rgba(59, 130, 246, .35), transparent 20rem);
    box-shadow: 12px 0 40px rgba(15, 23, 42, .18);
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    color: #fff;
    font-weight: 800;
    letter-spacing: .02em;
    box-shadow: 0 12px 28px rgba(37, 99, 235, .35);
}
.brand strong { display: block; font-size: 1rem; line-height: 1.2; }
.brand span { display: block; color: rgba(255,255,255,.68); font-size: .78rem; margin-top: 2px; }

.side-nav {
    display: grid;
    gap: 6px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 44px;
    padding: 10px 12px;
    color: rgba(255,255,255,.82);
    text-decoration: none;
    border-radius: 14px;
    transition: background .18s ease, transform .18s ease, color .18s ease;
}
.nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.08);
    transform: translateX(2px);
}
.nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(37,99,235,.9), rgba(59,130,246,.74));
    box-shadow: 0 10px 24px rgba(37,99,235,.28);
}
.nav-icon {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 10px;
    background: rgba(255,255,255,.1);
    font-size: .9rem;
}
.nav-link.active .nav-icon { background: rgba(255,255,255,.22); }

.sidebar-card {
    margin-top: auto;
    padding: 14px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 18px;
    background: rgba(255,255,255,.06);
    color: rgba(255,255,255,.75);
}
.sidebar-card p { margin: 9px 0 0; line-height: 1.4; font-size: .84rem; }

.app-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 32px;
    background: rgba(248,250,252,.82);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(217,226,239,.72);
}
.topbar h1 {
    margin: 0;
    font-size: clamp(1.45rem, 1.9vw, 2.1rem);
    letter-spacing: -.035em;
}
.eyebrow {
    margin: 0 0 4px;
    color: var(--primary);
    font-size: .78rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.topbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

main {
    width: 100%;
    max-width: 1420px;
    margin: 0 auto;
    padding: 26px 32px 44px;
}

.card, .hero-card {
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(217,226,239,.9);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.hero-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    overflow: hidden;
    position: relative;
    background:
        linear-gradient(135deg, rgba(255,255,255,.97), rgba(239,246,255,.94)),
        radial-gradient(circle at right, rgba(37,99,235,.18), transparent 24rem);
}
.hero-card:after {
    content: "";
    position: absolute;
    right: -60px;
    top: -80px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(37,99,235,.18), transparent 68%);
    pointer-events: none;
}
.hero-card h2 {
    margin: 10px 0 8px;
    font-size: clamp(1.6rem, 2.4vw, 2.45rem);
    letter-spacing: -.045em;
}
.hero-card p { margin: 0; max-width: 780px; color: var(--muted); line-height: 1.55; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; z-index: 1; }

h2 { margin: 0 0 12px; font-size: 1.22rem; letter-spacing: -.025em; }
h3 { margin: 18px 0 10px; font-size: 1rem; }
p { line-height: 1.5; }

.grid, .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.dashboard-grid { margin-bottom: 20px; }
.two-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
    gap: 20px;
}

.kpi, .stat-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, #fff, var(--card-soft));
}
.kpi strong, .stat-card strong {
    display: block;
    font-size: 1.55rem;
    line-height: 1.1;
    margin-top: 8px;
    letter-spacing: -.03em;
}
.stat-card {
    min-height: 132px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, .05);
}
.stat-card span { color: var(--muted); font-weight: 700; }
.stat-card small { display: block; color: var(--muted); margin-top: 10px; }
.stat-card.accent { border-color: #bfdbfe; background: linear-gradient(135deg, #ffffff, #eff6ff); }
.stat-card.success { border-color: #bbf7d0; background: linear-gradient(135deg, #ffffff, #ecfdf3); }
.stat-card.warning { border-color: #fedf89; background: linear-gradient(135deg, #ffffff, #fffbeb); }

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.section-head p { margin: 2px 0 0; }
.quick-actions {
    display: grid;
    gap: 10px;
}
.quick-actions a {
    display: block;
    padding: 14px 15px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    text-decoration: none;
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.quick-actions a:hover {
    border-color: #93c5fd;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, .07);
}
.quick-actions strong { display: block; margin-bottom: 4px; }
.quick-actions span { color: var(--muted); font-size: .9rem; }
.status-panel {
    display: grid;
    gap: 7px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--card-soft);
}
.status-panel.empty { background: #fffbeb; border-color: #fedf89; }
.status-panel strong { font-size: 1.05rem; }
.status-panel small { color: var(--muted); }
.mini-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.mini-metrics div {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}
.mini-metrics span { display: block; color: var(--muted); font-size: .82rem; }
.mini-metrics strong { display: block; margin-top: 4px; }

.table-wrap {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #fff;
}
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #475467;
    font-weight: 750;
    background: #f8fafc;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .035em;
}
tbody tr:last-child td { border-bottom: 0; }
tr:hover td { background: #f8fbff; }

form.inline { display: inline; }
label { display: block; color: #475467; font-size: .86rem; font-weight: 700; margin-bottom: 6px; }
input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cfd8e7;
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, .18);
}
textarea { min-height: 86px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.form-grid .wide { grid-column: span 2; }
.actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 0;
    border-radius: 13px;
    padding: 10px 15px;
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    color: white;
    text-decoration: none;
    cursor: pointer;
    font-weight: 750;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .18);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
button:hover, .button:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(37,99,235,.22); }
button.secondary, .button.secondary {
    background: #fff;
    color: #344054;
    border: 1px solid #cfd8e7;
    box-shadow: none;
}
button.secondary:hover, .button.secondary:hover { border-color: #93c5fd; box-shadow: 0 8px 16px rgba(15,23,42,.06); }
button.danger, .button.danger { background: linear-gradient(135deg, #d92d20, var(--danger)); box-shadow: 0 8px 18px rgba(180,35,24,.15); }

.badge, .pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
    line-height: 1;
}
.pill { background: var(--primary-soft); color: var(--primary); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.muted { color: var(--muted); }
.notice, .error {
    padding: 13px 15px;
    border-radius: 16px;
    margin-bottom: 18px;
    box-shadow: 0 8px 18px rgba(15,23,42,.04);
}
.notice { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.error { background: #fff1f3; border: 1px solid #fecdd3; color: var(--danger); }

/* V0.4 */
.mini-form {
    display: grid;
    gap: .45rem;
    min-width: 280px;
    padding: .75rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}
.mini-form input,
.mini-form select { width: 100%; padding: .48rem .55rem; }
details summary { cursor: pointer; color: var(--primary); font-weight: 750; }

/* V0.5.1 - lignes de ticket dynamiques */
.ticket-line-toolbar { margin: 14px 0; }
.ticket-lines .line-select { width: 78px; text-align: center; }
.ticket-lines .line-select input[type="radio"] { width: auto; transform: scale(1.15); }
.ticket-lines .line-number { width: 42px; color: var(--muted); font-weight: 750; }
.ticket-lines tbody tr:has(input[type="radio"]:checked) td { background: #eff6ff; }
.ticket-lines input { min-width: 110px; }
.ticket-lines td:nth-child(3) input { min-width: 260px; }

@media (max-width: 1180px) {
    .app-shell { grid-template-columns: 240px minmax(0, 1fr); }
    .dashboard-grid, .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .two-columns { grid-template-columns: 1fr; }
}

@media (max-width: 850px) {
    .app-shell { display: block; }
    .sidebar {
        position: relative;
        height: auto;
        padding: 16px;
        border-radius: 0 0 24px 24px;
    }
    .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sidebar-card { display: none; }
    .topbar { position: relative; flex-direction: column; align-items: flex-start; padding: 18px 16px; }
    main { padding: 18px 16px 30px; }
    .hero-card { flex-direction: column; align-items: flex-start; }
    .grid, .dashboard-grid, .form-grid, .mini-metrics { grid-template-columns: 1fr; }
    .form-grid .wide { grid-column: auto; }
}

@media print {
    body { background: #fff; }
    .sidebar, .topbar, .actions, .hero-card, .button, button { display: none !important; }
    .app-shell, .app-main { display: block; }
    main { max-width: none; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
}

/* V0.7.2 - saisie plus rapide et analyse visuelle des prix */
.ticket-entry-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 12px 0 14px;
}
.ticket-entry-summary div {
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, #fff, var(--card-soft));
}
.ticket-entry-summary span,
.ticket-entry-summary small {
    display: block;
    color: var(--muted);
    font-size: .82rem;
}
.ticket-entry-summary strong {
    display: block;
    margin-top: 5px;
    font-size: 1.15rem;
    letter-spacing: -.02em;
}
.checkline {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid #cfd8e7;
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font-weight: 650;
}
.checkline input { width: auto; }
.price-chart {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    overflow-x: auto;
}
.price-chart svg {
    display: block;
    width: 100%;
    min-width: 720px;
    height: auto;
}
.chart-grid {
    stroke: #d9e2ef;
    stroke-width: 1;
}
.chart-line {
    fill: none;
    stroke: var(--primary);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.chart-points circle {
    fill: #fff;
    stroke: var(--primary-2);
    stroke-width: 3;
}
.chart-label {
    fill: var(--muted);
    font-size: 13px;
    font-weight: 700;
}
.chart-date { font-size: 12px; }

@media (max-width: 850px) {
    .ticket-entry-summary { grid-template-columns: 1fr; }
}

/* V0.7.3 - correction des produits non reconnus sans quitter les tickets */
body.modal-open { overflow: hidden; }
.row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.modal-backdrop[hidden] { display: none !important; }
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
    background: rgba(15, 23, 42, .48);
    backdrop-filter: blur(6px);
}
.side-drawer {
    width: min(720px, 100vw);
    height: 100vh;
    overflow-y: auto;
    padding: 24px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border-left: 1px solid var(--border);
    box-shadow: -22px 0 44px rgba(15, 23, 42, .22);
    animation: drawerIn .18s ease-out;
}
@keyframes drawerIn {
    from { transform: translateX(32px); opacity: .85; }
    to { transform: translateX(0); opacity: 1; }
}
.drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin-top: 10px; }
.drawer-close {
    min-width: 42px;
    width: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 14px;
    font-size: 1.35rem;
}
.drawer-context {
    display: grid;
    gap: 5px;
    margin-bottom: 16px;
    padding: 14px 15px;
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    background: #eff6ff;
}
.drawer-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.drawer-form-grid .wide { grid-column: span 2; }
.drawer-note {
    display: grid;
    gap: 4px;
    margin-top: 16px;
    padding: 14px 15px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
}
.drawer-note span { color: var(--muted); line-height: 1.45; }
.drawer-actions {
    position: sticky;
    bottom: 0;
    margin: 18px -24px -24px;
    padding: 16px 24px;
    background: rgba(248,250,252,.94);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
}
@media (max-width: 850px) {
    .side-drawer { width: 100vw; padding: 18px; }
    .drawer-form-grid { grid-template-columns: 1fr; }
    .drawer-form-grid .wide { grid-column: auto; }
    .drawer-actions { margin: 18px -18px -18px; padding: 14px 18px; }
}

/* V0.7.4 - traitement mensuel plus lisible */
.treatment-hero {
    align-items: stretch;
}
.treatment-status-box {
    min-width: 270px;
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 18px;
    border: 1px solid #bfdbfe;
    border-radius: 18px;
    background: rgba(255,255,255,.78);
    z-index: 1;
}
.treatment-status-box span { color: var(--muted); font-weight: 750; }
.treatment-status-box strong { font-size: 1.15rem; }
.treatment-status-box small { color: var(--muted); }
.period-switcher {
    display: grid;
    grid-template-columns: minmax(180px, 240px) auto;
    gap: 12px;
    align-items: end;
}
.period-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.treatment-metrics { margin-bottom: 20px; }
.warning-card {
    border-color: #fedf89;
    background: linear-gradient(135deg, #ffffff, #fffbeb);
}
.action-card {
    background: linear-gradient(135deg, #ffffff, #f8fbff);
}
.calculation-card {
    border-color: #bfdbfe;
}
.beneficiaire-param-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.beneficiaire-param-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
}
.beneficiaire-param-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.beneficiaire-param-head strong {
    font-size: 1.02rem;
}
.form-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
button:disabled, .button.disabled {
    cursor: not-allowed;
    filter: grayscale(.35);
    opacity: .55;
    transform: none !important;
    box-shadow: none !important;
}
.active-version-card {
    border-color: #bbf7d0;
    background: linear-gradient(135deg, #ffffff, #f0fdf4);
}
.beneficiary-results-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.beneficiary-result-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
}
.beneficiary-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.beneficiary-title h3 {
    margin: 0;
    font-size: 1.05rem;
}
.progress-wrap {
    width: 100%;
    height: 13px;
    margin: 14px 0 7px;
    overflow: hidden;
    border-radius: 999px;
    border: 1px solid #cfd8e7;
    background: #e5eaf2;
}
.progress-bar {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #60a5fa, var(--primary));
}
.cpam-print-area {
    border-color: #bfdbfe;
}
.print-beneficiaire {
    margin-top: 18px;
}
.print-beneficiaire h3 {
    padding-top: 4px;
    border-top: 1px solid var(--border);
}
.table-total td {
    font-weight: 800;
    background: #f8fafc;
}
@media (max-width: 980px) {
    .beneficiaire-param-grid,
    .beneficiary-results-grid {
        grid-template-columns: 1fr;
    }
    .period-switcher { grid-template-columns: 1fr; }
}
@media (max-width: 850px) {
    .form-grid.compact { grid-template-columns: 1fr; }
    .treatment-status-box { min-width: 0; width: 100%; }
}
@media print {
    body.print-cpam .card:not(.cpam-print-area) { display: none !important; }
    body.print-cpam .cpam-print-area { display: block !important; border: 0; box-shadow: none; }
    body.print-cpam .cpam-print-area .section-head button { display: none !important; }
    body.print-cpam .cpam-print-area .table-wrap { border: 0; overflow: visible; }
    body.print-cpam .cpam-print-area table { font-size: 11px; }
    body.print-cpam .cpam-print-area th,
    body.print-cpam .cpam-print-area td { padding: 5px 6px; }
}

/* V0.8.1 — finition visuelle premium + code-barres LPP */
:root {
    --premium-accent: #14b8a6;
    --premium-accent-soft: #ccfbf1;
    --violet-soft: #ede9fe;
}

.card, .hero-card {
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover, .hero-card:hover {
    border-color: rgba(37, 99, 235, .22);
    box-shadow: 0 18px 45px rgba(15, 23, 42, .10);
}
.dashboard-grid .kpi, .grid .kpi {
    position: relative;
    overflow: hidden;
}
.dashboard-grid .kpi:after, .grid .kpi:after {
    content: "";
    position: absolute;
    right: -24px;
    top: -24px;
    width: 72px;
    height: 72px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(37, 99, 235, .10), transparent 70%);
    pointer-events: none;
}
.table-wrap table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    backdrop-filter: blur(8px);
}
tr:hover td {
    background: rgba(219, 234, 254, .28);
}
.button, button {
    box-shadow: 0 10px 22px rgba(37, 99, 235, .14);
}
.button.secondary, button.secondary {
    box-shadow: none;
}
.badge {
    letter-spacing: .015em;
}
.barcode-block {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    color: #0f172a;
    min-width: 112px;
}
.barcode-svg {
    width: 148px;
    max-width: 100%;
    height: 54px;
    display: block;
}
.barcode-svg text {
    font: 700 9px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .08em;
    fill: currentColor;
}

.barcode-block {
    position: relative;
    cursor: zoom-in;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.barcode-block:hover,
.barcode-block:focus-visible,
.barcode-block.is-preview-source {
    border-color: rgba(37, 99, 235, .45);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
}
.barcode-block:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .18);
    outline-offset: 3px;
}
.barcode-zoom-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(5px);
}
.barcode-zoom-card {
    position: relative;
    display: grid;
    gap: 12px;
    justify-items: center;
    width: min(760px, 94vw);
    padding: 26px 24px 20px;
    border-radius: 24px;
    border: 1px solid rgba(226, 232, 240, .9);
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    box-shadow: 0 30px 80px rgba(15, 23, 42, .28);
}
.barcode-zoom-content {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 16px;
    border-radius: 18px;
    border: 1px dashed rgba(15, 23, 42, .18);
    background: #ffffff;
}
.barcode-zoom-content .barcode-svg {
    width: min(680px, 84vw);
    height: 190px;
    max-width: 100%;
}
.barcode-zoom-content .barcode-svg text {
    font-size: 11px;
    letter-spacing: .10em;
}
.barcode-zoom-hint {
    margin: 0;
    color: var(--muted);
    font-size: .86rem;
    text-align: center;
}
.barcode-zoom-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, .08);
    color: #0f172a;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
}
.barcode-zoom-close:hover {
    background: rgba(15, 23, 42, .14);
}
@media (max-width: 640px) {
    .barcode-zoom-card { padding: 22px 14px 16px; }
    .barcode-zoom-content .barcode-svg { height: 148px; }
}

.barcode-card {
    margin-top: 16px;
    display: inline-flex;
    flex-direction: column;
    gap: 7px;
    padding: 12px;
    border-radius: 16px;
    border: 1px dashed rgba(37, 99, 235, .28);
    background: rgba(219, 234, 254, .34);
}
.barcode-card > span:first-child {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.ticket-entry-summary {
    background: linear-gradient(135deg, rgba(29,78,216,.08), rgba(20,184,166,.10));
    border: 1px solid rgba(37,99,235,.15);
}
.ticket-lines tbody tr:has(input[type="radio"]:checked) td {
    background: rgba(20, 184, 166, .10);
    box-shadow: inset 3px 0 0 var(--premium-accent);
}
input:focus, select:focus, textarea:focus {
    outline: 3px solid rgba(37, 99, 235, .14);
    border-color: rgba(37, 99, 235, .55);
}
.side-drawer {
    box-shadow: -24px 0 70px rgba(15, 23, 42, .24);
}
.drawer-note {
    background: linear-gradient(135deg, rgba(237, 233, 254, .72), rgba(219, 234, 254, .7));
}
@media print {
    .barcode-zoom-backdrop { display: none !important; }
    .barcode-block {
        border: 0;
        padding: 0;
        background: transparent;
    }
    .barcode-svg {
        width: 120px;
        height: 46px;
    }
}

/* V0.8.2 — saisie accélérée sans scan : favoris par magasin et auto-complétion */
.smart-entry-panel {
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    padding: 16px;
    margin: 16px 0;
    border: 1px solid rgba(37, 99, 235, .16);
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(219, 234, 254, .68), rgba(240, 253, 250, .72)),
        #fff;
}
.smart-entry-panel h3 {
    margin: 8px 0 6px;
    font-size: 1.08rem;
}
.smart-favorites {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px;
    min-height: 42px;
}
.smart-favorite {
    display: grid;
    gap: 4px;
    align-content: start;
    width: 100%;
    min-height: 86px;
    padding: 11px 12px;
    text-align: left;
    border: 1px solid rgba(37, 99, 235, .18);
    border-radius: 16px;
    color: var(--text);
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.smart-favorite:hover,
.smart-favorite:focus {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, .38);
    box-shadow: 0 16px 30px rgba(37, 99, 235, .12);
}
.smart-favorite strong {
    font-size: .88rem;
    line-height: 1.22;
}
.smart-favorite span {
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.25;
}
.smart-favorite em {
    color: var(--ok);
    font-style: normal;
    font-weight: 800;
    font-size: .78rem;
}
.ticket-lines tbody tr.smart-filled td {
    background: rgba(220, 250, 230, .42);
}
.ticket-lines tbody tr.smart-filled td:first-child {
    box-shadow: inset 3px 0 0 var(--ok);
}
@media (max-width: 920px) {
    .smart-entry-panel {
        grid-template-columns: 1fr;
    }
}

/* V0.8.2.1 — confort de saisie ticket : favoris discrets et sauvegarde visible */
.ticket-form-head {
    align-items: center;
    gap: 16px;
}
.save-ticket-top {
    white-space: nowrap;
}
.ticket-save-card {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 6px;
    background: linear-gradient(135deg, rgba(29, 78, 216, .12), rgba(20, 184, 166, .12)) !important;
    border-color: rgba(37, 99, 235, .22) !important;
}
.ticket-save-card button {
    width: 100%;
    justify-content: center;
}
.ticket-save-card small {
    color: var(--muted);
    font-weight: 600;
}
.smart-entry-panel[style*="display:none"] {
    margin: 0;
    padding: 0;
    border: 0;
}
@media (max-width: 720px) {
    .ticket-form-head {
        align-items: stretch;
    }
    .save-ticket-top {
        width: 100%;
        justify-content: center;
    }
}

/* V0.8.2.2 — confort saisie ticket : actions explicites et favoris sans message central */
.ticket-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.ticket-form-actions button,
.ticket-form-actions .button {
    min-height: 42px;
}
.smart-entry-panel.smart-entry-panel-compact {
    grid-template-columns: 1fr;
    padding: 0;
    margin: 10px 0 14px;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.smart-entry-panel.smart-entry-panel-compact .smart-favorites {
    min-height: 0;
}
.ticket-form-bottom-actions {
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, .20);
}
.ticket-form-bottom-actions button {
    min-height: 44px;
}
.js-ticket-reset {
    border-color: rgba(148, 163, 184, .45) !important;
}
@media (max-width: 720px) {
    .ticket-form-actions,
    .ticket-form-bottom-actions {
        justify-content: stretch;
    }
    .ticket-form-actions button,
    .ticket-form-bottom-actions button {
        width: 100%;
        justify-content: center;
    }
}


/* V0.8.2.3 — optimisation écran portable 15,6 pouces */
@media (max-width: 1680px) {
    body {
        font-size: 14px;
    }
    .app-shell {
        grid-template-columns: 246px minmax(0, 1fr);
    }
    .sidebar {
        gap: 14px;
        padding: 18px 14px;
    }
    .brand {
        gap: 10px;
        padding: 8px 6px 14px;
    }
    .brand-mark {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }
    .brand strong {
        font-size: .94rem;
    }
    .brand span {
        font-size: .73rem;
    }
    .nav-link {
        min-height: 40px;
        padding: 8px 10px;
        border-radius: 13px;
        font-size: .93rem;
    }
    .nav-icon {
        width: 24px;
        height: 24px;
        flex-basis: 24px;
    }
    .sidebar-card {
        padding: 11px;
        border-radius: 16px;
    }
    .sidebar-card .pill {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.15;
    }
    .sidebar-card p {
        font-size: .78rem;
    }
    .topbar {
        padding: 18px 24px;
    }
    main {
        max-width: none;
        padding: 20px 24px 34px;
    }
    .card, .hero-card {
        padding: 18px;
        margin-bottom: 16px;
        border-radius: 18px;
    }
    .form-grid {
        gap: 10px;
    }
    .ticket-entry-summary {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 9px;
    }
    .ticket-entry-summary div {
        padding: 10px 11px;
        border-radius: 14px;
    }
    .ticket-entry-summary strong {
        font-size: 1rem;
    }
    th, td {
        padding: 8px 9px;
    }
    input, select, textarea {
        padding: 8px 10px;
        border-radius: 10px;
    }
    button, .button {
        min-height: 38px;
        padding: 9px 12px;
        border-radius: 12px;
    }
    .ticket-line-toolbar {
        gap: 8px;
        margin: 10px 0 12px;
    }
    .ticket-line-toolbar .muted {
        font-size: .82rem;
    }
}

@media (max-width: 1450px) {
    .app-shell {
        grid-template-columns: 220px minmax(0, 1fr);
    }
    .sidebar {
        padding: 16px 12px;
    }
    .brand span {
        display: none;
    }
    .nav-link {
        gap: 9px;
        font-size: .9rem;
    }
    .topbar {
        padding: 15px 18px;
        gap: 12px;
    }
    .topbar h1 {
        font-size: 1.42rem;
    }
    .eyebrow {
        font-size: .72rem;
    }
    main {
        padding: 16px 18px 28px;
    }
    .section-head {
        gap: 10px;
    }
    .ticket-form-head {
        align-items: flex-start;
    }
    .ticket-form-actions {
        gap: 8px;
    }
    .ticket-lines {
        table-layout: fixed;
        min-width: 1040px;
        font-size: .86rem;
    }
    .ticket-lines th,
    .ticket-lines td {
        padding: 7px 8px;
    }
    .ticket-lines input {
        min-width: 0 !important;
        width: 100%;
        padding: 7px 8px;
        font-size: .88rem;
    }
    .ticket-lines .line-select {
        width: 52px;
    }
    .ticket-lines .line-number {
        width: 34px;
    }
    .ticket-lines th:nth-child(1),
    .ticket-lines td:nth-child(1) { width: 54px; text-align: center; }
    .ticket-lines th:nth-child(2),
    .ticket-lines td:nth-child(2) { width: 38px; text-align: center; }
    .ticket-lines th:nth-child(3),
    .ticket-lines td:nth-child(3) { width: 300px; }
    .ticket-lines th:nth-child(4),
    .ticket-lines td:nth-child(4) { width: 72px; }
    .ticket-lines th:nth-child(5),
    .ticket-lines td:nth-child(5) { width: 98px; }
    .ticket-lines th:nth-child(6),
    .ticket-lines td:nth-child(6) { width: 112px; }
    .ticket-lines th:nth-child(7),
    .ticket-lines td:nth-child(7) { width: 126px; }
    .ticket-lines th:nth-child(8),
    .ticket-lines td:nth-child(8) { width: 160px; }
    .table-wrap {
        max-width: 100%;
    }
}

@media (max-height: 850px) and (min-width: 851px) {
    .sidebar {
        gap: 10px;
        padding-top: 14px;
        padding-bottom: 14px;
    }
    .brand {
        padding-bottom: 12px;
    }
    .nav-link {
        min-height: 38px;
        padding-top: 7px;
        padding-bottom: 7px;
    }
    .sidebar-card p {
        display: none;
    }
    .topbar {
        padding-top: 14px;
        padding-bottom: 14px;
    }
    .card, .hero-card {
        padding-top: 16px;
        padding-bottom: 16px;
    }
}

@media (max-width: 1180px) {
    .ticket-entry-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .ticket-entry-summary {
        grid-template-columns: 1fr;
    }
}

/* V0.8.3 - Nomenclature LPP */
.soft-alert {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid var(--primary-soft);
    border-radius: 16px;
    background: linear-gradient(180deg, #f8fbff, #eef6ff);
    color: #1e3a8a;
}
.dashboard-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin: 12px 0 18px;
}
.lpp-update-form .form-grid {
    align-items: end;
}
.filters {
    display: flex;
    gap: 10px;
    align-items: end;
    margin: 12px 0 16px;
}
.filters input {
    min-width: min(520px, 100%);
}
@media (max-width: 720px) {
    .filters {
        display: grid;
    }
    .filters input {
        min-width: 0;
        width: 100%;
    }
}

/* V0.8.5 — corrections guidées et saisie accélérée */
.todo-month-card { border-color: rgba(37, 99, 235, .16); }
.todo-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.todo-steps a { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 18px; background: #fff; color: var(--text); text-decoration: none; transition: .18s ease; }
.todo-steps a:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15, 23, 42, .08); border-color: rgba(37,99,235,.25); }
.todo-steps small { color: var(--muted); line-height: 1.35; }
.corrections-hero { background: linear-gradient(135deg, #fff7ed, #eff6ff 58%, #eef2ff); }
.corrections-grid .stat-card.warning { border-color: rgba(245, 158, 11, .35); }
.corrections-section .empty-state { padding: 16px; border: 1px dashed rgba(22, 163, 74, .25); border-radius: 18px; background: rgba(240, 253, 244, .72); display: flex; gap: 12px; align-items: center; }
.correction-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.correction-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 18px; background: #fff; }
.correction-card h3 { margin: 8px 0 4px; font-size: 1rem; }
.correction-card p { margin: 0; color: var(--muted); }
.star-button { width: 34px; height: 34px; border-radius: 999px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: #fff; color: #94a3b8; border: 1px solid var(--border); box-shadow: none; font-size: 1.05rem; }
.star-button.active { color: #d97706; background: #fffbeb; border-color: #fbbf24; }
.star-button:hover { color: #d97706; transform: translateY(-1px); }
.smart-favorites { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.smart-favorites-title { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: var(--muted); }
.smart-favorites-title strong { color: var(--text); }
.smart-favorite.is-starred { border-color: #fbbf24; background: linear-gradient(180deg, #fffbeb, #fff); }
.ticket-lines tr.price-changed td { background: #fffbeb; }
.price-alert { margin-top: 6px; padding: 7px 8px; border-radius: 12px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-size: .78rem; line-height: 1.25; }
.price-alert label { display: block; margin-top: 5px; color: #7c2d12; font-weight: 700; }
.price-alert input { width: auto; height: auto; margin-right: 5px; }
@media (max-width: 1280px) {
  .todo-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .smart-favorites { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .correction-cards { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .todo-steps, .smart-favorites { grid-template-columns: 1fr; }
  .correction-card { align-items: flex-start; flex-direction: column; }
}

/* V0.8.7 — assistant mensuel + impression CPAM premium */
.monthly-assistant {
    border-color: rgba(37, 99, 235, .18);
    background: linear-gradient(135deg, #ffffff, #f8fbff 56%, #f0fdfa);
}
.assistant-progress {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
    margin: 6px 0 16px;
}
.assistant-progress div {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--premium-accent), var(--primary));
}
.assistant-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.assistant-step {
    display: grid;
    gap: 8px;
    min-height: 160px;
    padding: 14px;
    color: var(--text);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(255,255,255,.86);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .05);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.assistant-step:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(15, 23, 42, .09);
    border-color: rgba(37, 99, 235, .28);
}
.assistant-step.ok { border-color: rgba(22, 163, 74, .28); }
.assistant-step.warn { border-color: rgba(245, 158, 11, .38); background: linear-gradient(180deg, #fff, #fffbeb); }
.assistant-step.danger { border-color: rgba(220, 38, 38, .32); background: linear-gradient(180deg, #fff, #fef2f2); }
.assistant-step-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .82rem; font-weight: 800; }
.assistant-step strong { font-size: 1rem; letter-spacing: -.01em; }
.assistant-step small { color: var(--muted); line-height: 1.35; }
.assistant-cta { margin-top: auto; color: var(--primary); font-weight: 850; font-size: .86rem; }
.badge.neutral { background: #e2e8f0; color: #475569; }
.no-print { display: flex; }
.premium-print { background: #fff; }
.print-document-head {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    border: 1px solid #dbeafe;
    border-radius: 20px;
    background: linear-gradient(135deg, #eff6ff, #ffffff 60%, #f0fdfa);
}
.print-document-head h2 { margin: 4px 0 5px; }
.print-eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .74rem; color: var(--primary); font-weight: 900; }
.print-lock {
    min-width: 180px;
    display: grid;
    place-content: center;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid rgba(20, 184, 166, .25);
    border-radius: 16px;
    background: #f0fdfa;
    color: #0f766e;
    font-weight: 900;
    text-align: center;
}
.print-lock small { color: #64748b; font-weight: 700; }
.print-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0 18px;
}
.print-summary-grid div {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
}
.print-summary-grid span { display: block; color: var(--muted); font-size: .8rem; }
.print-summary-grid strong { display: block; margin-top: 4px; font-size: 1.02rem; }
.print-beneficiaire { page-break-inside: avoid; }
.print-beneficiaire-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin: 20px 0 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.print-beneficiaire-head h3 { margin: 0 0 4px; }
.print-beneficiaire-head p { margin: 0; color: var(--muted); }
.print-beneficiaire-head > span {
    white-space: nowrap;
    padding: 8px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 850;
}
.print-footer-note {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: .86rem;
}
@media (max-width: 1320px) {
    .assistant-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .print-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .assistant-steps, .print-summary-grid { grid-template-columns: 1fr; }
    .print-document-head, .print-beneficiaire-head { flex-direction: column; align-items: flex-start; }
    .print-lock { width: 100%; }
}
@media print {
    body.print-cpam .no-print,
    body.print-cpam .section-head.no-print,
    body.print-cpam .sidebar,
    body.print-cpam .topbar { display: none !important; }
    body.print-cpam .app-shell,
    body.print-cpam .app-main,
    body.print-cpam main { display: block !important; padding: 0 !important; margin: 0 !important; }
    body.print-cpam .cpam-print-area {
        display: block !important;
        border: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    body.print-cpam .print-document-head,
    body.print-cpam .print-summary-grid div {
        border-color: #999 !important;
        background: #fff !important;
    }
    body.print-cpam .print-summary-grid { grid-template-columns: repeat(4, 1fr); }
    body.print-cpam .print-lock { background: #fff !important; border-color: #999 !important; color: #000 !important; }
    body.print-cpam .print-beneficiaire { break-inside: avoid; page-break-inside: avoid; }
    body.print-cpam .print-beneficiaire + .print-beneficiaire { page-break-before: auto; }
    body.print-cpam .cpam-print-area table { font-size: 10px !important; }
    body.print-cpam .cpam-print-area th,
    body.print-cpam .cpam-print-area td { padding: 4px 5px !important; }
    body.print-cpam .muted { color: #444 !important; }
}

/* V0.8.8 — saisie ticket en deux panneaux, optimisée PC sans ascenseur horizontal */
.ticket-saisie-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(280px, 30vw, 380px);
    gap: 16px;
    align-items: start;
    margin-top: 14px;
}
.ticket-panel {
    min-width: 0;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 20px;
    background: rgba(255,255,255,.88);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .06);
}
.ticket-panel-main {
    padding: 14px;
}
.ticket-panel-title,
.ticket-favorites-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.ticket-panel-title h3,
.ticket-favorites-head h3 {
    margin: 0 0 4px;
    font-size: 1.02rem;
}
.ticket-panel-title p,
.ticket-favorites-head p {
    margin: 0;
    font-size: .84rem;
}
.ticket-favorites-panel {
    position: sticky;
    top: 14px;
    max-height: min(760px, calc(100vh - 124px));
    overflow: hidden;
    padding: 14px;
    background: linear-gradient(180deg, rgba(248,250,252,.96), rgba(255,255,255,.98));
}
.ticket-favorite-search {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    font-size: .88rem;
    border-radius: 12px;
}
.ticket-favorites-panel .smart-favorites {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: calc(100vh - 278px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}
.ticket-favorites-panel .smart-favorites-title {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 0 0 4px;
    font-size: .82rem;
}
.ticket-favorites-panel .smart-favorite {
    min-height: auto;
    padding: 10px 11px;
    border-radius: 15px;
    box-shadow: none;
    background: rgba(255,255,255,.92);
}
.ticket-favorites-panel .smart-favorite strong {
    font-size: .86rem;
    line-height: 1.18;
}
.ticket-favorites-panel .smart-favorite span,
.ticket-favorites-panel .smart-favorite em {
    font-size: .75rem;
}
.smart-favorites-empty {
    padding: 12px;
    border: 1px dashed rgba(148, 163, 184, .38);
    border-radius: 14px;
    color: var(--muted);
    background: rgba(248, 250, 252, .9);
    font-size: .86rem;
}
.ticket-table-wrap {
    overflow-x: visible;
    border-radius: 16px;
}
.ticket-lines-compact {
    width: 100%;
    min-width: 0 !important;
    table-layout: fixed;
    font-size: .84rem;
}
.ticket-lines-compact th,
.ticket-lines-compact td {
    padding: 6px 6px;
    vertical-align: top;
}
.ticket-lines-compact input {
    width: 100%;
    min-width: 0 !important;
    padding: 7px 8px;
    font-size: .84rem;
    border-radius: 10px;
}
.ticket-lines-compact th:nth-child(1),
.ticket-lines-compact td:nth-child(1) { width: 40px; text-align: center; }
.ticket-lines-compact th:nth-child(2),
.ticket-lines-compact td:nth-child(2) { width: 32px; text-align: center; }
.ticket-lines-compact th:nth-child(4),
.ticket-lines-compact td:nth-child(4) { width: 54px; }
.ticket-lines-compact th:nth-child(5),
.ticket-lines-compact td:nth-child(5) { width: 82px; }
.ticket-lines-compact th:nth-child(6),
.ticket-lines-compact td:nth-child(6),
.ticket-lines-compact th:nth-child(7),
.ticket-lines-compact td:nth-child(7) {
    display: none;
}
.ticket-lines-compact th:nth-child(8),
.ticket-lines-compact td:nth-child(8) { width: 170px; }
.ticket-lines-compact tbody tr.is-active-line td,
.ticket-lines-compact tbody tr:has(input[type="radio"]:checked) td {
    background: rgba(20, 184, 166, .10);
    box-shadow: inset 3px 0 0 var(--premium-accent);
}
.ticket-lines-compact tbody tr.just-filled td {
    animation: ticketJustFilled .65s ease;
}
@keyframes ticketJustFilled {
    0% { background: rgba(34,197,94,.26); }
    100% { background: rgba(220,250,230,.42); }
}
.ticket-lines-compact .price-alert {
    max-width: 100%;
    overflow-wrap: anywhere;
}
.ticket-entry-summary {
    position: sticky;
    top: 0;
    z-index: 5;
}
@media (min-width: 1500px) {
    .ticket-lines-compact th:nth-child(6),
    .ticket-lines-compact td:nth-child(6),
    .ticket-lines-compact th:nth-child(7),
    .ticket-lines-compact td:nth-child(7) {
        display: table-cell;
    }
    .ticket-lines-compact th:nth-child(6),
    .ticket-lines-compact td:nth-child(6) { width: 96px; }
    .ticket-lines-compact th:nth-child(7),
    .ticket-lines-compact td:nth-child(7) { width: 110px; }
}
@media (max-width: 1180px) {
    .ticket-saisie-layout {
        grid-template-columns: 1fr;
    }
    .ticket-favorites-panel {
        position: static;
        max-height: none;
    }
    .ticket-favorites-panel .smart-favorites {
        max-height: 360px;
    }
}
@media (max-width: 760px) {
    .ticket-panel-main,
    .ticket-favorites-panel {
        padding: 10px;
        border-radius: 16px;
    }
    .ticket-lines-compact th:nth-child(1),
    .ticket-lines-compact td:nth-child(1) { width: 34px; }
    .ticket-lines-compact th:nth-child(2),
    .ticket-lines-compact td:nth-child(2) { width: 28px; }
    .ticket-lines-compact th:nth-child(4),
    .ticket-lines-compact td:nth-child(4) { width: 46px; }
    .ticket-lines-compact th:nth-child(5),
    .ticket-lines-compact td:nth-child(5) { width: 70px; }
    .ticket-lines-compact th:nth-child(8),
    .ticket-lines-compact td:nth-child(8) { display: none; }
}

/* V0.8.9 — liste des tickets saisis et correction ciblée */
.ticket-list-card .grid {
    margin: 14px 0 18px;
}
.ticket-list-wrap {
    overflow-x: visible;
}
.tickets-table {
    width: 100%;
    min-width: 0 !important;
    table-layout: fixed;
}
.tickets-table th,
.tickets-table td {
    vertical-align: middle;
}
.tickets-table th:nth-child(1),
.tickets-table td:nth-child(1) { width: 105px; }
.tickets-table th:nth-child(2),
.tickets-table td:nth-child(2) { width: 120px; }
.tickets-table th:nth-child(3),
.tickets-table td:nth-child(3) { width: 130px; }
.tickets-table th:nth-child(4),
.tickets-table td:nth-child(4) { width: 80px; }
.tickets-table th:nth-child(5),
.tickets-table td:nth-child(5) { width: 140px; }
.tickets-table th:nth-child(6),
.tickets-table td:nth-child(6) { width: 95px; text-align: right; }
.tickets-table th:nth-child(7),
.tickets-table td:nth-child(7) { width: 110px; }
.tickets-table th:nth-child(8),
.tickets-table td:nth-child(8) { width: 210px; }
.tickets-table tr.selected-ticket td {
    background: rgba(20, 184, 166, .10);
    box-shadow: inset 3px 0 0 var(--premium-accent);
}
.tickets-table .row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
}
.tickets-table .row-actions .button,
.tickets-table .row-actions button {
    padding: 7px 9px;
    min-height: 34px;
    font-size: .82rem;
}
@media (max-width: 1250px) {
    .tickets-table th:nth-child(3),
    .tickets-table td:nth-child(3),
    .tickets-table th:nth-child(7),
    .tickets-table td:nth-child(7) {
        display: none;
    }
    .tickets-table th:nth-child(8),
    .tickets-table td:nth-child(8) { width: 180px; }
}
@media (max-width: 900px) {
    .tickets-table,
    .tickets-table thead,
    .tickets-table tbody,
    .tickets-table tr,
    .tickets-table th,
    .tickets-table td {
        display: block;
        width: 100% !important;
    }
    .tickets-table thead { display: none; }
    .tickets-table tr {
        border: 1px solid rgba(148, 163, 184, .22);
        border-radius: 16px;
        margin-bottom: 10px;
        overflow: hidden;
        background: rgba(255,255,255,.96);
    }
    .tickets-table td {
        border: 0;
        padding: 8px 10px;
        text-align: left !important;
    }
}

/* V0.8.10.6 — progression import LPP */
.lpp-job-progress {
    width: 100%;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.10);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
    margin: 0.75rem 0 0.35rem;
}

.lpp-job-progress > div {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.35s ease;
}

/* V0.8.10.7 — lisibilité rapport LPP et actions Ameli */
.soft-alert,
.card,
details,
summary {
    min-width: 0;
}

.soft-alert {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.code-block {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #0f172a;
    color: #e5e7eb;
    font-size: .86rem;
    line-height: 1.45;
}

.lpp-check-actions {
    margin-top: 8px;
}

@media (max-width: 720px) {
    .lpp-check-actions {
        align-items: stretch;
    }
    .lpp-check-actions button,
    .lpp-check-actions .button {
        width: 100%;
    }
}

/* V0.8.10.9 — assistant UX mise à jour LPP lisible */
:root { --accent: #14b8a6; }
.section-head.compact { margin-bottom: 8px; }
.lpp-wizard-card {
    border-color: rgba(37, 99, 235, .18);
    background: linear-gradient(180deg, #fff, #f8fbff);
}
.lpp-steps-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.lpp-step-card {
    padding: 15px 16px;
    border: 1px solid var(--border);
    border-left-width: 5px;
    border-radius: 18px;
    background: linear-gradient(180deg, #fff, var(--card-soft));
    box-shadow: 0 10px 24px rgba(15, 23, 42, .04);
}
.lpp-step-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.lpp-step-line h3 {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin: 0;
    font-size: 1rem;
    line-height: 1.25;
}
.lpp-step-index {
    color: var(--primary);
    font-weight: 900;
}
.lpp-step-card p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.lpp-step-card.done { border-left-color: var(--ok); background: linear-gradient(180deg, #fff, #f0fdf4); }
.lpp-step-card.running { border-left-color: var(--warn); background: linear-gradient(180deg, #fff, #fffbeb); }
.lpp-step-card.error { border-left-color: var(--danger); background: linear-gradient(180deg, #fff, #fff1f3); }
.lpp-step-card.todo { border-left-color: #cbd5e1; }
@media (max-width: 720px) {
    .lpp-step-line { align-items: flex-start; flex-direction: column; }
}
.lpp-import-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 16px 0;
}
.lpp-import-options article {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, #fff, #f8fafc);
}
.lpp-import-options h3 { margin-top: 10px; }
.lpp-import-options p { margin-bottom: 0; color: var(--muted); }
.lpp-selected-files {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: rgba(248, 250, 252, .85);
    overflow-wrap: anywhere;
}
.lpp-preflight {
    margin: 16px 0;
    padding: 16px;
    border: 1px solid rgba(37, 99, 235, .16);
    border-radius: 18px;
    background: rgba(239, 246, 255, .55);
}
.lpp-checklist {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.lpp-check-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}
.lpp-check-item > strong {
    display: grid;
    place-items: center;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    font-size: .9rem;
}
.lpp-check-item.ok > strong { background: var(--ok-soft); color: var(--ok); }
.lpp-check-item.warn > strong { background: var(--warn-soft); color: var(--warn); }
.lpp-check-item.danger > strong { background: var(--danger-soft); color: var(--danger); }
.lpp-check-item span { min-width: 0; }
.lpp-check-item b { display: block; font-size: .9rem; }
.lpp-check-item small { display: block; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.lpp-next-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    padding: 14px;
    border: 1px solid rgba(6, 118, 71, .16);
    border-radius: 16px;
    background: rgba(220, 250, 230, .48);
}
.lpp-next-actions strong { margin-right: 4px; }
.lpp-next-actions span { color: var(--muted); }
.success-inline { border-color: rgba(6, 118, 71, .22); background: rgba(220, 250, 230, .54); }
.lpp-report-card details { margin-top: 12px; }
.lpp-job-card details { margin-top: 10px; }
@media (max-width: 760px) {
    .lpp-import-options,
    .lpp-checklist { grid-template-columns: 1fr; }
}

/* V1.0.1 - Mutuelle historisée */
.compact-actions {
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.close-contract-form {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
}
.close-contract-form input[type="date"] {
    min-width: 142px;
    padding: 8px 10px;
}
.mutuelle-rule-note {
    border-left: 4px solid var(--primary);
    padding-left: 12px;
}
@media (max-width: 900px) {
    .close-contract-form { flex-wrap: wrap; }
}

/* V1.0.2 - Optimisation globale CPAM + mutuelle et code-barres dans le dossier CPAM */
.cpam-print-barcode {
    min-width: 92px;
    max-width: 132px;
}
.cpam-print-barcode .barcode-block {
    padding: 4px 5px;
    border-radius: 8px;
    transform-origin: center center;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.cpam-print-barcode .barcode-svg {
    height: 34px;
    max-width: 116px;
}
.cpam-print-barcode .barcode-svg text {
    font-size: 8px;
}
.cpam-print-barcode .barcode-block:hover,
.cpam-print-barcode .barcode-block:focus-visible {
    position: relative;
    z-index: 50;
    transform: scale(1.9);
    background: #fff;
    box-shadow: 0 16px 36px rgba(15, 23, 42, .22);
}
@media print {
    body.print-cpam .cpam-print-barcode .barcode-block,
    body.print-cpam .cpam-print-barcode .barcode-block:hover,
    body.print-cpam .cpam-print-barcode .barcode-block:focus-visible {
        transform: none !important;
        box-shadow: none !important;
        border: 0 !important;
        padding: 0 !important;
    }
    body.print-cpam .cpam-print-barcode .barcode-svg {
        height: 28px !important;
        max-width: 104px !important;
    }
}

/* V1.0.4 — version active compacte */
.active-version-inline-card {
    padding: 14px 18px;
}
.active-version-inline {
    display: flex;
    align-items: center;
    gap: 10px 16px;
    flex-wrap: wrap;
    line-height: 1.35;
}
.active-version-title {
    font-size: 1.05rem;
    color: var(--text);
    white-space: nowrap;
}
.active-version-inline > span:not(.badge) {
    color: var(--muted);
    font-size: .92rem;
    white-space: nowrap;
}
.active-version-inline > span strong {
    color: var(--text);
    font-size: 1rem;
    margin-left: 3px;
}
.active-version-meta {
    color: #64748b !important;
}

/* V1.0.5 — seul le nom des bénéficiaires est agrandi dans le dossier CPAM */
.print-beneficiaire-head h3,
.print-beneficiaire h3 {
    color: #dc2626;
    font-size: 1.22rem;
    font-weight: 900;
}
@media print {
    body.print-cpam .print-beneficiaire-head h3,
    body.print-cpam .print-beneficiaire h3 {
        color: #b91c1c !important;
        font-size: 14pt !important;
    }
}

/* V1.0.6 — dossier CPAM : ouverture du ticket complet façon ticket de caisse */
.cpam-clickable-row {
    cursor: pointer;
    transition: background-color .15s ease, box-shadow .15s ease;
}
.cpam-clickable-row:hover,
.cpam-clickable-row:focus-visible {
    background: rgba(37, 99, 235, .06);
    outline: 2px solid rgba(37, 99, 235, .28);
    outline-offset: -2px;
}
.ticket-modal-open {
    overflow: hidden;
}
.ticket-receipt-modal[hidden] {
    display: none !important;
}
.ticket-receipt-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
}
.ticket-receipt-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(3px);
}
.ticket-receipt-dialog {
    position: relative;
    width: min(760px, calc(100vw - 32px));
    max-height: min(88vh, 920px);
    overflow: auto;
    border-radius: 28px;
    background: #f8fafc;
    box-shadow: 0 30px 80px rgba(15, 23, 42, .35);
    border: 1px solid rgba(226, 232, 240, .95);
    padding: 22px;
}
.ticket-receipt-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}
.ticket-receipt-top h2 {
    margin: 8px 0 4px;
}
.ticket-paper {
    width: min(440px, 100%);
    margin: 0 auto;
    padding: 24px 22px;
    border-radius: 8px 8px 22px 22px;
    background:
        linear-gradient(135deg, transparent 10px, #fff 0) top left,
        linear-gradient(225deg, transparent 10px, #fff 0) top right,
        linear-gradient(45deg, transparent 10px, #fff 0) bottom left,
        linear-gradient(315deg, transparent 10px, #fff 0) bottom right;
    background-size: 50% 50%;
    background-repeat: no-repeat;
    box-shadow: 0 18px 38px rgba(15, 23, 42, .16);
    border: 1px solid rgba(203, 213, 225, .75);
    color: #111827;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.ticket-paper-head {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.ticket-paper-head h3 {
    margin: 0 0 6px;
    font-size: 1.25rem;
}
.ticket-paper-head p,
.ticket-paper-notes,
.ticket-paper-legend {
    margin: 0;
    color: #475569;
    font-size: .82rem;
}
.ticket-paper-meta {
    margin-top: 14px;
    display: grid;
    gap: 4px;
    font-size: .86rem;
}
.ticket-paper-meta-line,
.ticket-paper-total {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}
.ticket-paper-notes {
    margin-top: 10px;
    padding: 8px 0 0;
}
.ticket-paper-separator {
    margin: 14px 0;
    border-top: 1px dashed #334155;
}
.ticket-paper-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dotted rgba(100, 116, 139, .45);
}
.ticket-paper-line.is-selected {
    margin-inline: -8px;
    padding-inline: 8px;
    border-radius: 10px;
    background: rgba(250, 204, 21, .18);
    box-shadow: inset 3px 0 0 #eab308;
}
.ticket-paper-line-main,
.ticket-paper-line-side {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.ticket-paper-line-side {
    text-align: right;
    align-items: flex-end;
    min-width: 104px;
}
.ticket-paper-line-detail,
.ticket-paper-line-reason {
    color: #64748b;
    font-size: .74rem;
    line-height: 1.25;
}
.ticket-paper-line-reason {
    color: #9f1239;
}
.ticket-paper-status {
    display: inline-flex;
    border-radius: 999px;
    padding: 2px 7px;
    font-size: .66rem;
    font-weight: 800;
    background: #e2e8f0;
    color: #334155;
    white-space: nowrap;
}
.ticket-status-retained .ticket-paper-status {
    background: #dcfce7;
    color: #166534;
}
.ticket-status-excluded .ticket-paper-status {
    background: #fef3c7;
    color: #92400e;
}
.ticket-status-warning .ticket-paper-status,
.ticket-status-archived .ticket-paper-status {
    background: #fee2e2;
    color: #991b1b;
}
.ticket-paper-total {
    align-items: baseline;
    font-size: 1.05rem;
    font-weight: 900;
}
.ticket-paper-legend {
    margin-top: 12px;
    line-height: 1.35;
    text-align: center;
}
@media (max-width: 720px) {
    .ticket-receipt-modal {
        padding: 10px;
        place-items: stretch;
    }
    .ticket-receipt-dialog {
        width: 100%;
        max-height: calc(100vh - 20px);
        border-radius: 22px;
        padding: 16px;
    }
    .ticket-receipt-top {
        flex-direction: column;
    }
}
@media print {
    body.print-cpam .ticket-receipt-modal,
    body.print-cpam .ticket-receipt-modal * {
        display: none !important;
    }
    body.print-cpam .cpam-clickable-row {
        cursor: default;
        outline: 0 !important;
        box-shadow: none !important;
    }
}

/* V1.0.7 — version active : retour au visuel KPI sur une ligne, sans potentiel calculé */
.active-version-classic-card {
    padding: 22px 26px;
}
.active-version-classic-head {
    align-items: center;
    margin-bottom: 16px;
}
.active-version-classic-head h2 {
    margin: 0;
    font-size: 1.25rem;
    letter-spacing: -.02em;
}
.active-version-kpi-grid {
    grid-template-columns: repeat(5, minmax(140px, 1fr));
    gap: 14px;
}
.active-version-kpi-grid .kpi {
    min-height: 92px;
}
.active-version-kpi-grid .kpi strong {
    font-size: 1.45rem;
}
@media (max-width: 1150px) {
    .active-version-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 680px) {
    .active-version-kpi-grid {
        grid-template-columns: 1fr;
    }
}
