/* Compagnon Aromapassion · charte Aromapassion (Palette 12) :
   Rouge #F177A0 · Apricot #F6891F · Golden Grass #E3B723 · Chelsea Cucumber #77B65E
   Puerto Rico #39BFBC · Lavender Purple #8078B3 · Jumbo #818285 · Aluminium #A8AAAD */
:root {
  --primary: #39BFBC; --primary-dark: #23817F; --primary-pale: #E3F6F5;
  --accent: #8078B3; --vert: #77B65E;
  --bg: #F8FAFA; --surface: #fff; --border: #DCDDE0;
  --text: #1E3535; --muted: #4A6A6A;
  --danger: #D2557F; --danger-bg: #FDEEF3; --info-bg: #EEF6EA;
  --rose: #F177A0; --apricot: #F6891F; --gold: #E3B723; --jumbo: #818285; --alu: #A8AAAD;
  --radius: 14px; --shadow: 0 2px 10px rgba(30, 53, 53, .07);
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; line-height: 1.5; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; line-height: 1.25; }
h2 { font-size: 1.45rem; margin: .2rem 0 .4rem; color: var(--primary-dark); }
h3 { font-size: 1.1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); } .small { font-size: .86rem; }
[hidden] { display: none !important; }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: linear-gradient(160deg, var(--primary-pale), #F0EEF8 60%, #FDEEF3); }
.login-card { background: var(--surface); max-width: 420px; width: 100%; padding: 2rem; border-radius: 20px; box-shadow: var(--shadow); text-align: center; }
.login-logo { width: 190px; height: 190px; display: block; margin: 0 auto; }
.login-card h1 { color: var(--primary-dark); margin: .6rem 0 .3rem; font-size: 1.5rem; }
.login-card form { display: grid; gap: .6rem; text-align: left; margin-top: 1.2rem; }
.login-msg { min-height: 1.4em; font-weight: 500; }

/* Barre et onglets */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; }
.brand img { border-radius: 50%; }
.brand b { color: var(--primary-dark); }
.top-actions { display: flex; gap: .4rem; }
.tabs { position: sticky; top: 53px; z-index: 4; display: flex; gap: .3rem; overflow-x: auto; padding: .5rem 1rem;
  background: var(--bg); border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tab { flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: .45rem .9rem;
  border-radius: 999px; font-size: .95rem; cursor: pointer; }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
main { max-width: 960px; margin: 0 auto; padding: 1rem; }
.panel { display: none; } .panel.active { display: block; }

/* Éléments */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin: .9rem 0; box-shadow: var(--shadow); }
.card h3:first-child { margin-top: 0; }
.scroll { overflow-x: auto; }
.btn { background: var(--primary); color: #fff; border: 0; border-radius: 10px; padding: .65rem 1rem; font-weight: 600; font-size: 1rem; cursor: pointer; }
.btn:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border: 1px solid var(--primary); color: var(--primary-dark); border-radius: 10px; padding: .4rem .8rem; cursor: pointer; font-size: .92rem; }
.btn-x { border: 0; background: #F1F4F4; color: var(--muted); width: 2rem; height: 2rem; border-radius: 8px; font-size: 1.2rem; cursor: pointer; flex: 0 0 auto; }
.lien { border: 0; background: none; color: var(--primary-dark); font-weight: 600; cursor: pointer; padding: 0; text-align: left; font-size: 1rem; }
input, select { font: inherit; padding: .55rem .65rem; border: 1px solid #BFD9D8; border-radius: 10px; background: #fff; color: var(--text); width: 100%; }
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
label { display: grid; gap: .25rem; font-size: .92rem; color: var(--muted); }
.row { display: flex; gap: .8rem; flex-wrap: wrap; margin: .6rem 0; }
.row > * { flex: 1 1 180px; }
.search { margin: .4rem 0 1rem; }

/* Fiches */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .7rem; }
.he-card { position: relative; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .9rem 1rem; cursor: pointer; display: grid; gap: .15rem; box-shadow: var(--shadow); font: inherit; color: inherit; }
.he-card:hover { border-color: var(--primary); }
.he-nom { font-weight: 700; font-size: 1.02rem; padding-right: 1.2rem; }
.he-latin { font-style: italic; color: var(--muted); font-size: .9rem; }
.he-fam { font-size: .8rem; color: var(--accent); }
.pastille { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; vertical-align: middle; }
.he-card .pastille { position: absolute; top: 1rem; right: 1rem; }
.tag { display: inline-block; color: #fff; font-size: .8rem; padding: .15rem .55rem; border-radius: 999px; margin: 0 .2rem .2rem 0; }
.tag.ghost { background: var(--primary-pale); color: var(--primary-dark); }
dialog { border: 0; border-radius: 18px; padding: 1.4rem; max-width: 640px; width: calc(100% - 1.5rem); max-height: 88vh; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(30, 53, 53, .45); }
dialog h2 { margin-top: 0; }

/* Listes et tableaux */
.puces { padding-left: 1.1rem; margin: .3rem 0; } .puces li { margin: .25rem 0; }
.puces.warn li::marker { color: var(--danger); }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { border-bottom: 1px solid var(--border); padding: .5rem .45rem; text-align: left; vertical-align: middle; }
.tbl thead th { background: var(--primary-pale); color: var(--primary-dark); }
.tbl tbody th { color: var(--primary-dark); white-space: nowrap; }
.mnemo { list-style: none; padding: 0; margin: .4rem 0; display: grid; gap: .35rem; }
.mnemo li { display: flex; gap: .6rem; align-items: baseline; }
.lettre { flex: 0 0 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; margin: .6rem 0; }
.kpis div { background: var(--primary-pale); border-radius: 12px; padding: .7rem; text-align: center; display: grid; }
.kpis b { font-size: 1.4rem; color: var(--primary-dark); }
.kpis span { font-size: .85rem; color: var(--muted); }
.note { background: #F0EEF8; border-left: 4px solid var(--accent); padding: .7rem .9rem; border-radius: 8px; }

/* Atelier */
.at-ligne { display: flex; gap: .5rem; align-items: center; margin: .45rem 0; }
.at-ligne select { flex: 1 1 auto; }
.at-ligne .pct { display: flex; align-items: center; gap: .3rem; flex: 0 0 6.5rem; color: var(--text); }
.alert { background: var(--danger-bg); border-left: 4px solid var(--danger); padding: .6rem .9rem; border-radius: 8px; margin: .7rem 0; }
.info { background: var(--info-bg); border-left: 4px solid var(--vert); padding: .6rem .9rem; border-radius: 8px; margin: .7rem 0; }
.alert ul, .info ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.liste { list-style: none; padding: 0; } .liste li { display: flex; gap: .6rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.liste li .muted { flex: 1 1 200px; }
.syn { border-bottom: 1px solid var(--border); padding: .6rem 0; } .syn:last-child { border: 0; }
.syn p { margin: .25rem 0; }
.syn-head { display: flex; justify-content: space-between; gap: .6rem; align-items: center; flex-wrap: wrap; }

.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 1rem 2.5rem; }
@media (max-width: 520px) { h2 { font-size: 1.25rem; } .card { padding: .9rem; } main { padding: .7rem; } }

/* Nouveau totum */
.fam-bar { display: flex; height: 22px; border-radius: 11px; overflow: hidden; margin: .6rem 0; background: #eee; }
.fam-bar span { display: block; height: 100%; }
.fam-leg { list-style: none; padding: 0; margin: .3rem 0 .8rem; display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .9rem; }
.fam-leg i, .dot { display: inline-block; width: .75rem; height: .75rem; border-radius: 3px; margin-right: .35rem; vertical-align: middle; }
.tbl .n { text-align: right; white-space: nowrap; }
.tbl.mol tr.pick { cursor: pointer; } .tbl.mol tr.pick:hover td { background: #F5F7F7; }
.tbl.mol tr.sel td { background: var(--primary-pale); font-weight: 600; }
.calc { background: #F0EEF8; border-left: 4px solid var(--accent); padding: .6rem .9rem; border-radius: 8px; margin: .7rem 0; font-size: .92rem; }
textarea { font: inherit; width: 100%; padding: .55rem .65rem; border: 1px solid #BFD9D8; border-radius: 10px; }
details summary { cursor: pointer; }
.totum-top { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; margin: .6rem 0; }
.donut { width: 150px; height: 150px; border-radius: 50%; position: relative; flex: 0 0 150px; }
.donut > div { position: absolute; inset: 30px; background: #fff; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut b { font-size: 1.6rem; line-height: 1; } .donut span { font-size: .8rem; color: var(--muted); }
.totum-top .fam-leg { flex: 1 1 200px; flex-direction: column; gap: .25rem; }
.fam-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .7rem; margin: .7rem 0; }
.fam-card { border: 1px solid var(--border); border-left: 6px solid var(--c); border-radius: 10px; padding: .6rem .8rem; background: color-mix(in srgb, var(--c) 7%, #fff); }
.fam-head { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.fam-name { font-weight: 700; text-transform: capitalize; } .fam-name i { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-right: .4rem; vertical-align: middle; }
.fam-gauge { height: 8px; background: #fff; border-radius: 4px; overflow: hidden; margin: .4rem 0; } .fam-gauge span { display: block; height: 100%; }
.fam-eff { margin: .3rem 0; font-size: .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0; }
.chip { background: #fff; border: 1px solid color-mix(in srgb, var(--c) 45%, #fff); border-radius: 999px; padding: .1rem .55rem; font-size: .8rem; }
.tampon { background: #fff; border: 1px dashed var(--c); border-radius: 8px; padding: .4rem .6rem; margin-top: .4rem; font-size: .85rem; }
.tampon-par { font-size: .82rem; color: var(--muted); margin-top: .35rem; }
.mol-det { margin: .6rem 0; } .mol-det summary { padding: .4rem 0; }
.actions { flex: 1 1 200px; border: 1px solid var(--border); border-radius: 10px; padding: .55rem .75rem; background: #fff; }
.actions ul { list-style: none; padding: 0; margin: .4rem 0 .2rem; }
.actions li { position: relative; padding: .2rem .4rem; margin: .2rem 0; font-size: .9rem; border-radius: 6px; overflow: hidden; }
.actions li span { position: relative; z-index: 1; }
.actions li i { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, #39BFBC 22%, #fff); border-radius: 6px; }
.actions p { margin: .2rem 0 0; }
.mes h3 { margin: 0; }
.mes textarea { margin: .3rem 0 .5rem; }
#mes-q { width: 100%; padding: .55rem .65rem; border: 1px solid #BFD9D8; border-radius: 10px; font: inherit; }
.grid-titre { grid-column: 1 / -1; margin: .8rem 0 .1rem; font-size: 1rem; color: var(--primary, #2A9C99); }
#fiche .chip { display: inline-block; margin: .15rem .1rem; }
#fiche .chip .dot { width: .6rem; height: .6rem; }

/* Protection du contenu */
#filigrane { position: fixed; inset: 0; z-index: 900; pointer-events: none; background-repeat: repeat; }
#app { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#tab-mes, #app input, #app textarea, #app select { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
body.voile #app, body.voile dialog { filter: blur(14px); }
body.voile #app::after { content: ""; position: fixed; inset: 0; background: rgba(240, 244, 244, .55); }
@media print {
  body * { visibility: hidden !important; }
  body::before { content: "L'impression du Compagnon n'est pas disponible. Vos synergies s'impriment depuis l'onglet « Mes synergies »."; visibility: visible; display: block; padding: 2rem; font: 14px Arial, sans-serif; }
  body.print-mes::before { content: none; }
  body.print-mes #tab-mes, body.print-mes #tab-mes * { visibility: visible !important; }
  body.print-mes #tab-mes { position: absolute; left: 0; top: 0; width: 100%; }
  body.print-mes #tab-mes .row, body.print-mes #mes-q { display: none !important; }
  #filigrane { display: none; }
}
dialog#fiche { -webkit-user-select: none; user-select: none; background-image: var(--fili); background-repeat: repeat; }
.abo-box { margin: 1rem 0 .4rem; padding: .8rem .9rem; border: 1px solid #BFD9D8; border-radius: 12px; background: #F3FAFA; text-align: left; }
.abo-box p { margin: .3rem 0 .6rem; }
.abo-box .btn { display: inline-block; text-decoration: none; }
.acces-banner { background: #FFF4E8; border-bottom: 1px solid #F6891F; color: #6B3B00; padding: .55rem 1rem; font-size: .9rem; text-align: center; }
.acces-banner a { color: #B45A00; font-weight: 600; }

.who { display: inline-block; vertical-align: bottom; font-size: .85rem; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { align-items: center; }
@media (max-width: 560px) { .who { font-size: .72rem; max-width: 28vw; } }
.compte { position: relative; }
.compte-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 950; width: 270px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(30, 53, 53, .15); padding: .5rem; }
.compte-menu a, .compte-menu button { display: block; width: 100%; text-align: left; padding: .55rem .7rem; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: .95rem; text-decoration: none; cursor: pointer; }
.compte-menu a:hover, .compte-menu button:hover { background: var(--primary-pale); color: var(--primary-dark); }
.compte-mail { margin: .2rem .7rem .4rem; font-size: .8rem; color: var(--muted); word-break: break-all; }
.compte-aide { margin: 0 .7rem .4rem; font-size: .75rem; color: var(--muted); line-height: 1.35; }

/* Atelier : apports et couverture de l'objectif */
.couverture { list-style: none; padding: 0; margin: .5rem 0; }
.couverture li { padding: .35rem .6rem; border-radius: 8px; margin: .25rem 0; }
.couverture li.ok { background: #EAF6E4; color: #1E3535; }
.couverture li.manque { background: #FDF1E4; color: #1E3535; }
#at-apports .tbl td:first-child { width: 30%; vertical-align: top; }
#at-seule .n { text-align: right; }
