/* ============================================================
   MC Tools — Design system Hively Hospitality
   Charte : vert profond #1B2621 · sauge #C0DFD7 · Gilda Display + Poppins
   ============================================================ */

@font-face {
    font-family: 'Gilda Display';
    src: url('/assets/fonts/GildaDisplay-Regular.ttf') format('truetype');
    font-weight: 400; font-display: swap;
}
@font-face {
    font-family: 'Poppins';
    src: url('/assets/fonts/Poppins-ExtraLight.ttf') format('truetype');
    font-weight: 200; font-display: swap;
}
@font-face {
    font-family: 'Poppins';
    src: url('/assets/fonts/Poppins-Regular.ttf') format('truetype');
    font-weight: 400; font-display: swap;
}
@font-face {
    font-family: 'Poppins';
    src: url('/assets/fonts/Poppins-Medium.ttf') format('truetype');
    font-weight: 500; font-display: swap;
}
@font-face {
    font-family: 'Poppins';
    src: url('/assets/fonts/Poppins-ExtraBold.ttf') format('truetype');
    font-weight: 800; font-display: swap;
}

:root {
    --forest:    #1B2621;   /* vert profond — fond sombre / marque */
    --forest-2:  #24322C;   /* surface sombre secondaire */
    --sage:      #C0DFD7;   /* menthe/sauge — accent */
    --sage-deep: #6D827C;   /* gris-vert — texte secondaire sur clair */
    --paper:     #F3F7F5;   /* fond clair teinté sauge */
    --white:     #FFFFFF;
    --ink:       #1B2621;   /* texte principal sur clair */
    --line:      #DCE7E2;   /* filets sur fond clair */
    --line-dk:   #34423B;   /* filets sur fond sombre */
    --radius:    14px;
    --radius-sm: 8px;
    --radius-lg: 22px;
    --shadow:    0 1px 2px rgba(27,38,33,.06), 0 8px 24px rgba(27,38,33,.06);
    /* Ombre douce unifiée (v0.79.0) : remplace peu à peu --shadow sur les
       cartes, pour un rendu plus aéré, moins "posé" que la double-ombre d'origine. */
    --shadow-soft:  0 3px 16px rgba(27,38,33,.07);
    --shadow-hover: 0 10px 28px rgba(27,38,33,.11);
    /* Teintes pastel pour badges/status (fonds à faible opacité, jamais d'aplat
       saturé hors CTA) — v0.79.0, inspiré d'une réflexion UX partagée par Pedro. */
    --sage-08:   rgba(192,223,215,.30);
    --sage-16:   rgba(192,223,215,.55);
    --forest-08: rgba(27,38,33,.06);
    --corail:    #C0563E;
    --corail-16: rgba(192,86,62,.14);
    --safran:    #E0A83C;
    --safran-16: rgba(224,168,60,.18);
    --ok:        #2D7D56;
    --ok-16:     rgba(45,125,86,.14);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
    font-family: 'Gilda Display', Georgia, serif;
    font-weight: 400;
    letter-spacing: .2px;
    line-height: 1.15;
}

a { color: inherit; }

.eyebrow {
    font-size: 11px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--sage-deep);
    font-weight: 500;
}

/* ─── Boutons ────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 10px;
    font-family: 'Poppins', sans-serif; font-weight: 500; font-size: 15px;
    padding: 12px 22px; border-radius: 999px; border: 0; cursor: pointer;
    text-decoration: none; transition: transform .15s ease, background .15s ease;
}
.btn--sage  { background: var(--sage); color: var(--forest); }
.btn--sage:hover  { transform: translateY(-1px); background: #cfe8e1; }
.btn--ghost { background: transparent; color: var(--sage); border: 1px solid var(--line-dk); }
.btn--ghost:hover { border-color: var(--sage); }

/* ─── Header portail (fond sombre) ───────────────────────── */
.app-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 40px; background: var(--forest);
    border-bottom: 1px solid var(--line-dk);
}
.app-header img.logo { height: 30px; display: block; }
.app-header .user { display: flex; align-items: center; gap: 20px; }
.app-header .user span { color: var(--sage); font-size: 14px; font-weight: 400; }
.app-header .user a { color: #9fb4ad; font-size: 13px; text-decoration: none; }
.app-header .user a:hover { color: var(--sage); }
.support-link {
    background: none; border: 1px solid var(--line-dk); color: #9fb4ad; font-size: 12.5px;
    padding: 6px 12px; border-radius: 999px; cursor: pointer; font-family: 'Poppins', sans-serif;
    white-space: nowrap; transition: color .15s ease, border-color .15s ease;
}
.support-link:hover { color: var(--sage); border-color: var(--sage); }
@media (max-width: 760px) { .support-link { display: none; } }

/* ─── Prise d'identité (switch_user) ───────────────────────── */
.imp-banner {
    display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap;
    background: #C0563E; color: #fff; padding: 9px 18px;
    font-size: 13px; letter-spacing: .01em; position: relative; z-index: 70;
}
.imp-banner a { color: #fff; text-decoration: underline; font-weight: 600; white-space: nowrap; }
.imp-banner a:hover { opacity: .85; }

.usermenu { position: relative; }
.usermenu > summary {
    list-style: none; cursor: pointer; color: var(--sage); font-size: 14px;
    display: inline-flex; align-items: center; gap: 6px;
}
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu > summary:hover { color: var(--white); }
.usermenu > summary .chev { font-size: 11px; opacity: .8; }
.usermenu__panel {
    position: absolute; right: 0; top: calc(100% + 10px); min-width: 230px;
    background: var(--white); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--shadow-soft); padding: 6px; z-index: 80;
}
.usermenu__panel a {
    display: block; padding: 10px 12px; border-radius: 6px;
    color: var(--forest); font-size: 13.5px; text-decoration: none;
}
.usermenu__panel a:hover { background: var(--paper); color: var(--forest); }


/* ─── Contenu ─────────────────────────────────────────────── */
main { max-width: 1040px; margin: 0 auto; padding: 56px 24px 80px; }
/* Écrans à onglets denses (import) : on exploite la largeur disponible. */
main:has(.imp-toprow) { max-width: 1520px; }
/* Sociétés & établissements : tableau imbriqué large (10 colonnes) sans scroll horizontal. */
main:has(.soc-wide) { max-width: 1520px; }

@media (max-width: 760px) {
    main { padding: 28px 16px 56px; }
    .app-header { padding: 14px 18px; }
    .page-title h1 { font-size: 26px; }
    .page-sub { margin-bottom: 24px; font-size: 14px; }
}

.page-title { display: flex; align-items: baseline; gap: 16px; margin-bottom: 4px; }
.page-title h1 { font-size: 34px; margin: 0; }
.page-sub { color: var(--sage-deep); margin: 6px 0 40px; font-size: 15px; }

/* ─── Grille d'apps ──────────────────────────────────────── */
.app-grid {
    display: grid; gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.app-card {
    display: block; text-decoration: none; background: var(--white);
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow-soft);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
    position: relative; overflow: hidden;
}
.app-card::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--sage); opacity: 0; transition: opacity .16s ease;
}
.app-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--sage); }
.app-card:hover::before { opacity: 1; }
.app-card .name { font-family: 'Gilda Display', serif; font-size: 20px; color: var(--ink); }
.app-card .code { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--sage-deep); margin-top: 8px; }

.app-card--soon {
    opacity: .55; cursor: default;
}
.app-card--soon:hover { transform: none; box-shadow: var(--shadow-soft); border-color: var(--line); }
.app-card--soon:hover::before { opacity: 0; }

.empty {
    background: var(--sage-08); border: 1px dashed var(--line); border-radius: var(--radius-lg);
    padding: 40px; text-align: center; color: var(--sage-deep); line-height: 1.6;
}
.empty strong { color: var(--forest); }

/* ─── Paramètres : familles (pastilles) ──────────────────── (v0.63.0) */
.settings-grid {
    display: grid; gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.settings-card {
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 22px 24px; box-shadow: var(--shadow-soft);
}
.settings-card h2 {
    font-size: 17px; margin: 0 0 14px; color: var(--ink);
    padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.settings-card__links { display: flex; flex-direction: column; gap: 2px; }
.settings-card__links a {
    display: block; padding: 9px 10px; margin: 0 -10px; border-radius: 8px;
    color: var(--ink); text-decoration: none; font-size: 14.5px;
    transition: background .15s ease, color .15s ease;
}
.settings-card__links a:hover { background: var(--paper); color: var(--forest); }

/* ─── Écran de connexion (plein cadre vert) ──────────────── */
.login-shell {
    min-height: 100vh; display: grid; place-items: center;
    background:
        radial-gradient(1100px 600px at 80% -10%, #26332d 0%, transparent 60%),
        var(--forest);
}
.login-card { width: min(440px, 92vw); text-align: center; padding: 8px 24px 24px; }
.login-medallion {
    width: 150px; height: 150px; margin: 0 auto 34px;
    border-radius: 50%;
    background: rgba(192, 223, 215, .08);
    border: 1px solid #34423b;
    display: flex; align-items: center; justify-content: center;
}
.login-medallion img { width: 112px; height: auto; display: block; }
.login-card h1 { color: var(--white); font-size: 30px; margin: 0 0 10px; }
.login-card .lead { color: #9fb4ad; font-size: 15px; margin: 0 0 36px; }
.login-card .btn { margin-top: 4px; }
.login-err {
    background: rgba(255,255,255,.06); border: 1px solid #5b3b3b; color: #f4c9c4;
    padding: 12px 16px; border-radius: 10px; margin-bottom: 24px; font-size: 14px;
}
.login-foot { margin-top: 44px; color: #6d827c; font-size: 12px; letter-spacing: .04em; }

@media (max-width: 640px) {
    .app-header { padding: 14px 20px; }
    main { padding: 36px 18px 60px; }
    .page-title h1 { font-size: 27px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ============================================================
   Header + menu hamburger + drawer   (v0.6.0)
   ============================================================ */
.app-header__left { display: flex; align-items: center; gap: 16px; }
.app-header .brand img { height: 26px; display: block; }

.burger {
    width: 26px; height: 20px; position: relative; cursor: pointer;
    display: inline-flex; flex-direction: column; justify-content: space-between;
}
.burger span { display: block; height: 2px; width: 100%; background: var(--sage); border-radius: 2px; transition: .2s; }

.nav-toggle:checked ~ .nav-scrim { opacity: 1; pointer-events: auto; }
.nav-toggle:checked ~ .nav-drawer { transform: translateX(0); }

.nav-scrim {
    position: fixed; inset: 0; background: rgba(15,22,19,.5);
    opacity: 0; pointer-events: none; transition: opacity .2s ease; z-index: 40;
}
.nav-drawer {
    position: fixed; top: 0; left: 0; bottom: 0; width: 290px; max-width: 82vw;
    background: var(--forest); border-right: 1px solid var(--line-dk);
    transform: translateX(-100%); transition: transform .22s ease; z-index: 50;
    padding: 18px 14px; display: flex; flex-direction: column; gap: 2px;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.nav-drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 10px 14px; }
.nav-close { color: #9fb4ad; font-size: 26px; line-height: 1; cursor: pointer; text-decoration: none; }
.nav-close:hover { color: var(--sage); }

.nav-group {
    margin: 16px 10px 6px; font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
    color: var(--sage-deep);
}
.nav-group--toggle { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; padding: 6px 10px; border-radius: 8px; margin: 12px 4px 2px; }
.nav-group--toggle:hover { background: var(--forest-2); color: var(--sage); }
.nav-group--toggle .chev { font-size: 10px; transition: transform .2s ease; }
.nav-sub { overflow: hidden; max-height: 0; transition: max-height .22s ease; }
.nav-grp:checked ~ .nav-sub { max-height: 640px; }
.nav-grp:checked ~ .nav-group--toggle .chev { transform: rotate(180deg); }
.nav-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 12px; border-radius: 10px; color: #dCe7e2; text-decoration: none; font-size: 15px;
}
.nav-item:hover { background: var(--forest-2); color: #fff; }
.nav-item--sub { color: #b7c9c2; font-size: 14px; padding-left: 18px; }
.nav-item--soon { color: #6d827c; cursor: default; }
.nav-item--soon:hover { background: transparent; color: #6d827c; }
.nav-item--soon em { font-style: normal; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; opacity: .8; }

/* ============================================================
   Pages admin : titres, tables, formulaires, flash   (v0.6.0)
   ============================================================ */
.h-page { font-size: 34px; margin: 0; }

.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.admin-head__actions { display: flex; gap: 10px; }

.btn--ghost-dark { color: var(--forest); border: 1px solid var(--line); }
.btn--ghost-dark:hover { border-color: var(--sage-deep); }

.import-bar, .filter-bar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px 18px; margin-bottom: 22px;
}
.import-bar__label { font-size: 13px; color: var(--ink); font-weight: 500; }
.import-bar__label span { color: var(--sage-deep); font-weight: 400; }
.import-bar__note { font-size: 12px; color: var(--sage-deep); margin: -14px 0 22px; }

.soc-card {
    background: var(--white, #fff);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 16px;
}
.soc-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.soc-card__name { font-family: 'Gilda Display', serif; font-size: 17px; font-weight: 500; color: var(--ink); }
.soc-card__empty { font-size: 13px; color: var(--sage-deep); margin: 4px 0 0; }
.tbl--nested { margin-top: 6px; table-layout: auto; }
.tbl--nested th, .tbl--nested td { font-size: 12.5px; padding: 10px 12px; white-space: nowrap; }
.tbl--nested td:first-child, .tbl--nested th:first-child { white-space: normal; }
.filter-bar label { font-size: 13px; color: var(--sage-deep); }

input[type=file] { font-size: 13px; }
select, .form-card input {
    padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
    font-family: inherit; font-size: 14px; background: var(--white); color: var(--ink);
}
select:focus, .form-card input:focus { outline: none; border-color: var(--sage-deep); }

.tbl-scroll { overflow-x: auto; border-radius: var(--radius); }
.tbl { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--sage-deep); background: #eef4f1; padding: 12px 16px; }
.tbl td { padding: 12px 16px; border-top: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.tbl__actions { display: flex; gap: 14px; align-items: center; justify-content: flex-end; }
.tbl__actions a { color: var(--sage-deep); text-decoration: none; font-size: 13px; }
.tbl__actions a:hover { color: var(--forest); }
.tbl__actions form { display: inline; }
.tbl__empty { text-align: center; color: var(--sage-deep); padding: 28px; }
.chip { display: inline-block; font-size: 12px; letter-spacing: .04em; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; color: var(--sage-deep); }
.link-danger { background: none; border: 0; color: #b3524b; font-size: 13px; cursor: pointer; padding: 0; font-family: inherit; }
.link-danger:hover { color: #8f3b35; }

.form-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; max-width: 520px; box-shadow: var(--shadow-soft); }
.form-card .field { margin-bottom: 16px; }
.form-card label { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--sage-deep); margin-bottom: 6px; }
.form-card input, .form-card select { width: 100%; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.flash--success { background: #e9f5ee; border: 1px solid #bfe0cd; color: #2d7d56; }
.flash--error { background: #fbecea; border: 1px solid #ecc7c2; color: #b3524b; }
.flash--warning { background: #fdf6ea; border: 1px solid #ecd9b0; color: #8a6a1f; }

/* ============================================================
   Formulaires Phase 2 : SMTP, rôles DOP, utilisateurs  (v0.7.0)
   ============================================================ */
.form-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form-two { grid-template-columns: 1fr; } }

.card-title { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--forest); font-weight: 600; margin-bottom: 12px; }
.card-title__hint { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--sage-deep); font-size: 12px; }
.hint { font-size: 12px; color: var(--sage-deep); margin-top: 6px; }

.check-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; max-height: 260px; overflow: auto; padding: 4px 2px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.check-list--inline { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); max-height: none; }
@media (max-width: 560px) { .check-list { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--sage-deep); }
.check em { font-style: normal; color: var(--sage-deep); font-size: 12px; }

.switch { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--sage-deep); }

.multi { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; background: var(--white); }
.multi option { padding: 4px 6px; }

.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-right: 4px; }
.badge--admin { background: var(--forest); color: var(--sage); }
.badge--dop { background: var(--sage-16); color: var(--forest); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.dot--on { background: #2d7d56; }
.dot--off { background: #b3524b; }
.tbl__muted { color: var(--sage-deep); }

/* Champ de filtre au-dessus des listes à cocher (v0.8.3) */
.list-filter { width: 100%; margin-bottom: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; font-size: 13px; background: var(--white); }
.list-filter:focus { outline: none; border-color: var(--sage-deep); }

/* Benchmark (v0.11.0) */
.bench-cards { display: flex; gap: 16px; flex-wrap: wrap; }
.run-output { background: var(--forest); color: #cfe3dc; padding: 14px 16px; border-radius: 10px; font-size: 12.5px; line-height: 1.5; overflow: auto; max-height: 340px; white-space: pre-wrap; word-break: break-word; }

/* ============================================================
   Onglets d'import Benchmark (CSV vs API)   (v0.17.0)
   ============================================================ */
.imp-toprow { display: flex; gap: 24px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-top: 8px; }
.imp-tabs { display: flex; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line); flex: 1; min-width: 320px; }
.imp-tab {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 12px 18px; font-size: 14px; color: var(--sage-deep);
    border: 1px solid transparent; border-bottom: 0; border-radius: 12px 12px 0 0;
    position: relative; top: 1px; user-select: none;
}
.imp-tab .dot { width: 9px; height: 9px; border-radius: 50%; }
.imp-tab--csv .dot  { background: #378ADD; }   /* bleu   = CSV Budget */
.imp-tab--api .dot  { background: #1D9E75; }   /* vert   = API Qotid */
.imp-tab--paye .dot { background: #E08A1E; }   /* orange = Paye */
.imp-tab--fx .dot   { background: #8A6BB1; }   /* violet = Taux de change */
.imp-tab--codes .dot { background: #C0563E; }  /* terracotta = codes non reconnus */
.imp-tab--anomalies .dot { background: #1C6B4A; }  /* vert foncé = vérification CSV */
.imp-tab--files .dot { background: #4A6D82; }  /* bleu-gris = explorateur fichiers */
.imp-tab--integration .dot { background: #B5884A; }  /* ocre = intégration */
.imp-tab--rapportca .dot { background: #7A9E5B; }  /* vert clair = rapport CA */
.imp-tab--comptasearch .dot { background: #9E7A5B; }  /* brun = compta search */
.imp-badge {
    display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px;
    border-radius: 9px; background: #C0563E; color: #fff;
    font-size: 11px; line-height: 17px; text-align: center; font-weight: 600;
}
.imp-tab:hover { color: var(--forest); }

/* Tiroir « Configuration avancée » : onglets peu utilisés, repliés par défaut. */
.imp-more { flex-basis: 100%; margin-top: 2px; }
.imp-more__btn {
    cursor: pointer; user-select: none; list-style: none;
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--text2); padding: 6px 4px;
}
.imp-more__btn::-webkit-details-marker { display: none; }
.imp-more__chev { font-size: 10px; transition: transform .15s ease; }
.imp-more[open] .imp-more__chev { transform: rotate(180deg); }
.imp-more__tabs {
    display: flex; gap: 8px; flex-wrap: wrap;
    padding: 6px 0 2px; margin-top: 2px;
    border-top: 1px dashed var(--line);
}

#tab-csv:checked  ~ .imp-toprow .imp-tab--csv,
#tab-api:checked  ~ .imp-toprow .imp-tab--api,
#tab-paye:checked ~ .imp-toprow .imp-tab--paye,
#tab-codes:checked ~ .imp-toprow .imp-tab--codes,
#tab-anomalies:checked ~ .imp-toprow .imp-tab--anomalies,
#tab-files:checked ~ .imp-toprow .imp-tab--files,
#tab-integration:checked ~ .imp-toprow .imp-tab--integration,
#tab-rapportca:checked ~ .imp-toprow .imp-tab--rapportca,
#tab-comptasearch:checked ~ .imp-toprow .imp-tab--comptasearch,
#tab-fx:checked   ~ .imp-toprow .imp-tab--fx {
    background: var(--white); color: var(--forest);
    border-color: var(--line); border-bottom: 1px solid var(--white);
}

.imp-panel { display: none; padding-top: 22px; }
#tab-csv:checked  ~ .imp-panel--csv,
#tab-api:checked  ~ .imp-panel--api,
#tab-paye:checked ~ .imp-panel--paye,
#tab-codes:checked ~ .imp-panel--codes,
#tab-anomalies:checked ~ .imp-panel--anomalies,
#tab-files:checked ~ .imp-panel--files,
#tab-integration:checked ~ .imp-panel--integration,
#tab-rapportca:checked ~ .imp-panel--rapportca,
#tab-comptasearch:checked ~ .imp-panel--comptasearch,
#tab-fx:checked   ~ .imp-panel--fx { display: block; }

.tab-accent {
    max-width: 680px; font-size: 12.5px; padding: 10px 14px; border-radius: 10px;
    margin-bottom: 16px; border: 1px solid;
}
.tab-accent--csv  { background: #eaf1fb; border-color: #cfe0f6; color: #185FA5; }
.tab-accent--codes { background: #fbeeea; border-color: #f2d3c9; color: #A03E28; max-width: 920px; }
.tab-accent--api  { background: #e6f5ee; border-color: #c5e6d5; color: #0F6E56; }
.tab-accent--paye { background: #fdf1e2; border-color: #f6dcbb; color: #9A5B12; }
.tab-accent--fx   { background: #f2edf8; border-color: #e0d3ef; color: #5E4382; }
.tab-accent--files { background: #eef2f5; border-color: #d5e0e8; color: #35586B; max-width: 920px; }
.tab-accent--integration { background: #faf3e6; border-color: #eeddbe; color: #7A5A1C; max-width: 920px; }
.tab-accent--rapportca { background: #eff5ea; border-color: #d9e6cd; color: #4A6B33; max-width: 920px; }
.tab-accent--comptasearch { background: #f6efe9; border-color: #e6d6c8; color: #6B4A33; max-width: 920px; }
.imp-badge--run  { background: #378ADD; }
.imp-badge--warn { background: #E08A1E; }

/* ── Bandeau de progression d'une intégration en arrière-plan (v0.69.0) ──
   Réutilisé pour le job Benchmark (onglet Intégration) et le job RH (onglet Paye). */
.job-box {
    background: var(--forest); border: 1px solid var(--line-dk); border-radius: var(--radius);
    padding: 16px 18px; color: var(--paper); transition: opacity .15s ease;
}
/* Utilitaire générique (pas seulement .job-box) : masquer un élément sans le retirer du DOM. */
.is-hidden { display: none !important; }
.job-box__head { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 500; }
.job-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sage-deep); flex: none; }
.job-dot--run  { background: #E0A83C; box-shadow: 0 0 0 3px rgba(224,168,60,.25); animation: job-pulse 1.4s ease-in-out infinite; }
.job-dot--done { background: #4FAE7A; }
.job-dot--error { background: #C8564C; }
@keyframes job-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.job-box__head #job-count, .job-box__head [id$="-count"] { margin-left: auto; font-size: 12px; }
.job-bar { height: 6px; border-radius: 4px; background: rgba(255,255,255,.14); margin-top: 12px; overflow: hidden; }
.job-bar__fill { height: 100%; background: var(--sage); border-radius: 4px; transition: width .5s ease; }
.job-msg { font-size: 12.5px; color: var(--sage); margin-top: 8px; min-height: 1.2em; }
.job-box .hint { color: rgba(243,247,245,.65); }
.job-box .btn--ghost-dark { border-color: rgba(243,247,245,.35); color: var(--paper); }
.job-box .btn--ghost-dark:hover { border-color: var(--sage); color: var(--sage); }
.job-box .run-output {
    background: rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.08); border-radius: 8px;
    padding: 10px 12px; color: rgba(243,247,245,.85); overflow-y: auto;
}

/* ── Mise en page responsive de l'écran d'import (v0.42.0) ── */
.imp-grid {
    display: grid; gap: 18px; align-items: start;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    max-width: 1460px;
}
/* Les cartes portent des largeurs/marges en style inline (héritage) : la grille reprend la main. */
.imp-grid > * { max-width: none !important; margin-top: 0 !important; margin-bottom: 0 !important; }
.imp-panel .tbl { width: 100%; }
.imp-panel .tbl-scroll, .imp-panel .form-card { overflow-x: auto; }

@media (max-width: 900px) {
    .imp-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .imp-toprow { flex-direction: column-reverse; align-items: stretch; gap: 14px; }
    .sync-cal { min-width: 0; }
    .imp-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
    .imp-tabs::-webkit-scrollbar { height: 4px; }
    .imp-tab { white-space: nowrap; padding: 10px 14px; font-size: 13px; }
    .imp-panel { padding-top: 16px; }
    .periode-row { flex-direction: column; align-items: stretch; }
    .periode-row .field { max-width: none !important; min-width: 0; width: 100%; }
    .annee-filter { width: 100%; }
    .form-two { display: block; }
    .form-two .field + .field { margin-top: 12px; }
    .tab-accent { max-width: none; }
    .explo-per > summary { flex-wrap: wrap; }
    .explo-zip { margin-left: 0; }
}

/* ── Explorateur de fichiers déposés (v0.38.0, refondu v0.48.0) ── */
/* Les dépôts s'empilent en pleine largeur : les tableaux de fichiers ont besoin
   de place, une grille multi-colonnes les rendait illisibles. */
.imp-panel--files .imp-grid { grid-template-columns: 1fr; max-width: 1100px; }
.explo-card { max-width: none !important; }
.explo-per { border-top: 1px solid var(--line); padding: 6px 0; }
.explo-per:first-of-type { border-top: 0; }
.explo-per > summary {
    cursor: pointer; display: flex; align-items: center; gap: 10px;
    font-size: 13.5px; color: var(--forest); padding: 6px 2px; border-radius: 6px;
}
.explo-per > summary:hover { background: var(--paper); }
.explo-per[open] > summary { font-weight: 500; }
.explo-zip { margin-left: auto; font-size: 12px; color: var(--sage-deep); white-space: nowrap; }

/* Barre d'actions compacte, alignée à droite sous la période ouverte. */
.explo-actions {
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    justify-content: flex-end; padding: 6px 2px; font-size: 12.5px;
}
.explo-actions form { display: flex; align-items: center; gap: 10px; }
.explo-actions__opt { display: flex; align-items: center; gap: 5px; color: var(--sage-deep); cursor: pointer; }
.explo-link {
    background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit;
    font-size: 12.5px; color: var(--sage-deep); text-decoration: underline;
}
.explo-link:hover { color: var(--forest); }
.explo-link--danger { color: #b3524b; }
.explo-link--danger:hover { color: #8f3b35; }
.chip--budget { background: #378ADD; color: #fff; }

/* Tableau des fichiers : largeurs fixes, nom tronqué proprement (titre au survol). */
.explo-tbl { table-layout: fixed; width: 100%; margin-top: 6px; font-size: 12.5px; }
.explo-tbl th, .explo-tbl td { padding: 7px 10px; }
.explo-tbl .num { text-align: right; }
.explo-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 760px) {
    .explo-tbl { font-size: 12px; }
    .explo-tbl th:nth-child(3), .explo-tbl td:nth-child(3) { display: none; }
    .explo-actions { justify-content: flex-start; }
}

.anomaly-badge { color:#fff; font-size:10px; font-weight:600; padding:2px 9px; border-radius:10px; text-transform:uppercase; letter-spacing:.03em; }
.anomaly-summary { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.imp-soon { opacity: .85; }

/* ── Calendrier de suivi des synchronisations (v0.26.0) ── */
.sync-cal { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; min-width: 300px; }
.sync-cal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.sync-cal__title { font-size: 12px; font-weight: 600; color: var(--forest); letter-spacing: .02em; }
.sync-cal__year { font-size: 13px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper, #fff); color: var(--forest); cursor: pointer; }
.sync-cal__grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.cal-cell {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    padding: 7px 4px 6px; border: 1px solid var(--line); border-radius: 8px;
    background: #fafbfa; cursor: default; transition: border-color .15s, background .15s;
}
.cal-cell.has { background: #fff; border-color: #cfe0d6; }
.cal-cell:hover { border-color: var(--sage-deep); }
.cal-m { font-size: 11px; font-weight: 600; color: var(--sage-deep); }
.cal-cell.has .cal-m { color: var(--forest); }
.cal-dots { display: flex; gap: 3px; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; background: #e2e6e3; box-shadow: inset 0 0 0 1px #d3d8d4; }
.cal-dot.on { box-shadow: none; }
.cal-dot--budget.on { background: #378ADD; }
.cal-dot--api.on    { background: #1D9E75; }
.cal-dot--paye.on   { background: #E08A1E; }
.sync-cal__legend { display: flex; gap: 14px; margin-top: 10px; font-size: 11px; color: var(--sage-deep); }
.sync-cal__legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.lg--budget { background: #378ADD; }
.lg--api    { background: #1D9E75; }
.lg--paye   { background: #E08A1E; }
.cal-cell { outline: none; }
.cal-cell:focus { border-color: var(--sage-deep); }
.cal-tip {
    position: absolute; z-index: 1000; pointer-events: none;
    background: #22302B; color: #F3F7F5; border-radius: 9px;
    padding: 9px 12px; font-size: 12px; line-height: 1.5;
    box-shadow: 0 6px 20px rgba(0,0,0,.22); min-width: 150px;
    opacity: 0; transform: translateY(3px); transition: opacity .12s, transform .12s;
}
.cal-tip.on { opacity: 1; transform: translateY(0); }
.cal-tip__t { font-weight: 700; margin-bottom: 5px; font-size: 12.5px; }
.cal-tip__r { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.cal-tip__r i { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cal-tip__r b { font-weight: 600; }
.cal-tip__none { color: #9fb4ad; font-style: italic; }

/* ── Taux de change EUR/CHF (v0.27.0) ── */
.fx-years { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 18px; }
.fx-year {
    padding: 6px 14px; border: 1px solid var(--line); border-radius: 20px;
    font-size: 13px; color: var(--sage-deep); text-decoration: none; background: #fff; transition: all .15s;
}
.fx-year:hover { border-color: var(--sage-deep); color: var(--forest); }
.fx-year.on { background: var(--forest); border-color: var(--forest); color: #fff; }
.fx-addyear { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; }
.fx-addyear input { width: 92px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.fx-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 4px; }
@media (max-width: 640px) { .fx-grid { grid-template-columns: repeat(2, 1fr); } }
.fx-cell { display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fafbfa; position: relative; }
.fx-cell--bce { background: #f2edf8; border-color: #e0d3ef; }
.fx-cell label { font-size: 11px; font-weight: 600; color: var(--sage-deep); }
.fx-cell input { border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; font-size: 14px; color: var(--forest); background: #fff; }
.fx-cell input:focus { outline: none; border-color: var(--sage-deep); }
.fx-src { position: absolute; top: 7px; right: 9px; font-size: 8.5px; letter-spacing: .04em; text-transform: uppercase; color: #8A6BB1; font-weight: 700; }
.fx-cell:not(.fx-cell--bce) .fx-src { color: var(--sage-deep); font-weight: 600; }

/* ── Filtres d'affectation utilisateur (v0.28.0) ── */
.aff-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 6px; }
.aff-filters .aff-search { flex: 1 1 220px; min-width: 200px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.aff-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 10px; }

/* Menu déroulant multi-sélection (cases à cocher) des filtres établissement */
.aff-dd { position: relative; }
.aff-dd__btn { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; color: var(--forest); cursor: pointer; font-family: inherit; white-space: nowrap; }
.aff-dd__btn:hover { border-color: var(--sage-deep); }
.aff-dd.open .aff-dd__btn, .aff-dd.has-sel .aff-dd__btn { border-color: var(--sage-deep); background: var(--paper); }
.aff-dd__menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; width: max-content; min-width: 230px; max-width: 320px; max-height: 260px; overflow-y: auto; overflow-x: hidden; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); padding: 6px; box-sizing: border-box; }
.aff-dd.open .aff-dd__menu { display: block; }
.aff-dd__menu-actions { display: flex; justify-content: space-between; gap: 8px; padding: 2px 6px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.aff-dd__menu-actions button { background: none; border: none; color: var(--sage-deep); font-size: 11.5px; cursor: pointer; font-family: inherit; padding: 0; text-decoration: underline; }
.aff-dd__opt { display: flex; align-items: flex-start; gap: 8px; padding: 5px 8px; font-size: 13px; border-radius: 6px; cursor: pointer; white-space: normal; }
.aff-dd__opt:hover { background: var(--paper); }
.aff-dd__opt input { margin: 3px 0 0; flex: 0 0 auto; }
.aff-dd__opt span { word-break: break-word; }
.btn--sm { padding: 5px 12px; font-size: 12px; }
#aff-count { margin-left: auto; font-size: 12px; }

/* ─── Copilote MIA (bulle flottante) ────────────────────────── */
#mia-widget { position: fixed; right: 22px; bottom: 22px; z-index: 500; }
#mia-fab {
    width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--white); color: var(--sage);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 20px rgba(27,38,33,.28);
    position: relative; transition: transform .15s ease;
    padding: 0;
}
#mia-fab img { width: 34px; height: 34px; object-fit: contain; }
#mia-fab:hover { transform: translateY(-2px); }
.mia-fab__dot {
    position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%;
    background: #00FFAB; box-shadow: 0 0 0 2px var(--forest);
}
.mia-panel {
    position: absolute; right: 0; bottom: 68px; width: 360px; max-width: calc(100vw - 44px);
    height: 480px; max-height: 70vh; background: var(--white); border-radius: 16px;
    box-shadow: 0 12px 40px rgba(27,38,33,.24); display: flex; flex-direction: column; overflow: hidden;
}
/* Spécificité supérieure à `.mia-panel { display: flex }` : sans cette règle, l'attribut
   `hidden` posé par le JS (bouton fermer, état replié) n'a aucun effet visuel. */
.mia-panel[hidden] { display: none; }
.mia-panel__head {
    background: var(--forest); color: var(--white); padding: 10px 16px;
    display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.mia-panel__head > div { flex: 1; }
.mia-panel__logo { width: 34px; height: 34px; object-fit: contain; background: var(--white); border-radius: 50%; padding: 3px; flex-shrink: 0; }
.mia-panel__head strong { color: #00FFAB; letter-spacing: .02em; }
.mia-panel__sub { display: block; font-size: 11px; color: var(--sage); opacity: .85; }
#mia-close, #mia-reset { background: none; border: none; color: var(--sage); font-size: 20px; line-height: 1; cursor: pointer; flex-shrink: 0; }
#mia-reset { font-size: 15px; }
#mia-close:hover, #mia-reset:hover { color: var(--white); }
.mia-thread { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.mia-msg { font-size: 13.5px; line-height: 1.5; padding: 9px 12px; border-radius: 12px; max-width: 88%; white-space: pre-wrap; }
.mia-msg--bot { background: var(--paper); color: var(--ink); align-self: flex-start; border-bottom-left-radius: 4px; }
.mia-msg--user { background: var(--forest); color: var(--white); align-self: flex-end; border-bottom-right-radius: 4px; }
.mia-msg--pending::after { content: '…'; opacity: .5; }
.mia-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); flex-shrink: 0; }
.mia-form textarea {
    flex: 1; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
    font-family: inherit; font-size: 13px; max-height: 120px;
}
.mia-form button {
    width: 36px; height: 36px; flex-shrink: 0; border: none; border-radius: 10px;
    background: var(--forest); color: #00FFAB; cursor: pointer; font-size: 14px;
}
.mia-form button:hover { background: var(--forest-2); }
@media (max-width: 480px) {
    #mia-widget { right: 12px; bottom: 12px; }
    .mia-panel { width: calc(100vw - 24px); right: -10px; }
}

/* ============================================================
   Aération visuelle : toast, bannière rappel, compagnon,
   états vides, anneaux SVG   (v0.79.0)
   Inspiré d'une réflexion UX partagée par Pedro (fichier "Cockpit 90
   jours") : palette pastel plutôt qu'aplats, ombres douces, ton engageant.
   ============================================================ */

/* ─── Toast (notification non bloquante, remplace alert()) ──────────── */
#mc-toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(16px);
    background: var(--forest); color: var(--paper); padding: 13px 22px; border-radius: 999px;
    font-size: 14px; font-weight: 500; box-shadow: var(--shadow-hover);
    opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
    z-index: 900; max-width: min(92vw, 520px); text-align: center;
}
#mc-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
#mc-toast.mc-toast--error { background: var(--corail); }
#mc-toast.mc-toast--ok { background: var(--ok); }

/* ─── Bannière de rappel contextuelle (ex. "pense à sauvegarder") ────── */
.reminder-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    background: var(--safran-16); border: 1px solid rgba(224,168,60,.35); color: #6b4f0d;
    border-radius: var(--radius); padding: 12px 18px; margin-bottom: 18px; font-size: 13.5px; font-weight: 500;
}
.reminder-banner strong { font-weight: 700; }

/* ─── États vides, ton engageant (remplace un tableau/écran nu) ──────── */
.empty-friendly {
    text-align: center; padding: 38px 24px; color: var(--sage-deep);
    background: var(--sage-08); border: 1px dashed var(--line); border-radius: var(--radius-lg);
    font-size: 14px; line-height: 1.6;
}
.empty-friendly strong { color: var(--forest); }

/* ─── Modale légère (bouton Support, etc.) ───────────────────────────── */
.mc-modal-overlay {
    position: fixed; inset: 0; background: rgba(27,38,33,.45); display: none;
    align-items: center; justify-content: center; z-index: 850; padding: 20px;
}
.mc-modal-overlay.is-open { display: flex; }
.mc-modal-box {
    background: var(--white); border-radius: var(--radius-lg); padding: 26px 28px; max-width: 480px;
    width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-hover);
}
.mc-modal-box h2 { font-size: 20px; margin: 0 0 6px; }
.mc-modal-box .hint { margin: 0 0 16px; }
.mc-modal-box textarea {
    width: 100%; min-height: 120px; padding: 10px 12px; border: 1px solid var(--line);
    border-radius: var(--radius-sm); font-family: inherit; font-size: 14px; resize: vertical; color: var(--ink);
}
.mc-modal-box select { margin-bottom: 12px; }
.mc-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ─── Anneaux de progression SVG (remplacent certaines barres plates) ── */
.ring-value { font-family: 'Gilda Display', serif; font-weight: 400; fill: var(--forest); }
.ring-wrap { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; }
.ring-label { font-size: 12px; color: var(--sage-deep); text-align: center; }
