/* Domea Trésorerie — charte Domea (Poppins / Cormorant Garamond, anthracite #242424, cuivre #B8875A, or #E6CC9F)
   déclinée en « cockpit » sombre, pour que la trésorerie se distingue des autres outils. */
:root {
  --nuit: #141312; --fond: #1B1A19; --surface: #232120; --surface-2: #2B2826; --surface-3: #34302D;
  --ligne: #3A3532; --ligne-douce: #2E2A28;
  --texte: #F3EEE8; --texte-2: #B9B0A7; --texte-3: #857C74;
  --cuivre: #B8875A; --or: #E6CC9F; --or-fonce: #8E6740;
  --or-degrade: linear-gradient(100deg, #9c7246 0%, #f0dbb3 40%, #c4945f 65%, #f3dfb8 88%);
  --vert: #8FC79A; --vert-fond: #8FC79A1F; --rouge: #E8826F; --rouge-fond: #E8826F1F;
  --orange: #E8B06A; --orange-fond: #E8B06A1F; --bleu: #9DB4C4; --bleu-fond: #9DB4C41A;
  --rayon: 14px;
  --texte-f: "Poppins", "Segoe UI", system-ui, sans-serif;
  --titre-f: "Cormorant Garamond", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fond); color: var(--texte); font-family: var(--texte-f); font-size: 14px; line-height: 1.5; font-weight: 300; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
b, strong { font-weight: 600; }
a { color: var(--or); }
h2 { font-family: var(--titre-f); font-weight: 600; font-size: 21px; margin: 0 0 12px; color: var(--texte); letter-spacing: .01em; }
::selection { background: #b8875a55; }

/* ---------- marque ---------- */
.monogramme { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-family: var(--titre-f); font-weight: 700; font-size: 24px; color: #1B1A19; background: var(--or-degrade); flex: none; box-shadow: 0 6px 18px #b8875a40; }
.monogramme.grand { width: 64px; height: 64px; font-size: 40px; border-radius: 18px; margin-bottom: 18px; }
.logo { font-family: var(--titre-f); font-size: 40px; font-weight: 600; line-height: 1; }
.logo span { background: var(--or-degrade); -webkit-background-clip: text; background-clip: text; color: transparent; font-style: italic; }

/* ---------- connexion ---------- */
.login { min-height: 100vh; max-width: 420px; margin: 0 auto; padding: 14vh 24px 40px; }
.tagline { color: var(--texte-2); margin: 8px 0 34px; }
.label { display: block; font-weight: 500; font-size: 12px; color: var(--texte-2); text-transform: uppercase; letter-spacing: .08em; margin: 16px 0 7px; }
.aide { color: var(--texte-3); font-size: 12.5px; margin: 6px 0 12px; }
.erreur { color: var(--rouge); font-weight: 500; }

/* ---------- champs & boutons ---------- */
.field { width: 100%; padding: 11px 13px; border: 1px solid var(--ligne); border-radius: 10px; background: var(--nuit); font: inherit; color: var(--texte); color-scheme: dark; }
.field::placeholder { color: var(--texte-3); }
.field:focus { outline: none; border-color: var(--cuivre); box-shadow: 0 0 0 3px #b8875a2e; }
.field.mini { width: auto; padding: 8px 12px; }
textarea.field { resize: vertical; }
.btn { border: 1px solid var(--ligne); background: var(--surface-2); color: var(--texte); padding: 9px 15px; border-radius: 10px; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--cuivre); }
.btn-or { background: var(--or-degrade); border: 0; color: #1B1A19; font-weight: 600; box-shadow: 0 6px 20px #b8875a33; }
.btn-or:hover { filter: brightness(1.06); }
.btn-or span { font-weight: 600; }
.btn-danger { color: var(--rouge); border-color: #e8826f55; background: transparent; }
.btn.large { width: 100%; margin-top: 22px; padding: 13px; font-size: 15px; }
.btn.mini { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: wait; }

/* ---------- coque ---------- */
.coque { display: flex; min-height: 100vh; }
.rail { width: 236px; flex: none; background: var(--nuit); border-right: 1px solid var(--ligne-douce); display: flex; flex-direction: column; padding: 22px 14px; position: sticky; top: 0; height: 100vh; }
.marque { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.marque-nom { font-family: var(--titre-f); font-size: 24px; font-weight: 600; line-height: 1; }
.marque-sous { font-size: 11px; color: var(--or); letter-spacing: .18em; text-transform: uppercase; margin-top: 3px; }
.onglets { display: flex; flex-direction: column; gap: 3px; }
.onglets button { display: flex; align-items: center; gap: 12px; border: 0; background: none; font: inherit; font-weight: 400; color: var(--texte-2); padding: 10px 12px; border-radius: 10px; cursor: pointer; text-align: left; position: relative; }
.onglets button svg { width: 19px; height: 19px; flex: none; }
.onglets button:hover { background: var(--surface); color: var(--texte); }
.onglets button.actif { background: linear-gradient(90deg, #b8875a26, #b8875a08); color: var(--or); font-weight: 500; }
.onglets button.actif::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--or-degrade); }
.rail-pied { margin-top: auto; padding: 0 8px; }
.direct { font-size: 12px; color: var(--texte-3); display: inline-flex; align-items: center; gap: 8px; }
.direct .pastille { width: 8px; height: 8px; border-radius: 50%; background: var(--texte-3); }
.direct.on { color: var(--texte-2); }
.direct.on .pastille { background: var(--vert); box-shadow: 0 0 0 4px #8fc79a26; animation: pouls 2.4s infinite; }
@keyframes pouls { 50% { box-shadow: 0 0 0 7px #8fc79a00; } }

.principal { flex: 1; min-width: 0; }
.barre-haut { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 26px 32px 6px; max-width: 1280px; }
.barre-haut h1 { font-family: var(--titre-f); font-weight: 600; font-size: 38px; margin: 0; line-height: 1.05; }
.sur-titre { font-size: 11.5px; color: var(--or); text-transform: uppercase; letter-spacing: .16em; }
main { max-width: 1280px; padding: 18px 32px 40px; }

/* ---------- tableau de bord ---------- */
.cartes { display: grid; grid-template-columns: minmax(300px, 1.25fr) 2fr; gap: 16px; margin-bottom: 16px; }
.hero { position: relative; overflow: hidden; border-radius: 20px; padding: 24px 26px; background: radial-gradient(130% 120% at 0% 0%, #3a2f26 0%, #242120 55%, #1d1b1a 100%); border: 1px solid #4a3d33; }
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(#e6cc9f22, transparent 70%); pointer-events: none; }
.hero .k { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--or); }
.hero .v { font-family: var(--titre-f); font-weight: 600; font-size: 60px; line-height: 1.05; margin: 8px 0 4px; font-variant-numeric: lining-nums tabular-nums; background: var(--or-degrade); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .v.neg { background: none; color: var(--rouge); }
.hero .s { color: var(--texte-2); font-size: 12.5px; }
.hero .verdict { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 7px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500; background: #ffffff0d; }
.hero .verdict i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.carte { background: var(--surface); border: 1px solid var(--ligne-douce); border-radius: var(--rayon); padding: 15px 17px; position: relative; }
.carte .k { font-size: 11px; color: var(--texte-3); font-weight: 500; text-transform: uppercase; letter-spacing: .1em; }
.carte .v { font-family: var(--titre-f); font-size: 31px; font-weight: 600; margin-top: 4px; line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; }
.carte .s { font-size: 12px; color: var(--texte-3); margin-top: 3px; }
.carte.rouge .v { color: var(--rouge); } .carte.orange .v { color: var(--orange); } .carte.vert .v { color: var(--vert); }
.carte.rouge { border-color: #e8826f40; } .carte.orange { border-color: #e8b06a33; }

.panneau { background: var(--surface); border: 1px solid var(--ligne-douce); border-radius: var(--rayon); padding: 18px 20px; margin-bottom: 16px; }
.panneau.sans-marge { padding: 0; overflow: hidden; }
.panneau-tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.panneau-tete h2 { margin: 0; }
.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.grille-2 > .panneau { margin-bottom: 0; }
.grille-2 + .panneau, .grille-2 + div { margin-top: 16px; }
.bascule { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--texte-2); cursor: pointer; user-select: none; }
.bascule input { accent-color: var(--cuivre); }

/* ---------- graphe ---------- */
.graphe { position: relative; width: 100%; height: 320px; }
.graphe svg { width: 100%; height: 100%; display: block; }
.graphe .bulle { position: absolute; pointer-events: none; background: #0e0d0cf0; border: 1px solid var(--ligne); color: var(--texte); font-size: 12px; padding: 7px 10px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -115%); }
.graphe .bulle b { color: var(--or); }
.legende-graphe { font-size: 12px; color: var(--texte-3); margin: 8px 0 0; }
.legende-graphe span { display: inline-block; width: 18px; height: 3px; vertical-align: middle; border-radius: 2px; }
.l-reel { background: var(--or); } .l-pot { background: repeating-linear-gradient(90deg, var(--cuivre) 0 5px, transparent 5px 8px); } .l-seuil { background: repeating-linear-gradient(90deg, var(--rouge) 0 4px, transparent 4px 7px); }

/* ---------- listes ---------- */
.liste-ech { list-style: none; margin: 0; padding: 0; }
.liste-ech li { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--ligne-douce); cursor: pointer; border-radius: 6px; }
.liste-ech li:hover { background: var(--surface-2); }
.liste-ech li:last-child { border-bottom: 0; }
.liste-ech .d { width: 62px; flex: none; font-size: 12px; color: var(--texte-3); }
.liste-ech .t { flex: 1; min-width: 0; }
.liste-ech .t small { display: block; color: var(--texte-3); font-size: 11.5px; }
.liste-ech .m { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plus { color: var(--vert); } .moins { color: var(--texte); }
.alerte { display: block; padding: 10px 13px; border-radius: 10px; margin-bottom: 8px; font-size: 13px; border-left: 3px solid; }
.alerte b { color: inherit; }
.alerte.rouge { background: var(--rouge-fond); color: #f3b3a6; border-color: var(--rouge); }
.alerte.orange { background: var(--orange-fond); color: #f2cf9f; border-color: var(--orange); }
.alerte.vert { background: var(--vert-fond); color: #bfe0c5; border-color: var(--vert); }
.alerte.bleu { background: var(--bleu-fond); color: #c9d7e0; border-color: var(--bleu); }
.vide { color: var(--texte-3); font-size: 13px; padding: 10px 0; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--texte-3); font-weight: 500; padding: 11px 14px; border-bottom: 1px solid var(--ligne); background: var(--surface); position: sticky; top: 0; white-space: nowrap; }
.table th.num { text-align: right; }
.table td { padding: 9px 14px; border-bottom: 1px solid var(--ligne-douce); vertical-align: middle; }
.table td > small, .libelle small { display: block; color: var(--texte-3); font-size: 11.5px; }
.table tr.cliquable { cursor: pointer; }
.table tr.cliquable:hover td { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.num.neg { color: var(--rouge); font-weight: 500; }
.table tr.realise td { color: var(--texte-3); }
.table tr.realise td .libelle { text-decoration: line-through; text-decoration-color: #ffffff30; }
.table tr.retard td:first-child { color: var(--rouge); font-weight: 500; }
.table tr.potentiel td { background: #b8875a0d; }
.table tr.sep-mois td { background: var(--nuit); font-family: var(--titre-f); font-weight: 600; color: var(--or); font-size: 16px; padding: 8px 14px; letter-spacing: .02em; text-transform: capitalize; }
.badge { display: inline-block; font-size: 10.5px; font-weight: 500; padding: 1px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 1px; background: #ffffff12; color: var(--texte-2); }
.badge.pot { background: #b8875a2e; color: var(--or); }
.badge.est { background: var(--bleu-fond); color: var(--bleu); }
.badge.ret { background: var(--rouge-fond); color: var(--rouge); }
.badge.ok { background: var(--vert-fond); color: var(--vert); }
.cat { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; white-space: nowrap; color: var(--texte-2); }
.cat i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.btn-pointer { border: 1px solid var(--ligne); background: transparent; border-radius: 999px; padding: 3px 11px; font: inherit; font-size: 12px; font-weight: 500; color: var(--vert); cursor: pointer; white-space: nowrap; }
.btn-pointer:hover { background: var(--vert-fond); border-color: var(--vert); }
.btn-pointer.annuler { color: var(--texte-3); }

.barre-filtres { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.segment { display: inline-flex; background: var(--nuit); border: 1px solid var(--ligne-douce); border-radius: 10px; padding: 3px; }
.segment button { border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--texte-2); padding: 6px 13px; border-radius: 7px; cursor: pointer; }
.segment button.actif { background: var(--surface-3); color: var(--or); font-weight: 500; }
.segment.large { display: flex; margin-bottom: 4px; }
.segment.large button { flex: 1; padding: 9px; }
.segment.large button.entree.actif { color: var(--vert); }
.segment.large button.sortie.actif { color: var(--rouge); }
.pied { color: var(--texte-3); font-size: 12.5px; }

/* ---------- par mois ---------- */
.table-mois th:first-child, .table-mois td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; white-space: nowrap; }
.table-mois th:first-child { z-index: 2; }
.table-mois td.futur { background: #ffffff04; }
.table-mois th.courant { color: var(--or); }
.table-mois th.courant, .table-mois td.courant { background: #b8875a12; }
.table-mois tr.total td { font-weight: 500; border-top: 1px solid var(--ligne); }
.table-mois tr.solde td { font-family: var(--titre-f); font-size: 16px; font-weight: 600; background: var(--nuit); }
.table-mois tr.pot td { color: var(--cuivre); font-style: italic; }

/* ---------- imports ---------- */
.import h2 { font-size: 19px; }
.import .depot { display: block; border: 1px dashed #b8875a77; border-radius: 12px; text-align: center; padding: 16px; cursor: pointer; font-weight: 500; color: var(--or); background: #b8875a0a; transition: background .15s; }
.import .depot:hover { background: #b8875a1f; }
.import .depot input { display: none; }
.apercu { margin-top: 16px; }
.apercu select.field { padding: 6px 9px; font-size: 12.5px; }
.apercu .resume { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
.apercu .resume span { background: var(--surface-3); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; color: var(--texte-2); }
.ligne-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.ligne-form .field { flex: 1; min-width: 140px; }
.ligne-form label { color: var(--texte-2); font-size: 12px; }
.params { display: grid; gap: 12px; }
.params label, .modale label { display: block; font-size: 12px; color: var(--texte-2); }
.params label .field, .modale label .field { margin-top: 6px; }

/* ---------- fenêtres ---------- */
.voile { position: fixed; inset: 0; background: #0b0a09b8; backdrop-filter: blur(3px); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modale { background: var(--surface); border: 1px solid var(--ligne); border-radius: 18px; padding: 22px 24px; width: 100%; max-width: 580px; box-shadow: 0 30px 80px #000a; display: grid; gap: 13px; }
.modale.petite { max-width: 430px; }
.modale h2 { margin: 0; font-size: 26px; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.espace { flex: 1; }
.meta { font-size: 11.5px; color: var(--texte-3); margin: 0; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--surface-3); border: 1px solid var(--ligne); color: var(--texte); padding: 11px 18px; border-radius: 12px; font-weight: 500; z-index: 60; box-shadow: 0 12px 40px #0009; }
.toast.succes { border-color: var(--vert); color: var(--vert); } .toast.echec { border-color: var(--rouge); color: var(--rouge); }

/* ---------- mobile : barre d'onglets en bas ---------- */
@media (max-width: 860px) {
  .coque { display: block; }
  .rail { position: fixed; bottom: 0; top: auto; left: 0; right: 0; width: auto; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 30; border-right: 0; border-top: 1px solid var(--ligne); }
  .marque, .rail-pied { display: none; }
  .onglets { flex-direction: row; justify-content: space-around; width: 100%; gap: 0; }
  .onglets button { flex-direction: column; gap: 3px; font-size: 10px; padding: 6px 4px; flex: 1; align-items: center; text-align: center; }
  .onglets button.actif::before { left: 25%; right: 25%; top: -6px; bottom: auto; width: auto; height: 3px; }
  .principal { padding-bottom: 80px; }
  .barre-haut { padding: 18px 16px 4px; align-items: center; }
  .barre-haut h1 { font-size: 30px; }
  main { padding: 12px 14px 30px; }
  .cartes { grid-template-columns: 1fr; }
  .hero .v { font-size: 48px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .carte .v { font-size: 25px; }
  .deux { grid-template-columns: 1fr; }
  .grille-2 { grid-template-columns: 1fr; }
  .graphe { height: 250px; }
  .table { font-size: 12.5px; }
  .table td, .table th { padding: 8px 9px; }
  .col-cat { display: none; }
}
@media (max-width: 420px) { .onglets button span { font-size: 9px; } }
@media (max-width: 860px) {
  #btn-ajout { padding: 9px 14px; font-size: 18px; line-height: 1; }
  #btn-ajout .txt { display: none; }
  .barre-haut h1 { font-size: 27px; }
  .toast { bottom: 92px; }
  .onglets button.actif { background: transparent; }
}
