/* Police Inter auto-hébergée (variable, latin) - RGPD + sans render-blocking */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-Gz7AlRl.woff2") format('woff2');
}

/* ============================================================
   fx.diamontis.fr - Design system
   Inspiré de la charte Diamontis (intranet) : indigo #3937a3,
   cartes, sidebar, page-header, badges. Autonome (sans Bootstrap).
   ============================================================ */

:root {
    --primary: #3937a3;
    --primary-rgb: 57, 55, 163;
    --primary-600: #322f93;
    --primary-700: #2a2880;
    --primary-50: #eeeefb;
    --accent: #15b8a6;

    --bg: #f5f6fa;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --border: #e6e8ef;
    --text: #1c1f2b;
    --muted: #525a68;

    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #2563eb;

    --radius: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
    --shadow: 0 4px 16px rgba(16, 24, 40, .08);
    --shadow-lg: 0 18px 48px rgba(16, 24, 40, .14);
    --sidebar-w: 256px;

    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { opacity: .85; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5rem; font-weight: 700; letter-spacing: -.01em; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .55rem 1rem; border-radius: var(--radius);
    border: 1px solid transparent; font-weight: 600; font-size: .9rem;
    cursor: pointer; transition: all .15s ease; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-600); color: #fff; }
.btn-outline { background: var(--surface); color: var(--primary); border-color: var(--border); }
.btn-outline:hover { border-color: var(--primary); background: var(--primary-50); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-lg { padding: .8rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; border-radius: 8px; }
.btn-danger-soft { background: #fdecec; color: var(--danger); border-color: #f8cccc; }
.btn-danger-soft:hover { background: var(--danger); color: #fff; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .4rem; }
.form-control, .form-select {
    width: 100%; padding: .6rem .8rem; font-size: .95rem; font-family: inherit;
    color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .18);
}
.form-hint { font-size: .78rem; color: var(--muted); margin-top: .35rem; }

/* Champs date/heure natifs : look cohérent avec .form-control même sans la classe,
   et indicateur de calendrier aux couleurs de la charte. */
.app-content :where(
    input[type="date"], input[type="datetime-local"],
    input[type="month"], input[type="time"], input[type="week"]
) {
    width: 100%; padding: .6rem .8rem; font-size: .95rem; font-family: inherit;
    color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s;
}
.app-content input[type="date"]:focus,
.app-content input[type="datetime-local"]:focus,
.app-content input[type="month"]:focus,
.app-content input[type="time"]:focus,
.app-content input[type="week"]:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .18);
}
.app-content input[type="date"]::-webkit-calendar-picker-indicator,
.app-content input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.app-content input[type="month"]::-webkit-calendar-picker-indicator,
.app-content input[type="time"]::-webkit-calendar-picker-indicator,
.app-content input[type="week"]::-webkit-calendar-picker-indicator {
    cursor: pointer; opacity: .55; transition: opacity .15s;
    /* Teinte l'icône calendrier en --primary (#3937a3). */
    filter: invert(20%) sepia(64%) saturate(2200%) hue-rotate(232deg) brightness(85%) contrast(95%);
}
.app-content input[type="date"]::-webkit-calendar-picker-indicator:hover,
.app-content input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
.app-content input[type="month"]::-webkit-calendar-picker-indicator:hover,
.app-content input[type="time"]::-webkit-calendar-picker-indicator:hover,
.app-content input[type="week"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* ---------- Zone de dépôt de fichiers (import, GED) ---------- */
.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .6rem; padding: 2.5rem 1.5rem; text-align: center; cursor: pointer;
    border: 2px dashed var(--border); border-radius: var(--radius-lg);
    background: var(--surface-2); transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--primary); }
.dropzone.is-dragover { border-color: var(--primary); background: var(--primary-50); }
.dropzone .dz-icon { font-size: 2rem; color: var(--primary); }
.dropzone .dz-title { font-weight: 600; }
.dropzone .dz-hint { font-size: .85rem; color: var(--muted); }
.dropzone.dz-compact { padding: 1.6rem 1.25rem; }

/* ---------- Éditeur de lignes de facture (émission compacte) ---------- */
.invoice-lines thead th { padding: .5rem .55rem; }
.invoice-lines tbody td { padding: .35rem .5rem; }
.invoice-lines .form-control, .invoice-lines .form-select { padding: .42rem .55rem; font-size: .88rem; }
.invoice-lines .line-total { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Bouton « ajouter une ligne » : ligne d'ajout pleine largeur (style add-row). */
.line-add {
    display: flex; align-items: center; justify-content: center; gap: .5rem; width: 100%;
    padding: .6rem; margin: .6rem 0 0; border: 1px dashed var(--border); border-radius: var(--radius);
    background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .88rem;
    cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.line-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }

.emit-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; flex-wrap: wrap; margin: 1.1rem 0; }
.emit-totals { min-width: 240px; margin-left: auto; }
.emit-totals > div { display: flex; justify-content: space-between; gap: 2rem; padding: .2rem 0; }
.emit-total-ttc { font-size: 1.1rem; border-top: 1px solid var(--border); margin-top: .3rem; padding-top: .4rem; }

/* Gestionnaire d'étiquettes GED (modal CRUD couleur) */
.modal-lg { max-width: 560px; }
.tag-manager { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; max-height: 52vh; overflow-y: auto; }
.tag-row { display: flex; align-items: center; gap: .5rem; }
.tag-row form { margin: 0; }
.tag-row .tag-edit { display: flex; align-items: center; gap: .5rem; flex: 1; }
.tag-color {
    width: 2.4rem; height: 2.4rem; flex-shrink: 0; padding: 2px; cursor: pointer;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.tag-add { border-top: 1px solid var(--border); padding-top: .85rem; margin-top: .35rem; }
.tag-empty { color: var(--muted); font-size: .88rem; padding: .5rem 0; }

/* Barre d'outils GED (recherche + filtres) */
.ged-toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.ged-search { position: relative; flex: 1; min-width: 220px; }
.ged-search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; }
.ged-search input { padding-left: 2.1rem; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 1.25rem 1.5rem; }
.card-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); font-weight: 600; }
.card-hover { transition: box-shadow .2s, transform .2s; }
.card-hover:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.stat-card { display: flex; align-items: center; gap: 1rem; padding: 1.25rem; }
.stat-figure {
    width: 3rem; height: 3rem; flex-shrink: 0; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-50); color: var(--primary); font-size: 1.25rem;
}
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* ---------- Tables ---------- */
.table-container { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
table.table { width: 100%; border-collapse: collapse; }
.table thead th {
    text-align: left; padding: .75rem 1rem; background: var(--surface-2);
    font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
    border-bottom: 1px solid var(--border);
}
.table tbody td { padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem;
    border-radius: 999px; font-size: .73rem; font-weight: 600; line-height: 1.4;
    background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge-success { background: #eafaf0; color: #15803d; border-color: #c9f0d8; }
.badge-warning { background: #fef5e7; color: var(--warning); border-color: #fbe3bd; }
.badge-danger  { background: #fdecec; color: var(--danger);  border-color: #f8cccc; }
.badge-info    { background: #eaf1fe; color: var(--info);    border-color: #cfe0fc; }
.badge-primary { background: var(--primary-50); color: var(--primary); border-color: #d9d8f5; }
.badge-neutral { background: var(--surface-2); color: var(--muted); border-color: var(--border); }

/* ---------- Timeline (cycle de vie facture) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { position: relative; padding: 0 0 1.4rem 1.85rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: ''; position: absolute; left: .5rem; top: 1.35rem; bottom: -.15rem;
    width: 2px; background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
    position: absolute; left: 0; top: .15rem; width: 1.1rem; height: 1.1rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .52rem; color: #fff; box-shadow: 0 0 0 3px var(--surface);
}
.timeline-label { font-weight: 600; font-size: .9rem; line-height: 1.35; }
.timeline-meta { color: var(--muted); font-size: .78rem; margin-top: .15rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.timeline-meta .by-you { color: var(--primary); font-weight: 600; }

/* ---------- Alerts / flash ---------- */
.alert { padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid var(--border); font-size: .9rem; background: var(--surface); }
.alert-success { background: #eafaf0; color: #14622f; border-color: #c9f0d8; }
.alert-warning { background: #fef5e7; color: #7a4a06; border-color: #fbe3bd; }
.alert-error, .alert-danger { background: #fdecec; color: #8a1c1c; border-color: #f8cccc; }
.alert-info { background: #eaf1fe; color: #14367a; border-color: #cfe0fc; }

/* ============================================================
   App layout (sidebar)
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-w); flex-shrink: 0; background: #1b1c39; color: #c9cae2;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.app-brand { display: flex; align-items: center; gap: .65rem; padding: 1.15rem 1.25rem; color: #fff; font-weight: 800; font-size: 1.05rem; }
.app-brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; }
.app-nav { padding: .5rem .75rem; display: flex; flex-direction: column; gap: .15rem; flex: 1; overflow-y: auto; }
.app-nav .nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #6f719c; padding: 1rem .75rem .35rem; }
.app-nav a {
    display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: var(--radius);
    color: #c9cae2; font-weight: 500; font-size: .92rem; text-decoration: none; transition: background .12s, color .12s;
}
.app-nav a i { width: 1.1rem; text-align: center; opacity: .85; }
.app-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.app-nav a.active { background: var(--primary); color: #fff; }
.app-nav-bottom { padding: .5rem .75rem; display: flex; flex-direction: column; gap: .15rem; }
.app-nav-bottom a {
    display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: var(--radius);
    color: #c9cae2; font-weight: 500; font-size: .92rem; text-decoration: none; transition: background .12s, color .12s;
}
.app-nav-bottom a i { width: 1.1rem; text-align: center; opacity: .85; }
.app-nav-bottom a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.app-nav-bottom a.active { background: var(--primary); color: #fff; }
.app-sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .08); font-size: .82rem; }

/* ---------- Paramètres : sous-sidebar dédiée ---------- */
.settings-shell { display: flex; gap: 1.5rem; align-items: flex-start; }
.settings-subnav {
    flex-shrink: 0; width: 240px; position: sticky; top: calc(62px + 1.5rem);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem; box-shadow: var(--shadow-sm);
}
.settings-subnav-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: .6rem .7rem .5rem; }
.settings-subnav a {
    display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem; border-radius: var(--radius);
    color: var(--text); font-weight: 500; font-size: .9rem; text-decoration: none; transition: background .12s, color .12s;
}
.settings-subnav a i { width: 1.1rem; text-align: center; color: var(--muted); }
.settings-subnav a:hover { background: var(--surface-2); }
.settings-subnav a.active { background: var(--primary-50); color: var(--primary); }
.settings-subnav a.active i { color: var(--primary); }
.settings-content { flex: 1; min-width: 0; }

@media (max-width: 860px) {
    .settings-shell { flex-direction: column; }
    .settings-subnav { width: 100%; position: static; }
}

/* Utilitaire grille (les colonnes sont fournies en style inline). */
.grid { display: grid; }

/* ---------- Wizard d'onboarding (pleine largeur) ---------- */
.wizard-head { margin-bottom: 1.75rem; }
.wizard-head .page-title { font-size: 1.6rem; margin: 0; }
.wizard-head .page-subtitle { color: var(--muted); margin: .25rem 0 1.5rem; }

.wizard-steps { display: flex; list-style: none; padding: 0; margin: 0; }
.wizard-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .45rem; position: relative; text-align: center; }
.wizard-step::before {
    content: ''; position: absolute; top: 1rem; left: -50%; width: 100%; height: 2px; background: var(--border); z-index: 0;
}
.wizard-step:first-child::before { display: none; }
.wizard-step.done::before, .wizard-step.current::before { background: var(--primary); }
.wizard-step-dot {
    position: relative; z-index: 1; width: 2rem; height: 2rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem;
    background: var(--surface-2); color: var(--muted); border: 2px solid var(--border);
}
.wizard-step.current .wizard-step-dot { background: var(--primary); color: #fff; border-color: var(--primary); }
.wizard-step.done .wizard-step-dot { background: #15b8a6; color: #fff; border-color: #15b8a6; }
.wizard-step-label { font-size: .82rem; color: var(--muted); }
.wizard-step.current .wizard-step-label { color: var(--text); font-weight: 600; }

.wizard-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.wizard-aside .card { background: var(--surface); }
.wizard-aside h3 { font-size: 1rem; margin: 0 0 .5rem; }
.wizard-aside p { color: var(--muted); font-size: .88rem; margin: 0 0 .75rem; }
.wizard-aside ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: .88rem; line-height: 1.7; }
@media (max-width: 980px) {
    .wizard-body { grid-template-columns: 1fr; }
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
    height: 62px; background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; position: sticky; top: 0; z-index: 20;
}
.app-topbar .company-switch { font-weight: 600; display: flex; align-items: center; gap: .5rem; }

/* Sélecteur d'entreprise active (comptes multi-entreprises) */
.company-switch-menu { position: relative; display: block; }
.company-switch-menu summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem;
    padding: .4rem .7rem; border-radius: 8px; border: 1px solid transparent; user-select: none;
}
.company-switch-menu summary::-webkit-details-marker { display: none; }
.company-switch-menu summary:hover { background: var(--bg); border-color: var(--border); }
.company-switch-menu[open] summary { background: var(--bg); border-color: var(--border); }
.company-switch-caret { font-size: .65rem; color: var(--muted); transition: transform .15s; }
.company-switch-menu[open] .company-switch-caret { transform: rotate(180deg); }
.company-switch-list {
    position: absolute; top: calc(100% + 6px); left: 0; min-width: 280px; z-index: 50;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12); padding: .4rem; display: flex; flex-direction: column;
}
.company-switch-label {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
    padding: .35rem .6rem .25rem; font-weight: 600;
}
.company-switch-item {
    display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: 7px;
    color: inherit; text-decoration: none; font-weight: 500; font-size: .92rem;
}
.company-switch-item small { display: block; color: var(--muted); font-weight: 400; font-size: .75rem; }
.company-switch-item:hover { background: var(--bg); }
.company-switch-item.current { background: var(--bg); cursor: default; }
.company-switch-item.current > i { color: #15b8a6; }
.company-switch-add { border-top: 1px solid var(--border); border-radius: 0 0 7px 7px; margin-top: .25rem; color: var(--muted); font-size: .85rem; }
.app-topbar .user { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .9rem; }
.app-topbar .user-link { display: inline-flex; align-items: center; gap: .5rem; color: inherit; text-decoration: none; padding: .25rem .5rem; border-radius: var(--radius, .5rem); transition: background .15s, color .15s; }
.app-topbar .user-link:hover { color: var(--primary); background: var(--primary-50, rgba(57,55,163,.08)); }
.app-content { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; }

/* Footer applicatif : poussé en bas de la zone de contenu (margin-top auto). */
.app-footer {
    margin-top: auto; padding: 1.75rem .25rem .25rem;
    text-align: center; color: var(--muted); font-size: .85rem;
}
.app-footer i.fa-heart { color: #e0245e; margin: 0 .1rem; }
.app-footer a { color: var(--muted); font-weight: 600; }
.app-footer a:hover { color: var(--primary); }

.page-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.page-header .page-title { font-size: 1.5rem; margin: 0; }
.page-header .page-subtitle { color: var(--muted); font-size: .9rem; margin: .15rem 0 0; }
.page-header .page-actions { margin-left: auto; display: flex; gap: .5rem; }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 3.5rem 1rem; }
.empty-state .icon { width: 4rem; height: 4rem; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: 1rem; }
.empty-state h3 { margin: 0 0 .35rem; }
.empty-state p { color: var(--muted); max-width: 26rem; margin: 0 0 1.25rem; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; background: radial-gradient(1200px 600px at 100% -10%, rgba(var(--primary-rgb), .12), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 2rem; }
.auth-card .brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.15rem; margin-bottom: 1.5rem; }
.auth-card .brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }

/* ---------- Utilities ---------- */
.container { max-width: 1140px; margin: 0 auto; padding: 0 1.25rem; }
.muted { color: var(--muted); }
.text-center { text-align: center; }
.flex { display: flex; }
.items-center { align-items: center; }
.between { justify-content: space-between; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: 1rem; } .gap-4 { gap: 1.5rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2.5rem; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }

@media (max-width: 860px) {
    .app-sidebar { display: none; }
}

/* ============================================================
   Vitrine (marketing)
   ============================================================ */
.mkt-header { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.mkt-nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.mkt-brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.15rem; color: var(--text); }
.mkt-brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.mkt-nav-links { display: flex; align-items: center; gap: 1.5rem; }
.mkt-nav-links a { color: var(--text); font-weight: 500; }
.mkt-nav-links a:hover { color: var(--primary); text-decoration: none; }
.mkt-nav-links a.btn-primary, .mkt-nav-links a.btn-primary:hover { color: #fff; }

.hero { padding: 5rem 0 4rem; background: radial-gradient(900px 500px at 90% -10%, rgba(var(--primary-rgb), .14), transparent); }
.hero h1 { font-size: clamp(2.1rem, 4.5vw, 3.4rem); letter-spacing: -.02em; max-width: 14ch; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 46ch; margin: 1.25rem 0 2rem; }
.hero .cta-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: .5rem; background: var(--primary-50); color: var(--primary); font-weight: 600; font-size: .82rem; padding: .35rem .8rem; border-radius: 999px; margin-bottom: 1.25rem; }

.section { padding: 4rem 0; }
.section-head { text-align: center; max-width: 40rem; margin: 0 auto 2.5rem; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.section-head p { color: var(--muted); font-size: 1.05rem; }

.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.75rem; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem 1.5rem; box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s; text-align: center; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature .fic { width: 3rem; height: 3rem; border-radius: var(--radius); background: var(--primary-50); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin: 0 auto 1.25rem; }
.feature h3 { font-size: 1.1rem; margin-bottom: .5rem; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; line-height: 1.55; }

@media (max-width: 1024px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .feature-grid { grid-template-columns: 1fr; } }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }
.step .n { width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; margin-bottom: .8rem; }

.cta-band { background: linear-gradient(135deg, var(--primary), #5654c9); color: #fff; border-radius: var(--radius-lg); padding: 3rem; text-align: center; }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, .85); max-width: 40rem; margin: .5rem auto 1.75rem; }
.cta-band .btn-primary { background: #fff; color: var(--primary); }
.cta-band .btn-primary:hover { background: #f1f1fb; }

.mkt-footer { border-top: 1px solid var(--border); padding: 2.5rem 0; color: var(--muted); font-size: .9rem; }
.mkt-footer a { color: var(--muted); }
.mkt-footer a:hover { color: var(--primary); }

.legal { max-width: 800px; margin: 0 auto; padding: 3rem 1.25rem; }
.legal h1 { margin-bottom: 1.5rem; }
.legal h2 { font-size: 1.2rem; margin-top: 2rem; }
.legal p { color: #333; }

/* ---------- Admin : navigation par onglets (liens) ---------- */
.admin-tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.admin-tabs a {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .7rem 1.1rem; margin-bottom: -1px;
    font-weight: 600; font-size: .9rem; color: var(--muted);
    border-bottom: 2px solid transparent; text-decoration: none;
    transition: color .15s, border-color .15s;
}
.admin-tabs a:hover { color: var(--text); }
.admin-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Admin : monitoring des outils ---------- */
.health-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1.5rem; }
.health-pill { padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--border); font-size: .82rem; }
.health-pill strong { font-weight: 800; }
.health-docker { margin-left: auto; font-size: .85rem; }
.health-group-title { font-size: 1rem; font-weight: 700; margin: 1.5rem 0 .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1rem; }
.tool-card { border-left: 4px solid var(--border); }
.tool-card.tool-ok { border-left-color: var(--success); }
.tool-card.tool-degraded { border-left-color: var(--warning); }
.tool-card.tool-down { border-left-color: var(--danger); }
.tool-card.tool-unknown { border-left-color: var(--muted); }

.tool-card-head { display: flex; align-items: center; gap: .75rem; }
.tool-icon { width: 2.4rem; height: 2.4rem; flex-shrink: 0; border-radius: var(--radius); background: var(--primary-50); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.tool-title { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.tool-title strong { font-size: .98rem; }
.tool-title .badge { align-self: flex-start; }
.tool-latency { margin-left: auto; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tool-message { font-size: .85rem; color: var(--text); margin: .8rem 0 .6rem; }

.tool-details { display: grid; grid-template-columns: 1fr; gap: .25rem; margin: 0 0 .6rem; }
.tool-details > div { display: flex; justify-content: space-between; gap: 1rem; font-size: .8rem; border-bottom: 1px dashed var(--border); padding-bottom: .2rem; }
.tool-details dt { color: var(--muted); margin: 0; }
.tool-details dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; word-break: break-all; }

.tool-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .25rem; }
.tool-actions form { margin: 0; }

/* ---------- Modale de confirmation (remplace window.confirm) ---------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000; padding: 1rem;
    display: flex; align-items: center; justify-content: center;
    background: rgba(16, 24, 40, .55); opacity: 0; transition: opacity .15s ease;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay.is-open { opacity: 1; }
.modal {
    background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    width: 100%; max-width: 440px; padding: 1.5rem;
    transform: translateY(10px) scale(.98); transition: transform .15s ease;
}
.modal-overlay.is-open .modal { transform: none; }
.modal-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .25rem; }
.modal-icon {
    width: 2.5rem; height: 2.5rem; flex-shrink: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-50); color: var(--primary); font-size: 1.1rem;
}
.modal-icon-danger { background: #fdecec; color: var(--danger); }
.modal-title { margin: 0; font-size: 1.1rem; }
.modal-message { color: var(--muted); font-size: .92rem; margin: .5rem 0 0; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.5rem; }

/* ---------- Onglets (CSS pur, radios masqués - aucune dépendance JS) ---------- */
.tabs > .tab-radio {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.tab-nav {
    display: flex; gap: .25rem; flex-wrap: wrap;
    border-bottom: 1px solid var(--border); margin-bottom: 1.5rem;
}
.tab-nav label {
    display: inline-flex; align-items: center; gap: .55rem;
    padding: .7rem 1.1rem; margin-bottom: -1px; cursor: pointer;
    font-weight: 600; font-size: .9rem; color: var(--muted);
    border: 1px solid transparent; border-bottom: 2px solid transparent;
    border-top-left-radius: var(--radius); border-top-right-radius: var(--radius);
    transition: color .15s, border-color .15s, background .15s;
}
.tab-nav label:hover { color: var(--text); background: var(--surface-2); }
.tab-nav label .tab-count {
    font-size: .72rem; font-weight: 700; line-height: 1; padding: .15rem .45rem;
    border-radius: 999px; background: var(--surface-2); color: var(--muted);
    border: 1px solid var(--border);
}
.tab-panel { display: none; }

/* Onglets e-reporting : le radio coché (général sibling ~) pilote l'onglet actif
   et l'affichage du panneau correspondant (data-tab). 100% CSS, aucun JS. */
#er-tab-tx:checked   ~ .tab-nav label[for="er-tab-tx"],
#er-tab-pay:checked  ~ .tab-nav label[for="er-tab-pay"],
#er-tab-intl:checked ~ .tab-nav label[for="er-tab-intl"],
#er-tab-ppf:checked  ~ .tab-nav label[for="er-tab-ppf"] {
    color: var(--primary); border-bottom-color: var(--primary);
}
#er-tab-tx:checked   ~ .tab-nav label[for="er-tab-tx"]   .tab-count,
#er-tab-pay:checked  ~ .tab-nav label[for="er-tab-pay"]  .tab-count,
#er-tab-intl:checked ~ .tab-nav label[for="er-tab-intl"] .tab-count,
#er-tab-ppf:checked  ~ .tab-nav label[for="er-tab-ppf"]  .tab-count {
    background: var(--primary-50); color: var(--primary); border-color: #d9d8f5;
}
#er-tab-tx:checked   ~ .tab-panels .tab-panel[data-tab="tx"],
#er-tab-pay:checked  ~ .tab-panels .tab-panel[data-tab="pay"],
#er-tab-intl:checked ~ .tab-panels .tab-panel[data-tab="intl"],
#er-tab-ppf:checked  ~ .tab-panels .tab-panel[data-tab="ppf"] { display: block; }

/* Accessibilité clavier : anneau de focus visible sur l'onglet ciblé. */
#er-tab-tx:focus-visible   ~ .tab-nav label[for="er-tab-tx"],
#er-tab-pay:focus-visible  ~ .tab-nav label[for="er-tab-pay"],
#er-tab-intl:focus-visible ~ .tab-nav label[for="er-tab-intl"],
#er-tab-ppf:focus-visible  ~ .tab-nav label[for="er-tab-ppf"] {
    outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius);
}

/* --- Grille tarifaire (vitrine) --------------------------------------- */
.hero-compact { padding-bottom: 1rem; }
.text-center { text-align: center; }
.mt-3 { margin-top: 1rem; }

.pricing-grid {
    display: grid; gap: 1.5rem; align-items: stretch;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    max-width: 1000px; margin: 0 auto;
}
.pricing-card {
    position: relative; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    padding: 1.75rem 1.5rem;
}
.pricing-card-featured {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .18), var(--shadow);
}
.pricing-badge {
    position: absolute; top: -.75rem; left: 50%; transform: translateX(-50%);
}
.pricing-name { margin: 0 0 .5rem; font-size: 1.15rem; }
.pricing-price { display: flex; align-items: baseline; gap: .4rem; margin-bottom: .25rem; }
.pricing-amount { font-size: 2rem; font-weight: 700; color: var(--text); }
.pricing-period { font-size: .85rem; color: var(--muted); }
.pricing-tagline { margin: 0 0 1.25rem; min-height: 2.5em; }
.pricing-features { list-style: none; padding: 0; margin: 0 0 1.5rem; flex: 1; }
.pricing-features li { display: flex; align-items: flex-start; gap: .55rem; padding: .35rem 0; font-size: .92rem; }
.pricing-features li i { color: var(--success); margin-top: .2rem; }

/* --- Bascule mensuel / annuel (pur CSS) ------------------------------- */
.pricing-toggle-input { position: absolute; opacity: 0; pointer-events: none; }
.pricing-toggle {
    display: inline-flex; gap: .25rem; margin: 0 auto 1.75rem; padding: .25rem;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 999px; justify-content: center;
}
.pricing { display: flex; flex-direction: column; align-items: center; }
.pricing-toggle label {
    display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
    padding: .4rem 1rem; border-radius: 999px; font-size: .9rem; font-weight: 600;
    color: var(--muted); transition: background .15s, color .15s;
}
#bi-monthly:checked ~ .pricing-toggle label[for="bi-monthly"],
#bi-yearly:checked ~ .pricing-toggle label[for="bi-yearly"] {
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}
.pricing-toggle-input:focus-visible ~ .pricing-toggle label[for="bi-monthly"],
.pricing-toggle-input:focus-visible ~ .pricing-toggle label[for="bi-yearly"] {
    outline: 2px solid var(--primary); outline-offset: 2px;
}
.pricing-grid { width: 100%; }
.price-monthly, .price-yearly { display: inline-flex; align-items: baseline; gap: .4rem; }
.price-yearly { display: none; }
#bi-yearly:checked ~ .pricing-grid .price-monthly { display: none; }
#bi-yearly:checked ~ .pricing-grid .price-yearly { display: inline-flex; }
/* Toggle periodicite dans le tunnel d'onboarding (grille .offre-grid). */
#bi-yearly:checked ~ .offre-grid .price-monthly { display: none; }
#bi-yearly:checked ~ .offre-grid .price-yearly { display: inline; }
.offre-grid .price-yearly { display: none; }

/* Features « a venir » (roadmap) sur les grilles tarifaires */
.pricing-features li.feature-coming { color: var(--muted); }

/* ============================================================
   Admin - Stockage objet (/admin/storage)
   ============================================================ */

/* --- Carte de téléversement --- */
.storage-upload-card { max-width: 720px; margin-bottom: 1.25rem; }
.storage-upload-title {
    display: flex; align-items: center; gap: .6rem;
    font-size: .98rem; margin-bottom: 1rem;
}
.storage-upload-form { display: flex; flex-direction: column; gap: 0; }
.storage-upload-row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }

/* Input file custom : masque le natif, affiche un bouton cohérent avec .btn */
.storage-file-input {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.storage-file-label {
    display: flex; align-items: center; gap: .55rem;
    width: 100%; padding: .55rem .85rem;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--muted);
    font-size: .92rem; cursor: pointer;
    transition: border-color .15s, box-shadow .15s, color .15s;
    user-select: none;
}
.storage-file-label:hover {
    border-color: var(--primary); color: var(--text);
}
.storage-file-input:focus-visible + .storage-file-label,
.storage-file-label:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .18);
    outline: none;
}
.storage-file-label.has-file {
    border-color: var(--primary); color: var(--text); font-weight: 600;
}
.storage-file-label.has-file .storage-file-icon { color: var(--primary); }
.storage-file-icon {
    width: 1.6rem; height: 1.6rem; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px; background: var(--primary-50);
    color: var(--primary); font-size: .85rem;
    transition: background .15s, color .15s;
}
.storage-file-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Barre de recherche + filtres --- */
.storage-toolbar {
    display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
    margin-bottom: 1rem; padding: .9rem 1.25rem;
}
.storage-search-wrap { position: relative; flex: 1 1 220px; min-width: 0; }
.storage-search-icon {
    position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: .82rem; pointer-events: none;
}
.storage-search-input { padding-left: 2.2rem; }

.storage-filter-wrap { display: flex; gap: .5rem; flex-wrap: wrap; }
.storage-filter-icon {
    position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: .8rem; pointer-events: none; z-index: 1;
}
.storage-filter-select { padding-left: 2.2rem; min-width: 160px; }

.storage-counter {
    margin-left: auto; font-size: .82rem; color: var(--muted);
    white-space: nowrap; padding: .3rem .6rem;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 999px; font-weight: 600;
}

/* --- Tableau des objets --- */
.storage-path-cell { max-width: 340px; }
.storage-path-code {
    font-size: .8rem; word-break: break-all; white-space: normal;
    background: var(--surface-2); padding: .15rem .4rem;
    border-radius: 4px; border: 1px solid var(--border);
}
.storage-company-name { display: block; font-weight: 600; font-size: .88rem; }
.storage-company-id { font-size: .73rem; }

/* --- Badges de type --- */
.storage-type-badge { font-size: .73rem; }
.storage-type-archive { background: #eaf1fe; color: var(--info);    border-color: #cfe0fc; }
.storage-type-import  { background: #fef5e7; color: var(--warning); border-color: #fbe3bd; }
.storage-type-ged     { background: #eafaf0; color: var(--success); border-color: #c9f0d8; }
.storage-type-autre   { background: var(--surface-2); color: var(--muted); border-color: var(--border); }

/* Responsive : masque la colonne ID sur les petits écrans */
@media (max-width: 860px) {
    .storage-path-cell { max-width: 180px; }
    .storage-company-id { display: none; }
    .storage-filter-select { min-width: 120px; }
}
.pricing-features li.feature-coming i { color: var(--muted); }
.feature-soon { font-size: .62rem; vertical-align: middle; margin-left: .15rem; }
.feature-coming { opacity: .85; }

/* ---------- Modale de saisie (motif de refus) ---------- */
.modal-input { max-width: 520px; }
.modal-body { margin: .75rem 0 0; }
.modal-body .form-label { font-size: .85rem; }
.modal-body .form-control { margin-top: .35rem; }

/* ---------- Sélecteur de client destinataire (emission) ---------- */
.emit-client-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: .5rem; margin-bottom: .35rem;
}
.emit-client-header .form-label { margin: 0; }
.emit-client-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.required-star { color: var(--danger); margin-left: .15rem; }
.emit-no-client {
    display: flex; align-items: flex-start; gap: 1rem;
    padding: 1.25rem 1.5rem;
}
.emit-no-client > i { font-size: 1.4rem; color: var(--warning); margin-top: .15rem; flex-shrink: 0; }
.emit-no-client > div > p { margin: .35rem 0 .75rem; font-size: .92rem; }

/* ---------- Dropzone de dépôt de fichiers ---------- */
.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .75rem; padding: 3.5rem 1.5rem;
    border: 2px dashed var(--border); border-radius: var(--radius-lg);
    background: var(--surface-2); cursor: pointer; text-align: center;
    transition: border-color .15s, background .15s;
}
.dropzone.is-dragover,
.dropzone:hover { border-color: var(--primary); background: var(--primary-50); }
.dz-icon { font-size: 2.5rem; color: var(--primary); }
.dz-title { font-weight: 600; }
.dz-hint { font-size: .85rem; color: var(--muted); }

/* ---------- Import par lot - revue groupée ---------- */
.batch-item { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: start; }
.batch-item-info { min-width: 0; }
.batch-item-actions { display: flex; flex-direction: column; gap: .6rem; min-width: 240px; }
.batch-exclude-row { display: flex; align-items: center; gap: .5rem; padding-top: .25rem; }
